0
点赞
收藏
分享

微信扫一扫

两倍样式调节

芒果六斤半 2021-10-04 阅读 75
随笔

           // 动态适配终端计算 js

           function autoResizeDev() {

               var htmlWidth = document.documentElement.clientWidth || document.body.clientWidth;

               var htmlDom = document.getElementsByTagName('html')[0];

               //判断pc、移动端

               htmlWidth > 768 ? htmlDom.style.fontSize = '100px' : htmlDom.style.fontSize = htmlWidth / 7.5 + 'px';

           }

           autoResizeDev();

           window.onresize = autoResizeDev;

举报

相关推荐

0 条评论