PageSourceSearch

https://appspeople.dk/wp-content/themes/number-three/js/navigation.js?ver=1656316759

js appspeople.dk collected 2026-10-02 00:35:48 UTC 2,679 bytes, 92 lines download raw bytes

1/**
2 * File navigation.js.
3 *
4 * Handles toggling the navigation menu for small screens and enables TAB key
5 * navigation support for dropdown menus.
6 */
7( function($) {
8	const siteNavigation = document.getElementById( 'site-navigation' );
9	// Return early if the navigation don't exist.
10	if ( ! siteNavigation ) {
11		return;
12	}
13
14	const button = siteNavigation.getElementsByTagName( 'button' )[ 0 ];
15	// Return early if the button don't exist.
16	if ( 'undefined' === typeof button ) {
17		return;
18	}
19
20	const menu = siteNavigation.getElementsByTagName( 'ul' )[ 0 ];
21	// Hide menu toggle button if menu is empty and return early.
22	if ( 'undefined' === typeof menu ) {
23		button.style.display = 'none';
24		return;
25	}
26
27	if ( ! menu.classList.contains( 'nav-menu' ) ) {
28		menu.classList.add( 'nav-menu' );
29	}
30
31
32	const $burgerContent = $( '.number-three-burger-menu-content' );
33	// Toggle the .toggled class and the aria-expanded value each time the button is clicked.
34	$('.menu-toggle').on( 'click', function() {
35		siteNavigation.classList.toggle( 'toggled' );
36
37		if ( button.getAttribute( 'aria-expanded' ) === 'true' ) {
38			button.setAttribute( 'aria-expanded', 'false' );
39		} else {
40			button.setAttribute( 'aria-expanded', 'true' );
41		}
42
43
44		if (siteNavigation.classList.contains('toggled')) {
45			$('body').css('overflow-y', 'hidden');
46
47			$burgerContent.show(10, function() {
48				$burgerContent.addClass('active');
49			});
50		} else {
51			var timeoutAmount = parseFloat($burgerContent.css('transition-duration'));
52			timeoutAmount = timeoutAmount * 1000;
53
54			$('body').css('overflow-y', '');
55
56			$burgerContent.removeClass('active');
57			window.setTimeout(function() {
58				$burgerContent.hide(0);
59			}, timeoutAmount);
60		}
61	} );
62
63	$('.number-three-burger-menu-content').on('click', function(e) {
64		if ($(e.target).is(this) || $(e.target).is('.burger-menu-close, .burger-menu-close *'))
65			$('.menu-toggle').first().trigger('click');
66	});
67
68
69	$('.number-three-burger-menu-content .menu li').on('click', function(e) {
70		if ($(this).hasClass('active')) return true;
71		
72		if ($(this).hasClass('burger-menu-item-back')) {
73			e.stopPropagation();
74			e.preventDefault();
75
76			$(this).parent().parent().removeClass('active').parent().removeClass('active-parent');
77		} else if ($(this).hasClass('menu-item-has-children')) {
78			e.stopPropagation();
79			e.preventDefault();
80
81			$(this).addClass('active').parent().addClass('active-parent');
82		}
83	});
84
85
86	$(window).on('resize orientationchange', function() {
87		if (!$('body').hasClass('burger-menu') && siteNavigation.classList.contains('toggled')) {
88			$('body').css('overflow-y', '');
89			$('.menu-toggle').first().trigger('click');
90		}
91	});
92} )(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.