mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-20 07:11:08 -05:00
20 lines
638 B
JavaScript
20 lines
638 B
JavaScript
document.addEventListener('DOMContentLoaded', function() {
|
|
const mapContainer = document.getElementById('map');
|
|
if (!mapContainer) return;
|
|
|
|
const lat = parseFloat(mapContainer.dataset.lat);
|
|
const lng = parseFloat(mapContainer.dataset.lng);
|
|
const name = mapContainer.dataset.name;
|
|
|
|
if (isNaN(lat) || isNaN(lng)) return;
|
|
|
|
const map = L.map('map').setView([lat, lng], 13);
|
|
|
|
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
|
attribution: '© OpenStreetMap contributors'
|
|
}).addTo(map);
|
|
|
|
L.marker([lat, lng])
|
|
.addTo(map)
|
|
.bindPopup(name);
|
|
}); |