|
56 | 56 | <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.min.css"> |
57 | 57 | <link rel="stylesheet" href="/materialjs/material.min.css" /> |
58 | 58 | <link rel="stylesheet" href="style.css" /> |
| 59 | + <style type="text/css"> |
| 60 | + html { |
| 61 | + scroll-behavior: smooth; |
| 62 | + } |
| 63 | + |
| 64 | + #myBtn { |
| 65 | + display: none; |
| 66 | + position: fixed; |
| 67 | + bottom: 20px; |
| 68 | + right: 30px; |
| 69 | + z-index: 99; |
| 70 | + font-size: 25px; |
| 71 | + border: none; |
| 72 | + outline: none; |
| 73 | + background-color: #87CEFA; |
| 74 | + color: white; |
| 75 | + font-color: blue; |
| 76 | + cursor: pointer; |
| 77 | + padding: 14px; |
| 78 | + border-radius: 30%; |
| 79 | +} |
| 80 | + |
| 81 | +.fa-angle-double-up { |
| 82 | + |
| 83 | + font-weight: bolder; |
| 84 | +} |
| 85 | + |
| 86 | +#myBtn:hover { |
| 87 | + background-color: #D3D3D3; |
| 88 | +} |
| 89 | +</style> |
59 | 90 | <script defer src="/materialjs/material.min.js"></script> |
60 | 91 | <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> |
61 | 92 |
|
|
132 | 163 | </div> |
133 | 164 | </div> |
134 | 165 |
|
| 166 | + <button onclick="topFunction()" id="myBtn" title="Go to top"><i class="fa fa-angle-double-up p-1 font-weight-bold" aria-hidden="true" style="color: black;"></i></button> |
| 167 | + |
135 | 168 | <div class="nwoc-content"> |
136 | 169 | <a id="about"></a> |
137 | 170 | <h3>About</h3> |
@@ -518,6 +551,27 @@ <h4>Tell your friends about NWoC</h4> |
518 | 551 |
|
519 | 552 | }()); |
520 | 553 | </script> |
| 554 | +<script> |
| 555 | +//Get the button |
| 556 | +var mybutton = document.getElementById("myBtn"); |
| 557 | + |
| 558 | +// When the user scrolls down 20px from the top of the document, show the button |
| 559 | +window.onscroll = function() {scrollFunction()}; |
| 560 | + |
| 561 | +function scrollFunction() { |
| 562 | + if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) { |
| 563 | + mybutton.style.display = "block"; |
| 564 | + } else { |
| 565 | + mybutton.style.display = "none"; |
| 566 | + } |
| 567 | +} |
| 568 | + |
| 569 | +// When the user clicks on the button, scroll to the top of the document |
| 570 | +function topFunction() { |
| 571 | + document.body.scrollTop = 0; |
| 572 | + document.documentElement.scrollTop = 0; |
| 573 | +} |
| 574 | +</script> |
521 | 575 |
|
522 | 576 | <script src="https://cdnjs.cloudflare.com/ajax/libs/tilt.js/1.2.1/tilt.jquery.min.js"></script> |
523 | 577 | <script> |
|
0 commit comments