Skip to content

Commit

Permalink
the scroll up button has been successfully added to the FAQs page
Browse files Browse the repository at this point in the history
  • Loading branch information
2004pra committed Oct 26, 2024
1 parent 1be424a commit b9f43ee
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions F&Q.html
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,13 @@
</head>
<body>
<script src="script.js"></script>
<script>

</script>
<header class="main-head">
<button class="go-top-btn">
<img height="45px" width="50px" src="arrow_upper.png " alt="arrow up">
</button>
<div class="logo">
<img src="img/logo.png" id="logo-web" />
<h1 id="logo"><a href="#home">BuddyTrail</a></h1>
Expand Down Expand Up @@ -378,6 +384,22 @@ <h2>Suggestions/Questions</h2>
modal.style.display = 'none';
}
});

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"
})
})
</script>


Expand Down

0 comments on commit b9f43ee

Please sign in to comment.