flexible.js 503 字节

"use strict";
;(function(win, lib) {
  var doc = win.document;
  var docEl = doc.documentElement;
  var flexible = lib.flexible || (lib.flexible = {});
  function refreshRem(){
    var width = docEl.getBoundingClientRect().width;

    width = width > 640 ? 640 : width;

    var rem = width / 6.4;
    docEl.style.fontSize = rem + 'px';
    flexible.rem = win.rem = rem;
  }
  win.addEventListener('resize',refreshRem)
  refreshRem();
})(window, window['lib'] || (window['lib'] = {}));