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

Function renderSlider

src/scripts/main.js:29–58  ·  view source on GitHub ↗
(elem, refs, opts)

Source from the content-addressed store, hash-verified

27}
28
29const renderSlider = function(elem, refs, opts) {
30
31 const {
32 arrowLeftElem,
33 arrowRightElem,
34 dotsElem,
35 containerElem
36 } = refs
37
38 // Add default class
39 elem.classList.add('basicSlider')
40
41 // Clear existing content
42 elem.innerHTML = ''
43
44 // Insert slider content
45 elem.appendChild(containerElem)
46
47 // Insert arrows at the end so they stay clickable
48 if (opts.arrows === true) {
49 elem.appendChild(arrowLeftElem)
50 elem.appendChild(arrowRightElem)
51 }
52
53 // Insert dots at the end so they stay clickable
54 if (opts.dots === true) {
55 elem.appendChild(dotsElem)
56 }
57
58}
59
60const renderArrow = function(direction, fn) {
61

Callers 1

initFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected