响应式js设置

<script>
(function anonymous() {
// 声明一个函数,并直接的执行
function computed() {
let HTML = document.documentElement, winW = HTML.clientWidth, desW = 750;
if (winW > desW) {
HTML.style.fontSize = "100px";
return;
}
HTML.style.fontSize = winW / 750 * 100 + "px";
}
computed();
window.addEventListener('resize', computed, false);
})();
</script>
posted @ 2018-08-13 15:53  雷神约  阅读(213)  评论(0编辑  收藏  举报