How can I disable a slider for desktop resolutions but display it on mobile devices? The following code allows only for the opposite:
$('.slider').slick({
slidesToShow: 5,
slidesToScroll: 1,
autoplay: false,
autoplaySpeed: 2000,
responsive: [
{
breakpoint: 767,
settings: "unslick"
}
]
});
Much cleaner solution than the currently accepted answer: Add the mobileFirst: true,
option:
$('.slider').slick({
slidesToShow: 5,
slidesToScroll: 1,
autoplay: false,
autoplaySpeed: 2000,
mobileFirst: true,
responsive: [
{
breakpoint: 767,
settings: "unslick"
}
]
});
This will interpret your breakpoint settings starting from low resolutions, as intended.
See the settings section in the Slick documentation.
Try this: screen width 9999px to 768px will not be slider
('.slider').slick({ slidesToShow: 5, slidesToScroll: 1, autoplay: false, autoplaySpeed: 2000, responsive: [ { breakpoint: 9999, settings: "unslick" }, { breakpoint: 767, settings: { slidesToShow: 3, slidesToScroll: 3, infinite: true, dots: true } } ] });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With