Deepak Banka
Deepak Banka

Reputation: 599

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.

Upvotes: 5

Views: 3672

Answers (1)

Deepak Banka
Deepak Banka

Reputation: 599

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();
              }); 

Upvotes: 9

Related Questions