Files
UiQuestions/static/scripts/handleScrollRestoration.js
bendtherules 4cf46e250e handleScrollRestoration - Add script to head
This will set history.scrollRestoration to "manual" on page start, if hash starts with "link-"
2020-10-26 12:33:40 +05:30

9 lines
205 B
JavaScript

var hash = window.location.hash;
var hashName = hash.substring(1, hash.length);
if (hashName.startsWith("link-")) {
if ("scrollRestoration" in history) {
history.scrollRestoration = "manual";
}
}