I am working with Leaflet and EasyButton and have several EasyButtons on the map. I would like to move them outside the map, but have difficulty to achieve this. Seems EasyButton does have any function for capturing the name of the buttons that it holds.
Something similar to this, but with easyButton.
Placing controls outside map container with Leaflet?
var ButtonPower_Line = L.easyButton({
id: 'ButtonPowerLine',
states: [{
stateName: 'Show',
icon: '<strong> Off</strong>',
title: 'Show',
onClick: function (btn) {
//do sth
}
}, {
stateName: 'Hide',
icon: '<strong> On</strong>',
title: 'Hide',
onClick: function (btn) {
//do sth
}
}]
});
ButtonPower_Line.addTo(map);
Best Answer
Here is a simple example, it is a HTML page with two text boxes (input) and a button. The HTML button and inputs are outside the map. The text boxes ask for Lat, Lng and when you hit the button it takes the textbox values and plots the point on the map. I have use HTML buttons to zoom to New York City since I work for the state or one to reset the map to original extents and turn off layers. Basic idea create an on click function for the button.