Load event not firing in leaflet
I am trying to render business logic in a map whenever some events are executed by the user.
I can get drag, dblclick and zoomstart working values.
But the load event doesn't fire for me. (Browser loading first)
My example code is below:
var map = L.map('map').setView([34.7320,-86.5966], 14);
map.on('load drag dblclick zoomstart', function() {
// My business logic goes here.
});
+3
source to share
2 answers
This can be done when you call setView, which makes the map fire a load event.
var map = L.map('map').on('load', function(){
// Your business logic here...
}).setView([34.7320,-86.5966], 14);
(OR)
+4
source to share