PageSourceSearch

https://youngblood-tyler.com/wp-content/themes/corzo/js/script-core.js?ver=1.0.0

js youngblood-tyler.com collected 2026-10-05 21:53:23 UTC 40,034 bytes, 1,298 lines download raw bytes

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