PageSourceSearch

https://pcs-nj.com/wp-content/themes/ztudiox/js/script-core.js?ver=1.0.0

js pcs-nj.com collected 2026-10-06 20:49:44 UTC 33,485 bytes, 1,112 lines download raw bytes

1(function($){
2	"use strict";
3
4	var ztudiox_display = 'desktop';
5	if( typeof(window.matchMedia) == 'function' ){
6		$(window).on('resize ztudiox-set-display', function(){
7			if( window.matchMedia('(max-width: 419px)').matches ){
8				ztudiox_display = 'mobile-portrait';
9			}else if( window.matchMedia('(max-width: 767px)').matches ){
10				ztudiox_display = 'mobile-landscape'
11			}else if( window.matchMedia('(max-width: 959px)').matches ){
12				ztudiox_display = 'tablet'
13			}else{
14				ztudiox_display = 'desktop';
15			}
16		});
17		$(window).trigger('ztudiox-set-display');
18	}else{
19		$(window).on('resize ztudiox-set-display', function(){
20			if( $(window).innerWidth() <= 419 ){
21				ztudiox_display = 'mobile-portrait';
22			}else if( $(window).innerWidth() <= 767 ){
23				ztudiox_display = 'mobile-landscape'
24			}else if( $(window).innerWidth() <= 959 ){
25				ztudiox_display = 'tablet'
26			}else{
27				ztudiox_display = 'desktop';
28			}
29		});
30		$(window).trigger('ztudiox-set-display');
31	}
32
33	// ref : http://unscriptable.com/2009/03/20/debouncing-javascript-methods/
34	// ensure 1 is fired
35	var ztudiox_debounce = function(func, threshold, execAsap){
36		
37		var timeout;
38
39		return function debounced(){
40			
41			var obj = this, args = arguments;
42			
43			function delayed(){
44				if( !execAsap ){
45					func.apply(obj, args);
46				}
47				timeout = null;
48			};
49
50			if( timeout ){
51				clearTimeout(timeout);
52			}else if( execAsap ){
53				func.apply(obj, args);
54			}
55			timeout = setTimeout(delayed, threshold);
56		};
57	}	
58	
59	// reduce the event occurance
60	var ztudiox_throttling = function(func, threshold){
61		
62		var timeout;
63
64		return function throttled(){
65			var obj = this, args = arguments;
66			
67			function delayed(){
68				func.apply(obj, args);
69				timeout = null;
70			};
71
72			if( !timeout ){
73				timeout = setTimeout(delayed, threshold);
74			}
75		};
76	}	
77
78	/////////////////////////
79	// menu handle function
80	/////////////////////////
81	var ztudiox_sf_menu = function( menu ){
82
83		if( menu.length == 0 ) return;
84
85		this.main_menu = menu;
86
87		this.slide_bar = this.main_menu.children('.ztudiox-navigation-slide-bar');
88		this.slide_bar_offset = '3';
89
90		this.current_menu = this.main_menu.children('.sf-menu').children('.current-menu-item, .current-menu-ancestor').children('a');
91		
92		this.init();
93		
94	} // ztudiox_sf_menu
95
96	ztudiox_sf_menu.prototype = {
97		
98		init: function(){
99			
100			var t = this;
101			
102			// sf menu mod
103			t.sf_menu_mod();
104			
105			// init superfish menu
106			if(typeof($.fn.superfish) == 'function'){
107				t.main_menu.superfish({ delay: 400, speed: 'fast' });	
108				
109				t.sf_menu_position();
110				$(window).resize(ztudiox_debounce(function(){
111					t.sf_menu_position();
112				}, 300));
113			}
114			
115			// init the slidebar
116			if( t.slide_bar.length > 0 ){
117				t.init_slidebar();
118			}
119			
120		}, // init
121		
122		sf_menu_mod: function(){
123			
124			// create the mega menu script
125			this.main_menu.find('.sf-mega > ul').each(function(){	
126				var mega_content = $('<div></div>');
127				var mega_row = $('<div class="sf-mega-section-wrap" ></div>');
128				var mega_column_size = 0;
129				
130				$(this).children('li').each(function(){
131					var column_size = parseInt($(this).attr('data-size'));
132					if( mega_column_size + column_size  <= 60 ){
133						mega_column_size += column_size;
134					}else{	
135						mega_column_size = column_size;
136						mega_content.append(mega_row);
137						mega_row = $('<div class="sf-mega-section-wrap" ></div>');
138					}
139					
140					mega_row.append( $('<div class="sf-mega-section" ></div>')
141						.addClass('ztudiox-column-' + column_size)
142						.html( $('<div class="sf-mega-section-inner" ></div>')
143							.addClass($(this).attr('class'))
144							.attr('id', $(this).attr('id'))
145							.html($(this).html())
146						)
147					);
148				});
149				
150				mega_content.append(mega_row);
151				$(this).replaceWith(mega_content.html());
152			});
153			
154		}, // sf_menu_mod
155		
156		sf_menu_position: function(){
157
158			if( ztudiox_display == 'mobile-landscape' || ztudiox_display == 'mobile-portrait' || ztudiox_dis
158play == 'tablet' ) return;
159
160			// submenu of normal menu
161			var body_wrapper = $('.ztudiox-body-wrapper');
162			var sub_normal_menu = this.main_menu.find('.sf-menu > li.ztudiox-normal-menu .sub-menu');
163			
164			sub_normal_menu.css({display: 'block'}).removeClass('sub-menu-right');
165			sub_normal_menu.each(function(){
166				if( $(this).offset().left + $(this).width() > body_wrapper.outerWidth() ){
167					$(this).addClass('sub-menu-right');
168				}
169			});
170			sub_normal_menu.css({display: 'none'});
171			
172			// submenu of mega menu
173			this.main_menu.find('.sf-menu > li.ztudiox-mega-menu .sf-mega').each(function(){
174				if( !$(this).hasClass('sf-mega-full') ){
175					
176					$(this).css({ display: 'block' });
177					
178					// set the position
179					$(this).css({ right: '', 'margin-left': -(($(this).width() - $(this).parent().outerWidth()) / 2) });
180					
181					// if exceed the screen
182					if( $(this).offset().left + $(this).width() > $(window).width() ){
183						$(this).css({ right: 0, 'margin-left': '' });
184					}
185					
186					$(this).css({ display: 'none' });
187				}
188				
189			});
190			
191		}, // sf_menu_position
192		
193		init_slidebar: function(){
194			
195			var t = this;
196			
197			t.animate_slidebar(t.current_menu);
198			$(window).load(function(){ t.animate_slidebar(t.current_menu); });
199			
200			// animate slidebar 
201			t.main_menu.children('.sf-menu').children('li').on({
202				mouseenter: function(){
203					var nav_element = $(this).children('a');
204					t.animate_slidebar(nav_element);
205				}, 
206				mouseleave: function(){
207					t.animate_slidebar(t.current_menu);
208				}
209			});
210			
211			// window resize event
212			$(window).on('resize', function(){ t.animate_slidebar(t.current_menu); });
213			$(window).on('ztudiox-navigation-slider-bar-init', function(){ 
214				t.current_menu = t.main_menu.children('.sf-menu').children('.current-menu-item, .current-menu-ancestor').children('a');
215				t.animate_slidebar(t.current_menu); 
216			});
217			$(window).on('ztudiox-navigation-slider-bar-animate', function(){ t.animate_slidebar(t.current_menu); });
218			
219		}, // init_slidebar
220
221		animate_slidebar: function( target ){
222			var t = this;
223
224			if( !target.length ){
225				t.slide_bar.css({ width: 0 });
226				return;
227			}
228
229			t.slide_bar.css({ 
230				width: 0, 
231				top: target.position().top + (target.height() * 0.6), 
232				left: target.position().left + (target.outerWidth() / 2),
233				display: 'block'
234			});
235
236			t.slide_bar.animate({ 
237				width: target.outerWidth() + (2 * t.slide_bar_offset),
238				left: target.position().left - t.slide_bar_offset
239			}, { duration: 200, queue: false });
240		},
241		
242	}; // ztudiox_sf_menu.prototype
243	
244	/////////////////////////
245	// mobile menu
246	/////////////////////////
247	$.fn.ztudiox_mobile_menu = function( args ){
248		
249		var menu_button = $(this).siblings('.ztudiox-mm-menu-button');
250		var options = {
251			navbar: { title: '<span class="mmenu-custom-close" ></span>' },
252			extensions: [ 'pagedim-black' ],
253
254		};
255		var extensions = { 
256			offCanvas: { pageNodetype: '.ztudiox-body-outer-wrapper' } 
257		};
258
259		// remove the wrap for submenu
260		$(this).find('a[href="#"]').each(function(){
261			var content = $(this).html();
262			$('<span class="ztudiox-mm-menu-blank" ></span>').html(content).insertBefore($(this));
263			$(this).remove();
264		});
265		
266		if( $(this).attr('data-slide') ){
267			var html_class = 'ztudiox-mmenu-' + $(this).attr('data-slide');
268			$('html').addClass(html_class);
269
270			options.offCanvas = { position : $(this).attr('data-slide') };
271		}		
272		
273		$(this).mmenu(options, extensions);
274
275		var menu_api = $(this).data('mmenu');
276		$(this).find('a').not('.mm-next, .mm-prev').on('click', function(){
277			menu_api.close();
278		});
279		$(this).find('.mmenu-custom-close').on('click', function(){
280			menu_api.close();
281		});
282		$(window).resize(function(){
283			menu_api.close();
284		});
285
286		// add class active to button
287		menu_api.bind('open', function($panel){
288			menu_button.addClass('ztudiox-active');
289		});
290		menu_api.bind('close', function($panel){
291			menu_button.removeClass('ztudiox-active');
292		});
293
294	}	
295
296	/////////////////////////
297	// overlay menu
298	/////////////////////////
299	var ztudiox_overlay_menu = function( menu ){
300
301		this.menu = menu;
302		this.menu_button = menu.children('.ztudiox-overlay-menu-icon');
303		this.menu_content = menu.children('.ztudiox-overlay-menu-content');
304		this.menu_close = this.menu_content.children('.ztudiox-overlay-menu-close');
305
306		this.init();
307	}
308	ztudiox_overlay_menu.prototype = {
309		
310		init: function(){
311
312			var t = this;
313
314			// add transition delay for each menu
315			var delay_count = 0;
316			t.menu_content.appendTo('body');
317			t.menu_content.find('ul.menu > li').each(function(){
318				$(this).css('transition-delay', (delay_count * 150) + 'ms');
319
320				delay_count++;
321			});
322
323			// bind the menu button
324			t.menu_button.on('click', function(){
325				$(this).addClass('ztudiox-active');
326
327				t.menu_content.fadeIn(200, function(){
328					$(this).addClass('ztudiox-active');
329				});
330
331				return false;
332			});
333
334			// bind the menu close button
335			t.menu_close.on('click', function(){
336				t.menu_button.removeClass('ztudiox-active');
337
338				t.menu_content.fadeOut(400, function(){
339					$(this).removeClass('ztudiox-active');
340				});
341				t.menu_content.find('.sub-menu').slideUp(200).removeClass('ztudiox-active');
342
343				return false;
344			});
345
346			// menu item click
347			t.menu_content.find('a').on('click', function(e){ 
348				var sub_menu = $(this).siblings('.sub-menu');
349				if( sub_menu.length > 0 ){
350					if( !sub_menu.hasClass('ztudiox-active') ){
351						var prev_active = sub_menu.closest('li').siblings().find('.sub-menu.ztudiox-active');
352						if( prev_active.length > 0 ){
353							prev_active.removeClass('ztudiox-active').slideUp(150);
354							sub_menu.delay(150).slideDown(400, 'easeOutQuart').addClass('ztudiox-active');
355						}else{
356							sub_menu.slideDown(400, 'easeOutQuart').addClass('ztudiox-active');
357						}
358
359						$(this).addClass('ztudiox-no-preload');
360						return false;
361					}else{
362						$(this).removeClass('ztudiox-no-preload');
363					}
364				}else{
365					t.menu_close.trigger('click');
366				}
367			});
368
369		}
370
371	}; // ztudiox_overlay_menu.prototype
372
373	/////////////////////////
374	// header side navigation
375	/////////////////////////
376	var ztudiox_header_side_nav = function( side_nav ){
377
378		if( side_nav.length == 0 ) return;
379
380		this.prev_scroll = 0;
381
382		this.side_nav = side_nav;
383		this.side_nav_content = side_nav.children();
384
385		this.init();
386
387	} // ztudiox_header_side_nav
388
389	ztudiox_header_side_nav.prototype = {
390
391		init: function(){
392
393			var t = this;
394
395			t.init_nav_bar_element();
396
397			$(window).resize(function(){ 
398				t.init_nav_bar_element();
399			});
400			
401			$(window).scroll(function(){
402
403				if( ztudiox_display == 'mobile-landscape' || ztudiox_display == 'mobile-portrait' || ztudiox_display == 'tablet' ) return;
404
405				// if content longer than screen height
406				if( t.side_nav.hasClass('ztudiox-allow-slide') ){
407
408					var admin_bar_height = parseInt($('html').css('margin-top'));
409					var scroll_down = ($(window).scrollTop() > t.prev_scroll);
410					t.prev_scroll = $(window).scrollTop();
411
412					// if scroll down
413					if( scroll_down ){
414
415						if( !t.side_nav.hasClass('ztudiox-fix-bottom') ){
416							if( t.side_nav.hasClass('ztudiox-fix-top') ){
417								t.side_nav.css('top', t.side_nav.offset().top);
418								t.side_nav.removeClass('ztudiox-fix-top');
419
420							}else if( $(window).height() + $(window).scrollTop() > t.side_nav_content.offset().top + t.side_nav_content.outerHeight() ){ 
421								if( !t.side_nav.hasClass('ztudiox-fix-bottom') ){
422									t.side_nav.addClass('ztudiox-fix-bottom');
423									t.side_nav.css('top', '');
424								}
425							}
426						}
427
428					// if scroll up
429					}else{
430
431						if( !t.side_nav.hasClass('ztudiox-fix-top') ){
432							if( t.side_nav.hasClass('ztudiox-fix-bottom') ){
433								var top_pos = $(window).scrollTop() + ($(window).height() - admin_bar_height) - t.side_nav_content.outerHeight();
434								t.side_nav.css('top', top_pos);
435								t.side_nav.removeClass('ztudiox-fix-bottom');
436
437							}else if( $(window).scrollTop() + admin_bar_height < t.side_nav_content.offset().top ){ 
438								if( !t.side_nav.hasClass('ztudiox-fix-top') ){
439									t.side_nav.addClass('ztudiox-fix-top');
440									t.side_nav.css('top', '');
441								}
442							}
443						}
444					
445					}
446
447				}
448			});
449
450		},
451
452		init_nav_bar_element: function(){
453
454			if( ztudiox_display == 'mobile-landscape' || ztudiox_display == 'mobile-portrait' || ztudiox_display == 'tablet' ) return;
455
456			var t = this;
457			var middle_pos = t.side_nav_content.children('.ztudiox-pos-middle').addClass('ztudiox-active');
458			var bottom_pos = t.side_nav_content.children('.ztudiox-pos-bottom').addClass('ztudiox-active');
459
460			// remove all additional space
461			t.side_nav_content.children('.ztudiox-pre-spaces').remove();
462
463			// add class depends on the screen size/content
464			if( $(window).height() < t.side_nav_content.height() ){
465				t.side_nav.addClass('ztudiox-allow-slide');
466			}else{
467				t.side_nav.removeClass('ztudiox-allow-slide ztudiox-fix-top ztudiox-fix-bottom').css('top', '');
468
469				// set the middle position
470				if( t.side_nav.hasClass('ztudiox-style-middle') ){
471					middle_pos.each(function(){
472						var top_padding = parseInt($(this).css('padding-top'));
473						var prespace = ((t.side_nav.height() - (t.side_nav_content.height() - top_padding)) / 2) - top_padding;
474
475						if( prespace > 0 ){
476							$('<div class="ztudiox-pre-spaces" ></div>').css('height', prespace).insertBefore($(this));
477						}
478					});
479				}
480
481				// set the bottom position
482				bottom_pos.each(function(){
483					var prespace = t.side_nav.height() - t.side_nav_content.height();
484
485					if( prespace > 0 ){
486						$('<div class="ztudiox-pre-spaces" ></div>').css('height', prespace).insertBefore($(this));
487					}
488				});
489
490			}
491		}
492
493	}; // ztudiox_sf_menu.prototype
494
495	/////////////////////////
496	// anchoring
497	/////////////////////////	
498
499	var ztudiox_anchor = function(){
500
501		this.anchor_link = $('a[href*="#"]').not('[href="#"]').filter(function(){
502
503			// for mm-menu plugin
504			if( $(this).is('.ztudiox-mm-menu-button, .mm-next, .mm-prev, .mm-title, .gdlr-core-ilightbox') ){
505				return false;
506			}
507
508			// for additional plugins
509			if( $(this).is('.fbx-btn-transition') ){
510				return false;
511			}
512
513			// for woocommerce
514			if( $(this).parent('.description_tab, .reviews_tab').length || $(this).not('[class^="ztudiox"]').closest('.woocommerce').length ){
515				return false;
516			}
517
518			return true;
519		});
520
521		if( this.anchor_link.length ){
522			this.menu_anchor = $('#ztudiox-main-menu, #ztudiox-bullet-anchor');
523			this.home_anchor = this.menu_anchor.find('ul.sf-menu > li.current-menu-item > a, ul.sf-menu > li.current-menu-ancestor > a, .ztudiox-bullet-anchor-link.current-menu-item');
524
525			this.init();
526		}
527	}
528	ztudiox_anchor.prototype = {
529
530		init: function(){
531
532			var t = this;
533
534			t.animate_anchor();
535			t.scroll_section();
536
537			// init bullet anchor height
538			t.menu_anchor.filter('#ztudiox-bullet-anchor').each(function(){
539				$(this).css('margin-top', - t.menu_anchor.height() / 2).addClass('ztudiox-init');
540			});
541
542			// initialize if the page hash exists
543			// wait for all element to initialize ( eg. flexslider )
544			var url_hash = window.location.hash;
545			if( url_hash ){
546				setTimeout(function(){
547
548					var current_menu = t.menu_anchor.find('a[href*="' + url_hash + '"]');
549					if( !current_menu.is('.current-menu-item, .current-menu-ancestor') ){
550						current_menu.addClass('current-menu-item').siblings().removeClass('current-menu-item current-menu-ancestor');
551
552						$(window).trigger('ztudiox-navigation-slider-bar-init');
553					}
554
555					t.scroll_to(url_hash, false, 300);
556				}, 500);
557			}
558	
559		},
560
561		animate_anchor: function(){
562
563			var t = this;
564
565			// home anchor
566			t.home_anchor.on('click', function(){
567
568				if( window.location.href == this.href ){
569					$('html, body').animate({ scrollTop: 0 }, { duration: 1500, easing: 'easeOutQuart' });
570					return false;
571				}
572				
573			});
574
575			// normal anchor
576			t.anchor_link.on('click', function() {
577				if( location.hostname == this.hostname && location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') ){
578					return t.scroll_to(this.hash, true);
579				}
580			});
581
582		}, // animate anchor
583
584		scroll_to: function( hash, redirect, duration ){
585
586			// start scrolling
587			if( hash == '#ztudiox-top-anchor' ){
588				var scroll_position = 0;
589			}else{
590				
591				var target = $(hash);
592
593				if( target.length ){
594					var scroll_position = target.offset().top;
595				}
596			}
597
598			if( typeof(scroll_position) != 'undefined' ){
599
600				// offset for wordpress admin bar
601				scroll_position = scroll_position - parseInt($('html').css('margin-top'));
602
603				// offset for fixed nav bar
604				if( ztudiox_display == 'mobile-portrait' || ztudiox_display == 'mobile-landscape' ){
605					scroll_position = scroll_position - 75;
606				}else if( typeof(window.ztudiox_anchor_offset) != 'undefined' ){
607					scroll_position = scroll_position - parseInt(window.ztudiox_anchor_offset);
608				}
609
610				if( scroll_position < 0 ) scroll_position = 0;
611
612				$('html, body').animate({ scrollTop: scroll_position }, { duration: 1500, easing: 'easeOutQuart', queue: false });
613
614				return false;
615
616			}else if( redirect ){
617
618				window.location.href = ztudiox_script_core.home_url + hash;
619
620				return false;
621			}
622
623		}, // scroll to
624
625		scroll_section: function(){
626
627			var t = this;
628
629			// have anchor in anchor menu
630			var menu_link_anchor = this.menu_anchor.find('a[href*="#"]').not('[href="#"]');
631			if( !menu_link_anchor.length ){ return; }
632
633			// get anchor section
634			var home_anchor_section = $('#ztudiox-page-wrapper');
635			var anchor_section = home_anchor_section.find('div[id], section[id]');
636			if( !anchor_section.length ){ return; }
637
638			// add data for faster query
639			menu_link_anchor.each(function(){
640				if( $(this).closest('.sub-menu').length == 0 && $(this.hash).length ){
641					$(this).attr('data-anchor', this.hash);
642				}
643			});
644
645			// check section on scroll event
646			$(window).scroll(function(){
647
648				if( ztudiox_display == 'mobile-landscape' || ztudiox_display == 'mobile-portrait' || ztudiox_display == 'tablet' ) return;
649				
650				if( t.home_anchor.length && $(window).scrollTop() <= home_anchor_section.offset().top ){
651
652					t.home_anchor.each(function(){
653						if( $(this).hasClass('ztudiox-bullet-anchor-link') ){
654							$(this).addClass('current-menu-item').siblings().removeClass('current-menu-item');
655							$(this).parent('.ztudiox-bullet-anchor').attr('data-anchor-section', 'ztudiox-home');
656						}else if( !$(this).parent('.current-menu-item, .current-menu-ancestor').length ){
657							$(this).parent().addClass('current-menu-item').siblings().removeClass('current-menu-item current-menu-ancestor');
658							$(window).trigger('ztudiox-navigation-slider-bar-init');
659						}			
660					});
661
662				}else{
663					var section_position = $(window).scrollTop() + ($(window).height() / 2);
664
665					anchor_section.each(function(){
666						if( $(this).css('display') == 'none' ) return;
667						
668						var top_offset_pos = $(this).offset().top;
669
670						if( (section_position > top_offset_pos) && (section_position <  top_offset_pos + $(this).outerHeight()) ){
671							var section_id = $(this).attr('id');
672							menu_link_anchor.filter('[data-anchor="#' +  section_id + '"]').each(function(){
673								if( $(this).hasClass('ztudiox-bullet-anchor-link') ){
674									$(this).addClass('current-menu-item').siblings().removeClass('current-menu-item');
675									$(this).parent('.ztudiox-bullet-anchor').attr('data-anchor-section', section_id);
676								}else if( $(this).parent('li.menu-item').length && !$(this).parent('li.menu-item').is('.current-menu-item, .current-menu-ancestor') ){
677									$(this).parent('li.menu-item').addClass('current-menu-item').siblings().removeClass('current-menu-item current-menu-ancestor');
678									$(window).trigger('ztudiox-navigation-slider-bar-init');
679								}
680							});
681							
682							return false;
683						}
684
685					});
686				}
687
688			});
689
690		} // scroll section
691
692	};
693
694	var ztudiox_sticky_navigation = function(){
695
696		var t = this;
697
698		// get navigation
699		t.sticky_nav = $('.ztudiox-with-sticky-navigation .ztudiox-sticky-navigation');
700		t.mobile_menu = $('#ztudiox-mobile-header');
701
702		// set the anchor offset
703		if( t.sticky_nav.hasClass('ztudiox-sticky-navigation-height') ){
704			window.ztudiox_anchor_offset = t.sticky_nav.outerHeight();
705			$(window).resize(function(){
706				window.ztudiox_anchor_offset = t.sticky_nav.outerHeight();
707			});
708		}else if( t.sticky_nav.attr('data-navigation-offset') ){
709			window.ztudiox_anchor_offset = parseInt(t.sticky_nav.attr('data-navigation-offset'));
710		}else if( t.sticky_nav.length ){
711			window.ztudiox_anchor_offset = 75;
712		}
713
714		// init the sticky navigation
715		if( t.sticky_nav.length ){
716			t.init(); 
717		}
718
719		if( t.mobile_menu.hasClass('ztudiox-sticky-mobile-navigation') ){
720			t.style_mobile_slide();
721			$(window).trigger('ztudiox-set-sticky-mobile-navigation'); 
722		}
723
724	}
725	ztudiox_sticky_navigation.prototype = {
726		
727		init: function(){
728
729			var t = this;
730
731			if( t.sticky_nav.hasClass('ztudiox-style-fixed') ){
732				t.style_fixed();
733			}else if( t.sticky_nav.hasClass('ztudiox-style-slide') ){
734				t.style_slide();
735			}
736
737			$(window).trigger('ztudiox-set-sticky-navigation'); 
738		},
739
740		style_fixed: function(){
741
742			var t = this;
743			var placeholder = $('<div class="ztudiox-sticky-menu-placeholder" ></div>');
744
745			$(window).on('scroll ztudiox-set-sticky-navigation', function(){
746
747				if( ztudiox_display == 'mobile-landscape' || ztudiox_display == 'mobile-portrait' || ztudiox_display == 'tablet' ) return;
748
749				var page_offset = parseInt($('html').css('margin-top'));
750
751				if( !t.sticky_nav.hasClass('ztudiox-fixed-navigation') ){
752
753					if( $(window).scrollTop() + page_offset > t.sticky_nav.offset().top ){
754						if( !t.sticky_nav.hasClass('ztudiox-without-placeholder') ){
755							placeholder.height(t.sticky_nav.outerHeight());
756						}
757						placeholder.insertAfter(t.sticky_nav);
758						$('body').append(t.sticky_nav);
759						t.sticky_nav.addClass('ztudiox-fixed-navigation');
760						
761						setTimeout(function(){ t.sticky_nav.addClass('ztudiox-animate-fixed-navigation'); }, 10);	
762						setTimeout(function(){ 
763							t.sticky_nav.css('height', ''); 
764							$(window).trigger('ztudiox-navigation-slider-bar-animate');
765						}, 200);
766					}
767				}else{
768
769					if( $(window).scrollTop() + page_offset <= placeholder.offset().top ){
770						if( !t.sticky_nav.hasClass('ztudiox-without-placeholder') ){
771							t.sticky_nav.height(placeholder.height());
772						}
773						t.sticky_nav.insertBefore(placeholder);
774						t.sticky_nav.removeClass('ztudiox-fixed-navigation');
775						placeholder.remove();
776
777						setTimeout(function(){ t.sticky_nav.removeClass('ztudiox-animate-fixed-navigation'); }, 10);	
778						setTimeout(function(){ 
779							t.sticky_nav.css('height', ''); 
780							$(window).trigger('ztudiox-navigation-slider-bar-animate');
781						}, 200);
782					}
783				}
784			});
785
786		}, // style_fixed
787
788		style_slide: function(){
789
790			var t = this;
791			var placeholder = $('<div class="ztudiox-sticky-menu-placeholder" ></div>');
792
793			$(window).on('scroll ztudiox-set-sticky-navigation', function(){
794
795				if( ztudiox_display == 'mobile-landscape' || ztudiox_display == 'mobile-portrait' || ztudiox_display == 'tablet' ){ return; }
796
797				var page_offset = parseInt($('html').css('margin-top'));
798
799				if( !t.sticky_nav.hasClass('ztudiox-fixed-navigation') ){
800
801					if( $(window).scrollTop() + page_offset > t.sticky_nav.offset().top + t.sticky_nav.outerHeight() + 200 ){
802						
803						if( !t.sticky_nav.hasClass('ztudiox-without-placeholder') ){
804							placeholder.height(t.sticky_nav.outerHeight());
805						}
806						placeholder.insertAfter(t.sticky_nav);
807						t.sticky_nav.css('display', 'none');
808
809						$('body').append(t.sticky_nav);
810						t.sticky_nav.addClass('ztudiox-fixed-navigation ztudiox-animate-fixed-navigation');
811						t.sticky_nav.slideDown(200);
812						$(window).trigger('ztudiox-navigation-slider-bar-animate');
813					}
814				}else{
815
816					if( $(window).scrollTop() + page_offset <= placeholder.offset().top + placeholder.height() + 200 ){
817						var clone = t.sticky_nav.clone();
818						clone.insertAfter(t.sticky_nav);
819						clone.slideUp(200, function(){ $(this).remove(); });
820
821						t.sticky_nav.insertBefore(placeholder);
822						placeholder.remove();
823						t.sticky_nav.removeClass('ztudiox-fixed-navigation ztudiox-animate-fixed-navigation');
824						t.sticky_nav.css('display', 'block');
825
826						$(window).trigger('ztudiox-navigation-slider-bar-animate');
827					}
828				}
829			});
830
831		}, // style_slide		
832
833		style_mobile_slide: function(){
834
835			var t = this;
836			var placeholder = $('<div class="ztudiox-sticky-mobile-placeholder" ></div>');
837
838			$(window).on('scroll ztudiox-set-sticky-mobile-navigation', function(){
839
840				if( ztudiox_display == 'mobile-landscape' || ztudiox_display == 'mobile-portrait' || ztudiox_display == 'tablet' ){
841
842					var page_offset = parseInt($('html').css('margin-top'));
843
844					if( !t.mobile_menu.hasClass('ztudiox-fixed-navigation') ){
845						if( $(window).scrollTop() + page_offset > t.mobile_menu.offset().top + t.mobile_menu.outerHeight() + 200 ){
846							placeholder.height(t.mobile_menu.outerHeight()).insertAfter(t.mobile_menu);
847							$('body').append(t.mobile_menu);
848							t.mobile_menu.addClass('ztudiox-fixed-navigation');
849							t.mobile_menu.css('display', 'none').slideDown(200);
850						}
851					}else{
852						if( $(window).scrollTop() + page_offset <= placeholder.offset().top + placeholder.height() + 200 ){
853							var clone = t.mobile_menu.clone();
854							clone.insertAfter(t.mobile_menu);
855							clone.slideUp(200, function(){ $(this).remove(); });
856
857							t.mobile_menu.insertBefore(placeholder);
858							placeholder.remove();
859							t.mobile_menu.removeClass('ztudiox-fixed-navigation');
860							t.mobile_menu.css('display', 'block');
861						}
862					}
863				}
864
865			});
866
867		}, // style_slide
868
869	};
870
871	var ztudiox_font_resize = function(){
872
873		this.heading_font = $('h1, h2, h3, h4, h5, h6');
874
875		this.init();
876
877	}
878	ztudiox_font_resize.prototype = {
879
880		init: function(){
881
882			var t = this;
883
884			t.resize();
885			$(window).on('resize', ztudiox_throttling(function(){
886				t.resize();
887			}, 100));
888
889		},
890
891		resize: function(){
892			
893			var t = this;
894
895			if( ztudiox_display == 'mobile-landscape' || ztudiox_display == 'mobile-portrait' ){
896
897				t.heading_font.each(function(){
898					if( parseInt($(this).css('font-size')) > 40 ){
899						if( !$(this).attr('data-orig-font') ){
900							$(this).attr('data-orig-font', $(this).css('font-size')); 
901						}
902
903						$(this).css('font-size', '40px');
904					}
905				});
906
907			// return font to normal
908			}else{
909
910				t.heading_font.filter('[data-orig-font]').each(function(){
911					$(this).css('font-size', $(this).attr('data-orig-font'));
912				});
913
914			}
915		}
916
917	};
918
919
920	////////////////////////////////
921	// starting running the script
922	////////////////////////////////
923	$(document).ready(function(){
924	
925		// resize font on mobile
926		new ztudiox_font_resize();
927
928		// init main navigation menu
929		$('#ztudiox-main-menu, #ztudiox-right-menu, #ztudiox-mobile-menu').each(function(){
930			if( $(this).hasClass('ztudiox-overlay-menu') ){
931				new ztudiox_overlay_menu( $(this) );
932			}else if( $(this).hasClass('ztudiox-mm-menu-wrap') ){
933				$(this).ztudiox_mobile_menu();
934			}else{
935				new ztudiox_sf_menu( $(this) );
936			}
937		});
938
939		$('#ztudiox-top-search, #ztudiox-mobile-top-search').each(function(){
940
941			var search_wrap = $(this).siblings('.ztudiox-top-search-wrap');
942			search_wrap.appendTo('body');
943
944			// bind click button
945			$(this).on('click', function(){
946				search_wrap.fadeIn(200, function(){
947					$(this).addClass('ztudiox-active');
948				});
949			});
950
951			// bind close button
952			search_wrap.find('.ztudiox-top-search-close').on('click', function(){
953				search_wrap.fadeOut(200, function(){
954					$(this).addClass('ztudiox-active');
955				});
956			});
957
958			// bind search button
959			search_wrap.find('.search-submit').on('click', function(){
960				if( search_wrap.find('.search-field').val().length == 0 ){
961					return false;
962				}
963			});
964		});
965
966		$('#ztudiox-main-menu-cart, #ztudiox-mobile-menu-cart').each(function(){
967			
968			$(this).on({
969				mouseenter: function(){
970					$(this).addClass('ztudiox-active ztudiox-animating');
971				}, 
972				mouseleave: function(){
973					var menu_cart = $(this);
974					menu_cart.removeClass('ztudiox-active');
975					setTimeout(function(){
976						menu_cart.removeClass('ztudiox-animating');
977					}, 400)
978				}
979			});
980		});
981
982		// additional space for header transparent
983		$('.ztudiox-header-boxed-wrap, .ztudiox-header-background-transparent, .ztudiox-navigation-bar-wrap.ztudiox-style-transparent').each(function(){
984			var header_transparent = $(this);
985			var header_transparent_sub = $('.ztudiox-header-transparent-substitute');
986
987			header_transparent_sub.height(header_transparent.outerHeight());
988			$(window).on('load resize', function(){
989				header_transparent_sub.height(header_transparent.outerHeight());
990			});
991		});
992
993		// full screen for 404 not found
994		$('body.error404, body.search-no-results').each(function(){
995
996			var wrap = $(this).find('#ztudiox-full-no-header-wrap');
997			var body_wrap_offset = parseInt($(this).children('.ztudiox-body-outer-wrapper').children('.ztudiox-body-wrapper').css('margin-bottom'));
998			
999			var padding = ($(window).height() - wrap.offset().top - wrap.outerHeight() - body_wrap_offset) / 2;
1000			if( padding > 0 ){
1001				wrap.css({ 'padding-top': padding, 'padding-bottom': padding });
1002			}
1003
1004			$(window).on('load resize', function(){
1005				wrap.css({ 'padding-top': 0, 'padding-bottom': 0 });
1006				padding = ($(window).height() - wrap.offset().top - wrap.outerHeight() - body_wrap_offset) / 2;
1007				if( padding > 0 ){
1008					wrap.css({ 'padding-top': padding, 'padding-bottom': padding });
1009				}
1010			});
1011		});
1012
1013		// back to top button
1014		var back_to_top = $('#ztudiox-footer-back-to-top-button');
1015		if( back_to_top.length ){ 
1016			$(window).on('scroll', function(){
1017				if( $(window).scrollTop() > 300 ){
1018					back_to_top.addClass('ztudiox-scrolled');
1019				}else{
1020					back_to_top.removeClass('ztudiox-scrolled');
1021				}
1022			});
1023		}
1024
1025		// page preload
1026		$('body').children('#ztudiox-page-preload').each(function(){
1027			var page_preload = $(this);
1028			var animation_time = parseInt(page_preload.attr('data-animation-time'));
1029			
1030			$('a[href]').not('[href^="#"], [target="_blank"], .gdlr-core-js, .strip').on('click', function(e){
1031				if( e.which != 1 || $(this).hasClass('ztudiox-no-preload') ) return;
1032				
1033				if( window.location.href != this.href ){
1034					page_preload.addClass('ztudiox-out').fadeIn(animation_time);
1035				}
1036			});
1037			
1038			$(window).load(function(){
1039				page_preload.fadeOut(animation_time);
1040			});
1041		});
1042
1043		// single nav style 2 sync height
1044		$('body.ztudiox-blog-style-2 .ztudiox-single-nav-area').each(function(){
1045			var max_height;
1046			var single_nav_2 = $(this).children();
1047
1048			max_height = 0;
1049			single_nav_2.css('min-height', '0px');
1050			single_nav_2.each(function(){
1051				if( max_height < $(this).outerHeight() ){
1052					max_height = $(this).outerHeight();
1053				}
1054			});
1055			single_nav_2.css('min-height', max_height);
1056
1057			$(window).resize(function(){
1058				max_height = 0;
1059				single_nav_2.css('min-height', '0px');
1060				single_nav_2.each(function(){
1061					if( max_height < $(this).outerHeight() ){
1062						max_height = $(this).outerHeight();
1063					}
1064				});
1065				single_nav_2.css('min-height', max_height);
1066			});
1067		});
1068		
1069	});
1070
1071	// fix back button for preload
1072	$(window).on('pageshow', function(event) {
1073	    if( event.originalEvent.persisted ){
1074	        $('body').children('#ztudiox-page-preload').each(function(){
1075				$(this).fadeOut(400);
1076			});
1077	    }
1078	});
1079	// $(window).on('beforeunload', function(){
1080	// 	$('body').children('#ztudiox-page-preload').each(function(){
1081	// 		$(this).fadeOut(400);
1082	// 	});
1083	// });
1084
1085	$(window).load(function(){
1086
1087		// fixed footer
1088		$('#ztudiox-fixed-footer').each(function(){
1089			var fixed_footer = $(this);
1090			var placeholder = $('<div class="ztudiox-fixed-footer-placeholder" ></div>');
1091
1092			placeholder.insertBefore(fixed_footer);
1093			placeholder.height(fixed_footer.outerHeight());
1094			$('body').css('min-height', $(window).height() - parseInt($('html').css('margin-top'))); // for safari
1095			$(window).resize(function(){ 
1096				placeholder.height(fixed_footer.outerHeight()); 
1097				$('body').css('min-height', $(window).height() - parseInt($('html').css('margin-top')));
1098			});
1099		});
1100
1101		// side navigation bar
1102		new ztudiox_header_side_nav( $('#ztudiox-header-side-nav') );
1103
1104		// sticky navigation
1105		new ztudiox_sticky_navigation();
1106
1107		// anchoring
1108		new ztudiox_anchor();
1109
1110	});
1111
1112})(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.