g787543 / infinite-react-carousel

Infinite carousel for react
https://g787543.github.io/infinite-react-carousel/
MIT License
109 stars 33 forks source link

autoplay not working when adding beforeChange or afterChange #9

Open ferrarisMat opened 4 years ago

ferrarisMat commented 4 years ago

Describe the bug Having autoplay and beforeChange={(e) => console.log(e)} at the same time, disables the autoplay.

g787543 commented 4 years ago

Hi @ferrarisMat,

Have you set pauseOnHover={false} ? if not autoplay will stop when you hover on carousel.

ferrarisMat commented 4 years ago

Hi @g787543,

Yep, it has been deactivated, I needed to trigger this function to get the current slide index before it scrolls to the next one, I found a way with the data-carousel-key property and the .active CSS class