第18行: | 第18行: | ||
| [[jspopularGL/guide/infoWindow|信息窗口]] | | [[jspopularGL/guide/infoWindow|信息窗口]] | ||
|} | |} | ||
− | </div></div><div class="header"><div class="active">核心代码</div></div><div class="pre-wrap"><div class="pre-wrap-w pre-wrap-w-and"><pre class="prettyprint | + | </div></div><div class="header"><div class="active">核心代码</div></div><div class="pre-wrap"><div class="pre-wrap-w pre-wrap-w-and"><pre class="prettyprint codestyle"> var map = new BMapGL.Map('container'); |
− | + | ||
var point = new BMapGL.Point(116.404, 39.928); | var point = new BMapGL.Point(116.404, 39.928); | ||
map.centerAndZoom(point, 15); | map.centerAndZoom(point, 15); | ||
第37行: | 第36行: | ||
}); | }); | ||
</pre> | </pre> | ||
− | + | </div></div></div></div> |
2020年10月9日 (五) 16:48的最后版本
点覆盖物详情查看
功能场景
该示例介绍如何在地图上添加点标记,并如何给点标记添加点击弹出信息窗口。
DEMO
https://bj.bcebos.com/v1/mapopen/api-demos/video/点覆盖物详情查看.mp4
绘制点覆盖物,并为其添加信息窗口
核心代码
var map = new BMapGL.Map('container'); var point = new BMapGL.Point(116.404, 39.928); map.centerAndZoom(point, 15); map.enableScrollWheelZoom(true); var marker1 = new BMapGL.Marker(new BMapGL.Point(116.404, 39.925)); map.addOverlay(marker1); // 将标注添加到地图中 var opts1 = { title: '故宫博物馆', content: '故宫博物馆的简介', width: 220, height: 80 }; var infoWindow1 = new BMapGL.InfoWindow('地址:北京市东城区王府井大街88号乐天银泰百货八层', opts1); marker1.addEventListener('click', function () { map.openInfoWindow(infoWindow1, point1); });