Answer the question
In order to leave comments, you need to log in
Slick slider, twitching when adaptive?
Autoplay with a smooth shift, a kind of running line.
When the window is resized, when the slider is rebuilt to a different number of slides, some jumps appear.
I tried to somehow reinitialize the slider, but even did not help
$(window).on('resize', function() {
// $('.slider').slick('resize');
// $('.slider').slick('reinit');
$('.slider').slick('setPosition');
});
Answer the question
In order to leave comments, you need to log in
Well, here's a working solution: at the end of the window resize, destroy and create this slider again
function resizedw(){
$('.slider').slick('unslick');
$('.slider').slick({
slidesToShow: 3,
arrows: true,
dots: true,
speed: 5000,
autoplay: true,
pauseOnHover: false,
pauseOnFocus: false,
cssEase: 'linear',
autoplaySpeed: 0,
customPaging: function() {
return ''
},
responsive: [
{
breakpoint: 900,
settings: {
slidesToShow: 2,
}
},
{
breakpoint: 500,
settings: {
slidesToShow: 1
}
}
]
});
}
let doit;
window.onresize = function(){
clearTimeout(doit);
doit = setTimeout(resizedw, 1000);
};
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question