RE: Google Maps API Thickbox

Home

Google Maps API + Thickbox

Jan8

Pictures

Had some trouble for a while at work with getting our google maps working with this thickbox, and I put it off for ages (telling people not to put a map in a lightbox), but today I got to the bottom of it. Don't load your map until the lightbox has loaded, by setting a timeout, like:

setTimeout( function() {
var map = new GMap2( $('#map' ));
map.setCenter( new GLatLng( 0, 0 ), 0 );
var bounds = new GLatLngBounds();
.
.
.
}, 0.1 );


It's not exactly been bugging me for ages, but it was bugging me ages ago, and then I forgot about it. Now it's fixed! Bit of a dirty hack really.

Where'd everybody go?

:: Comment / reply

RE: Google Maps API + Thickbox

Pictures

Hi,
Could you show me exactly how to set the time out with this function ?

function load() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map"));
map.setCenter(new GLatLng(40.967715,-76.887817), 7);
map.addControl(new GLargeMapControl());
......

Thanks

:: 23 Oct :: :: Comment / reply

RE: Google Maps API + Thickbox

Pictures

There are a couple of ways, either put it within function load():

function load() {
if (GBrowserIsCompatible()) {
setTimeout( function() {
map = new GMap2(document.getElementById("map"));
map.setCenter(new GLatLng(40.967715,-76.887817), 7);
map.addControl(new GLargeMapControl());
......
}, 0.1 );
}
}


or wrap it around the place where you call function load()

24 Oct :: :: Comment / reply

RE: Google Maps API + Thickbox

Pictures

I tried this fix for loading a google map in a thickbox window. It works on Safari and FF (mac) and FF (PC). But IE and Opera (PC & MAC) still don't work. Does anyone have any ideas?

You can see my example here:
http://www.davidcool.com/gallery_view.php?CID=7&SCID=105&AID=1&IMGID=1418#tanchor1418

Just click on the "map" icon.

Thanks,
David

:: 8 Nov :: :: Comment / reply