2012-06-14 152 views
4

我玩弄骨幹和gmaps.js出於某種原因,該地圖是不正確的渲染......谷歌地圖不正確渲染

的控制器沒有顯示正確的,信息窗口奇怪的渲染過。我正在使用gmaps.js library。我甚至不知道如何調試這件事......

這裏是我的地圖骨幹觀點:

App.MapView = Backbone.View.extend({ 
    el: '.map', 
    initialize: function() { 
     this.map = new GMaps({ 
      div: this.el, 
      lat: -12.043333, 
      lng: -77.028333, 
     }); 
     App.houseCollection.bind('reset', this.populateMarkers, this); 
    }, 
    populateMarkers: function(collection) { 
     _.each(collection.models, function(house) { 
      var html = 'hello' 
      this.map.addMarker({ 
       lat: house.attributes.lat, 
       lng: house.attributes.lng, 
       infoWindow: { 
        content: html, 
       }     
      }); 
     }, this); 
    }, 
}); 

感謝

enter image description here

回答

7

我已經看到了問題類似的截圖和修補程序是將這些行添加到CSS:

#map label { width: auto; display:inline; } 
#map img { max-width: none; max-height: none; } 

(如果需要,請將#map替換爲地圖的div id或class name)與backbone或gmaps.js無關,我不認爲它可能是頁面的其他組件。

+0

那麼修好了!非常感謝。這可能與bootstrap.css有關,可能會改變一些東西... – AlexBrand

+0

不客氣!令我驚訝的是,Google地圖如何只是一堆巧妙排列的圖像。 –

+0

救了我一大堆的海爾,謝謝:-) –