分类:
前端
//注册自定义窗体
var infoWindow = new AMap.InfoWindow({
isCustom: true, //使用自定义窗体
content: createInfoWindow(content),//自定义窗体,传入dom或者HTML字符串
offset: new AMap.Pixel(16, -57)//位移量
});
function createInfoWindow(content){
return content
}
//tMarker 当前点(覆盖物)return content
}
var event = AMap.event.addListener(tMarker, 'click', function () {
infoWindow.open(map, tMarker.getPosition());
});
//关闭信息窗体
function closeInfoWindow() {
map.clearInfoWindow();
}
//移除当前自定义窗体 AMap.event.removeListener(event);
评价