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 103103 position : relative;
104104}
105105
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+
106128.nav-menu h3 .title {
107129 color : var (--nav-heading-font-color );
108- font-size : 1.05 em ;
130+ font-size : 0.9 rem ;
109131 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 ;
112134}
113135
114136.nav-menu a {
Original file line number Diff line number Diff line change 2222 menuPanel . scrollTop = 0
2323 }
2424
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+
2538 find ( menuPanel , '.nav-item-toggle' ) . forEach ( function ( btn ) {
2639 var li = btn . parentElement
2740 btn . addEventListener ( 'click' , toggleActive . bind ( li ) )
87100 window . addEventListener ( 'hashchange' , onHashChange )
88101 }
89102
90- function activateCurrentPath ( navItem ) {
103+ function activateCurrentPath ( navItem , trace ) {
91104 var ancestorClasses
92105 var ancestor = navItem . parentNode
93106 while ( ! ( ancestorClasses = ancestor . classList ) . contains ( 'nav-menu' ) ) {
94107 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' )
96110 }
97111 ancestor = ancestor . parentNode
98112 }
Original file line number Diff line number Diff line change 11{{ #with page.navigation }}
22<div class =" nav-panel-menu is-active" data-panel =" menu" >
33 <nav class =" nav-menu" >
4+ <button class =" nav-menu-toggle" title =" Toggle expand/collapse all" ></button >
45 {{ #with @root.page.componentVersion }}
56 <h3 class =" title" ><a href =" {{{ relativize ./url }}} " >{{ ./title }} </a ></h3 >
67 {{ /with }}
You can’t perform that action at this time.
0 commit comments