地图有时仅出现在其 div 的左上角 [英] Map sometimes appears only on upper left corner of its div

查看:26
本文介绍了地图有时仅出现在其 div 的左上角的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Google Maps API v3 for javascript.在某些情况下,我只看到左上角的地图.要查看,请尝试转到 http://telofast.com/telofun/#stationRanking 然后按多行之一.

I'm using the Google Maps API v3 for javascript. On certain cases I only see the map on the upper left corner. To see, please try going to http://telofast.com/telofun/#stationRanking and then pressing on one of the many lines.

推荐答案

当浏览器调整大小时,地图可以正常工作,因为宽度和高度设置正确并引发调整大小事件.

The map works when the browser is resized as the width and height are correctly set and the resize event is raised.

解决您的问题的最快方法是在显示它的 javascript 之后调用 resize 方法(如下).也许在 showDiv('mapDiv');showScoresAndCenterOn 之后?

The quickest solution to your problem would be to call the resize method (below) after the javascript which reveals it. Maybe after showDiv('mapDiv'); in showScoresAndCenterOn?

google.maps.event.trigger(map, 'resize');

这篇关于地图有时仅出现在其 div 的左上角的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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