summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorVolpeon <git@volpeon.ink>2021-12-30 07:41:17 +0100
committerVolpeon <git@volpeon.ink>2021-12-30 07:41:17 +0100
commit1f57750948b4b6fea541e5ed4f473b592b66e47e (patch)
treed2ff81165f605e1d0fcdd4864963d06c9a77f9b6 /content
parentLightbox optimizations (diff)
downloadvolpeon.ink-1f57750948b4b6fea541e5ed4f473b592b66e47e.tar.gz
volpeon.ink-1f57750948b4b6fea541e5ed4f473b592b66e47e.tar.bz2
volpeon.ink-1f57750948b4b6fea541e5ed4f473b592b66e47e.zip
Improved lightbox
Diffstat (limited to 'content')
-rw-r--r--content/lightbox.js2
1 files changed, 2 insertions, 0 deletions
diff --git a/content/lightbox.js b/content/lightbox.js
index d6115b4..4ec959d 100644
--- a/content/lightbox.js
+++ b/content/lightbox.js
@@ -5,6 +5,7 @@
5 const mainEl = document.querySelector("main"); 5 const mainEl = document.querySelector("main");
6 const lightboxEl = document.querySelector(".c-lightbox"); 6 const lightboxEl = document.querySelector(".c-lightbox");
7 const lightboxBgEl = lightboxEl.querySelector(".c-lightbox__bg"); 7 const lightboxBgEl = lightboxEl.querySelector(".c-lightbox__bg");
8 const lightboxCountEl = lightboxEl.querySelector(".c-lightbox__count");
8 const lightboxCloseEl = lightboxEl.querySelector(".c-lightbox__close"); 9 const lightboxCloseEl = lightboxEl.querySelector(".c-lightbox__close");
9 const lightboxPrevEl = lightboxEl.querySelector(".c-lightbox__prev"); 10 const lightboxPrevEl = lightboxEl.querySelector(".c-lightbox__prev");
10 const lightboxNextEl = lightboxEl.querySelector(".c-lightbox__next"); 11 const lightboxNextEl = lightboxEl.querySelector(".c-lightbox__next");
@@ -24,6 +25,7 @@
24 const setIndex = (i) => { 25 const setIndex = (i) => {
25 currentIndex = i; 26 currentIndex = i;
26 lightboxImgEl.src = figureEls[i].href; 27 lightboxImgEl.src = figureEls[i].href;
28 lightboxCountEl.textContent = (i + 1) + " / " + figureEls.length;
27 lightboxPrevEl.classList.toggle("u-dn", i === 0); 29 lightboxPrevEl.classList.toggle("u-dn", i === 0);
28 lightboxNextEl.classList.toggle("u-dn", i === figureEls.length - 1); 30 lightboxNextEl.classList.toggle("u-dn", i === figureEls.length - 1);
29 }; 31 };