Revert "Improve navigation scrolling to show full content"

This reverts commit a7ea82ff19.
This commit is contained in:
douwe
2026-09-25 11:31:39 +02:00
parent a7ea82ff19
commit 5c20a6b747
2 changed files with 2 additions and 13 deletions
-2
View File
@@ -67,7 +67,6 @@ footer > div > p {
.scroll_container { .scroll_container {
overflow-y: auto; overflow-y: auto;
scroll-snap-type: y mandatory; scroll-snap-type: y mandatory;
scroll-padding-top: 100px;
} }
.scroll_section { .scroll_section {
@@ -76,7 +75,6 @@ footer > div > p {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
scroll-margin-top: 100px;
} }
.scroll_section > h1 { .scroll_section > h1 {
+2 -11
View File
@@ -10,9 +10,6 @@ document.addEventListener('DOMContentLoaded', () => {
function setupNavigationHighlight() { function setupNavigationHighlight() {
const sections = document.querySelectorAll('.scroll_section'); const sections = document.querySelectorAll('.scroll_section');
const navOptions = document.querySelectorAll('.nav_option'); const navOptions = document.querySelectorAll('.nav_option');
const header = document.querySelector('header');
const headerHeight = header ? header.offsetHeight : 0;
const observer = new IntersectionObserver((entries) => { const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => { entries.forEach(entry => {
if (entry.isIntersecting) { if (entry.isIntersecting) {
@@ -24,17 +21,13 @@ function setupNavigationHighlight() {
} }
}); });
}, { }, {
threshold: 0.7, threshold: 0.5
rootMargin: `-${headerHeight}px 0px -40% 0px`
}); });
sections.forEach(section => observer.observe(section)); sections.forEach(section => observer.observe(section));
} }
function setupNavigationClicks() { function setupNavigationClicks() {
const header = document.querySelector('header');
const headerHeight = header ? header.offsetHeight : 0;
document.querySelectorAll('.nav_option').forEach(link => { document.querySelectorAll('.nav_option').forEach(link => {
link.addEventListener('click', (event) => { link.addEventListener('click', (event) => {
event.preventDefault(); event.preventDefault();
@@ -42,9 +35,7 @@ function setupNavigationClicks() {
const targetId = link.getAttribute('href'); const targetId = link.getAttribute('href');
const targetSection = document.querySelector(targetId); const targetSection = document.querySelector(targetId);
if (targetSection) { if (targetSection) {
const targetPosition = targetSection.getBoundingClientRect().top + window.pageYOffset - headerHeight; targetSection.scrollIntoView({
window.scrollTo({
top: targetPosition,
behavior: 'smooth' behavior: 'smooth'
}); });
} }