Reset Scroll Position after page is loaded
See original GitHub issueDescription
Each time i load new page, the scroll position stays same as it was on the previous page. I want to reset the scroll position each time page is reloaded.
Environment
Gatsby version: 1.9.130 Node.js version: 6.10.2 Operating System: mac OS High Sierra
File contents (if changed):
gatsby-config.js
:
package.json
:
gatsby-node.js
:
gatsby-browser.js
:
gatsby-ssr.js
:
Steps to reproduce
I’ve tried all solutions mentioned here: https://stackoverflow.com/questions/33188994/scroll-to-the-top-of-the-page-after-render-in-react-js and none of it helped. (i was adding those to html.js)
…
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:12 (9 by maintainers)
Top Results From Across the Web
html - How to reset the scroll position after loading of different ...
I've created the service app-scroll.service which looks like this: ... constructor() { } scrollToTop(){ const container = document.
Read more >Memorize Scroll Position Across Page Loads - CSS-Tricks
The trick is to throw the scroll position into localStorage right before the page is exited, and when loaded, grab that value and...
Read more >How to reset the scrolling position when the page is updated?
Ie if you scrolled to the middle of the page and updated it, the browser remembers this position. It is required that when...
Read more >jQuery | How can maintain scroll position after height of body ...
I have a one-page website and if user access path/#contact it will scroll to that section and after slider finish to load the...
Read more >List - How to reset scroll position after dataSource is updated
Hi mps Developer,. You can accomplish this by using the following methods: scrollTo, scrollTop. The idea is to use the scrollTop method before ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@monsieurnebo, not sure if this is helpful or not but instead of dealing with the issue that you described I decided to simply force it to start at the top every time. Not very elegant but it was better than the current behavior for my use case.
https://github.com/ryanwiemer/rw/blob/907ee95cc39c97eb560ec39b02a7b76ad116d5c9/gatsby-browser.js#L4-#L10
This should restore the correct behavior folks https://github.com/gatsbyjs/gatsby/pull/3775