Document.documentelement.style.fontsize problem can not be set

(function () { 
'use strict';

the let DOC = document.documentElement; // dom reduce operating
function a resize () {
// Get document width dom
the let || doc.getBoundingClientRect window.innerWidth the clientWidth = () width;.
the let = doc.style.fontSize the fontSize;
// html dynamically changing the font-size, 320 Example
if (clientWidth <375) {// set the limit value in case
the fontSize = '100px';
} {the else
the fontSize = the clientWidth / 375 * 100 + 'PX';
}
}
// synchronous detection screen size change font-size, such as a trigger switch the screen anyway
window.onresize = function () {
a resize ()
};
triggered when the page initialization //
a resize ()
}) ();

Get ahead fontsize stored in variables, but can not successfully set fontsize html, but fontsize this variable is to get the result, but did not succeed on the web. Only if-else code block can be set by doc.style.fontsize way successfully set up, I did not know why. 

Keep for later resolution


Guess you like

Origin www.cnblogs.com/lqywong/p/11653681.html