Popup on hovering over cluster group

浪尽此生 提交于 2019-12-13 00:55:18

问题


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


回答1:


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


来源:https://stackoverflow.com/questions/32067832/popup-on-hovering-over-cluster-group

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!