MCPcopy Create free account
hub / github.com/electerious/basicSlider / renderArrow

Function renderArrow

src/scripts/main.js:60–79  ·  view source on GitHub ↗
(direction, fn)

Source from the content-addressed store, hash-verified

58}
59
60const renderArrow = function(direction, fn) {
61
62 const elem = document.createElement('button')
63
64 // Only allow left and right arrows
65 direction = (direction === ARROW_LEFT ? 'left' : 'right')
66
67 // Add the default and direction class
68 elem.classList.add('basicSlider__arrow')
69 elem.classList.add(`basicSlider__arrow--${ direction }`)
70
71 // Bind click event
72 elem.onclick = (e) => {
73 fn()
74 stopEvent(e)
75 }
76
77 return elem
78
79}
80
81const renderDots = function(dotElems = []) {
82

Callers 1

initFunction · 0.85

Calls 1

stopEventFunction · 0.85

Tested by

no test coverage detected