feat: add lightbox for viewing forest and reward images fullscreen

- Click any forest element or reward image to see it large
- Smooth zoom-in animation, click anywhere to close
- Hover effect on clickable images
- Works on both forest grid and reward screen

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-29 20:50:20 +02:00
co-authored by Claude Opus 4.6
parent f9ae7c45eb
commit fabf9211c4
3 changed files with 72 additions and 0 deletions
+23
View File
@@ -64,4 +64,27 @@ document.addEventListener("DOMContentLoaded", async () => {
};
document.addEventListener("click", initAudioOnce);
document.addEventListener("keydown", initAudioOnce);
// Lightbox: click on forest/reward images to view fullscreen
const lightbox = document.getElementById("image-lightbox")!;
const lightboxImg = document.getElementById("lightbox-img") as HTMLImageElement;
document.addEventListener("click", (e) => {
const target = e.target as HTMLElement;
// Open lightbox when clicking forest element or reward image
if (
(target.tagName === "IMG" && target.closest(".forest__element")) ||
(target.tagName === "IMG" && target.closest(".reward__image-area"))
) {
lightboxImg.src = (target as HTMLImageElement).src;
lightboxImg.alt = (target as HTMLImageElement).alt;
lightbox.style.display = "flex";
}
});
// Close lightbox on click
lightbox.addEventListener("click", () => {
lightbox.style.display = "none";
lightboxImg.src = "";
});
});