gadlol gadlol - 4 months ago 6x
Javascript Question

How to get the number of pixels a user has scrolled down the page?

Suppose we have a html page with large height.So there will be a vertical scrollbar.

As the user scrolls down I want to know how much he has scrolled using javascript (jquery) I suppose... Is this possible?


You can do this using .scroll() and .scrollTop().

 $(window).scroll(function() {
     // use the value from $(window).scrollTop(); 

See also this question.