首頁 >web前端 >html教學 >检测浏览器支持css3D转换_html/css_WEB-ITnose

检测浏览器支持css3D转换_html/css_WEB-ITnose

WBOY
WBOY原創
2016-06-24 11:41:501209瀏覽

var support_css3 = (function() {                var div = document.createElement('div'),                        vendors = 'Ms O Moz Webkit'.split(' '),                        len = vendors.length;                return function(prop) {                    if ( 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;                };            })();            function support_css3_3d(){                var docElement = document.documentElement;                var support = support_css3('perspective');                var body = document.body;                if(support && 'webkitPerspective' in docElement.style){                    var style = document.createElement('style');                    style.type = 'text/css';                    style.innerHTML = '@media (transform-3d),(-webkit-transform-3d){#css3_3d_test{left:9px;position:absolute;height:3px;}}';                    body.appendChild(style);                    var div = document.createElement('div');                    div.id = 'css3_3d_test';                    body.appendChild(div);                    support = div.offsetLeft === 9 && div.offsetHeight === 3;                }                return support;            }

出处:http://www.cnblogs.com/lvdabao/p/HTML5_CSS3_detection.html

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn