rcbyr / keen-slider

The HTML touch slider carousel with the most native feeling you will get.
https://keen-slider.io/
MIT License
4.67k stars 214 forks source link

slideChanged event is called too many times #345

Open Shiyan7 opened 1 year ago

Shiyan7 commented 1 year ago

I have pagination, and when clicking on a bullet that is too far from the current bullet, too many events are called, below I attach a link to the demo https://codesandbox.io/s/pedantic-benz-jshzfv?file=/src/styles.css

Because of this, my animation on pagination breaks, but if you add setTimeout with a delay of 200ms, then everything works and the animation does not break, below is the link how it should work (crutch code) https://codesandbox.io/s/peaceful-banzai-p29kgn?file=/src/styles.css

Shiyan7 commented 1 year ago

It only helps if you don't use buller's onClick instanceRef.current?.moveToIdx(idx); and use instanceRef.current?.track.to(idx); but then there is no swipe animation, how can this be fixed? Below is a demo with the corrected version https://codesandbox.io/s/hungry-ride-g7h946?file=/src/App.tsx