tnblog
首页
视频
资源
登录

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

6713人阅读 2020/12/2 9:57 总访问:226779 评论:0 收藏:0 手机
分类: 前端

    //注册自定义窗体
   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);




评价
若人生只如初见,愿还是相遇的那个下午,阳光明媚转身一笑便如春暖花开
排名
6
文章
6
粉丝
16
评论
8
{{item.articleTitle}}
{{item.blogName}} : {{item.content}}
ICP备案 :渝ICP备18016597号-1
网站信息:2018-2024TNBLOG.NET
技术交流:群号656732739
联系我们:contact@tnblog.net
欢迎加群交流技术