Last active
December 19, 2015 03:09
-
-
Save juanbrujo/5888370 to your computer and use it in GitHub Desktop.
detecting support for CSS transitions
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
// detecting support for CSS transitions | |
function supportsTransitions() { | |
var b = document.body || document.documentElement; | |
var s = b.style; | |
var p = 'transition'; | |
if(typeof s[p] == 'string') {return true; } | |
v = ['Moz', 'Webkit', 'Khtml', 'O', 'ms'], | |
p = p.charAt(0).toUpperCase() + p.substr(1); | |
for(var i=0; i<v.length; i++) { | |
if(typeof s[v[i] + p] == 'string') { return true; } | |
} | |
return false; | |
} | |
var transitionSupport = true; | |
if (!supportsTransitions()) { | |
transitionSupport = false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment