js设置移动端媒体查询

2020-07-22  本文已影响0人  锦锦_jane
let rootWidth = document.documentElement.clientWidth || document.body.clientWidth;
let rootHeights = document.documentElement.clientHeight || document.body.clientHeight;
let rootDom = document.querySelector('html');
if(rootWidth<440){
    rootDom.style.fontSize = rootWidth /10.8 + 'px';
}else {
    rootWidth=440
    rootDom.style.fontSize = rootWidth /10.8 + 'px';
    window.onload = () => {
        document.getElementsByTagName("body")[0].style.minHeight = rootHeights+"px";
    }
}

上一篇 下一篇

猜你喜欢

热点阅读