Popup on hovering over cluster group
Asked Answered
P

1

5

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

Putput answered 18/8, 2015 at 8:54 Comment(0)
P
9

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();
              }); 
Putput answered 27/8, 2015 at 6:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.