Skip to content

Instantly share code, notes, and snippets.

@uurtech
Created December 30, 2019 11:30
Show Gist options
  • Save uurtech/8f042180e7884d5bf1faf885b5044994 to your computer and use it in GitHub Desktop.
Save uurtech/8f042180e7884d5bf1faf885b5044994 to your computer and use it in GitHub Desktop.
Scroll Check by time.
let tempTimeStamp = 0;
window.addEventListener('scroll', function (event) {
if(((event["timeStamp"] - tempTimeStamp) / 1000) < 5){ //how many seconds you rely on.
tempTimeStamp = event["timeStamp"];
}else{
console.log(( event["timeStamp"] - tempTimeStamp) / 1000)
tempTimeStamp = event["timeStamp"];
//use withinviewport in here.
}
}, false);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment