I'm creating html5 mobile apps and I noticed that the idle
, bounds_changed
and tilesloaded
events fire when the map object is created and rendered (even if it is not visible).
To make my map run code when it is shown for the first time I did the following:
google.maps.event.addListenerOnce(map, 'tilesloaded', function(){
//this part runs when the mapobject is created and rendered
google.maps.event.addListenerOnce(map, 'tilesloaded', function(){
//this part runs when the mapobject shown for the first time
});
});