akiran / react-slick

React carousel component
http://react-slick.neostack.com/
MIT License
11.77k stars 2.1k forks source link

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

Closed Dityath closed 9 months ago

Dityath commented 3 years ago

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

Leolik commented 3 years ago

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

pioneiro commented 3 years ago

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.

belachkar commented 3 years ago

@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).

gi-batalha commented 2 years ago

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

Vixy88 commented 1 year ago

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

Vixy88 commented 1 year ago

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

& .slick-list { flex: 1; }

AlbertRF147 commented 1 year ago

The problem persists. I fixed it with:

.slick-slide.slick-cloned {
  display: none;
}
ahmadmustafeen commented 1 year ago

i fixed it by conditionally turning infinite scroll to false

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

`

akiran commented 9 months ago

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

shoaib-ab commented 3 months ago

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.

I am also facing the same problem

ahmadmustafeen commented 3 months ago

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.

I am also facing the same problem

tried this? https://github.com/akiran/react-slick/issues/2093#issuecomment-1705213915