博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
动态获取移动端视宽,从而结合rem达到适配
阅读量:4306 次
发布时间:2019-06-06

本文共 1315 字,大约阅读时间需要 4 分钟。

// jq        !function(){            var windowWidth= $(window).width();            if(windowWidth > 750) {                windowWidth = 750;            }            var fontSize = windowWidth / 750 * 50;//50是html根元素font-size值            $("html").attr("style", "font-size:" + fontSize + "px");            $(window).resize(function() {                windowWidth = $(window).width();                if(windowWidth > 750) {                    windowWidth = 750;                }                fontSize = windowWidth / 750 * 50;                $("html").attr("style", "font-size:" + fontSize + "px");            });        }();//js!function(){    var windowWidth = document.documentElement.clientWidth || document.body.clientWidth;    if(windowWidth > 750) {        windowWidth = 750;    }    var fontSize = windowWidth / 750 * 50;   //50是html根元素font-size值    document.getElementsByTagName('html')[0].style.fontSize = fontSize + "px";    window.onresize = function(){        var windowWidth = document.documentElement.clientWidth || document.body.clientWidth;        if(windowWidth > 750) {            windowWidth = 750;        }        fontSize = windowWidth / 750 * 50;        document.getElementsByTagName('html')[0].style.fontSize = fontSize + "px";    }}();

 

转载于:https://www.cnblogs.com/520BigBear/p/9610083.html

你可能感兴趣的文章
在Android App中集成Google登录
查看>>
openstack quantum搭建过程中一些有用的链接
查看>>
数据库:mysql 获取刚插入行id[转]
查看>>
Egret入门学习日记 --- 第二篇
查看>>
前端“黑话”polyfill
查看>>
wifi-mac
查看>>
linux 下运行 tomcat
查看>>
RocketMQ 使用及常见问题
查看>>
UVA10785 The Mad Numerologist
查看>>
var result = ![] == []; console.log(result); // 结果是?为什么?
查看>>
高效率Oracle SQL语句
查看>>
Maven deploy部署jar到远程私服仓库
查看>>
2/19 福建四校联考
查看>>
abap 中modify 的使用
查看>>
tomcat调优方案Maximum number of threads (200) created for connector with address null and port 8091...
查看>>
java类的加载机制
查看>>
MDK linker和debug的设置以及在RAM中调试
查看>>
CocosCreator2.1.0渲染流程与shader
查看>>
制作新网络框架快速自动生成消息结构体的编辑器
查看>>
[转]Device Context 设备环境 设备上下文 理解
查看>>