I'm using slick.js to power a slider. I'd like to remove the "previous" arrow when the first slide is active and the "next" arrow when the last slide is active. I may need to remove both arrows when the final slide is active. Is there a slick event function or a jquery function that can do this?
To disable previous arrow on first slide and next arrow on last slide you could define infinite : false,
on slick initialization like below.
$("#slider").slick({
infinite : false
});
if you have additional settings just include that in initialization. slider
is id of container.
This is to disable arrows on Slider. To remove arrows you could just hide it when first/last slide is active. Go through documentation on how to get active slide on slider and with jquery hide you could hide arrow by class name of arrow button. You could get class/id of arrow button by inspecting element. Right click on arrow and inspect it.
To get current slide: $('#slider').slick('slickCurrentSlide');
To hide or show next arrow: $('.slick-next').show();
or $('.slick-next').hide();
Similarly for prev arrow: $('.slick-prev').show();
or $('.slick-prev').hide();
Heres Fiddle: https://jsfiddle.net/pjfw1wqz/
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