[Help]: Limit drag/swipe to one direction #749
Unanswered
rodrigovallades
asked this question in
Help
Replies: 1 comment 2 replies
-
Hi, I still haven't figured this one out. Any help is appreciated. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Summary
Hi,
I have a specific use case where I need the drag/swipe to be limited to just one direction.
I started to dig into the
emblaApi.internalEngine()
method and found out that I can use thescrollBody.direction()
, which returns1
or-1
depending on the direction.You can see it working here:
https://codesandbox.io/p/sandbox/embla-carousel-drag-direction-detection-47dj9n
Now, I need a way to disable drag/scroll completely in one specific direction (animation and everything else). Any thoughts on how can I accomplish this?
If applicable, which variants of Embla Carousel are relevant to this question?
Additional information
No response
CodeSandbox example
https://codesandbox.io/p/sandbox/embla-carousel-drag-direction-detection-47dj9n
Beta Was this translation helpful? Give feedback.
All reactions