1//To detect how much the user has scrolled the page vertically in terms of pixels
2//from the very top, in JavaScript, we would probe either window.pageYOffset,
3//or in older versions of IE, one of several variants of document.body.scrollTop,
4//whichever property is supported:
5var scrollTop = window.pageYOffset || (document.documentElement || document.body.parentNode || document.body).scrollTop
6
7//Using jQuery instead, the equivalent would be:
8var scrollTop = $(window).scrollTop() //Best