force scroll to the blog once it's loaded
All checks were successful
Web/pipeline/head This commit looks good
All checks were successful
Web/pipeline/head This commit looks good
This commit is contained in:
parent
9ddbf3be57
commit
484025fe0a
5 changed files with 16 additions and 11 deletions
|
@ -13,6 +13,7 @@
|
|||
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
|
||||
<script src="../scripts/util.js"></script>
|
||||
|
||||
<!-- Global site tag (gtag.js) - Google Analytics -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-150032076-2"></script>
|
||||
|
@ -41,7 +42,6 @@
|
|||
<div id="content">
|
||||
<div id="entries">
|
||||
<!-- Cookie notification -->
|
||||
<script src="../scripts/cookies.js"></script>
|
||||
<script src="../scripts/cookieinfo.js"></script>
|
||||
</div>
|
||||
<script src="index.js"></script>
|
||||
|
|
|
@ -53,15 +53,7 @@ function populateManual(lang) {
|
|||
sidebar.append(`<a href="https://git.ellpeck.de/Ellpeck/Web">© Ellpeck</a>`);
|
||||
sidebar.append("<hr>");
|
||||
|
||||
// Move to anchor now that it's loaded
|
||||
if (window.location.hash.startsWith("#")) {
|
||||
var anchor = $(window.location.hash);
|
||||
if (anchor.length) {
|
||||
$('html, body').animate({
|
||||
scrollTop: anchor.offset().top
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
forceToAnchor();
|
||||
}
|
||||
|
||||
function replaceFormatting(text) {
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/gh/google/code-prettify@master/loader/prettify.js"></script>
|
||||
<script src="scripts/cookies.js"></script>
|
||||
<script src="scripts/util.js"></script>
|
||||
<script src="scripts/main.js"></script>
|
||||
|
||||
<!-- Global site tag (gtag.js) - Google Analytics -->
|
||||
|
|
|
@ -28,5 +28,6 @@ $.ajax({
|
|||
list.append(p);
|
||||
}
|
||||
}
|
||||
forceToAnchor();
|
||||
}
|
||||
});
|
|
@ -12,3 +12,15 @@ function setCookie(key, value, days) {
|
|||
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
|
||||
document.cookie = key + "=" + value + "; expires=" + date.toUTCString();
|
||||
}
|
||||
|
||||
function forceToAnchor() {
|
||||
// this is probably a terrible hack
|
||||
if (window.location.hash.startsWith("#")) {
|
||||
var anchor = $(window.location.hash);
|
||||
if (anchor.length) {
|
||||
$('html, body').animate({
|
||||
scrollTop: anchor.offset().top
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue