Jump to content
Search Community

Use my own scroll value with ScrollTrigger?

jesper.landberg test
Moderator Tag

Recommended Posts

@jesper.landberg I read your question a few times and I'm still not quite sure what you're asking. Did you read through the docs and watch the [new] video already? That might clear things up. 

 

Basically the scrollerProxy() method lets you say "hey, ScrollTrigger, for this particular scroller element (like 'body' or '.container'), please use these methods to interact with it instead of the standard ones because I'm gonna customize things". So your scrollTop in that configuration object should be a FUNCTION that can get or set the scrollTop. So when ScrollTrigger tries to discern the scrollTop of that element, it'll call that function and you can return whatever value you want, and ScrollTrigger will use that. 

 

Is it clearer now? 

 

There are 3 different demos on the docs page. Hopefully those serve as decent templates. Let me know if you have any other questions. Better yet, if you've got a reduced test case where you're trying to make something work (but it isn't working), please provide that. I'm sure it'll illuminate things for me so I better understand what you're asking. 

  • Like 1
Link to comment
Share on other sites

10 hours ago, GreenSock said:

@jesper.landberg I read your question a few times and I'm still not quite sure what you're asking. Did you read through the docs and watch the [new] video already? That might clear things up. 

 

Basically the scrollerProxy() method lets you say "hey, ScrollTrigger, for this particular scroller element (like 'body' or '.container'), please use these methods to interact with it instead of the standard ones because I'm gonna customize things". So your scrollTop in that configuration object should be a FUNCTION that can get or set the scrollTop. So when ScrollTrigger tries to discern the scrollTop of that element, it'll call that function and you can return whatever value you want, and ScrollTrigger will use that. 

 

Is it clearer now? 

 

There are 3 different demos on the docs page. Hopefully those serve as decent templates. Let me know if you have any other questions. Better yet, if you've got a reduced test case where you're trying to make something work (but it isn't working), please provide that. I'm sure it'll illuminate things for me so I better understand what you're asking. 

 

Sorry as usual I suck at explaining my issues haha:) but ur answer still managed to clear it up for me and my personal smooth scroll now works fine with this:) Thanks!

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