Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save omurphy27/d5a24d1d4d1a45b3d6f3 to your computer and use it in GitHub Desktop.
Save omurphy27/d5a24d1d4d1a45b3d6f3 to your computer and use it in GitHub Desktop.
Using modernizr to detect support for the CSS Calc() property
// Using modernizr to detect support for the CSS Calc() property
// Especially useful because older phone browsers don't support Calc()
// source http://stackoverflow.com/questions/18359506/using-modernizr-to-test-browser-support-for-css-calc
// use and include special modernizr build: http://modernizr.com/download/#-shiv-cssclasses-prefixes-css_calc-load
supportsCalc();
function supportsCalc() {
if (!Modernizr.csscalc) {
$('body').addClass('calc-no-bueno');
// add css class to body if calc isn't supported
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment