Test page
http://spp.demo-website.co.uk/admin/google_maps_test.html
Clicking the map link beside a property opens a jQuery Fancybox with
the map in it. The code for this is drawn in using AJAX. The code in
the AJAX file is:
<script>
var latlng = new google.maps.LatLng(57.55, -4.75);
var myoptions = {
zoom: 15,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"),
myoptions);
var marker = new google.maps.Marker({
position: latlng,
map: map
});
</script>
This works fine on viewing the first map. Close the fancybox down and
click the other map link and you'll see the map is mainly grey,
looking like it's offset out of the window. If you refresh the page it
should work fine the first time again.
Tested in FF3 and IE8 on XP.
I've read a few posts saying that
google.maps.event.trigger(map, "resize");
should reset it, but haven't worked out how or where to use this (in
the main page or the ajax file)? Any ideas?
cheers
Garve