移动端自适应js

<script>
        //移动端自适应
        (function (doc, win) {
            var docEl = doc.documentElement,
                    resizeEvt = ‘orientationchange‘ in window ? ‘orientationchange‘ : ‘resize‘,
                    recalc = function () {
                        var clientWidth = docEl.clientWidth;
                        if (!clientWidth) return;
                        docEl.style.fontSize = 100 * (clientWidth / 750) + ‘px‘;
                    };
            if (!doc.addEventListener) return;
            win.addEventListener(resizeEvt, recalc, false);
            doc.addEventListener(‘DOMContentLoaded‘, recalc, false);
        })(document, window);
</script>
style
html,body{width:100%}
.container{width:7.5rem}/*即750px*/

  

  

移动端自适应js

上一篇:人工智能APP-人脸识别Face Detection


下一篇:[AndroidStudio]DrawerLayout布局结合HomeAsUp箭头动画效果最小系统