summaryrefslogtreecommitdiff
path: root/tests/make_png/html/scripts/top.js
diff options
context:
space:
mode:
Diffstat (limited to 'tests/make_png/html/scripts/top.js')
-rw-r--r--tests/make_png/html/scripts/top.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/make_png/html/scripts/top.js b/tests/make_png/html/scripts/top.js
index b3fabf8c0..e77372e4f 100644
--- a/tests/make_png/html/scripts/top.js
+++ b/tests/make_png/html/scripts/top.js
@@ -92,3 +92,18 @@ function class_one_four(){
div.className = 'animation one_four';
}
+// When the user scrolls down 20px from the top of the document, show the button
+window.onscroll = function() {scrollFunction()};
+
+function scrollFunction() {
+ if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
+ document.getElementById("myBtn").style.display = "block";
+ } else {
+ document.getElementById("myBtn").style.display = "none";
+ }
+}
+// When the user clicks on the button, scroll to the top of the document
+function topFunction() {
+ document.body.scrollTop = 0;
+ document.documentElement.scrollTop = 0;
+}