diff options
Diffstat (limited to 'content')
-rw-r--r-- | content/lightbox.js | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/content/lightbox.js b/content/lightbox.js index deb5cce..39a5074 100644 --- a/content/lightbox.js +++ b/content/lightbox.js | |||
@@ -39,13 +39,9 @@ | |||
39 | images[i].thumbnailEl.classList.add("is-selected"); | 39 | images[i].thumbnailEl.classList.add("is-selected"); |
40 | }; | 40 | }; |
41 | 41 | ||
42 | const prev = () => { | 42 | const prev = () => setIndex(currentIndex > 0 ? currentIndex - 1 : figureEls.length - 1); |
43 | setIndex(currentIndex > 0 ? currentIndex - 1 : figureEls.length - 1); | ||
44 | }; | ||
45 | 43 | ||
46 | const next = () => { | 44 | const next = () => setIndex(currentIndex < figureEls.length - 1 ? currentIndex + 1 : 0); |
47 | setIndex(currentIndex < figureEls.length - 1 ? currentIndex + 1 : 0); | ||
48 | }; | ||
49 | 45 | ||
50 | lightboxCloseEl?.addEventListener("click", hide); | 46 | lightboxCloseEl?.addEventListener("click", hide); |
51 | lightboxPrevEl.addEventListener("click", prev); | 47 | lightboxPrevEl.addEventListener("click", prev); |