Skip to content

Commit

Permalink
this way update is called twice: once via the scroll event and anothe…
Browse files Browse the repository at this point in the history
…r time via animation()
  • Loading branch information
nrchtct committed Dec 14, 2023
1 parent 6f84dc1 commit 5fc8f50
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
9 changes: 4 additions & 5 deletions js/scrolling.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//put the update in an animation frame loop
document.addEventListener('scroll', (e) => {
e.preventDefault()
update()
})
// document.addEventListener('scroll', (e) => {
// e.preventDefault()
// update()
// })
let lastScrollY = null;
let visibleCursors = [];
function updateCursor(currentSession,currentProgress) {
Expand All @@ -14,7 +14,6 @@ function updateCursor(currentSession,currentProgress) {
(currentProgress * currentSession.height) - //add the progress of the current session
(currentProgress * (currentSession.index == 0 ? window.innerHeight/2: window.innerHeight)) - //subtract the progress of the window
(cursorDimensions.height / 2) //subtract half the height of the cursor

cursor.attr('style', `top:${cursorPosition}px;`)
return updateLinks(currentSession,currentProgress,cursorDimensions)
}
Expand Down
1 change: 1 addition & 0 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ p {
padding: 1em 1.5em;
pointer-events: all;
z-index: 1;
will-change: top;
}
.cursor--shadow {
visibility: hidden;
Expand Down

0 comments on commit 5fc8f50

Please sign in to comment.