jlmakes / scrollreveal

Animate elements as they scroll into view.
https://scrollrevealjs.org/
22.3k stars 2.26k forks source link

Staggered Reveal #518

Closed kerns closed 4 years ago

kerns commented 4 years ago

Just entering this feature request into the record. Staggered reveal would be just like the sequenced reveal but randomized. In many ways this mimics or emulates real-time lazy loading.

jlmakes commented 4 years ago

I'm not sure it's exactly what you're imagining, but I was thinking you could randomize the options.delay for each revealed item.

let items = [].slice.call(document.querySelectorAll('.item'))

for (let item of items) {
    ScrollReveal().reveal(item, {
      reset: true,
      delay: Math.random() * 1000
    });
}

See the Demo on JSbin

kerns commented 4 years ago

YES. That's it. Thanks 👍 Hope to see it as a feature in your next release should that come.