PageSourceSearch

https://ecma-international.org/wp-content/themes/enfold/config-tem…/avia-shortcodes/menu/menu.js?ver=8.1

js ecma-international.org collected 2026-09-24 07:17:18 UTC 4,026 bytes, 183 lines download raw bytes

1(function($)
2{
3	"use strict";
4	$.avia_utilities = $.avia_utilities || {};
5
6	$( function()
7    {
8		 //activates the sticky submenu
9		$.avia_utilities = $.avia_utilities || {};
10
11        if( $.avia_utilities.avia_sticky_submenu )
12		{
13			$.avia_utilities.avia_sticky_submenu();
14		}
15    });
16
17
18	$.avia_utilities.avia_sticky_submenu = function()
19	{
20		var win 		= $(window),
21			html 		= $('html').first(),
22			header  	= $('.html_header_top.html_header_sticky #header'),
23			html_margin = parseInt( $('html').first().css('margin-top'), 10),
24			setWitdth	= $('.html_header_sidebar #main, .boxed #main'),
25			menus		= $('.av-submenu-container'),
26			bordermod	= html.is('.html_minimal_header') ? 0 : 1,
27			fixed_frame	= $('.av-frame-top').height(),
28			burger_menu	= $('.av-burger-menu-main'),
29			calc_margin	= function()
30			{
31				html_margin = parseInt( html.css('margin-top'), 10);
32				if(!$('.mobile_menu_toggle:visible').length)
33				{
34					$('.av-open-submenu').removeClass('av-open-submenu');
35				}
36
37				menus.filter('.av-sticky-submenu').each(function()
38				{
39					$(this).next('.sticky_placeholder').height($(this).height());
40				});
41
42			},
43
44			calc_values	= function()
45			{
46				var content_width = setWitdth.width();
47				html_margin = parseInt( html.css('margin-top'), 10);
48				menus.width(content_width);
49			},
50
51			check = function( placeholder, no_timeout)
52			{
53				var menu_pos	= this.offset().top,
54					top_pos 	= placeholder.offset().top,
55					scrolled	= win.scrollTop(),
56					modifier 	= html_margin,
57					fixed		= false;
58
59					/**
60					 * If we have burger menu active we ignore sticking submenus
61					 */
62					if( burger_menu.is(":visible") )
63					{
64						this.css({top: 'auto', position: 'absolute'}); fixed = false;
65						return;
66					}
67
68					if(header.length)
69					{
70						modifier += header.outerHeight() + parseInt( header.css('margin-top'), 10);
71					}
72
73					if(fixed_frame)
74					{
75						modifier += fixed_frame;
76					}
77
78					if(scrolled + modifier > top_pos)
79					{
80						if(!fixed)
81						{
82							this.css({top: modifier - bordermod, position: 'fixed'}); fixed = true;
83						}
84					}
85					else
86					{
87						this.css({top: 'auto', position: 'absolute'}); fixed = false;
88					}
89
90			},
91			toggle = function(e)
92			{
93				e.preventDefault();
94
95				var clicked = $(this),
96					menu 	= clicked.siblings('.av-subnav-menu');
97
98					if(menu.hasClass('av-open-submenu'))
99					{
100						menu.removeClass('av-open-submenu');
101					}
102					else
103					{
104						menu.addClass('av-open-submenu');
105					}
106			};
107
108		win.on("debouncedresize av-height-change",  calc_margin ); calc_margin();
109
110		if(setWitdth.length)
111		{
112			win.on("debouncedresize av-height-change",  calc_values );
113			calc_values();
114		}
115
116
117		menus.each( function()
118		{
119			var menu = $(this),
120				sticky = menu.filter('.av-sticky-submenu'),
121				placeholder = menu.next('.sticky_placeholder'),
122				mobile_button = menu.find('.mobile_menu_toggle');
123
124			if( sticky.length )
125			{
126				win.on( 'scroll debouncedresize',  function()
127				{
128					window.requestAnimationFrame( check.bind( sticky, placeholder ) );
129				});
130			}
131
132			if( mobile_button.length )
133			{
134			   mobile_button.on( 'click',  toggle );
135			}
136        });
137
138
139		html.on('click', '.av-submenu-hidden .av-open-submenu li a', function()
140		{
141			var current = $(this);
142
143			var list_item = current.siblings('ul, .avia_mega_div');
144			if(list_item.length)
145			{
146				if(list_item.hasClass('av-visible-sublist'))
147				{
148				    list_item.removeClass('av-visible-sublist');
149				}
150				else
151				{
152				    list_item.addClass('av-visible-sublist');
153				}
154				return false;
155			}
156		});
157
158		$('.avia_mobile').on('click', '.av-menu-mobile-disabled li a', function()
159		{
160			var current = $(this);
161			var list_item = current.siblings('ul');
162			if(list_item.length)
163			{
164				if(list_item.hasClass('av-visible-mobile-sublist'))
165				{
166
167				}
168				else
169				{
170					$('.av-visible-mobile-sublist').removeClass('av-visible-mobile-sublist');
171				    list_item.addClass('av-visible-mobile-sublist');
172				    return false;
173				}
174
175			}
176		});
177
178
179
180	};
181
182
183}(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.