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'));想要實現(xiàn)的效果就是cssSupports(elem,property)在里面?zhèn)饕粋€選擇器和一個屬性名,該怎么改?
這個閉包我想傳多個參數(shù)進去該怎么改進?
汪汪一只貓
2018-08-15 10:09:21