Twenty Twelve: make proper use of the cached jQuery collection in navigation.js, props mattwiebe. Fixes #20131.

git-svn-id: http://svn.automattic.com/wordpress/trunk@20017 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
lancewillett 2012-02-28 19:17:04 +00:00
parent d131a8951a
commit e3813d7b68
1 changed files with 6 additions and 6 deletions

View File

@ -8,11 +8,11 @@ jQuery( document ).ready( function( $ ) {
timeout = false; timeout = false;
$.fn.smallMenu = function() { $.fn.smallMenu = function() {
$( masthead ).find( '.site-navigation' ).removeClass( 'main-navigation' ).addClass( 'main-small-navigation' ); masthead.find( '.site-navigation' ).removeClass( 'main-navigation' ).addClass( 'main-small-navigation' );
$( masthead ).find( '.site-navigation h3' ).removeClass( 'assistive-text' ).addClass( 'menu-toggle' ); masthead.find( '.site-navigation h3' ).removeClass( 'assistive-text' ).addClass( 'menu-toggle' );
$( '.menu-toggle' ).click( function() { $( '.menu-toggle' ).click( function() {
$( masthead ).find( '.menu' ).toggle(); masthead.find( '.menu' ).toggle();
$( this ).toggleClass( 'toggled-on' ); $( this ).toggleClass( 'toggled-on' );
} ); } );
}; };
@ -32,9 +32,9 @@ jQuery( document ).ready( function( $ ) {
if ( browserWidth < 600 ) { if ( browserWidth < 600 ) {
$.fn.smallMenu(); $.fn.smallMenu();
} else { } else {
$( masthead ).find( '.site-navigation' ).removeClass( 'main-small-navigation' ).addClass( 'main-navigation' ); masthead.find( '.site-navigation' ).removeClass( 'main-small-navigation' ).addClass( 'main-navigation' );
$( masthead ).find( '.site-navigation h3' ).removeClass( 'menu-toggle' ).addClass( 'assistive-text' ); masthead.find( '.site-navigation h3' ).removeClass( 'menu-toggle' ).addClass( 'assistive-text' );
$( masthead ).find( '.menu' ).removeAttr( 'style' ); masthead.find( '.menu' ).removeAttr( 'style' );
} }
}, 200 ); }, 200 );
} ); } );