menu : expand/collapse menu items without navigation

This commit is contained in:
Sören Weber 2022-04-03 12:12:12 +02:00
parent cadc808932
commit 48c7d6bc73
No known key found for this signature in database
GPG key ID: 07D17FF580AE7589
12 changed files with 133 additions and 52 deletions
static/js

View file

@ -339,10 +339,6 @@ function initMenuScrollbar(){
// that need to be executed inbetween our own handlers
var psm = new PerfectScrollbar('#content-wrapper');
var psc = new PerfectScrollbar(content);
window.addEventListener('resize', function(){
psm && psm.update();
psc && psc.update();
});
document.addEventListener('keydown', function(){
// if we facked initial scrolling, we want to
// remove the focus to not leave visual markers on
@ -353,6 +349,19 @@ function initMenuScrollbar(){
autofocus = false;
}
});
// on resize, we have to redraw the scrollbars to let new height
// affect their size
window.addEventListener('resize', function(){
psm && psm.update();
psc && psc.update();
});
// now that we may have collapsible menus, we need to call a resize
// for the menu scrollbar if sections are expanded/collapsed
document.querySelectorAll('#sidebar .collapsible-menu input.toggle').forEach( function(e){
e.addEventListener('change', function(){
psm && psm.update();
});
});
}
function initLightbox(){