Simplified spacing and anchor handling.

This commit is contained in:
Bob Vandevliet 2025-12-17 20:06:06 +01:00
parent bd84cc5c29
commit 38bde95c5b
4 changed files with 20 additions and 32 deletions

View file

@ -31,14 +31,13 @@ document.addEventListener('DOMContentLoaded', () =>
/**
* @type {NodeListOf<HTMLElement>}
*/
const sections = document.querySelectorAll('section');
const sectionsWithId = document.querySelectorAll('section[id]');
sections.forEach(section =>
sectionsWithId.forEach(anchorTarget =>
{
const anchorTarget = section.querySelector('[id]');
const anchorHeader = section.querySelector('h1,h2');
const anchorHeader = anchorTarget.querySelector('h1,h2');
if (anchorTarget && anchorHeader)
if (anchorHeader)
{
const anchorLink = document.createElement('a');
anchorLink.className = 'anchor-link';

View file

@ -89,12 +89,8 @@ $ff-subheader: 'Eras ITC',
var(--#{$prefix}font-sans-serif);
main {
@extend .pb-4;
padding-top: 7rem !important;
}
body.has-hero main {
@extend .pt-3;
@extend .pb-4;
}
section,
@ -108,12 +104,8 @@ main>* {
background-color: $red-200;
}
:target::before {
content: "";
display: block;
height: 6rem;
margin-top: -6rem;
visibility: hidden;
:target {
scroll-margin-top: 4.5rem;
}
.anchor-link {