Restructure to classic static-site layout, add project-card component, fix bugs
- Move wwwroot/ to public/ with assets/ grouping (css, js, img, fonts, vid) - Inline section includes into index.html, drop runtime fetch loading - Add project-card web component to replace repeated project markup - Fix IntersectionObserver options placement bug in nav highlight - Fix @font-face syntax, invalid 5-digit hex colors, 75x border-radius typo - Remove dead css link (home.css), unused purple/orange color vars - Fix typos, replace inline styles with classes, serve favicon
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
setupNavigationHighlight();
|
||||
setupNavigationClicks();
|
||||
setupCopyright();
|
||||
});
|
||||
|
||||
function setupNavigationHighlight() {
|
||||
const sections = document.querySelectorAll('.scroll_section');
|
||||
const navOptions = document.querySelectorAll('.nav_option');
|
||||
const observer = new IntersectionObserver((entries) => {
|
||||
entries.forEach(entry => {
|
||||
if (entry.isIntersecting) {
|
||||
const sectionId = entry.target.id;
|
||||
window.history.replaceState(null, null, `#${sectionId}`);
|
||||
navOptions.forEach(link => {
|
||||
link.classList.toggle('active', link.getAttribute('href') === `#${sectionId}`);
|
||||
});
|
||||
}
|
||||
});
|
||||
}, {
|
||||
threshold: 0.5
|
||||
});
|
||||
|
||||
sections.forEach(section => observer.observe(section));
|
||||
}
|
||||
|
||||
function setupNavigationClicks() {
|
||||
document.querySelectorAll('.nav_option').forEach(link => {
|
||||
link.addEventListener('click', (event) => {
|
||||
event.preventDefault();
|
||||
|
||||
const targetId = link.getAttribute('href');
|
||||
const targetSection = document.querySelector(targetId);
|
||||
if (targetSection) {
|
||||
targetSection.scrollIntoView({
|
||||
behavior: 'smooth'
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function setupCopyright() {
|
||||
document.getElementById('copyright').textContent = `© ${new Date().getFullYear()} - douwco.be`;
|
||||
}
|
||||
Reference in New Issue
Block a user