Skip to content
Snippets Groups Projects
Commit cdaa4c0a authored by Austin Anderson's avatar Austin Anderson
Browse files

Try and fix scrolling to IDs again

parent a8987883
No related branches found
No related tags found
No related merge requests found
...@@ -104,11 +104,14 @@ $(function () { ...@@ -104,11 +104,14 @@ $(function () {
// Nothing to do if no hash in the URL // Nothing to do if no hash in the URL
if (window.location.hash.length <= 1) { if (window.location.hash.length <= 1) {
// Empty! // Empty!
// If the hash matches a span on the page, then scroll to it (a header) // If the hash matches a Category on the page, then scroll to it once the
// window gets focus (this handles e.g. if opened in the background)
} else if ($("span[id='" + unescaped + "']".length)) { } else if ($("span[id='" + unescaped + "']".length)) {
$(window).focus(function() {
document.getElementById(unescaped).scrollIntoView({ document.getElementById(unescaped).scrollIntoView({
behavior: 'smooth' behavior: 'smooth'
}); });
});
// If the hash is exactly 41 chars (hash sign # plus a 40-char sha hash), // If the hash is exactly 41 chars (hash sign # plus a 40-char sha hash),
// just show that modal. // just show that modal.
} else if (window.location.hash.length == 41) { } else if (window.location.hash.length == 41) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment