react-indiana-drag-scroll
react-indiana-drag-scroll copied to clipboard
Doesn't work with scroll snapping
I planned to use this great tool for creating a carousel. I didn't want a continous scroll but rather the scrolling to snap to the items with scroll-snap-type: x mandatory. This makes the scrolling area not scrollable at all.
@tonygustafsson, hello!
I would recommend to use the corresponding libraries for creating a carousel. There are plenty of ones. This library is designated to solve one common simple task.
Although, you can make scroll-snap work with this library. You should disable scroll-snap while dragging for this. But it will produce another problem: when you return scroll-snap the container will be scrolled immediately without any easing (on desktop).
That's how it works.
As I know all carousels that allows dragging slides by mouse and implements some sort of scroll snap, do it on their own by scripts.
Just remove class snap-x onStartScroll and restore onEndScroll
But it will produce another problem: when you return scroll-snap the container will be scrolled immediately without any easing
scroll-behavior: smooth
works in some browsers to address this.