Open shejinalt opened 2 years ago
My assumption is, the loop starts before all the dynamic sliders are added to the DOM. The best approach is to use a callback whenever a slider is added to the page. If you can share the link, that would be helpful.
it'n not forEach function, that's my old code. I included this on document.ready function. please follow my code.
`$(document).ready(function(){ $(".singleItem.with-custom-arrow") .not(".slick-initialized") .slick({ infinite: false, arrows: true, dots: true, centerMode: false, slidesToShow: 1, //adaptiveHeight: true, responsive: [ { breakpoint: 991, settings: { slidesToShow: 1, slidesToScroll: 1, }, }, { breakpoint: 768, settings: { slidesToShow: 1, slidesToScroll: 1, }, }, ], })
setTimeout(() => {
$(".singleItem.with-custom-arrow").not('.slick-initialized').slick('refresh');
}, 0)
});`
If the sliders are added dynamically then there is a probability they are added after document.ready
executes.
I have 5 or more sliders in a single page. These slider's items are dynamically added from other side. But when I run page some of sliders not working ,only 4 or 5 is working correctly. But inside "slick-track" the items showing correctly