File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -346,6 +346,8 @@ <h2>Table of Contents</h2>
346
346
if ( document . location . hash . includes ( '#' ) ) {
347
347
document . location . hash = document . location . hash ;
348
348
}
349
+
350
+ updateTocSize ( ) ;
349
351
}
350
352
}
351
353
@@ -474,6 +476,19 @@ <h2>Table of Contents</h2>
474
476
}
475
477
}
476
478
479
+ function updateTocSize ( ) {
480
+ const toc = document . getElementById ( 'toc' ) ;
481
+ const tocInner = document . getElementById ( 'table-of-contents' ) ;
482
+ if ( toc != null && tocInner != null ) {
483
+ const height = window . document . documentElement . clientHeight ;
484
+ tocInner . style . maxHeight = `${ height - tocInner . getBoundingClientRect ( ) . top - 20 } px` ;
485
+ toc . style . maxHeight = `${ height - toc . getBoundingClientRect ( ) . top - 20 } px` ;
486
+ }
487
+ }
488
+
489
+ window . onscroll = updateTocSize ;
490
+ window . onresize = updateTocSize ;
491
+
477
492
//]]>
478
493
</ script >
479
494
You can’t perform that action at this time.
0 commit comments