Google Maps API, all markers opening the same infowindow

后端 未结 2 1454
再見小時候
再見小時候 2021-01-24 02:35

I\'ve got a page that retrieves a bunch of locations and some data about their associated markers and puts them on a Google Maps map. Each one is supposed to pop up its own litt

2条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-24 03:11

    I had this once, too. It is a scoping issue. I had to change my structure a little bit but maybe in your case changing the callback could already help:

    GEvent.addListener(marker, "click", function() {
     marker.openInfoWindowHtml(pins[i].getElementsByTagName("message")[0].childNodes[0].nodeValue;);
    });
    

提交回复
热议问题