levkin.ca/spec/spec.js
ilia b9a601894d Add levkin.ca design concepts (Spec, Slab, Relay, Vault).
Four static landing-page options with Vite build, cal booking, and links to sibling sites.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-20 22:34:48 -04:00

18 lines
578 B
JavaScript

const sections = document.querySelectorAll('section[id]');
const links = document.querySelectorAll('.toc nav a');
const observer = new IntersectionObserver(
(entries) => {
entries.forEach((entry) => {
if (!entry.isIntersecting) return;
links.forEach((a) => {
a.style.fontWeight = a.getAttribute('href') === `#${entry.target.id}` ? '600' : '';
a.style.color = a.getAttribute('href') === `#${entry.target.id}` ? 'var(--accent)' : '';
});
});
},
{ rootMargin: '-30% 0px -60% 0px' }
);
sections.forEach((s) => observer.observe(s));