From 735ee1df5c82972a01a07e37e4d4fabf789a579c Mon Sep 17 00:00:00 2001 From: JayMeDotDot Date: Tue, 10 Jun 2025 22:46:02 +0800 Subject: [PATCH] fix mobilePage carousel animation bug --- src/pages/Mobile/index.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/pages/Mobile/index.tsx b/src/pages/Mobile/index.tsx index 4542aca4..1aa58cf8 100644 --- a/src/pages/Mobile/index.tsx +++ b/src/pages/Mobile/index.tsx @@ -53,13 +53,13 @@ const MobilePage: React.FC = () => { const slideWidth = container.offsetWidth if (currentSlide === 0) { - container.style.transition = 'none' - container.style.transform = `translateX(0)` + container.style.transform = `translateX(-${totalSlides * slideWidth}px)` setTimeout(() => { - container.style.transition = 'transform 0.5s ease' - container.style.transform = `translateX(-${slideWidth}px)` - }, 50) + container.style.transition = 'none' + container.style.transform = `translateX(0)` + }, 500) } else { + container.style.transition = 'transform 0.5s ease' container.style.transform = `translateX(-${currentSlide * slideWidth}px)` } }