Jump to content
Search Community

Pinned element inside dynamic content section

adam.reznicek test
Moderator Tag

Go to solution Solved by GreenSock,

Recommended Posts

  • Solution

First of all, thanks for the minimal demo, @adam.reznicek! Super clear and very helpful. 

 

Yes, you can dynamically do stuff like that - the key is that you've gotta tell ScrollTrigger to refresh() after you've shifted things around in the DOM. That'll tell it to re-calculate the start/end values for the various ScrollTriggers. You could get fancy and do a ResizeObserver that's debounced like this: 

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

 

Or do it in whatever way you want - the point is to wait until your DOM is done shifting around, and THEN call ScrollTrigger.refresh(). 

 

Does that help? 

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