svelte-carousel
svelte-carousel copied to clipboard
responsive feature
would be great is we had responsive prop i.e: show certain number of particles in given screen size... I love the carousel!!!
Hi @kimutaiRop, so glad to hear that! Thank you! Nice feature, ok.
@vadimkorr Is this functionality added?
I solved it simply by doing the following:
<script lang="ts">
import Carousel from 'svelte-carousel';
let windowWidth: number;
const averageWidth = 380;
$: numberOfSlides = windowWidth ? Math.floor(windowWidth / averageWidth) : 4;
</script>
<svelte:window bind:innerWidth={windowWidth} />
<Carousel particlesToShow={numberOfSlides}>
<div>Slide 1</div>
<div>Slide 2</div>
<div>Slide 3</div>
<div>Slide 4</div>
<div>Slide 5</div>
</Carousel>