Last active
March 15, 2025 15:06
-
-
Save thinkphp/1e45cd73e8f7dbeb62aa0793a86c61a1 to your computer and use it in GitHub Desktop.
view-on-map
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let buttons = document.querySelectorAll('.view-map'); | |
for (let i = 0; i < buttons.length; i++) { | |
buttons[i].addEventListener('click', function() { | |
const card = this.closest('.place-card'); | |
const lat = card.dataset.lat; | |
const lng = card.dataset.lng; | |
const name = card.dataset.name; | |
if (lat && lng) { | |
showMap(lat, lng, name); | |
} else { | |
alert('Map coordinates not available for this location'); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment