Skip to content

Is it possible to stagger animations triggered by inView? (vanilla JS) #2928

Answered by mattgperry
bogdano asked this question in Q&A
Discussion options

You must be logged in to vote

Yeah it's possible though here target is just one element so it's not going to stagger anything. I think without a sandbox it's hard to imagine what you're trying to - are there multiple .fade-in elements? If so I think it's more likely you want one element to trigger the animation of all of them, which should then be staggered.

inView(parentElement, ({ target }) => {
        animate(".fade-in",
                { opacity: [0, 1]},
                { duration: 0.6, ease: 'easeOut' },
                { delay: stagger(0.9) }
        );
})

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by bogdano
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants