I am using the Leaflet markercluster plug in, and now want to add a button to turn the clustering on/off. For that I wanted to use the leaflet button plug in, because I am already using it in my code.
I tried around with this piece of code and customized the lines with "sidebar" in it.
var button = new L.Control.Button('Toggle me', {
toggleButton: 'active'
});
button.addTo(map);
button.on('click', function () {
if (button.isToggled()) {
sidebar.hide();
} else {
sidebar.show();
}
});
I also have an overlay where I want to implement those layers then.
How I cluster my markers:
var extern2 = L.markerClusterGroup();
extern2.addLayer(extern);