Something like this? It creates a timeout everytime you scroll the page and erases the old timeout. If you scroll again within 300ms, nothing happens, but if you don't, the callback function gets called and increments the value.
HTML Code:
<!DOCTYPE html>
<html>
<head>
<style>
#content {
background-color : #ff0;
height : 2000px;
margin : auto;
width : 640px;
}
#counter {
background-color : #090;
padding : 20px;
position : fixed;
}
</style>
<script>
var count = 0,
timeOut;
window.onscroll = function() {
clearTimeout( timeOut );
timeOut = setTimeout( function() {
document.getElementById( "counter" ).childNodes[ 0 ].nodeValue = count++;
}, 300 );
}
</script>
<title>Scrollstop</title>
</head>
<body>
<span id = "counter">0</span>
<div id = "content"></div>
</body>
</html>
Bookmarks