Add scroll-to-top button that appears after scrolling 300px
This commit is contained in:
parent
4785d8edc7
commit
8ae2bd3552
1 changed files with 3 additions and 0 deletions
3
docs/_static/scrolltop.js
vendored
3
docs/_static/scrolltop.js
vendored
|
|
@ -1,3 +1,6 @@
|
|||
// Injects a scroll-to-top button that appears after scrolling down 300px.
|
||||
// When clicked, it smoothly scrolls the page back to the top.
|
||||
|
||||
window.addEventListener("scroll", function () {
|
||||
const btn = document.getElementById("scrollToTop");
|
||||
btn.style.display = window.scrollY > 300 ? "block" : "none";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue