百度地图api-自定义覆盖物
function addMarker(map,point,index){ // 创建图标对象
var myIcon = new BMap.Icon("markers.png", new BMap.Size(23, 25), {
offset: new BMap.Size(10, 25),
imageOffset: new BMap.Size(0, 0 - index * 25) // 设置图片偏移
});
var marker = new BMap.Marker(point, {icon: myIcon});
map.addOverlay(marker);
}
function initMap(orgName,orgAddress,orgTel,pointX,pointY){
var map = new BMap.Map("allmap");
var point = new BMap.Point(pointY, pointX);
map.centerAndZoom(point, 15);
map.enableScrollWheelZoom(true);
addMarker(map,point,1);
var opts = {
width : 250, // 信息窗口宽度
height: 100, // 信息窗口高度
}
var content = orgName + '<br>' + '地址:' + orgAddress + '<br>' + '电话:' + orgTel;
var infoWindow = new BMap.InfoWindow(content, opts); // 创建信息窗口对象
map.openInfoWindow(infoWindow, map.getCenter()); // 打开信息窗口
$(".title").text(orgName);
} 相关推荐
magvwiz 2020-09-26
mickeychan 2020-09-17
rungod 2020-09-16
xiaozhukuaitui 2020-09-05
小西0 2020-09-05
xiaozhukuaitui 2020-08-25
龙心尘 2020-08-25
rungod 2020-08-22
waiwaiLILI 2020-07-20
shilongdred 2020-06-28
人工智能快报 2020-06-09
shilongdred 2020-06-08
id=3&hmsr=%E5%BC%80%E5%8F%91%E8%80%85-AI%E5%AD%A6%E4%B9%A0%E8%B7%AF%E7%BA%BF&hmpl=&hmcu=&hmkw=&hmci=
zmosquito 2020-06-02
nextwhy 2020-05-20
fengyeezju 2020-04-20
etzt 2020-04-16