diff --git a/map.js b/map.js index c87fe68..4b0111c 100644 --- a/map.js +++ b/map.js @@ -257,20 +257,39 @@ iconAnchor: [16, 32], popupAnchor: [0, -32] }); + +function openModal(imageSrc) { + const modal = document.getElementById('image-modal'); + const modalImage = document.getElementById('modal-image'); + modalImage.src = imageSrc; + modal.style.display = 'block'; +} - const marker = L.marker([snack.lat, snack.lng], { icon: markerIcon }).addTo(map); - const popupContent = ` - - `; +function closeModal() { + const modal = document.getElementById('image-modal'); + modal.style.display = 'none'; +} + +window.onclick = function(event) { + const modal = document.getElementById('image-modal'); + if (event.target === modal) { + modal.style.display = 'none'; + } +}; + +const marker = L.marker([snack.lat, snack.lng], { icon: markerIcon }).addTo(map); + const popupContent = ` + +`; marker.bindPopup(popupContent); markers.push({ marker, name: snack.name }); });