(function(window, document) { var viewWidth = 720; var pick = viewWidth / 100; var mode = "resize"; function change() { var view = document.documentElement.clientWidth || window.innerWidth; if(view >= 720) { document.getElementsByTagName('html')[0].style.fontSize = 100 + 'px'; return; } document.getElementsByTagName('html')[0].style.fontSize = view / pick + 'px'; console.log(document.getElementsByTagName('html')[0].style.fontSize) } window.addEventListener(mode, change, !1); window.document.addEventListener('DOMContentLoaded', change, !1); })(window, document);