-
-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent click event on child element when dragging #24
Comments
Hi Alex (@alexcoroza), Thanks for taking time to open this issue. Would you mind forking this CodeSandbox to demonstrate the issue and what you want to achieve? It's much easier for me to troubleshoot and help you that way. Thank you for your patience. Kindly, |
Oooh, Didnt expect this, you responded so quick. Here is the example scenario: When you drag to change slides and then you mouseup on top of a slide, the click event is triggered. Actually Im using this library in my angular app so the sample codes in sandbox is quite different(but they show the same problem). I tried many javascript drag scroll carousel libraries they have all this kind of issue except for the ngx-drag-scroll(though its laggy). As of now I'm just showing an inivisible overlay whenever .on('scrolling') is called then hide it when finished, just to prevent the child element's click event |
Hello Alex (@alexcoroza), Thank you for the sample code 👍. Just want to make sure that I understand you correctly before we start discussing how to solve this issue:
All the best, |
Yes the question 1. I just want to prevent the click event only when dragging. |
Hello Alex (@alexcoroza), embla.clickAllowed() Please read about it in the release description. You can see it in action in this CodeSandbox. This method is an opt-in feature and here is how it works: It returns Mouse Pointers
Touch Pointers
Otherwise it will return Kindly, |
Hi Alex (@alexcoroza), I’m curious if you’ve had the chance to try this yet? Kindly, |
Hello again Alex (@alexcoroza), Thank you for your feature request! |
Hey @davidjerleke this is exactly what I need but I'm struggling to figure out how to implement it while using the react version. Any chance you could provide a bit of guidance? Thanks so much for you hard work in this, it has the smoothest animations I've found for a carousel library! |
Hi @coopemor, I would be happy to help. In order to do so I need additional details. Are you using React hooks or class based components? Kindly, |
Amazing! Thank you @davidjerleke I'm using hooks in my design. |
Hello @coopemor, Your question is related to the Embla Carousel React, so I decided to create a new issue there. Just follow this link and we'll continue this conversation there. Thanks! |
I created a carousel and added my custom clickable elements inside. The problem is when I drag the carousel and then I mouseup, click event is triggered which is not the desired action.
The text was updated successfully, but these errors were encountered: