Leo Jiang
Leo Jiang

Reputation: 26085

How can I check how much an element was scrolled using jQuery?

Google Reader and Gmail have scrollable divs that has a shadow on top if the div was scrolled. The shadow changes opacity depending on how much the div was scrolled. How can I check how much an element was scrolled using Javascript/jQuery?

Upvotes: 1

Views: 3797

Answers (2)

rfunduk
rfunduk

Reputation: 30442

Use $(el).scrollTop() to find how many pixels from the top an element (including, say, body) has been scrolled.

As @nathanjosiah suggests, check the docs for details.

Upvotes: 1

Related Questions