The map at: http://www.stjohnhistoricalsociety.org/helloWorld.htm
causes an error 'map is undefined' line 16. Your 'map' variable is local to your page's document ready function so is not accessible by the resizeMapContainer() function. Solution is to make 'map' a global variable. Then the checkResize() method will succeed and your problem may be fixed... Martin. On 22 Oct, 00:47, Peter Burgess <[email protected]> wrote: > Here is the problem: > > I want to maximize the map container on my web page which has a > conventional layout: > header > content > trailer > > I'm having wierd problems > withhttp://www.stjohnhistoricalsociety.org/helloWorld.htm, > using Chrome browser. Toggling the "large"/"small" buttons creates a > couple of problems: > 1) When expanding the map size, the arrow/minimize button on the > GOverviewMapControl gets "lost". > > 2) when expanding the map size, the tiling does not fill the container > and behaves erratically as you navigate around. > > I think that there is a race-condition between the main map and the > GOverviewMapControl. I think different browsers behave differently > when expanding the map size. My complex version works with Firefox, > but not Chrome/Safari. > > Here is the link to the simple > versionhttp://www.stjohnhistoricalsociety.org/helloWorld.htm > > Here's the link to the complex > versionhttp://www.stjohnhistoricalsociety.org/Maps9.htm > > Here's the code for the simple version -- > <!DOCTYPE html "-//W3C//DTD XHTML 1.0 Strict//EN" > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> > <html xmlns="http://www.w3.org/1999/xhtml"> > <head> > <meta http-equiv="content-type" content="text/html; charset=utf-8"/ > > <title>Google Maps JavaScript API Example</title> > <script type="text/javascript" > src="http://www.google.com/jsapi? > key=ABQIAAAATLykv4FdOu2sXWuzzo40fxSy5mk1SA6WGuID8uyb7GpLBR- > BPhTDyR_pEQrMp2B2ThAW0lGFihRFIg"> > </script> > <script type="text/javascript"> > google.load("jquery", "1"); > google.load("maps", "2.x"); > > function resizeMapContainer(w,h) { > $("#map_canvas").width(w).height(h); > map.checkResize(); > // mapOv.checkResize(); > } > > </script> > </head> > <body onunload="GUnload()"> > <div> > <form action="#"> > <div> > <input type="button" value="Large" > title="Large" > onclick="resizeMapContainer(1000,600);"/> > <input type="button" value="Small" > title="Small" > onclick="resizeMapContainer(500, 300);"/> > </div> > </form> > </div> > <div id="map_canvas" style="position:absolute; top:100; left:100; > width: 500px; height: 300px"></div> > > <script type="text/javascript"> > > $(document).ready(function () { > if (GBrowserIsCompatible()) { > var map = new > GMap2(document.getElementById("map_canvas")); > map.setCenter(new GLatLng(37.4419, -122.1419), 13); > map.addControl(new GLargeMapControl()); > map.addControl(new GScaleControl()); > // var mapOv = new GOverviewMapControl(); > // map.addControl(mapOv); > map.addControl(new GOverviewMapControl()); > // Race-condition with > minimizer arrow control. > map.enableScrollWheelZoom(); > map.enableDoubleClickZoom(); > map.enableContinuousZoom(); > map.setUIToDefault(); > } > }); > > </script> > > </body> > </html> > --------------------- --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
