rcbyr / keen-slider

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

How to scroll more than 1 slide on a movement #394

Closed briankitt closed 6 months ago

briankitt commented 6 months ago

I have a need for the carousel to slide 3 slides on a drag, arrow or dot operation

I can't seem to find in the documentation how to set the scroll amount to anything other than 1. Is there a way to do this?

briankitt commented 6 months ago

I solved it by doing 2 things: On my arrows, I implement a custom next() prev() that does a .moveToIdx() with a value calculated to be 3 off of the current index (depending on direction).

Then I had to fix the dots, I show 1/3 of the dots, and on each dot, I go to the index * 3