Jump to content
Search Community

Scroll trigger on repetitive blog structure

Pierrest test
Moderator Tag

Recommended Posts

Hello everybody,

 

I would like to make an action on each post of a blog when they enter the viewport.

i did the following, but the event is fired on all elements with the .blog-item class, i would like to be fired only when each blog-item element enter the viewport, could it be possible to pass something like "this" in jQuery from the ScrollTrigger?

Thanks all.

 

 let articles = gsap.utils.toArray($(".blog-item > *"));

ScrollTrigger.create({
  start: "bottom bottom",
  trigger: ".blog-item",
  onEnter: articleApparition
});

  function articleApparition() {
    let init= 1;
    articles.forEach(function(section){
    let delais = init * 0.7;
    gsap.to(section, {
      opacity:1, 
      duration:2,
      delay: delais, 
      ease:"power1.out"
    });
    init++

    });
  }

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...