Last active
September 15, 2015 10:40
-
-
Save cladley/e0c3cd3074268789889b to your computer and use it in GitHub Desktop.
transition end , animation end event names
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function whichAnimationEndEvent(){ | |
var el = document.createElement('fakeelement'); | |
var animationsEvents = { | |
'WebkitAnimation' : 'webkitAnimationEnd', | |
'OAnimation' : 'oAnimationEnd', | |
'msAnimation' : 'MSAnimationEnd', | |
'animation' : 'animationend' | |
}; | |
for(var t in animationsEvents){ | |
if(el.style[t] !== undefined){ | |
return animationsEvents[t]; | |
} | |
} | |
} | |
function whichTransitionEndEvent(){ | |
var el = document.createElement('fakeelement'); | |
var transitions = { | |
'transition':'transitionend', | |
'OTransition':'oTransitionEnd', | |
'MozTransition':'transitionend', | |
'WebkitTransition':'webkitTransitionEnd' | |
} | |
for(var t in transitions){ | |
if( el.style[t] !== undefined ){ | |
return transitions[t]; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment