"footnotes" -> ".footnotes"; use idFromHash()
This commit is contained in:
parent
76dd3abff2
commit
5bbda2a68e
|
@ -152,10 +152,10 @@
|
||||||
document.addEventListener("click", (ev) =>
|
document.addEventListener("click", (ev) =>
|
||||||
{
|
{
|
||||||
if (!(ev.target && ev.target instanceof HTMLAnchorElement)) return;
|
if (!(ev.target && ev.target instanceof HTMLAnchorElement)) return;
|
||||||
if (!ev.target.matches(".footnotes .reversefootnote, .footnotes .footnoteBackLink, footnotes .footnote-return")) return;
|
if (!ev.target.matches(".footnotes .reversefootnote, .footnotes .footnoteBackLink, .footnotes .footnote-return")) return;
|
||||||
const hash = ev.target.hash;
|
const id = idFromHash(ev.target);
|
||||||
if (!hash) return;
|
if (!id) return;
|
||||||
const fnref = document.getElementById(hash.substring(1));
|
const fnref = document.getElementById(id);
|
||||||
|
|
||||||
window.scrollTo({ top: fnref.getBoundingClientRect().top + window.scrollY });
|
window.scrollTo({ top: fnref.getBoundingClientRect().top + window.scrollY });
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
|
|
Loading…
Reference in New Issue