You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
582 B
JavaScript

function getRem(pwidth,prem){
var html = document.getElementsByTagName("html")[0];
var oWidth = document.body.clientWidth || document.documentElement.clientWidth;
//var oHeight = document.body.clientHeight || document.documentElement.clientHeight;
// if (oWidth >= pwidth) {
// oWidth = pwidth;
// }
// if (oWidth > oHeight) {
// oWidth = oHeight
// }
var size=oWidth/pwidth*prem;
html.style.fontSize = size + "px";
}
$(document).ready(function(){
//画布、字体大小设定
getRem(750,100);
$(window).resize(function() {
getRem(750,100);
})
});