Javascript (preferably Jquery) that will mimic behavior of hashtags
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?
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);
链接地址: http://www.djcxy.com/p/23090.html
上一篇: 我怎样才能移动到<名称标签缓慢?