Skip to content

Instantly share code, notes, and snippets.

@cladley
Last active September 15, 2015 10:40
Show Gist options
  • Save cladley/e0c3cd3074268789889b to your computer and use it in GitHub Desktop.
Save cladley/e0c3cd3074268789889b to your computer and use it in GitHub Desktop.
transition end , animation end event names
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