Initialize slick slider after ajax success

Add following snippet into your ajax success.

if ($('.your_slick_selector').hasClass('slick-initialized')) {
    $('.your_slick_selector').slick('destroy');
}

$( '.your_slick_selector' ).html( response );

$( '.your_slick_selector' ).slick({
    infinite: false,
    slidesToShow: 5,
    slidesToScroll: 5,
});

4 Comments

Been trying to figure this out for a few days now. Saw some other answers on StackOverflow that didn’t work for me. You are a legend thank you!