将鼠标悬停在群集组上时弹出 [英] Popup on hovering over cluster group
本文介绍了将鼠标悬停在群集组上时弹出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在使用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屋!
查看全文