-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodal-handler.js
More file actions
22 lines (19 loc) · 858 Bytes
/
modal-handler.js
File metadata and controls
22 lines (19 loc) · 858 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// modal-handler.js
export function initializeModal() {
document.addEventListener("DOMContentLoaded", function () {
// Create modal structure
var modal = document.createElement("div");
modal.id = "modal-container";
modal.style.display = "none"; // Hide initially
modal.innerHTML = `
<div id="modal-content">
<button id="modal-close">×</button>
<iframe id="modal-iframe" src=""></iframe>
</div>
`;
document.body.appendChild(modal);
var iframe = document.getElementById("modal-iframe");
var closeButton = document.getElementById("modal-close");
// Event listener for multiple images
document.querySelectorAll(".open-modal").forEach(button => {
button.addEventListener("click", function () {