Open lowedown opened 10 years ago
So you are initializing a slider with no slides?
That's one scenario when it happened. We made sure that we always have slides defined, but it would also happen sometimes with slides... possibly because our CMS injects some markup. I couldn't exactly figure out why it happens, because the browser always hangs, but if an infinite loop would be prevented, the problem would be solved.
Thanks for the info. I will take a look at it.
For emtpy slides, may be you can apply this workaround:
if($('.iosslider li.slide').length>0){
//initialize slider here
$('.iosslider').iosSlider()
}
I am also having the browser freezing issue when I set the slider's style to display:none for mobile as client wants it that way.
@media screen and (max-width: 479px){
div#featured-wrapper.iosslider{
display:none!important
}
}
So for those who might stumble into similar case, I have initialized the slider like this to fix the issue:
function initHomeSlider() {
jQuery('.iosslider:hidden').iosSlider('autoSlidePause');
jQuery('.iosslider:visible').iosSlider({
snapToChildren: true,
desktopClickDrag: true,
infiniteSlider: true,
snapSlideCenter: true,
navNextSelector: jQuery('.next'),
navPrevSelector: jQuery('.prev'),
autoSlide: true,
autoSlideTimer: 5000,
autoSlideHoverPause: true
});
jQuery('.iosslider:visible').iosSlider('autoSlidePlay');
}
jQuery(document).ready(function($) {
$(window).resize(function(){
initHomeSlider();
}).resize();
})
Hope that helps :)
Same issue here, a slider is always initialized but displayed none with media queries (to not appear on mobile)
When you resize the page and the slider gets hidden the browser completely freezes
Located the issue and made a PR
This line in slowScrollHorizontalInterval leads to an infinite loop when sliderMax[sliderNumber] is 0 and newOffset is 0 causing the browser to freeze.
This would happen, when we didn't have any slides defined.