当前位置:网站首页>网页自适应,等比缩放
网页自适应,等比缩放
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
边栏推荐
猜你喜欢
sql中出现一个变态问题
Research on recyclerview details - Discussion and repair of recyclerview click dislocation
帆软中根据分类进行汇总
星界边境Starbound创意工坊订阅的mod的存放路径
Postman的安装使用及填坑心得
MySQL数据库讲解(九)
HyperMotion云迁移完成阿里云专有云产品生态集成认证
How QT designer adds resource files
krpano全景之vtour文件夹和tour
金融行业云迁移实践 平安金融云整合HyperMotion云迁移解决方案,为金融行业客户提供迁移服务
随机推荐
Can I compile the header file and source file of the template separately
A table splitting implementation scheme of MySQL and InnoDB, MyISAM and MRG_ Introduction to MyISAM and other engine application scenarios
Research on recyclerview details - Discussion and repair of recyclerview click dislocation
Request module
GFS分布式文件系统(理论)
统信UOS PHP7.2.3升级至PHP7.2.24
处理 mkdir:无法创建目录“aaa“:只读文件系统
操作系统常见面试题目:
mysql 5.1升级到5.68
使用开源调研工具Prophet是一种什么体验?
时间复杂度计算举例
gzip和gunzip 解压参数详解
OpenStack命令操作
01-NIO基础之ByteBuffer和FileChannel
Oracle-数据泵使用
预览CSV文件
JSP学习2
星界边境文本自动翻译机(高级版)使用说明
mysql锁数据库锁
PySide2