|
60 | 60 |
|
61 | 61 | function onScroll () { |
62 | 62 | var scrolledBy = window.pageYOffset |
63 | | - var buffer = getNumericStyleVal(document.documentElement, 'fontSize') * 1.15 |
64 | 63 | var ceil = article.offsetTop |
65 | 64 | if (scrolledBy && window.innerHeight + scrolledBy + 2 >= document.documentElement.scrollHeight) { |
66 | 65 | lastActiveFragment = Array.isArray(lastActiveFragment) ? lastActiveFragment : Array(lastActiveFragment || 0) |
|
85 | 84 | }) |
86 | 85 | lastActiveFragment = undefined |
87 | 86 | } |
88 | | - var activeFragment |
89 | | - headings.some(function (heading) { |
90 | | - if (heading.getBoundingClientRect().top + getNumericStyleVal(heading, 'paddingTop') - buffer > ceil) return true |
91 | | - activeFragment = '#' + heading.id |
92 | | - }) |
93 | | - if (activeFragment) { |
94 | | - if (activeFragment === lastActiveFragment) return |
95 | | - if (lastActiveFragment) links[lastActiveFragment].classList.remove('is-active') |
96 | | - var activeLink = links[activeFragment] |
97 | | - activeLink.classList.add('is-active') |
98 | | - if (list.scrollHeight > list.offsetHeight) { |
99 | | - list.scrollTop = Math.max(0, activeLink.offsetTop + activeLink.offsetHeight - list.offsetHeight) |
100 | | - } |
101 | | - lastActiveFragment = activeFragment |
102 | | - } else if (lastActiveFragment) { |
103 | | - links[lastActiveFragment].classList.remove('is-active') |
104 | | - lastActiveFragment = undefined |
| 87 | + // Scroll-based highlighting disabled - fragment jumper handles TOC highlighting |
| 88 | + // Only keep the TOC scrolling functionality for auto-scroll to active item |
| 89 | + var activeLink = document.querySelector('aside.toc a.is-active') |
| 90 | + if (activeLink && list.scrollHeight > list.offsetHeight) { |
| 91 | + list.scrollTop = Math.max(0, activeLink.offsetTop + activeLink.offsetHeight - list.offsetHeight) |
105 | 92 | } |
106 | 93 | } |
107 | 94 |
|
|
0 commit comments