Skip to content

Instantly share code, notes, and snippets.

@juanbrujo
Last active December 19, 2015 03:09
Show Gist options
  • Save juanbrujo/5888370 to your computer and use it in GitHub Desktop.
Save juanbrujo/5888370 to your computer and use it in GitHub Desktop.
detecting support for CSS transitions
// 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