@@ -515,7 +515,6 @@ aria-label="Show hidden lines"></button>';
515
515
} ) ( ) ;
516
516
517
517
( function sidebar ( ) {
518
- const body = document . querySelector ( 'body' ) ;
519
518
const sidebar = document . getElementById ( 'sidebar' ) ;
520
519
const sidebarLinks = document . querySelectorAll ( '#sidebar a' ) ;
521
520
const sidebarToggleButton = document . getElementById ( 'sidebar-toggle' ) ;
@@ -548,7 +547,7 @@ aria-label="Show hidden lines"></button>';
548
547
} ) ;
549
548
550
549
function showSidebar ( ) {
551
- body . classList . add ( 'sidebar-visible' ) ;
550
+ document . documentElement . classList . add ( 'sidebar-visible' ) ;
552
551
Array . from ( sidebarLinks ) . forEach ( function ( link ) {
553
552
link . setAttribute ( 'tabIndex' , 0 ) ;
554
553
} ) ;
@@ -562,7 +561,7 @@ aria-label="Show hidden lines"></button>';
562
561
}
563
562
564
563
function hideSidebar ( ) {
565
- body . classList . remove ( 'sidebar-visible' ) ;
564
+ document . documentElement . classList . remove ( 'sidebar-visible' ) ;
566
565
Array . from ( sidebarLinks ) . forEach ( function ( link ) {
567
566
link . setAttribute ( 'tabIndex' , - 1 ) ;
568
567
} ) ;
@@ -594,14 +593,14 @@ aria-label="Show hidden lines"></button>';
594
593
function initResize ( ) {
595
594
window . addEventListener ( 'mousemove' , resize , false ) ;
596
595
window . addEventListener ( 'mouseup' , stopResize , false ) ;
597
- body . classList . add ( 'sidebar-resizing' ) ;
596
+ document . documentElement . classList . add ( 'sidebar-resizing' ) ;
598
597
}
599
598
function resize ( e ) {
600
599
let pos = e . clientX - sidebar . offsetLeft ;
601
600
if ( pos < 20 ) {
602
601
hideSidebar ( ) ;
603
602
} else {
604
- if ( ! body . classList . contains ( 'sidebar-visible' ) ) {
603
+ if ( ! document . documentElement . classList . contains ( 'sidebar-visible' ) ) {
605
604
showSidebar ( ) ;
606
605
}
607
606
pos = Math . min ( pos , window . innerWidth - 100 ) ;
@@ -610,7 +609,7 @@ aria-label="Show hidden lines"></button>';
610
609
}
611
610
//on mouseup remove windows functions mousemove & mouseup
612
611
function stopResize ( ) {
613
- body . classList . remove ( 'sidebar-resizing' ) ;
612
+ document . documentElement . classList . remove ( 'sidebar-resizing' ) ;
614
613
window . removeEventListener ( 'mousemove' , resize , false ) ;
615
614
window . removeEventListener ( 'mouseup' , stopResize , false ) ;
616
615
}
0 commit comments