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).

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.

How can this be solved ?

有帮助吗?

解决方案

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

The map itself is stored in the following js variable:

Gmaps4Rails.map

But glad you found a solution to your problem ;)

其他提示

Solution : load the empty map in the main frame of the page, and update it dynamically with Gmaps4Rails.replace_markers(json).

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top