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);
posted on 2017-09-20 17:58 lengyue0030 阅读(223) 评论(0) 编辑 收藏 举报