HTML named anchors can be used to jump to a specific part of the webpage (usually top) upon clicking on “Go to Top” kind of links on a long web page.
If you would like the jump to happen in a smoother way than sharply, do the following:
-
Go to My Theme -> Settings -> List any JavaScript or other code to be manually inserted in the site’s footer just above the </body> tag in the input below.
Paste the following:
<script type="text/javascript">jQuery(document).ready(function() { jQuery('a.scrollToTop').click(function() { jQuery('html, body').animate({scrollTop:0}, 'slow'); return false; }); }); </script> - Add HTML similar to the following wherever you want to place the “Go to Top” link:
<a href="#" class="scrollToTop">Go to Top</a>
That’s it!
