悬停在群集组上时弹出

Popup on hovering over cluster group

我想在使用 Leaflet.markercluster 制作的集群组上添加弹出窗口,就像悬停在传单标记上的弹出窗口一样。

借助 leaflet.markercluster

的 github 页面中存在的问题,我找到了答案
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();
              });