-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmap.html
30 lines (29 loc) · 1.19 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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
body, html,#allmap {width: 100%;height: 100%;overflow: hidden;margin:0;}
#golist {display: none;}
@media (max-device-width: 780px){#golist{display: block !important;}}
</style>
<script type="text/javascript" src="http://api.map.baidu.com/api?type=quick&ak=l0dG4x26vqd3I5yGlGGaVqDg&v=1.0"></script>
<title>添加普通标注点</title>
</head>
<body>
<a id="golist" href="../demolist.htm">返回demo列表页</a>
<div id="allmap"></div>
</body>
</html>
<script type="text/javascript">
// 百度地图API功能
var map = new BMap.Map("allmap");
map.centerAndZoom(new BMap.Point(116.424863,40.002867), 14);
map.addControl(new BMap.ZoomControl()); //添加地图缩放控件
var marker1 = new BMap.Marker(new BMap.Point(116.424863,40.002867)); //创建标注
map.addOverlay(marker1); // 将标注添加到地图中
//创建信息窗口
var infoWindow1 = new BMap.InfoWindow("普通标注");
marker1.addEventListener("click", function(){this.openInfoWindow(infoWindow1);});
</script>