Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
Isolate all code in some context. Next, pass the slider container to this context. And in the code itself, search for control elements not globally in the document, but only within the passed container.
Something like this:
function makeSlider(slider) {
...
}
document.querySelectorAll('.slider').forEach(makeSlider)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question