From 1f57750948b4b6fea541e5ed4f473b592b66e47e Mon Sep 17 00:00:00 2001 From: Volpeon Date: Thu, 30 Dec 2021 07:41:17 +0100 Subject: Improved lightbox --- content/lightbox.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'content') 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 @@ const mainEl = document.querySelector("main"); const lightboxEl = document.querySelector(".c-lightbox"); const lightboxBgEl = lightboxEl.querySelector(".c-lightbox__bg"); + const lightboxCountEl = lightboxEl.querySelector(".c-lightbox__count"); const lightboxCloseEl = lightboxEl.querySelector(".c-lightbox__close"); const lightboxPrevEl = lightboxEl.querySelector(".c-lightbox__prev"); const lightboxNextEl = lightboxEl.querySelector(".c-lightbox__next"); @@ -24,6 +25,7 @@ const setIndex = (i) => { currentIndex = i; lightboxImgEl.src = figureEls[i].href; + lightboxCountEl.textContent = (i + 1) + " / " + figureEls.length; lightboxPrevEl.classList.toggle("u-dn", i === 0); lightboxNextEl.classList.toggle("u-dn", i === figureEls.length - 1); }; -- cgit v1.2.3-70-g09d2