We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 19454c6 commit e4dd5aeCopy full SHA for e4dd5ae
1 file changed
_layouts/post.html
@@ -208,17 +208,7 @@ <h3>{{ t.post_discussion }}</h3>
208
});
209
210
if (activeLink) {
211
- var sidebar = document.getElementById('toc-sidebar');
212
- var linkTop = activeLink.offsetTop - sidebar.offsetTop;
213
- var linkBottom = linkTop + activeLink.offsetHeight;
214
- var scrollTop = sidebar.scrollTop;
215
- var viewHeight = sidebar.clientHeight;
216
-
217
- if (linkTop < scrollTop + 40) {
218
- sidebar.scrollTo({top: linkTop - 40, behavior: 'smooth'});
219
- } else if (linkBottom > scrollTop + viewHeight - 40) {
220
- sidebar.scrollTo({top: linkBottom - viewHeight + 40, behavior: 'smooth'});
221
- }
+ activeLink.scrollIntoView({block: 'nearest', behavior: 'smooth'});
222
}
223
224
0 commit comments