What I'm trying to do is have a popup box when you click on a marker on the leaflet map. In this popup box are five elements present.
- Title
- Description
- Image
- Button (Next Image)
- Button (Previous Image)
So what I tried to do was add a custom pop which for each feature:
onEachFeature: function(feature, layer) {
layer.bindPopup(insertDataPopUp(feature), customPopUpOptions);
}
But in my pop up settings when I call a onclick function in my HTML, the function is not recognized. So what I'm trying to do if someone clicks the next image button a new image is displayed. But the issue right now is that the function in the HTML is not found....
Here is the code for the popup where the issue lies:
function insertDataPopUp(feature) {
if (feature.properties.pictures != null) {
var picturePath = feature.properties.pictures[0];
var picture = "<img id='popupFoto' src=" + picturePath + " alt=''/>";
} else {
picture = "";
}
var customPopup =
"<div id='infoBox'><h2>" +
feature.properties.name +
"</h2><p>" +
feature.properties.description +
"</p>" +
picture +
'<button onclick="nextFoto()">Back</button> <button onclick="nextFoto()">Forward</button></div>';
return customPopup;
}
I'm using leaflet, javascript and the vue framework.