Created
June 20, 2019 17:57
-
-
Save scsskid/56e914b155181a4bb589db08b64f2034 to your computer and use it in GitHub Desktop.
get name of Transitionend event for current browser, src: https://stackoverflow.com/q/12250329/2823589
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
var whichTransitionEvent = (function (){ | |
var t; | |
var el = document.createElement('fakeelement'); | |
var transitions = { | |
'transition' :'transitionEnd', | |
'OTransition' :'oTransitionEnd', | |
'MSTransition' :'msTransitionEnd', | |
'MozTransition' :'transitionend', | |
'WebkitTransition' :'webkitTransitionEnd' | |
} | |
for(t in transitions){ | |
if( el.style[t] !== undefined ){ | |
return transitions[t]; | |
} | |
} | |
} ()); | |
console.log(whichTransitionEvent); // returns "webkitTransitionEvent" in Chrome | |
console.log(typeof whichTransitionEvent); // returns "string" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://stackoverflow.com/q/12250329/2823589