If you need a plain JavaScript function to add a smooth scrolling back to the top of the page, you can use this script.
- Add an id of "top" to the
body
- Add the
onclick
function to the link - Include the JavaScript function in your HTML file, preferrably at the bottom before the closing
</body>
tag if possible. Since this script is not part of the UI it can load last and will not negatively affect the user experience or usability of the page.
Author: Marco Del Corno - http://thewebthought.blogspot.com/2012/06/javascript-smooth-scroll-to-top-of-page.html