Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
117
rated 0 times [  119] [ 2]  / answers: 1 / hits: 19552  / 10 Years ago, sun, march 9, 2014, 12:00:00

Is there an event (or other method) to detect when all visible tiles have been downloaded and displayed with leaflet? (Similar to Google Maps event that is called when all visible map tiles are loaded, but for leaflet instead)


More From » events

 Answers
9

Solved. Bind the load event on the tile layer. Example:



var tile_layer=L.tileLayer(tile_url,{
attribution: Map data &copy; <a href='http://openstreetmap.org'>OpenStreetMap</a> +
contributors, <a href='http://creativecommons.org/licenses/by-sa/2.0/'>CC-BY-SA</a>.,
maxZoom: 18
});
tile_layer.addTo(map);
tile_layer.on(load,function() { console.log(all visible tiles have been loaded) });

[#72082] Friday, March 7, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
rhett

Total Points: 671
Total Questions: 100
Total Answers: 102

Location: Hong Kong
Member since Tue, Oct 19, 2021
3 Years ago
;