I'm using Leaflet v0.7 and there seem to be no setters for min/maxZoom on the map or tileLayer.
Is there any way to set these values dynamically?
To enable it, use the map's zoomSnap option. The zoomSnap option has a default value of 1 (which means that the zoom level of the map can be 0 , 1 , 2 , and so on). If you set the value of zoomSnap to 0.5 , the valid zoom levels of the map will be 0 , 0.5 , 1 , 1.5 , 2 , and so on.
setView : Set the view of the map (center and zoom level) flyTo : Flys to a given location/zoom-level using smooth pan-zoom. fitBounds : Set the bounds of a map. flyToBounds : Flys to given bound using smooth pan/zoom. setMaxBounds : Restricts the map view to the given bounds.
A reset view control for Leaflet. Move the map then click the reset button to see the reset effect.
Used to load and display tile layers on the map, implements ILayer interface.
If you have your map initialized
var map = L.map('map').setView([51.505, -0.09], 13);
then you can simply do:
map.options.minZoom = 12;
map.options.maxZoom = 14;
Example JSFiddle.
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