"use strict"; /*根元素字体设置 * 以1920设计稿为基准,计算时,将设计稿上的尺寸除以100即可 */ (function(doc, win) { var htmlFont = function() { var docEl = doc.documentElement, view = docEl.clientWidth, height = docEl.clientHeight, font,font1; docEl.style.minHeight = height + "px"; font = view / 7.5; if (view<=750) { docEl.style.fontSize = font + "px" }else{ docEl.style.fontSize="" } }; htmlFont(); win.addEventListener("resize", htmlFont, false) })(document, window);