Skip to content

Commit 9615c95

Browse files
authored
ENH: IntersectionObserver at 1/3 screen (#567)
* IntersectionObserver at 1/3 screen * Update src/sphinx_book_theme/assets/scripts/index.js * Filesystem
1 parent ce736b2 commit 9615c95

File tree

1 file changed

+5
-1
lines changed
  • src/sphinx_book_theme/assets/scripts

1 file changed

+5
-1
lines changed

src/sphinx_book_theme/assets/scripts/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,11 @@ var initTocHide = () => {
131131
};
132132

133133
// Set up the intersection observer to watch all margin content
134-
let tocObserver = new IntersectionObserver(hideTocCallback);
134+
let options = {
135+
// Trigger callback when the top of a margin item is 1/3 up the screen
136+
rootMargin: "0px 0px -33% 0px",
137+
};
138+
let tocObserver = new IntersectionObserver(hideTocCallback, options);
135139
// TODO: deprecate popout after v0.5.0
136140
const selectorClasses = [
137141
"marginnote",

0 commit comments

Comments
 (0)