Last active
July 6, 2018 16:51
-
-
Save ricardozea/1e76562fbeb30f8b2619df80b2bc1f26 to your computer and use it in GitHub Desktop.
Just add this small script into your main JavaScript file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//**SCROLL TO TOP | |
$("footer").append("<hr><a href='#' class='scroll-up'>Back to Top ↑</a>"); | |
$(".scroll-up").on("click", function(e) { | |
e.preventDefault(); | |
$("html, body").animate({ scrollTop: 0 }, 720); //the last value is the speed | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment