I am using leaflet to display a map.
This is my head code :
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.0.2/dist/leaflet.css" />
<script src="https://unpkg.com/leaflet@1.0.2/dist/leaflet.js"></script>
and this is my body code :
<div id="mapid" style="height: 1000px"> </div>
<script>
var mymap = L.map('mapid').setView([51.505, -0.09], 13);
L.tileLayer('https://b.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="http://mapbox.com">Mapbox</a>',
maxZoom: 18,
minZoom: 3
}).addTo(mymap);
mymap.on('click', function (e) { alert(e.latlng); });
mymap.on('zoomstart', function (e) { alert(e.latlng); });
</script>
This map has two events as you can see from the code above : on click event and on zoomstart event.
When I click on the map I got the popup alert : LatLng(51.51600,-1.54213).
But when I zoom on the map I got the popup alert : undefined.
How can I get the current position on zoomstart Event ?