first draft

This commit is contained in:
Jay
2026-03-10 23:03:45 +00:00
parent 2d6ae6db8d
commit 0d7904a8de
13 changed files with 1340 additions and 908 deletions

View File

@@ -1,14 +1,24 @@
// https://twitter.com/uixmat
// ─── Scroll reveal ─────────────────────────────────────────
const reveals = document.querySelectorAll('.reveal');
const observer = new IntersectionObserver((entries) => {
entries.forEach(e => {
if (e.isIntersecting) {
e.target.classList.add('visible');
observer.unobserve(e.target);
}
});
}, { threshold: 0.1, rootMargin: '0px 0px -40px 0px' });
reveals.forEach(el => observer.observe(el));
function scrollNav() {
$('.nav a').click(function(){
$(".active").removeClass("active");
$(this).addClass("active");
$('html, body').stop().animate({
scrollTop: $($(this).attr('href')).offset().top - 160
}, 300);
return false;
});
}
scrollNav();
// ─── Active nav link on scroll ──────────────────────────────
const sections = document.querySelectorAll('section[id]');
const navLinks = document.querySelectorAll('.nav-links a');
window.addEventListener('scroll', () => {
let current = '';
sections.forEach(s => {
if (window.scrollY >= s.offsetTop - 120) current = s.id;
});
navLinks.forEach(a => {
a.style.color = a.getAttribute('href') === `#${current}` ? 'var(--mauve)' : '';
});
});