Popup giving features properties are interesting but I would like to make a side bar where properties of a clicked feature would show.
I've got the traditional code for displaying geojson features using jquery :
$.getJSON("${resourcesFolderName}/VergueParis.geojson",function(data){
//Def icons
var siteIcon = L.icon({
iconUrl: '${resourcesFolderName}/eye.svg',
iconSize: [30,30]
});
var siteIcon2 = L.icon({
iconUrl: '${resourcesFolderName}/eye2.svg',
iconSize: [30,30]
});
var siteIcon3 = L.icon({
iconUrl: '${resourcesFolderName}/eye3.svg',
iconSize: [30,30]
});
L.geoJson(data ,{
pointToLayer: function(feature,latlng){
var marker = L.marker(latlng,{icon: siteIcon});
marker.bindPopup('<img src="'+ feature.properties.Image +'" style="width:100%;height:100%;">'+ '<br/>' +'<img src="${resourcesFolderName}/Filet.svg" style="width:221px;height:10px;">' + '<br/>' + feature.properties.Titre + '<br/>' + feature.properties.Annee);
return marker;
return L.marker(latlng,{icon: siteIcon});
},
//Change icon on Rollover
onEachFeature: function(feature,layer)
{
layer.on("mouseover",function(e){
layer.setIcon(siteIcon2)
});
layer.on("mouseout",function(e){
layer.setIcon(siteIcon)
});
//End change on rollover
}
}).addTo(hypeDocument.map).on('click', markerOnClick);
});
And the associated markerOnClick function :
function markerOnClick(e) {
alert("hi. you clicked the marker at " + e.latlng);
var newinnerContent = 'Title of the feature :';
hypeDocument.getElementById("Rectangle").innerHTML = newinnerContent;
hypeDocument.continueTimelineNamed('Rectangle', hypeDocument.kDirectionForward)
};
Note : the 'Hype' reference relates to a software i'm using to create my map.
Alert function works and I'd like to display the feature property "Titre" just after the above phrase "Title of the feature :"
I tried different approaches but nothing works.
Any idea would be welcome.
${resourcesFolderName}
) need enclosing back ticks (`
) rather than quotes.