谷歌地图不正确渲染 [英] google maps not rendering correctly

查看:314
本文介绍了谷歌地图不正确渲染的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我玩弄骨干和gmaps.js,由于某种原因地图不正确渲染...

I am playing around with backbone and gmaps.js and for some reason the map is not rendering correctly...

这些控制器无法显示正确的,信息窗口奇怪渲染了。

The controllers are not showing up right, and the infowindow is rendering oddly too.

我使用的是 gmaps.js库。我甚至不知道如何调试这个事情...

I am using the gmaps.js library. I don't even know how to debug this thing...

下面是我在地图视图骨干:

Here is my backbone view for the map:

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);
   },
});

感谢

推荐答案

我见过类似的截屏问题和解决方法是在这些行添加到CSS:

I've seen questions with similar screenshots and the fix is in adding these lines to CSS:

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

(如果需要的话,与地图的DIV ID或类名替换#map)不相关的骨干或gmaps.js,我不认为,你的网页大概其他一些组件。

(if needed, replace #map with your map's div id or class name) Not related to backbone or gmaps.js, I don't think, probably some other component of your page.

这篇关于谷歌地图不正确渲染的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆