Created
December 29, 2015 10:42
-
-
Save xiajngsi/7313c6acc13d5e6cf746 to your computer and use it in GitHub Desktop.
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 transitionEndEventName () { | |
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'; | |
} | |
var transitionEnd = transitionEndEventName(); | |
jQuery(".target").on(transitionEnd, function() { | |
console.log("hehe"); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment