Ticket #31527: 31527.twentythirteen.patch
File 31527.twentythirteen.patch, 1.8 KB (added by , 10 years ago) |
---|
-
wp-content/themes/twentythirteen/js/functions.js
6 6 7 7 ( function( $ ) { 8 8 var body = $( 'body' ), 9 _window = $( window ); 9 _window = $( window ), 10 nav, button, menu, tertiary; 10 11 12 nav = $( '#site-navigation' ); 13 button = nav.find( '.menu-toggle' ); 14 menu = nav.find( '.nav-menu' ); 15 tertiary = $( '#tertiary' ); 16 11 17 /** 12 18 * Adds a top margin to the footer if the sidebar widget area is higher 13 19 * than the rest of the page, to help the footer always visually clear … … 29 35 * Enables menu toggle for small screens. 30 36 */ 31 37 ( function() { 32 var nav = $( '#site-navigation' ), button, menu; 33 if ( ! nav ) { 38 if ( ! nav || ! button ) { 34 39 return; 35 40 } 36 41 37 button = nav.find( '.menu-toggle' );38 if ( ! button ) {39 return;40 }41 42 42 // Hide button if menu is missing or empty. 43 menu = nav.find( '.nav-menu' );44 43 if ( ! menu || ! menu.children().length ) { 45 44 button.hide(); 46 45 return; … … 69 68 } ); 70 69 } )(); 71 70 71 // Add or remove ARIA attributes. 72 function onResizeARIA() { 73 if ( 643 > _window.width() ) { 74 button.attr( 'aria-expanded', 'false' ); 75 tertiary.attr( 'aria-expanded', 'false' ); 76 button.attr( 'aria-controls', 'secondary' ); 77 } else { 78 button.removeAttr( 'aria-expanded' ); 79 tertiary.removeAttr( 'aria-expanded' ); 80 button.removeAttr( 'aria-controls' ); 81 } 82 } 83 84 _window 85 .on( 'load.twentythirteen', onResizeARIA ) 86 .on( 'resize.twentythirteen', function() { 87 onResizeARIA(); 88 } ); 89 72 90 /** 73 91 * Makes "skip to content" link work correctly in IE9 and Chrome for better 74 92 * accessibility.