Commit 25f9d7ea authored by Wolfgang's avatar Wolfgang

pb-view: scroll to target element if an id is given in the URLs hash

parent d9501fc4
......@@ -465,6 +465,7 @@
this.animate();
this._scroll();
this.next = resp.next;
this.previous = resp.previous;
......@@ -538,6 +539,16 @@
}
}
_scroll() {
const hash = this.getUrl().hash;
if (hash) {
const target = this.shadowRoot.getElementById(hash.substring(1));
if (target) {
target.scrollIntoView({block: "center", inline: "nearest"});
}
}
}
_initFootnotes(content) {
content.querySelectorAll('.note, .fn-back').forEach(elem => {
elem.addEventListener('click', (ev) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment