Created
November 21, 2012 06:05
-
-
Save matori/4123325 to your computer and use it in GitHub Desktop.
[Modernizr] CSS transforms-style: preserve-3d;
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
Modernizr.addTest('csstransformspreserve3d', function () { | |
var prop, | |
val, | |
cssText, | |
ret; | |
prop = 'transform-style'; | |
if ('webkitTransformStyle' in document.documentElement.style) { | |
prop = '-webkit-' + prop; | |
} | |
val = 'preserve-3d'; | |
cssText = '#modernizr { ' + prop + ': ' + val + '; }'; | |
Modernizr.testStyles(cssText, function (el, rule) { | |
ret = window.getComputedStyle ? getComputedStyle(el, null).getPropertyValue(prop) : ''; | |
}); | |
return (ret === val); | |
}); | |
var test = Modernizr.csstransformspreserve3d; | |
console.log(test); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
it won't work in Chrome 26 -,but i am not mean your code .
my problem here is:
when I use your code test Chrome 26- ,it showed it supported preserve-3d,so i wrote some css3 in the page.
However it couldn't do what preserve-3d shoud do,it won't keep 3d position. Chrome 29 did just fine.
plz help me with it. thx:)