1
1

FontSize.ts 552 B

1234567891011121314
  1. /// <reference path="../Elements.ts" />
  2. /**
  3. * Update font sizes according to screen resolution and/or mobile status
  4. */
  5. function updateFontSize () {
  6. var minWidth = Elements.isMobile? 800 : 1280;
  7. var proportion = new StoredMemory("FontProportion", Elements.isMobile ? 17 : 14.5);
  8. var width = document.body.clientWidth < minWidth ? minWidth : document.body.clientWidth;
  9. document.documentElement.style[ "font-size" ] = (width * proportion.getValue() / 1280) + "px";
  10. }
  11. updateFontSize();
  12. window.addEventListener("resize", updateFontSize);