When the user performs a certain action I want to bring them further down the page. Kind of like how an a-name link works. Except obviously it needs to happen without any additional parameters being added to the u开发者_如何学JAVArl or refreshing the page.
So what would be the jQuery way of doing this:
<a href="#person">Click Me</a>
<a name='person'>Tommy</a>
EDIT
a nice slide down effect to bring the user down the page would be nice too.
Have a look at the ScrollTo plugin for jQuery. It does what you want and supports animations as well. So you could just do:
<a id="person">Tommy</a>
and use the plugin like this:
$.scrollTo($('#person'));
Alternatively, if you don't want any fancy stuff, you could do this by yourself in a couple of lines:
var offset = $('#person').offset();
window.scrollTo(offset.left, offset.top);
http://plugins.jquery.com/project/ScrollTo
精彩评论