So, I'm adding markers to the map and after adding them I open the infoWindow attached to the first marker added with a click event. I call fitBounds() before that to make sure all markers fit on the screen. However, open the infoWindow often moves the map so that some markers go 'out of bounds' so to speak. I tried this top fit the new bounds after opening the infoWindow but that doesn't seem to work:
map.fitBounds(bounds); google.maps.event.trigger(markers[0],'click'); var newBounds = map.getBounds(); bounds.extend(newBounds.getNorthEast()); map.fitBounds(bounds); This results in the error "Uncaught TypeError: Cannot call method 'getNorthEast' of undefined". What am I doing wrong here? Should I follow a different strategy to achieve what I want? -- 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 google-maps-js-api...@googlegroups.com. To unsubscribe from this group, send email to google-maps-js-api-v3+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.