码迷,mamicode.com
首页 > Web开发 > 详细

是否支持css3

时间:2016-05-26 14:44:24      阅读:152      评论:0      收藏:0      [点我收藏+]

标签:

/**
     * 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

标签:

原文地址:http://www.cnblogs.com/juexin/p/5530904.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!