Menu
  • HOME
  • TAGS

Multiple infoBubbles in google maps api shows just last added

jquery,google-maps,google-maps-api-3,infobubble

I found it, just replace: google.maps.event.addListener(marker, 'click', function () { infoBubble.open(map, marker); console.log(infoBubble.content); }); with: google.maps.event.addListener(marker, 'click', function () { infoBubble.setContent(this.content); infoBubble.open(map, this); }); Thank you for help....

Showing same marker details after close of markers using infobubbles

javascript,html,google-maps-api-3,infobubble

the infoBubble-variable will be overwritten inside the loop. Solution: pass the infoBubble as argument to the function that adds the click-listener: (function (marker, data , infoBubble) { google.maps.event.addListener(marker, 'click', function () { infoBubble.open(map, marker); }); }(marker, data, infoBubble)); ...