Added description message to marker
This commit is contained in:
parent
488631e1aa
commit
16cf06fb33
6
map.js
6
map.js
|
@ -1,4 +1,7 @@
|
||||||
|
|
||||||
|
var noDescText = "No description available";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var shOSM = L.tileLayer('https://mbtiler.nyaaa.net/styles/basic-preview/512/{z}/{x}/{y}.png', {
|
var shOSM = L.tileLayer('https://mbtiler.nyaaa.net/styles/basic-preview/512/{z}/{x}/{y}.png', {
|
||||||
maxZoom: 19,
|
maxZoom: 19,
|
||||||
|
@ -45,11 +48,12 @@ fetch('./data.json')
|
||||||
.then(data => {
|
.then(data => {
|
||||||
// Define waypoint markers
|
// Define waypoint markers
|
||||||
function createMarker(waypoint) {
|
function createMarker(waypoint) {
|
||||||
|
|
||||||
return L.marker([waypoint.lat, waypoint.lng], {
|
return L.marker([waypoint.lat, waypoint.lng], {
|
||||||
radius: 5,
|
radius: 5,
|
||||||
color: '#337aff',
|
color: '#337aff',
|
||||||
fillColor: '#337aff'
|
fillColor: '#337aff'
|
||||||
});
|
}).bindPopup(waypoint.desc ?? noDescText);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Create waypoints from server data and add them to the map
|
// Create waypoints from server data and add them to the map
|
||||||
|
|
Loading…
Reference in New Issue