PageSourceSearch

https://www.turing22.com/wp-content/themes/betheme/js/scripts.js?ver=20.9.5.6-b-modified-1633625204

js turing22.com collected 2026-10-06 07:59:37 UTC 77,162 bytes, 2,984 lines download raw bytes

1(function($){
2
3    "use strict";
4
5
6    /* ---------------------------------------------------------------------------
7	 * Global vars
8	 * --------------------------------------------------------------------------- */
9
10    var scrollticker;	// Scroll Timer | don't need to set this in every scroll
11
12    var rtl           = $( 'body' ).hasClass( 'rtl' );
13    var simple        = $( 'body' ).hasClass( 'style-simple' );
14
15    var top_bar_top   = '61px';
16    var header_H      = 0;
17    var mobile_init_W = ( window.mfn.mobile_init ) ? window.mfn.mobile_init : 1240;
18
19    var lightbox_attr = false;
20
21
22    /* ---------------------------------------------------------------------------
23	 * Lightbox | Magnific Popup
24	 * --------------------------------------------------------------------------- */
25
26    if( ! window.mfn_lightbox.disable ){
27    	if( ! ( window.mfn_lightbox.disableMobile && ( window.innerWidth < 768 ) ) ){
28    		lightbox_attr = {
29				title : window.mfn_lightbox.title  ? window.mfn_lightbox.title  : false,
30    		};
31    	}
32    }
33
34
35    /* ---------------------------------------------------------------------------
36	 * Admin Bar & WooCommerce Store Notice
37	 * --------------------------------------------------------------------------- */
38
39    function adminBarH(){
40    	var height = 0;
41
42    	// WP adminbar
43    	if( $( 'body' ).hasClass( 'admin-bar' ) ){
44    		height += $( '#wpadminbar' ).innerHeight();
45    	}
46
47    	// WC demo store
48    	if( $( 'body' ).hasClass( 'woocommerce-demo-store' ) ){
49    		height += $( 'body > p.demo_store' ).innerHeight();
50    	}
51
52    	return height;
53    }
54
55
56    /* ---------------------------------------------------------------------------
57	 * Header | Sticky
58	 * --------------------------------------------------------------------------- */
59
60	function mfn_sticky(){
61		if( $( 'body' ).hasClass( 'sticky-header' ) ){
62			if( ! ( $( 'body' ).hasClass( 'header-creative' ) && window.innerWidth >= 768 ) ){
63
64				var start_y = header_H;
65				var window_y = $( window ).scrollTop();
66
67				if( window_y > start_y ){
68
69					if( ! ( $( '#Top_bar' ).hasClass( 'is-sticky' ) ) ){
70
71						$( '.header_placeholder' ).css( 'height', $( '#Top_bar' ).height() );
72
73						$( '#Top_bar' )
74							.addClass( 'is-sticky' )
75							.css( 'top', -60 )
76							.animate({
77								'top': adminBarH() + 'px'
78							}, 300 );
79
80						// Header width
81						mfn_header();
82					}
83
84				} else {
85
86					if( $( '#Top_bar' ).hasClass( 'is-sticky' ) ){
87
88						$( '.header_placeholder' ).css( 'height', 0 );
89						$( '#Top_bar' )
90							.removeClass( 'is-sticky' )
91							.css( 'top', top_bar_top );
92
93						// Retina Logo - max height
94						sticky_logo();
95
96						// Header width
97						mfn_header();
98
99					}
100
101				}
102
103				mfn_mobile_sticky();
104
105			}
106		}
107	}
108
109
110	/* ---------------------------------------------------------------------------
111	 * Header | Sticky | Retina Logo - max height
112	 * --------------------------------------------------------------------------- */
113	function sticky_logo(){
114
115		// ! retina display
116		if( ! window.devicePixelRatio > 1 ){
117			return false;
118		}
119
120		var parent = $( '#Top_bar #logo' );
121
122		// ! retina logo set
123		if( ! parent.hasClass( 'retina' ) ){
124			return false;
125		}
126
127		var el = $( 'img.logo-main', parent );
128		var height = el.data( 'height' );
129
130		if( $( 'body' ).hasClass( 'logo-overflow' ) ){
131			// do nothing
132		} else if( height > parent.data( 'height' ) ){
133			height = parent.data( 'height' );
134		}
135
136		el.css( 'max-height', height + 'px' );
137
138	}
139
140	/* ---------------------------------------------------------------------------
141	 * Header | Sticky | Height
142	 * --------------------------------------------------------------------------- */
143
144	function mfn_stickyH(){
145
146    	if( $('body').hasClass( 'header-below' ) ){
147
148	    	// header below slider
149	    	header_H = $( '.mfn-main-slider' ).innerHeight() + $( '#Top_bar' ).innerHeight();
150
151	    } else {
152
153	    	// default
154	    	header_H = $( '#Top_bar' ).innerHeight() + $( '#Action_bar' ).innerHeight();
155
156	    }
157
158    }
159
160
161    /* ---------------------------------------------------------------------------
162	 * Header | Sticky | Mobile
163	 * --------------------------------------------------------------------------- */
164
165	function mfn_mobile_sticky(){
166		if( $( 'body' ).hasClass( 'mobile-sticky' ) && ( $( window ).width() < 768 ) ){
167
168			var windowH = $( window ).height();
169			var offset = adminBarH() + $( '#Top_bar .logo' ).height();
170
171			if( ( ! $( '#Top_bar' ).hasClass( 'is-sticky' ) ) && $( '#Action_bar' ).is( ':visible' ) ){
172				offset += $( '#Action_bar' ).height();
173			}
174
175			var menuH = windowH - offset;
176			if( menuH < 176 ){
177				menuH = 176;
178			}
179
180			$( '#Top_bar #menu' ).css( 'max-height', menuH + 'px' );
181
182		}
183	}
184
185
186	/* ---------------------------------------------------------------------------
187	 * Header | Top bar left | Width
188	 * --------------------------------------------------------------------------- */
189
190	function mfn_header(){
191		var rightW = $('.top_bar_right').innerWidth();
192		if( rightW && ! $('body').hasClass('header-plain') ){
193			rightW += 10;
194		}
195		var parentW = $('#Top_bar .one').innerWidth();
196		var leftW = parentW - rightW;
197		$('.top_bar_left, .menu > li > ul.mfn-megamenu').css( 'width', leftW );
198	}
199
200
201	/* ---------------------------------------------------------------------------
202	 * FIX | Header | Sticky | Height
203	 * --------------------------------------------------------------------------- */
204
205	function fixStickyHeaderH(){
206		var stickyH = 0;
207
208		// FIX | sticky top bar height
209
210		var topBar = $( '.sticky-header #Top_bar' );
211
212		if( topBar.hasClass( 'is-sticky' ) ){
213			stickyH = $( '.sticky-header #Top_bar' ).innerHeight();
214		} else {
215			topBar.addClass( 'is-sticky' );
216			stickyH = $( '.sticky-header #Top_bar' ).innerHeight();
217			topBar.removeClass( 'is-sticky' );
218		}
219
220		// FIX | responsive
221
222		if( $( window ).width() < mobile_init_W  ){
223
224			if( $( window ).width() < 768 ){
225
226				// mobile
227				if( ! $( 'body' ).hasClass( 'mobile-sticky' ) ){
228					stickyH = 0;
229				}
230
231			} else {
232
233				// tablet
234				if( ! $( 'body' ).hasClass( 'tablet-sticky' ) ){
235					stickyH = 0;
236				}
237
238			}
239
240		} else {
241
242			// desktop
243
244			// FIX | header creative
245			if( $( 'body' ).hasClass( 'header-creative' ) ){
246				stickyH = 0;
247			}
248
249		}
250
251		return stickyH;
252	}
253
254
255	/* ---------------------------------------------------------------------------
256	 * Sidebar | Height
257	 * --------------------------------------------------------------------------- */
258
259	function mfn_sidebar(){
260		if( $('.with_aside .four.columns').length ){
261
262			var maxH = $('#Content .sections_group').outerHeight();
263
264			$('.with_aside .four.columns .widget-area').each(function(){
265				$(this).css( 'min-height', 0 );
266				if( $(this).height() > maxH ){
267					maxH = $(this).height();
268				}
269			});
270			$('.with_aside .four.columns .widget-area').css( 'min-height', maxH + 'px' );
271
272		}
273	}
274
275
276	/* ---------------------------------------------------------------------------
277	 * Section | Full Screen
278	 * --------------------------------------------------------------------------- */
279
280	function mfn_sectionH(){
281		var windowH = $( window ).height();
282
283		// FIX | next/prev section
284		var offset = 0;
285		if( $( '.section.full-screen:not(.hide-desktop)' ).length > 1 ){
286			offset = 5;
287		}
288
289		$( '.section.full-screen' ).each( function(){
290
291			var section = $( this );
292			var wrapper = $( '.section_wrapper', section );
293
294			section
295				.css( 'padding', 0 )
296				.css( 'min-height', windowH + offset );
297
298			var padding = ( windowH + offset - wrapper.height() ) / 2;
299
300			if( padding < 50 ) padding = 50;
301
302			wrapper
303				.css( 'padding-top', padding + 10 )			// 20 = column margin-bottom / 2
304				.css( 'padding-bottom', padding - 10 );
305		});
306	}
307
308
309	/* ---------------------------------------------------------------------------
310	 * Equal Height | Wraps
311	 * --------------------------------------------------------------------------- */
312
313	function mfn_equalH_wrap(){
314		$('.section.equal-height-wrap .section_wrapper').each(function(){
315			var maxH = 0;
316			$('> .wrap', $(this) ).each(function(){
317				$(this).css( 'height', 'auto' );
318				if( $(this).innerHeight() > maxH ){
319					maxH = $(this).innerHeight();
320				}
321			});
322			$('> .wrap', $(this) ).css( 'height', maxH + 'px' );
323		});
324	}
325
326
327	/* ---------------------------------------------------------------------------
328	 * Equal Height | Items
329	 * --------------------------------------------------------------------------- */
330
331	function mfn_equalH(){
332		$('.section.equal-height .mcb-wrap-inner').each(function(){
333			var maxH = 0;
334
335			$('> .column', $(this) ).each(function(){
336				$(this).css( 'height', 'auto' );
337				if( $(this).height() > maxH ){
338					maxH = $(this).height();
339				}
340			});
341			$('> .column', $(this) ).css( 'height', maxH + 'px' );
342		});
343	}
344
345
346	/* ---------------------------------------------------------------------------
347	 * Into | Full Screen
348	 * --------------------------------------------------------------------------- */
349
350	function mfn_introH(){
351		var windowH = $( window ).height() - $('#Header_wrapper').height() - adminBarH();
352
353		$('#Intro.full-screen').each(function(){
354
355			var el = $(this);
356			var inner = $( '.intro-inner', el );
357
358			el.css( 'padding', 0 ).css( 'min-height', windowH );
359
360			var padding = ( windowH - inner.height() ) / 2;
361			inner.css( 'padding-top', padding ).css( 'padding-bottom', padding );
362
363		});
364	}
365
366
367	/* ---------------------------------------------------------------------------
368	 * Footer | Sliding | Height
369	 * --------------------------------------------------------------------------- */
370
371	function mfn_footer(){
372
373		// Fixed, Sliding
374		if( $('.footer-fixed #Footer, .footer-sliding #Footer').length ){
375
376			var footerH = $('#Footer').height() - 1;
377			$('#Content').css( 'margin-bottom', footerH + 'px' );
378
379		}
380
381		// Stick to bottom
382		if( $('.footer-stick #Footer').length ){
383
384			var headerFooterH 	= $('#Header_wrapper').height() + $('#Footer').height();
385			var documentH 		= $( document ).height() - adminBarH();
386
387			if( ( documentH <= $( window ).height() ) && ( headerFooterH <= $( window ).height() ) ){
388				$('#Footer').addClass('is-sticky');
389			} else {
390				$('#Footer').removeClass('is-sticky');
391			}
392
393		}
394
395	}
396
397
398	/* ---------------------------------------------------------------------------
399	 * Back To Top | Sticky / Show on scroll
400	 * --------------------------------------------------------------------------- */
401
402	function backToTopSticky(){
403
404		if( $('#back_to_top.sticky.scroll').length ){
405			var el = $('#back_to_top.sticky.scroll');
406
407			// Clear Timeout if one is pending
408			if( scrollticker ){
409				window.clearTimeout(scrollticker);
410				scrollticker = null;
411			}
412
413			el.addClass('focus');
414
415			// Set Timeout
416			scrollticker = window.setTimeout(function(){
417				el.removeClass('focus');
418			}, 1500); // Timeout in msec
419
420		}
421
422	}
423
424
425	/* ---------------------------------------------------------------------------
426	 * niceScroll | Padding right fix for short content
427	 * --------------------------------------------------------------------------- */
428
429	function niceScrollFix(){
430		var el = $('body > .nicescroll-rails');
431		if( el.length ){
432			if( el.is(":visible") ){
433				$('body').addClass('nice-scroll');
434			} else {
435				$('body').removeClass('nice-scroll');
436			}
437		}
438	}
439
440
441	/* ---------------------------------------------------------------------------
442	 * # Hash smooth navigation
443	 * --------------------------------------------------------------------------- */
444
445	function hashNav(){
446
447		// # window.location.hash
448		var hash = window.location.hash;
449
450		if( hash ){
451
452			// FIX | Master Slider
453			if( hash.indexOf( "&" ) > -1 || hash.indexOf( "/" ) > -1 ){
454				return false;
455			}
456
457			// Contact Form 7 in popup
458			if( hash.indexOf( "wpcf7" ) > -1 ){
459				cf7popup( hash );
460			}
461
462			if( $( hash ).length ){
463
464				var tabsHeaderH = $( hash ).siblings( '.ui-tabs-nav' ).innerHeight();
465
466				$( 'html, body' ).animate({
467					scrollTop: $( hash ).offset().top - fixStickyHeaderH() - tabsHeaderH - adminBarH()
468				}, 500 );
469			}
470
471		}
472
473	}
474
475
476	/* ---------------------------------------------------------------------------
477	 * One Page | Scroll Active
478	 * --------------------------------------------------------------------------- */
479
480	function onePageActive(){
481		if( $('body').hasClass('one-page') ){
482
483			var stickyH	= $('.sticky-header #Top_bar').innerHeight();
484			var windowT = $( window ).scrollTop();
485			var start	= windowT + stickyH + adminBarH() + 1;
486			var first 	= false;
487
488			$('div[data-id]').each(function(){
489
490				if( $(this).visible( true ) ){
491					if( !first ){
492						first = $(this);
493					} else if( ( $(this).offset().top < start ) && ( $(this).offset().top > first.offset().top ) ) {
494						first = $(this);
495					}
496				}
497
498				if( first ){
499					var newActive = first.attr('data-id');
500			        var active = '[data-hash="'+ newActive +'"]';
501
502			        if( newActive ){
503				        var menu = $('#menu');
504				        menu.find('li').removeClass('current-menu-item current-menu-parent current-menu-ancestor current_page_item current_page_parent current_page_ancestor');
505				        $( active, menu )
506				        	.closest('li').addClass('current-menu-item')
507				        	.closest('.menu > li').addClass('current-menu-item');
508			        }
509				}
510
511			});
512
513		}
514	}
515
516
517	/* ---------------------------------------------------------------------------
518	 * Contact Form 7 | Popup
519	 * --------------------------------------------------------------------------- */
520
521	function cf7popup( hash ){
522		if( hash && $( hash ).length ){
523			var id = $( hash ).closest('.popup-content').attr('id');
524
525			$('a.popup-link[href="#'+ id +'"]:not(.once)')
526				.addClass('once')
527				.click();
528
529		}
530	}
531
532
533	/* ---------------------------------------------------------------------------
534	 * Zoom Box | Vertical Align
535	 * --------------------------------------------------------------------------- */
536
537	function zoomBoxVerticalAlign(){
538		$('.zoom_box').each(function(){
539
540        var el = $(this);
541        var elH = el.height();
542        var desc = el.find('.desc_wrap');
543        var descH = desc.height();
544
545        var padding = ( elH - descH ) / 2;
546
547        desc.css( 'padding-top', padding +'px' );
548
549    });
550	}
551
552
553
554	/* --------------------------------------------------------------------------------------------------------------------------
555	 *
556	 * $( document ).ready
557	 *
558	 * ----------------------------------------------------------------------------------------------------------------------- */
559
560
561	$( document ).ready( function(){
562
563
564		/* ---------------------------------------------------------------------------
565		 * Top Bar
566		 * --------------------------------------------------------------------------- */
567
568		$( '#Top_bar' ).removeClass( 'loading' );
569
570		top_bar_top = parseInt( $('#Top_bar').css('top'), 10 );
571		if( top_bar_top < 0 ) top_bar_top = 61;
572		top_bar_top = top_bar_top + 'px';
573
574
575		/* ---------------------------------------------------------------------------
576		 * Menu | Overlay
577		 * --------------------------------------------------------------------------- */
578
579		$( '.overlay-menu-toggle' ).click( function(e){
580			e.preventDefault();
581
582			$(this).toggleClass('focus');
583			$( '#Overlay' ).stop(true,true).fadeToggle(500);
584
585			var menuH = $('#Overlay nav').height() / 2;
586			$( '#Overlay nav' ).css( 'margin-top', '-' + menuH + 'px' );
587		});
588
589
590		/* ---------------------------------------------------------------------------
591		 * Menu | Responsive | button
592		 * --------------------------------------------------------------------------- */
593
594		$( '.responsive-menu-toggle' ).on( 'click', function(e){
595			e.preventDefault();
596
597			var el = $(this);
598			var menu = $('#Top_bar #menu');
599			var menuWrap = menu.closest('.top_bar_left');
600
601			el.toggleClass('active');
602
603			// sticky menu button
604			if( el.hasClass('is-sticky') && el.hasClass('active') && ( window.innerWidth < 768 ) ){
605
606				var top = 0;
607				if( menuWrap.length ){
608					top = menuWrap.offset().top - adminBarH();
609				}
610				$('body,html').animate({
611					scrollTop: top
612				}, 200);
613
614			}
615
616			menu.stop(true,true).slideToggle(200);
617		});
618
619
620		/* ---------------------------------------------------------------------------
621		 * Menu | Responsive | Side Slide
622		 * --------------------------------------------------------------------------- */
623
624		function sideSlide(){
625
626			var slide 				= $( '#Side_slide' );
627			var overlay 			= $( '#body_overlay' );
628			var ss_mobile_init_W 	= mobile_init_W;
629			var pos 				= 'right';
630
631			var shift_slide			= -slide.data( 'width' );
632			var shift_body			= shift_slide / 2;
633
634
635			// constructor ----------
636
637			var constructor = function(){
638				if( ! slide.hasClass( 'enabled' ) ){
639					$( 'nav#menu' ).detach().appendTo( '#Side_slide .menu_wrapper' );
640					slide.addClass( 'enabled' );
641				}
642			};
643
644
645			// destructor ----------
646
647			var destructor = function(){
648				if( slide.hasClass( 'enabled' ) ){
649					close();
650					$( 'nav#menu' ).detach().prependTo( '#Top_bar .menu_wrapper' );
651					slide.removeClass( 'enabled' );
652				}
653			};
654
655
656			// reload ----------
657
658			var reload = function(){
659
660				if( ( window.innerWidth < ss_mobile_init_W ) ){
661					constructor();
662				} else {
663					destructor();
664				}
665			};
666
667
668			// init ----------
669
670			var init = function(){
671				if( slide.hasClass( 'left' ) ){
672					pos = 'left';
673				}
674
675				// responsive off
676				if( $( 'body' ).hasClass( 'responsive-off' ) ){
677					ss_mobile_init_W = 0;
678				}
679
680				// header simple
681				if( $( 'body' ).hasClass( 'header-simple' ) ){
682					ss_mobile_init_W = 9999;
683				}
684
685				reload();
686			};
687
688
689			// reset to default ----------
690
691			var reset = function( time ){
692
693				$( '.lang-active.active', slide ).removeClass('active').children('i').attr('class','icon-down-open-mini');
694				$( '.lang-wrapper', slide ).fadeOut(0);
695
696				$( '.icon.search.active', slide ).removeClass('active');
697				$( '.search-wrapper', slide ).fadeOut(0);
698
699				$( '.menu_wrapper, .social', slide ).fadeIn( time );
700
701			};
702
703
704			// menu button ----------
705
706			var button = function(){
707
708				// show
709				if( pos == 'left' ){
710					slide.animate( { 'left': 0 }, 300 );
711					$('body').animate( { 'right': shift_body }, 300 );
712				} else {
713					slide.animate( { 'right': 0 }, 300 );
714					$('body').animate( { 'left': shift_body }, 300 );
715				}
716
717				overlay.fadeIn(300);
718
719				// reset
720				reset(0);
721
722			};
723
724
725			// close ----------
726
727			var close = function(){
728
729				if( pos == 'left' ){
730					slide.animate( { 'left': shift_slide }, 300 );
731					$('body').animate( { 'right': 0 }, 300 );
732				} else {
733					slide.animate( { 'right': shift_slide }, 300 );
734					$('body').animate( { 'left': 0 }, 300 );
735				}
736
737				overlay.fadeOut(300);
738
739        // if page contains revolution slider, trigger resize
740        if( $('.rev_slider').length ){
741          setTimeout( function(){
742      			$( window ).trigger( 'resize' );
743            console.log(1);
744      		}, 300 );
745        }
746			};
747
748
749			// search ----------
750
751			$( '.icon.search', slide ).on( 'click', function(e){
752
753				e.preventDefault();
754
755				var el = $(this);
756
757				if( el.hasClass('active') ){
758
759					$( '.search-wrapper', slide ).fadeOut(0);
760					$( '.menu_wrapper, .social', slide ).fadeIn(300);
761
762				} else {
763
764					$( '.search-wrapper', slide ).fadeIn(300);
765					$( '.menu_wrapper, .social', slide ).fadeOut(0);
766
767					$( '.lang-active.active', slide ).removeClass('active').children('i').attr('class','icon-down-open-mini');
768					$( '.lang-wrapper', slide ).fadeOut(0);
769
770				}
771
772				el.toggleClass('active');
773			});
774
775
776			// search form submit ----------
777
778			$( 'a.submit', slide ).on( 'click', function(e){
779				e.preventDefault();
780				$('#side-form').submit();
781			});
782
783
784			// lang menu ----------
785
786			$( '.lang-active', slide ).on( 'click', function(e){
787				e.preventDefault();
788
789				var el = $(this);
790
791				if( el.hasClass('active') ){
792
793					$( '.lang-wrapper', slide ).fadeOut(0);
794					$( '.menu_wrapper, .social', slide ).fadeIn(300);
795					el.children('i').attr('class','icon-down-open-mini');
796
797				} else {
798
799					$( '.lang-wrapper', slide ).fadeIn(300);
800					$( '.menu_wrapper, .social', slide ).fadeOut(0);
801					el.children('i').attr('class','icon-up-open-mini');
802
803					$( '.icon.search.active', slide ).removeClass('active');
804					$( '.search-wrapper', slide ).fadeOut(0);
805
806				}
807
808				el.toggleClass('active');
809			});
810
811
812			// init, click, debouncedresize ----------
813
814			// init
815
816			init();
817
818			// click | menu button
819
820			$( '.responsive-menu-toggle' ).off( 'click' );
821
822			$( '.responsive-menu-toggle' ).on( 'click', function(e){
823				e.preventDefault();
824				button();
825			});
826
827			// click | close
828
829			overlay.on( 'click', function(e){
830				close();
831			});
832
833			$( '.close', slide ).on( 'click', function(e){
834				e.preventDefault();
835				close();
836			});
837
838			// click | below search or languages menu
839
840			$( slide ).on( 'click', function(e){
841				if( $( e.target ).is( slide ) ){
842					reset(300);
843				}
844			});
845
846			// debouncedresize
847
848			$( window ).on( 'debouncedresize', reload );
849
850
851		}
852
853		if( $( 'body' ).hasClass( 'mobile-side-slide' ) ){
854			sideSlide();
855		}
856
857
858		/* ---------------------------------------------------------------------------
859		 * Gallery | WordPress Gallery
860		 * --------------------------------------------------------------------------- */
861
862		// Content
863		$( '.sections_group .gallery' ).each( function(){
864
865			var el	= $( this );
866			var id	= el.attr( 'id' );
867
868			$( '> br', el ).remove();
869
870			$( '.gallery-icon > a', el )
871				.wrap( '<div class="image_frame scale-with-grid"><div class="image_wrapper"></div></div>' )
872				.prepend( '<div class="mask"></div>' )
873				.children( 'img' )
874					.css( 'height', 'auto' )
875					.css( 'width', '100%' );
876
877			// Link | Media File
878			if( el.hasClass( 'file' ) ){
879				$( '.gallery-icon a', el ).attr( 'rel', 'prettyphoto['+ id +']' );
880			}
881
882			// Masonry
883			if( el.hasClass( 'masonry' ) ){
884
885				el.isotope({
886					itemSelector	: '.gallery-item',
887					layoutMode		: 'masonry',
888					isOriginLeft	: rtl ? false : true
889				});
890
891			}
892
893		});
894
895		// Widget
896		$( '.widget_media_gallery .gallery' ).each( function(){
897
898			var el = $( this );
899			var id = el.attr( 'id' );
900
901			// Link | Media File
902			$( '.gallery-icon a', el ).attr( 'rel', 'prettyphoto[widget-'+ id +']' );
903		});
904
905
906		/* ---------------------------------------------------------------------------
907		 * Lightbox | PrettyPhoto
908		 * --------------------------------------------------------------------------- */
909
910		$( 'a[rel^="prettyphoto[portfolio]"]' ).each(function(){
911
912			var el = $(this);
913			var parent = el.closest( '.column' );
914			var index = $( '.column' ).index( parent );
915
916			el.attr( 'rel', 'prettyphoto[portfolio-'+ index +']' );
917
918		});
919
920
921		/* ---------------------------------------------------------------------------
922		 * Lightbox | Magnific Popup
923		 * with prettyPhoto backward compatibility
924		 * --------------------------------------------------------------------------- */
925
926		function lightbox(){
927
928			var galleries = [];
929
930
931			// init -----------
932
933			var init = function(){
934
935				if( lightbox_attr ){
936					compatibility();
937					set_type();
938					constructor();
939				}
940
941			};
942
943
944			// backward compatibility for prettyPhoto ----------
945
946			var compatibility = function(){
947
948				$( 'a[rel^="prettyphoto"], a.prettyphoto, a[rel^="prettyphoto"]' ).each(function(){
949
950					var el 	= $( this );
951					var rel = el.attr( 'rel' );
952
953					if( rel ){
954						rel = rel.replace( 'prettyphoto', 'lightbox' );
955					} else {
956						rel = 'lightbox';
957					}
958
959					// Visual Composer prettyPhoto
960					var data_rel = el.attr( 'data-rel' );
961					if( data_rel ){
962						rel = data_rel.replace( 'prettyPhoto', 'lightbox' );
963						el.removeAttr( 'data-rel' );
964					}
965
966					el.removeClass( 'prettyphoto' ).attr( 'rel', rel );
967
968				});
969
970			};
971
972
973			// check if item is a part of gallery ----------
974
975			var is_gallery = function( rel ){
976
977				if( ! rel ){
978					return false;
979				}
980
981				var reg_exp = /\[(?:.*)\]/;
982				var gallery = reg_exp.exec( rel );
983
984				if( gallery ){
985					gallery = gallery[0];
986					gallery = gallery.replace( '[','' ).replace( ']','' );
987					return gallery;
988				}
989
990				return false;
991			};
992
993
994			// set array of names of galleries ----------
995
996			var set_gallery = function( gallery ){
997
998				if( galleries.indexOf( gallery ) == -1 ){
999					galleries.push( gallery );
1000					return true;
1001				}
1002
1003				return false;
1004			};
1005
1006
1007			// get file type by link ----------
1008
1009			var get_type = function( src ){
1010
1011				if( src.match(/youtube\.com\/watch/i) || src.match(/youtu\.be/i) ){
1012					return 'iframe';
1013
1014				} else if( src.match(/vimeo\.com/i) ){
1015					return 'iframe';
1016
1017				} else if( src.match(/\biframe=true\b/i) ){
1018					return 'ajax';
1019
1020				} else if( src.match(/\bajax=true\b/i) ){
1021					return 'ajax';
1022
1023				} else if( src.substr(0,1) == '#' ){
1024					return 'inline';
1025
1026				} else {
1027					return 'image';
1028
1029				}
1030			};
1031
1032
1033			// set file type ----------
1034
1035			var set_type = function(){
1036
1037				$( 'a[rel^="lightbox"]' ).each(function(){
1038
1039					var el 		= $( this );
1040					var href 	= el.attr( 'href' );
1041					var rel 	= el.attr( 'rel' );
1042
1043					if( href ){
1044
1045						// gallery
1046						var gallery = is_gallery( rel );
1047						if( gallery ){
1048							el.attr( 'data-type', 'gallery' );
1049							set_gallery( gallery );
1050							return true;
1051						}
1052
1053						el.attr( 'data-type', get_type( href ) );
1054
1055						// iframe paremeters
1056						if( get_type( href ) == 'iframe' ){
1057							el.attr( 'href', href.replace( '&rel=0', '' ) );
1058						}
1059					}
1060
1061				});
1062
1063			};
1064
1065
1066			// constructor ----------
1067
1068			var constructor = function(){
1069
1070				var attr = {
1071					autoFocusLast	: false,
1072					removalDelay	: 160,
1073					image			: {
1074						titleSrc	: function( item ){
1075              var img = item.el.closest( '.image_wrapper' ).find( 'img' ).first();
1076              if( lightbox_attr.title && img.length ){
1077                return img.attr( 'alt' );
1078              } else {
1079                return false;
1080              }
1081						}
1082					}
1083				};
1084
1085				// image
1086
1087				$( 'a[rel^="lightbox"][data-type="image"]' ).magnificPopup({
1088					autoFocusLast	: attr.autoFocusLast,
1089					removalDelay	: attr.removalDelay,
1090					type			: 'image',
1091					image			: attr.image
1092				});
1093
1094				// iframe | video
1095
1096				$( 'a[rel^="lightbox"][data-type="iframe"]' ).magnificPopup({
1097					autoFocusLast	: attr.autoFocusLast,
1098					removalDelay	: attr.removalDelay,
1099					type			: 'iframe',
1100					iframe: {
1101						patterns: {
1102							youtube: {
1103								index: 'youtube.com/',
1104								id: 'v=',
1105								src: '//www.youtube.com/embed/%id%?autoplay=1&rel=0'
1106							}
1107						}
1108					}
1109				});
1110
1111				// inline
1112
1113				$( 'a[rel^="lightbox"][data-type="inline"]' ).magnificPopup({
1114					autoFocusLast	: attr.autoFocusLast,
1115					type			: 'inline',
1116					midClick		: true,
1117					callbacks		: {
1118						open: function(){
1119							$( '.mfp-content' ).children().addClass( 'mfp-inline' );
1120						},
1121						beforeClose: function(){
1122							$( '.mfp-content' ).children().removeClass( 'mfp-inline' );
1123						}
1124					}
1125				});
1126
1127				// gallery
1128
1129				for( var i = 0, len = galleries.length; i < len; i++ ){
1130
1131					var gallery = '[' + galleries[i] + ']';
1132					gallery = 'a[rel^="lightbox' + gallery +'"]:visible';
1133
1134					$( gallery ).magnificPopup({
1135						autoFocusLast	: attr.autoFocusLast,
1136						removalDelay	: attr.removalDelay,
1137						type			: 'image',
1138						image			: attr.image,
1139						gallery			: {
1140							enabled		: true,
1141							tCounter	: '<span class="mfp-counter">%curr% / %total%</span>' // markup of counter
1142						}
1143					});
1144				}
1145
1146			};
1147
1148      // reload ----------
1149
1150      var reload = function(){
1151
1152        $( 'a[rel^="lightbox"]' ).unbind( 'click' );
1153        constructor();
1154
1155      }
1156
1157			// Visual Composer prettyPhoto | unbind ----------
1158
1159			var unbindPretty = function(){
1160
1161				if( lightbox_attr ){
1162					$( 'a[data-rel^="prettyPhoto"], a[rel^="lightbox"]' ).each( function(){
1163						$( this ).unbind( 'click.prettyphoto' );
1164					});
1165				}
1166
1167			}
1168
1169			// init ----------
1170
1171			init();
1172
1173			// onload ----------
1174
1175			$( window ).on( 'load', unbindPretty );
1176			$( document ).on( 'isotope:arrange', reload );
1177
1178		}
1179
1180		lightbox();
1181
1182
1183		/* ---------------------------------------------------------------------------
1184		 * Menu | mfnMenu
1185		 * --------------------------------------------------------------------------- */
1186
1187		function mainMenu(){
1188
1189			var mm_mobile_init_W = mobile_init_W;
1190
1191			if( $( 'body' ).hasClass( 'header-simple' ) || $( '#Header_creative.dropdown' ).length ){
1192				mm_mobile_init_W = 9999;
1193			}
1194
1195			$( '#menu > ul.menu' ).mfnMenu({
1196				addLast		: true,
1197				arrows		: true,
1198				mobileInit	: mm_mobile_init_W,
1199				responsive	: window.mfn.responsive
1200			});
1201
1202			$( '#secondary-menu > ul.secondary-menu' ).mfnMenu({
1203				mobileInit	: mm_mobile_init_W,
1204				responsive	: window.mfn.responsive
1205			});
1206
1207		}
1208
1209		mainMenu();
1210
1211
1212		/* ---------------------------------------------------------------------------
1213		 * Menu | NOT One Page | .scroll item
1214		 * Works with .scroll class
1215		 * Since 4.8 replaced with: Page Options > One Page | function: onePageMenu()
1216		 * --------------------------------------------------------------------------- */
1217
1218		function onePageScroll(){
1219			if( ! $('body').hasClass('one-page') ){
1220				var menu = $('#menu');
1221
1222				if( menu.find('li.scroll').length > 1 ){
1223					menu.find('li.current-menu-item:not(:first)').removeClass('current-menu-item currenet-menu-parent current-menu-ancestor current-page-ancestor current_page_item current_page_parent current_page_ancestor');
1224
1225					// menu item click
1226					menu.find('a').click(function(){
1227						$(this).closest('li').siblings('li').removeClass('current-menu-item currenet-menu-parent current-menu-ancestor current-page-ancestor current_page_item current_page_parent current_page_ancestor');
1228						$(this).closest('li').addClass('current-menu-item');
1229					});
1230				}
1231			}
1232		}
1233		onePageScroll();
1234
1235
1236		/* ---------------------------------------------------------------------------
1237		 * Menu | One Page | Active on Scroll & Click
1238		 * --------------------------------------------------------------------------- */
1239
1240		function onePageMenu(){
1241			if( $('body').hasClass('one-page') ){
1242
1243				var menu = $('#menu');
1244
1245
1246				// add attr [data-hash] & [data-id] ----------
1247
1248				$('a[href]', menu).each(function(){
1249
1250					var url = $(this).attr( 'href' );
1251					if( url && url.split('#')[1] ){
1252
1253						// data-hash
1254						var hash = '#' + url.split('#')[1];
1255						if( hash && $(hash).length ){				// check if element with specified ID exists
1256							$(this).attr( 'data-hash', hash );
1257							$(hash).attr( 'data-id', hash );
1258						}
1259
1260						// Visual Composer
1261						var vcHash = '#' + url.split('#')[1];
1262						var vcClass = '.vc_row.' + url.split('#')[1];
1263						if( vcClass && $(vcClass).length ){			// check if element with specified Class exists
1264							$(this).attr( 'data-hash', vcHash );
1265							$(vcClass).attr( 'data-id', vcHash );
1266						}
1267
1268					}
1269
1270				});
1271
1272
1273				// active ----------
1274
1275				var hash;
1276				var activeSelector 	= '.menu > li.current-menu-item, .menu > li.current-menu-parent, .menu > li.current-menu-ancestor, .menu > li.current-page-ancestor, .menu > li.current_page_item, .menu > li.current_page_parent, .menu > li.current_page_ancestor';
1277				var activeClasses 	= 'current-menu-item current-menu-parent current-menu-ancestor current-page-ancestor current_page_item current_page_parent current_page_ancestor';
1278
1279				if( $( activeSelector, menu ).length ){
1280
1281					// remove duplicated
1282					$( activeSelector, menu )
1283						.not(':first').removeClass( activeClasses );
1284
1285					// remove if 1st link to section & section is not visible
1286					hash = $( activeSelector, menu ).find('a[data-hash]').attr( 'data-hash' );
1287
1288					if( hash ){
1289						hash = '[data-id="'+ hash +'"]';
1290
1291						if( $(hash).length && $( hash ).visible( true ) ){
1292							// do nothing
1293						} else {
1294							$( activeSelector, menu ).removeClass( 'current-menu-item current-menu-parent current-menu-ancestor current-page-ancestor current_page_item current_page_parent current_page_ancestor' )
1295								.closest('.menu > li').removeClass( 'current-menu-item current-menu-parent current-menu-ancestor current-page-ancestor current_page_item current_page_parent current_page_ancestor' );
1296						}
1297					} else {
1298						// do nothing
1299					}
1300
1301				} else {
1302
1303					// add to first if none is active
1304					var first = $( '.menu:first-child > li:first-child', menu );
1305					var firstA  = first.children('a');
1306
1307					if( firstA.attr( 'data-hash' ) ){
1308						hash = firstA.attr( 'data-hash' );
1309						hash = '[data-id="'+ hash +'"]';
1310
1311						if( $(hash).length && ( $(hash).offset().top == adminBarH() ) ){
1312							first.addClass( 'current-menu-item' );
1313						}
1314					}
1315
1316				}
1317
1318
1319				// click ----------
1320
1321				$('#menu a[data-hash]').click(function(e){
1322					e.preventDefault(); // only with: body.one-page
1323
1324					// active
1325
1326					menu.find('li').removeClass('current-menu-item');
1327					$(this)
1328						.closest('li').addClass('current-menu-item')
1329						.closest('.menu > li').addClass('current-menu-item');
1330
1331					var hash = $(this).attr('data-hash');
1332					hash = '[data-id="'+ hash +'"]';
1333
1334					// mobile - sticky header - close menu
1335
1336					if( window.innerWidth < 768 ){
1337						$('.responsive-menu-toggle').removeClass('active');
1338						$('#Top_bar #menu').hide();
1339					}
1340
1341					// offset
1342
1343					var headerFixedAbH = $('.header-fixed.ab-show #Action_bar').innerHeight();
1344					var tabsHeaderH = $(hash).siblings('.ui-tabs-nav').innerHeight();
1345
1346					var offset = headerFixedAbH + tabsHeaderH + adminBarH();
1347
1348					// sticky height
1349
1350					var stickyH = fixStickyHeaderH();
1351
1352					// FIX | Header below | 1st section
1353					if( $( 'body' ).hasClass( 'header-below' ) && $( '#Content' ).length ){
1354						if( $( hash ).offset().top < ( $( '#Content' ).offset().top + 60 ) ){
1355							stickyH = -1;
1356						}
1357					}
1358
1359					// animate scroll
1360
1361					$( 'html, body' ).animate({
1362						scrollTop: $( hash ).offset().top - offset - stickyH
1363					}, 500);
1364
1365				});
1366
1367			}
1368		}
1369		onePageMenu();
1370
1371
1372		/* ---------------------------------------------------------------------------
1373		 * Header | Creative
1374		 * --------------------------------------------------------------------------- */
1375
1376		var cHeader 	= 'body:not( .header-open ) #Header_creative';
1377		var cHeaderEl 	= $( cHeader );
1378		var cHeaderCurrnet;
1379
1380		function creativeHeader(){
1381
1382			$( '.creative-menu-toggle' ).click( function(e){
1383				e.preventDefault();
1384
1385				cHeaderEl.addClass( 'active' );
1386				$( '.creative-menu-toggle, .creative-social', cHeaderEl ).fadeOut( 500 );
1387				$( '#Action_bar', cHeaderEl ).fadeIn( 500 );
1388
1389			});
1390
1391		}
1392		creativeHeader();
1393
1394		$( document ).on( 'mouseenter', cHeader, function(){
1395			cHeaderCurrnet = 1;
1396		});
1397
1398		$( document ).on( 'mouseleave', cHeader, function(){
1399			cHeaderCurrnet = null;
1400		    setTimeout(function(){
1401		    	if ( ! cHeaderCurrnet ){
1402
1403		    		cHeaderEl.removeClass( 'active' );
1404		    		$( '.creative-menu-toggle, .creative-social', cHeaderEl ).fadeIn( 500 );
1405		    		$( '#Action_bar', cHeaderEl ).fadeOut( 500 );
1406
1407		    	}
1408		    }, 1000);
1409		});
1410
1411		// Fix: Header Creative & Mobile Sticky | On Resize > 768 px
1412		function creativeHeaderFix(){
1413			if( $( 'body' ).hasClass( 'header-creative' ) && window.innerWidth >= 768 ){
1414				if( $( '#Top_bar' ).hasClass( 'is-sticky' ) ){
1415					$( '#Top_bar' ).removeClass( 'is-sticky' );
1416				}
1417			}
1418		}
1419
1420
1421		/* ---------------------------------------------------------------------------
1422		 * Header | Search
1423		 * --------------------------------------------------------------------------- */
1424
1425		$("#search_button:not(.has-input), #Top_bar .icon_close").click(function(e){
1426			e.preventDefault();
1427			$('#Top_bar .search_wrapper').fadeToggle()
1428				.find('.field').focus();
1429		});
1430
1431
1432		/* ---------------------------------------------------------------------------
1433		 * WPML | Language switcher in the WP Menu
1434		 * --------------------------------------------------------------------------- */
1435
1436		function mfn_wpml(){
1437			$('#menu .menu-item-language:not(.menu-item-language-current)').each(function(){
1438				var el = $(this).children('a');
1439
1440				if( ! el.children('span:not(.icl_lang_sel_bracket)').length ){
1441					el.wrapInner('<span></span>');
1442				}
1443
1444			});
1445
1446			$('#menu span.icl_lang_sel_bracket').each(function(){
1447				var el = $(this);
1448				el.replaceWith( el.html() );
1449			});
1450
1451		}
1452		mfn_wpml();
1453
1454
1455		/* ---------------------------------------------------------------------------
1456		 * Breadcrumbs | Remove last item link
1457		 * --------------------------------------------------------------------------- */
1458
1459		function breadcrumbsRemoveLastLink(){
1460			var el = $('.breadcrumbs.no-link').find('li').last();
1461			var text = el.text();
1462			el.html( text );
1463		}
1464		breadcrumbsRemoveLastLink();
1465
1466
1467        /* ---------------------------------------------------------------------------
1468         * Downcount
1469         * --------------------------------------------------------------------------- */
1470
1471        $( '.downcount' ).each( function(){
1472        	var el = $(this);
1473        	el.downCount({
1474        		date	: el.attr('data-date'),
1475        		offset	: el.attr('data-offset')
1476        	});
1477        });
1478
1479
1480        /* ---------------------------------------------------------------------------
1481         * Hover | on Touch | .tooltip, .hover_box
1482         * --------------------------------------------------------------------------- */
1483
1484        $( '.tooltip, .hover_box' )
1485        .bind( 'touchstart', function(){
1486            $( this ).toggleClass( 'hover' );
1487        })
1488        .bind( 'touchend', function(){
1489            $( this ).removeClass( 'hover' );
1490        });
1491
1492
1493        /* ---------------------------------------------------------------------------
1494         * Popup | Contact Form | Button
1495         * --------------------------------------------------------------------------- */
1496
1497        $("#popup_contact > a.button").click(function(e){
1498        	e.preventDefault();
1499        	$(this).parent().toggleClass('focus');
1500        });
1501
1502
1503        /* ---------------------------------------------------------------------------
1504		 * Scroll | niceScroll
1505		 * --------------------------------------------------------------------------- */
1506
1507        if( $('body').hasClass('nice-scroll-on') && window.innerWidth >= 768 && ! navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|Opera Mini)/))
1508        {
1509        	$('html').niceScroll({
1510        		autohidemode		: false,
1511        		cursorborder		: 0,
1512        		cursorborderradius	: 5,
1513        		cursorcolor			: '#222222',
1514        		cursorwidth			: 10,
1515        		horizrailenabled	: false,
1516        		mousescrollstep		: ( window.mfn.nicescroll ) ? window.mfn.nicescroll : 40,
1517        		scrollspeed			: 60
1518        	});
1519
1520        	$('body').removeClass('nice-scroll-on').addClass('nice-scroll');
1521        	niceScrollFix();
1522	    }
1523
1524
1525        if( ('#Header_creative.scroll').length && window.innerWidth >= 1240 ){
1526        	$('#Header_creative.scroll').niceScroll({
1527        		autohidemode		: false,
1528        		cursorborder		: 0,
1529        		cursorborderradius	: 5,
1530        		cursorcolor			: '#222222',
1531        		cursorwidth			: 0,
1532        		horizrailenabled	: false,
1533        		mousescrollstep		: 40,
1534        		scrollspeed			: 60
1535        	});
1536        }
1537
1538
1539		/* ---------------------------------------------------------------------------
1540		 * Black & White
1541		 * --------------------------------------------------------------------------- */
1542
1543		function mfn_greyscale(){
1544	        $('.greyscale .image_wrapper > a, .greyscale .image_wrapper_tiles, .greyscale.portfolio-photo a, .greyscale .client_wrapper .gs-wrapper').has('img').BlackAndWhite({
1545	    		hoverEffect		: false,
1546	    		intensity		: 1			// opacity: 0, 0.1, ... 1
1547	    	});
1548		}
1549		mfn_greyscale();
1550
1551
1552		/* ---------------------------------------------------------------------------
1553		 * Sliding Top
1554		 * --------------------------------------------------------------------------- */
1555
1556		$( '.sliding-top-control' ).click(function(e){
1557			e.preventDefault();
1558			$('#Sliding-top .widgets_wrapper').slideToggle();
1559			$('#Sliding-top').toggleClass('active');
1560		});
1561
1562
1563		/* ---------------------------------------------------------------------------
1564		 * Alert
1565		 * --------------------------------------------------------------------------- */
1566
1567		$(this).on('click', '.alert .close', function(e) {
1568			e.preventDefault();
1569			$(this).closest('.alert').hide(300);
1570		});
1571
1572
1573		/* ---------------------------------------------------------------------------
1574		 * Button | mark buttons with icon & label
1575		 * --------------------------------------------------------------------------- */
1576
1577		$( 'a.button_js' ).each(function(){
1578			var btn = $(this);
1579			if( btn.find('.button_icon').length && btn.find('.button_label').length ){
1580				btn.addClass('kill_the_icon');
1581			}
1582		});
1583
1584
1585		/* ---------------------------------------------------------------------------
1586		 * Navigation Arrows | Sticky
1587		 * --------------------------------------------------------------------------- */
1588
1589		$('.fixed-nav').appendTo( 'body' );
1590
1591
1592		/* ---------------------------------------------------------------------------
1593		 * Feature List
1594		 * --------------------------------------------------------------------------- */
1595
1596		$('.feature_list').each(function(){
1597			var col = $(this).attr('data-col') ? $(this).attr('data-col') : 4;
1598			$(this).find('li:nth-child('+ col +'n):not(:last-child)').after('<hr />');
1599		});
1600
1601
1602		/* ---------------------------------------------------------------------------
1603		 * IE Fixes
1604		 * --------------------------------------------------------------------------- */
1605
1606		function checkIE(){
1607			// IE 9
1608			var ua = window.navigator.userAgent;
1609	        var msie = ua.indexOf("MSIE ");
1610	        if( msie > 0 && parseInt(ua.substring(msie + 5, ua.indexOf(".", msie))) == 9 ){
1611	        	$("body").addClass("ie");
1612			}
1613		}
1614		checkIE();
1615
1616
1617		/* ---------------------------------------------------------------------------
1618		 * Parallax
1619		 * --------------------------------------------------------------------------- */
1620
1621		var ua = navigator.userAgent,
1622		isMobileWebkit = /WebKit/.test(ua) && /Mobile/.test(ua);
1623
1624		if( ! isMobileWebkit && window.innerWidth >= 768 ){
1625
1626			if( window.mfn.parallax == 'stellar' ){
1627
1628				// Stellar
1629				$.stellar({
1630					horizontalScrolling	: false,
1631					responsive			: true
1632				});
1633
1634			} else {
1635
1636				// Enllax
1637				$( window ).enllax();
1638
1639			}
1640
1641		} else {
1642
1643			$('div[data-enllax-ratio], div[data-stellar-ratio]').css( 'background-attachment' , 'scroll' );
1644
1645		}
1646
1647
1648		/* ---------------------------------------------------------------------------
1649		 * Load More | Ajax
1650		 * --------------------------------------------------------------------------- */
1651
1652		$( '.pager_load_more' ).click(function(e){
1653			e.preventDefault();
1654
1655			var el = $(this);
1656			var pager = el.closest( '.pager_lm' );
1657			var href = el.attr( 'href' );
1658
1659			// index | for many items on the page
1660			var index = $( '.lm_wrapper' ).index(el.closest( '.isotope_wrapper' ).find( '.lm_wrapper' ));
1661
1662			el.fadeOut(50);
1663			pager.addClass( 'loading' );
1664
1665			$.get( href, function( data ){
1666
1667				// content
1668				var content = $( '.lm_wrapper:eq('+ index +')', data ).wrapInner('').html();
1669
1670				if( $( '.lm_wrapper:eq('+ index +')' ).hasClass( 'isotope' ) ){
1671					// isotope
1672					$( '.lm_wrapper:eq('+ index +')' ).append( $( content ) ).isotope( 'reloadItems' ).isotope({ sortBy: 'original-order' });
1673				} else {
1674					// default
1675					$( content ).hide().appendTo( '.lm_wrapper:eq('+ index +')' ).fadeIn( 1000 );
1676				}
1677
1678				// next page link
1679				href = $( '.lm_wrapper:eq('+ index +')', data ).next().find( '.pager_load_more' ).attr( 'href' );
1680				pager.removeClass( 'loading' );
1681				if( href ){
1682					el.fadeIn();
1683					el.attr( 'href', href );
1684				}
1685
1686				// refresh some staff -------------------------------
1687
1688				mfn_greyscale();
1689
1690				mfn_jPlayer();
1691
1692				lightbox();
1693
1694				// isotope fix: second resize
1695
1696				$( '.lm_wrapper.isotope' ).imagesLoaded().progress( function() {
1697					$( '.lm_wrapper.isotope' ).isotope( 'layout' );
1698				});
1699
1700			});
1701
1702		});
1703
1704
1705		/* ---------------------------------------------------------------------------
1706		 * Filters | Blog & Portfolio
1707		 * --------------------------------------------------------------------------- */
1708
1709		$('.filters_buttons .open').click(function(e){
1710			e.preventDefault();
1711			var type = $(this).closest('li').attr('class');
1712			$('.filters_wrapper').show(200);
1713			$('.filters_wrapper ul.'+ type).show(200);
1714			$('.filters_wrapper ul:not(.'+ type +')').hide();
1715		});
1716
1717		$('.filters_wrapper .close a').click(function(e){
1718			e.preventDefault();
1719			$('.filters_wrapper').hide(200);
1720		});
1721
1722
1723		/* ---------------------------------------------------------------------------
1724		 * Portfolio List | Next v / Prev ^ buttons
1725		 * --------------------------------------------------------------------------- */
1726
1727		$('.portfolio_next_js').click(function(e){
1728			e.preventDefault();
1729
1730			var item = $(this).closest('.portfolio-item').next();
1731
1732			if( item.length ){
1733				$('html, body').animate({
1734					scrollTop: item.offset().top - fixStickyHeaderH()
1735				}, 500);
1736			}
1737		});
1738
1739		$('.portfolio_prev_js').click(function(e){
1740			e.preventDefault();
1741
1742			var item = $(this).closest('.portfolio-item').prev();
1743
1744			if( item.length ){
1745				$('html, body').animate({
1746					scrollTop: item.offset().top - fixStickyHeaderH()
1747				}, 500);
1748			}
1749		});
1750
1751
1752		/* ---------------------------------------------------------------------------
1753		 * Link | Smooth Scroll | .scroll
1754		 * --------------------------------------------------------------------------- */
1755
1756		$( '.scroll > a, a.scroll' ).click( function(e){
1757
1758			// prevent default if link directs to the current page
1759
1760			var urlL = location.href.replace(/\/#.*|#.*/, '');
1761			var urlT = this.href.replace(/\/#.*|#.*/, '');
1762			if( urlL == urlT ) e.preventDefault();
1763
1764			var hash = this.hash;
1765
1766      // offset
1767
1768      var headerFixedAbH = $('.header-fixed.ab-show #Action_bar').innerHeight();
1769      var tabsHeaderH = $(hash).siblings('.ui-tabs-nav').innerHeight();
1770
1771      var offset = headerFixedAbH + tabsHeaderH + adminBarH();
1772
1773      // animate scroll
1774
1775			if( hash && $(hash).length ){
1776
1777				$( 'html, body' ).animate({
1778          scrollTop: $( hash ).offset().top - offset - fixStickyHeaderH()
1779				}, 500 );
1780			}
1781		});
1782
1783
1784		/* ---------------------------------------------------------------------------
1785		 * Tabs
1786		 * --------------------------------------------------------------------------- */
1787
1788		$( '.jq-tabs' ).tabs();
1789
1790
1791		/* ---------------------------------------------------------------------------
1792		 * Accordion & FAQ
1793		 * --------------------------------------------------------------------------- */
1794
1795		$( '.mfn-acc' ).each( function(){
1796			var el = $(this);
1797
1798			if( el.hasClass('openAll') ){
1799				// show all -----------
1800
1801				el.find('.question')
1802					.addClass("active")
1803					.children(".answer")
1804						.show();
1805
1806			} else {
1807				// show one -----------
1808
1809				var active_tab = el.attr('data-active-tab');
1810				if( el.hasClass('open1st') ) active_tab = 1;
1811
1812				if( active_tab ){
1813					el.find('.question').eq( active_tab - 1 )
1814						.addClass("active")
1815						.children(".answer")
1816							.show();
1817				}
1818
1819			}
1820		});
1821
1822		$( '.mfn-acc .question > .title' ).click( function(){
1823
1824			if($(this).parent().hasClass("active")) {
1825
1826				$(this).parent().removeClass("active").children(".answer").slideToggle(100);
1827
1828			} else {
1829
1830				if( ! $(this).closest('.mfn-acc').hasClass('toggle') ){
1831					$(this).parents(".mfn-acc").children().each(function() {
1832						if($(this).hasClass("active")) {
1833							$(this).removeClass("active").children(".answer").slideToggle(100);
1834						}
1835					});
1836				}
1837				$(this).parent().addClass("active");
1838				$(this).next(".answer").slideToggle(100);
1839
1840			}
1841
1842			setTimeout( function(){
1843				$( window ).trigger( 'resize' );
1844			}, 50 );
1845
1846		});
1847
1848		// Visual Composer | Accordion | Sidebar height
1849		$( '.wpb_wrapper .vc_tta-panel-title' ).on( 'click', 'a', function(){
1850
1851			setTimeout( function(){
1852				$( window ).trigger( 'resize' );
1853			}, 50 );
1854
1855		});
1856
1857
1858		/* ---------------------------------------------------------------------------
1859		 * Helper
1860		 * --------------------------------------------------------------------------- */
1861
1862		$('.helper .link.toggle').click( function(e){
1863
1864			e.preventDefault();
1865
1866			var el = $(this);
1867			var id = el.attr('data-rel');
1868			var parent = el.closest('.helper');
1869
1870			if( el.hasClass('active') ){
1871
1872				el.removeClass('active');
1873				parent.find('.helper_content > .item-' + id ).removeClass('active').slideUp(200);
1874
1875			} else {
1876
1877				parent.find('.links > .link.active').removeClass('active');
1878				parent.find('.helper_content > .item.active').slideUp(200);
1879
1880				el.addClass('active');
1881				parent.find('.helper_content > .item-' + id ).addClass('active').slideDown(200);
1882
1883			}
1884
1885			setTimeout( function(){
1886				$( window ).trigger( 'resize' );
1887			}, 50 );
1888
1889		});
1890
1891
1892		/* ---------------------------------------------------------------------------
1893		 * HTML5 Video | jPlayer
1894		 * --------------------------------------------------------------------------- */
1895
1896		function mfn_jPlayer(){
1897			$('.mfn-jplayer').each(function(){
1898				var m4v = $(this).attr('data-m4v');
1899				var poster = $(this).attr('data-img');
1900				var swfPath = $(this).attr('data-swf');
1901				var cssSelectorAncestor = '#' + $(this).closest('.mfn-jcontainer').attr('id');
1902
1903				$(this).jPlayer({
1904					ready	: function () {
1905						$(this).jPlayer('setMedia', {
1906							m4v		: m4v,
1907							poster	: poster
1908						});
1909					},
1910					play	: function () { // To avoid both jPlayers playing together.
1911						$(this).jPlayer('pauseOthers');
1912					},
1913					size: {
1914						cssClass	: 'jp-video-360p',
1915						width		: '100%',
1916						height		: '360px'
1917					},
1918					swfPath				: swfPath,
1919					supplied			: 'm4v',
1920					cssSelectorAncestor	: cssSelectorAncestor,
1921					wmode				: 'opaque'
1922				});
1923			});
1924		}
1925		mfn_jPlayer();
1926
1927
1928		/* ---------------------------------------------------------------------------
1929		 * Love
1930		 * --------------------------------------------------------------------------- */
1931
1932		$('.mfn-love').click(function() {
1933			var el = $( this );
1934			if( el.hasClass( 'loved' ) ){
1935				return false;
1936			}
1937			el.addClass( 'loved' );
1938
1939			var post = {
1940				action: 'mfn_love',
1941				post_id: el.attr( 'data-id' )
1942			};
1943
1944			$.post( window.mfn_ajax, post, function( data ){
1945				el.find( '.label' ).html( data );
1946			});
1947
1948			return false;
1949		});
1950
1951
1952		/* ---------------------------------------------------------------------------
1953		 * Go to top
1954		 * --------------------------------------------------------------------------- */
1955
1956		$('#back_to_top').click(function(){
1957			$('body,html').animate({
1958				scrollTop: 0
1959			}, 500);
1960			return false;
1961		});
1962
1963
1964		/* ---------------------------------------------------------------------------
1965		 * Section | Next v / Prev ^ arrows
1966		 * --------------------------------------------------------------------------- */
1967
1968		$('.section .section-nav').click(function(){
1969			var el = $(this);
1970			var section = el.closest('.section');
1971
1972			if( el.hasClass('prev') ){
1973				// Previous Section -------------
1974				if( section.prev().length ){
1975					$('html, body').animate({
1976						scrollTop: section.prev().offset().top
1977					}, 500);
1978				}
1979			} else {
1980				// Next Section -----------------
1981				if( section.next().length ){
1982					$('html, body').animate({
1983						scrollTop: section.next().offset().top
1984					}, 500);
1985				}
1986			}
1987		});
1988
1989
1990		/* ---------------------------------------------------------------------------
1991		 * Intro | Scroll v arrow
1992		 * --------------------------------------------------------------------------- */
1993
1994		$('#Intro .intro-next').click(function(){
1995			var intro = $(this).closest('#Intro');
1996
1997			if( intro.next().length ){
1998				$('html, body').animate({
1999					scrollTop: intro.next().offset().top - fixStickyHeaderH() - adminBarH()
2000				}, 500);
2001			}
2002		});
2003
2004
2005		/* ---------------------------------------------------------------------------
2006		 * Widget | Muffin Menu | Hover on click
2007		 * --------------------------------------------------------------------------- */
2008
2009		$('.widget_mfn_menu ul.submenus-click').each(function(){
2010			var el = $(this);
2011			$( 'a', el ).click(function(e){
2012				var li = $(this).closest('li');
2013
2014				if( li.hasClass('hover') || ! li.hasClass('menu-item-has-children') ){
2015					// link click
2016				} else {
2017					e.preventDefault();
2018					li.siblings('li').removeClass('hover')
2019						.find('li').removeClass('hover');
2020					$(this).closest('li').addClass('hover');
2021				}
2022
2023			});
2024		});
2025
2026
2027		/* ---------------------------------------------------------------------------
2028		 * WooCommerce | Add to cart
2029		 * --------------------------------------------------------------------------- */
2030
2031		function addToCart(){
2032			$('body').on('click', '.add_to_cart_button', function(){
2033				$(this)
2034					.closest('.product')
2035						.addClass('adding-to-cart')
2036						.removeClass('added-to-cart');
2037			});
2038
2039			$('body').bind('added_to_cart', function() {
2040				$('.adding-to-cart')
2041					.removeClass('adding-to-cart')
2042					.addClass('added-to-cart');
2043			});
2044		}
2045		addToCart();
2046
2047
2048		/* ---------------------------------------------------------------------------
2049		 * Ajax | Complete
2050		 * --------------------------------------------------------------------------- */
2051
2052		$( document ).ajaxComplete( function() {
2053
2054			setTimeout( function(){
2055				$( window ).trigger( 'resize' );
2056			}, 100 );
2057
2058		});
2059
2060
2061		/* ---------------------------------------------------------------------------
2062		 * Isotope
2063		 * --------------------------------------------------------------------------- */
2064
2065		// Isotope | Fiters ----------
2066
2067		function isotopeFilter( domEl, isoWrapper ){
2068
2069			var filter = domEl.attr('data-rel');
2070			isoWrapper.isotope({ filter: filter });
2071
2072      setTimeout( function(){
2073				$( window ).trigger( 'resize' );
2074			}, 50 );
2075
2076		}
2077
2078		// Isotope | Fiters | Click ----------
2079
2080		$('.isotope-filters .filters_wrapper').find('li:not(.close) a').click(function(e){
2081			e.preventDefault();
2082
2083			var isoWrapper = $('.isotope');
2084			var filters 	= $(this).closest('.isotope-filters');
2085			var parent  	= filters.attr('data-parent');
2086
2087			if( parent ){
2088				parent = filters.closest( '.' + parent );
2089				isoWrapper = parent.find('.isotope').first();
2090			}
2091
2092			filters.find('li').removeClass('current-cat');
2093			$(this).closest('li').addClass('current-cat');
2094
2095			isotopeFilter( $(this), isoWrapper );
2096
2097      setTimeout( function(){
2098        $( document ).trigger( 'isotope:arrange' );
2099			}, 500 );
2100		});
2101
2102
2103		// Isotope | Fiters | Reset ----------
2104
2105		$('.isotope-filters .filters_buttons').find('li.reset a').click(function(e){
2106			e.preventDefault();
2107
2108			$('.isotope-filters .filters_wrapper').find('li').removeClass('current-cat');
2109			isotopeFilter( $(this), $('.isotope') );
2110		});
2111
2112
2113
2114		/* --------------------------------------------------------------------------------------------------------------------------
2115		 *
2116		 * $( window ).resize | Debouncedresize
2117		 *
2118		 * ----------------------------------------------------------------------------------------------------------------------- */
2119
2120
2121		$( window ).bind( 'debouncedresize', function(){
2122
2123
2124			// Isotope | Relayout
2125			$( '.masonry.isotope' ).isotope();
2126			$( '.masonry.gallery' ).isotope( 'layout' );
2127
2128			// Sliding Footer | Height
2129			mfn_footer();
2130
2131			// Header Width
2132			mfn_header();
2133
2134			// Sidebar Height
2135			mfn_sidebar();
2136
2137			// Full Screen Section
2138			mfn_sectionH();
2139
2140			// Full Screen Intro
2141			mfn_introH();
2142
2143			// niceScroll | Padding right fix for short content
2144			niceScrollFix();
2145
2146			// Zoom Box | Vertical Align
2147			zoomBoxVerticalAlign();
2148
2149			// Equal | Height
2150			mfn_equalH_wrap();
2151			mfn_equalH();
2152
2153			// Header Creative & Mobile Sticky
2154			creativeHeaderFix();
2155
2156		});
2157
2158
2159
2160		/* --------------------------------------------------------------------------------------------------------------------------
2161		 *
2162		 * document.ready | Init
2163		 *
2164		 * ----------------------------------------------------------------------------------------------------------------------- */
2165
2166		mfnSliderBlog();
2167		mfnSliderClients();
2168		mfnSliderOffer();
2169		mfnSliderOfferThumb();
2170		mfnSliderShop();
2171
2172		sliderPortfolio();
2173		sliderSlider();
2174		sliderTestimonials();
2175
2176		// Sidebar | Height
2177		mfn_sidebar();
2178
2179		// Sliding Footer | Height
2180		mfn_footer();
2181
2182		// Header | Width
2183		mfn_header();
2184
2185		// Full Screen Section
2186		mfn_sectionH();
2187		// Navigation | Hash
2188		hashNav();
2189
2190		// Full Screen Intro
2191		mfn_introH();
2192
2193		// Equal | Height
2194		mfn_equalH_wrap();
2195		mfn_equalH();
2196	});
2197
2198
2199
2200	/* --------------------------------------------------------------------------------------------------------------------------
2201	 *
2202	 * $( window ).scroll
2203	 *
2204	 * ----------------------------------------------------------------------------------------------------------------------- */
2205
2206
2207	$( window ).scroll( function(){
2208
2209		// Header | Sticky
2210		mfn_sticky();
2211
2212		// Back to top | Sticky
2213		backToTopSticky();
2214
2215		// One Page | Scroll | Active Section
2216		onePageActive();
2217
2218	});
2219
2220
2221
2222	/* --------------------------------------------------------------------------------------------------------------------------
2223	 *
2224	 * $( window ).load
2225	 *
2226	 * ----------------------------------------------------------------------------------------------------------------------- */
2227
2228
2229	$( window ).load( function(){
2230
2231
2232		/* ---------------------------------------------------------------------------
2233		 * Retina Logo
2234		 * --------------------------------------------------------------------------- */
2235
2236		function retinaLogo(){
2237			if( window.devicePixelRatio > 1 ){
2238
2239				var el 		= '';
2240				var src 	= '';
2241				var height 	= '';
2242
2243				var parent 	= $( '#Top_bar #logo' );
2244				var parentH	= parent.data( 'height' );
2245
2246				var maxH	= {
2247					sticky : {
2248						init 			: 35,
2249						no_padding		: 60,
2250						overflow 		: 110
2251					},
2252					mobile : {
2253						mini 			: 50,
2254						mini_no_padding	: 60
2255					},
2256					mobile_sticky : {
2257						init 			: 50,
2258						no_padding		: 60,
2259						overflow 		: 80
2260					}
2261				};
2262
2263				$( '#Top_bar #logo img' ).each( function( index ){
2264
2265					el 		= $( this );
2266					src 	= el.data( 'retina' );
2267					height 	= el.height();
2268
2269
2270					// main -----
2271
2272					if( el.hasClass( 'logo-main' ) ){
2273
2274						if( $( 'body' ).hasClass( 'logo-overflow' ) ){
2275
2276							// do nothing
2277
2278						} else if( height > parentH ){
2279
2280							height = parentH;
2281
2282						}
2283
2284					}
2285
2286					// sticky -----
2287
2288					if( el.hasClass( 'logo-sticky' ) ){
2289
2290						if( $( 'body' ).hasClass( 'logo-overflow' ) ){
2291
2292							if( height > maxH.sticky.overflow ){
2293								height = maxH.sticky.overflow;
2294							}
2295
2296						} else if( $( 'body' ).hasClass( 'logo-no-sticky-padding' ) ){
2297
2298							if( height > maxH.sticky.no_padding ){
2299								height = maxH.sticky.no_padding;
2300							}
2301
2302						} else if( height > maxH.sticky.init ){
2303
2304							height = maxH.sticky.init;
2305
2306						}
2307
2308					}
2309
2310					// mobile -----
2311
2312					if( el.hasClass( 'logo-mobile' ) ){
2313
2314						if( $( 'body' ).hasClass( 'mobile-header-mini' ) ){
2315
2316							if( parent.data( 'padding' ) > 0 ){
2317
2318								if( height > maxH.mobile.mini ){
2319									height = maxH.mobile.mini;
2320								}
2321
2322							} else {
2323
2324								if( height > maxH.mobile.mini_no_padding ){
2325									height = maxH.mobile.mini_no_padding;
2326								}
2327
2328							}
2329
2330						}
2331
2332					}
2333
2334					// mobile-sticky -----
2335
2336					if( el.hasClass( 'logo-mobile-sticky' ) ){
2337
2338						if( $( 'body' ).hasClass( 'logo-no-sticky-padding' ) ){
2339
2340							if( height > maxH.mobile_sticky.no_padding ){
2341								height = maxH.mobile_sticky.no_padding;
2342							}
2343
2344						} else if( height > maxH.mobile_sticky.init ){
2345							height = maxH.mobile_sticky.init;
2346						}
2347
2348					}
2349
2350
2351					// SET
2352
2353					if( src ){
2354						el.parent().addClass( 'retina' );
2355						el.attr( 'src', src ).css( 'max-height', height + 'px' );
2356					}
2357
2358				});
2359
2360			}
2361		}
2362		retinaLogo();
2363
2364
2365		/* ---------------------------------------------------------------------------
2366		 * Isotope
2367		 * --------------------------------------------------------------------------- */
2368
2369		// Portfolio - Isotope
2370		$( '.blog_wrapper .isotope:not( .masonry ), .portfolio_wrapper .isotope:not( .masonry-flat, .masonry-hover, .masonry-minimal )' ).isotope({
2371			itemSelector	: '.isotope-item',
2372			layoutMode		: 'fitRows',
2373			isOriginLeft	: rtl ? false : true
2374		});
2375
2376		// Portfolio - Masonry Flat
2377		$( '.portfolio_wrapper .masonry-flat' ).isotope({
2378			itemSelector	: '.isotope-item',
2379			percentPosition	: true,
2380			masonry			: {
2381				columnWidth: 1
2382		    },
2383		    isOriginLeft	: rtl ? false : true
2384		});
2385
2386		// Blog & Portfolio - Masonry
2387		$( '.isotope.masonry, .isotope.masonry-hover, .isotope.masonry-minimal' ).isotope({
2388			itemSelector	: '.isotope-item',
2389			layoutMode		: 'masonry',
2390			isOriginLeft	: rtl ? false : true
2391		});
2392
2393		// Portfolio | Active Category
2394		function portfolioActive(){
2395			var el 		= $( '.isotope-filters .filters_wrapper' );
2396			var active 	= el.attr( 'data-cat' );
2397
2398			if( active ){
2399				el.find( 'li.' + active ).addClass( 'current-cat' );
2400				$( '.isotope' ).isotope({ filter: '.category-' + active });
2401			}
2402		}
2403		portfolioActive();
2404
2405
2406		/* ---------------------------------------------------------------------------
2407		 * Chart
2408		 * --------------------------------------------------------------------------- */
2409
2410		$( '.chart' ).waypoint({
2411
2412			offset		: '100%',
2413			triggerOnce	: true,
2414			handler		: function(){
2415
2416				var el 		= $( this.element ).length ? $( this.element ) : $( this );
2417				var lineW 	= simple ? 4 : 8;
2418
2419				el.easyPieChart({
2420					animate		: 1000,
2421					lineCap		: 'circle',
2422					lineWidth	: lineW,
2423					size		: 140,
2424					scaleColor	: false,
2425					trackColor	: '#f8f8f8'
2426				});
2427
2428				if( typeof this.destroy !== 'undefined' && $.isFunction( this.destroy ) ){
2429					this.destroy();
2430				}
2431			}
2432		});
2433
2434
2435		/* ---------------------------------------------------------------------------
2436		 * Skills
2437		 * --------------------------------------------------------------------------- */
2438
2439		$( '.bars_list' ).waypoint({
2440
2441			offset		: '100%',
2442			triggerOnce	: true,
2443			handler		: function(){
2444
2445				var el = $( this.element ).length ? $( this.element ) : $( this );
2446
2447				el.addClass( 'hover' );
2448
2449				if( typeof this.destroy !== 'undefined' && $.isFunction( this.destroy ) ){
2450					this.destroy();
2451				}
2452			}
2453		});
2454
2455
2456		/* ---------------------------------------------------------------------------
2457		 * Progress Icons
2458		 * --------------------------------------------------------------------------- */
2459
2460		$('.progress_icons').waypoint({
2461
2462			offset		: '100%',
2463			triggerOnce	: true,
2464			handler		: function(){
2465
2466				var el 		= $( this.element ).length ? $( this.element ) : $( this );
2467				var active 	= el.attr( 'data-active' );
2468				var color 	= el.attr( 'data-color' );
2469				var icon 	= el.find( '.progress_icon' );
2470				var timeout	= 200;		// timeout in milliseconds
2471
2472				icon.each( function(i){
2473					if( i < active ){
2474						var time = ( i+1 ) * timeout;
2475						setTimeout( function(){
2476							$( icon[i] )
2477								.addClass( 'themebg' )
2478								.css( 'background-color', color );
2479						},time );
2480					}
2481				});
2482
2483				if( typeof this.destroy !== 'undefined' && $.isFunction( this.destroy ) ){
2484					this.destroy();
2485				}
2486			}
2487		});
2488
2489
2490		/* ---------------------------------------------------------------------------
2491		 * Animate Math | Counter, Quick Fact, etc.
2492		 * --------------------------------------------------------------------------- */
2493
2494		$('.animate-math .number').waypoint({
2495
2496			offset		: '100%',
2497			triggerOnce	: true,
2498			handler		: function(){
2499
2500				var el			= $( this.element ).length ? $( this.element ) : $( this );
2501				var duration	= Math.floor( ( Math.random() * 1000 ) + 1000 );
2502				var to			= el.attr( 'data-to' );
2503
2504				$({ property:0 }).animate({ property:to }, {
2505					duration	: duration,
2506					easing		:'linear',
2507					step		: function() {
2508						el.text( Math.floor( this.property ) );
2509					},
2510					complete	: function() {
2511						el.text( this.property );
2512					}
2513				});
2514
2515				if( typeof this.destroy !== 'undefined' && $.isFunction( this.destroy ) ){
2516					this.destroy();
2517				}
2518			}
2519		});
2520
2521
2522		/* ---------------------------------------------------------------------------
2523		 * Before After | TwentyTwenty
2524		 * --------------------------------------------------------------------------- */
2525
2526		$('.before_after.twentytwenty-container').twentytwenty();
2527
2528
2529		/* --------------------------------------------------------------------------------------------------------------------------
2530		 *
2531		 * window.load | Init
2532		 *
2533		 * ----------------------------------------------------------------------------------------------------------------------- */
2534
2535    // Header | Sticky
2536    mfn_stickyH();
2537 		mfn_sticky();
2538 		mfn_mobile_sticky();
2539
2540		// Full Screen Section
2541		mfn_sectionH();
2542
2543		// Navigation | Hash
2544		hashNav();
2545
2546		// Full Screen Intro
2547		mfn_introH();
2548
2549		// FIX | Revolution Slider Width & Height OnLoad
2550		$( window ).trigger( 'resize' );
2551
2552		// Sidebar | Height
2553		setTimeout( function(){
2554			mfn_sidebar();
2555		}, 10 );
2556	});
2557
2558
2559
2560	/* --------------------------------------------------------------------------------------------------------------------------
2561	 *
2562	 * $( document ).mouseup
2563	 *
2564	 * ----------------------------------------------------------------------------------------------------------------------- */
2565
2566
2567	$( document ).mouseup(function(e){
2568
2569
2570		// Widget | Muffin Menu | Hover on click
2571		if( $(".widget_mfn_menu ul.submenus-click").length ){
2572			if( $(".widget_mfn_menu ul.submenus-click").has(e.target).length === 0 ){
2573				$('.widget_mfn_menu ul.submenus-click li').removeClass('hover');
2574			}
2575		}
2576
2577
2578	});
2579
2580
2581
2582	/* --------------------------------------------------------------------------------------------------------------------------
2583	 *
2584	 * Sliders configuration
2585	 *
2586	 * ----------------------------------------------------------------------------------------------------------------------- */
2587
2588
2589	// Slick Slider | Auto responsive -----------------------------------------
2590
2591	function slickAutoResponsive( slider, max, size ){
2592
2593		if( ! max ) max = 5;
2594		if( ! size ) size = 380;
2595
2596		var width = slider.width();
2597		var count = Math.ceil( width / size );
2598
2599		if( count < 1 ) count = 1;
2600		if( count > max ) count = max;
2601
2602		return count;
2603	}
2604
2605
2606	// --- Offer Thumb -----------------------------------------------------------------
2607
2608	function mfnSliderOfferThumb(){
2609
2610		var pager = function( el, i ){
2611	        var img = $( el.$slides[i] ).children( '.thumbnail' ).html();
2612	        return '<a>'+ img +'</a>';
2613	    };
2614
2615		$('.offer_thumb_ul').each(function(){
2616
2617			var slider = $(this);
2618
2619			slider.slick({
2620				cssEase			: 'ease-out',
2621				arrows			: false,
2622				dots			: true,
2623				infinite		: true,
2624				touchThreshold	: 10,
2625				speed			: 300,
2626
2627				adaptiveHeight	: true,
2628				appendDots		: slider.siblings( '.slider_pagination' ),
2629				customPaging 	: pager,
2630
2631				rtl				: rtl ? true : false,
2632				autoplay		: window.mfn_sliders.offer ? true : false,
2633				autoplaySpeed	: window.mfn_sliders.offer ? window.mfn_sliders.offer : 5000,
2634
2635				slidesToShow	: 1,
2636				slidesToScroll	: 1
2637			});
2638
2639		});
2640	}
2641
2642
2643	// --- Offer -----------------------------------------------------------------
2644
2645	function mfnSliderOffer(){
2646		$('.offer_ul').each( function(){
2647
2648			var slider = $(this);
2649
2650			slider.slick({
2651				cssEase			: 'ease-out',
2652				dots			: false,
2653				infinite		: true,
2654				touchThreshold	: 10,
2655				speed			: 300,
2656
2657				prevArrow		: '<a class="button button_large button_js slider_prev" href="#"><span class="button_icon"><i class="icon-up-open-big"></i></span></a>',
2658				nextArrow		: '<a class="button button_large button_js slider_next" href="#"><span class="button_icon"><i class="icon-down-open-big"></i></span></a>',
2659
2660				adaptiveHeight	: true,
2661				//customPaging 	: pager,
2662
2663				rtl				: rtl ? true : false,
2664				autoplay		: window.mfn_sliders.offer ? true : false,
2665				autoplaySpeed	: window.mfn_sliders.offer ? window.mfn_sliders.offer : 5000,
2666
2667				slidesToShow	: 1,
2668				slidesToScroll	: 1
2669			});
2670
2671			// Pagination | Show (css)
2672			slider.siblings('.slider_pagination').addClass('show');
2673
2674			// Pager | Set slide number after change
2675			slider.on( 'afterChange', function( event, slick, currentSlide, nextSlide ){
2676				slider.siblings('.slider_pagination').find('.current').text( currentSlide + 1 );
2677			});
2678
2679		});
2680	}
2681
2682
2683	// --- Shop ------------------------------------------------------------------
2684
2685	function mfnSliderShop(){
2686
2687		var pager = function( el, i ){
2688	        return '<a>'+ i +'</a>';
2689	    };
2690
2691		$('.shop_slider_ul').each(function(){
2692
2693			var slider = $(this);
2694			var slidesToShow = 4;
2695
2696			var count = slider.closest( '.shop_slider' ).data( 'count' );
2697			if( slidesToShow > count ){
2698				slidesToShow = count;
2699				if( slidesToShow < 1 ){
2700					slidesToShow = 1;
2701				}
2702			}
2703
2704			slider.slick({
2705				cssEase			: 'ease-out',
2706				dots			: true,
2707				infinite		: true,
2708				touchThreshold	: 10,
2709				speed			: 300,
2710
2711				prevArrow		: '<a class="button button_js slider_prev" href="#"><span class="button_icon"><i class="icon-left-open-big"></i></span></a>',
2712				nextArrow		: '<a class="button button_js slider_next" href="#"><span class="button_icon"><i class="icon-right-open-big"></i></span></a>',
2713				appendArrows	: slider.siblings( '.blog_slider_header' ),
2714
2715				appendDots		: slider.siblings( '.slider_pager' ),
2716				customPaging 	: pager,
2717
2718				rtl				: rtl ? true : false,
2719				autoplay		: window.mfn_sliders.shop ? true : false,
2720				autoplaySpeed	: window.mfn_sliders.shop ? window.mfn_sliders.shop : 5000,
2721
2722				slidesToShow	: slickAutoResponsive( slider, slidesToShow ),
2723				slidesToScroll	: slickAutoResponsive( slider, slidesToShow )
2724			});
2725
2726			// Bind | debouncedresize
2727			$( window ).bind( 'debouncedresize', function(){
2728				slider.slick( 'slickSetOption', 'slidesToShow', slickAutoResponsive( slider, slidesToShow ), false );
2729				slider.slick( 'slickSetOption', 'slidesToScroll', slickAutoResponsive( slider, slidesToShow ), true );
2730			});
2731
2732		});
2733	}
2734
2735
2736	// --- Blog ------------------------------------------------------------------
2737
2738	function mfnSliderBlog(){
2739
2740		var pager = function( el, i ){
2741	        return '<a>'+ i +'</a>';
2742	    };
2743
2744		$('.blog_slider_ul').each(function(){
2745
2746			var slider = $(this);
2747			var slidesToShow = 4;
2748
2749			var count = slider.closest( '.blog_slider' ).data( 'count' );
2750			if( slidesToShow > count ){
2751				slidesToShow = count;
2752				if( slidesToShow < 1 ){
2753					slidesToShow = 1;
2754				}
2755			}
2756
2757			slider.slick({
2758				cssEase			: 'ease-out',
2759				dots			: true,
2760				infinite		: true,
2761				touchThreshold	: 10,
2762				speed			: 300,
2763
2764				prevArrow		: '<a class="button button_js slider_prev" href="#"><span class="button_icon"><i class="icon-left-open-big"></i></span></a>',
2765				nextArrow		: '<a class="button button_js slider_next" href="#"><span class="button_icon"><i class="icon-right-open-big"></i></span></a>',
2766				appendArrows	: slider.siblings( '.blog_slider_header' ),
2767
2768				appendDots		: slider.siblings( '.slider_pager' ),
2769				customPaging 	: pager,
2770
2771				rtl				: rtl ? true : false,
2772				autoplay		: window.mfn_sliders.blog ? true : false,
2773				autoplaySpeed	: window.mfn_sliders.blog ? window.mfn_sliders.blog : 5000,
2774
2775				slidesToShow	: slickAutoResponsive( slider, slidesToShow ),
2776				slidesToScroll	: slickAutoResponsive( slider, slidesToShow )
2777			});
2778
2779			// Bind | debouncedresize
2780			$( window ).bind( 'debouncedresize', function(){
2781				slider.slick( 'slickSetOption', 'slidesToShow', slickAutoResponsive( slider, slidesToShow ), false );
2782				slider.slick( 'slickSetOption', 'slidesToScroll', slickAutoResponsive( slider, slidesToShow ), true );
2783			});
2784
2785		});
2786	}
2787
2788
2789	// --- Clients ------------------------------------------------------------------
2790
2791	function mfnSliderClients(){
2792		$('.clients_slider_ul').each(function(){
2793
2794			var slider = $(this);
2795
2796			slider.slick({
2797				cssEase			: 'ease-out',
2798				dots			: false,
2799				infinite		: true,
2800				touchThreshold	: 10,
2801				speed			: 300,
2802
2803				prevArrow		: '<a class="button button_js slider_prev" href="#"><span class="button_icon"><i class="icon-left-open-big"></i></span></a>',
2804				nextArrow		: '<a class="button button_js slider_next" href="#"><span class="button_icon"><i class="icon-right-open-big"></i></span></a>',
2805				appendArrows	: slider.siblings( '.clients_slider_header' ),
2806
2807				rtl				: rtl ? true : false,
2808				autoplay		: window.mfn_sliders.clients ? true : false,
2809				autoplaySpeed	: window.mfn_sliders.clients ? window.mfn_sliders.clients : 5000,
2810
2811				slidesToShow	: slickAutoResponsive( slider, 4 ),
2812				slidesToScroll	: slickAutoResponsive( slider, 4 )
2813			});
2814
2815			// Bind | debouncedresize
2816			$( window ).bind( 'debouncedresize', function(){
2817				slider.slick( 'slickSetOption', 'slidesToShow', slickAutoResponsive( slider, 4 ), false );
2818				slider.slick( 'slickSetOption', 'slidesToScroll', slickAutoResponsive( slider, 4 ), true );
2819			});
2820
2821		});
2822	}
2823
2824
2825	// --- Portfolio -------------------------------------------------------------
2826
2827	function sliderPortfolio(){
2828
2829		$('.portfolio_slider_ul').each(function(){
2830
2831			var slider = $(this);
2832			var size = 380;
2833			var scroll = 5;
2834
2835			if( slider.closest( '.portfolio_slider' ).data( 'size' ) ){
2836				size = slider.closest( '.portfolio_slider' ).data( 'size' );
2837			}
2838
2839			if( slider.closest( '.portfolio_slider' ).data( 'size' ) ){
2840				scroll = slider.closest( '.portfolio_slider' ).data( 'scroll' );
2841			}
2842
2843			slider.slick({
2844				cssEase			: 'ease-out',
2845				dots			: false,
2846				infinite		: true,
2847				touchThreshold	: 10,
2848				speed			: 300,
2849
2850				prevArrow		: '<a class="slider_nav slider_prev themebg" href="#"><i class="icon-left-open-big"></i></a>',
2851				nextArrow		: '<a class="slider_nav slider_next themebg" href="#"><i class="icon-right-open-big"></i></a>',
2852
2853				rtl				: rtl ? true : false,
2854				autoplay		: window.mfn_sliders.portfolio ? true : false,
2855				autoplaySpeed	: window.mfn_sliders.portfolio ? window.mfn_sliders.portfolio : 5000,
2856
2857				slidesToShow	: slickAutoResponsive( slider, 5, size ),
2858				slidesToScroll	: slickAutoResponsive( slider, scroll, size )
2859			});
2860
2861			// Bind | debouncedresize
2862			$( window ).bind( 'debouncedresize', function(){
2863				slider.slick( 'slickSetOption', 'slidesToShow', slickAutoResponsive( slider, 5, size ), false );
2864				slider.slick( 'slickSetOption', 'slidesToScroll', slickAutoResponsive( slider, scroll, size ), true );
2865			});
2866
2867		});
2868	}
2869
2870
2871	// --- Slider ----------------------------------------------------------------
2872
2873	function sliderSlider(){
2874
2875		var pager = function( el, i ){
2876	        return '<a>'+ i +'</a>';
2877	    };
2878
2879		$('.content_slider_ul').each(function(){
2880
2881			var slider 		= $(this);
2882			var count 		= 1;
2883			var centerMode	= false;
2884
2885			if( slider.closest( '.content_slider' ).hasClass( 'carousel' ) ){
2886				count = slickAutoResponsive( slider );
2887
2888				$( window ).bind( 'debouncedresize', function(){
2889					slider.slick( 'slickSetOption', 'slidesToShow', slickAutoResponsive( slider ), false );
2890					slider.slick( 'slickSetOption', 'slidesToScroll', slickAutoResponsive( slider ), true );
2891				});
2892			}
2893
2894			if( slider.closest( '.content_slider' ).hasClass( 'center' ) ){
2895				centerMode = true;
2896			}
2897
2898			slider.slick({
2899				cssEase			    : 'cubic-bezier(.4,0,.2,1)',
2900				dots			      : true,
2901				infinite		    : true,
2902				touchThreshold  : 10,
2903				speed			      : 300,
2904
2905				centerMode		  : centerMode,
2906				centerPadding	  : '20%',
2907
2908				prevArrow		     : '<a class="button button_js slider_prev" href="#"><span class="button_icon"><i class="icon-left-open-big"></i></span></a>',
2909				nextArrow		     : '<a class="button button_js slider_next" href="#"><span class="button_icon"><i class="icon-right-open-big"></i></span></a>',
2910
2911				adaptiveHeight	: true,
2912				appendDots		  : slider.siblings( '.slider_pager' ),
2913				customPaging 	  : pager,
2914
2915				rtl				      : rtl ? true : false,
2916				autoplay		    : window.mfn_sliders.slider ? true : false,
2917				autoplaySpeed	  : window.mfn_sliders.slider ? window.mfn_sliders.slider : 5000,
2918
2919				slidesToShow    : count,
2920				slidesToScroll	: count
2921			});
2922
2923      // Lightbox | disable on dragstart
2924      var clickEvent = false;
2925
2926			slider.on( 'dragstart', '.slick-slide a[rel="lightbox"]', function( event ){
2927				if( lightbox_attr ){
2928          var events = $( this ).data( 'events' );
2929          clickEvent = events.click[0];
2930					$( this ).addClass( 'unbind-click' ).unbind( 'click' );
2931				}
2932			});
2933
2934			// Lightbox | enable after change
2935			slider.on( 'afterChange', function( event, slick, currentSlide, nextSlide ){
2936				if( lightbox_attr ){
2937					$( 'a.unbind-click[rel="lightbox"]', slider ).removeClass( 'unbind-click' ).bind( 'click', clickEvent );
2938				}
2939			});
2940
2941		});
2942	}
2943
2944
2945	// --- Testimonials ----------------------------------------------------------------
2946
2947	function sliderTestimonials(){
2948
2949		var pager = function( el, i ){
2950	        var img = $( el.$slides[i] ).find('.single-photo-img').html();
2951	        return '<a>'+ img +'</a>';
2952	    };
2953
2954		$('.testimonials_slider_ul').each(function(){
2955
2956			var slider = $(this);
2957
2958			slider.slick({
2959				cssEase			: 'ease-out',
2960				dots			: true,
2961				infinite		: true,
2962				touchThreshold	: 10,
2963				speed			: 300,
2964
2965				prevArrow		: '<a class="button button_js slider_prev" href="#"><span class="button_icon"><i class="icon-left-open-big"></i></span></a>',
2966				nextArrow		: '<a class="button button_js slider_next" href="#"><span class="button_icon"><i class="icon-right-open-big"></i></span></a>',
2967
2968				adaptiveHeight	: true,
2969				appendDots		: slider.siblings( '.slider_pager' ),
2970				customPaging 	: pager,
2971
2972				rtl				: rtl ? true : false,
2973				autoplay		: window.mfn_sliders.testimonials ? true : false,
2974				autoplaySpeed	: window.mfn_sliders.testimonials ? window.mfn_sliders.testimonials : 5000,
2975
2976				slidesToShow	: 1,
2977				slidesToScroll	: 1
2978			});
2979
2980		});
2981	}
2982
2983
2984})(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.