LeafletJS: How to remove the zoom control
If you want to dynamically turn on and off zooming you can do something like this:
map.touchZoom.disable();
map.doubleClickZoom.disable();
map.scrollWheelZoom.disable();
map.boxZoom.disable();
map.keyboard.disable();
$(".leaflet-control-zoom").css("visibility", "hidden");
Thanks to coordinate's answer I was able to figure out the correct method. The solution is:
// Create the map
var map = L.mapbox.map('map', null, { zoomControl:false });
// Create my custom layer
var layer = L.mapbox.tileLayer('MAPBOX-ID', {
format: 'jpg80',
minZoom: 13,
maxZoom:15,
tileSize: 256,
reuseTiles: true,
unloadInvisibleTiles: true
});
// Add the layer
map.addLayer(layer);
This worked for me:
var map = new L.map('map', { zoomControl: false });
With mapbox try:
var map = L.mapbox.map('map', { zoomControl: false });
See map creation and the zoomControl option in the Leaflet documentation.
you can remove the control zoomControl
in this way:
map.removeControl(map.zoomControl);