2014-02-24 51 views
1

我对JS很新,所以也许我的问题很容易解决,虽然我已经花了很多时间。使用mapbox禁用世界地图的水平重复

我正在使用Mapbox与单张api,并且我想在缩小时禁用水平世界地图的重复。我已经探索了maxBounds属性,但它并不令人满意,因为我想将地图隐藏在边界之外。基本上,我想这个结果http://jsfiddle.net/zF6bf/,而不是“帆布”,我想这张地图,存储在mapbox.com:cartogrph.hbem5mod

此外,我想禁用拖动和缩放处理程序,所以我正在寻找一个解决方案,将与以下兼容:

// disable drag and zoom handlers 
map.dragging.disable(); 
map.touchZoom.disable(); 
map.doubleClickZoom.disable(); 
map.scrollWheelZoom.disable(); 
// disable tap handler, if present. 
if (map.tap) map.tap.disable(); 

任何人都可以帮助我吗?我会非常感激。

由于提前, 乔纳斯

回答

1

请参阅该文档:Disable World Wrapping

<script> 
var map = L.mapbox.map('map','cartogrph.hbem5mod', { 
    // these options apply to the tile layer in the map 
    tileLayer: { 
     // this map option disables world wrapping. by default, it is false. 
     continuousWorld: false, 
     // this option disables loading tiles outside of the world bounds. 
     noWrap: true 
    } 
}).setView([38, -102.0], 5); 
</script>