I need to add a button like a home that resets the map. I used the Leaflet.EasyButton but It doesn’t show on my map. It doesn’t even show any error in the console.
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/leaflet-easybutton@2/src/easy-button.css">
<script src="https://cdn.jsdelivr.net/npm/leaflet-easybutton@2/src/easy-button.js"></script>
Here's my leaflet js file,
var lmap = new L.map("lmap", {
zoomControl: false,
maxZoom: 11,
minZoom: 3,
}).setView([34.543896, 63.160652], 6);
L.control.zoom({
position: 'topright'
}).addTo(lmap);
lmap.addControl(new L.Control.Fullscreen({position: 'bottomleft'}));
L.control.mousePosition({position: 'bottomright', numDigits: 3}).addTo(lmap);
L.control.scalefactor().addTo(lmap);
L.easyButton( 'fa-gbp', function(){
lmap.setView([55, -2], 4);
}).addTo(lmap);
Worked as expected Demo
The OP downloaded the src files and then it worked.
var lmap = new L.map("lmap", {
zoomControl: false,
maxZoom: 11,
minZoom: 3,
}).setView([34.543896, 63.160652], 6);
L.easyButton( 'fa-gbp', function(){
lmap.setView([55, -2], 4);
}).addTo(lmap)