From 407c9656cbd188ba39bf7352e4533fb065fc0d8d Mon Sep 17 00:00:00 2001 From: Michael Pilosov Date: Sun, 14 Jan 2024 06:41:02 +0000 Subject: [PATCH] updated lightbox --- out/index.html | 62 ++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 53 insertions(+), 9 deletions(-) diff --git a/out/index.html b/out/index.html index 19fc5f4..cbaad4f 100644 --- a/out/index.html +++ b/out/index.html @@ -26,6 +26,7 @@ background-color: rgba(0, 0, 0, 0.8); align-items: center; justify-content: center; + z-index: 1000; } #lightbox img { max-width: 80%; @@ -34,6 +35,11 @@ #lightbox #caption { color: white; margin-top: 20px; + position: absolute; + bottom: 10px; + left: 50%; + transform: translateX(-50%); + text-align: center; } @@ -42,7 +48,7 @@

Image Gallery

- +
@@ -53,6 +59,9 @@ + + function navigateLightbox(direction) { + var newIndex = currentImageIndex + direction; + // Looping over if the index goes out of bounds + if (newIndex >= imageArray.length) { + newIndex = 0; + } else if (newIndex < 0) { + newIndex = imageArray.length - 1; + } + // Checking if the new image is visible + if (imageArray[newIndex].style.display !== 'none') { + currentImageIndex = newIndex; + var newImage = imageArray[currentImageIndex]; + openLightbox(newImage.src, newImage.src.split('/').pop()); + } else { + // Recursively call the function to skip non-visible images + navigateLightbox(direction); + } + } + window.onload = function() { + loadImages(); + updateGridLayout(document.getElementById('layoutSlider').value); + }; +