|
48 | 48 | <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons|Roboto"> |
49 | 49 | <link rel="stylesheet" href="/materialjs/material.min.css" /> |
50 | 50 | <link rel="stylesheet" href="style.css" /> |
| 51 | + <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.min.css"> |
51 | 52 | <script defer src="/materialjs/material.min.js"></script> |
52 | 53 | <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> |
53 | 54 |
|
@@ -155,6 +156,9 @@ <h3>NWoC 2020 Projects</h3> |
155 | 156 | </ul> |
156 | 157 | </div> |
157 | 158 | </div> |
| 159 | + |
| 160 | + <button onclick="topFunction()" id="myBtn" title="Go to top"><i class="fa fa-angle-double-up" aria-hidden="true" style="color: black;font-weight: bolder;"></i></button> |
| 161 | + |
158 | 162 | <div class="mdl-cell mdl-cell--6-col"> |
159 | 163 | <div class="nwoc-repo-card"> |
160 | 164 | <img src="https://cdnjs.cloudflare.com/ajax/libs/octicons/8.0.0/svg/mark-github.svg"/> |
@@ -683,4 +687,25 @@ <h3>NWoC 2020 Projects</h3> |
683 | 687 | </main> |
684 | 688 | </div> |
685 | 689 | </body> |
| 690 | + <script> |
| 691 | +//Get the button |
| 692 | +var mybutton = document.getElementById("myBtn"); |
| 693 | + |
| 694 | +// When the user scrolls down 20px from the top of the document, show the button |
| 695 | +window.onscroll = function() {scrollFunction()}; |
| 696 | + |
| 697 | +function scrollFunction() { |
| 698 | + if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) { |
| 699 | + mybutton.style.display = "block"; |
| 700 | + } else { |
| 701 | + mybutton.style.display = "none"; |
| 702 | + } |
| 703 | +} |
| 704 | + |
| 705 | +// When the user clicks on the button, scroll to the top of the document |
| 706 | +function topFunction() { |
| 707 | + document.body.scrollTop = 0; |
| 708 | + document.documentElement.scrollTop = 0; |
| 709 | +} |
| 710 | +</script> |
686 | 711 | </html> |
0 commit comments