-
Notifications
You must be signed in to change notification settings - Fork 210
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
On click event? #132
Comments
The workaround I'm using for now: # @drop.on 'open', @openHandler
@drop.on 'close', @closeHandler
@drop.target.addEventListener('click', @somethingINeedToDoBeforeOpenHandler)
@drop.target.addEventListener('click', @openHandler) |
Are you looking for something like a |
hi @geekjuice Actually I'm looking for something like |
Gotcha. I think the way I thought new Drop({
...options,
showOn(e) {
if (e.type === 'click') {
console.log('Opened via user click');
} else {
console.log('Probably opened programatically');
}
return true; // To confirm opening the drop
}
}); This way, you can determine what type of event opened the drop and even determine if the drop should open or not. |
@geekjuice hm makes sense... like changing here to pass the event along. if (typeof this.options.showOn !== 'undefined' && !this.options.showOn(event)) {
return;
} Do you want me to test #120? |
Yea, if the And I always welcome everyone to test open PRs so they can be merged sooner 👍 🍻 |
Hey,
I would like to ask you if there's a way to trigger an event on drop click, before opening a drop.
I tried this:
But I'm getting
open
beforeclick
in the console. I know what I need might seems wrong, but I need something to trigger based on the user interaction (click on the drop to open it), because I also callopen
programatically, and based on my current implementation it's hard to differentiate when its being opened because of a user interaction or because I@drop.open
programatically.Is there a way to do that with Drop?
Thanks
The text was updated successfully, but these errors were encountered: