Question: Is it possible to use Leaflet.label on Leaflet.markercluster?
Problem: I am trying to have a HTML div appear when the cursor hovers over a cluster icon.
For a normal Marker, you can use attach a label to a marker using
L.marker([-37.7772, 175.2606]).bindLabel('Look revealing label!').addTo(map);
http://jsfiddle.net/WUXXz/
var label = null;
markers.on('clustermouseover', function (a) {
label = new L.Label().setLatLng(a.layer.getLatLng())
.setContent('<p>Hello world!<br />This is a nice popup.</p>')
.openOn(map);
});
markers.on('clustermouseout', function () {
if (label) {
label.close();
label = null;
}
});
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