views:

53

answers:

3
A: 

When you're loading in the large map, try adding this at the end of your map code.

map.checkResize();

When Google Maps first renders on your page, it has the dimensions recorded so that it displays the map images in that size. If you're resizing the map dynamically, you need to tell the API to check the new size.

GKR
I tried this, but it doesn't seem to work. See my edited post though. Thanks!
Maurice
+1  A: 

I think you are using v3. So google.maps.event.trigger(map, "resize");

Also take a look at here

Argiropoulos Stavros
Doesn't seem to to work. I tried it almost everywhere (before the end of teh function, after the function, in the load part) but with no result.. Still the weird square
Maurice
A: 

I fixed it!

I made an own function for the largemap and placed it in the callback when the elements are opened


function largeMap(){
 var largeLatlng = new google.maps.LatLng(51.92475, 4.38206);
 var largeOptions = {zoom: 10, center: largeLatlng,mapTypeId: google.maps.MapTypeId.ROADMAP};
 var largeMap = new google.maps.Map(document.getElementById("largeMap"), largeOptions);
 var largeMarker = new google.maps.Marker({position: largeLatlng, map:largeMap, title:"Cherrytrees"});
 largeMarker.setMap(largeMap);
}
[..]
 $("#showRoute").click(function(e){
  e.preventDefault();
  $("#shadow").add($("#shadowContent"),$("#closebar"),$("#content")).fadeIn(500);
  $("#shadowContent").show().css({'width':'750px','top':'25px','left':'50%','margin-left':'-400px'});
  $("#closeBarLink").click(function(l){
   l.preventDefault();
   $("#shadow").add($("#shadowContent"),$("#closebar"),$("#content")).fadeOut(500);
  });
  largeMap();
 });

Thanks anyway!!

Maurice