Last active
October 26, 2015 05:10
-
-
Save fredchu/466ade10bef487f1c63e to your computer and use it in GitHub Desktop.
Check if CSS calc() is available using JavaScript and 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
Modernizr.addTest('csscalc', function() { | |
var prop = 'width:'; | |
var value = 'calc(10px);'; | |
var el = document.createElement('div'); | |
el.style.cssText = prop + Modernizr._prefixes.join(value + prop); | |
return !!el.style.length; | |
}); | |
// ref http://stackoverflow.com/questions/14125415/how-can-i-check-if-css-calc-is-available-using-javascript |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment