博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
移动端自适应js
阅读量:4679 次
发布时间:2019-06-09

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

window.addEventListener('resize', setHtmlFontSize)setHtmlFontSize();function setHtmlFontSize() {  var windowWidth = document.documentElement.offsetWidth;  if (windowWidth > 640) {    windowWidth = 640;  } else if (windowWidth < 320) {    windowWidth = 320;  }  var StandardWidth = 375;  var StandardHtmlFontSize = 16;  var htmlFontSize = windowWidth / StandardWidth * StandardHtmlFontSize;  document.querySelector('html').style.fontSize = htmlFontSize + 'px';}

 

转载于:https://www.cnblogs.com/muou2125/p/11356698.html

你可能感兴趣的文章
【腾讯IMWeb前端训练营】 Vuejs todoList demo
查看>>
C语言博客作业04--数组
查看>>
postEvent() @ triggerEvent
查看>>
js数组操作
查看>>
FlexSlider是一个非常出色的jQuery滑动切换插件
查看>>
mysql插入中文报错
查看>>
tp5 中 model 的聚合查询
查看>>
android wear开发之:增加可穿戴设备功能到通知中 - Adding Wearable Features to Notifications...
查看>>
几种内核对象的受信与非受信状态
查看>>
压缩文件函数库(转载)
查看>>
【转】ubuntu12.04没有/var/log/messages解决
查看>>
几种队列
查看>>
Oracle EBS 初始化用户密码
查看>>
SYS_CONTEXT 详细用法
查看>>
Pycharm配置autopep8让Python代码更符合pep8规范
查看>>
函数的复写
查看>>
17_重入锁ReentrantLock
查看>>
winform窗口关闭提示
查看>>
64款工具,总有合适您的那款
查看>>
我的第一篇博客
查看>>