Skip to content

Instantly share code, notes, and snippets.

@estrattonbailey
Created October 16, 2018 15:45
Show Gist options
  • Save estrattonbailey/3d159ff5bbac277edf7fed31f6f3c2ed to your computer and use it in GitHub Desktop.
Save estrattonbailey/3d159ff5bbac277edf7fed31f6f3c2ed to your computer and use it in GitHub Desktop.
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