PageSourceSearch

https://infocongo.net/wp-content/plugins/cmsmasters-mega-menu/js/jquery.megaMenu.js?ver=1.2.9

js infocongo.net collected 2026-10-02 19:09:56 UTC 4,533 bytes, 189 lines download raw bytes

1/**
2 * @package 	WordPress Plugin
3 * @subpackage 	CMSMasters Mega Menu
4 * @version 	1.2.9
5 * 
6 * Mega Menu Script
7 * Created by CMSMasters
8 * 
9 */
10
11
12var header = jQuery('#header .header_mid_inner'), 
13	nav = jQuery('#navigation');
14
15if(nav.length > 0) {
16	var nav_left = nav.offset().left, 
17		mega = nav.find('> li.menu-item-mega'), 
18		header_width = header.width(), 
19		firstRun = true, 
20		rtl = jQuery('html').attr('dir');
21
22
23	jQuery(document).ready(function() { 
24		cmsmastersMegaMenu();
25	} );
26
27
28	jQuery(window).on('debouncedresize', function () { 
29		setTimeout(function () {
30			cmsmastersMegaMenu();
31		}, 150);
32	} );
33
34
35	jQuery(window).on('debouncedscroll', function () { 
36		cmsmastersMegaMenu();
37	} );
38}
39
40function cmsmastersMegaMenu() { 
41	var win_width = jQuery(window).width(), 
42		new_header_width = header.width(), 
43		header_pad_left = Number(header.css('padding-left').replace('px', '')), 
44		header_left = header.offset().left + header_pad_left, 
45		header_right = header_left + new_header_width, 
46		new_nav_left = nav.offset().left;
47	
48	
49	if (
50		firstRun || 
51		new_header_width !== header_width || 
52		new_nav_left !== nav_left
53	) {
54		mega.each(function () { 
55			var li = jQuery(this), 
56				full = li.hasClass('menu-item-mega-fullwidth'), 
57				drop_right = li.hasClass('menu-item-dropdown-right'), 
58				li_left = li.offset().left, 
59				mega = li.find('> div');
60			
61			
62			if (mega.length === 1) {
63				var mega_width = mega.outerWidth(), 
64					mega_left = mega.offset().left, 
65					mega_right = mega_left + mega_width;
66				
67				
68				if (full) {
69					mega.css( { 
70						width : 	new_header_width + 'px', 
71						right : 	'auto', 
72						left : 		'-' + (li_left - header_left) + 'px' 
73					} );
74				} else {
75					if (mega_width >= new_header_width) {
76						li.addClass('menu-item-mega-fullwidth menu-item-mega-dynamic-fullwidth').find('> div').css( { 
77							width : 	new_header_width + 'px', 
78							right : 	'auto', 
79							left : 		'-' + ((typeof(rtl) === 'undefined') ? (li_left - header_left) : (mega_right - header_right)) + 'px' 
80						} );
81					} else {
82						if (drop_right) {
83							if (typeof(rtl) === 'undefined') {
84								if (mega_left < header_left) {
85									mega.css( { 
86										right : 	'auto', 
87										left : 		'-' + (li_left - header_left) + 'px' 
88									} );
89								}
90							} else {
91								if (mega_right > header_right) {
92									mega.css( { 
93										left : 	'-' + (mega_right - header_right) + 'px' 
94									} );
95								}
96							}
97						} else {
98							if (typeof(rtl) === 'undefined') {
99								if (mega_right > header_right) {
100									mega.css( { 
101										left : 	'-' + (mega_right - header_right) + 'px' 
102									} );
103								} else if (mega_left < header_left) {
104									mega.css( { 
105										left : 	'-' + (li_left - header_left) + 'px' 
106									} );
107								}
108							} else {
109								if (mega_left < header_left) {
110									mega.css( { 
111										right : 	'auto', 
112										left : 		'-' + (li_left - header_left) + 'px' 
113									} );
114								}
115							}
116						}
117					}
118				}
119				
120				
121				if (win_width < 1008) {
122					mega.css( { 
123						width : 	'', 
124						right : 	'', 
125						left : 		'' 
126					} );
127					
128					
129					mega.find('a').each(function () { 
130						var a_style = jQuery(this).attr('style'), 
131							span_tag = jQuery(this).find('span');
132						
133						
134						jQuery(this).removeAttr('style').attr('data-style', a_style);
135						
136						
137						span_tag.each(function () { 
138							var span_style = jQuery(this).attr('style');
139							
140							
141							jQuery(this).removeAttr('style').attr('data-style', span_style);
142						} );
143					} );
144				} else {
145					mega.find('a').each(function () { 
146						var a_style = jQuery(this).attr('data-style'), 
147							span_tag = jQuery(this).find('span');
148						
149						
150						jQuery(this).removeAttr('data-style').attr('style', a_style);
151						
152						
153						span_tag.each(function () { 
154							var span_style = jQuery(this).attr('data-style');
155							
156							
157							jQuery(this).removeAttr('data-style').attr('style', span_style);
158						} );
159					} );
160				}
161			}
162		} );
163		
164		
165		nav_left = new_nav_left;
166	}
167	
168	
169	firstRun = false;
170}
171
172
173function cmsmastersMegaMenuDestroy() { 
174	mega.each(function () { 
175		var li = jQuery(this), 
176			mega = li.find('> div');
177		
178		
179		mega.css( { 
180			width : 	'', 
181			right : 	'', 
182			left : 		'' 
183		} );
184	} );
185	
186	
187	firstRun = true;
188}
189

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.