Created
October 16, 2018 15:45
-
-
Save estrattonbailey/3d159ff5bbac277edf7fed31f6f3c2ed to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function roop (c, a) { | |
function cycle (t) { | |
c() && a(t) | |
return requestAnimationFrame(cycle) | |
} | |
return cycle(performance.now()) | |
} | |
let y = window.pageYOffset | |
roop(() => { | |
const change = window.pageYOffset !== y | |
y = window.pageYOffset | |
return change | |
}, () => { | |
console.log('is scrolling') | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment