PC端响应式设置

        window.onunload = function() {}
        setFontSize()
        window.onresize = function() {
          setFontSize()
        }
        function setFontSize() {
          let designSize = 1920; // 设计图尺寸

          let html = document.documentElement;

          let wW = html.clientWidth;// 窗口宽度
          let rem = wW * 100 / designSize;

          document.documentElement.style.fontSize = rem + 'px';

        }

 

posted @ 2022-02-11 14:43  rachelch  阅读(108)  评论(0)    收藏  举报