Skip to content

Commit

Permalink
Merge pull request #130 from sriharsha0x1/ScrollUp
Browse files Browse the repository at this point in the history
Scroll up #120
  • Loading branch information
jency1 authored Oct 15, 2024
2 parents 266f05e + 34fdfd0 commit 17cfd12
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 24 deletions.
6 changes: 5 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@
</button>
</div>
</div>
<button class="top" id="top" onclick="topFunction()"><img src="website/web_images/top.png" alt=""></button>
<button class="go-top-btn">
<img src="website/web_images/arrow.png" alt="arrow up">
</button>


<nav id="navbar">
<img src="website/web_images/3dlogo.svg" alt="Dataverse Logo" class="logo" id="normal">
<img src="website/web_images/3d_glow.png" alt="Dataverse Logo" class="logo" id="glow">
Expand Down
21 changes: 18 additions & 3 deletions website/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,25 @@ window.addEventListener("load",function(e){
displayCopyright();
});

function topFunction() {
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
const goTopBtn = document.querySelector('.go-top-btn');

window.addEventListener('scroll', checkHeight)

function checkHeight(){
if(window.scrollY > 200) {
goTopBtn.style.display = "flex"
} else {
goTopBtn.style.display = "none"
}
}

goTopBtn.addEventListener('click', () => {
window.scrollTo({
top: 0,
behavior: "smooth"
})
})

function changeCss() {
var top = document.getElementById("top");
var scroll_icon = document.getElementById("scroll_icon");
Expand Down
39 changes: 19 additions & 20 deletions website/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -370,28 +370,27 @@ footer {
color: white;
}

.top {
background-color: #3333337b;
padding: 10px 7px 10px 7px;
border: none;
border-radius: 10px;
.go-top-btn {
position: fixed;
bottom: 10px;
right: 10px;
backdrop-filter: blur(7px);
box-shadow: 5px 5px 10px black;
z-index: 50;

}

#top {
opacity: 0;
transition-duration: 0.3s;
}
bottom: 35px;
right: 35px;
border-radius: 50%;
cursor: pointer;
height: 65px;
width: 65px;
background: #fff;
border: 3px solid #333;
display: none;
justify-content: center;
z-index: 1000;
align-items: center;
}

.go-top-btn img {
width: 50px;
height: 50px;
}

.top img {
height: 20px;
}

#navbar {
width: 100vw;
Expand Down
Binary file added website/web_images/arrow-up.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added website/web_images/arrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 17cfd12

Please sign in to comment.