HEX
Server: nginx/1.24.0
System: Linux nowruzgan 6.8.0-57-generic #59-Ubuntu SMP PREEMPT_DYNAMIC Sat Mar 15 17:40:59 UTC 2025 x86_64
User: babak (1000)
PHP: 8.3.6
Disabled: NONE
Upload Files
File: /var/www/meysamkiani.com/root/wp-content/themes/libretto/js/navigation.js
/**
 * navigation.js
 *
 * Handles toggling the navigation menu for small screens.
 */

( function( $ ) {
	var windowWidth = $( window ).width();

	/* Drop menu down from top of screen */
	$( '.menu-toggle' ).on( 'click', function() {
		var menu = $( this ).parent().find( '.menu-wrapper' );
		menu.toggleClass( 'menu-visible' );
		$( this ).find( '#menu-icon' ).toggleClass( 'open' );
	});

	/* Open sub-menus if we're using the teeny menu */
	if ( $( '.menu-toggle' ).is( ':visible' ) ) {
		$( '.menu-item-has-children > a' ).on( 'click', function() {
			$( this ).parent().children( '.sub-menu' ).toggleClass( 'menu-visible' );
			return false;
		});
	}

	/* Make sure to show the sub-menu on page resize */
	$( window ).resize( function() {

		// Prevent the following code from getting triggered when scrolling on mobile devices
		if ( windowWidth !== $( window ).width() ) {
			var menu = $( '.menu-toggle' ).parent().find( '.menu-wrapper' );
			menu.removeClass( 'menu-visible' );
			$( '#menu-icon' ).removeClass( 'open' );
		}

		windowWidth = $( window ).width();
	});

} )( jQuery );