jQuery Auto Scroll To Top Of Page

By Sam Deering

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

jQuery scroll to top

jQuery(document).ready(function($) {
		$('html, body').animate({scrollTop:0}, 'slow');
		return false;
  • ahmad balavipour

    thanks alot, very good tutorial. i am using this in my website

  • Jana

    thanks, just what I was looking for :-)

  • Naved Ahmed

    thanks …. but I need automattical scroll… :(

  • Hamza

    automaic scoll needed its not :(



Learn Coding Online
Learn Web Development

Start learning web development and design for free with SitePoint Premium!

Get the latest in JavaScript, once a week, for free.