当前位置:网站首页>网页自适应,等比缩放
网页自适应,等比缩放
2022-04-23 14:09:00 【瑞瑞小同学】
可以先写一个预定的宽高,然后在等比缩放,
//自适应缩放
getc() {
// let width = document.documentElement.clientWidth;
// let height = document.documentElement.clientHeight;
window.addEventListener('load', adaptation);
window.addEventListener('resize', adaptation);
function adaptation() {
var w = document.body.clientWidth;
var h = document.body.clientHeight;
var nw = 2048;
var nh = 1536;
var left, top, scale, scale1;
scale = w / nw
scale1 = h / nh
if (scale1 < scale) {
document.getElementById('main').setAttribute('style', 'transf
版权声明
本文为[瑞瑞小同学]所创,转载请带上原文链接,感谢
https://blog.csdn.net/yr123456654321/article/details/111488066
边栏推荐
- mysql 5.1升级到5.611
- 文字组合,不重复,做搜索或查询关键字匹配
- FBS (fman build system) packaging
- Wechat applet communicates with esp8266 based on UDP protocol
- MySQL数据库讲解(九)
- 線程組ThreadGroup使用介紹+自定義線程工廠類實現ThreadFactory接口
- HyperMotion云迁移助力中国联通,青云完成某央企上云项目,加速该集团核心业务系统上云进程
- man man随记和crontab的@reboot用法
- Pass in external parameters to the main function in clion
- 金融行业云迁移实践 平安金融云整合HyperMotion云迁移解决方案,为金融行业客户提供迁移服务
猜你喜欢
Postman的安装使用及填坑心得
帆软实现分页时第一行和最后两行冻结方式
剑指offer刷题(1)--面向华为
微信小程序客服接入,实现发送和接收消息
ThreadGroup ThreadGroup implémente l'interface threadfactory en utilisant la classe Introduction + Custom thread Factory
帆软中单元格中隔行变色以及数量大于100字体变大变红设置
关于云容灾,你需要知道这些
RecyclerView进阶使用-实现仿支付宝菜单编辑页面拖拽功能
进入新公司,运维工程师从下面这几项了解系统的部署
什么是云迁移?云迁移的四种模式分别是?
随机推荐
多云数据流转?云上容灾?年前最后的价值内容分享
Logging module
Wechat applet communicates with esp8266 based on UDP protocol
帆软报表设置单元格填报以及根据值的大小进行排名方法
Operation instructions of star boundary text automatic translator
RecyclerView进阶使用-实现仿支付宝菜单编辑页面拖拽功能
Jira截取全图
Operation instructions of star boundary automatic text translator (advanced version)
字节面试编程题:最小的K个数
线程间控制之CountDownLatch和CyclicBarrier使用介绍
正则表达式
如何轻松做好一个项目
Returns the subscript after array sorting
VMware Workstation 无法连接到虚拟机。系统找不到指定的文件
STD:: map and STD:: vector memory free
利用json-server在本地创建服务器请求
JSP学习2
mysql 5.1升级到5.67
squid代理
jsp学习1