Answer the question
In order to leave comments, you need to log in
Why doesn't this script work when changing the orientation of the iPad?
Moreover, if you change the width in dev tools, then everything is displayed correctly
$(window).on('resize', function() {
var slider = $('#our-goods .our-goods-wrap');
var settings = {
infinite: true,
autoplay: true,
autoplaySpeed: 4000,
slidesToShow: 3,
slidesToScroll: 1,
arrows: false,
responsive: [
{
breakpoint: 860,
settings: {
slidesToShow: 2,
}
},
{
breakpoint: 580,
settings: {
slidesToShow: 1,
}
},
],
}
if ($(window).width() > '992')
{
if (slider.hasClass('slick-initialized')) {
slider.slick('unslick');
}
return;
}
else if (!slider.hasClass('slick-initialized'))
{
return slider.slick(settings);
}
});
Answer the question
In order to leave comments, you need to log in
try like this
$(window).on('resize orientationchange', function() {
var slider = $('#our-goods .our-goods-wrap');
var settings = {
infinite: true,
autoplay: true,
autoplaySpeed: 4000,
slidesToShow: 3,
slidesToScroll: 1,
arrows: false,
responsive: [
{
breakpoint: 860,
settings: {
slidesToShow: 2,
}
},
{
breakpoint: 580,
settings: {
slidesToShow: 1,
}
},
],
}
if ($(window).width() > '992')
{
if (slider.hasClass('slick-initialized')) {
slider.slick('unslick');
}
return;
}
else if (!slider.hasClass('slick-initialized'))
{
return slider.slick(settings);
}
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question