PageSourceSearch

https://saofeia.github.io/js/tools/scrollTopBottom.js

js saofeia.github.io collected 2026-10-03 09:54:11 UTC 836 bytes, 34 lines download raw bytes

1const initScrollTopBottom = () => {
2  const backToTopButton_dom = document.querySelector(".tool-scroll-to-top");
3  const backToBottomButton_dom = document.querySelector(
4    ".tool-scroll-to-bottom",
5  );
6
7  const backToTop = () => {
8    window.scrollTo({
9      top: 0, // scrolls to the top of the page
10      behavior: "smooth",
11    });
12  };
13
14  const backToBottom = () => {
15    const docHeight = document.body.scrollHeight;
16    window.scrollTo({
17      top: docHeight, // scrolls to the bottom of the page
18      behavior: "smooth",
19    });
20  };
21
22  const initBackToTop = () => {
23    backToTopButton_dom.addEventListener("click", backToTop);
24  };
25
26  const initBackToBottom = () => {
27    backToBottomButton_dom.addEventListener("click", backToBottom);
28  };
29
30  initBackToTop();
31  initBackToBottom();
32};
33
34export default initScrollTopBottom;

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.