I want to do a color fade, and run a function once when it is complete. I can do this with the bind
, which runs a callback on transitionend
. This works, but is run for each transition tied to an element.
CSS
Multiple transitions: Output: (2) called
box-shadow: 2px 2px 5px red !important;
transition: all 2s ease-out ;
Single transition: Output: called
transition: background-color 2s ease-out !important;
background: red !important;
jQuery:
$("#currentBlock").bind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd", function(event){
log("called");
$(this).unbind(event);
});
I would like to apply a transition to the box-shadow, but it is calling the transitionend
twice, instead of once. How do I limit the amount of time the callback is called, or cancel it if it is called again.