toc: add scrollbar #262

This commit is contained in:
Sören Weber 2022-06-06 00:44:04 +02:00
parent 63a4297da9
commit bcd4b2694b
No known key found for this signature in database
GPG key ID: 07D17FF580AE7589
2 changed files with 6 additions and 2 deletions

View file

@ -1159,9 +1159,10 @@ option {
#TableOfContents { #TableOfContents {
font-size: 13px !important; font-size: 13px !important;
max-height: 85%; max-height: 90vh;
overflow: auto; overflow: hidden;
padding: 15px 5px !important; padding: 15px 5px !important;
position: relative; /* PS */
} }
#TableOfContents > ul > li > a { #TableOfContents > ul > li > a {

View file

@ -427,6 +427,7 @@ function initToc(){
function showToc(){ function showToc(){
var b = document.querySelector( 'body' ); var b = document.querySelector( 'body' );
b.classList.toggle( 'toc-flyout' ); b.classList.toggle( 'toc-flyout' );
pst && pst.update();
} }
document.querySelector( '#sidebar-overlay' ).addEventListener( 'click', showNav ); document.querySelector( '#sidebar-overlay' ).addEventListener( 'click', showNav );
@ -434,10 +435,12 @@ function initToc(){
document.querySelector( '#toc-overlay' ).addEventListener( 'click', showToc ); document.querySelector( '#toc-overlay' ).addEventListener( 'click', showToc );
var t = document.querySelector( '#toc-menu' ); var t = document.querySelector( '#toc-menu' );
var p = document.querySelector( '.progress' ); var p = document.querySelector( '.progress' );
var pst;
if( t && p ){ if( t && p ){
// we may not have a toc // we may not have a toc
t.addEventListener( 'click', showToc ); t.addEventListener( 'click', showToc );
p.addEventListener( 'click', showToc ); p.addEventListener( 'click', showToc );
pst = new PerfectScrollbar('#TableOfContents');
} }
} }