11

Possible Duplicate:
jQuery scroll To Element

Basically, I want my user to be instantly scroll down to a specific anchor tag just like they do with a hashtag. However, I can't use a hashtag and therefore want to scroll them down using javascript (preferably jquery).

Any thoughts on how to do this?

4

1 Answer 1

7

This will jump instantly to the element matched by $(selector):

$(document).scrollTop($(selector).offset().top);

If you want a fluid animation:

$(document.body).animate({'scrollTop': $(selector).offset().top}, duration);

Not the answer you're looking for? Browse other questions tagged or ask your own question.