Scroll to Top of Page with jQuery


/ Published in: jQuery
Save to your folder(s)

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.


Copy this code and paste it in your HTML
  1. $('#someAnchor').click(function() {
  2. $('html, body').animate({ scrollTop:0 }, 'fast');
  3. return false;
  4. });

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.