$(document).ready(function() { $('a[href=#top]').click(function(){ $('html, body').animate({scrollTop:0}, 'slow'); return false; }); });

(Source: togetherwestand)

This is usually how I feel when I cry and freak out about something and it turns out to be not so bad after all.