/ Published in: jQuery
Easy "back to top" scroll link
Expand |
Embed | Plain Text
HTML: <a href="#" class="backToTop">Back to top</a> jQuery: $(document).ready(function(){ $('a.backToTop').click(function(){ $('html, body').animate({scrollTop: '0px'}, 300); event.preventDefault(); }); });
Comments
Subscribe to comments
You need to login to post a comment.

Use event.preventDefault() instead of return false and you are okay.
http://api.jquery.com/event.preventDefault/
Thanks gabrielizaias. That's some good advise! Fixed