1/** 2 * Handles toggling the main navigation menu for small screens. 3 */ 4jQuery( document ).ready( function( $ ) { 5 var $masthead = $( '#masthead' ), 6 timeout = false; 7 8 $.fn.smallMenu = function() { 9 $masthead.find( '.site-navigation' ).addClass( 'main-small-navigation' ); 10 $masthead.find( '.site-navigation div.assistive-text' ).addClass( 'menu-toggle' ).removeClass('assistive-text'); 11 $masthead.find( '.site-navigation .menu-toggle a > span' ).addClass( 'inline-icon-list' ); 12 13 $( '.menu-btn' ).unbind( 'click' ).click( function() { 14 $masthead.find( '.site-navigation .menu' ).slideToggle(); 15 $( this ).toggleClass( 'toggled-on' ); 16 return false; 17 } ); 18 }; 19 20 // Check viewport width on first load. 21 if ( $( window ).width() < 720 ) 22 $.fn.smallMenu(); 23 24 // Check viewport width when user resizes the browser window. 25 $( window ).resize( function() { 26 var browserWidth = $( window ).width(); 27 28 if ( false !== timeout ) 29 clearTimeout( timeout ); 30 31 timeout = setTimeout( function() { 32 if ( browserWidth < 720 ) { 33 $.fn.smallMenu(); 34 } else { 35 $masthead.find( '.site-navigation' ).removeClass( 'main-small-navigation' ).addClass( 'site-navigation' ); 36 $masthead.find( '.site-navigation .menu-toggle a > span' ).removeClass( 'icon-list' ); 37 $masthead.find( '.site-navigation .menu-toggle' ).addClass( 'assistive-text' ).removeClass( 'menu-toggle' ); 38 $masthead.find( '.menu' ).removeAttr( 'style' ); 39 } 40 }, 200 ); 41 } ); 42} );
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.