Jump to content
Search Community

End scrolling at the right

Wixxtorr test
Moderator Tag

Go to solution Solved by Wixxtorr,

Recommended Posts

Hi!

I'm trying to understand how a scroll trigger works. In this example, I can’t manage to set up a scroll trigger in such a way that the scrolling of images ends at the right edge of the window, and does not scroll all the way to the left. Can anyone suggest? I've already tried different options, it doesn't work.

Viktor

See the Pen oNqMovG by v777999 (@v777999) on CodePen

Link to comment
Share on other sites

Like this?: 

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

 

You just needed to adjust the x distance (subtracting the window.innerWidth). And I'd recommend making it a function-based value and setting invalidateOnRefresh: true on your ScrollTrigger so that it's forced to re-calculate that whenever the window resizes (responsive). 

 

Happy tweening!

  • Like 1
Link to comment
Share on other sites

  • Solution
57 minutes ago, GreenSock said:

Like this?: 

 

 

 

You just needed to adjust the x distance (subtracting the window.innerWidth). And I'd recommend making it a function-based value and setting invalidateOnRefresh: true on your ScrollTrigger so that it's forced to re-calculate that whenever the window resizes (responsive). 

 

Happy tweening!

Yes, that's exactly what I wanted! Thank you so much! I will continue to study further.

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