当前位置:网站首页 > R语言数据分析 > 正文

gridview自适应宽度(webview自适应高度)



<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>数据大屏scale</title> </head> <style type="text/css"> /* 去除默认样式 */ * { margin: 0; padding: 0; } .container { width: 100wh; height: 100vh; background: orange; background: url(/Users/hoge/Desktop/code/vueStudy/硅谷甄选/admin_template/project/src/views/screen/images/bg.png) no-repeat; background-size: cover; } .box { width: 1920px; height: 1080px; background: red; transform-origin: left top; position: fixed; left: 50%; top: 50%; } .top { width: 100px; height: 100px; background: hotpink; margin-left: 50px; } .bottom { width: 100px; height: 100px; background: skyblue; margin-left: 50px; margin-top: 100px; } /* 放大缩小的倍数从设备的中心点开始进行放大 */ </style> <body> <!-- div box 为整个数据大屏的根节点,100vh 100wh的高度 --> <div class="container"> <!-- 数据展示的区域 --> <div class="box"> <div class="top">我是祖国的</div> <div class="bottom">老花骨朵</div>
        </div>
    </div>
</body>

</html>
<script>
    // 监控数据大屏的放大与缩小 let box = document.querySelector(".box"); box.style.transform = `scale(${getScale()}) translate(-50%)`; // 计算缩放的比例 function getScale(w = 1920, h = 1080) { // 屏幕的宽|高/设计稿的宽|高 const ww = window.innerWidth / w; const wh = window.innerHeight / h; return ww < wh ? ww : wh; } window.onresize = () => { box.style.transform = `scale(${getScale()}) translate(-50%)` } </script>
到此这篇gridview自适应宽度(webview自适应高度)的文章就 介绍到这了,更多相关内容请继续浏览下面的相关 推荐文章,希望大家都能在 编程的领域有一番成就!

版权声明


相关文章:

  • vb for语句循环(vb.net for循环语句)2025-04-17 07:18:09
  • pdf viewer怎么导入pdf(pdf viewer怎么使用)2025-04-17 07:18:09
  • docker里启动docker(docker 启动minio)2025-04-17 07:18:09
  • fedora换国内源(fedora更换国内源)2025-04-17 07:18:09
  • redhat证书难考吗(red hat证书)2025-04-17 07:18:09
  • 连接redis为啥不用写用户名(连接redis不需要用户名么)2025-04-17 07:18:09
  • dhclient没反应(dhclient is already running)2025-04-17 07:18:09
  • 断开连接(airpods总是自动断开连接)2025-04-17 07:18:09
  • spring aop日志(spring日志记录)2025-04-17 07:18:09
  • oracle视频教程全集(oracle全套教学视频百度云)2025-04-17 07:18:09
  • 全屏图片