2012-06-14 159 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

救了我一大堆的海尔,谢谢:-) –