首页 > 其他 > 详细

rem_750

时间:2017-09-20 19:17:03      阅读:425      评论:0      收藏:0      [点我收藏+]
/* fix the code flash the page  */
var globalWidth = document.documentElement.clientWidth;//window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
var radixNO = 100/750*globalWidth;
document.documentElement.style.fontSize = radixNO + ‘px‘;
/* fit document fit the screen, get the radix */
(function (doc, win) {
    var docEl = doc.documentElement,
            resizeEvt = ‘orientationchange‘ in window ? ‘orientationchange‘ : ‘resize‘,
            recalc = function () {
                var globalWidth = window.innerWidth;// for judge the screen ??
                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);

 

rem_750

原文:http://www.cnblogs.com/lengyue0030/p/7562862.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!