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.
http://jsfiddle.net/LzUkF/28/
Any answers gratefully received.
You only need to set the zoomToBoundsOnClick
-option of the L.markerClusterGroup()
to false: http://jsfiddle.net/LzUkF/29/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With