I’m embedding Google Maps into my web site. Once Google Maps is loaded, I need to kick off a few JavaScript processes.
Is there a way to auto-detect when Google Maps has fully loaded, including tile downloads and all?
A tilesloaded()
method exists that is supposed to accomplish exactly this task but it does not work.
Best Answer
This was bothering me for a while with GMaps v3.
I found a way to do it like this:
The "idle" event is triggered when the map goes to idle state - everything loaded (or failed to load). I found it to be more reliable then tilesloaded/bounds_changed and using
addListenerOnce
method the code in the closure is executed the first time "idle" is fired and then the event is detached.See also the events section in the Google Maps Reference.