Javascript Google Map v3 地图加载事件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8677261/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-24 07:02:05 来源:igfitidea点击:
Google Map v3 Map loaded event
提问by skayred
Is there any listener to handle map completely loaded?
是否有任何侦听器来处理完全加载的地图?
In my case, I need to get bounds from map, so I've done it this way:
就我而言,我需要从地图中获取边界,所以我是这样做的:
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();
},
Is there any not-hacking way?
有什么不破解的方法吗?
回答by Sudhir Bastakoti
Try something like:
尝试类似:
google.maps.event.addListenerOnce(map, 'idle', function(){
//loaded fully
});
回答by Ash
How about the tilesloaded
event?
怎么样的tilesloaded
活动?
google.maps.event.addListener(map, 'tilesloaded', function() {
// Visible tiles loaded!
});