Skip to content Skip to sidebar Skip to footer

Google Maps Individual Marker Infowindow - How To?

I have this working multy markers script. Markers are printed on the map but when I click on any marker I can see same info window.. Something wrong in this loop: function bind

Solution 1:

First of all declare infowindow globally in following way:

var infoWindow = new google.maps.InfoWindow();

Then after creating marker and content string just call this function:

bindInfoWindow(marker, map, infoWindow, content);

This is the definition of function bindInfoWindow()

function bindInfoWindow(marker, map, infowindow, content) {
        google.maps.event.addListener(marker, 'click', function() {
            infowindow.setContent(content);
            infowindow.open(map, marker);
        });
    }

Post a Comment for "Google Maps Individual Marker Infowindow - How To?"