动态计算rem的js代码
2021-07-12 23:05
标签:最小 color element class div font cli min height 以最小1024尺寸为例: 动态计算rem的js代码 标签:最小 color element class div font cli min height 原文地址:http://www.cnblogs.com/Smiled/p/7080335.htmlfunction rem() {
var htmlEle = document.documentElement;
var winWidth = htmlEle.clientWidth || document.body.clientWidth;
var width = winWidth : winWidth;
htmlEle.style.fontSize = Math.ceil(100 * (width / 1920)) + ‘px‘;
htmlEle.style.height = htmlEle.clientHeight + ‘px‘;
htmlEle.style.minWidth = 1024 + ‘px‘;
};
rem();
window.onresize = function() {
rem();
}
上一篇:HTML-封装原生Ajax
下一篇:jquery获取复选框的值