Created
February 27, 2020 10:16
-
-
Save c0defre4k/233be3bd8583022cef7e3ce3460faa9e to your computer and use it in GitHub Desktop.
Get the name of transitonend event
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
/** | |
* Check for transition end support | |
* Based on https://gist.github.com/O-Zone/7230245 | |
* @returns {String} | |
*/ | |
export default function transitionEndEvent() { | |
const transitions = { | |
transition: 'transitionend', | |
WebkitTransition: 'webkitTransitionEnd', | |
MozTransition: 'transitionend', | |
OTransition: 'otransitionend' | |
} | |
const elem = document.createElement('div') | |
// eslint-disable-next-line no-restricted-syntax | |
for (const t in transitions) { | |
if (typeof elem.style[t] !== 'undefined') { | |
return transitions[t] | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment