Skip to content

Instantly share code, notes, and snippets.

@RyoSugimoto
Created April 15, 2014 12:38
Show Gist options
  • Save RyoSugimoto/10729171 to your computer and use it in GitHub Desktop.
Save RyoSugimoto/10729171 to your computer and use it in GitHub Desktop.
CSSのcalc()関数が使えるかどうかを調べる。
#css-calc {
width: 10px;
width: calc(10px + 10px);
width: -webkit-calc(10px + 10px);
display: none;
}
var cssCalc = (function () {
$('body').append('<div id="css-calc"></div>');
var cssCalc = Number($('#css-calc').width());
$('#css-calc').remove();
if(cssCalc === 10) {
return false;
} else {
return true;
}
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment