Modified Executive Committee page

This commit is contained in:
Kent Joseph T. Palima
2026-04-30 12:37:45 +08:00
parent 4b7ae32e07
commit c333a4725a
+19 -16
View File
@@ -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";
}
});
}
</script>