mmdevcodes / a11y-slider

Library for simple and accessible sliders
https://a11yslider.js.org/
MIT License
53 stars 7 forks source link

How to add more sliders on one page? #36

Open ysnitko opened 1 year ago

ysnitko commented 1 year ago

Hi. How to add more sliders on one page? If you just copy and paste the same html code, then only the first slider works.

mmdevcodes commented 1 year ago

@fjord20 Select all your sliders and then iterate over the list:

const sliders = document.querySelectorAll('.slider');

sliders.forEach(sliderEl => {
   const slider = new A11YSlider(sliderEl);
});