Variable Visions

Published Thu. Jan. 01, 1970

JQuery animated Scroll to Top link

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.

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>


Published Tue. Jul. 31, 2012

Keywords: jQuery, scrollop, anchor tags