Created
September 6, 2013 21:41
-
-
Save Boztown/6470351 to your computer and use it in GitHub Desktop.
Determine which CSS3 transition events to use (from Modernizr).
This file contains hidden or 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 whichTransitionEvent(){ | |
var t; | |
var 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 transitionEnd = whichTransitionEvent(); | |
element.addEventListener(transitionEnd, theFunctionToInvoke, false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment