-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
34 lines (29 loc) · 1015 Bytes
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<!DOCTYPE>
<html>
<head>
<meta charset="utf-8"/>
<title>Hello World</title>
<style>
body{margin:0;padding: 0;background-color: black;}
canvas#rolejs{width:100%;height:100%}
</style>
<script>
function handleWindowResize() {
// 获取窗口的宽度和高度
var windowWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
var windowHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
// 获取要更改的div元素
var divElement = document.getElementById('rolejs');
// 设置div元素的宽度和高度为窗口的宽度和高度
divElement.style.width = windowWidth + 'px';
divElement.style.height = windowHeight + 'px';
}
// 监听窗口大小变化的事件
window.addEventListener('resize', handleWindowResize);
</script>
<body>
<canvas id="rolejs"></canvas>
<script type="text/javascript" src="PEngine.js"></script>
</body>
</head>
</html>