tags:

views:

223

answers:

2

when a link is at the bottom of the browser window and user click it to show some content, I would like the browser to scroll down so that the shown content is located at the top of the window to be visible. how to do this in jquery?

A: 

you could try the jQuery scrollto plugin

Jon Erickson
+1  A: 

You can use plain javascript to do this.

Use scrolIntoView function.

rahul
thanks. any idea on how to add a sliding effect when scroll?
perlwle
You can use slideToggle.
rahul
sorry if i wasn't clear. I meant that scrollIntoView goes to the position instantly. but I would like to create a sliding effect for the scrolling.
perlwle
For that you can use the scrollto plugin suggested by @Jon, or use animate function in jquery.
rahul