From 5fc8f50d909a89f7806853fda57ca54477e83c4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20D=C3=B6rk?= Date: Thu, 14 Dec 2023 19:37:47 +0100 Subject: [PATCH] this way update is called twice: once via the scroll event and another time via animation() --- js/scrolling.js | 9 ++++----- style.css | 1 + 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/js/scrolling.js b/js/scrolling.js index 97be9df..bd79144 100644 --- a/js/scrolling.js +++ b/js/scrolling.js @@ -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) { @@ -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) } diff --git a/style.css b/style.css index 257a381..37ee089 100644 --- a/style.css +++ b/style.css @@ -153,6 +153,7 @@ p { padding: 1em 1.5em; pointer-events: all; z-index: 1; + will-change: top; } .cursor--shadow { visibility: hidden;