Posted By

vagrantradio on 10/08/10


Tagged

scroll


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

jplr
Astraion
Plotarius
dubogii


jQuery Easy Page Scroll


 / Published in: jQuery
 

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.

  1. $('#someAnchor').click(function() {
  2. $('html, body').animate({ scrollTop:0 }, 'fast');
  3. return false;
  4. });

Report this snippet  

You need to login to post a comment.