Alright several things:


- Move your map variable to the global scope. Your initMap function
should start like this:
var map;
function initMap() { var latlng = new
google.maps.LatLng(-34.593014,-58.405209 ); var myOptions = { zoom: 15,
center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP };map = new
google.maps.Map(document.getElementById("map_canvas"), myOptions);
- Right now, you are calling initMap every time someone clicks the map
tab. Instead, you should only call it once. You could have a function
like this:
function ShowMap() {
if(map)
google.maps.event.trigger(map, 'resize');
else
initMap();
}

- The resize event needs to be called every time the map div changes
size or visibility. I've added the code to trigger the event in the
ShowMap function above.
That should be about it.


Chad Killingsworth

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to