Skip to content

Commit

Permalink
Merge pull request #1257 from Anni299/main
Browse files Browse the repository at this point in the history
Added scroll-to-top arrow button
  • Loading branch information
Suchitra-Sahoo authored Jul 24, 2024
2 parents fc8d8a3 + 81892a1 commit 00144cd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
4 changes: 1 addition & 3 deletions about/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,7 @@ <h2>Quick Links</h2>
</div>
</footer>
<div id="backtoTop">
<a href="#about"
><i class="bx bx-up-arrow-alt" id="go-to-top" title="Go to top"></i
></a>
<a href="#about"><i class="bx bx-up-arrow-alt" id="go-to-top" title="Go to top"></i></a>
</div>
<div class="cursor"></div>
<div class="cursor2"></div>
Expand Down
25 changes: 14 additions & 11 deletions buyproducts/buy_products.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,8 @@
<title>Agricultural Tools Store</title>
<link rel="stylesheet" href="./buy_products.css" />
<link rel="stylesheet" href="../testimonials/testimonials.css" />
<link
rel="stylesheet"
href="../cursor/style.css"
<link
href="https://unpkg.com/[email protected]/css/boxicons.min.css"
rel="stylesheet"
/>
<link rel="stylesheet" href="../cursor/style.css" />
<link href="https://unpkg.com/[email protected]/css/boxicons.min.css" rel="stylesheet"/>
<script
src="https://kit.fontawesome.com/b08b6de27e.js"
crossorigin="anonymous"
Expand Down Expand Up @@ -649,9 +644,7 @@ <h2>Quick Links</h2>
</div>
</footer>
<div id="backtoTop">
<a href="#buy_products"
><i class="bx bx-up-arrow-alt" id="go-to-top" title="Go to top"></i
></a>
<a href="#buy_products"><i class="bx bx-up-arrow-alt" id="go-to-top" title="Go to top"></i></a>
</div>
<div class="cursor"></div>
<div class="cursor2"></div>
Expand All @@ -668,11 +661,21 @@ <h2>Quick Links</h2>

if (scrollPosition > 300) {
// Adjust this value as needed to show the button at the desired scroll position
backToTopButton.style.display = "block";
backToTopButton.style.display = "flex";
} else {
backToTopButton.style.display = "none";
}
});

// Scroll to top when the button is clicked
document
.getElementById("backtoTop")
.addEventListener("click", function () {
window.scrollTo({
top: 0,
behavior: "smooth",
});
});
</script>
<!-- <script src="https://mediafiles.botpress.cloud/43c4d3ec-a251-474f-8cce-3d8737805a57/webchat/config.js" defer></script> -->
<script type="text/javascript">
Expand Down

0 comments on commit 00144cd

Please sign in to comment.