Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Make the mobile menu slide up and down
<script>
jQuery( document ).ready( function( $ ) {
$( '.menu-toggle' ).addClass( 'closed' );
$( document ).on( 'click', '.menu-toggle.closed', function() {
var sub = $( this ).next( '.main-nav' ).children( 'ul' );
sub.hide();
sub.slideDown();
$( this ).removeClass( 'closed' );
$( this ).addClass( 'opened' );
});
$( document ).on( 'click', '.menu-toggle.opened', function() {
var sub = $( this ).next( '.main-nav' ).children( 'ul' );
sub.slideUp();
$( this ).removeClass( 'opened' );
$( this ).addClass( 'closed' );
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment