|
@@ -2,18 +2,18 @@
|
|
|
export const setHtmlFontSize = () => {
|
|
|
console.count("setHtmlFontSize");
|
|
|
(function (doc, win) {
|
|
|
- var htmlDom = doc.getElementsByTagName("html")[0],
|
|
|
- resizeEvt = "orientationchange" in win ? "orientationchange" : "resize",
|
|
|
- recalc = function () {
|
|
|
- requestAnimationFrame(() => {
|
|
|
- var clientWidth = doc.documentElement.clientWidth || doc.body.clientWidth;
|
|
|
- if (!clientWidth) return;
|
|
|
- htmlDom.style.fontSize = clientWidth>=578.88 ? '144px' : 154.5 * (clientWidth / 578.88) + 'px';
|
|
|
- })
|
|
|
- };
|
|
|
+ let resizeEvt = "orientationchange" in win ? "orientationchange" : "resize",
|
|
|
+ recalc = function () {
|
|
|
+ let htmlDom = doc.getElementsByTagName("html")[0]
|
|
|
+ requestAnimationFrame(() => {
|
|
|
+ let clientWidth = doc.documentElement.clientWidth || doc.body.clientWidth;
|
|
|
+ if (!clientWidth) return;
|
|
|
+ htmlDom.style.fontSize = clientWidth>=578.88 ? '144px' : 154.5 * (clientWidth / 578.88) + 'px';
|
|
|
+ })
|
|
|
+ };
|
|
|
if (!doc.addEventListener) return;
|
|
|
win.addEventListener(resizeEvt, recalc, false);
|
|
|
- doc.addEventListener('DOMContentLoaded', recalc, false);
|
|
|
- setTimeout(()=>recalc(),1000)
|
|
|
+ doc.addEventListener('DOMContentLoaded', recalc, false);
|
|
|
+ recalc()
|
|
|
})(document, window);
|
|
|
};
|