[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2] GSoC-2017-kushal fbaf709 59/70: Add Go to top button
From: |
Kushal K S V S |
Subject: |
[freetype2] GSoC-2017-kushal fbaf709 59/70: Add Go to top button |
Date: |
Sun, 18 Mar 2018 11:21:19 -0400 (EDT) |
branch: GSoC-2017-kushal
commit fbaf7095106c4103fcc25686ce4bfb784df8d1e6
Author: Kushal K S V S <address@hidden>
Commit: Kushal K S V S <address@hidden>
Add Go to top button
---
tests/make_png/bitmap.c | 1 +
tests/make_png/html/scripts/top.js | 15 +++++++++++++++
tests/make_png/html/styles/top.css | 13 +++++++++++++
3 files changed, 29 insertions(+)
diff --git a/tests/make_png/bitmap.c b/tests/make_png/bitmap.c
index 5fa1f2b..8158af7 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 b3fabf8..e77372e 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 c2c0029..d6518db 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%;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2] GSoC-2017-kushal fbaf709 59/70: Add Go to top button,
Kushal K S V S <=