LeafletJS:如何清除变焦控件 [英] LeafletJS: How to remove the zoom control

查看:197
本文介绍了LeafletJS:如何清除变焦控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 LeafletJS 地图上移除缩放控件(+/-)。

I'm trying to remove the zoom controls (+/-) on a LeafletJS map.

我正在使用 MapBox.js版本的Leaflet ,但大多数操作与Leaflet相同。我实现这样的地图:

I'm using the MapBox.js version of Leaflet but most of the operations are the same as Leaflet. I implement my map like this:

var map = L.mapbox.map('map');

var layer = L.mapbox.tileLayer('MAPBOX-ID', {
    format: 'jpg70',
    minZoom: 13,
    maxZoom: 15,
    reuseTiles: true, 
    unloadInvisibleTiles: true
});
map.addLayer(layer);
map.setView([40.73547,-73.987856]);

文档说有一个zoomControl选项,将从地图中删除缩放控件,但我没有运气让它上班。

The documentation says there's a zoomControl option that will remove the zoom control from the map but I've had no luck in getting it to work.

如何使用此实现删除缩放控件?

How can I remove the zoom control with this implementation?

谢谢!

推荐答案

这对我来说很有用。 p>

This is work for me.

var map = new L.Map('map', { zoomControl:false });

你尝试过吗?

var map = L.mapbox.map('map', { zoomControl:false });

这篇关于LeafletJS:如何清除变焦控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆