block by mapsam e66a8d12c23e4bedd0ed

Leaflet layer toggling

Full Screen

Showing the functionality of toggling layers in Leaflet while preserving their reference for later usage (i.e. turning the layer back on). This is useful when working with many layers in leaflet and turning opacity to 0 won’t cut it because it can have negative effects when hover and click events require properly layered DOM elements.

Important takeaways:

index.html