Leaflet: dynamically set min / maxZoom

I am using Leaflet v0.7, and there seems to be no setters for the min / maxZoom map on the map or tileLayer.

Is there a way to set these values โ€‹โ€‹dynamically?

+5
source share
1 answer

If you have an initialized card

var map = L.map('map').setView([51.505, -0.09], 13); 

then you can just do:

 map.options.minZoom = 12; map.options.maxZoom = 14; 

JSFiddle example .

+18
source

Source: https://habr.com/ru/post/1208842/


All Articles