Jump to content
Search Community

Gatsby + ScrollSmoother

Eduardo Muramoto test
Moderator Tag

Go to solution Solved by OSUblake,

Recommended Posts

Hi,

I'm currently adding ScrollSmoother to a Gatsby website. It seems like the height of the page is not updating when I render a new page or there's a rehydration.
I was wondering if there's a way of refreshing ScrollSmoother or updating it.

 

Another thing that I wanted to know if there's a way that I can use listeners like "onUpdate: (self) => {}" when I use ScrollSmoother.get() in a different component.

Link to comment
Share on other sites

  • Solution

Welcome to the forums @Eduardo Muramoto

 

Just call ScrollTrigger.refresh() to update ScrollSmoother.

 

19 minutes ago, Eduardo Muramoto said:

Another thing that I wanted to know if there's a way that I can use listeners like "onUpdate: (self) => {}" when I use ScrollSmoother.get() in a different component.

 

No, but maybe we add a way to do that in the future. Here's just a quicky example of how you could do that by making your own custom add/remove listener.

 

https://codesandbox.io/s/gsap-scrollsmoother-next-js-starter-forked-irmojq?file=/pages/_app.js

 

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