Answer the question
In order to leave comments, you need to log in
How to turn off the slider when the width and height decrease?
I have a vertical slider on my page. Each slide is 100vh high and scrolls one slide at a time.
<div class="slider">
<div class="slider-children" style="height: 100vh;">
<h1>Slider 1</h1>
</div>
<div class="slider-children" style="height: 100vh;">
<h1>Slider 2</h1>
</div>
<div class="slider-children" style="height: 100vh;">
<h1>Slider 3</h1>
</div>
</div>
$(window).on("load resize orientationchange", function () {
$(".slider").each(function () {
if ($(window).width() < 1390 || $(window).height() < 700) {
if ($(".slider").hasClass("slick-initialized")) {
$(".slider").slick("unslick");
}
}
});
});
<div class="slider-children" style="height: 100vh;">
<h1>Slider 2</h1>
<div class="horizontal-slider">
<div class="horizontal-slider_children">
Slide 2-1
</div>
<div class="horizontal-slider_children">
Slide 2-2
</div>
</div>
</div>
Answer the question
In order to leave comments, you need to log in
Instead , write a selector that only fits the big slider, but doesn't fit the inner ones. Well, there by its id, or maybe it has some other classes besides .slider. $(".slider").slick("unslick");
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question