(direction, fn)
| 58 | } |
| 59 | |
| 60 | const 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 | |
| 81 | const renderDots = function(dotElems = []) { |
| 82 |