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

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

问题描述

我试图在Joomla标签内设置Google地图(v3),但地图上有显示问题。

如果我离开地图所在的标签并将地图画布变为灰色,并且地图仅部分显示在地图画布的左上角。



带屏幕截图的图片:





我通过在地图参数上设置地图大小,谷歌地图版本2,我找不到在版本3地图上设置地图大小的正确语法。



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

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

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

我已经测试了resize函数并且使用了缩放功能,但这些都没有帮助。 解决方案

地图初始化函数调用之前的短延迟(100ms)。

也许地图画布在Google地图访问之前未完全呈现。


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.

Image with screen capture:

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.

解决方案

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地图v3大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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