markerclusterer info windows

前端 未结 4 1781
遇见更好的自我
遇见更好的自我 2020-12-15 14:18

Let me say I am still fairly new to google maps and javascript. i\'ve been mixing together the google store locator tutorial with some other stuff. So far, I am using mark

4条回答
  •  失恋的感觉
    2020-12-15 14:41

    Raphael Isidro's solution didn't work for me. Oddly enough, the marker text was empty and it was being positioned at grid (0,0) of my screen.

    This worked perfectly for me:

    var markerCluster = new MarkerClusterer(map, my_markers ,{zoomOnClick: false});
    google.maps.event.addListener(markerCluster, 'clusterclick', function(cluster) {
      var content = '';
      // Convert lat/long from cluster object to a usable MVCObject
      var info = new google.maps.MVCObject;
      info.set('position', cluster.center_);
      iw.close();
      iw.setContent('

    Hi this is my Info Window

    '); iw.open(map, info); });

    Working example here: See http://krisarnold.com/2010/10/15/adding-info-windows-to-map-clusters-with-google-maps-api-v3/

提交回复
热议问题