rem自适应js代码

以后懒得写,直接复制了

var computedFz = (function(){
  var designWidth = 375, rem2px = 100;
  function computedFz(){
	var fz = Math.floor(window.innerWidth / designWidth * rem2px);
	document.documentElement.style.fontSize = (fz > 100 ? 100 : fz) + 'px'
  }
	return computedFz;
})()
computedFz();
window.onresize = function(){
  setTimeout(computedFz,500);
}

  

原文地址:https://www.cnblogs.com/maomao93/p/7455554.html