Scroll to Top of Page with jQuery

$('#someAnchor').click(function() { $('html, body').animate({ scrollTop:0 }, 'fast'); return false; });
Simple way to scroll to the top of the page, when an anchor tag has been clicked.

Note that we must "return false," in order to disable the default browser action.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.