Variable Visions

Articles jQuery JQuery-animated-Scroll-to-Top-link


tutorials - jQuery and Web-Development.

JQuery animated Scroll to Top link

Published Tue. Jul. 31, 2012


This jQuery function converts the #jump anchor tag to a link that scrolls back to the top of the html body in two seconds with easing.

jQuery

jQuery('a[href=#jump]').click(function(){
        jQuery('html, body').animate({scrollTop:0}, 2000);
        return false;
        });


HTML

<a href="#jump">BACK TO TOP</a>



Tag(s): jQuery, scrollop, anchor tags