Modified Executive Committee page
This commit is contained in:
@@ -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>
|
||||
Reference in New Issue
Block a user