Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions community.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
href="https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,400;0,500;0,600;0,700;0,800;0,900;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap"
rel="stylesheet"
/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">

<title>caMicroscope</title>
<!--

Expand All @@ -53,6 +55,8 @@
</head>

<body style="background-color: #fcfcfc">
<button onclick="topFunction()" id="myBtn" title="Go to top"><i class="fa fa-arrow-up"></i>
</button>
<nav class="navbar">
<div class="container">
<a href="#" class="nav-logo logo__color">caMicroscope</a>
Expand Down Expand Up @@ -135,5 +139,6 @@
</div>
<script src="/js/navbar-responsive.js"></script>
<script src="/js/footer.js"></script>
<script src="/js/scrolltotop.js"></script>
</body>
</html>
28 changes: 28 additions & 0 deletions css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -309,3 +309,31 @@ a {
line-height: 10px;
}
}

#myBtn {
display: none;
position: fixed;
bottom: 20px;
right: 30px;
z-index: 99;
font-size: 18px;
border: none;
outline: none;
background-color: black;
color: white;
cursor: pointer;
padding: 15px;
border-radius: 50%;
width: 60px;
height: 60px;
transition: 0.15ss;
}

#myBtn:hover {
background-color: #9a2ca0;
border:2px solid white;
padding: 15px;
border-radius: 50%;
width: 60px;
height: 60px;
}
4 changes: 4 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
href="https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,400;0,500;0,600;0,700;0,800;0,900;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap"
rel="stylesheet"
/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<title>caMicroscope</title>
<!--

Expand All @@ -53,6 +54,8 @@
</head>

<body style="background-color: #fcfcfc">
<button onclick="topFunction()" id="myBtn" title="Go to top"><i class="fa fa-arrow-up"></i>
</button>
<div class="main-conatiner">
<nav class="navbar">
<div class="container">
Expand Down Expand Up @@ -276,5 +279,6 @@
</div>
<script src="/js/navbar-responsive.js"></script>
<script src="/js/footer.js"></script>
<script src="/js/scrolltotop.js"></script>
</body>
</html>
20 changes: 20 additions & 0 deletions js/scrolltotop.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

// Get the button
let mybutton = document.getElementById("myBtn");

// 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) {
mybutton.style.display = "block";
} else {
mybutton.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;
}