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

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -