Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added-scroll-up-button #1801

Merged
merged 1 commit into from
Oct 31, 2024
Merged
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
68 changes: 68 additions & 0 deletions about.html
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,74 @@ <h3>PRIYA Ghosal</h3>
}
</style>

<!-- Scroll to top button -->
<button id="scrollToTopBtn" title="Go to top">
<i class="fas fa-arrow-up"></i>
</button>

<style>
#scrollToTopBtn {
position: fixed;
bottom: 30px;
right: 30px;
width: 50px;
height: 50px;
background-color: #000;
color: #fff;
border: none;
border-radius: 50%;
cursor: pointer;
display: none;
font-size: 20px;
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
transition: all 0.3s ease;
z-index: 1000;
display: flex;
align-items: center;
justify-content: center;
}

#scrollToTopBtn:hover {
background-color: #333;
transform: translateY(-5px);
box-shadow: 0 6px 15px rgba(0,0,0,0.2);
}

#scrollToTopBtn i {
transition: transform 0.3s ease;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}

#scrollToTopBtn:hover i {
transform: translate(-50%, -50%) translateY(-3px);
}
</style>

<script>
// Scroll to top functionality
const scrollToTopBtn = document.getElementById("scrollToTopBtn");

// Show button when user scrolls down 300px
window.onscroll = function() {
if (document.body.scrollTop > 300 || document.documentElement.scrollTop > 300) {
scrollToTopBtn.style.display = "block";
} else {
scrollToTopBtn.style.display = "none";
}
};

// Smooth scroll to top when button is clicked
scrollToTopBtn.addEventListener("click", function() {
window.scrollTo({
top: 0,
behavior: "smooth"
});
});
</script>

<div class="footer-responsive">

<footer>
Expand Down
Loading