浏览器检测是否支持某个 CSS 属性
作者:
枫_d646 | 来源:发表于
2018-09-27 17:33 被阅读0次// 下面函数判断浏览器是否支持某个 css 属性
function isPropertySupported(property) {
if (property in document.body.style) return true;
var prefixes = ['Moz', 'Webkit', 'O', 'ms', 'Khtml'];
var prefProperty = property.charAt(0).toUpperCase() + property.substr(1);
for(var i = 0; i < prefixes.length; i++){
if((prefixes[i] + prefProperty) in document.body.style) return true;
}
return false;
}
isPropertySupported('background-clip') // true
参考链接
本文标题:浏览器检测是否支持某个 CSS 属性
本文链接:https://www.haomeiwen.com/subject/lwxyoftx.html
网友评论