Created
June 16, 2014 18:42
-
-
Save davidchase/6d41f19336c5656791e2 to your computer and use it in GitHub Desktop.
TransitionEnd alternative to 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
// Credits: | |
// http://stackoverflow.com/questions/5023514/how-do-i-normalize-css3-transition-functions-across-browsers/9090128#9090128 | |
var transitionEndEventName = function() { | |
var i; | |
var el = document.createElement('div'); | |
var transitions = { | |
'transition':'transitionend', | |
'OTransition':'otransitionend', | |
'MozTransition':'transitionend', | |
'WebkitTransition':'webkitTransitionEnd' | |
}; | |
for (i in transitions) { | |
if (transitions.hasOwnProperty(i) && el.style[i] !== undefined) { | |
return transitions[i]; | |
} | |
} | |
} | |
var transitionEnd = transitionEndEventName(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment