Skip to content

Instantly share code, notes, and snippets.

@c0defre4k
Created February 27, 2020 10:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save c0defre4k/233be3bd8583022cef7e3ce3460faa9e to your computer and use it in GitHub Desktop.
Save c0defre4k/233be3bd8583022cef7e3ce3460faa9e to your computer and use it in GitHub Desktop.
Get the name of transitonend event
/**
* 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