Skip to content

Instantly share code, notes, and snippets.

@Ledzz
Created August 26, 2016 08:32
Show Gist options
  • Save Ledzz/570dbf27c523d7826814c299a86e91f6 to your computer and use it in GitHub Desktop.
Save Ledzz/570dbf27c523d7826814c299a86e91f6 to your computer and use it in GitHub Desktop.
transitionEnd polyfill
(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