Skip to content

Instantly share code, notes, and snippets.

@davidchase
Created June 16, 2014 18:42
Show Gist options
  • Save davidchase/6d41f19336c5656791e2 to your computer and use it in GitHub Desktop.
Save davidchase/6d41f19336c5656791e2 to your computer and use it in GitHub Desktop.
TransitionEnd alternative to Modernizr
// 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