This example demonstrates the zoomToBoundsOnClick option. When you click a cluster, the map zooms and pans to fit all markers within that cluster in the
viewport.
// Enable zoom to bounds on cluster click (default: true)
let markers = new L.MarkerClusterGroup({
zoomToBoundsOnClick: true
});
// Or use programmatically:
markers.on('clusterclick', function(a) {
a.sourceTarget.zoomToBounds();
});
Features:
Tip: Click on any cluster icon to zoom in and see all markers it contains.