JS > Mobile > Index > add a function to next-project button
All checks were successful
Deploy / Deploy to Production (push) Successful in 4s

This commit is contained in:
camille 2026-07-01 17:58:43 +02:00
parent 5e478feed3
commit 4412a0a01a

View file

@ -1,6 +1,7 @@
document.addEventListener("DOMContentLoaded", () => {
const nextButtons = document.querySelectorAll("button.next");
const nextProjectButtons = document.querySelectorAll("button.next-project");
const projects = document.querySelectorAll(".projects-index .project");
const firstProject = projects[0];
@ -89,6 +90,10 @@ document.addEventListener("DOMContentLoaded", () => {
nextButton.addEventListener("click", goToNextPicture);
});
nextProjectButtons.forEach((nextProjectButton) => {
nextProjectButton.addEventListener("click", goToNextProject);
});
document.addEventListener("keyup", (event) => {
if (event.key === "ArrowRight") goToNextPicture();
if (event.key === "ArrowLeft") goToPrevPicture();