Google Maps Api v3 – getBounds is undefined-Collection of common programming errors
In other comments here, it’s adviced to use the “bounds_changed” event over “idle”, which I agree with. Certainly under IE8 which triggers “idle” before “bounds_changed” on my dev machine at least, leaving me with a reference to null on getBounds.
The “bounds_changed” event however, will be triggered continuously when you’ll drag the map. Therefor, if you want to use this event to start loading markers, it will be heavy on your webserver.
My multi browser solution to this problem:
google.maps.event.addListenerOnce(gmap, "bounds_changed", function(){
loadMyMarkers();
google.maps.event.addListener(gmap, "idle", loadMyMarkers);
});