0

因此,我一直在弄清楚如何在 overlaycomplete 事件期间将信息窗口添加到标记。我已经想出了如何为标记添加标题,但我无法让信息窗口工作....有什么帮助吗?

这是我目前必须创建标题的代码...

google.maps.event.addListener(drawingManager, 'overlaycomplete', function(event) {
  if (event.type == google.maps.drawing.OverlayType.MARKER) {
     event.overlay.setTitle("Hello");
  }
});
4

1 回答 1

1
google.maps.event.addListener(drawingManager, 'overlaycomplete', function(event) {
  if (event.type == google.maps.drawing.OverlayType.MARKER) {
    //event.overlay.setTitle("Hello");
    var infowindow = new google.maps.InfoWindow({
      content: '<div id="content" onmouseover="updateContent()">Hello</div>',
      maxWidth: 10
    });
    google.maps.event.addListener(event.overlay,'click',function(){
      infowindow.open(map,event.overlay);
    });
  }
});
于 2012-09-05T20:27:40.510 回答