below is our code for the scroll to top:
$(document).ready(function(){
var offset = 220;
$(window).scroll(function() {
if ($(this).scrollTop() > offset) {
$('a#backtop').show();
} else {
$('a#backtop').hide();
}
});
$('a#backtop').click(function(event) {
event.preventDefault();
$('html, body').animate({scrollTop: 0}, 500);
return false;
});
});