悬停在集群组上的弹出窗口 [英] Popup on hovering over cluster group

查看:11
本文介绍了悬停在集群组上的弹出窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

推荐答案

借助leaflet.markercluster的github页面中存在的问题我能够找到答案

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

这篇关于悬停在集群组上的弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆