Files
ClassContent/历届学生/zheng-yuqing/项目练习/上课项目/caipu/js/util/rem.js
2024-09-27 02:06:13 +08:00

11 lines
341 B
JavaScript

window.onload = function () {
getRem(750, 100)
};
window.onresize = function () {
getRem(750, 100)
};
function getRem(pwidth, prem) {
var html = document.getElementsByTagName("html")[0];
var oWidth = document.body.clientWidth || document.documentElement.clientWidth;
html.style.fontSize = oWidth / pwidth * prem + "px";
}