-
-
Notifications
You must be signed in to change notification settings - Fork 78.9k
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
Have Bootstrap plugin events forward the underlying originalEvent that caused them #15393
Comments
if (originalEvent.type === 'click') {
// do something useful, like fire analytics tracking
} The Collapse does not consume/prevent event bubbling - why not use .e.g data-attributes with other code to integrate with analytics? (I've been using GA tracking via data attributes on the past gig). See e.g.: http://bit.ly/1x7Cft7 and other. $(document).on('click.analytics.data-api', '[data-whateverfits="ga"]', function (e) { |
@peterblazejewicz The point of my suggestion is to not create additional event handlers. Also, in my specific use case I am actually tracking collapse / expand with regard to panels. |
Sounds like a reasonable & useful request to me. |
Can then @cookch10's request be expanded to other related UI components? I've used to write a code/markup to track many actions on the important, user facing elements like Alerts and Modals - so just like with Collapse it would be useful to get original event (otherwise I have to resort to additional event bindings). Thanks! |
Punting this to v4. Added it to our v4 todo list. |
Nice! |
It would be useful to know if an expand / collapse event was triggered by a user interaction (e.g. a click) or something else (e.g. programmatically) without having to bind a new click event handler.
Given the following code (which is based off of bootstrap v3.2.0):
In the example above I have indicated capturing the e.originalEvent object and storing it on the event object supplied to the fnCollapseCallback handler.
It might be the case that there is an existing attribute more suited for storing this information (and possibly also not storing the entire originalEvent object).
The text was updated successfully, but these errors were encountered: