svelte-carousel icon indicating copy to clipboard operation
svelte-carousel copied to clipboard

responsive feature

Open kimutaiRop opened this issue 4 years ago • 3 comments

would be great is we had responsive prop i.e: show certain number of particles in given screen size... I love the carousel!!!

kimutaiRop avatar Oct 21 '21 18:10 kimutaiRop

Hi @kimutaiRop, so glad to hear that! Thank you! Nice feature, ok.

vadimkorr avatar Oct 22 '21 07:10 vadimkorr

@vadimkorr Is this functionality added?

Absleepy avatar Mar 09 '23 16:03 Absleepy

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>

imCorfitz avatar Apr 03 '23 07:04 imCorfitz