ricardozea
7/6/2018 - 4:46 PM

[jQuery] Smooth scroll to top of page

Just add this small script into your main JavaScript file.

//**SCROLL TO TOP
$("footer").append("<hr><a href='#' class='scroll-up'>Back to Top &uarr;</a>");

$(".scroll-up").on("click", function(e) {
	e.preventDefault();
  $("html, body").animate({ scrollTop: 0 }, 720); //the last value is the speed
});