1(function (doc, win) { 2 var docEl = doc.documentElement, 3 resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize', 4 recalc = function () { 5 var clientWidth = docEl.clientWidth; 6 if (!clientWidth) return; 7 if (clientWidth >= 750) { 8 // docEl.style.fontSize = '100px'; 9 docEl.setAttribute('style', 'font-size:100px!important'); 10 } else { 11 docEl.style.fontSize = 100 * (clientWidth / 750) + 'px'; 12 } 13 }; 14 15 if (!doc.addEventListener) return; 16 win.addEventListener(resizeEvt, recalc, false); 17 doc.addEventListener('DOMContentLoaded', recalc, false); 18})(document, window);
rem.js(第二版)

达里尔
2023-09-14
604 0 0
点赞
收藏
评论区
加载中...