Jump to content
Search Community

Update end point on scrollTrigger after resize

D.Cus test
Moderator Tag

Go to solution Solved by Cassie,

Recommended Posts

How do I update the end value in this scrollTrigger when the browser does a resize.
I have tried doing 

a resize event to fire ScrollTrigger.refresh(); but this seems to do nothing and running the scrollTrigger within a resize just creates multiple scrollTrigger instances

Thanks in advance

See the Pen JjJKmbM?editors=1111 by darren-ignition (@darren-ignition) on CodePen

Link to comment
Share on other sites

  • Solution

Hey there!

If you're trying to set the end trigger at the top of the footer element you can set the footer as the end trigger.

See the Pen rNwLQOK?editors=1011 by GreenSock (@GreenSock) on CodePen



You can also use the invalidateOnRefresh property. It will refresh any functional values.

 

 

invalidateOnRefresh Boolean - If true, the animation associated with the ScrollTrigger will have its invalidate() method called whenever a refresh() occurs (typically on resize). This flushes out any internally-recorded starting values.



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


 

  • Like 5
  • Thanks 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...