2012-12-09 39 views
2

我正在嵌入mapbox地圖 - 我發現在地圖中間放置了一個空白行,正如您可以從附加圖像中看到的那樣。Mapbox - 圖層中的奇怪白線

enter image description here

有誰知道問題是什麼?

我也使用twitter-bootstrap框架。

,這是地圖div HTML/CSS我用:

<div class="map"></div> 

    .map{ 
     max-width:none !important; 
     width:100% !important; 
     height:250px !important; 
     max-height:250px; 
     position: relative; 
     margin:0 auto !important; 
    } 

,這是我的js:

var map = mapbox.map(_element); 
map.addLayer(mapbox.layer().id('examples.map-uh4ustwo')); 

// Create an empty markers layer 
var markerLayer = mapbox.markers.layer(); 

// Add interaction to this marker layer. This 
// binds tooltips to each marker that has title 
// and description defined. 
mapbox.markers.interaction(markerLayer); 
map.addLayer(markerLayer); 

map.zoom(3).center({ lat: _json.lat, lon: _json.lon }); 

// Add a single feature to the markers layer. 
// You can use .features() to add multiple features. 
markerLayer.add_feature({ 
    geometry: { 
     coordinates: [_json.lon, _json.lat] 
    }, 
    properties: { 
     'marker-color': '#F96363', 
     'marker-symbol': 'circle-stroked', 
     /*title: 'Example Marker', 
     description: 'This is a single marker.' 
     */ 
    } 
}); 

感謝。

+0

你有沒有忘了附上圖片? – salih0vicX

+0

@ salih0vicX是的,現在有 – sbaaaang

回答

6

首先,檢查你沒有任何'響應圖像'的東西打開,這將混亂的地圖圖像的大小。

然後,儘量不要使用!important這麼多。

最後,檢查您的瀏覽器沒有放大或縮小。在Chrome中,點擊⌘0

+0

我重新設定了規則,現在它像一個魅力,thx – sbaaaang

+0

讓我的Chrome放大:)。謝謝! – ohlando

3

該問題與這個事實有關,默認情況下,leaflet.js使用CSS3 3D轉換來定位切片,並且操作系統和瀏覽器的某些組合無法正確處理。

的解決辦法是禁用加載實際庫之前3D變換:

<script>L_DISABLE_3D = true;</script> 
<script src="mapbox.js"></script> 

這解決了白線的問題,我在Firefox的引導/ Mapbox應用

+0

這對我有效。謝謝。 (我也嘗試了標記的解決方案,這使得白線發生較少但並未完全消失。) – ippi