var iwidth = 1920; //pc端以1920的设计稿为基准 var iminwidth = 1020; //可视宽度小于1020,显示移动端效果图,以750的设计稿为基准 var e = window.document, t = e.documentelement, i = iwidth, d = i / 100, // d = i / 100, o = "orientationchange" in window ? "orientationchange" : "resize", a = function() { var n = t.clientwidth || 320; if (n >= iminwidth) { //宽度为1920时,html的font-size=100px t.style.fontsize = n / d + "px"; } else { //宽度为750时,html的font-size=100px, 使用vw单位 t.style.fontsize = (100 / 750) * 100 + "vw"; } }; e.addeventlistener && (window.addeventlistener(o, a, !1), e.addeventlistener("domcontentloaded", a, !1));