@@ -94,20 +94,18 @@ export interface Props {
94
94
<button class =" open" ><Icon name =" list" group =" solid" /></button >
95
95
<button class =" close" ><Icon name =" x" group =" solid" /></button >
96
96
<div class =" title" >Outline</div >
97
- <div class =" content" >
98
- <nav >
99
- <ol >
100
- <li ><a href ={ ` #${titleSlug } ` } >{ article .data .title } </a ></li >
101
- {
102
- headings .map ((heading ) => (
103
- <li class = { ` depth-${heading .depth } ` } >
104
- <a href = { ` #${heading .slug } ` } >{ heading .text } </a >
105
- </li >
106
- ))
107
- }
108
- </ol >
109
- </nav >
110
- </div >
97
+ <nav class =" content" >
98
+ <ol >
99
+ <li ><a href ={ ` #${titleSlug } ` } >{ article .data .title } </a ></li >
100
+ {
101
+ headings .map ((heading ) => (
102
+ <li class = { ` depth-${heading .depth } ` } >
103
+ <a href = { ` #${heading .slug } ` } >{ heading .text } </a >
104
+ </li >
105
+ ))
106
+ }
107
+ </ol >
108
+ </nav >
111
109
</div >
112
110
</div >
113
111
</Layout >
@@ -155,16 +153,21 @@ export interface Props {
155
153
156
154
headings.forEach((heading) => intersectionObserver.observe(heading));
157
155
158
- document.addEventListener(
159
- "scroll",
160
- lodash.debounce(() => {
161
- console.warn("INVOKE");
156
+ const scrollOutline = lodash.debounce(
157
+ () => {
162
158
outline?.scrollTo({
163
159
top: topLink.offsetTop - outline.clientHeight / 2,
164
160
behavior: "smooth",
165
161
});
166
- }, 10)
162
+ },
163
+ 30,
164
+ { leading: false, trailing: true }
167
165
);
166
+
167
+ document.addEventListener("scroll", scrollOutline);
168
+ document
169
+ .querySelector(".columns .center")
170
+ ?.addEventListener("scroll", scrollOutline);
168
171
</script >
169
172
170
173
<style lang =" scss" >
0 commit comments