做ease庫判斷opacity有了疑問查詢結(jié)果:
較為簡潔的辦法是
if('opacity' in document.body.style)
{
// do stuff
}
擴展所有屬性檢測
function isPropertySupported(property)
{
return property in document.body.style;
}
參考鏈接
Check whether a CSS property is supported
相類似的方法是直接在實例上檢測宗收,不過實用性上沒有上述方法好用
How do you properly detect the browser's support for opacity?