سؤال

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