This repository was archived by the owner on Sep 3, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +16
-25
lines changed
Expand file tree Collapse file tree 4 files changed +16
-25
lines changed Original file line number Diff line number Diff line change 1717 <h1 class="site-title"><a href="<?php echo esc_url ( home_url ( '/ ' ) ); ?> " rel="home"><?php bloginfo ( 'name ' ); ?> </a></h1>
1818 <h2 class="site-description"><?php bloginfo ( 'description ' ); ?> </h2>
1919 </div>
20+ <button id="responsive-menu-toggle"><?php _e ( 'Menu ' , 'voidx ' ); ?> </button>
2021 <nav id="site-navigation" class="site-navigation">
21- <button id="responsive-menu-toggle"><?php _e ( 'Menu ' , 'voidx ' ); ?> </button>
2222 <div id="responsive-menu"><?php wp_nav_menu ( array ( 'theme_location ' => 'header ' , 'menu_id ' => 'menu-header ' , 'menu_class ' => 'menu-inline ' ) ); ?> </div>
2323 </nav>
2424 </header>
Original file line number Diff line number Diff line change 1- // ==== RESPONSIVE NAVIGATION MENU ==== //
1+ // ==== RESPONSIVE MENU ==== //
22
33// Menu toggle script adapted from _s: https://github.com/Automattic/_s
44; ( function ( ) {
1919
2020 // Toggle navigation; add or remove a class to both the button and the nav element itself
2121 button . onclick = function ( ) {
22- if ( button . className . indexOf ( 'toggled' ) !== - 1 ) {
23- button . className = button . className . replace ( ' toggled' , '' ) ;
22+ if ( button . className . indexOf ( 'active' ) !== - 1 ) {
23+ nav . style . display = 'none' ;
24+ button . className = button . className . replace ( ' active' , '' ) ;
2425 } else {
25- button . className += ' toggled' ;
26- }
27-
28- if ( menu . className . indexOf ( 'toggled' ) !== - 1 ) {
29- menu . className = menu . className . replace ( ' toggled' , '' ) ;
30- } else {
31- menu . className += ' toggled' ;
26+ nav . style . display = 'block' ;
27+ button . className += ' active' ;
3228 }
3329 } ;
3430} ) ( ) ;
Original file line number Diff line number Diff line change 7171 @extend %spacer-below-2 ;
7272 }
7373}
74+ .site-navigation {
75+ display : none ;
76+ @include media-above ($break-medium ) {
77+ display : block !important ; // Handles an edge case where user resizes after menu is hidden on smaller screens
78+ }
79+ & .active {
80+ display : block ;
81+ }
82+ }
7483.alignright {
7584 float : right ;
7685}
Original file line number Diff line number Diff line change 2020 }
2121}
2222
23- // Responsive header menu; this container ID handles the fact that `wp_nav_menu()` defaults back to `wp_page_menu()` when no menu is active
24- #responsive-menu {
25- display : none ;
26- @include media-above ($break-medium ) {
27- display : block ;
28- }
29- & .toggled {
30- display : block ;
31- }
32- }
33-
3423// Menu toggle for mobile phones and small screens
3524#responsive-menu-toggle {
3625 @include media-above ($break-medium ) {
3726 display : none ;
3827 }
39- & .toggled {
40- display : none ;
41- }
4228}
You can’t perform that action at this time.
0 commit comments