Created
April 8, 2016 11:59
-
-
Save oreillyross/5e387b760c9f2c22b3c9c4918ae91d38 to your computer and use it in GitHub Desktop.
This code will check to see if CSS animation support is available: Query the animation boolean value
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 animation = false, | |
animationstring = 'animation', | |
keyframeprefix = '', | |
domPrefixes = 'Webkit Moz O ms Khtml'.split(' '), | |
pfx = '', | |
elm = document.createElement('div'); | |
if( elm.style.animationName !== undefined ) { animation = true; } | |
if( animation === false ) { | |
for( var i = 0; i < domPrefixes.length; i++ ) { | |
if( elm.style[ domPrefixes[i] + 'AnimationName' ] !== undefined ) { | |
pfx = domPrefixes[ i ]; | |
animationstring = pfx + 'Animation'; | |
keyframeprefix = '-' + pfx.toLowerCase() + '-'; | |
animation = true; | |
break; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment