百度地图动态插入标注

1.点击地图上面的红旗图片后,在地图上面点击动态添加标注

百度地图动态插入标注_第1张图片

  style="position:absolute;top:7px; right:450px; z-index:20;cursor:pointer;background:#cccccc;border:1px solid #ffffff;width:60px;height:30px;text-align:center;">
  
 

 

2.

$('.mypig').live(
   "click",
   function(even) {
    window.clickPointer = "tuodong";
    drawingManager.close();
    var str = $(this).attr("imgVal");
    map.addEventListener("click", function(e) {
     if (str == 1) {
      var point = new BMap.Point(e.point.lng, e.point.lat);
      var myIcon = new BMap.Icon("../images/flag.png",
        new BMap.Size(38, 47));
      var marker = new BMap.Marker(point, {
       icon : myIcon
      }); // 创建标注
      marker.disableMassClear();
      map.addOverlay(marker);
     }
     str = 0;
    });
   });

百度地图动态插入标注_第2张图片

转载于:https://www.cnblogs.com/lyming/p/4140194.html

你可能感兴趣的:(百度地图动态插入标注)