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.
 
 
 
 

16 lines
500 B

  1. (function (doc, win){
  2. var docEl = doc.documentElement,
  3. resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
  4. recalc = function () {
  5. var clientWidth = docEl.clientWidth;
  6. clientWidth=clientWidth>540?540:clientWidth;
  7. if (!clientWidth) return;
  8. docEl.style.fontSize = 100 * (clientWidth / 375) + 'px';
  9. };
  10. if (!doc.addEventListener) return;
  11. win.addEventListener(resizeEvt, recalc, false);
  12. doc.addEventListener('DOMContentLoaded', recalc, false);
  13. })(document, window);