This repository has been archived on 2020-05-08. You can view files and clone it, but cannot push or open issues or pull requests.
_s/js/small-menu.js

28 lines
830 B
JavaScript

jQuery( document ).ready( function( $ ) {
var $browserWidth = $( window ).width();
$.fn.smallMenu = function() {
$( '#masthead .site-navigation' ).removeClass( 'main-navigation' ).addClass( 'main-small-navigation' );
$( '#masthead .site-navigation h1' ).removeClass( 'assistive-text' ).addClass( 'menu-toggle' );
$( '.menu-toggle' ).click( function () {
$( '#masthead .menu' ).toggle( 'fast' );
});
}
$(window).resize(function() {
var $browserWidth = $( window ).width();
if ( $browserWidth < 600 ) {
$.fn.smallMenu();
} else {
$( '#masthead .site-navigation' ).removeClass( 'main-small-navigation' ).addClass( 'main-navigation' );
$( '#masthead .site-navigation h1' ).removeClass( 'menu-toggle' ).addClass( 'assistive-text' );
}
});
if ( $browserWidth < 600 ) {
$.fn.smallMenu();
}
} );