Created
December 30, 2019 11:30
-
-
Save uurtech/8f042180e7884d5bf1faf885b5044994 to your computer and use it in GitHub Desktop.
Scroll Check by time.
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
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