1
0
Fork 0
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:
Taly 2022-07-13 18:38:18 +03:00
parent fe04c5b081
commit 37fbf197ea

View file

@ -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();
} }
} }
} }