-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmap-simple.html
More file actions
62 lines (59 loc) · 1.59 KB
/
map-simple.html
File metadata and controls
62 lines (59 loc) · 1.59 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>腾讯地图</title>
<style>
html, body {
height: 100%;
margin: 0;
padding: 0;
overflow: hidden;
}
#container {
width: 100%;
height: 100%;
}
.loading {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: rgba(255,255,255,0.9);
padding: 20px;
border-radius: 8px;
text-align: center;
z-index: 1000;
}
</style>
</head>
<body>
<div class="loading">正在加载地图...</div>
<div id="container"></div>
<script src="https://map.qq.com/api/gljs?v=1.exp&key=6BFBZ-BRBKC-Z342A-AJULT-IAMSZ-JGBKI"></script>
<script>
// 移除加载提示
setTimeout(() => {
document.querySelector('.loading').style.display = 'none';
}, 2000);
// 初始化地图
function initMap() {
var center = new TMap.LatLng(29.589483, 106.486053);
var map = new TMap.Map('container', {
center: center,
zoom: 17.2,
pitch: 43.5,
rotation: 45,
mapStyleId: 'style1'
});
}
// 等待TMap加载
setTimeout(() => {
if (typeof TMap !== 'undefined') {
initMap();
}
}, 1000);
</script>
</body>
</html>