如何更新谷歌地图,如果它的地图画布改变了它的尺寸? [英] How to update the google map if the map canvas of it changed its dimenstions?
问题描述
我试着再次重新创建谷歌地图,但它似乎也保留了其他之前创建的谷歌地图。这有时会导致奇怪的行为(旧地图位于新的顶部)。可以发布谷歌地图吗?
感谢您的帮助! 解决方案
p>查看 google.maps.Map class 参考,我想你正在寻找 resize
事件:
lockquote>
开发者应该触发当div更改大小时,该事件在地图上:
google.maps.event.trigger (map,'resize')
I have a google map inside of a div which gets changed, its parent div can get an additional class which changes its dimensions. This changes causes the google map not to get updated, it resist in the previous dimensions. How can I refresh the google map?
I tried to recreate the google map again but it seems to keep the other previously created google maps there as well. This causes sometimes strange behavior (the old map is on the top of the new). Can a google map be released?
Thanks for your help!
Check the google.maps.Map class reference, I think you're looking for the resize
event:
Developers should trigger this event on the map when the div changes size:
google.maps.event.trigger(map, 'resize')
这篇关于如何更新谷歌地图,如果它的地图画布改变了它的尺寸?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!