javascript scroll back to the top
how can I get this scroll back to the top neat thing from this link , just scroll down a bit, you'll see in t开发者_JS百科he bottom right icon(top pointer) that scrolls back to the top on click. Thank you
In jQuery:
$(document).ready(function() {
$('a[href=#top]').click(function(){
$('html, body').animate({scrollTop:0}, 'slow');
return false;
});
});
You can then make links like this:
<a href="#top" title="Scroll back to the top">Back to the top</a>
You can find the script here: http://www.javascriptkit.com/jkincludes/scrolltopcontrol.js
Although you need to use jquery for this script to work.
精彩评论