mirror of
https://github.com/Ellpeck/ObsidianJustSharePlease.git
synced 2024-11-23 02:48:34 +01:00
make sure anchors are actually scrolled to once they are loaded
This commit is contained in:
parent
1d83851102
commit
44c706f4a4
1 changed files with 6 additions and 3 deletions
|
@ -63,9 +63,12 @@
|
|||
main.html(DOMPurify.sanitize(md.render(t)));
|
||||
|
||||
// scroll to anchor
|
||||
$(() => {
|
||||
console.log("Loaded!");
|
||||
let element = $(window.location.hash);
|
||||
if (element.length)
|
||||
$(window).scrollTop(element.offset().top);
|
||||
});
|
||||
},
|
||||
error: (r, s, e) => main.html(`<div class="error"><p>Error loading shared note with id <code>${id}</code>: ${e}</p><p><a href="#">Home</a></p></div>`)
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue