JavaScript
Article
By Sam Deering

jQuery Auto Scroll To Top Of Page

By Sam Deering

jquery-sail-on-up-top-of-page
You can use jQuery to automate a slow scroll to the top of your webpage by using a simple code snippet below. Why?

  1. It saves the user time scrolling to the top if your page is long
  2. It looks cool.

See Live Demo

--ADVERTISEMENT--

jQuery scroll to top

jQuery(document).ready(function($) {
	$('a[href=#topbar]').click(function(){
		$('html, body').animate({scrollTop:0}, 'slow');
		return false;
	});
});
Recommended
Sponsors
The most important and interesting stories in tech. Straight to your inbox, daily. Get Versioning.
Login or Create Account to Comment
Login Create Account