Skip to content

Smooth scrolling to top of page

Last updated on January 17, 2018

When the size of web page increases, it’s better to have a button to scroll to the top of the page with a single click.

How to add Smooth scrolling:

Blow simple js script will allow your visitors to smooth scroll to the top of the page simply by clicking a link (with #top) located at the bottom of your page.

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

That’s it.

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments