Last active
December 20, 2015 13:19
-
-
Save Oikio/6137837 to your computer and use it in GitHub Desktop.
Animation and transition events naming in coffee with modernizr.
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
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