File tree Expand file tree Collapse file tree 4 files changed +88
-5
lines changed Expand file tree Collapse file tree 4 files changed +88
-5
lines changed Original file line number Diff line number Diff line change 103
103
position : relative;
104
104
}
105
105
106
+ .nav-menu-toggle {
107
+ background : transparent url(../ img/octicons-24.svg#view-unfold) no-repeat center;
108
+ border : none;
109
+ outline : none;
110
+ width : 0.9rem ;
111
+ height : 0.9rem ;
112
+ opacity : 0.5 ;
113
+ position : sticky;
114
+ top : 0.8075rem ;
115
+ margin-right : -0.5rem ;
116
+ float : right;
117
+ visibility : hidden;
118
+ }
119
+
120
+ .nav-menu-toggle .is-active {
121
+ background-image : url(../ img/octicons-24.svg#view-fold);
122
+ }
123
+
124
+ .nav-panel-menu .is-active : hover .nav-menu-toggle {
125
+ visibility : visible;
126
+ }
127
+
106
128
.nav-menu h3 .title {
107
129
color : var (--nav-heading-font-color );
108
- font-size : 1.05 em ;
130
+ font-size : 0.9 rem ;
109
131
font-weight : var (--body-font-weight-bold );
110
- margin : 0 ;
111
- padding-top : 0.25 em ;
132
+ margin : 0.15 rem 0 0 ;
133
+ padding : 0 ;
112
134
}
113
135
114
136
.nav-menu a {
Original file line number Diff line number Diff line change 22
22
menuPanel . scrollTop = 0
23
23
}
24
24
25
+ menuPanel . querySelector ( '.nav-menu-toggle' ) . addEventListener ( 'click' , function ( ) {
26
+ var collapse = ! this . classList . toggle ( 'is-active' )
27
+ find ( menuPanel , '.nav-item > .nav-item-toggle' ) . forEach ( function ( btn ) {
28
+ collapse ? btn . parentElement . classList . remove ( 'is-active' ) : btn . parentElement . classList . add ( 'is-active' )
29
+ } )
30
+ if ( currentPageItem ) {
31
+ if ( collapse ) activateCurrentPath ( currentPageItem , false )
32
+ scrollItemToMidpoint ( menuPanel , currentPageItem . querySelector ( '.nav-link' ) )
33
+ } else if ( collapse ) {
34
+ menuPanel . scrollTop = 0
35
+ }
36
+ } )
37
+
25
38
find ( menuPanel , '.nav-item-toggle' ) . forEach ( function ( btn ) {
26
39
var li = btn . parentElement
27
40
btn . addEventListener ( 'click' , toggleActive . bind ( li ) )
87
100
window . addEventListener ( 'hashchange' , onHashChange )
88
101
}
89
102
90
- function activateCurrentPath ( navItem ) {
103
+ function activateCurrentPath ( navItem , trace ) {
91
104
var ancestorClasses
92
105
var ancestor = navItem . parentNode
93
106
while ( ! ( ancestorClasses = ancestor . classList ) . contains ( 'nav-menu' ) ) {
94
107
if ( ancestor . tagName === 'LI' && ancestorClasses . contains ( 'nav-item' ) ) {
95
- ancestorClasses . add ( 'is-active' , 'is-current-path' )
108
+ ancestorClasses . add ( 'is-active' )
109
+ if ( trace !== false ) ancestorClasses . add ( 'is-current-path' )
96
110
}
97
111
ancestor = ancestor . parentNode
98
112
}
Original file line number Diff line number Diff line change 1
1
{{ #with page.navigation }}
2
2
<div class =" nav-panel-menu is-active" data-panel =" menu" >
3
3
<nav class =" nav-menu" >
4
+ <button class =" nav-menu-toggle" title =" Toggle expand/collapse all" ></button >
4
5
{{ #with @root.page.componentVersion }}
5
6
<h3 class =" title" ><a href =" {{{ relativize ./url }}} " >{{ ./title }} </a ></h3 >
6
7
{{ /with }}
You can’t perform that action at this time.
0 commit comments