I've been struggling to cancel the click event that occurs when clicking on a cluster in leaflet. So when I click on a clustered pin the map zooms in. I'd like a custom popup to appear or at least have some way of making sure the map doesn't zoom in when I click on the clustered pin.
I've tried various tricks that I remember such as
layerMakers.on('clusterclick', function(e) {
e.originalEvent.preventDefault();
e.originalEvent.stopPropagation();
L.DomEvent.stopPropagation(e);
return false;
});
Here is a fiddle demonstrating the problem. Note I've left out all my attempts from this just to make it easier to play with.
Any answers gratefully received.
您只需zoomToBoundsOnClick
L.markerClusterGroup()
的zoomToBoundsOnClick
-option设置为false: http : //jsfiddle.net/LzUkF/29/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.