Changeset 31784
- Timestamp:
- 03/15/2015 07:59:53 PM (10 years ago)
- Location:
- trunk/src/wp-content/themes/twentyfourteen
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-content/themes/twentyfourteen/functions.php
r31453 r31784 261 261 } 262 262 263 wp_enqueue_script( 'twentyfourteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '201 40616', true );263 wp_enqueue_script( 'twentyfourteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20150315', true ); 264 264 } 265 265 add_action( 'wp_enqueue_scripts', 'twentyfourteen_scripts' ); -
trunk/src/wp-content/themes/twentyfourteen/header.php
r29842 r31784 52 52 <button class="menu-toggle"><?php _e( 'Primary Menu', 'twentyfourteen' ); ?></button> 53 53 <a class="screen-reader-text skip-link" href="#content"><?php _e( 'Skip to content', 'twentyfourteen' ); ?></a> 54 <?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu' ) ); ?>54 <?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu', 'menu_id' => 'primary-menu' ) ); ?> 55 55 </nav> 56 56 </div> -
trunk/src/wp-content/themes/twentyfourteen/js/functions.js
r28758 r31784 8 8 ( function( $ ) { 9 9 var body = $( 'body' ), 10 _window = $( window ); 10 _window = $( window ), 11 nav, button, menu; 12 13 nav = $( '#primary-navigation' ); 14 button = nav.find( '.menu-toggle' ); 15 menu = nav.find( '.nav-menu' ); 11 16 12 17 // Enable menu toggle for small screens. 13 18 ( function() { 14 var nav = $( '#primary-navigation' ), button, menu; 15 if ( ! nav ) { 16 return; 17 } 18 19 button = nav.find( '.menu-toggle' ); 20 if ( ! button ) { 19 if ( ! nav || ! button ) { 21 20 return; 22 21 } 23 22 24 23 // Hide button if menu is missing or empty. 25 menu = nav.find( '.nav-menu' );26 24 if ( ! menu || ! menu.children().length ) { 27 25 button.hide(); … … 29 27 } 30 28 31 $( '.menu-toggle' ).on( 'click.twentyfourteen', function() {29 button.on( 'click.twentyfourteen', function() { 32 30 nav.toggleClass( 'toggled-on' ); 31 if ( nav.hasClass( 'toggled-on' ) ) { 32 $( this ).attr( 'aria-expanded', 'true' ); 33 menu.attr( 'aria-expanded', 'true' ); 34 } else { 35 $( this ).attr( 'aria-expanded', 'false' ); 36 menu.attr( 'aria-expanded', 'false' ); 37 } 33 38 } ); 34 39 } )(); … … 110 115 } ); 111 116 117 // Add or remove ARIA attributes. 118 function onResizeARIA() { 119 if ( 781 > _window.width() ) { 120 button.attr( 'aria-expanded', 'false' ); 121 menu.attr( 'aria-expanded', 'false' ); 122 button.attr( 'aria-controls', 'primary-menu' ); 123 } else { 124 button.removeAttr( 'aria-expanded' ); 125 menu.removeAttr( 'aria-expanded' ); 126 button.removeAttr( 'aria-controls' ); 127 } 128 } 129 130 _window 131 .on( 'load.twentyfourteen', onResizeARIA ) 132 .on( 'resize.twentyfourteen', function() { 133 onResizeARIA(); 134 } ); 135 112 136 _window.load( function() { 113 137 // Arrange footer widgets vertically.
Note: See TracChangeset
for help on using the changeset viewer.