Skip to content

Instantly share code, notes, and snippets.

@chrismcintosh
Created July 15, 2016 15:19
Show Gist options
  • Save chrismcintosh/b659b0802d9789f8d3d67a7274fd5359 to your computer and use it in GitHub Desktop.
Save chrismcintosh/b659b0802d9789f8d3d67a7274fd5359 to your computer and use it in GitHub Desktop.
setupMenus();
$( window ).resize( function() {
setupMenus();
});
function setupMenus () {
if ( window.innerWidth <= 768 ) {
$( 'ul.menu-secondary > li' ).addClass('moved-item'); //tag moved items so we can move them back
$( 'ul.menu-secondary > li' ).appendTo( 'ul.menu-primary' );
$( '.nav-secondary' ).hide();
}
if ( window.innerWidth > 768 ) {
$( '.nav-primary .genesis-nav-menu, nav .sub-menu' ).removeAttr( 'style' );
$( '.responsive-menu > .menu-item' ).removeClass( 'menu-open' );
$( '.nav-secondary' ).show();
$( 'ul.menu-primary > li.moved-item' ).appendTo( 'ul.menu-secondary' );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment