fix: apply same fix to ShopModule

This commit is contained in:
2023-06-11 22:55:09 +02:00
parent f70c9d4997
commit ddef65da52

View File

@@ -38,15 +38,16 @@
// Image rotation
let imagesLoop: ReturnType<typeof setTimeout>
let currentImageIndex = 0
const loopDuration = 3000
const incrementCurrentImageIndex = () => {
currentImageIndex = currentImageIndex === images.length - 1 ? 0 : currentImageIndex + 1
imagesLoop = setTimeout(() => requestAnimationFrame(incrementCurrentImageIndex), 3000)
imagesLoop = setTimeout(() => requestAnimationFrame(incrementCurrentImageIndex), loopDuration)
}
onMount(() => {
if (images.length > 1) {
incrementCurrentImageIndex()
imagesLoop = setTimeout(incrementCurrentImageIndex, loopDuration)
}
return () => {