((doc, win, designWidth) => {
  const html = doc.documentELement;
  const refreshRem = () => {
    const clientWidth = html.clientWidth;
    if (clientWidth >= designWidth) {
      html.style.fontSize = '100px';
    } else {
      html.style.fontSize = 100 * clientWidth / designWidth + 'px';
    }
  };
  doc.addEventListener('DOMContentLoaded', refreshRem);
)(document, window, 750)
(function (doc, win, designWidth) {
  var html = doc.documentElment;
  function refreshRem() {
    var clientWidth = html.getBoundingClientRect().width;
    if (clientWidth >= designWidth) {
      html.style.width = '100px';
    } else {
      html.style.width = 100 * (clientWidth / designWidth) + 'px';
    }
  }
  doc.addEventListener('DOMContentLoaded', refreshRem);
})(document, window, 750)

Leave a Reply

电子邮件地址不会被公开。 必填项已用*标注