Jump to content
Search Community

ScrollSmoother with dynamic content

Stephan Wergles test
Moderator Tag

Recommended Posts

Hey, 

 

I'm using ScrollSmoother with ScrollTrigger to smooth out scrolling my entire page. This page uses e.g. a collapse component to toggle several content blocks, meaning the height of the "smooth-content" can change as the user is interacting with the page, which results in a wrong calculation of the scroll height. Thus you can scroll more far or less than the updated content's height.

 

Is there any method available, to update ScrollSmoother's content calculation?

 

Thanks and cheerz

Stephan

Link to comment
Share on other sites

Sure, you can call ScrollTrigger.refresh() anytime to have it recalculate things. A cheaper option is to call ScrollSmoother.get().scrollTrigger.refresh() to only refresh that one ScrollTrigger rather than all of them. The next release of ScrollSmoother will likely include a ResizeObserver that'll automatically refresh() when the content resizes.

 

Thanks for being a Club GreenSock member! 💚

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