react-slick icon indicating copy to clipboard operation
react-slick copied to clipboard

Question: The slick is not working when the item is less than slidesToShow

Open Dityath opened this issue 3 years ago • 4 comments

I dont know why but my slider is not working fine when the slides item less than the slidesToShow, it just became stacked like a css grid, and how to make the slide become just a single slider (or make it into multiple slider that less than slidetoshow) when this happens? or maybe any other tips?

codesandbox: CodeSandBox

Dityath avatar Oct 14 '21 06:10 Dityath

I have exactly the same problem ( problem with infinite: true

Leolik avatar Oct 14 '21 19:10 Leolik

I got a similar problem, when the slides are less than slidesToShow, the slides doubled and stacked upon each other, I tried to remove infinite: true but that didn't worked. Also I tired the code from documentation, the same problem occured. Can anyone confirm is it only problem of mine or everyones.

pioneiro avatar Oct 18 '21 15:10 pioneiro

@Leolik @pioneiro @Dityath The same issue. It's due to the duplicates or clones created even when no need for them (with the class slick-cloned).

  • The clones must not be created when the Nbr of items < slidesToShow in the settings.

belachkar avatar Oct 26 '21 04:10 belachkar

I had the same problem here. The slides doubled and stacked upon each other when there's less items than the value set on slidesToShow property

gi-batalha avatar Aug 03 '22 20:08 gi-batalha

Any update on this one, we are having the same issue?

Vixy88 avatar Nov 17 '22 11:11 Vixy88

We fixed this now by adding flex:1 to the .slick-list class

& .slick-list { flex: 1; }

Vixy88 avatar Nov 17 '22 11:11 Vixy88

The problem persists. I fixed it with:

.slick-slide.slick-cloned {
  display: none;
}

AlbertRF147 avatar May 05 '23 11:05 AlbertRF147

i fixed it by conditionally turning infinite scroll to false

<Slider dots={true} infinite={slides.length >= 3} speed={500} slidesToShow={3} slidesToScroll={1} >

ahmadmustafeen avatar Sep 04 '23 12:09 ahmadmustafeen

Yes, slides can't be less than slidesToShow You have to fix it with conditional logic as @ahmadmustafeen suggested

akiran avatar Jan 19 '24 09:01 akiran