javascript - Clustering markers with infowindow in googlemaps v3 api -
i cant clusterermarker work. want markers cluster when close each other , have found:
var mcoptions = {gridsize: 50, maxzoom: 15}; var mc = new markerclusterer(map, markers, mcoptions);
but cant them work code, either markers disappear or 1 visible (not in correct way). hope can me problem.
for (var = 0; < locations.length; i++) { var marker = new google.maps.marker({ position: new google.maps.latlng(locations[i][1], locations[i][2]), map: map }); google.maps.event.addlistener(marker, 'mouseover', (function (marker, i) { return function () { infowindow.setcontent(locations[i][0]); infowindow.open(map, marker); } })(marker, i)); }
var gmarkers = []; (var = 0; < locations.length; i++) { var marker = new google.maps.marker({ position: new google.maps.latlng(locations[i][1], locations[i][2]), map: map }); google.maps.event.addlistener(marker, 'mouseover', (function (marker, i) { return function () { infowindow.setcontent(locations[i][0]); infowindow.open(map, marker); } })(marker, i)); gmarkers.push(marker); } var markercluster = new markerclusterer(map, gmarkers);
Comments
Post a Comment