REM
2018/07/20

- 自适应更改html font-size js

640为设计稿大小
100位当设计稿为640px时html font-size为100px
此时1px=0.01rem;

(function(doc, win) {
          var docEl = doc.documentElement,
              isIOS = navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/),
              dpr = isIOS ? Math.min(win.devicePixelRatio, 3) : 1,
              dpr = window.top === window.self ? dpr : 1, //被iframe引用时,禁止缩放
              resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize';
          docEl.dataset.dpr = dpr;
          var recalc = function() {
              var width = docEl.clientWidth;
              if (width / dpr > 640) {
                  width = 640 * dpr;
              }
              docEl.dataset.width = width;
              docEl.dataset.percent = 100 * (width / 640);
              docEl.style.fontSize = 100 * (width / 640) + 'px';
          };
          recalc()
          if (!doc.addEventListener) return;
          win.addEventListener(resizeEvt, recalc, false);
      })(document, window);
      ```