Created
December 10, 2012 21:17
-
-
Save pfulton/4253505 to your computer and use it in GitHub Desktop.
CSS box-sizing detection with Modernizr
This file contains hidden or 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
// test whether or not CSS box-sizing is supported. Append the relevant classes to the html element. | |
// for reference: http://www.snackoclock.net/2012/08/simple-box-sizing-border-box-fallback-for-ie/ | |
Modernizr.addTest("boxsizing", function() { | |
return Modernizr.testAllProps("boxSizing") && (document.documentMode === undefined || document.documentMode > 7); | |
}); | |
if(!Modernizr.boxsizing){ | |
alert("No box-sizing, but we added a class for you!"); | |
} | |
// alternatively, provide some kind of fall-back | |
Modernizr.load([{ test : Modernizr.boxsizing , nope : 'box-sizing-fallback.js' }]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment