当前位置:网站首页>网页自适应,等比缩放
网页自适应,等比缩放
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
边栏推荐
猜你喜欢
随机推荐
PySide2
星界边境文本自动翻译机使用说明
Wechat applet input hidden and inoperable settings
RecyclerView高级使用(二)-垂直拖拽排序的简单实现
mysql 5.1升级到5.69
在Clion中给主函数传入外部参数
Idea控制台乱码解决
困扰多年的系统调研问题有自动化采集工具了,还是开源免费的
GFS分布式文件系统(理论)
Jmeter设置环境变量支持在任意终端目录输入jmeter直接启动
DP energy Necklace
JSP学习2
返回数组排序后下标
容灾有疑问?点这里
Returns the subscript after array sorting
ActiveMQ Basics
pthread_ Why does self() repeat
时间复杂度计算举例
Wechat applet communicates with low-power Bluetooth - receives data sent by hardware (IV)
Wechat applet positioning and ranging through low-power Bluetooth device (2)