人生若只如初见

高德地图注册自定义窗体和移除点击事件

电脑版发表于:2020/12/2 9:57

    //注册自定义窗体
   var infoWindow = new AMap.InfoWindow({
         isCustom: true,  //使用自定义窗体
        content: createInfoWindow(content),//自定义窗体,传入dom或者HTML字符串
        offset: new AMap.Pixel(16-57)//位移量
    });

    function createInfoWindow(content){
        return content
    }

    //tMarker 当前点(覆盖物)
     
var event = AMap.event.addListener(tMarker, 'click'function () {
          infoWindow.open(map, tMarker.getPosition());
    });

       //关闭信息窗体
      function closeInfoWindow() {
         map.clearInfoWindow();
      }
    //移除当前自定义窗体
    AMap.event.removeListener(event);




关于TNBLOG
TNBLOG,技术分享。技术交流:群号677373950
ICP备案 :渝ICP备18016597号-1
App store Android
精彩评论
{{item.replyName}}
{{item.content}}
{{item.time}}
{{subpj.replyName}}
@{{subpj.beReplyName}}{{subpj.content}}
{{subpj.time}}
猜你喜欢