I can't seem to find the map event in Leaflet that equals to Google Map "idle" event.
The definition of Google Map event "idle" is "This event is fired when the map becomes idle after panning or zooming."
https://developers.google.com/maps/documentation/javascript/reference#Map
I tried Leaflet "viewreset", "load", "blur", "focused", "moveend" but they are really different from Google Map's "idle".
The best I can do is to use this
var foo = function(e){
console.log('Hello');
}
map.on('load', foo);
map.on('moveend', foo);
Just want to find out if I'm reading the manual wrong. Or even if there is no event equivalent to Google Map's 'idle', is there a better way to implement it?
There is no "idle" event in Leaflet library, though the description seems resemblant of "moveend" (there is nothing about map initialization).
As you yourself found out, you can use both "load" and "moveend" events. For catching those two, you don't need to call map.on
twice: events can be joined in one string:
map.on('load moveend', function(e) { ... });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With