是否支持css3
Posted 觉信
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了是否支持css3相关的知识,希望对你有一定的参考价值。
/** * Function to check css3 support * @param {String} declaration name * @return {Boolean} */ function isCssSupported(declaration) { var supported = false, prefixes = ‘Khtml ms O Moz Webkit‘.split(‘ ‘), clone = document.createElement(‘div‘), declarationCapital = null; declaration = declaration.toLowerCase(); if (clone.style[declaration] !== undefined) supported = true; if (supported === false) { declarationCapital = declaration.charAt(0).toUpperCase() + declaration.substr(1); for( var i = 0; i < prefixes.length; i++ ) { if( clone.style[prefixes[i] + declarationCapital ] !== undefined ) { supported = true; break; } } } if (window.opera) { if (window.opera.version() < 13) supported = false; } return supported; }
以上是关于是否支持css3的主要内容,如果未能解决你的问题,请参考以下文章
判断浏览器是否支持某个css3属性的javascript方法