/计算屏幕基准font-size比例/
(function(doc, win) {
var docEl = doc.documentElement,
dpr = win.devicePixelRatio;
resizeEvt = ‘orientationchange’ in window ? ‘orientationchange’ : ‘resize’;
docEl.dataset.dpr = dpr;
var recalc = function() {
var width = docEl.clientWidth;
if (width / dpr > 750) {
width = 750 * dpr;
}
docEl.style.fontSize = 100 * (width / 750) + ‘px’;
};
recalc();
if (!doc.addEventListener) return;
win.addEventListener(resizeEvt, recalc, false);
})(document, window);
通过js计算来实现rem的响应式 还会有什么弊端吗