Revert "Improve navigation scrolling to show full content"
This reverts commit a7ea82ff19.
This commit is contained in:
@@ -10,9 +10,6 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
function setupNavigationHighlight() {
|
||||
const sections = document.querySelectorAll('.scroll_section');
|
||||
const navOptions = document.querySelectorAll('.nav_option');
|
||||
const header = document.querySelector('header');
|
||||
const headerHeight = header ? header.offsetHeight : 0;
|
||||
|
||||
const observer = new IntersectionObserver((entries) => {
|
||||
entries.forEach(entry => {
|
||||
if (entry.isIntersecting) {
|
||||
@@ -24,17 +21,13 @@ function setupNavigationHighlight() {
|
||||
}
|
||||
});
|
||||
}, {
|
||||
threshold: 0.7,
|
||||
rootMargin: `-${headerHeight}px 0px -40% 0px`
|
||||
threshold: 0.5
|
||||
});
|
||||
|
||||
sections.forEach(section => observer.observe(section));
|
||||
}
|
||||
|
||||
function setupNavigationClicks() {
|
||||
const header = document.querySelector('header');
|
||||
const headerHeight = header ? header.offsetHeight : 0;
|
||||
|
||||
document.querySelectorAll('.nav_option').forEach(link => {
|
||||
link.addEventListener('click', (event) => {
|
||||
event.preventDefault();
|
||||
@@ -42,9 +35,7 @@ function setupNavigationClicks() {
|
||||
const targetId = link.getAttribute('href');
|
||||
const targetSection = document.querySelector(targetId);
|
||||
if (targetSection) {
|
||||
const targetPosition = targetSection.getBoundingClientRect().top + window.pageYOffset - headerHeight;
|
||||
window.scrollTo({
|
||||
top: targetPosition,
|
||||
targetSection.scrollIntoView({
|
||||
behavior: 'smooth'
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user