<div id="page">
 
<h3>Top</h3>
  
*<br>*<br>*<br>*<br>*<br>*<br>*<br>*<br>
*<br>*<br>*<br>*<br>*<br>*<br>*<br>*<br>
*<br>*<br>*<br>*<br>*<br>*<br>*<br>*<br>
*<br>*<br>*<br>*<br>*<br>*<br>*<br>*<br>
*<br>*<br>*<br>*<br>*<br>*<br>*<br>*<br>
  
<button id="to-top">Scroll To Top</button>
  
</div>
jQuery("#to-top").click(function (){
		jQuery('html, body').animate({
			scrollTop: jQuery('#page').offset().top
		}, 1200);						   
});

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js