2012-02-06 16:40:54 +00:00
|
|
|
jQuery( document ).ready( function( $ ) {
|
|
|
|
var $browserWidth = $( window ).width();
|
2012-02-06 21:44:43 +00:00
|
|
|
var $masthead = $( '#masthead' );
|
2012-02-06 16:40:54 +00:00
|
|
|
|
|
|
|
$.fn.smallMenu = function() {
|
2012-02-06 21:44:43 +00:00
|
|
|
$( $masthead ).find( '.site-navigation' ).removeClass( 'main-navigation' ).addClass( 'main-small-navigation' );
|
|
|
|
$( $masthead ).find( '.site-navigation h1' ).removeClass( 'assistive-text' ).addClass( 'menu-toggle' );
|
2012-02-06 16:40:54 +00:00
|
|
|
|
|
|
|
$( '.menu-toggle' ).click( function () {
|
2012-02-06 21:44:43 +00:00
|
|
|
$( $masthead ).find( '.menu' ).toggle();
|
2012-02-07 03:20:46 +00:00
|
|
|
$( this ).toggleClass( 'toggled-on' );
|
2012-02-06 16:40:54 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
$(window).resize(function() {
|
|
|
|
var $browserWidth = $( window ).width();
|
|
|
|
|
|
|
|
if ( $browserWidth < 600 ) {
|
|
|
|
$.fn.smallMenu();
|
|
|
|
} else {
|
2012-02-06 21:44:43 +00:00
|
|
|
$( $masthead ).find( '.site-navigation' ).removeClass( 'main-small-navigation' ).addClass( 'main-navigation' );
|
|
|
|
$( $masthead ).find( '.site-navigation h1' ).removeClass( 'menu-toggle' ).addClass( 'assistive-text' );
|
|
|
|
$( $masthead ).find( '.menu' ).removeAttr( 'style' );
|
2012-02-06 16:40:54 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
if ( $browserWidth < 600 ) {
|
|
|
|
$.fn.smallMenu();
|
|
|
|
}
|
|
|
|
|
|
|
|
} );
|