Skip to content

Commit 7a80b2e

Browse files
authored
Merge pull request #989 from JayMeDotDot/fix-mobile-page-animation
fix mobilePage carousel animation bug
2 parents 94b8f79 + 735ee1d commit 7a80b2e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/pages/Mobile/index.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ const MobilePage: React.FC = () => {
5252
const slideWidth = container.offsetWidth
5353

5454
if (currentSlide === 0) {
55-
container.style.transition = 'none'
56-
container.style.transform = `translateX(0)`
55+
container.style.transform = `translateX(-${totalSlides * slideWidth}px)`
5756
setTimeout(() => {
58-
container.style.transition = 'transform 0.5s ease'
59-
container.style.transform = `translateX(-${slideWidth}px)`
60-
}, 50)
57+
container.style.transition = 'none'
58+
container.style.transform = `translateX(0)`
59+
}, 500)
6160
} else {
61+
container.style.transition = 'transform 0.5s ease'
6262
container.style.transform = `translateX(-${currentSlide * slideWidth}px)`
6363
}
6464
}

0 commit comments

Comments
 (0)