diff options
author | Kushal K S V S <kkushal32@gmail.com> | 2017-08-27 13:26:40 -0700 |
---|---|---|
committer | Kushal K S V S <kkushal32@gmail.com> | 2018-03-18 20:40:45 +0530 |
commit | fbaf7095106c4103fcc25686ce4bfb784df8d1e6 (patch) | |
tree | 46e0a8ef920307094a20de930a003be0d894c4bc | |
parent | 13d3b701f0a4c8d9a21ecdad970a62748e098521 (diff) | |
download | freetype2-fbaf7095106c4103fcc25686ce4bfb784df8d1e6.tar.gz |
Add Go to top button
-rw-r--r-- | tests/make_png/bitmap.c | 1 | ||||
-rw-r--r-- | tests/make_png/html/scripts/top.js | 15 | ||||
-rw-r--r-- | tests/make_png/html/styles/top.css | 13 |
3 files changed, 29 insertions, 0 deletions
diff --git a/tests/make_png/bitmap.c b/tests/make_png/bitmap.c index 5fa1f2bb3..8158af74c 100644 --- a/tests/make_png/bitmap.c +++ b/tests/make_png/bitmap.c @@ -663,6 +663,7 @@ void Print_Head( FILE* fp ){ <link href=\"../../../../../styles/top.css\" rel=\"stylesheet\" type=\"text/css\" >\n\ </head>\n\ <body>\n\ + <button onclick=\"topFunction()\" id=\"myBtn\" title=\"Go to top\">Top</button>\n\ <table>\n\ <colgroup>\n\ <col span=\"3\" style=\"background-color:white\">\n\ 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; +} diff --git a/tests/make_png/html/styles/top.css b/tests/make_png/html/styles/top.css index c2c0029a0..d6518db7d 100644 --- a/tests/make_png/html/styles/top.css +++ b/tests/make_png/html/styles/top.css @@ -34,6 +34,19 @@ th { width: 50%; height: auto; } +#myBtn { + display: none; + position: fixed; + bottom: 10px; + right: 10px; + z-index: 99; + cursor: pointer; + padding: 15px; + border-radius: 10px; + background-color: #555; + color: white; +} + /*Top Page styling begins*/ #frame_1{ width:49%; |