mirror of
https://github.com/codex-team/codex.docs.git
synced 2025-08-09 15:35:25 +02:00
Update table-of-content.js
This commit is contained in:
parent
fe04c5b081
commit
37fbf197ea
1 changed files with 6 additions and 0 deletions
|
@ -253,6 +253,11 @@ export default class TableOfContent {
|
||||||
* If targetLink is not defined then do nothing
|
* If targetLink is not defined then do nothing
|
||||||
*/
|
*/
|
||||||
if (!targetLink) {
|
if (!targetLink) {
|
||||||
|
/**
|
||||||
|
* Show the top of table of content
|
||||||
|
*/
|
||||||
|
document.querySelector(`.${this.CSS.tocHeader}`).scrollIntoViewIfNeeded();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,6 +283,7 @@ export default class TableOfContent {
|
||||||
*/
|
*/
|
||||||
if (listItem) {
|
if (listItem) {
|
||||||
listItem.classList.add(this.CSS.tocElementItemActive);
|
listItem.classList.add(this.CSS.tocElementItemActive);
|
||||||
|
listItem.scrollIntoViewIfNeeded();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue