William,
A cunning plan! But unfortunately it suffers from the same timing
problem. I tried your code and no minimap appeared so I put an alert
at the start of the createMinimap function because I was not sure that
the onload on the image had triggered it. Then the minimap appeared
after the alert! To make it work reliably you still need to put in a
delay. It seems quite bizarre that the onload event in the image is
fired before the DOM object is available but that is certainly what
appears to happen in Firefox 3. In the end the function appeared as
follows (following Mike's recursive function construct):
function createMinimap() {
var tabcontainer = document.getElementById("minimap");
if (tabcontainer) {
var minimap = new GMap2(tabcontainer);
minimap.setCenter(new GLatLng(centreLat, centreLng),
10);
minimap.addControl(new GSmallMapControl());
minimap.addControl(new GMapTypeControl());
}
else {
setTimeout("createMinimap()",100);
}
}
This could just as easily be invoked inline following the
marker.openInfoWindowHtml(txt);
statement and so the img onload idea does not really add anything and
is redundant. A pity! I rather like your idea.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" 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-API?hl=en
-~----------~----~----~----~------~----~------~--~---