JSDM

HTML

 
1
<div id="app">中华人民共和国</div>
2

CSS

xxxxxxxxxx
10
 
1
*{
2
  padding: 0;
3
  margin: 0;
4
}
5
#app{
6
  width: 960px;
7
  height: 540px;
8
  background-color: #ccc;
9
  position: relative;
10
}
? ?
? ?
必须是有效的URL
+ 添加另一个资源

JS

xxxxxxxxxx
17
 
1
/*16:9缩放*/
2
window.addEventListener('load', adaptation);
3
window.addEventListener('resize', adaptation);
4
5
function adaptation() {
6
  let el = document.getElementById('app')
7
  console.log({obj:el})
8
  const win_w = window.innerWidth;
9
  const win_h = window.innerHeight;
10
  const app_w = el.clientWidth;
11
  const app_h = el.clientHeight;
12
  const scale_w = win_w / app_w
13
  const sclae_h = win_h / app_h
14
  const left = -(app_w - win_w) / 2
15
  const top = -(app_h - win_h) / 2
16
  el.setAttribute('style', 'transform: scale(' + scale_w + ',' + sclae_h + ');left:' + left + 'px;top:' + top + 'px;');
17
}
必须是有效的URL
+ 添加另一个资源
Close

文件管理 点击文件查看URL

图片

  1. 暂无文件

CSS

  1. 暂无文件

JavaScript

  1. 暂无文件

其他

  1. 暂无文件
拖动文件到上面的区域或者:
加载中 ..................