-
Notifications
You must be signed in to change notification settings - Fork 0
/
map.html
70 lines (66 loc) · 1.69 KB
/
map.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
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
63
64
65
66
67
68
69
70
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>地震位置</title>
</head>
<script charset="utf-8"
src="https://map.qq.com/api/gljs?v=1.exp&key=KNABZ-TFCA4-PY5UU-XP4VW-546TE-JLBLU"></script>
<style type="text/css">
body,html{height:100%;margin:0;padding:0}#container{width:100%;height:100%}
</style>
<body onload="initMap()">
<div id="container"></div>
<script>
//get variables from url
function getQueryVariable(variable){
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
if(pair[0] == variable){return pair[1];}
}
return(false);
}
var message = decodeURI(getQueryVariable("m"));
var title = decodeURI(getQueryVariable("t"));
var lat = getQueryVariable("la");
var lon = getQueryVariable("ln");
function initMap() {
var center = new TMap.LatLng(lat,lon);
var map = new TMap.Map("container", {
center: center,
zoom: 1,
});
var marker = new TMap.MultiMarker({
id: 'marker-layer',
map: map,
styles: {
"marker": new TMap.MarkerStyle({
"width": 23,
"height": 35,
"anchor": { x: 12, y: 32 },
})
},
geometries: [{
"id": 'demo1',
"styleId": 'marker',
"position": new TMap.LatLng(lat,lon),
"properties": {
"title": 'marker'
}
}]
});
//set infoWindow
var infoWindow = new TMap.InfoWindow({
map: map,
position: center,
content: title +'<br>'+ message,
offset: { x: 0, y: -32 }
});
}
</script>
</body>
</html>