kenwheeler / slick

the last carousel you'll ever need
kenwheeler.github.io/slick
MIT License
28.47k stars 5.89k forks source link

Remove slick cloned slides while setting infinite:true #3552

Open shivanit2 opened 6 years ago

shivanit2 commented 6 years ago

I need to remove slick-cloned slides from my slider.I know it is possible to do so by keeping infinite to false. But I want to eliminate slick clones whilst keeping infinite true.How can I achieve this?

PAKOTxx commented 4 years ago

same question, this is problem for SEO, some variants?

klemus commented 3 years ago

bump?

sagarsatalkar commented 3 years ago

adaptiveHeight: true worked for me.

Thanks.

analogaryan commented 2 years ago

thanks

thanhnx9368 commented 7 months ago

If you're intergrated fancybox + react-slider. They will be displayed duplicated slide in fancybox.

I have a solution for this: We have to remove attribute data-fancybox in a tag element.

useEffect(() => { const removeDataFancyboxAttribute = () => { const layoutDiv = document.querySelectorAll('.slick-list > .slick-track > .slick-cloned') layoutDiv?.length > 0 && layoutDiv?.forEach((item) => { const aTags = item.querySelectorAll('a') aTags.forEach((aTag) => { if (aTag.getAttribute('data-fancybox')) { aTag.removeAttribute('data-fancybox') } }) }) }

setTimeout(() => {
  removeDataFancyboxAttribute()
}, 500)

}, [])

samucalima commented 5 months ago

adaptiveHeight: true worked for me.

Thanks.

This solution didn't work for me :(