Skip to content

Commit 20fb8af

Browse files
committed
fix: Show highlight for H4 elements and improve scrollport detection
1 parent b7a7974 commit 20fb8af

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

assets/js/highlightHeadline.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ function isAsideActive() {
77
function initHighlightHeadline() {
88

99
// In this site's layout, the table of contents (.content_with_heading) is an element that appears before any other content at the same hierarchy level
10-
const headings = Array.from(document.querySelectorAll('.content_with_heading :is(h1, h2, h3, h4)'));
10+
const headings = Array.from(document.querySelectorAll('.content_with_heading :is(h1, h2, h3)'));
1111
const windowPath = window.location.pathname;
1212
if (headings.length === 0) {
1313
return; // No headings? No business here
@@ -66,7 +66,7 @@ function initHighlightHeadline() {
6666
{
6767
//? docHeight: Extend the detection above the heading so it's always considered as intersecting if above the scrollport
6868
//? -33%: The element won't be considered as intersecting until it has gone _above_ the bottom third of the scrollport
69-
rootMargin: `${docHeight}px 0px -80% 0px`,
69+
rootMargin: `${docHeight}px 0px -90% 0px`,
7070
threshold: 1, // Only considered intersecting if all the pixels are inside the intersection area
7171
}
7272
);

0 commit comments

Comments
 (0)