Created
May 23, 2013 19:38
-
-
Save michsch/5638830 to your computer and use it in GitHub Desktop.
CSS3 feature detection for transitions without Modernizr.
Found here: http://stackoverflow.com/questions/7264899/detect-css-transitions-using-javascript-and-without-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
/** | |
* original found here: http://stackoverflow.com/questions/7264899/detect-css-transitions-using-javascript-and-without-modernizr | |
*/ | |
var featureDetection = ( function( exports, root, document ) { | |
"use strict"; | |
exports.transition = function() { | |
var body, bodyStyle, feature, prefix; | |
body = document.body || document.documentElement; | |
bodyStyle = body.style; | |
feature = 'transition'; | |
if(typeof bodyStyle[feature] === 'string') { | |
return true; | |
} | |
// Tests for vendor specific prop | |
prefix = ['Moz', 'Webkit', 'Khtml', 'O', 'ms']; | |
feature = feature.charAt(0).toUpperCase() + feature.substr(1); | |
for( var i = 0; i < prefix.length; i++ ) { | |
if(typeof bodyStyle[prefix[i] + feature] === 'string') { | |
return true; | |
} | |
} | |
return false; | |
} | |
return exports; | |
})( featureDetection || {}, window, document ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment