Ad

Slick Carousel Get Current SlidesToShow Depending On Breakpoints

I use the kenwheeler/slick Carousel and i want to take the settings i put. I want to get the attribute slidesToShow. I try this way because of some breakpoints i put also and affects the value of the property above. The easy way is to get the settings object and check for the value of this property. Does anybody knows how to get any attribute of the Slick Settings on demand somehow like:

$('#slickCarouselId').attritubeName 

Thanks ...

Ad

Answer

If I understand correctly you need

// get
let slides = $('#slickCarouselId').slick('slickGetOption', 'slidesToShow');
// set
$('#slickCarouselId').slick('slickSetOption', 'slidesToShow', 2, true);

Last argument is passed to refresh UI

Ad
source: stackoverflow.com
Ad