Smooth Scrolling Links to the Top of the Page

Here’s a useful snippet of reusable code to use jQuery to smoothly scroll to the top of the page. I first wrote it in response to a question on Stack Overflow. It finds any anchor with href equal to #top.

$("a[href=’#top’]").click(function(e) {
$("html").animate({ scrollTop: 0 }, "slow");


Mark Ursino

Mark is Sr. Director at Rightpoint and a Sitecore MVP.


Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.