From c86edbefb7a7dfef44ea204c1a5891d364c4a761 Mon Sep 17 00:00:00 2001 From: Ephraim Atta-Duncan Date: Thu, 23 May 2024 13:10:42 +0000 Subject: [PATCH] fix: reset autoplay timer when you manually click on a new slide --- apps/marketing/src/components/(marketing)/carousel.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/marketing/src/components/(marketing)/carousel.tsx b/apps/marketing/src/components/(marketing)/carousel.tsx index 252ad8d24..51ee3fed0 100644 --- a/apps/marketing/src/components/(marketing)/carousel.tsx +++ b/apps/marketing/src/components/(marketing)/carousel.tsx @@ -80,6 +80,13 @@ export const Carousel = () => { emblaThumbsApi.scrollTo(emblaApi.selectedScrollSnap()); resetProgress(); + const autoplay = emblaApi.plugins()?.autoplay; + + console.log(autoplay); + + if (autoplay) { + autoplay.reset(); + } }, [emblaApi, emblaThumbsApi, setSelectedIndex]); const resetProgress = useCallback(() => {