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 to top feature on about page #1720

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
47 changes: 46 additions & 1 deletion about.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,29 @@
</div>
<div id="loading-text">Ready to Explore the World...</div>
</div>
<!-- <style>
<style>


.scroll-to-top {
position: fixed;
bottom: 30px;
right: 30px;
padding: 10px 15px;
font-size: 20px;
background-color: #007BFF;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
display: none; /* Hidden by default */
z-index: 1000;
}

.scroll-to-top:hover {
background-color: #0056b3;
}


/* Preloader Container */
#preloader {
position: fixed;
Expand Down Expand Up @@ -681,6 +703,9 @@ <h3>PRIYA Ghosal</h3>
}
</style>

<button id="scrollToTopBtn" class="scroll-to-top">↑</button>


<!-- Scroll to top button -->
<button id="scrollToTopBtn" title="Go to top">
<i class="fas fa-arrow-up"></i>
Expand Down Expand Up @@ -853,6 +878,26 @@ <h3>Follow Us <div class="underline"><span></span></div>
});
</script>

<script>
// Show the button when the user scrolls down 100px from the top
window.onscroll = function() {
const scrollToTopBtn = document.getElementById('scrollToTopBtn');
if (document.body.scrollTop > 100 || document.documentElement.scrollTop > 100) {
scrollToTopBtn.style.display = 'block';
} else {
scrollToTopBtn.style.display = 'none';
}
};

// Scroll to the top when the button is clicked
document.getElementById('scrollToTopBtn').addEventListener('click', function() {
window.scrollTo({
top: 0,
behavior: 'smooth'
});
});

</script>

<!-- Circles -->
<div class="circle"></div>
Expand Down