Rebuild portfolio with industrial ByteGeist layout and verified backups
ci/woodpecker/push/woodpecker Pipeline failed
ci/woodpecker/push/woodpecker Pipeline failed
This commit is contained in:
1 parent
422dc6f20f
commit
d665cabd44
54 files changed
+3992
-374
No files matched your search
@@ -0,0 +1,38 @@
|
||||
// Navigation progressively enhances normal links; content works without JavaScript.
|
||||
(() => {
|
||||
const toggle = document.querySelector('.nav-toggle');
|
||||
const nav = document.querySelector('.site-nav');
|
||||
const closeMenu = () => {
|
||||
nav?.classList.remove('open');
|
||||
toggle?.setAttribute('aria-expanded', 'false');
|
||||
};
|
||||
toggle?.addEventListener('click', () => {
|
||||
const open = nav.classList.toggle('open');
|
||||
toggle.setAttribute('aria-expanded', String(open));
|
||||
});
|
||||
nav?.addEventListener('click', event => {
|
||||
if (event.target.closest('a')) closeMenu();
|
||||
});
|
||||
document.addEventListener('keydown', event => {
|
||||
if (event.key === 'Escape' && nav?.classList.contains('open')) {
|
||||
closeMenu();
|
||||
toggle.focus();
|
||||
}
|
||||
});
|
||||
if ('IntersectionObserver' in window) {
|
||||
const observer = new IntersectionObserver(entries => {
|
||||
const visible = entries.filter(entry => entry.isIntersecting);
|
||||
if (!visible.length) return;
|
||||
const id = visible[0].target.id;
|
||||
nav?.querySelectorAll('a[href^="#"]').forEach(link => {
|
||||
const active = link.getAttribute('href') === `#${id}`;
|
||||
link.classList.toggle('active', active);
|
||||
if (active) link.setAttribute('aria-current', 'location');
|
||||
else link.removeAttribute('aria-current');
|
||||
});
|
||||
}, { rootMargin: '-10% 0px -55% 0px', threshold: 0 });
|
||||
document.querySelectorAll('main section[id]').forEach(section => observer.observe(section));
|
||||
}
|
||||
const year = document.getElementById('year');
|
||||
if (year) year.textContent = new Date().getFullYear();
|
||||
})();
|
||||
Reference in new issue
Block a user