This is a Javascript function written in jQuery that shows and hides a back-to-top button.
To implement into your project, simply create something similar to the following in your HTML file, preferably right before the footer section:
<div id="toTopWrapper">
<a id="toTop" href="#" title="Back to top" style="display: block;"><img src="/images/backtotop4.png" alt="Back to top button"></a>
</div>
You can also substitute SVG instead of images by inserting the SVG code in lieu of the image.