// 定义基准字体 new function () { var _self = this; _self.fontSize = 100;//榛樿瀛椾綋澶у皬 _self.widthProportion = function () { if(document.documentElement.clientWidth <= 750){ _self.width = 750; }else{ _self.width = 1903; } var p = (document.body && document.body.clientWidth || document.getElementsByTagName("html")[0].offsetWidth) / _self.width; return p ; }; _self.changePage = function () { document.getElementsByTagName("html")[0].setAttribute("style", "font-size:" + _self.widthProportion() * _self.fontSize + "px"); } window.addEventListener("DOMContentLoaded", function() { _self.changePage(); }); window.addEventListener('resize', function () { _self.changePage(); }, false); };