|
@@ -4,9 +4,11 @@ export const setHtmlFontSize = () => {
|
|
|
var htmlDom = doc.getElementsByTagName('html')[0],
|
|
|
resizeEvt = 'orientationchange' in win ? 'orientationchange' : 'resize',
|
|
|
recalc = function () {
|
|
|
- var clientWidth = doc.documentElement.clientWidth || doc.body.clientWidth;
|
|
|
- if (!clientWidth) return;
|
|
|
- htmlDom.style.fontSize = clientWidth>=579 ? '144px' : 145 * (clientWidth / 579) + 'px';
|
|
|
+ requestAnimationFrame(()=>{
|
|
|
+ var clientWidth = doc.documentElement.clientWidth || doc.body.clientWidth;
|
|
|
+ if (!clientWidth) return;
|
|
|
+ htmlDom.style.fontSize = clientWidth>=579 ? '144px' : 145 * (clientWidth / 579) + 'px';
|
|
|
+ })
|
|
|
};
|
|
|
if (!doc.addEventListener) return;
|
|
|
win.addEventListener(resizeEvt, recalc, false);
|