Jump to content
Search Community

ScrollTrigger only one direction while scrubbing

martis test
Moderator Tag

Recommended Posts

Hello,

 

I am looking to have an animation only scrub in one direction. I am running into an issue with loading and having its start and end points jump around. Or it will appear higher on the page, then as images above it load, it pushes it down, but will not reset correctly using the example here:

 

 

Is there a method I should be looking at like `refresh()`?

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

Link to comment
Share on other sites

Were you saying that the demo you linked to had that problem or did you just mean you're trying to do something like that? 

 

If you're lazy-loading images that shift the layout around, there are two solutions:

  1. Define width/height properties on all your elements/images so that the browser can lay out the page properly right away instead of updating things when they load. 
  2. If you can't do that, you can just call ScrollTrigger.refresh() AFTER your things are done loading and the layout isn't going to shift around anymore. 

Let us know if you need anything else. 

 

Happy tweening/scrolling!

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