From ecca0c3892d022b38ed66be71cd0131e7b3bd26e Mon Sep 17 00:00:00 2001 From: Vadim Date: Fri, 2 Jul 2021 17:26:37 +0300 Subject: [PATCH] #31 : Fix swipe --- src/components/Carousel/Carousel.svelte | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) 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]() } }