Gmaps4rails:动态加载时地图不显示 [英] Gmaps4rails : map not showing when loaded dynamically

查看:85
本文介绍了Gmaps4rails:动态加载时地图不显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我通过Jquery调用($('#id').load(/xyz))使用Gmaps4rails显示地图时,未显示该地图(而是显示空白区域).

When I display a map using Gmaps4rails through a Jquery call ($('#id').load(/xyz)), the map is not shown (a blank area is shown instead).

此页面: https://groups.google.com/group/Google-Maps-API/browse_thread/thread/02710b15f3d76ec2/67413d33e7fd0e74?hl=zh_CN 建议在页面加载后调用map.reloadMap,但是我不知道ID应当调用的元素. gmaps4rails文档仅提及包含地图的div的ID,而读取源代码则无济于事.

This page : https://groups.google.com/group/Google-Maps-API/browse_thread/thread/02710b15f3d76ec2/67413d33e7fd0e74?hl=en suggests calling map.reloadMap once the page has been loaded, however I don't know the id of the element that should be called. The gmaps4rails documentation only mentions the id of the div containing the map and reading the source didn't help.

如何解决?

推荐答案

好,我已经更新了源代码.我特别评论了js文件.

Fyi, I've updated the source code. I especially commented the js file.

地图本身存储在以下js变量中:

The map itself is stored in the following js variable:

Gmaps4Rails.map

但是很高兴您找到了解决问题的方法;)

But glad you found a solution to your problem ;)

这篇关于Gmaps4rails:动态加载时地图不显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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