Skip to content
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

Pass the trigger event through hooks #622

Closed
Tracked by #703
adamrzk opened this issue May 8, 2021 · 1 comment
Closed
Tracked by #703

Pass the trigger event through hooks #622

adamrzk opened this issue May 8, 2021 · 1 comment
Assignees
Labels
@barba/core @barba/core plugin enhancement
Milestone

Comments

@adamrzk
Copy link

adamrzk commented May 8, 2021

I am using the leave function to make some transition. I am not applying the transition on the container itself but on another element outside it. How can I get the click event in leave function? my transition needs the e.pageX and e.pageY values

@xavierfoucrier xavierfoucrier added the question questioning about a functionality or usage label May 8, 2021
@xavierfoucrier xavierfoucrier self-assigned this May 8, 2021
@xavierfoucrier
Copy link
Member

Hello @adamrzk,

Unfortunately, you can't get the clicked MouseEvent inside a Barba hook.
Only the clicked element, using data.trigger, see https://barba.js.org/docs/advanced/hooks/#data-properties.

However, you can use the prevent option to get the e.PageX and e.PageY properties: this is fired before any Barba transition.
See https://barba.js.org/docs/advanced/strategies/#prevent.

I keep this issue opened and mark it as enhancement for a next release.

@xavierfoucrier xavierfoucrier added @barba/core @barba/core plugin enhancement and removed question questioning about a functionality or usage labels May 10, 2021
@xavierfoucrier xavierfoucrier changed the title Get click event Pass the trigger click event through hooks May 10, 2021
@thierrymichel thierrymichel added this to the barba@next milestone Jan 31, 2022
@barbajs barbajs deleted a comment from mestrellar28 Feb 22, 2023
@xavierfoucrier xavierfoucrier changed the title Pass the trigger click event through hooks Pass the trigger event through hooks Mar 1, 2023
xavierfoucrier added a commit that referenced this issue Mar 1, 2023
@xavierfoucrier xavierfoucrier mentioned this issue Apr 5, 2023
15 tasks
xavierfoucrier added a commit that referenced this issue Aug 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@barba/core @barba/core plugin enhancement
Projects
None yet
Development

No branches or pull requests

3 participants