Setting Google Map v3 size on map options

会有一股神秘感。 提交于 2019-12-24 17:31:05

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/8735740/setting-google-map-v3-size-on-map-options

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!