rem_750

/* 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);
时间: 2024-08-26 09:43:45

rem_750的相关文章