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)



https://github.com/Leaflet/Leaflet/issues/3560

http://jsfiddle.net/QUGyr/1/

+4


source


As from here you can use event

'idling'



instead

'load'

0


source







All Articles