If the div is not visible or has a size of 0 when it is created then you need to trigger the resize event on the map when it is later displayed.
google.maps.event.trigger(map, 'resize'); -- Luke On Wed, Jul 13, 2011 at 9:11 AM, Tonks <[email protected]> wrote: > I am writing a webapp using iui which has everything on one page and > navigates between different <div>'s. I have a list of places which the user > can choose and he is then shown a route from the nearest motorway junction > to the chosen place. this works fine the first time the map is initialized. > But then if the user goes back and chooses a different place, the map is re > rendered in the same div but the center point of the defined route is put at > the top left of the div. This does not happen all the time and it sometimes > works fine which is very confusing. The code calls the initialize function > every time a new map is needed. Is this the wrong way to do this? > > -- > You received this message because you are subscribed to the Google Groups > "Google Maps JavaScript API v3" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/google-maps-js-api-v3/-/EHA3iQloYlsJ. > 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. > -- 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.
