diff options
Diffstat (limited to 'live/static/scripts/return_top.js')
-rw-r--r-- | live/static/scripts/return_top.js | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/live/static/scripts/return_top.js b/live/static/scripts/return_top.js deleted file mode 100644 index 77c468f..0000000 --- a/live/static/scripts/return_top.js +++ /dev/null @@ -1,21 +0,0 @@ -// Taken from https://www.w3schools.com/howto/howto_js_scroll_to_top.asp -// and tweaked as needed -document.addEventListener("DOMContentLoaded", function(event) { - let returnTopButton = document.getElementById("returnTopButton"); - let scrollTopAppearPX = window.screen.availHeight; - - window.onscroll = function() {scrolling(returnTopButton, scrollTopAppearPX)}; -}) - -function scrolling(returnButton, onScrollAppear) { - if (document.body.scrollTop > onScrollAppear || document.documentElement.scrollTop > onScrollAppear) { - returnButton.style.display = "inline-block"; - } else { - returnButton.style.display = "none"; - } -} - -function returnTop() { - document.body.scrollTop = 0; // For Safari - document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera -} |