Created
August 26, 2016 08:32
-
-
Save Ledzz/570dbf27c523d7826814c299a86e91f6 to your computer and use it in GitHub Desktop.
transitionEnd polyfill
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(){ | |
function transitionEndEventName() { | |
var i, | |
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]; | |
} | |
} | |
} | |
window.transitionEnd = transitionEndEventName(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment