Return to Snippet

Revision: 28008
at June 29, 2010 08:04 by Nettuts


Initial Code
$('#someAnchor').click(function() {
	$('html, body').animate({ scrollTop:0 }, 'fast');
	return false;
});

Initial URL


Initial Description
This is a simple way to scroll to the top of the page, when an anchor tag has been clicked. Note that we must "return false," in order to disable the default browser action.

Initial Title
Scroll to Top of Page with jQuery

Initial Tags
javascript, jquery

Initial Language
jQuery