2014-02-24 52 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>