0

Is there a way in javascript to detect if there is currently a css3 transition running?

Ideally a 'transitionstart' event would be useful, then I could catch all transitionstart events and wait for the corresponding transitionend events.

My scenario is the following. I would like to add an 'active' class to a dom element that will potentially trigger transitions on that element and also any number of child elements. I would like a callback once all animations are completed, and ideally I would like to keep all the animation timings in css and not javascript.

dannym
  • 267
  • 3
  • 11
  • Is there anything triggering this transition? – raam86 Jul 11 '13 at 10:33
  • adding a class to the element / a parent element – dannym Jul 11 '13 at 10:37
  • Possible duplicate: http://stackoverflow.com/questions/7264899/detect-css-transitions-using-javascript-and-without-modernizr and http://stackoverflow.com/questions/2794148/css3-transition-events – easwee Jul 11 '13 at 10:55
  • neither of these directly answer the question asked. The first describes detection of css3 transition capability and the second describes how to attach handlers to the end of transitions. The question here is detecting if there are any transitions currently in progress, without having to know know what elements have tranisitions on and when they are initiated – dannym Jul 11 '13 at 16:40
  • Why not use the same function that sets the class that triggers the transition as the trigger ? –  Jul 12 '13 at 02:09
  • Alternatively, if you wanted to detect transitions, you could simply perform the transitions through jQuery instead of CSS3. – Ryan Sparks Jul 24 '13 at 04:12

0 Answers0