mirror of
https://github.com/codex-team/codex.docs.git
synced 2025-08-10 07:55:24 +02:00
optimization
This commit is contained in:
parent
7b737209df
commit
8bc5ae06ed
1 changed files with 12 additions and 0 deletions
|
@ -288,6 +288,18 @@ export default class TableOfContent {
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
scrollToActiveItemIfNeeded() {
|
scrollToActiveItemIfNeeded() {
|
||||||
|
/**
|
||||||
|
* Do nothing if the Table of Content has no internal scroll at this page
|
||||||
|
*
|
||||||
|
* @todo compute it once
|
||||||
|
*/
|
||||||
|
const hasScroll = this.nodes.wrapper.scrollHeight > this.nodes.wrapper.clientHeight;
|
||||||
|
|
||||||
|
if (!hasScroll) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If some item is highlighted, check whether we need to scroll to it or not
|
* If some item is highlighted, check whether we need to scroll to it or not
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue