mirror of
https://github.com/bendtherules/UiQuestions.git
synced 2026-08-18 22:02:42 +00:00
handleScrollRestoration - Add script to head
This will set history.scrollRestoration to "manual" on page start, if hash starts with "link-"
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
var hash = window.location.hash;
|
||||
var hashName = hash.substring(1, hash.length);
|
||||
|
||||
if (hashName.startsWith("link-")) {
|
||||
if ("scrollRestoration" in history) {
|
||||
history.scrollRestoration = "manual";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user