Control max zoom - Javascript Leaflet

Javascript examples for Leaflet:Zoom

Description

Control max zoom

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <link rel="stylesheet" type="text/css" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css"> 
      <script type="text/javascript" src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script> 
      <style id="compiled-css" type="text/css">

html, body, #map {
   width: 100%;
   height: 100%;
   padding: 0;
   margin: 0;
}


      </style> 
      <script type="text/javascript">
    window.onload=function(){/* ww  w .j a  v  a  2  s .  c  o m*/
var map = new L.Map('map').setView([55, 0], 3);
var basemap = new L.TileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors',
  maxZoom: 19
});
map.addLayer(basemap);
basemap.on('loading', function (event) {
   console.log('start loading tiles');
});
basemap.on('load', function (event) {
   console.log('all tiles loaded');
});
basemap.on('tileloadstart', function (event) {
   console.log('start loading 1 tile');
});
    }

      </script> 
   </head> 
   <body> 
      <div id="map"></div>  
   </body>
</html>

Related Tutorials