Revert "Consistent linking, less confusing, partial revert of 0e82abef."
This reverts commit 8a2835a13e.
This commit is contained in:
parent
adfd9bb4b7
commit
c187f29e4b
1 changed files with 11 additions and 0 deletions
|
|
@ -44,6 +44,17 @@ document.addEventListener('DOMContentLoaded', () =>
|
||||||
// Update nav links and add anchor links to section headers.
|
// Update nav links and add anchor links to section headers.
|
||||||
sectionsWithId.forEach(anchorTarget =>
|
sectionsWithId.forEach(anchorTarget =>
|
||||||
{
|
{
|
||||||
|
// Navigate within current page if a section for the anchor exists.
|
||||||
|
navLinks.forEach(navLink =>
|
||||||
|
{
|
||||||
|
const href = navLink.getAttribute('href');
|
||||||
|
|
||||||
|
if (href.startsWith('/#') && href.substring(2) === anchorTarget.id)
|
||||||
|
{
|
||||||
|
navLink.setAttribute('href', href.substring(1));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {HTMLHeadingElement|null}
|
* @type {HTMLHeadingElement|null}
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue