Last active
October 31, 2017 10:12
-
-
Save edankwan/4389601 to your computer and use it in GitHub Desktop.
preserve-3d test for Modernizr based on https://gist.github.com/4123325
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
(function(Modernizr, win){ | |
Modernizr.addTest('csstransformspreserve3d', function () { | |
var prop = Modernizr.prefixed('transformStyle'); | |
var val = 'preserve-3d'; | |
var computedStyle; | |
if(!prop) return false; | |
prop = prop.replace(/([A-Z])/g, function(str,m1){ return '-' + m1.toLowerCase(); }).replace(/^ms-/,'-ms-'); | |
Modernizr.testStyles('#modernizr{' + prop + ':' + val + ';}', function (el, rule) { | |
computedStyle = win.getComputedStyle ? getComputedStyle(el, null).getPropertyValue(prop) : ''; | |
}); | |
return (computedStyle === val); | |
}); | |
}(Modernizr, win)); |
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 shows 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:)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Great, you saved my time :)
Thanks for share it!