mirror of
https://github.com/saicaca/fuwari.git
synced 2026-01-11 14:52:52 +01:00
fix: fix incorrect position of TOC indicator
This commit is contained in:
@@ -52,7 +52,7 @@ const maxLevel = siteConfig.toc.depth;
|
|||||||
}]}>{removeTailingHash(heading.text)}</div>
|
}]}>{removeTailingHash(heading.text)}</div>
|
||||||
</a>
|
</a>
|
||||||
)}
|
)}
|
||||||
<div id="active-indicator" class="-z-10 absolute bg-[var(--toc-btn-hover)] left-0 right-0 h-16 rounded-xl transition-all
|
<div id="active-indicator" class="-z-10 absolute bg-[var(--toc-btn-hover)] left-0 right-0 rounded-xl transition-all
|
||||||
group-hover:bg-transparent border-2 border-[var(--toc-btn-hover)] group-hover:border-[var(--toc-btn-active)] border-dashed"></div>
|
group-hover:bg-transparent border-2 border-[var(--toc-btn-hover)] group-hover:border-[var(--toc-btn-active)] border-dashed"></div>
|
||||||
</table-of-contents>
|
</table-of-contents>
|
||||||
|
|
||||||
@@ -198,6 +198,13 @@ class TableOfContents extends HTMLElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
connectedCallback() {
|
connectedCallback() {
|
||||||
|
// wait for the onload animation to finish, which makes the `getBoundingClientRect` return correct values
|
||||||
|
setTimeout(() => {
|
||||||
|
this.init();
|
||||||
|
}, 250);
|
||||||
|
}
|
||||||
|
|
||||||
|
init() {
|
||||||
this.tocEl = document.getElementById(
|
this.tocEl = document.getElementById(
|
||||||
"toc-inner-wrapper"
|
"toc-inner-wrapper"
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user