mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2025-07-03 22:20:30 +00:00
menu : expand/collapse menu items without navigation #231
This commit is contained in:
parent
cadc808932
commit
48c7d6bc73
12 changed files with 133 additions and 52 deletions
static/js
|
@ -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(){
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue