Update variables name

This commit is contained in:
TheThomaas 2025-06-03 20:32:52 +02:00
parent 1d0d83b24e
commit 513a975459

View file

@ -8,17 +8,17 @@ const intercept = document.createElement("div");
intercept.setAttribute("data-observer-intercept", ""); intercept.setAttribute("data-observer-intercept", "");
header.before(intercept); header.before(intercept);
const observer2 = new IntersectionObserver(([entry]) => { const observer = new IntersectionObserver(([entry]) => {
header.classList.toggle("scroll", !entry.isIntersecting); header.classList.toggle("scroll", !entry.isIntersecting);
}); });
observer2.observe(intercept); observer.observe(intercept);
// Update navigation according to page scroll // Update navigation according to page scroll
const options = { const options = {
rootMargin: '0px 0px -60% 0px' rootMargin: '0px 0px -60% 0px'
}; };
const observer = new IntersectionObserver(entries => { const sectionObserver = new IntersectionObserver(entries => {
entries.forEach(entry => { entries.forEach(entry => {
const id = entry.target.getAttribute("id"); const id = entry.target.getAttribute("id");
if (entry.isIntersecting) { if (entry.isIntersecting) {
@ -34,7 +34,7 @@ const observer = new IntersectionObserver(entries => {
},options); },options);
document.querySelectorAll('section').forEach(function(section, i) { document.querySelectorAll('section').forEach(function(section, i) {
observer.observe(section); sectionObserver.observe(section);
}); });
// Random accent font & color // Random accent font & color