PageSourceSearch

https://studiobloc.de/wp-content/themes/sequential/js/navigation.js?ver=20141022

js studiobloc.de collected 2026-10-08 07:20:19 UTC 2,266 bytes, 87 lines download raw bytes

1/**
2 * navigation.js
3 *
4 * Handles toggling the navigation menu for small screens.
5 */
6( function( $ ) {
7
8	var main_navigation = $( '.main-navigation' );
9
10	function menu_responsive() {
11
12		var elements_width = $( '.site-branding' ).width() + main_navigation.width() + 72,
13		    wrapper_width = $( '.site-header > .wrapper' ).width();
14
15		if ( elements_width > wrapper_width && $( window ).width() >= 1020 ) {
16			$( 'body' ).addClass( 'menu-left' );
17		} else {
18			$( 'body' ).removeClass( 'menu-left' );
19		}
20
21		if ( $( window ).width() < 1020 ) {
22			$( '.site-branding' ).css( 'width', '100%' )
23			                     .css( 'width', '-=72px' );
24		} else {
25			$( '.site-branding' ).css( 'width', '' )
26		}
27
28		$( '.main-navigation .page_item_has_children > a, .main-navigation .menu-item-has-children > a' ).addClass( 'dropdown-link' );
29
30		$( '.dropdown-link' ).each( function() {
31
32			if ( $( this ).children( '.dropdown-toggle' ).length === 0 ) {
33				$( this ).append( '<button class="dropdown-toggle" aria-expanded="false" />' );
34			}
35			if ( $( window ).width() >= 1020 ) {
36				$( this ).children( '.dropdown-toggle' ).remove();
37			}
38
39		} );
40
41	}
42
43	function menu_toggles() {
44
45		$( '.menu-toggle' ).click( function( e ) {
46
47			e.preventDefault();
48			if ( main_navigation.hasClass( 'toggled' ) ) {
49				$( this ).attr( 'aria-expanded', 'false' );
50				main_navigation.removeClass( 'toggled' );
51			} else {
52				$( this ).attr( 'aria-expanded', 'true' );
53				main_navigation.addClass( 'toggled' );
54			}
55
56		} );
57
58		$( '.dropdown-toggle' ).click( function( e ) {
59
60			e.preventDefault();
61			if ( $( this ).hasClass( 'toggle-on' ) ) {
62				$( this ).attr( 'aria-expanded', 'false' );
63				$( this ).removeClass( 'toggle-on' );
64				$( this ).parent( 'a' ).removeClass( 'toggle-on' );
65				$( this ).parent().next( '.sub-menu' ).removeClass( 'toggle-on' );
66			} else {
67				$( this ).attr( 'aria-expanded', 'true' );
68				$( this ).addClass( 'toggle-on' );
69				$( this ).parent( 'a' ).addClass( 'toggle-on' );
70				$( this ).parent().next( '.sub-menu' ).addClass( 'toggle-on' );
71			}
72
73		} );
74
75	}
76
77	function sequential_menu() {
78
79		menu_responsive();
80		menu_toggles();
81
82	}
83
84	$( document ).ready( sequential_menu );
85	$( window ).resize( _.debounce( menu_responsive, 100 ) );
86
87} )( 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.