Created
October 20, 2014 22:51
-
-
Save tyler-johnson/cb366fddb64d35fc025a to your computer and use it in GitHub Desktop.
Determine the correct CSS3 transition end event name.
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
var transitionEndEventName = (function() { | |
var i, | |
undefined, | |
el = document.createElement('div'), | |
transitions = { | |
'transition':'transitionend', | |
'OTransition':'otransitionend', // oTransitionEnd in very old Opera | |
'MozTransition':'transitionend', | |
'WebkitTransition':'webkitTransitionEnd' | |
}; | |
for (i in transitions) { | |
if (transitions.hasOwnProperty(i) && el.style[i] !== undefined) { | |
return transitions[i]; | |
} | |
} | |
//TODO: throw 'TransitionEnd event is not supported in this browser'; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment