React-slick: In infinite mode, when slidesToShow equal to the length of slides, infinite functionality is not working.

Created on 1 Jun 2020  路  4Comments  路  Source: akiran/react-slick

demo: https://codesandbox.io/s/react-slick-playground-yjk35?file=/index.js

Even after using { arrows: true, dots: true, infinite: true} when slideToShow equals to the length of slides, no pre/post cloned slides are being rendered which usually happens when infinite is set to true. Arrows and Dots are also not being rendered in this case.

Most helpful comment

Hi,

I have got a workaround for this issue, so sharing it thinking it may help.

Suppose, slidesToShow = totalSlides = 3, then instead of passing 3 to slidesToShow, we can pass 2.99 which will show arrows and dots and add cloned slides. And if you are using centerMode: true, then the slides in this case will not be centered so for this, add css like:
.slick-slide { transform: translate(100%, 0); }
This will move your slide by 1 which works in case of 3 visible slides. You can translate based of your number of visible slides.

All 4 comments

Hi,

I have got a workaround for this issue, so sharing it thinking it may help.

Suppose, slidesToShow = totalSlides = 3, then instead of passing 3 to slidesToShow, we can pass 2.99 which will show arrows and dots and add cloned slides. And if you are using centerMode: true, then the slides in this case will not be centered so for this, add css like:
.slick-slide { transform: translate(100%, 0); }
This will move your slide by 1 which works in case of 3 visible slides. You can translate based of your number of visible slides.

+1, I have the same issue. The workaround method from @amitk7407 is working 馃憤

+1, SAME ISSUE

Same issue. Although @amitk7407 solution made my slider infinite.. it doesn't look good because it is cut

https://share.getcloudapp.com/jkuL1n97

Was this page helpful?
0 / 5 - 0 ratings

Related issues

BradyEdgar94 picture BradyEdgar94  路  3Comments

slashwhatever picture slashwhatever  路  3Comments

enriquelopez-atlas picture enriquelopez-atlas  路  3Comments

walker-jiang picture walker-jiang  路  3Comments

briziel picture briziel  路  3Comments