Jump to content
Search Community

Incorrect trigger positions when using two or more ScrollTrigger

PavelD test
Moderator Tag

Go to solution Solved by GreenSock,

Recommended Posts

  • Solution

Welcome to the forums, @PavelD! And thanks for putting together such a great minimal demo. Those are super helpful. 

 

The problem is that you're passing a numeric value as the "end" for your ScrollTrigger, and numbers are interpreted as the raw (absolute) scroll position but I think you meant to use a relative value. For example...

// when the page has scrolled exactly 500px (absolute, like from the very top):
end: 500

// when the page has scrolled 500px beyond wherever the start of this ScrollTrigger is (relative):
end: "+=500"

Is this what you intended?:

See the Pen ExegbjW?editors=1010 by GreenSock (@GreenSock) on CodePen

  • Like 1
Link to comment
Share on other sites

4 hours ago, GreenSock said:

Welcome to the forums, @PavelD! And thanks for putting together such a great minimal demo. Those are super helpful. 

 

The problem is that you're passing a numeric value as the "end" for your ScrollTrigger, and numbers are interpreted as the raw (absolute) scroll position but I think you meant to use a relative value. For example...

// when the page has scrolled exactly 500px (absolute, like from the very top):
end: 500

// when the page has scrolled 500px beyond wherever the start of this ScrollTrigger is (relative):
end: "+=500"

Is this what you intended?:

 

 

This is exactly what i wanted. Thank you very much!

  • Like 1
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...