Google Map v3 Map loaded event [duplicate]

匿名 (未验证) 提交于 2019-12-03 02:45:02

问题:

This question already has an answer here:

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?

回答1:

Try something like:

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


回答2:

How about the tilesloadedevent?

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


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!