首页 > 其他 > 详细

H5页面尺寸兼容rem

时间:2020-07-29 18:08:29      阅读:77      评论:0      收藏:0      [点我收藏+]

//计算根节点HTML的字体大小
function resizeRoot(){
var deviceWidth = document.documentElement.clientWidth,
num = 750,
num1 = num / 100;
if(deviceWidth > num){
deviceWidth = num;
}
document.documentElement.style.fontSize = deviceWidth / num1 + "px";
}
//根节点HTML的字体大小初始化
resizeRoot();

window.onresize = function(){
resizeRoot();
};

H5页面尺寸兼容rem

原文:https://www.cnblogs.com/vindycxy/p/13398267.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!