I'm using Hexo to generate my personal website, and the theme NexT I used provide PJAX support. After enable PJAX, the scroll position back to top of the page on every refresh.
Is it possible to restore the scroll position at page refresh?
I'm using Hexo to generate my personal website, and the theme [`NexT`](https://github.com/theme-next/hexo-theme-next) I used provide PJAX support. After enable PJAX, the scroll position back to top of the page on every refresh.
Is it possible to restore the scroll position at page refresh?
You can configure this by setting 'scrollRestoration' to false:
newPjax({scrollRestoration:false,});
Okay I found the reason for this behavior:
Pjax sets scrollRestoration to 'manual':
https://github.com/MoOx/pjax/blob/7940a6e3e595dae970f670b0abfc2cc03d74d614/index.js#L26
You can configure this by setting 'scrollRestoration' to false:
```js
new Pjax({
scrollRestoration: false,
});
```
scrollRestoration (Boolean, default: true)
When set to true, Pjax will attempt to restore the scroll position when navigating backwards or forwards.
What does this mean?
@bjoernhasse This solved my problem, thanks!
According to the README
> `scrollRestoration` (Boolean, default: true)
> When set to true, Pjax will attempt to restore the scroll position when navigating backwards or forwards.
What does this mean?
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
I'm using Hexo to generate my personal website, and the theme
NexTI used provide PJAX support. After enable PJAX, the scroll position back to top of the page on every refresh.Is it possible to restore the scroll position at page refresh?
I am having the same issue. Does anyone have an idea how to fix it?
Okay I found the reason for this behavior:
Pjax sets scrollRestoration to 'manual':
https://github.com/MoOx/pjax/blob/7940a6e3e595dae970f670b0abfc2cc03d74d614/index.js#L26
You can configure this by setting 'scrollRestoration' to false:
@bjoernhasse This solved my problem, thanks!
According to the README
What does this mean?