Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Popup on hovering over cluster group

I want to add popup on cluster group made using Leaflet.markercluster just like the popups that come on hovering over the leaflet markers.

like image 941
Deepak Banka Avatar asked Aug 18 '15 08:08

Deepak Banka


1 Answers

I was able to find the answer with the help of issues present in the github page of leaflet.markercluster

cluster.on('clustermouseover', function(c) {
              var popup = L.popup()
                  .setLatLng(c.layer.getLatLng())
                  .setContent(c.layer._childCount +' Locations(click to Zoom)')
                  .openOn(map);
              }).on('clustermouseout',function(c){
                   map.closePopup();
              }).on('clusterclick',function(c){
                   map.closePopup();
              }); 
like image 154
Deepak Banka Avatar answered Oct 03 '22 14:10

Deepak Banka