fix autoscroll not working on slow connections
This commit is contained in:
parent
2e1bca75e3
commit
76be31d38e
2 changed files with 11 additions and 13 deletions
|
@ -26,6 +26,16 @@ $.getJSON("blog/posts.json", function (json) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (window.location.hash.startsWith("#blog-")) {
|
||||||
|
var anchor = $(window.location.hash);
|
||||||
|
if (anchor.length) {
|
||||||
|
openBlogPost(window.location.hash.substring(6));
|
||||||
|
$('html, body').animate({
|
||||||
|
scrollTop: anchor.offset().top
|
||||||
|
}, 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function openBlogPost(id) {
|
function openBlogPost(id) {
|
||||||
|
|
|
@ -13,9 +13,7 @@ $(function () {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
openModals(window.location.hash);
|
||||||
let hash = window.location.hash;
|
|
||||||
openModals(hash);
|
|
||||||
$('a').on('click', function () {
|
$('a').on('click', function () {
|
||||||
openModals($(this).attr('href'));
|
openModals($(this).attr('href'));
|
||||||
});;
|
});;
|
||||||
|
@ -35,16 +33,6 @@ $(function () {
|
||||||
window.location.hash = "";
|
window.location.hash = "";
|
||||||
location.reload();
|
location.reload();
|
||||||
});
|
});
|
||||||
|
|
||||||
if (hash.startsWith("#blog-")) {
|
|
||||||
var anchor = $(hash);
|
|
||||||
if (anchor.length) {
|
|
||||||
openBlogPost(hash.substring(6));
|
|
||||||
$('html, body').animate({
|
|
||||||
scrollTop: anchor.offset().top
|
|
||||||
}, 0)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function getCookie(key) {
|
function getCookie(key) {
|
||||||
|
|
Loading…
Reference in a new issue