mirror of
https://github.com/LukeHagar/unicorn-utterances.git
synced 2025-12-07 04:21:57 +00:00
12 lines
292 B
TypeScript
12 lines
292 B
TypeScript
export const enableTables = () => {
|
|
const observer = new IntersectionObserver(
|
|
([e]) => {
|
|
(e.target as HTMLElement).dataset.sticky =
|
|
e.intersectionRatio < 1 ? "pinned" : "";
|
|
},
|
|
{ threshold: [1] },
|
|
);
|
|
|
|
document.querySelectorAll("thead").forEach((e) => observer.observe(e));
|
|
};
|