diff --git a/src/components/Carousel/Carousel.svelte b/src/components/Carousel/Carousel.svelte index 5ee99ec..223492d 100644 --- a/src/components/Carousel/Carousel.svelte +++ b/src/components/Carousel/Carousel.svelte @@ -17,7 +17,7 @@ const dispatch = createEventDispatcher() - const directionFnDescription = { + const autoplayDirectionFnDescription = { [NEXT]: () => { progressManager.start(() => { showNextPage() @@ -30,6 +30,15 @@ } } + const directionFnDescription = { + [NEXT]: () => { + showNextPage() + }, + [PREV]: () => { + showPrevPage() + } + } + /** * CSS animation timing function * examples: 'linear', 'steps(5, end)', 'cubic-bezier(0.1, -0.6, 0.2, 0)' @@ -161,7 +170,7 @@ function applyAutoplay() { if (autoplay) { - directionFnDescription[autoplayDirection]() + autoplayDirectionFnDescription[autoplayDirection]() } }