Spaces:
Paused
Paused
Download src/lib/components/common/SlideShow.svelte from coteerratu/open-webui: direct link, hf CLI and curl.
- Browser
- Download file 976 Bytes
-
https://huggingface.co/spaces/coteerratu/open-webui/resolve/main/src/lib/components/common/SlideShow.svelte
- Command line
-
hf download hf://spaces/coteerratu/open-webui/src/lib/components/common/SlideShow.svelte
-
curl -L -o SlideShow.svelte https://huggingface.co/spaces/coteerratu/open-webui/resolve/main/src/lib/components/common/SlideShow.svelte
976 Bytes
| <script lang="ts"> | |
| import { onMount } from 'svelte'; | |
| export let imageUrls = [ | |
| '/assets/images/adam.jpg', | |
| '/assets/images/galaxy.jpg', | |
| '/assets/images/earth.jpg', | |
| '/assets/images/space.jpg' | |
| ]; | |
| export let duration = 5000; | |
| let selectedImageIdx = 0; | |
| onMount(() => { | |
| setInterval(() => { | |
| selectedImageIdx = (selectedImageIdx + 1) % (imageUrls.length - 1); | |
| }, duration); | |
| }); | |
| </script> | |
| {#each imageUrls as imageUrl, idx (idx)} | |
| <div | |
| class="image w-full h-full absolute top-0 left-0 bg-cover bg-center transition-opacity duration-1000" | |
| style="opacity: {selectedImageIdx === idx ? 1 : 0}; background-image: url('{imageUrl}')" | |
| ></div> | |
| {/each} | |
| <style> | |
| .image { | |
| position: absolute; | |
| top: 0; | |
| left: 0; | |
| width: 100%; | |
| height: 100%; | |
| background-size: cover; | |
| background-position: center; /* Center the background images */ | |
| transition: opacity 1s ease-in-out; /* Smooth fade effect */ | |
| opacity: 0; /* Make images initially not visible */ | |
| } | |
| </style> | |