Running a TransitionEnd listener on children

I added a transitionend event listener to the div . There are children in this div who have transition to some elements. I want the transition event only for the element for which I added it, is this an error? or expected behavior? How to make it fire only if it adds a listener to?

+5
source share
2 answers

Events by default bubble up so that they will be "passed" to the parent element until they hit the body or handler that stops them.

You can:

If you show us some code, it will be easier to help you depending on your current implementation.

+9
source

This process is called Event Bubbling . What you can do is either detect the bubbles using an event handler, or prevent bubbling by stopping the protonation. You can do it with

 event.stopPropagation() 

In IE up to 9.

You can do it like

 window.event.cancelBubble = true; 

Please view here in detail.

+5
source

Source: https://habr.com/ru/post/1204459/


All Articles