Skip to content

Commit

Permalink
fix: toc scrollspy highlight
Browse files Browse the repository at this point in the history
  • Loading branch information
TrebledJ committed Nov 5, 2023
1 parent 7e4f2c4 commit bd26c5d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion assets/js/post.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ $(() => {

// --- TOC Current Section Highlight --- //
const headerOffset = 150;
const sections = document.querySelectorAll('.post-article h2,.post-article h3');
const sections = document.querySelectorAll('.post-body h2,.post-body h3');
const mainNavLinks = document.querySelectorAll('#toc-sidebar nav.toc a');
const mobileNavLinks = document.querySelectorAll('#btn-mobile-toc nav.toc a');

Expand Down
5 changes: 4 additions & 1 deletion assets/scss/_toc-sidebar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,14 @@
.toc-link-container {
a {
color: var(--main-text-color) !important;
&:hover {
font-weight: 500;
}
}

a.active {
color: var(--bold-color) !important;
font-weight: 600;
font-weight: 700;
}
}

Expand Down
4 changes: 2 additions & 2 deletions assets/scss/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ $carousel-transition: transform 2s ease, opacity 1.5s ease-out .5s;
}
}

#toc-sidebar a,
#toc-sidebar a:not(.active),
.dim-deep {
opacity: 0.7;
transition: opacity $transition-duration linear;
Expand All @@ -169,7 +169,7 @@ $carousel-transition: transform 2s ease, opacity 1.5s ease-out .5s;
opacity: $opacity-low;
}

#toc-sidebar a,
// #toc-sidebar,
.dim-deep {
opacity: $opacity-lower;
}
Expand Down

0 comments on commit bd26c5d

Please sign in to comment.