0

I'm running a transitionend on a parent div because I want to wait until that transition is complete. Unfortunately, there is a child button that has a transition that trigggers the transitionend event to run before the parent div has finished its transition. I've tried using event.stopPropagation() but no luck.

The transitionend is only firing once instead of firing on all the transitions, so I can't filter by the event.target.

<div class="section">
   <div class="fp-tableCell">
       <a href="http://www.gosomewhere.com" class="btn">View</a>
   </div>
</div>


function whichTransitionEvent(){
    var t,
        el = document.createElement("fakeelement");

     var transitions = {
         "transition"      : "transitionend",
         "OTransition"     : "oTransitionEnd",
         "MozTransition"   : "transitionend",
         "WebkitTransition": "webkitTransitionEnd"
     };

     for (t in transitions){
         if (el.style[t] !== undefined){
             return transitions[t];
         }
    }
}

var transitionEvent = whichTransitionEvent();
var fpSection = $('.section.active').children('.fp-tableCell');

fpSection.one(transitionEvent, function (event) {
     console.log('do stuff');
});

Any help would be awesome. Thanks

dgas02
  • 88
  • 1
  • 7
  • 1
    _"The transitionend is only firing once instead of firing on all the transitions"_ - sure about that? I mean, considering you are only listening for `.one` of them ... – CBroe Jul 04 '18 at 18:40
  • 1
    Thanks CBroe. Your sarcasm is exactly what I needed. Problem solved. – dgas02 Jul 04 '18 at 19:05

0 Answers0