(jQuery) Scroll event.. I want to scroll the document to the point specified if the user scroll the page?

The scrollTop property only accepts an integer (not pixels). Omit the px and it should be fine.

The scrollTop property only accepts an integer (not pixels). Omit the px and it should be fine. $(window).

Scroll(function() { $('body'). Get(0). ScrollTop = 3000; // note that this does only work if body has overflow // if it hasn't, use window instead }).

Also. Is there a way to know if the user scrolled north / south? – Keira Nighly May 1 '09 at 19:10 2 $('body') returns a jQuery object; get(0) gives you access to the corresponding node (within the DOM) - this enables you to access DOM properties like 'scrollTop' – 999 May 1 '09 at 19:42.

There is a plugin for JQuery called ScrollTo that might do exactly what you need. Check it out here: plugins.jquery.com/project/ScrollTo.

Yes, I know that.. I want to write my own function so that I could learn.. – Keira Nighly May 1 '09 at 19:07 1 Read the code then! – altCognito May 1 '09 at 19:08 1 Yes, I tried to read the code but I didn't understand any of it.. I'm still new to this programming thing – Keira Nighly May 1 '09 at 19:10.

Related Questions