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 71
71
document.querySelector("#edit-page").href += `/edit/main/docs${location.pathname.replace(/^\/notebook-kit\//, "/") + (location.pathname.endsWith("/") ? "index" : "")}.html`;
72
72
</script>
73
73
<script type="module">
74
- let scrolled1 = false;
74
+ let scrolled = false;
75
75
const header = document.querySelector("#header");
76
76
document.addEventListener("scroll", () => {
77
77
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);
80
80
});
81
81
</script>
82
82
<script type="module">
83
- let scrolled2 = false;
83
+ let side;
84
+ let scrolled = false;
84
85
document.addEventListener("scroll", () => {
85
86
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);
89
92
});
90
93
</script>
91
94
<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