Skip to content

Commit

Permalink
Minor visual fix
Browse files Browse the repository at this point in the history
  • Loading branch information
alanrme committed Jul 8, 2024
1 parent 8cf122f commit 34d8cb4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,19 @@ ready(() => {
// fire when window resized, e.g. when device is turned
window.addEventListener('resize', function(event) {
intro = _('.content').offsetTop; // set top of content

headerYOffset = (window.innerHeight)/10 - parseFloat(getComputedStyle(_("h2")).fontSize) - 5
updateHeaders()
}, true);

document.addEventListener('scroll', () => {
// Update scroll position on scroll
scrollPos = window.scrollY


updateHeaders()
})

function updateHeaders() {
sections.forEach((section, i) => {
const rect = section.getBoundingClientRect()

Expand All @@ -133,7 +138,7 @@ ready(() => {
}
}
})
})
}

// run every 150ms, put most things-that-change-with-scrolling here.
// more efficient than putting them in the scroll event
Expand Down

0 comments on commit 34d8cb4

Please sign in to comment.