Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[Modernizr] CSS transforms-style: preserve-3d;
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);
@mayloveless

This comment has been minimized.

Copy link

@mayloveless mayloveless commented Sep 17, 2013

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:)

@Grsmto

This comment has been minimized.

Copy link

@Grsmto Grsmto commented Sep 28, 2013

Works on Chrome 29/IE10. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment