Disable scroll-top on back button with SPA functionality

To be clear, this is not spam. I had to create a new post since it would not allow me to edit my prior post

I’m currently working on this project which adds SPA functionality to SSG sites. I’ve ran into a issue with the use of window.scrollTo(0, 0)

At the moment on back button input (pushstate) the SPA will go to the top by default. I only want the window.scrollTo(0, 0) to work on href and not pushstate since this creates a glitching effect that is distracting.

Here is the repo with an example of SPA functionality with a site. There are instructions for quick start in readMe.

https://github.com/moonfacedesign/atmos/tree/stack-001

Site

https://mf-stackpost-001.onrender.com

Can I use window.scrollTo(0, 0) somewhere else so it will not work on back button or is there another method I need to look into?

Cheers.

Do you want scroll to tag after pressing a button? Not sure if I understand this correctly. Send me a PM, maybe I can help you

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.