You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

36 rivejä
1.2 KiB

  1. // /**
  2. // * Created by web_developer_02 on 2018/3/1
  3. // */
  4. // (function (doc, win){
  5. // let docEl = doc.documentElement,
  6. // resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
  7. // recalc = function () {
  8. // let clientWidth = docEl.clientWidth;
  9. //
  10. // clientWidth=clientWidth>768?768:clientWidth;
  11. // if (!clientWidth) return;
  12. // docEl.style.fontSize = 100 * (clientWidth / 375) + 'px';
  13. // };
  14. //
  15. //
  16. // if (!doc.addEventListener) return;
  17. // win.addEventListener(resizeEvt, recalc, false);
  18. // doc.addEventListener('DOMContentLoaded', recalc, false);
  19. // })(document, window);
  20. (function (doc, win){
  21. var docEl = doc.documentElement,
  22. resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
  23. recalc = function () {
  24. var clientWidth = docEl.clientWidth;
  25. clientWidth=clientWidth>768?768:clientWidth;
  26. if (!clientWidth) return;
  27. docEl.style.fontSize = 100 * (clientWidth / 375) + 'px';
  28. };
  29. if (!doc.addEventListener) return;
  30. win.addEventListener(resizeEvt, recalc, false);
  31. doc.addEventListener('DOMContentLoaded', recalc, false);
  32. })(document, window);