var cssSupports = (function() { var div = document.getElementById('cultural-banner'), vendors = 'Khtml O Moz Webkit'.split(' '), len = vendors.length; return function(prop) { if ( prop in div.style ) return true; if ('-ms-' + prop in div.style) return true; prop = prop.replace(/^[a-z]/, function(val) { return val.toUpperCase(); }); while(len--) { if ( vendors[len] + prop in div.style ) { return true; } } return false; }; })();console.log(cssSupports('transition'));
想要实现的效果就是cssSupports(elem,property)在里面传一个选择器和一个属性名,该怎么改?
相关分类