javascript - Enable and disable Slick Slider on certain break points -
i'm trying enable slick slider (slick.js) initiate on 520px wide. below , slides stack (i.e. no slick). possible can work without refreshing page?
i've done this, works when dragging browser (narrow) below 500px, when move on 500px doesn't re-initiate without refreshing page...
$('.slick').slick({ autoplay: true, autoplayspeed: 4000, delay: 5000, speed: 700, responsive: [ { breakpoint: 500, settings: "unslick" } ] });
is there way around this?
i'm using https://github.com/kenwheeler/slick
you can try reconstruct when window resized above 500. seems work in demo.
function slickify(){ $('.slick').slick({ autoplay: true, autoplayspeed: 4000, delay: 5000, speed: 700, responsive: [ { breakpoint: 500, settings: "unslick" } ] }); } slickify(); $(window).resize(function(){ var $windowwidth = $(window).width(); if ($windowwidth > 500) { slickify(); } });
Comments
Post a Comment