diff --git a/src/pages/executive-committee.astro b/src/pages/executive-committee.astro index 77a259d..dea8dc0 100644 --- a/src/pages/executive-committee.astro +++ b/src/pages/executive-committee.astro @@ -45,24 +45,27 @@ import vp_sec from '../assets/images/execomm/vp_sec.png'; const cards = document.querySelectorAll(".photo-card img"); const closeBtn = document.querySelector(".close-modal"); - cards.forEach(img => { - img.addEventListener("click", () => { - modal.style.display = "flex"; - modalImg.src = (img as HTMLImageElement).src; - document.body.style.overflow = "hidden"; // Prevent scrolling when open + // This simple check satisfies TypeScript's strict rules! + if (modal && closeBtn && modalImg) { + cards.forEach(img => { + img.addEventListener("click", () => { + modal.style.display = "flex"; + modalImg.src = (img as HTMLImageElement).src; + document.body.style.overflow = "hidden"; // Prevent scrolling when open + }); }); - }); - closeBtn.addEventListener("click", () => { - modal.style.display = "none"; - document.body.style.overflow = "auto"; - }); - - // Close if user clicks outside the image - modal.addEventListener("click", (e) => { - if (e.target === modal) { + closeBtn.addEventListener("click", () => { modal.style.display = "none"; document.body.style.overflow = "auto"; - } - }); + }); + + // Close if user clicks outside the image + modal.addEventListener("click", (e) => { + if (e.target === modal) { + modal.style.display = "none"; + document.body.style.overflow = "auto"; + } + }); + } \ No newline at end of file