Hi
Here is my code to create a button with link to return to "Home page". (see attached file)
I've always the problem : click is seen on console but not active.
Jean Michel
L.Control.Quitter = L.Control.extend(
{
options: {position: 'topright'},
onAdd: function(map)
{
var link = L.DomUtil.create('a','my-link-class');
var div = L.DomUtil.create('div', 'leaflet-bar my-control',link);
div.title = "Menu principal";
var myButton = L.DomUtil.create('button', '', div);
link.href = "....return to index page....";
let myImage = L.DomUtil.create('img', 'my-button-class', myButton);
myImage.src = "Marqueurs/stop2.png";
myImage.style = "margin-left:0px;margin-top:2px;width:20px;height:20px";
L.DomEvent.disableClickPropagation(div);
L.DomEvent.on(div, 'click', function()
{
console.log('click');
});
return div;
},
onRemove: function(map) {}
});
var control = new L.Control.Quitter()
control.addTo(Rcarte);