Jump to content
Search Community

Creating a section before the section with fixed and the scroll will not repeat to the 1st section

Louienator test
Moderator Tag

Recommended Posts

Hi,

 

I'm not completely sure about what you're trying to do here, maybe something like this:

See the Pen XWzRraJ by GreenSock (@GreenSock) on CodePen

 

One issue I can see in your code is this:

tl.fromTo([outerWrappers[index], innerWrappers[index]], { 
  yPercent: i => i ? -100 * dFactor : 100 * dFactor
}, { 
  yPercent: 0 
}, 0)
  .fromTo(images[index], { yPercent: 15 * dFactor }, { yPercent: 0 }, 0)
  .from( headings, {
  // HERE
  scrollTrigger: {
    trigger: sections,
    onEnter: function() {
      gsap.set( headings, {
        y: 140
      });
    },
    onLeave: function() {
      gsap.set( headings, {
        y: 140
      });
    }
  }
});

You have a ScrollTrigger config inside a Timeline child instance, that is a logical problem as explained in our Learning Center:

https://gsap.com/resources/st-mistakes/#nesting-scrolltriggers-inside-multiple-timeline-tweens

 

Also I'm fuzzy about why you need/want a ScrollTrigger config in there since everything is being ran by the Observer Plugin.

 

Happy Tweening!

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...