I added a transitionend
event listener to a div
. This div
has children who have transition on some elements. I want the transitionend event to only fire for the element I added it for, is this a bug? or expected behavior? How to make it fire only if its the one i added the listener to?
Events are bubbling by default, meaning that they will be "transmitted" to the parent element until they hit the body or a handler that will stop them.
You can either :
event.stopPropagation()
on them. That way, they won't bubble through the parent anymore.If you'd show us some code, it would be easier to help you, depending on your current implementation.
This process is called as Event Bubbling
.The thing you can do is either detect the bubbling using the event handler or prevent the bubbling by stopping the propogation. You can do this by
event.stopPropagation()
In IE beofore 9.
You can do it as
window.event.cancelBubble = true;
Please have a detailed look here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With