Search code examples
google-mapsgoogle-maps-api-3markerclusterer

Infowindow not opening over marker


I'm trying to get markerclusters to work with a sidebar.

I have tried this: http://www.geocodezip.com/v3_MW_example_map3_clustered.html

but I am having the same issue that the infowindow is not opening over the marker, when the link is clicked.

Can anyone help with this please.


Solution

  • You want to have two more things happen when they click on the side bar. You want to pan to that location, and you want to set the zoom at an appropriate level so you can actually see the marker.

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

    could be changed to

    google.maps.event.addListener(marker, 'click', function() {
        map.panTo(marker.position);
        map.setZoom(13);
        infowindow.setContent(contentString); 
        infowindow.open(map,marker);
        });
    

    This allows the map to travel to the marker and make it visible, before it displays the info window.