在加载Google地图后,如何使用JavaScript调整Google地图大小? [英] How do I resize a Google Map with JavaScript after it has loaded?
问题描述
我有一个'mapwrap'div设置为400px x 400px,里面,我有一个Google'地图'设置为100%x 100%。所以地图加载在400 x 400px,然后用JavaScript我调整大小的'mapwrap'到100%x 100%的屏幕 - 谷歌地图调整到整个屏幕,我预计,但瓷砖开始消失在右边缘之前
I have a 'mapwrap' div set to 400px x 400px and inside that I have a Google 'map' set to 100% x 100%. So the map loads at 400 x 400px, then with JavaScript I resize the 'mapwrap' to 100% x 100% of the screen - the google map resizes to the whole screen as I expected but tiles start disappearing before the right hand edge of the page.
有一个简单的函数,我可以调用导致谷歌地图重新调整到更大的尺寸'mapwrap'div?
Is there a simple function I can call to cause the Google map to re-adjust to the larger size 'mapwrap' div?
推荐答案
如果您使用的是Google Maps v2,请调用 checkResize()
在调整大小后的容器。 链接
If you're using Google Maps v2, call checkResize()
on your map after resizing the container. link
这篇关于在加载Google地图后,如何使用JavaScript调整Google地图大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!