Answer the question
In order to leave comments, you need to log in
How to make a draggable carousel in React?
Hello.
There is a custom carousel. I would like to fasten the possibility of "drag and drop" to it. I figured out that it is possible to calculate the distance between onMouseDown and onMouseUp ( tochStart and touchEnd for phone ) and if the difference between the values is more than, say, 100 pixels, we scroll back and forth. Faced with the fact that the content that is inside the carousel block starts to stand out. You can do .preventDefault() on cards on onMouseDown , but then links that may be inside the card will not be clicked.
Is it possible to somehow leave the ability to click on links, but the carousel was also dragged?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question