Skip to main content

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.

$("#selector").click(function() {
  $("html, body").animate({
    scrollTop: 0
  }, "slow");
  return false;
});