Carousel: Fix reveal
This commit is contained in:
@@ -52,16 +52,18 @@ export const animateIn = scope => {
|
||||
|
||||
// Reveal on scroll
|
||||
let visible = false
|
||||
requestAnimationFrame(() => {
|
||||
const carouselReveal = ScrollOut({
|
||||
once: true,
|
||||
targets: scope,
|
||||
onChange: (el, ctx) => {
|
||||
requestAnimationFrame(() => {
|
||||
if (ctx.visible === 0) {
|
||||
visible = true
|
||||
}
|
||||
})
|
||||
},
|
||||
onShown: (el, ctx) => {
|
||||
requestAnimationFrame(() => {
|
||||
// If revealed on scroll, no delay
|
||||
if (visible) {
|
||||
tl.restart()
|
||||
@@ -70,7 +72,7 @@ export const animateIn = scope => {
|
||||
else {
|
||||
setTimeout(() => tl.restart(), animDelay * 2)
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user