Skip to content

Commit

Permalink
Add ids to footnote reference buttons for anchoring
Browse files Browse the repository at this point in the history
  • Loading branch information
DeclanChidlow committed Feb 12, 2025
1 parent 5c2fc93 commit 779cb2c
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/assets/scripts/footnotes.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,6 @@ class FootnotesSidenotes {
}

setupReference(reference, index) {
if (!reference.id) {
reference.id = `footnote-ref-${index}`;
}

const footnoteId = reference.getAttribute("href").substring(1);
const footnoteContent = document.getElementById(footnoteId).innerHTML;
const sidenote = document.createElement("div");
Expand All @@ -84,6 +80,7 @@ class FootnotesSidenotes {

const button = document.createElement("button");
button.className = "footnote-button";
button.id = `footnote-ref-${index + 1}`;
button.innerHTML = reference.innerHTML;
const popover = this.createPopover(footnoteContent, index);
document.body.appendChild(popover);
Expand Down

0 comments on commit 779cb2c

Please sign in to comment.