File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed
Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change 7171 document.querySelector("#edit-page").href += `/edit/main/docs${location.pathname.replace(/^\/notebook-kit\//, "/") + (location.pathname.endsWith("/") ? "index" : "")}.html`;
7272 </script>
7373 <script type="module">
74- let scrolled1 = false;
74+ let scrolled = false;
7575 const header = document.querySelector("#header");
7676 document.addEventListener("scroll", () => {
7777 const s = scrollY > 0;
78- if (scrolled1 === s) return;
79- header.classList.toggle("scrolled1", scrolled1 = s);
78+ if (scrolled === s) return;
79+ header.classList.toggle("scrolled1", scrolled = s);
8080 });
8181 </script>
8282 <script type="module">
83- let scrolled2 = false;
83+ let side;
84+ let scrolled = false;
8485 document.addEventListener("scroll", () => {
8586 const c = document.querySelector(".observablehq--cell");
86- const s = c?.getBoundingClientRect().bottom < 50;
87- if (scrolled2 === s) return;
88- header.classList.toggle("scrolled2", scrolled2 = s);
87+ if (!c) return;
88+ if (side === undefined) side = getComputedStyle(c).paddingBottom === "0px" ? "top" : "bottom";
89+ const s = c.getBoundingClientRect()[side] < 0;
90+ if (scrolled === s) return;
91+ header.classList.toggle("scrolled2", scrolled = s);
8992 });
9093 </script>
9194 <footer style="width: 100vw; margin: 2rem calc((100% - 100vw) / 2) -32px; padding-bottom: 16px; background-color: var(--theme-foreground); color: var(--theme-background); font: 12px/normal var(--sans-serif);">
You can’t perform that action at this time.
0 commit comments