Jump to content
Search Community

During page transition I want to scroll to top but ScrollSmoother is prevent window.ScrollTo behaviour instant

Duet Colin test
Moderator Tag

Go to solution Solved by Duet Colin,

Recommended Posts

During page transition I want to scroll to top but ScrollSmoother is prevent window.ScrollTo behaviour instant. So the scrolling is always smooth.. I need going instantly to top. 

 

Any idea if this is desirable behaviour? Because when I disable ScrollSmoother everything works perfectly. 

Do I need to kill ScrollSmoother or pause it?

 

When I read the docs, this should always work:

// scroll to top
window.scrollTo({
    top: 0,
    behavior: 'instant'
})
Link to comment
Share on other sites

Hi,

 

Is great to hear that you got it solved.

 

You can also explore ScrollTrigger's clearScrollMemory method:

https://greensock.com/docs/v3/Plugins/ScrollTrigger/static.clearScrollMemory()

 

Also keep in mind that some frameworks and packages offer scroll restoration in their routing solutions, so it would be a good idea to check on the resources of the framework you're using as well.

 

Happy Tweening!

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