2011-12-30 80 views
41

是否有任何監聽器處理地圖完全加載?谷歌地圖v3地圖加載事件

以我爲例,我需要從地圖界限,所以我已經做到了這種方式:

google.maps.event.addListener(this.map, "bounds_changed", this.mapLoaded); 

mapLoaded: function() { 
    google.maps.event.clearListeners(this.map, "bounds_changed"); 

    var bounds = this.map.getBounds(); 

    this.collection.setBounds(bounds.getNorthEast(), bounds.getSouthWest()); 
    this.collection.fetch(); 
}, 

有什麼不黑客的方式?

回答

89

嘗試類似:

google.maps.event.addListenerOnce(map, 'idle', function(){ 
    //loaded fully 
}); 
19

怎麼樣tilesloaded事件?

google.maps.event.addListener(map, 'tilesloaded', function() { 
    // Visible tiles loaded! 
});