Home > Web Front-end > HTML Tutorial > Detect that the browser supports css3D conversion_html/css_WEB-ITnose

Detect that the browser supports css3D conversion_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:41:50
Original
1213 people have browsed it

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;            }
Copy after login

Source: http://www.cnblogs.com/lvdabao/p/HTML5_CSS3_detection.html

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template