Skip to content

Instantly share code, notes, and snippets.

@Oikio
Last active December 20, 2015 13:19
Show Gist options
  • Save Oikio/6137837 to your computer and use it in GitHub Desktop.
Save Oikio/6137837 to your computer and use it in GitHub Desktop.
Animation and transition events naming in coffee with modernizr.
var tapEvent;
if (Modernizr.touch){
tapEvent = 'touchstart';
} else {
tapEvent = 'click';
}
var animationEndEventNames = {
WebkitAnimation: 'webkitAnimationEnd',
OAnimation: 'oAnimationEnd',
msAnimation: 'MSAnimationEnd',
animation: 'animationend'
};
var transitionEndEventNames = {
WebkitTransition: 'webkitTransitionEnd',
MozTransition: 'transitionend',
OTransition: 'oTransitionEnd',
msTransition: 'MSTransitionEnd',
transition: 'transitionend'
};
var animationEndEvent = animationEndEventNames[Modernizr.prefixed('animation')];
var transitionEndEvent = transitionEndEventNames[Modernizr.prefixed('transition')];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment