h5构建页面(rem布局准备)
2024-10-07 00:45:33
新建一个flex.js
! function () {
function t(t) {
return this.config = t, this
}
t.prototype = {
reset: function () {
var t = Math.min(document.documentElement.clientWidth, 750) / 750 * 100;
document.documentElement.style.fontSize = t + "px";
var e = parseFloat(window.getComputedStyle(document.documentElement).fontSize),
n = t / e;
/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent) || document.documentElement
.setAttribute("flatform", "android"), 1 != n && (document.documentElement.style
.fontSize = t * n + "px")
}
}, window.Adapter = new t, window.Adapter.reset(), window.onload = function () {
window.Adapter.reset()
}, window.onresize = function () {
window.Adapter.reset()
}
}();
引入页面,此时1rem=100px,我们就可以利用这个比例进行换算了。
最新文章
- HTML和CSS经典布局5
- asp.net 自带的缓存
- STC12C5A60S2笔记1(管脚定义)
- CEP简介
- ThindPad x230 无法U盘启动
- JavaScript基础-面向对象编程<;1>;
- AttributeError at /home/home/ Exception Type: AttributeError at /home/home/
- Struts2学习笔记①
- google官方的下拉刷新+自定义上拉加载更多
- android.intent.action.MAIN与android.intent.category.LAUNCHER
- linux下文件和目录
- GrideSearchCV 优化算法参数
- centos 7 防火墙操作
- wpf treeview 数据绑定 递归绑定节点
- [原][杂谈]如果人类的末日:";天网";出现
- 搭建SDN网络——mininet
- c++构造函数成员初始化中赋值和初始化列表两种方式的区别
- 基于Asp.net C#实现HTML转图片(网页快照)
- 如何添加使用echats地图悬浮显示内容
- swift 需求: 导航栏和HeaderView 使用一个背景图片。