PageSourceSearch

https://doctorshospital.com.pk/wp-content/themes/mediz/js/script-core.js?ver=1.0.0

js doctorshospital.com.pk collected 2026-10-02 23:53:18 UTC 37,785 bytes, 1,248 lines download raw bytes

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

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.