diff --git a/src/components/Carousel/Carousel.svelte b/src/components/Carousel/Carousel.svelte index 4e6e85a..1db0fbc 100644 --- a/src/components/Carousel/Carousel.svelte +++ b/src/components/Carousel/Carousel.svelte @@ -198,14 +198,16 @@ } } + // Disable page change while animation is in progress let disabled = false - function safeChangePage(cb) { + function safeChangePage(cb, options) { + const animated = get(options, 'animated', true) if (disabled) return cb() disabled = true setTimeout(() => { disabled = false - }, duration) + }, animated ? duration : 0) } function showPage(pageIndex, { offsetDelayMs, animated }) {