移动端布局 根元素的计算

var deviceW;
function computed() {
deviceW = document.documentElement.clientWidth || document.body.clientWidth;
if (deviceW > 750) return;
document.documentElement.style.fontSize = (deviceW / 750) * 100 + "px";
}
computed();
window.addEventListener("resize", function () {
computed();
}, false);
posted @ 2018-07-18 22:03  惊沙男孩  阅读(208)  评论(0)    收藏  举报