From 8ae2bd3552aec5a7062809ba998e9dd23c552fb2 Mon Sep 17 00:00:00 2001 From: DaleStack <211448639+DaleStack@users.noreply.github.com> Date: Fri, 1 Aug 2025 03:21:28 +0800 Subject: [PATCH] Add scroll-to-top button that appears after scrolling 300px --- docs/_static/scrolltop.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/_static/scrolltop.js b/docs/_static/scrolltop.js index 7f0d8281..e9c5abd4 100644 --- a/docs/_static/scrolltop.js +++ b/docs/_static/scrolltop.js @@ -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";