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

Fixed the bug #824

Closed
wants to merge 1 commit into from
Closed
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
44 changes: 21 additions & 23 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1036,33 +1036,31 @@ <h4>Reach Out To Us</h4>

</footer>

<!-- adding a scrollup btn -->
<a class="goupbtn" href="#"><i class="fa-solid fa-arrow-up"></i></a>
<a class="goupbtn" href="#" onclick="goToTop()"><i class="fa-solid fa-arrow-up"></i></a>

<script>
// Get the button
var mybutton = document.querySelector(".goupbtn");

// When the user scrolls, check if the button should be displayed
window.addEventListener("scroll", function() {
if (window.scrollY > 20) {
mybutton.style.display = "block";
} else {
mybutton.style.display = "none";
}
});

<script>
// Get the button
var mybutton = document.getElementById("goToTopBtn");
// When the user clicks on the button, scroll to the top of the document
function goToTop() {
document.body.scrollTop = 0; // For Safari
document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera
}
</script>



// 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 goToTop() {
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
}
</script>

<script>
let hamburger = document.querySelector('.hamburger');
Expand Down
1 change: 1 addition & 0 deletions styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -2198,6 +2198,7 @@ body {
font-size: 22px;
transition: all 0.5s;
transition: box-shadow 0.3s; /* Added transition for box-shadow */
display: none;
}

.goupbtn:hover {
Expand Down
Loading