PageSourceSearch

https://silverhome.design/local/templates/silverhome/components/figma/back-to-top/script.js?1790847657657

js silverhome.design collected 2026-10-08 15:57:46 UTC 657 bytes, 30 lines download raw bytes

1function hideOrShow(element,distanceOne,distanceTwo) {
2    if(distanceOne <= distanceTwo) {
3      element.classList.add("active");
4    }     
5    else
6    {
7      element.classList.remove("active");
8    }
9};
10
11function backToTop() {
12  const upArrow = document.querySelector('.back-to-top');
13  const height = 2 * window.innerHeight;
14
15  document.onscroll = ()=> {
16    let distanceToTop = window.scrollY;
17    hideOrShow(upArrow,height,distanceToTop);
18  };
19  
20  upArrow.addEventListener("click", function () {
21    window.scroll({
22      top: 0,
23      behavior: 'smooth'
24    });
25  });
26};
27
28document.addEventListener("DOMContentLoaded", () => {
29    backToTop();
30});

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.