Code:
<script type="text/javascript"> $(document).ready(function() { $('.link_top').click(function() { $('html').animate({scrollTop: 0}, 600); }); }); </script>
HTML Code:
<p class="text anchor-top"><a href="javascript:void" class="link_top">↑</a></p>
It's as simple as that. Hope this helps.
Some other tutorials which are similar to this:
How to get the width of the HTML document/web page window using JavaScript? (using jQuery library)