diff --git a/src/lib/NavClose.svelte b/src/lib/Close.svelte similarity index 100% rename from src/lib/NavClose.svelte rename to src/lib/Close.svelte diff --git a/src/lib/Gallery.svelte b/src/lib/Gallery.svelte index 3906fe3..17fc1ae 100644 --- a/src/lib/Gallery.svelte +++ b/src/lib/Gallery.svelte @@ -4,6 +4,7 @@ import { linear } from "svelte/easing"; import ArrowLeft from "$lib/ArrowLeft.svelte"; import ArrowRight from "$lib/ArrowRight.svelte"; + import Close from "$lib/Close.svelte"; export let images; export let arrowColor; @@ -13,6 +14,7 @@ let selectedImageIndex = 0 let elements = []; + let fullscreenShown = false; const scrollConfig = { behavior: 'smooth', @@ -48,12 +50,38 @@ elements[selectedImageIndex].scrollIntoView(scrollConfig) }); } + + const openFullscreen = () => { + fullscreenShown = true + document.body.classList.add("no-scroll") + } + + const closeFullscreen = () => { + fullscreenShown = false + document.body.classList.remove("no-scroll") + }
- {images[selectedImageIndex].image.alt} + +
e.stopPropagation()}> + {images[selectedImageIndex].image.alt} +
{images[selectedImageIndex].image.alt}
+
+ +