在地图选项上设置 Google Map v3 大小 [英] Setting Google Map v3 size on map options

查看:22
本文介绍了在地图选项上设置 Google Map v3 大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 Joomla 标签中设置 Google 地图 (v3),但地图上存在显示问题.

I am trying to set up Google map (v3) inside Joomla tabs but there is display problems on map.

如果我离开地图所在的选项卡并将地图画布改回灰色并且地图仅部分显示在地图画布的左上角.

If i move away from tab where the map is and change back map canvas is grey and map is displayed only partially on left corner of map canvas.

带屏幕截图的图像:

我在其他网站上通过在地图参数上设置地图大小来实现这一点,但是使用了谷歌地图版本 2,我找不到在版本 3 地图上设置地图大小的正确语法.

I get this worked on other site by setting map size on map parameters but there was used Google map version 2 and i could not find correct syntax for setting map size on version 3 map.

地图选项在全局变量中设置.

Map options are set in global variable.

var mapoptions = {
    zoom: 6,       
    center: new google.maps.LatLng(60, 50),       
    mapTypeId: google.maps.MapTypeId.ROADMAP,
    gridSize: 50,
    size(600, 700, 'px', 'px')
}

地图大小的正确语法是什么,或者有其他解决方案吗?

What is the correct syntax of map size or is there other solution for this?

我已经测试了调整大小功能和缩放功能,但这些都没有帮助.

I have tested resize function and playing with zoom but those was not helped.

推荐答案

我通过在地图初始化函数调用之前添加短延迟(100 毫秒)解决了这个问题.

I got this solved by adding short delay (100ms) before map initializing function call.

也许地图画布在谷歌地图访问它之前没有完全渲染.

Maybe map canvas did not get fully rendered before google map was accessing it.

这篇关于在地图选项上设置 Google Map v3 大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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