Skip to content

Commit

Permalink
Update main.js
Browse files Browse the repository at this point in the history
  • Loading branch information
ZsoltMONOLITE authored Dec 3, 2023
1 parent 32b249e commit 2f11a84
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,18 @@ function addGeoms(data) {
e.target.setStyle(geomHoverStyle);
},
click: function (e) {
document.getElementById("sidebar-title").innerHTML =
e.target.feature.properties.name;
document.getElementById("sidebar-content").innerHTML =
e.target.feature.properties.description;
sidebar.open(panelID);
// Dynamic zooming on click to zoom in further
map.setView(e.latlng, map.getZoom() + 2);
},
// Create a popup content string
var popupContent = "<b>" + e.target.feature.properties.name + "</b><br>" + e.target.feature.properties.description;

// Create a popup and set its content
var popup = L.popup()
.setLatLng(e.latlng)
.setContent(popupContent);
map.setView(e.latlng, map.getZoom() + 4);

// Open the popup on the map
popup.openOn(map);
},
});
},
style: geomStyle,
Expand Down

0 comments on commit 2f11a84

Please sign in to comment.