diff --git a/app.js b/app.js index 8375867..2b6a31a 100644 --- a/app.js +++ b/app.js @@ -80,5 +80,22 @@ $(document).ready(function () { .find(".hint") .removeClass("hint-reveal"); }); + + // Move back to top upon clicking the up arrow + $("#back-to-top").on("click", function() { + $('html, body').animate({scrollTop: 0}); + $("#back-to-top").css("right", "-100px"); -}); \ No newline at end of file + }); + + // Displays the back to top icon when scrolling down + $(window).on("scroll", function() { + if ($(window).scrollTop() > 10) { + $("#back-to-top").css("right", "10px"); + } else { + $("#back-to-top").css("right", "-100px"); + } + }); + + +}); diff --git a/index.html b/index.html index 5b1e12b..5847114 100644 --- a/index.html +++ b/index.html @@ -53,6 +53,9 @@

A listing of songs depicted through emojis. 💖

+
+ +