fix: scroll to location.hash after load (fixes WEB-4)
This commit is contained in:
parent
d80a00e97e
commit
942b48000d
@ -53,6 +53,13 @@ declare const Prism: any;
|
|||||||
API.getBlogPost(id).then((post) => {
|
API.getBlogPost(id).then((post) => {
|
||||||
blogPost.innerHTML = post.content;
|
blogPost.innerHTML = post.content;
|
||||||
UI.updateUI(blogPost);
|
UI.updateUI(blogPost);
|
||||||
|
|
||||||
|
if (location.hash && location.hash !== '#' && location.hash.startsWith('#')) {
|
||||||
|
const element = document.querySelector(location.hash);
|
||||||
|
if (element) {
|
||||||
|
setTimeout(() => element.scrollIntoView(), 1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user