mirror of
https://github.com/kevinveenbirkenbach/homepage.veen.world.git
synced 2025-01-16 11:34:00 +01:00
18 lines
721 B
JavaScript
18 lines
721 B
JavaScript
|
function openDynamicPopup(subitem) {
|
||
|
// Set modal title and content
|
||
|
document.getElementById('dynamicModalLabel').innerText = subitem.description;
|
||
|
const modalContent = document.getElementById('dynamicModalContent');
|
||
|
modalContent.value = subitem.address;
|
||
|
|
||
|
// Add copy functionality
|
||
|
document.getElementById('dynamicCopyButton').addEventListener('click', function () {
|
||
|
modalContent.select();
|
||
|
navigator.clipboard.writeText(modalContent.value)
|
||
|
.then(() => alert('Content copied to clipboard!'))
|
||
|
.catch(() => alert('Failed to copy content.'));
|
||
|
});
|
||
|
|
||
|
// Show the modal
|
||
|
const modal = new bootstrap.Modal(document.getElementById('dynamicModal'));
|
||
|
modal.show();
|
||
|
}
|