Posts

Showing posts with the label clearinterval

JavaScript / Jquery clearInterval & setInterval multiple sliders

Image
Clash Royale CLAN TAG #URR8PPP JavaScript / Jquery clearInterval & setInterval multiple sliders I have MULTIPLE sliders on one page, everything works except I can't get the set and clear intervals to work properly. I am trying to reset the setInterval when the next and prev functions are called. After I clicked next or prev the clearInterval works, the sliders all stop but weird stuff happens when the new setInterval runs. I would ideally like to do this for each slider on the page but I can't even globally get it to work (meaning reset all sliders on the page at once). Thanks for any feedback! Edit: Including JSFiddle Edit: I pasted a sample of the JS layout below the actual code gemco.customSlider = gemco.customSlider || {}; gemco.customSlider = { nextSlide: function(el, timer){ // Set Active Slide var parentSlide = el.parent('section'); var totalSlides = parentSlide.find($('.cs-slide')).length; var activeSlide = parentSlide.find($(...