/*判断浏览器是否支持某个css属性*/
function SupportCss(attrName){
  var i=0,
      arr = SupportCss.opt.aBrowser,
      eleStyle = SupportCss.opt.eleStyle;

  for(i;i<arr.length ;i++){
    if(arr[i] + attrName in eleStyle){return true;}
  }
  return false;
}

/*构造函数静态属性*/
SupportCss.opt = {

  /*浏览器前缀*/
  aBrowser : ['', '-webkit-', '-Moz-', '-ms-', '-o-'],

  /*页面对象*/
  eleStyle : document.documentElement.style
};


console.log('transition:',SupportCss('transition'));
console.log('width:',SupportCss('width'));

  

相关文章:

  • 2021-10-14
  • 2021-10-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2019-03-07
猜你喜欢
  • 2021-11-23
  • 2021-12-15
  • 2021-06-25
  • 2022-12-23
  • 2022-02-26
  • 2022-12-23
  • 2022-01-10
相关资源
相似解决方案