March 18, 2013

Smooth Page Scroll to Top with jQuery

The scrollTop:0 scrolls to the very top of the page, at 0px position, and the 600 represents the duration of animation in milliseconds. The Higher values indicate slower animations. You can also use ‘fast’, ‘slow’ or ‘normal’ instead of milliseconds.


            $("html, body").animate({ scrollTop: 0 }, 600);
            return false;

No comments:

Post a Comment

Popular Posts