Leaflet.MousePosition is a mouse position control that you can add to a Leaflet map. It displays the geographic coordinates of the mouse pointer, as it is moved around the map.
Insert the following line:
L.control.mousePosition(<Object> options?).addTo(map);
or during map initialization:
positionControl: true
emptystring:
Initial text to display. Default is ''.
latFormatter:
Custom function to format the latitude value. Argument: numerical latitude value. Return value: formatted string. Default is e.g. 37.298°N.
lngFirst:
Whether to put the longitude first or not. Default is false.
lngFormatter:
Custom function to format the longitude value. Argument: numerical longitude value. Return value: formatted string. Default is e.g. 121.630°W.
numDigits:
Number of digits. Default is 3.
position:
The standard Leaflet.Control position parameter. Default is 'bottomcenter'.
prefix:
A string to be prepended to the coordinates. Default is ''.
separator:
To separate longitude\latitude values. Default is ', '.
getLatLng:
Request the last recorded cursor position, as a
LatLng object.
MIT License (MIT)