Return to Snippet

Revision: 47074
at May 31, 2011 22:28 by griffpup


Initial Code
It only follows that elements with scrollbars in positions other than the top would have a scrollTop of > 0. If you have an element without scrollbars then one would expect that their scrollTop position IS 0 as they have nowhere to scroll to.

I'm not exactly sure what the problem is.

EDIT: Just in case that it is not explained properly in the jQuery docs:

scrollTop() => position of scrollbar for element (window/div/anything scrollable)

$("#element").offset().top => position of element relative to page

$("#element").offset().top - $(window).scrollTop() => position of element relative to scrolled area.

Initial URL


Initial Description


Initial Title
jquery scrolling

Initial Tags
textmate, jquery

Initial Language
Other