On 6/27/07, Glen Lipka <[EMAIL PROTECTED]> wrote:

I dont understand how scrollTop works.
Look at this demo page. http://www.commadot.com/jquery/dimensions/

Scroll to the bottom and click the box.  Shouldn't it have something in
ScrollTop?


It is the window that has the scroll offset in this case. If you have a div
with overflow auto and scroll it, it will also have a scrollTop.

$(window).scrollTop();

And with 1.0 you can set the scrollTop.

$(window).scrollTop(100);

To illustrate how scrollTop works on an element just go to the visual offset
test page (
http://brandonaaron.net/jquery/plugins/dimensions/test/offset_visual.html)
and run this line of code in firebug.

$('#relative3').scrollTop(100).scrollTop();


I tried $("body").scrollTop() too.  I think this plugin is really powerful
and useful, but the documentation is really small right now.


The examples are lacking but there are inline docs which explain the API. I
am working on finalizing 1.0 and the I will write some better docs with
examples soon. It will take time since this is a pretty powerful plugin. If
anyone would like to help write some docs and/or put together some examples,
it would be much appreciated.

--
Brandon Aaron

Reply via email to