移动端布局 根元素的计算

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);

猜你喜欢

转载自www.cnblogs.com/Neilisme/p/9332916.html