PageSourceSearch

https://cityofdesigndundee.com/wp-content/themes/parenttheme/js/theme-scripts.js?ver=1

js cityofdesigndundee.com collected 2026-10-10 01:27:48 UTC 64,692 bytes, 2,575 lines download raw bytes

1jQuery.fn.inView = function(inViewType){
2	var viewport = {};
3	viewport.top = jQuery(window).scrollTop();
4	viewport.bottom = viewport.top + jQuery(window).height();
5	var bounds = {};
6	bounds.top = this.offset().top;
7	bounds.bottom = bounds.top + this.outerHeight();
8	switch(inViewType){
9	  case 'bottomOnly':
10		return ((bounds.bottom <= viewport.bottom) && (bounds.bottom >= viewport.top));
11	  case 'topOnly':
12		return ((bounds.top <= viewport.bottom) && (bounds.top >= viewport.top));
13	  case 'both':
14		return ((bounds.top >= viewport.top) && (bounds.bottom <= viewport.bottom));         
15	  default:     
16		return ((bounds.top >= viewport.top) && (bounds.bottom <= viewport.bottom));        
17	}
18};
19
20function contentWrapperH() {
21
22	jQuery(function(){
23		var contentWrapper = jQuery('.iv-layout.content-wrapper');
24		if (jQuery('#all-site-wrapper').height() <= jQuery(window).height()) {
25			contentWrapper.css('min-height', 400);
26		};
27	});
28};
29contentWrapperH();
30
31function iv_cancelZoom() {
32	"use strict";
33
34	var d = document,
35		viewport,
36		content,
37		maxScale = ',maximum-scale=',
38		maxScaleRegex = /,*maximum\-scale\=\d*\.*\d*/;
39 
40	// this should be a focusable DOM Element
41	if(!this.addEventListener || !d.querySelector) {
42		return;
43	}
44 
45	viewport = d.querySelector('meta[name="viewport"]');
46	content = viewport.content;
47 
48	function changeViewport(event)
49	{
50		// http://nerd.vasilis.nl/prevent-ios-from-zooming-onfocus/
51		viewport.content = content + (event.type == 'blur' ? (content.match(maxScaleRegex, '') ? '' : maxScale + 10) : maxScale + 1);
52	}
53 
54	// We could use DOMFocusIn here, but it's deprecated.
55	this.addEventListener('focus', changeViewport, true);
56	this.addEventListener('blur', changeViewport, false);
57}
58
59
60jQuery.fn.cancelZoom = function() {
61	return this.each(iv_cancelZoom);
62};
63/* Media Query Vars */
64
65var _window_width = jQuery(window).width();
66
67var iv_device_xs = false;
68if( _window_width < 768 )
69	iv_device_xs = true;
70
71var iv_device_sm = false;
72if( _window_width >= 768 && _window_width < 992 )
73	iv_device_sm = true;
74
75var iv_device_md = false;
76if( _window_width >= 992 && _window_width < 1200 )
77	iv_device_md = true;
78
79var iv_device_lg = false;
80if( _window_width >= 1200)
81	iv_device_lg = true;
82
83
84function smoothScroll(scrollTime, scrollDistance){
85		
86	var scrollTime = scrollTime;			//Scroll time
87	var scrollDistance = scrollDistance;		//Distance. Use smaller value for shorter scroll and greater value for longer scroll
88
89	if (navigator.userAgent.indexOf('Mac') != -1 || navigator.userAgent.indexOf('Firefox') > -1 || jQuery('body').hasClass('is-horizontal')) {
90		return;
91	};
92	jQuery(window).on("mousewheel DOMMouseScroll", function(event){
93		
94		event.preventDefault();	
95										
96		var delta = event.originalEvent.wheelDelta/120 || -event.originalEvent.detail/3;
97		var scrollTop = jQuery(window).scrollTop();
98		var finalScroll = scrollTop - parseInt(delta*scrollDistance);
99			
100		TweenMax.to(jQuery(window), scrollTime, {
101			scrollTo : { y: finalScroll, autoKill:true },
102				ease: Expo.easeOut,	//For more easing functions see http://api.greensock.com/js/com/greensock/easing/package-detail.html
103				autoKill: true,
104				overwrite: 5							
105			});
106					
107	});
108		
109};
110
111/*
112 *	Recalculate Sticky Wrapper Height
113 */
114function ivan_recalc_sticky_height() {
115	"use strict";
116
117	var _h = jQuery('.iv-layout.header').outerHeight( false );
118	jQuery('.header-sticky-wrapper').css('height', _h + 'px');
119}
120
121/*!
122 * Init 
123 *Sideheader
124 */
125function sideHeaderInit() {
126	var sideheader = jQuery('#sideheader');
127	sideheader.show();
128	if ( jQuery('.header-left-area').find('.sideheader-trigger').length ) {
129		var liSideheaderTrigger = jQuery('.header-left-area').find('.sideheader-trigger').wrap('<li class="li-sideheader-trigger" />');
130		jQuery('.li-sideheader-trigger').appendTo('#menu-primary-menu');
131	};
132	if (sideheader.length) {
133		sideheader.perfectScrollbar();
134		jQuery('.sideheader-trigger a').on('click', function(event) {
135			event.preventDefault();
136			event.stopPropagation();
137			sideheader.toggleClass('is-visible');
138			jQuery('body').toggleClass('sideheader-visible');
139			if (jQuery('.header').hasClass('stuck')) {
140				jQuery('.header').addClass('fadeOutUp');
141			};
142		});
143		jQuery(document).on('click', function(e) {
144
145			var _element = sideheader;
146
147			if (!_element.is(e.target) // if the target of the click isn't the container...
148				&& _element.has(e.target).length === 0 ) // ... nor a descendant of the container
149			{
150				sideheader.removeClass('is-visible');
151				jQuery('body').removeClass('sideheader-visible');
152			}
153		});
154		jQuery(window).on('scroll', function(e) {
155
156			sideheader.removeClass('is-visible');
157			jQuery('body').removeClass('sideheader-visible');
158		});
159	};
160}
161/* Calls Sideheader Init script  */
162sideHeaderInit();
163
164
165/*!
166 * Flexible Header Height
167 *
168 * Function used to turn header height half the actual size depending of Window Scroll
169 *
170 */
171function ivan_fixed_header() {
172	"use strict";
173	
174
175	if( jQuery('.header-fixed').length > 0 ) {
176
177		if (jQuery('.iv-layout.header').hasClass('style5') == true) {
178
179			jQuery('.negative-push').css('height', jQuery('.iv-layout.header').height());
180		};
181
182		var _animTopDest = '0px';
183
184		jQuery('.header-fixed').find('.logo').imagesLoaded(function() {
185
186			var $headerFixed = jQuery('.iv-layout.header'),
187				_logoHeight = $headerFixed.find('.logo img:visible').outerHeight(),
188				_headerHeight = $headerFixed.outerHeight(),
189				_foldHeight = -_logoHeight - 150,
190				_window = jQuery(window),
191				_classFold = '',
192				headerHeight,
193				_class = '';
194
195			if( $headerFixed.hasClass('light') )
196				_class = 'light';
197			if( $headerFixed.hasClass('dark') )
198				_class = 'dark';
199			if(_logoHeight == 0) {
200				setTimeout( function() { ivan_fixed_header(); }, 500 );
201				return;
202			}
203			if( $headerFixed.hasClass('display-after-fold') ) {
204				_classFold = 'display-after-fold';
205
206				_foldHeight = -jQuery.waypoints('viewportHeight') + (_headerHeight - 1);
207			}
208
209			if ( jQuery('.iv-layout.top-header').length ) {
210				headerHeight = jQuery('.iv-layout.top-header').outerHeight() + _headerHeight;
211			} else {
212				headerHeight = _headerHeight;
213			};
214
215			$headerFixed.addClass('not-stuck');
216
217			_window.on('scroll', function() {
218				if ( _window.scrollTop() >= headerHeight ){
219					$headerFixed.removeClass('not-stuck').addClass('stuck');
220					jQuery('body').addClass('header-stuck');
221
222					ivan_fix_header_area_height();
223
224					$headerFixed.removeClass( _class );
225					$headerFixed.removeClass( _classFold );
226			
227					if( $headerFixed.hasClass('hide-container') == true ) {
228						$headerFixed.find('.to-hide').css('display', 'none');
229					}
230
231					if(_logoHeight > 0) {
232						$headerFixed.find('.logo img').css({ maxHeight: (_logoHeight * 0.7) + 'px'});
233					}
234				} else {
235					$headerFixed.addClass('not-stuck').removeClass('stuck');
236					jQuery('body').removeClass('header-stuck');
237
238					$headerFixed.find('.logo img').css({ maxHeight: 'inherit'});
239					$headerFixed.addClass( _class );
240					$headerFixed.addClass( _classFold );
241
242					if( $headerFixed.hasClass('hide-container') == true ) {
243						$headerFixed.find('.to-hide').css('display', 'block');
244						//ivan_recalc_sticky_height();
245					}
246
247					$headerFixed.parent('.sticky-wrapper').outerHeight(_headerHeight);
248				}
249			});
250		}); // imagesLoaded Logic
251	}
252
253	// Or in aside menu case...
254	if( jQuery('.aside-header-wrapper .fixed-height').length > 0 ) {
255
256		var $headerFixed = jQuery('.aside-header-wrapper .fixed-height');
257
258		$headerFixed.waypoint('sticky', {
259			wrapper: '<div class="aside-sticky-wrapper aside-header-sticky-wrapper" />',
260			stuckClass: 'aside-stuck'
261		});	
262	}
263}
264
265/*!
266 * 
267 * Function used to enable vertical header
268 *
269 */
270function verticalHeader() {
271	var header = jQuery('.header.vertical').not('.modern');
272
273	if (header.length) {
274		header.perfectScrollbar()
275
276		header.find('li').children('a').on('click', function(event) {
277			var $this = jQuery(this),
278				subMenu = $this.siblings('ul');
279			if(subMenu.length) {
280				event.preventDefault();
281				subMenu.slideToggle();
282				header.perfectScrollbar('update');
283				$this.parent().toggleClass('open');
284			}
285		});
286	};
287}
288verticalHeader();
289
290/*!
291 * Init Live Search
292 *
293 * Function used to enable live search effects
294 *
295 */
296function ivan_live_search_init() {
297	"use strict";
298	var searchTopStyle = jQuery('.live-search.search-top-style'),
299		searchfullScreen = jQuery('.live-search.search-full-screen-style'),
300		searchfullScreenAlt = jQuery('.live-search.search-full-screen-alt-style'),
301		formCloseBtn = jQuery('.live-search').find('.form-close-btn');
302
303	jQuery('.live-search .trigger').on("click", function (e) {
304
305		e.preventDefault();
306
307		var _element = jQuery(this).siblings('.inner-wrapper');
308
309		if ( jQuery(this).parents('.live-search').hasClass('search-top-style') == true ) {
310			jQuery('body').addClass('top-search-active');
311			if ( jQuery('.iv-layout.header.stuck').length ) {
312				jQuery('.iv-layout.header.stuck').addClass('top-search-active');
313			};
314		};
315
316		_element.toggleClass('visible');
317
318		if (!jQuery(this).parents('.iv-layout').hasClass('top-header') == true) {
319			jQuery('.top-header').addClass('beneath');
320		} else if (jQuery(this).parents('.iv-layout').hasClass('top-header') == true) {
321			jQuery('.top-header').removeClass('beneath');
322		}
323
324		setTimeout(function(){
325			_element.find('#s').focus().end()
326		}, 300);
327		
328	});
329
330	if ( searchTopStyle.length && jQuery(window).width() >= 992 ) {
331		jQuery(window).on('scroll', function() {
332			if ( searchTopStyle.find('.inner-wrapper').hasClass('visible') ) {
333				searchTopStyle.find('.inner-wrapper').removeClass('visible');
334				jQuery('body').removeClass('top-search-active');
335			};
336		});
337	};
338
339	jQuery(document).on('mouseup', function(e) {
340
341		var _element = jQuery('.inner-wrapper.visible');
342
343		if (!_element.is(e.target) // if the target of the click isn't the container...
344			&& _element.has(e.target).length === 0 ) // ... nor a descendant of the container
345		{
346
347			if(jQuery(this).parents('.header.simple-left-right').length == 0) {
348				if( _element.hasClass('visible') ) {
349					_element.removeClass('visible');
350				}
351			} else {
352				if( _element.hasClass('visible') ) {
353					_element.removeClass('visible');
354				}
355			}
356			if ( searchTopStyle.length ) {
357				// jQuery('#all-site-wrapper').css('top', 0);
358				jQuery('body').removeClass('top-search-active');
359				if ( jQuery('.iv-layout.header.stuck').length ) {
360					jQuery('.iv-layout.header.stuck').removeClass('top-search-active');
361				};
362			};
363		}
364
365	});
366
367	formCloseBtn.on('click', function() {
368		var _element = jQuery('.inner-wrapper.visible');
369		_element.removeClass('visible');
370		if ( jQuery('.iv-layout.header.stuck').length ) {
371			jQuery('.iv-layout.header.stuck').removeClass('top-search-active');
372		};
373		setTimeout(function(){
374			jQuery('.top-header').removeClass('beneath')	
375		}, 500);
376	});
377
378	if ( searchTopStyle.length ) {
379		searchTopStyle.find('.form-close-btn').css('right', searchTopStyle.find('form').offset().left);
380		formCloseBtn.on('click', function() {
381			var _element = jQuery('.inner-wrapper.visible');
382			_element.removeClass('visible');
383			jQuery('body').removeClass('top-search-active');
384		});
385	};
386
387
388	jQuery('.live-search .submit-form').on("click", function (e) {
389
390		e.preventDefault();
391
392		jQuery(this).parents('form').submit();
393
394	});
395}
396
397/*!
398 * Init Woo Cart
399 *
400 * Function used to enable cart effects
401 *
402 */
403function ivan_woo_cart_init() {
404	"use strict";
405
406	if(jQuery(window).width() > 992) {
407		
408		jQuery('.woo-cart').on( 'mouseenter mouseleave', function() {
409
410			var _element = jQuery(this).find('.inner-wrapper');
411
412			_element.addClass('visible');
413
414			if(jQuery(this).parents('.header.simple-left-right').length == 0) {
415				_element.animate( { opacity: 1 }, 400 );
416			} else {
417				_element.css('opacity', '1');
418			}
419
420		}, function() {
421
422			var _element = jQuery(this).find('.inner-wrapper');
423
424			if(jQuery(this).parents('.header.simple-left-right').length == 0) {
425				_element.animate( { opacity: 0 }, 150, function() {
426					_element.removeClass('visible');
427				} );
428			} else {
429				_element.css('opacity', '0');
430				_element.removeClass('visible');
431			}
432
433		});
434
435	} // End window size logic
436
437}
438
439/*!
440 * Init Woo Cart
441 *
442 * Function used to enable cart effects
443 *
444 */
445function ivan_wpml_languages_dropdown_init() {
446	"use strict";
447		
448		jQuery('.wpml-lang-dropdown').on( 'mouseenter mouseleave', function() {
449
450			var _element = jQuery(this).find('.inner-wrapper');
451
452			_element.addClass('visible');
453
454			_element.css('opacity', '1');
455
456
457		}, function() {
458
459			var _element = jQuery(this).find('.inner-wrapper');
460
461				_element.css('opacity', '0');
462				_element.removeClass('visible');
463
464		});
465
466}
467
468/*!
469 * Init Login with AJAX
470 *
471 * Function used to enable live search effects
472 *
473 */
474function ivan_login_ajax_init() {
475	"use strict";
476
477	jQuery('.login-ajax .trigger').on("click", function (e) {
478
479		var _element = jQuery(this).siblings('.inner-wrapper');
480
481		_element.addClass('visible');
482
483		_element.find('#lwa_user_login').focus();
484
485		e.preventDefault();
486	});
487
488	jQuery(document).on('mouseup', function(e) {
489
490		var _element = jQuery('.inner-wrapper.visible');
491
492		if (!_element.is(e.target) // if the target of the click isn't the container...
493			&& _element.has(e.target).length === 0 ) // ... nor a descendant of the container
494		{
495			_element.removeClass('visible');
496		}
497
498	});
499}
500
501/*!
502 * Init Responsive Menus
503 *
504 * Function used to enable responsive menus
505 *
506 */
507function ivan_responsive_menus_init() {
508	"use strict";
509
510	setTimeout(function() {
511		
512		jQuery('.mobile-menu-trigger').each( function() {
513
514			var _selector = jQuery(this).attr('data-selector');
515			var _id = jQuery(this).attr('data-id');
516			var _menuExists = true;
517
518			if( jQuery(_selector + ' .menu').length <= 0 ) {
519				_menuExists = false;
520			}
521
522			if( _menuExists == true ) {
523
524				_selector += ' .menu';
525
526				jQuery('body').prepend('<div class="iv-mobile-menu-wrapper" id="' + _id + '"><div class="iv-mobile-menu-holder"><div class="iv-mobile-menu-inner"><div class="iv-mobile-menu-close"><a href="#" aria-title="Close Menu" title="Close Menu"><span class="icon-arrow-left xbig"></span></a></div><div class="modules"></div><div class="menu-wrap"></div></div></div></div>');
527
528				jQuery('#' + _id + ' .iv-mobile-menu-inner .modules').append( jQuery( _selector ).parents('.iv-layout').find('.social-icons, .custom-text').clone().removeClass('hidden-xs hidden-sm') );
529
530				jQuery('#' + _id + ' .iv-mobile-menu-inner .menu-wrap').append( jQuery( _selector ).clone().removeClass('mega_main_menu_ul').attr('id', '') );
531
532				jQuery('#' + _id).find('.post_type_dropdown .mega_dropdown, .grid_dropdown .mega_dropdown, .widgets_dropdown  .mega_dropdown').remove();
533
534				jQuery('#' + _id).find('.menu > .menu-item-has-children > .item_link').on("click", function (e) {
535
536					if(jQuery(this).hasClass('opened') == false) {
537						e.preventDefault();
538
539						jQuery(this).siblings('ul').slideToggle('slow')
540
541						jQuery(this).addClass('opened');
542					} else {
543						return true;
544					}
545
546				});
547			} else {
548
549				// Special code used when 
550				jQuery('body').prepend('<div class="iv-mobile-menu-wrapper" id="' + _id + '"><div class="iv-mobile-menu-holder"><div class="iv-mobile-menu-inner"><div class="iv-mobile-menu-close"><a href="#"><span class="arrow_left"></a></div><div class="modules"></div><div class="menu-wrap"></div></div></div></div>');
551
552				jQuery('#' + _id + ' .iv-mobile-menu-inner .modules').append( jQuery( _selector ).find('.social-icons, .custom-text').clone().removeClass('hidden-xs hidden-sm') );
553			}
554
555			jQuery(this).on('click', function(e) {
556
557				e.preventDefault();
558
559				jQuery('#' + _id).addClass('slideIn');
560
561			});
562
563		});
564
565		jQuery('.iv-mobile-menu-close').on("click", function (e) {
566
567			e.preventDefault();
568
569			jQuery(this).parents('.iv-mobile-menu-wrapper').removeClass('slideIn');
570
571		});
572		
573	}, 1000);
574}
575/*!
576 * Init Overlay Menus
577 *
578 * Function used to enable responsive menus
579 *
580 */
581function ivan_overlay_menus_init() {
582	"use strict";
583
584	setTimeout(function() {
585		
586		jQuery('.overlay-menu-trigger').each( function() {
587
588			var _selector = jQuery(this).attr('data-selector');
589			var _id = jQuery(this).attr('data-id');
590			var _menuExists = true;
591
592			if( jQuery(_selector + ' .menu').length <= 0 ) {
593				_menuExists = false;
594			}
595
596			if( _menuExists == true ) {
597
598				_selector += ' .menu';
599
600				jQuery('body').prepend('<div class="iv-mobile-menu-wrapper  iv-overlay-menu-wrapper" id="' + _id + '"><div class="iv-mobile-menu-holder"><div class="iv-mobile-menu-inner"><div class="iv-mobile-menu-close"><a aria-title="Close Menu" title="Close Menu" href="#"><span class="icon-minimize xbig"></span></a></div><div class="modules"></div><div class="menu-wrap"></div></div></div></div>');
601
602				jQuery('#' + _id + ' .iv-mobile-menu-inner .modules').append( jQuery( _selector ).parents('.iv-layout').find('.social-icons, .custom-text').clone().removeClass('hidden-xs hidden-sm') );
603
604				jQuery('#' + _id + ' .iv-mobile-menu-inner .menu-wrap').append( jQuery( _selector ).clone().removeClass('mega_main_menu_ul').attr('id', '') );
605
606				jQuery('#' + _id).find('.post_type_dropdown .mega_dropdown, .grid_dropdown .mega_dropdown, .widgets_dropdown  .mega_dropdown').remove();
607
608				jQuery('#' + _id).find('.menu > .menu-item-has-children > .item_link').on("click", function (e) {
609
610					if(jQuery(this).hasClass('opened') == false) {
611						e.preventDefault();
612
613						jQuery(this).siblings('ul').slideToggle('slow')
614
615						jQuery(this).addClass('opened');
616					} else {
617						return true;
618					}
619
620				});
621			} else {
622
623				// Special code used when 
624				jQuery('body').prepend('<div class="iv-mobile-menu-wrapper" id="' + _id + '"><div class="iv-mobile-menu-holder"><div class="iv-mobile-menu-inner"><div class="iv-mobile-menu-close"><a href="#"><span class="arrow_left"></a></div><div class="modules"></div><div class="menu-wrap"></div></div></div></div>');
625
626				jQuery('#' + _id + ' .iv-mobile-menu-inner .modules').append( jQuery( _selector ).find('.social-icons, .custom-text').clone().removeClass('hidden-xs hidden-sm') );
627			}
628
629			jQuery(this).on('click', function(e) {
630
631				e.preventDefault();
632
633				jQuery('#' + _id).addClass('slideIn');
634				jQuery('body').addClass('overflow-hidden-menu');
635
636			});
637
638		});
639
640		jQuery('.iv-mobile-menu-close').on("click", function (e) {
641
642			e.preventDefault();
643
644			jQuery(this).parents('.iv-mobile-menu-wrapper').removeClass('slideIn');
645			jQuery('body').removeClass('overflow-hidden-menu');
646
647		});
648		
649	}, 1000);
650}
651
652/*!
653 * Init Responsive Menus Selects
654 *
655 * Function used to enable responsive menus inside a select
656 *
657 */
658function ivan_responsive_menus_select_init() {
659	"use strict";
660
661	jQuery('.responsive-menu-select').each( function() {
662
663		var _selector = jQuery(this).attr('data-selector');
664		
665		jQuery(_selector).tinyNav({
666			active: 'dummy',
667			header: ' ',
668			indent: '- ',
669			place: jQuery(this).find('.receptor')
670		});
671
672	});
673
674}
675
676/*!
677 * Init FullWidth MegaMenu
678 *
679 * Function used to fix megamenu fullwidth sizes
680 *
681 */
682function ivan_megamenu_init() {
683	"use strict";
684
685	if(iv_device_md == true || iv_device_lg == true) {
686
687		if( jQuery('body').hasClass('ivan-m-l-aside') == false ) {
688
689			var _container;
690
691			if (jQuery('.iv-layout.header').find('.container').length) {
692				_container = jQuery('.iv-layout.header').find('.container');
693			} else {
694				_container = jQuery('.container').first();
695			}
696
697			var _containerWidth = parseInt(_container.width(), 10),
698				_containerOffset = parseInt(_container.offset().left, 10),
699				_containerPadding = parseInt(_container.css("padding-left"), 10);
700
701			jQuery('.header .mega_main_menu:not(.direction-vertical), .top-header .mega_main_menu').each(function() {			
702
703				jQuery(this).find('.mega_main_menu_ul > .submenu_full_width > .mega_dropdown').each( function(e) {
704
705					var $this = jQuery(this);
706
707					$this.css('width', '');
708					$this.css('left', '');
709
710					var _offWrapper = $this.offset().left,
711						_offset = _offWrapper - _containerOffset - _containerPadding,
712						_offsetN = -(Math.abs(_offWrapper - _containerOffset));
713
714					$this.css("width", _containerWidth);
715					$this.css("left", _offsetN);
716				});
717			});
718		}
719	}
720}
721
722 /*!
723 * Init Negative Height
724 *
725 * Function used to add negative height header support
726 *
727 */
728
729var ivan_title_paddingTop = null;
730var ivan_header_marginTop = 0;
731var ivan_negative_header_calls = 0;
732function ivan_negative_height_init() {
733	"use strict";
734
735	var ivLayoutHeader = jQuery('.iv-layout.header');
736
737	if( ivLayoutHeader.hasClass('negative-height') == true ) {
738
739		var _h;
740
741		if(ivLayoutHeader.hasClass('header-fixed')) {
742			_h = jQuery('.header-sticky-wrapper').outerHeight( true );
743
744			_h += ivan_header_marginTop;
745		}
746		else
747			_h = jQuery('.iv-layout.header.negative-height').outerHeight( true );
748
749		// Specific to when title wrapper is on
750		if( jQuery('.iv-layout.title-wrapper').length > 0 ) {
751
752			ivLayoutHeader.css('display', 'block');
753
754			if( jQuery('.iv-layout.title-wrapper').length > 0 ) {
755
756				if( ivLayoutHeader.hasClass('show-after-fold') == false ||
757					ivLayoutHeader.hasClass('keep-logo-before-fold') == true ) {
758
759					if( ivan_title_paddingTop == null )
760						ivan_title_paddingTop = parseInt( jQuery('.iv-layout.title-wrapper').css('padding-top').replace("px", "") );
761
762				}
763			}
764
765		} else {
766
767			ivLayoutHeader.css('display', 'block');
768
769		}
770
771		ivLayoutHeader.find('.logo').imagesLoaded(function(){
772			ivan_negative_height_init();
773		});
774	}
775}
776function headerTitleFade(){
777	var topBanner = jQuery('.iv-layout.title-wrapper-large'),
778		title = topBanner.find('h2'),
779		titleDesc = topBanner.find('.title-description'),
780		breadcrumbs = topBanner.find('.ivan-breadcrumb'),
781		introSectionHeight = topBanner.outerHeight(),
782		opacitySpeed = 1; 
783	var MQ = 991;
784
785	triggerAnimation();
786	jQuery(window).on('resize', function(){
787		triggerAnimation();
788	});
789	function triggerAnimation(){
790		if(jQuery(window).width()>= MQ) {
791			jQuery(window).on('scroll', function(){
792				window.requestAnimationFrame(animateIntro);
793			});
794		} else {
795			jQuery(window).off('scroll');
796		}
797	}
798	function animateIntro () {
799		var scrollPercentage = (jQuery(window).scrollTop()/introSectionHeight).toFixed(5);
800
801		if( jQuery(window).scrollTop() < introSectionHeight) {
802			title.css({
803				'opacity': 1 - scrollPercentage * 2
804			});
805			titleDesc.css({
806				'opacity': 1 - scrollPercentage * 2
807			});
808			breadcrumbs.css({
809				'opacity': 1 - scrollPercentage * 2
810			});
811		}
812	};
813};
814
815/*!
816 *
817 * Sticky Footer
818 *
819 */
820function stickyFooter(){
821	var stickyFooterEnabled = jQuery('body').hasClass('sticky-footer'),
822		mainFooter = jQuery('.iv-layout.footer'),
823		bottomFooter = jQuery('.iv-layout.bottom-footer'),
824		contentWrapper = jQuery('.iv-layout.content-wrapper'),
825		relatedProjectsHolder = jQuery('.ivan-related-projects-holder'),
826		mainFooterH = 0,
827		bottomFooterH = 0;
828
829	if (mainFooter.length && bottomFooter.length && jQuery('body').hasClass('sticky-footer')) {
830		jQuery('.iv-layout.footer, .iv-layout.bottom-footer').imagesLoaded(function(){
831			mainFooterH = parseInt(mainFooter.outerHeight(), 10);
832			bottomFooterH = parseInt(bottomFooter.outerHeight(), 10);
833			
834			mainFooter.css('bottom', bottomFooterH);
835			if (relatedProjectsHolder.length) {
836				relatedProjectsHolder.css({
837					'margin-bottom': mainFooterH + bottomFooterH - 1
838				});
839			} else {
840				contentWrapper.css({
841					'margin-bottom': mainFooterH + bottomFooterH - 1
842				});
843			};
844		});
845	} else if (mainFooter.length && ! bottomFooter.length && jQuery('body').hasClass('sticky-footer')) {
846		mainFooter.imagesLoaded(function(){
847			mainFooterH = parseInt(mainFooter.outerHeight(), 10);
848			if (relatedProjectsHolder.length) {
849				relatedProjectsHolder.css({
850					'margin-bottom': mainFooterH
851				});
852			} else {
853				contentWrapper.css({
854					'margin-bottom': mainFooterH
855				});
856			};
857		});
858	} else if (! mainFooter.length && bottomFooter.length && jQuery('body').hasClass('sticky-footer')) {
859		mainFooter.imagesLoaded(function(){
860			bottomFooterH = parseInt(bottomFooter.outerHeight(), 10);
861			if (relatedProjectsHolder.length) {
862				relatedProjectsHolder.css({
863					'margin-bottom': bottomFooterH
864				});
865			} else {
866				contentWrapper.css({
867					'margin-bottom': bottomFooterH
868				});
869			};
870		});
871	};
872}
873
874/*!
875 * Post Formats init
876 *
877 * Function used to start carousels and lightboxes of posts
878 *
879 */
880function ivan_post_formats_init() {
881	"use strict";
882
883	var _autoHeight = true;
884
885	if(jQuery('.ivan-mansory-blog').length > 0)
886		_autoHeight = false;
887
888	if(jQuery('.post-gallery-carousel').length > 0) {
889		jQuery('.post-gallery-carousel').imagesLoaded(function(){
890
891			jQuery('.post-gallery-carousel').owlCarousel({
892				theme: "style-outline-circle",
893				singleItem: true,
894				items: 1,
895				loop: true,
896				nav: true,
897				navText: ["<div class='carousel-left'><svg class='icon icon--prev'><use xlink:href='#icon-prev'></use></svg></div>","<div class='carousel-right'><svg class='icon icon--next'><use xlink:href='#icon-next'></use></svg></div>"],
898				autoHeight: true,
899				pagination: true
900			});
901		});
902	}
903
904	//'.format-gallery .thumbnail .post-gallery-carousel-item a, .format-image .thumbnail a')
905
906	jQuery('.format-gallery, .format-image, .single-post .format-standard').each(function() {
907		jQuery(this).find('.thumbnail a').magnificPopup({
908			type: 'image',
909			gallery:{
910				enabled: true
911			}
912		});
913	});
914	
915}
916
917/*!
918 * Gallery Shortcode Improved
919 *
920 * Function used to start lightbox in gallery items and mansory
921 *
922 */
923function ivan_post_wp_gallery_init() {
924	"use strict";
925
926	var container = document.querySelector('.gallery');
927
928	if( null != container) {
929
930		jQuery('.gallery').each(function() {
931
932			jQuery(this).find('.gallery-item a').magnificPopup({
933				type: 'image',
934				image: {
935					verticalFit: false
936				},
937				gallery:{
938					enabled: true
939				}
940			});
941
942		}); 
943
944		var pckry;
945
946		imagesLoaded( container, function() {
947			pckry = new Packery( container, {
948				itemSelector: '.gallery-item',
949				gutter: 0
950			});
951		});
952	}
953
954	/* PrettyPhoto replaced by Magnific */
955	jQuery('a.prettyphoto').off('click.prettyphoto');
956	jQuery('a.prettyphoto').off('click');
957	jQuery('.prettyphoto').each(function() {
958		jQuery(this).prettyPhoto({
959			overlay_gallery: false,
960			markup: '<div class="pp_pic_holder"> \
961					<div class="pp_content_container"> \
962						<div class="pp_right"> \
963							<div class="pp_content"> \
964								<div class="pp_loaderIcon"></div> \
965								<div class="pp_fade"> \
966									<a href="#" class="pp_expand" title="Expand the image">Expand</a> \
967									<div id="pp_full_res"></div> \
968								</div> \
969							</div> \
970						</div> \
971					</div> \
972					<div class="pp_bottom"> \
973						<div class="pp_left"> \
974							<a href="#" class="pp_arrow_previous">Previous</a> \
975							<a href="#" class="pp_arrow_next">Next</a> \
976						</div> \
977						<div class="pp_middle"> \
978							<p class="currentTextHolder">0/0</p> \
979						</div> \
980						<div class="pp_right"> \
981							<a class="pp_close" href="#">Close</a> \
982						</div> \
983					</div> \
984				</div> \
985				<div class="pp_overlay"></div>'
986		});
987	});
988
989	/* Tiled Gallery JetPack */
990	jQuery('.tiled-gallery a').magnificPopup({
991		type: 'image',
992		image: {
993			verticalFit: false
994		},
995		gallery:{
996			enabled: true
997		}
998	});	
999
1000	/* PrettyPhoto replaced by Magnific */
1001	jQuery('.ivan-lightbox a, a.ivan-lightbox').each(function() {
1002		jQuery(this).magnificPopup({
1003			type: 'image',
1004			image: {
1005				verticalFit: false
1006			},
1007			gallery:{
1008				enabled: true
1009			}
1010		});
1011	});
1012}
1013
1014/*!
1015 * Load Back to Top Button
1016 *
1017 * Function used to display and configure back to top button
1018 *
1019 */
1020function ivan_back_to_top_init() {
1021	"use strict";
1022
1023	var $back_top = jQuery('#back-top');
1024
1025	var $next_prev_fixed = jQuery('.post-nav-fixed');
1026
1027	// When user click it, animate to top
1028	$back_top.on("click", function (e) {
1029		e.preventDefault();
1030
1031		jQuery('body, html').animate( {scrollTop: 0}, jQuery(window).scrollTop() / 3, 'linear' );
1032	});
1033
1034	var _windowHeight = jQuery.waypoints('viewportHeight');
1035	var _windowHeightPart = jQuery.waypoints('viewportHeight') * 0.5;
1036
1037	// Add class on and off according to 
1038	jQuery(window).on('scroll', function() {
1039
1040		var _currentScroll = jQuery(this).scrollTop();
1041
1042		if($back_top.length > 0 ) {
1043			if( _currentScroll > _windowHeight ) {
1044				$back_top.removeClass('off');
1045				$back_top.addClass('on');
1046			} else {
1047				$back_top.removeClass('on');
1048				$back_top.addClass('off');
1049			}
1050		}
1051
1052		if($next_prev_fixed.length > 0 ) {
1053			if( _currentScroll > _windowHeightPart ) {
1054				$next_prev_fixed.removeClass('off');
1055				$next_prev_fixed.addClass('on');
1056			} else {
1057				$next_prev_fixed.removeClass('on');
1058				$next_prev_fixed.addClass('off');
1059			}
1060		}
1061
1062	});
1063	
1064}
1065
1066function initWow(){
1067	if ( jQuery('.wow').length ) {
1068		var wow = new WOW({mobile: false});
1069		wow.init();
1070	};
1071};
1072initWow();
1073
1074/*!
1075* Floated Contact Form
1076*
1077*/
1078function floatedContactForm(){
1079	var el = jQuery('.floated-contact-form'),
1080		trigger = el.find('.form-trigger');
1081
1082	trigger.on('click', function(event) {
1083		event.preventDefault();
1084		if ( el.length ) {
1085			el.toggleClass('visible-form');
1086		}
1087	});
1088	jQuery(document).on('click', function(e) {
1089
1090		if (!el.is(e.target) // if the target of the click isn't the container...
1091			&& el.has(e.target).length === 0 ) // ... nor a descendant of the container
1092		{
1093			if ( el.length ) {
1094				el.removeClass('visible-form');
1095			};
1096		};
1097
1098	});
1099	// Add class on and off according to 
1100	jQuery(window).on('scroll', function() {
1101
1102		if ( jQuery('#back-top').hasClass('on') == true ) {
1103			el.addClass('slideIn');
1104		} else if ( jQuery('#back-top').hasClass('off') == true ) {
1105			el.removeClass('slideIn');
1106		};
1107
1108	});
1109}
1110
1111
1112/*!
1113 * Initializing Videos
1114 *
1115 */
1116
1117function mediaElmenetsVideos() {
1118	var video = jQuery('video'),
1119		fullwidthVideo = jQuery('.video-fullwidth');
1120
1121	if (video.length && typeof jQuery.fn.mediaelementplayer == 'function') {
1122		video.mediaelementplayer();
1123	};
1124	if (fullwidthVideo.length && typeof jQuery.fn.mediaelementplayer == 'function') {
1125		fullwidthVideo.each(function() {
1126			var $this = jQuery(this),
1127				middleContent = $this.find('.content-middle'),
1128				bottomContent = $this.find('.content-bottom');
1129			$this.find('video').on('play', function(){
1130				middleContent.fadeOut('200');
1131				bottomContent.fadeOut('200');
1132			});
1133			$this.find('video').on('pause', function(){
1134				middleContent.fadeIn('200');
1135				bottomContent.fadeIn('200');
1136			});
1137		});
1138	}
1139}
1140
1141
1142/*!
1143 * Initializing Tweets Slider
1144 *
1145 */
1146
1147function tweetsSlider() {
1148	var el = jQuery('.tweets-slider');
1149
1150	if (el.length && typeof jQuery.fn.owlCarousel == 'function') {
1151		el.children('ul').owlCarousel({
1152			items: 1,
1153			singleItem: true,
1154			dots: true
1155		});
1156	};
1157}
1158
1159/*!
1160 * Initializing Video Popup
1161 *
1162 */
1163function videoPopup() {
1164	var el = jQuery('.video-fullwidth');
1165
1166	if (el.length) {
1167		el.find('.video-play-trigger').magnificPopup({
1168			type: 'iframe'
1169		});
1170	};
1171};
1172
1173/*!
1174 * Circular Countdown
1175 *
1176 */
1177
1178function circularCountdown() {
1179	var el = jQuery('.ccounter'),
1180		targetDate = el.data('target-date'),
1181		targetTime = el.data('target-time');
1182	if (el.length) {
1183		targetDate = targetDate.split(',');
1184		targetTime = targetTime.split(':');
1185		el.ccountdown(targetDate[0],targetDate[1],targetDate[2],'' + targetTime[0] + ':' + targetTime[1] + '');
1186	};
1187};
1188circularCountdown();
1189
1190/*!
1191 * Steps Function
1192 *
1193 */
1194function steps() {
1195	var el = jQuery('.step');
1196	if (el.length) {
1197		el.imagesLoaded(function(){
1198			el.each(function() {
1199				var $this = jQuery(this),
1200					topSec = $this.find('figure'),
1201					topSecH = topSec.outerHeight(),
1202					details = $this.find('.details'),
1203					detailsH = details.outerHeight();
1204
1205				$this.on('mouseenter', function() {
1206					details.css({
1207						'-webkit-transform': 'translateY(' + -(detailsH / 2) + 'px) translateX(-50%)',
1208						'-ms-transform': 'translateY(' + -(detailsH / 2) + 'px) translateX(-50%)',
1209						'transform': 'translateY(' + -(detailsH / 2) + 'px) translateX(-50%)',
1210						opacity: 1,
1211						visibility: 'visible'
1212					});
1213					topSec.css({
1214						'-webkit-transform': 'translateY(' + -(detailsH / 2) + 'px)',
1215						'-ms-transform': 'translateY(' + -(detailsH / 2) + 'px)',
1216						'transform': 'translateY(' + -(detailsH / 2) + 'px)'
1217					});
1218				}).on('mouseleave', function(){
1219					details.css({
1220						'-webkit-transform': 'translateY(0) translateX(-50%)',
1221						'-ms-transform': 'translateY(0) translateX(-50%)',
1222						'transform': 'translateY(0) translateX(-50%)',
1223						opacity: 0,
1224						visibility: 'hidden'
1225					});
1226					topSec.css({
1227						'-webkit-transform': 'translateY(0)',
1228						'-ms-transform': 'translateY(0)',
1229						'transform': 'translateY(0)'
1230					});
1231				});
1232			});
1233		})
1234	};
1235};
1236steps();
1237
1238
1239/*!
1240 * Tab Function
1241 *
1242 */
1243function tabsInit(){
1244	"use strict";
1245
1246	var Tab = function (element) {
1247	  this.element = jQuery(element)
1248	}
1249
1250	Tab.VERSION = '3.3.5'
1251
1252	Tab.TRANSITION_DURATION = 600
1253
1254	Tab.prototype.show = function () {
1255	  var jQuerythis    = this.element
1256	  var jQueryul      = jQuerythis.closest('ul:not(.dropdown-menu)')
1257	  var selector = jQuerythis.data('target')
1258
1259	  if (!selector) {
1260		selector = jQuerythis.attr('href')
1261		selector = selector && selector.replace(/.*(?=#[^\s]*jQuery)/, '') // strip for ie7
1262	  }
1263
1264	  if (jQuerythis.parent('li').hasClass('active')) return
1265
1266	  var jQueryprevious = jQueryul.find('.active:last a')
1267	  var hideEvent = jQuery.Event('hide.bs.tab', {
1268		relatedTarget: jQuerythis[0]
1269	  })
1270	  var showEvent = jQuery.Event('show.bs.tab', {
1271		relatedTarget: jQueryprevious[0]
1272	  })
1273
1274	  jQueryprevious.trigger(hideEvent)
1275	  jQuerythis.trigger(showEvent)
1276
1277	  if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return
1278
1279	  var jQuerytarget = jQuery(selector)
1280
1281	  this.activate(jQuerythis.closest('li'), jQueryul)
1282	  this.activate(jQuerytarget, jQuerytarget.parent(), function () {
1283		jQueryprevious.trigger({
1284		  type: 'hidden.bs.tab',
1285		  relatedTarget: jQuerythis[0]
1286		})
1287		jQuerythis.trigger({
1288		  type: 'shown.bs.tab',
1289		  relatedTarget: jQueryprevious[0]
1290		})
1291	  })
1292	}
1293
1294	Tab.prototype.activate = function (element, container, callback) {
1295	  var jQueryactive    = container.find('> .active')
1296	  var transition = callback
1297		&& jQuery.support.transition
1298		&& (jQueryactive.length && jQueryactive.hasClass('fade') || !!container.find('> .fade').length)
1299
1300	  function next() {
1301		jQueryactive
1302		  .removeClass('active')
1303		  .find('> .dropdown-menu > .active')
1304			.removeClass('active')
1305		  .end()
1306		  .find('[data-toggle="tab"]')
1307			.attr('aria-expanded', false)
1308
1309		element
1310		  .addClass('active')
1311		  .find('[data-toggle="tab"]')
1312			.attr('aria-expanded', true)
1313
1314		if (transition) {
1315		  element[0].offsetWidth // reflow for transition
1316		  element.addClass('in')
1317		} else {
1318		  element.removeClass('fade')
1319		}
1320
1321		if (element.parent('.dropdown-menu').length) {
1322		  element
1323			.closest('li.dropdown')
1324			  .addClass('active')
1325			.end()
1326			.find('[data-toggle="tab"]')
1327			  .attr('aria-expanded', true)
1328		}
1329
1330		callback && callback()
1331	  }
1332
1333	  jQueryactive.length && transition ?
1334		jQueryactive
1335		  .one('bsTransitionEnd', next)
1336		  .emulateTransitionEnd(Tab.TRANSITION_DURATION) :
1337		next()
1338
1339	  jQueryactive.removeClass('in')
1340	}
1341
1342
1343	// TAB PLUGIN DEFINITION
1344	// =====================
1345
1346	function Plugin(option) {
1347	  return this.each(function () {
1348		var jQuerythis = jQuery(this)
1349		var data  = jQuerythis.data('bs.tab')
1350
1351		if (!data) jQuerythis.data('bs.tab', (data = new Tab(this)))
1352		if (typeof option == 'string') data[option]()
1353	  })
1354	}
1355
1356	var old = jQuery.fn.tab
1357
1358	jQuery.fn.tab             = Plugin
1359	jQuery.fn.tab.Constructor = Tab
1360
1361
1362	// TAB NO CONFLICT
1363	// ===============
1364
1365	jQuery.fn.tab.noConflict = function () {
1366	  jQuery.fn.tab = old
1367	  return this
1368	}
1369
1370
1371	// TAB DATA-API
1372	// ============
1373
1374	var clickHandler = function (e) {
1375	  e.preventDefault()
1376	  Plugin.call(jQuery(this), 'show')
1377	}
1378
1379	jQuery(document)
1380	  .on('click.bs.tab.data-api', '[data-toggle="tab"]', clickHandler)
1381	  .on('click.bs.tab.data-api', '[data-toggle="pill"]', clickHandler)
1382
1383	function transitionEnd() {
1384	  var el = document.createElement('bootstrap')
1385
1386	  var transEndEventNames = {
1387		WebkitTransition : 'webkitTransitionEnd',
1388		MozTransition    : 'transitionend',
1389		OTransition      : 'oTransitionEnd otransitionend',
1390		transition       : 'transitionend'
1391	  }
1392
1393	  for (var name in transEndEventNames) {
1394		if (el.style[name] !== undefined) {
1395		  return { end: transEndEventNames[name] }
1396		}
1397	  }
1398
1399	  return false // explicit for ie8 (  ._.)
1400	}
1401
1402	// http://blog.alexmaccaw.com/css-transitions
1403	jQuery.fn.emulateTransitionEnd = function (duration) {
1404	  var called = false
1405	  var jQueryel = this
1406	  jQuery(this).one('bsTransitionEnd', function () { called = true })
1407	  var callback = function () { if (!called) jQuery(jQueryel).trigger(jQuery.support.transition.end) }
1408	  setTimeout(callback, duration)
1409	  return this
1410	}
1411
1412	jQuery(function () {
1413	  jQuery.support.transition = transitionEnd()
1414
1415	  if (!jQuery.support.transition) return
1416
1417	  jQuery.event.special.bsTransitionEnd = {
1418		bindType: jQuery.support.transition.end,
1419		delegateType: jQuery.support.transition.end,
1420		handle: function (e) {
1421		  if (jQuery(e.target).is(this)) return e.handleObj.handler.apply(this, arguments)
1422		}
1423	  }
1424	})
1425
1426	jQuery('.tab-nav').find('li').find('a').on('click', function(event) {
1427		event.preventDefault();
1428		event.stopPropagation();
1429		jQuery(this).tab('show');
1430	});
1431}
1432
1433/*!
1434 * Animated Blocks
1435 *
1436 */
1437 function animatedBlock(){
1438	var currentTallest = 0,
1439		currentRowStart = 0,
1440		rowDivs = [],
1441		$el,
1442		topPosition = 0,
1443		animatedBlock = jQuery('.animated-block'),
1444		pushValue = animatedBlock.find('.hidden-part').height();
1445
1446	if (animatedBlock.length) {
1447		animatedBlock.imagesLoaded(function(){
1448			animatedBlock.each(function() {
1449
1450				$el = jQuery(this);
1451				topPosition = $el.position().top;
1452			   
1453				if (currentRowStart != topPosition) {
1454
1455				// we just came to a new row.  Set all the heights on the completed row
1456				for (currentDiv = 0;currentDiv < rowDivs.length ; currentDiv++) {
1457					rowDivs[currentDiv].height(currentTallest);
1458				}
1459
1460				// set the variables for the new row
1461				rowDivs.length = 0; // empty the array
1462				currentRowStart = topPosition;
1463				currentTallest = $el.height();
1464				rowDivs.push($el);
1465
1466				} else {
1467
1468				// another div on the current row.  Add it to the list and check if it's taller
1469				rowDivs.push($el);
1470				currentTallest = (currentTallest < $el.height()) ? ($el.height()) : (currentTallest);
1471
1472			} 
1473			// do the last row
1474			for (currentDiv = 0;currentDiv < rowDivs.length ; currentDiv++) {
1475				rowDivs[currentDiv].height(currentTallest);
1476			}
1477			   
1478			$el.find('.visible-part').css('padding-top', pushValue / 2 );
1479			});
1480		});
1481		animatedBlock.on('mouseenter', function() {
1482			$this = jQuery(this);
1483			$this.find('.visible-part').css({
1484					'-webkit-transform': 'translateY(-' + pushValue / 2 + 'px)',
1485					'-ms-transform': 'translateY(-' + pushValue / 2 + 'px)',
1486					'transform': 'translateY(-' + pushValue / 2 + 'px)'
1487				 });
1488			$this.find('.hidden-part').css({
1489					'-webkit-transform': 'translateY(-' + pushValue / 2 + 'px)',
1490					'-ms-transform': 'translateY(-' + pushValue / 2 + 'px)',
1491					'transform': 'translateY(-' + pushValue / 2 + 'px)'
1492				 });
1493		}).on('mouseleave', function() {
1494			$this = jQuery(this);
1495			$this.find('.visible-part').css({
1496					'-webkit-transform': 'translateY(0)',
1497					'-ms-transform': 'translateY(0)',
1498					'transform': 'translateY(0)'
1499				 });
1500			$this.find('.hidden-part').css({
1501					'-webkit-transform': 'translateY(0',
1502					'-ms-transform': 'translateY(0',
1503					'transform': 'translateY(0)'
1504				 });
1505		});
1506	};
1507
1508};
1509
1510/*!
1511 * Start Smooth Link Functionality
1512 *
1513 * Function used to go from one section to another smoothly
1514 *
1515 */
1516function ivan_smooth_links_init() {
1517	"use strict";
1518
1519	var header_offset = 0;
1520
1521	if( jQuery('.header-fixed').length > 0 ) {
1522		header_offset = jQuery('.header-fixed').outerHeight(false) * 0.57;
1523	}
1524
1525	// Go to present hashtags
1526	if(window.location.hash) {
1527
1528		var header_offset = 0;
1529
1530		if( jQuery('.header-fixed').length > 0 ) {
1531			header_offset = jQuery('.header-fixed').outerHeight(false);
1532		}
1533
1534		var target = jQuery(window.location.hash);
1535
1536		if( target.length ) {
1537			if( target.offset().top < 150)
1538				header_offset = 0;
1539
1540			jQuery(document).scrollTop( target.offset().top - header_offset );
1541		}
1542
1543	} else {
1544		// Fragment doesn't exist
1545	}
1546
1547	// Smooth scrolling to internal anchors
1548	jQuery('a[href*=#]:not([href=#]):not([href*=#tab]):not([href*=#comments])').on("click", function () {
1549
1550		if( header_offset == 0 ) {
1551			header_offset = jQuery('.header-fixed').outerHeight(false) * 0.57;
1552		}
1553
1554		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') 
1555			|| location.hostname == this.hostname) {
1556
1557			var target = jQuery(this.hash);
1558			target = target.length ? target : jQuery('[name=' + this.hash.slice(1) +']');
1559			   if (target.length) {
1560
1561				if( target.offset().top < 150)
1562					header_offset = 0;
1563
1564				jQuery('html,body').animate({
1565					scrollTop: target.offset().top - header_offset
1566				}, 600);
1567
1568				return false;
1569			}
1570		}
1571	});
1572	
1573}
1574
1575/**
1576 * Floating Contact Form
1577 * @returns 
1578 */
1579function ivan_floating_contact_form_init() {
1580	"use strict";
1581	
1582	var $ff = jQuery('#floating-contact-form');
1583	var $ff_submited = false;
1584	
1585	if ($ff.length < 1) {
1586		return;
1587	}
1588	
1589	jQuery('#ff-submit').on('click', function(event) {
1590		event.preventDefault();
1591		$ff.submit();
1592	});
1593	
1594	$ff.submit(function (e) {
1595		
1596		e.preventDefault();
1597		
1598		if ($ff_submited == true) {
1599			jQuery('#ff-notice').html(ivan_lang.form_already_submitted);
1600			return false;
1601		}
1602
1603		jQuery('#ff-submit').html(ivan_lang.sending);
1604		$ff_submited = true;
1605		
1606		jQuery.ajax({
1607			url: ivan_theme_scripts.ajaxurl,
1608			data: {
1609				name: jQuery('#ff-name').val(),
1610				email: jQuery('#ff-email').val(),
1611				message: jQuery('#ff-message').val(),
1612				action: 'ff_submit',
1613				nonce: jQuery('#ff-nonce').val(),
1614				recaptcha_response: jQuery('#g-recaptcha-response').val()
1615			},
1616			type: 'POST',
1617			dataType: 'JSON',
1618			success: function (data) {
1619				
1620				//configuration error
1621				if (data.error == 3) {
1622					
1623					jQuery('#ff-submit').html(ivan_lang.send);
1624					jQuery('#ff-notice').html(ivan_lang.failed_config_error);
1625					$ff_submited = false;
1626				
1627				//server error, wp_mail failed
1628				} else if (data.error == 2) {
1629					
1630					jQuery('#ff-submit').html(ivan_lang.send);
1631					jQuery('#ff-notice').html(ivan_lang.failed_server_error);
1632					$ff_submited = false;
1633				
1634				//form error
1635				} else if (data.error == 1) {
1636					
1637					if (data.errors.name == 1) {
1638						jQuery('#ff-name').css('border','1px solid #FF0000');
1639					} else {
1640						jQuery('#ff-name').removeAttr( 'style' );
1641					}
1642					
1643					if (data.errors.email == 1) {
1644						jQuery('#ff-email').css('border','1px solid #FF0000');
1645					} else {
1646						jQuery('#ff-email').removeAttr( 'style' );
1647					}
1648					
1649					if (data.errors.message == 1) {
1650						jQuery('#ff-message').css('border','1px solid #FF0000');
1651					} else {
1652						jQuery('#ff-message').removeAttr( 'style' );
1653					}
1654					
1655					if (data.errors.recaptcha == 1) {
1656						jQuery('.g-recaptcha').find('iframe').css('border','1px solid #FF0000');
1657					} else {
1658						jQuery('.g-recaptcha').find('iframe').removeAttr( 'style' );;
1659					}
1660					
1661					jQuery('#ff-submit').html(ivan_lang.send);
1662					jQuery('#ff-notice').html(ivan_lang.fill_all_required_fields);
1663					$ff_submited = false;
1664				//email sent
1665				} else {
1666					jQuery('#ff-name').removeAttr( 'style' );
1667					jQuery('#ff-email').removeAttr( 'style' );
1668					jQuery('#ff-message').removeAttr( 'style' );
1669					jQuery('.g-recaptcha').find('iframe').removeAttr( 'style' );;
1670					
1671					jQuery('#ff-notice').html(ivan_lang.thank_you);					
1672					jQuery('#ff-submit').html(ivan_lang.sent);
1673					$ff_submited = true;
1674				}
1675			}
1676		})
1677		
1678	});
1679}
1680
1681/**
1682 * Portfolio modern init
1683 * @returns 
1684 */
1685function ivan_portfolio_modern_init() {
1686	"use strict";
1687	
1688	var $portfolio_container = jQuery("#portfolio");
1689	var	$portfolio_items = jQuery("#portfolio .item");
1690	var	$active_filter = jQuery(".ivan-vc-filters a.current");
1691
1692	if ($portfolio_container.length > 0) {
1693		
1694		jQuery('body').append('<div id="portfolio-responsive"><div id="portfolio-responsive-2"></div><div id="portfolio-responsive-1"></div></div>');
1695		var $pr1 = jQuery("#portfolio-responsive-1");
1696		var $pr2 = jQuery("#portfolio-responsive-2");
1697		
1698		$portfolio_container.imagesLoaded(function() {
1699			var column_width = ivan_get_portfolio_column_width();
1700			
1701			$portfolio_items.each(function() {
1702				jQuery(this).width(column_width * jQuery(this).data("factor"))
1703			});
1704			$portfolio_container.isotope({
1705				itemSelector: ".item",
1706				masonry: {
1707					columnWidth: column_width
1708				},
1709				isResizeBound: false
1710			});
1711			
1712			jQuery(window).resize(function() {
1713				var column_width = ivan_get_portfolio_column_width();
1714				var elems = $portfolio_container.isotope("getItemElements");
1715				for (var i = 0; i < elems.length; i++) jQuery(elems[i]).width(column_width * jQuery(elems[i]).data("factor"));
1716				$portfolio_container.isotope({
1717					masonry: {
1718						columnWidth: column_width
1719					}
1720				})
1721			}).trigger("resize")
1722		});
1723		
1724		jQuery(".ivan-vc-filters").find("a").on("click", function (e) {
1725			
1726			$active_filter.removeClass("current");
1727			$active_filter = jQuery(this);
1728			$active_filter.addClass("current");
1729			var f = jQuery(this).data("filter");
1730			
1731			$portfolio_container.isotope({
1732				filter: f
1733			});
1734			e.preventDefault()
1735		});
1736	}
1737	if (window.addEventListener) window.addEventListener("orientationchange", function() {
1738		setTimeout(function() {
1739			jQuery(window).trigger("resize")
1740		}, 500)
1741	}, false);
1742
1743	function ivan_get_portfolio_column_width() {
1744		var colWidth = 0;
1745		
1746		var container_width = $portfolio_container.closest('.wpb_wrapper').width();
1747		if ($pr1.css("display") == "block") {
1748			return container_width;
1749		} else if ($pr2.css("display") == "block") {
1750			return (container_width / 2 - 1);
1751		} else {
1752			return (container_width / 3 - 1);
1753		}
1754	}
1755}
1756
1757function blogMasonryReveal() {
1758
1759	var el = jQuery('.masonry-posts.ivan-posts').find('.ivan-post');
1760
1761	if (el.length) {
1762
1763		el.each(function() {
1764			var $this = jQuery(this);
1765			$this.appear(function(){
1766				$this.addClass('visible')
1767			});
1768		});
1769	};
1770
1771};
1772blogMasonryReveal();
1773
1774function modernBlog() {
1775	var el = jQuery('.post.modern-fullwidth');
1776
1777	el.each(function() {
1778		var $this = jQuery(this),
1779			title = $this.find('header h2 a'),
1780			readMore = $this.find('.read-more'),
1781			readMoreTxt = readMore.find('span').html();
1782		jQuery(readMore).add(title).on('click', function(event) {
1783			event.preventDefault();
1784			ivan_post_wp_gallery_init();
1785			$this.find('.post-content').stop().slideToggle(400, function(){
1786				jQuery(window).data('plugin_stellar').destroy();
1787				setTimeout(function(){
1788					jQuery(window).data('plugin_stellar').init();
1789				},200);
1790				ivan_post_wp_gallery_init();
1791			}).end().toggleClass('post-content-showing');
1792		});
1793	});
1794};
1795modernBlog();
1796
1797
1798/**
1799 * Portfolio Style2
1800 */
1801function portfolio_style2() {
1802	var portfolioContainer = jQuery('.portfolio.style2'),
1803		itemsContainer = portfolioContainer.find('.items-container'),
1804		filtersWrapper = portfolioContainer.find('.filters-wrapper');
1805
1806	if (portfolioContainer.length) {
1807		itemsContainer.imagesLoaded(function() {
1808			
1809			itemsContainer.isotope({
1810				itemSelector: ".portfolio-item",
1811				percentPosition: true,
1812				masonry: {
1813					columnWidth: '.grid-sizer'
1814				}
1815			});
1816			filtersWrapper.on('click', 'li', function() {
1817				var $this = jQuery(this),
1818					filterValue = $this.attr("data-filter");
1819				
1820				$this.addClass('active')
1821					 .siblings('li').removeClass('active');
1822				
1823				itemsContainer.isotope({
1824					filter: filterValue
1825				});
1826			});
1827		});		
1828	};	
1829}
1830
1831/* Active Panr */
1832function activePanr() {
1833	var el = jQuery('.panr-active');
1834
1835	if (!el.length || typeof jQuery.fn.panr != 'function') {
1836		return
1837	} else {
1838		el.each(function() {
1839			var $this = jQuery(this),
1840				sensitivityValue = $this.attr('data-sensitivity'),
1841				scaleValue = $this.attr('data-scaleto');
1842			if (sensitivityValue === null || sensitivityValue === undefined) {
1843				sensitivityValue = 30;
1844			} else {
1845				sensitivityValue = $this.attr('data-sensitivity');
1846			};
1847			if (scaleValue === null || scaleValue === undefined) {
1848				scaleValue = 1.1;
1849			} else {
1850				scaleValue = $this.attr('data-scaleto');
1851			};
1852			$this.imagesLoaded(function(){
1853				$this.find('.panr-element').panr({
1854					sensitivity: sensitivityValue,
1855					scale: false,
1856					scaleOnHover: true,
1857					scaleTo: scaleValue,
1858					scaleDuration: .5,
1859					panY: true,
1860					panX: true,
1861					panDuration: 1.25,
1862					moveTarget: $this,
1863					resetPanOnMouseLeave: false
1864				});
1865			})
1866		});
1867	};
1868};
1869activePanr();
1870
1871/*!
1872 * Init Mansory Styled Blog
1873 *
1874 * Function used to display blog in styled way
1875 *
1876 */
1877function ivan_init_mansory_style_blog() {
1878	"use strict";
1879
1880	var container = document.querySelector('.ivan-mansory-blog');
1881
1882	if( null != container) {
1883
1884		var pckry;
1885
1886		imagesLoaded( container, function() {
1887			pckry = new Packery( container, {
1888				itemSelector: '.post-wrapper'
1889			});
1890
1891			setTimeout(function() {
1892				if(jQuery('body').hasClass("ivan-m-l-aside")) {
1893					jQuery('.ivan-mansory-blog').packery();
1894				}
1895			}, 1500);
1896
1897		});
1898
1899	}
1900	
1901}
1902
1903/*!
1904 * Calculate Correct Header Area Sizes
1905 *
1906 * Function used to fix height that should be used
1907 *
1908 */
1909function ivan_fix_header_area_height() {
1910	"use strict";
1911
1912	if( jQuery('.header').length > 0 ) {
1913		jQuery('.calc-height-area').each( function() {
1914			jQuery('.header-center-area').imagesLoaded(function(){
1915				jQuery(this).outerHeight( jQuery('.header-center-area').outerHeight() );
1916			});
1917		});
1918	};
1919};
1920
1921// Update properly the layout after added by AJAX
1922function ivan_update_mansory_style_blog() {
1923	"use strict";
1924
1925	jQuery('.ivan-mansory-blog').packery();
1926	jQuery('.ivan-mansory-blog').packery('reloadItems');
1927
1928}
1929
1930/**********************************************************
1931***********************************************************
1932***********************************************************/
1933
1934// Visual Composer Container Size
1935function ivan_vc_full_width_container() {
1936	"use strict";
1937
1938	var _w = jQuery(window).width();
1939
1940	jQuery('.entry-content > .wpb_row').each( function() {
1941
1942		var _rowW = jQuery(this).width();
1943
1944		var _diff = (_w - _rowW) / 2 + 15;
1945
1946		jQuery(this).css({
1947			marginLeft: '-' + _diff + 'px',
1948			paddingLeft: _diff + 'px',
1949			marginRight: '-' + _diff + 'px',
1950			paddingRight: _diff + 'px',
1951		});
1952
1953	});
1954}
1955
1956
1957/**********************************************************
1958***********************************************************
1959***********************************************************/
1960
1961// Fix Menu Areas that can't be fixed
1962ivan_fix_header_area_height();
1963
1964/*
1965 * Window Load Event
1966 */
1967jQuery(window).on('load',function () {
1968	"use strict";
1969
1970	// Fix Menu Areas that can't be fixed
1971	ivan_fix_header_area_height();
1972
1973	ivan_vc_full_width_container();
1974
1975});
1976jQuery(window).on('resize', function() {
1977
1978	if ( jQuery('.live-search.search-top-style').length ) {
1979		jQuery('.form-close-btn').css('right', jQuery('.live-search').find('form').offset().left);
1980	};
1981	ivan_megamenu_init();
1982
1983	blogMasonryReveal();
1984
1985	portfolioHorizontal();
1986
1987	horizontalLayout();
1988
1989	moveDown();
1990
1991	stickyFooter();
1992
1993	ivanScrollTo();
1994});
1995
1996function ivan_theme_script_load() {
1997	"use strict";
1998
1999	// Fix Menu Areas that can't be fixed
2000	ivan_fix_header_area_height();
2001
2002	ivan_vc_full_width_container();
2003}
2004
2005/*
2006 * Document Ready Event
2007 */
2008jQuery( function() {
2009	"use strict";
2010
2011	ivan_theme_script_ready();
2012
2013	headerTitleFade();
2014
2015});
2016
2017function ivan_theme_script_ready() {
2018	"use strict";
2019
2020	var ivLayoutHeader = jQuery('.iv-layout.header');
2021
2022	/* Small fix to empty p in content */
2023	jQuery('.entry-content > p:empty').remove();
2024
2025
2026	/* Init Back to Top Button */
2027	ivan_back_to_top_init();
2028
2029	floatedContactForm();
2030
2031	mediaElmenetsVideos();
2032
2033	tweetsSlider();
2034
2035	videoPopup();
2036
2037	steps();
2038
2039	initWow();
2040
2041	/* Calls Negative Height init script */
2042	if(ivLayoutHeader.hasClass('negative-height'))
2043		ivan_header_marginTop = parseInt( jQuery('.iv-layout.header.negative-height').css("marginTop").replace('px', '') );
2044
2045	ivLayoutHeader.find('.logo').imagesLoaded(function(){
2046		ivan_negative_height_init();
2047	});
2048
2049	/* Calls Live Search init script */
2050	ivan_live_search_init();
2051
2052	/* Calls Woo Cart init script */
2053	ivan_woo_cart_init();
2054	
2055	/* Calls WPMLLanguages dropdown init script */
2056	ivan_wpml_languages_dropdown_init();
2057
2058	/* Calls Login AJAX init script */
2059	ivan_login_ajax_init();
2060
2061	/* Calls Responsive Menu init script */
2062	ivan_responsive_menus_init();
2063	
2064	/* Calls Overlay Menu init script */
2065	ivan_overlay_menus_init();
2066
2067	/* Calls Responsive Menu Select init script */
2068	ivan_responsive_menus_select_init();
2069
2070	/* Calls MegaMenu init script */
2071	setTimeout(function() { ivan_megamenu_init(); }, 1000);
2072
2073	stickyFooter();
2074
2075	/* Call init function to post formats */
2076	ivan_post_formats_init();
2077
2078	/* Init Mansory Blog */
2079	ivan_init_mansory_style_blog();
2080
2081	/* Init default WP Gallery shortcode lightbox and mansory layout */
2082	ivan_post_wp_gallery_init();
2083
2084	/* Flexible Header */
2085	ivan_fixed_header();
2086	
2087	/* Flexible Header */
2088	ivan_portfolio_modern_init();
2089
2090	/* Portfolio Style2 */
2091	portfolio_style2();
2092	
2093	/* Flexible Header */
2094	ivan_floating_contact_form_init();
2095
2096	/* Tabs Init */
2097	tabsInit();
2098
2099	/* Animated Blocks Init */
2100	animatedBlock();
2101
2102	/* Fix iOS Zoom problems */
2103	jQuery('input:text,select,textarea').cancelZoom();
2104}
2105
2106// Infinite Scroll
2107jQuery( document.body ).on( 'post-load', function () {
2108	"use strict";
2109
2110
2111	imagesLoaded( jQuery('#post-list'), function() {
2112
2113		ivan_post_formats_init();
2114
2115		ivan_update_mansory_style_blog();
2116
2117		setTimeout(function() { ivan_update_mansory_style_blog(); }, 1000);
2118
2119	});
2120	
2121});
2122
2123if(ivan_theme_scripts.preload) {
2124	/*
2125	 * Fade In/Out Effect
2126	 */
2127	jQuery(window).bind("load", function() {
2128		"use strict";
2129
2130		jQuery('#page-loader').fadeOut();
2131	});
2132
2133	jQuery(window).bind('beforeunload', function(e){
2134		"use strict";
2135
2136		jQuery('#page-loader').fadeIn();
2137	});
2138}
2139
2140/*
2141 * Debounced Resize Event
2142 */
2143jQuery(window).on('debouncedresize', function( event ) {
2144
2145	ivan_recalc_dimensions();
2146
2147});
2148
2149function ivan_recalc_dimensions() {
2150	"use strict";
2151
2152	ivan_negative_height_init();
2153
2154	ivan_recalc_sticky_height();
2155
2156	ivan_vc_full_width_container();
2157}
2158
2159 /*!
2160 * Skip Input Focus Fix
2161 *
2162 * Fix odd focus behavior in mobile devices
2163 *
2164 */
2165( function() {
2166
2167	"use strict";
2168
2169	var is_webkit = navigator.userAgent.toLowerCase().indexOf( 'webkit' ) > -1,
2170		is_opera  = navigator.userAgent.toLowerCase().indexOf( 'opera' )  > -1,
2171		is_ie	 = navigator.userAgent.toLowerCase().indexOf( 'msie' )   > -1;
2172
2173	if ( ( is_webkit || is_opera || is_ie ) && 'undefined' !== typeof( document.getElementById ) ) {
2174		var eventMethod = ( window.addEventListener ) ? 'addEventListener' : 'attachEvent';
2175		window[ eventMethod ]( 'hashchange', function() {
2176			var element = document.getElementById( location.hash.substring( 1 ) );
2177
2178			if ( element ) {
2179				if ( ! /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) )
2180					element.tabIndex = -1;
2181
2182				element.focus();
2183			}
2184		}, false );
2185	}
2186})();
2187
2188/* Initial Stellar */
2189function initStellar() {
2190
2191	if (jQuery(window).width() >= 768) {
2192		jQuery.stellar({
2193			responsive: true,
2194			hideDistantElements: false,
2195			positionProperty: 'transform',
2196			horizontalScrolling: false,
2197			horizontalOffset: 0,
2198			verticalOffset: 0
2199		});
2200	};
2201};
2202initStellar();
2203
2204function horizontalLayout() {
2205	var el = jQuery('body.is-horizontal'),
2206		horizontalElement = jQuery('.portfolio-horizontal'),
2207		footer = jQuery('.iv-layout.footer'),
2208		bottomFooter = jQuery('.iv-layout.bottom-footer'),
2209		footerHeight,
2210		bottomFooterHeight;
2211	if (footer.length) {
2212		footer.imagesLoaded(function(){
2213			footerHeight = footer.outerHeight();
2214		});
2215	} else {
2216		footerHeight = 0;	
2217	};
2218	if (bottomFooter.length) {
2219		bottomFooter.imagesLoaded(function() {
2220			bottomFooterHeight = bottomFooter.outerHeight();
2221		});
2222	} else {
2223		bottomFooterHeight = 0;
2224	};
2225	if (horizontalElement.length) {
2226		jQuery('body').addClass('is-horizontal');
2227		if (jQuery('.iv-layout.header').length) {
2228			jQuery('.iv-layout.header').imagesLoaded(function(){
2229				jQuery('.iv-layout.content-wrapper').css({
2230					'margin-top': jQuery('.iv-layout.header').outerHeight()
2231				});
2232			});
2233		};
2234		jQuery('.iv-layout.footer, .iv-layout.bottom-footer').imagesLoaded(function(){
2235			jQuery('.iv-layout.content-wrapper').css({
2236				'margin-bottom': footerHeight + bottomFooterHeight
2237			});
2238		});
2239	};
2240};
2241horizontalLayout();
2242
2243/* Portfolio Horizontal */
2244function portfolioHorizontal() {
2245	var el = jQuery('.portfolio-horizontal');
2246
2247	el.each(function() {
2248		var $this = jQuery(this),
2249			texts = $this.find('.text'),
2250			imagesCarousel = $this.find('.images-carousel');
2251			fadeStart = 0,
2252			fadeUntil = 500,
2253			range = 1500;
2254			scrollTime = 0.3,
2255			scrollDistance = 400;
2256
2257		$this.imagesLoaded(function(){
2258			var imagesCarouselW = (imagesCarousel.find('figure').first().outerWidth(true)) * (imagesCarousel.find('figure').length),
2259				textsW = texts.outerWidth(),
2260				contentWrapperMT = parseInt(jQuery('.iv-layout.content-wrapper').css('margin-top')),
2261				contentWrapperMB = parseInt(jQuery('.iv-layout.content-wrapper').css('margin-bottom'));
2262
2263			$this.css({
2264				'width': '',
2265				'height': ''
2266			});
2267			$this
2268				.width(imagesCarouselW + textsW + 90)
2269				.height(jQuery(window).height() - jQuery('.iv-layout.content-wrapper').css('margin-top'));
2270
2271				if (jQuery('.iv-layout.header').length) {
2272					$this.height(jQuery(window).height() - jQuery('.iv-layout.header').outerHeight() - jQuery('.iv-layout.content-wrapper').css('margin-top'));
2273				}
2274				if (jQuery(window).width() >= 992) {
2275
2276
2277					jQuery(window).on("scroll mousewheel DOMMouseScroll", function(event){
2278						
2279						if (!navigator.userAgent.indexOf('Mac') != -1) {
2280							
2281							event.preventDefault();
2282															
2283							var delta = event.originalEvent.wheelDelta/60 || -event.originalEvent.detail/3;
2284							var scrollLeft = jQuery(window).scrollLeft();
2285							var finalScroll = scrollLeft - parseInt(delta*scrollDistance);
2286								
2287							TweenMax.to(jQuery(window), scrollTime, {
2288								scrollTo : { x: finalScroll, autoKill:false },
2289									ease: Expo.easeOut,	//For more easing functions see http://api.greensock.com/js/com/greensock/easing/package-detail.html
2290									autoKill: false,
2291									overwrite: 5
2292								});
2293						};
2294
2295						var offset = jQuery(window).scrollLeft(),
2296							opacity = 0;
2297
2298						if( offset <= fadeStart ){
2299							opacity = 1;
2300						} else if( offset <= fadeUntil ){
2301							opacity = 1 - offset / fadeUntil;
2302						};
2303
2304						texts.css({
2305							'position': 'fixed',
2306							'top': imagesCarousel.offset().top,
2307							'left': 90,
2308							'margin-top': 15,
2309							'opacity': opacity
2310						});
2311						imagesCarousel.css('margin-left', textsW);
2312					});
2313				} else {
2314
2315					jQuery(window).on("scroll mousewheel DOMMouseScroll", function(event){
2316						
2317						event.preventDefault();
2318														
2319						var delta = event.originalEvent.wheelDelta/120 || -event.originalEvent.detail/3;
2320						var scrollTop = jQuery(window).scrollTop();
2321						var finalScroll = scrollTop - parseInt(delta*scrollDistance);
2322							
2323						TweenMax.to(jQuery(window), scrollTime, {
2324							scrollTo : { y: finalScroll, autoKill:false },
2325								ease: Expo.easeOut,	//For more easing functions see http://api.greensock.com/js/com/greensock/easing/package-detail.html
2326								autoKill: false,
2327								overwrite: 5
2328							});
2329					});
2330				};
2331		});
2332	});
2333};
2334
2335portfolioHorizontal();
2336
2337smoothScroll(1.3, 220); // Smooth Scroll
2338
2339/* Fullscreen Slideshoow */
2340function fullscreenSlideshow() {
2341	var el = jQuery('.fullscreen-slideshow');
2342	if (el.length) {
2343		el.maximage();
2344	};
2345};
2346fullscreenSlideshow();
2347
2348/* Initital Countdown */
2349function countdown() {
2350	var el = jQuery('.countdown'),
2351		targetDate = el.attr('data-target-date'),
2352		targetHour = el.attr('data-target-hour');
2353	if (el.length) {
2354		el.countdown( '' +  targetDate + ' ' + targetHour + '', function(event) {
2355			jQuery(this).html(
2356			event.strftime(''
2357				+ '<div><span>%D</span><span class="text">Days</span></div>'
2358				+ '<div><span>%H</span><span class="text">Hours</span></div>'
2359				+ '<div><span>%M</span><span class="text">Mins</span></div>'
2360				+ '<div><span>%S</span><span class="text">Secs</span></div>'
2361				+ '')
2362			);
2363			el.fitText();
2364		});
2365	};
2366};
2367countdown();
2368
2369function productsMatchHeight() {
2370	var el = jQuery('ul.products').find('.product:not(.product-list-style)');
2371	if (el.length && typeof jQuery.fn.matchHeight == 'function') {
2372		el.matchHeight();
2373	};
2374};
2375productsMatchHeight();
2376
2377/* Hover Direction */
2378function hoverDir() {
2379	var el = jQuery('.hover-dir');
2380	if (el.length) {
2381		el.hoverdir({
2382			hoverElem: '.hover-dir-el',
2383			speed: 500
2384		});
2385	};
2386	
2387};
2388hoverDir();
2389
2390/* Simple Reveal */
2391function simpleReveal() {
2392
2393	var el = jQuery('.reveal');
2394
2395	if (el.length) {
2396		el.each(function() {
2397			var $this = jQuery(this);
2398			$this.appear(function(){
2399				$this.addClass('visible');
2400			});
2401		});
2402	};
2403
2404};
2405simpleReveal();
2406
2407/* Particles */
2408function initParticles() {
2409
2410	var el = jQuery('#particles-js');
2411
2412	if (el.length) {
2413
2414		particlesJS('particles-js',
2415		  
2416		  {
2417			"particles": {
2418			  "number": {
2419				"value": 150,
2420				"density": {
2421				  "enable": true,
2422				  "value_area": 900
2423				}
2424			  },
2425			  "opacity": {
2426				"value": 1,
2427				"random": true,
2428				"anim": {
2429				  "enable": true,
2430				  "speed": 0.5,
2431				  "opacity_min": 0.6,
2432				  "sync": false
2433				}
2434			  },
2435			  "size": {
2436				"value": 1.5,
2437				"random": true,
2438				"anim": {
2439				  "enable": true,
2440				  "speed": 1,
2441				  "size_min": 0.1,
2442				  "sync": false
2443				}
2444			  },
2445			  "line_linked": {
2446				"enable": false,
2447				"distance": 150,
2448				"color": "#ffffff",
2449				"opacity": 0.4,
2450				"width": 1
2451			  },
2452			  "move": {
2453				"enable": true,
2454				"speed": 1.1,
2455				"direction": "right",
2456				"random": true
2457			  }
2458			},
2459			"interactivity": {
2460			  "detect_on": "canvas",
2461			  "events": {
2462				"onhover": {
2463				  "enable": false
2464				}
2465			  }
2466			},
2467			"retina_detect": true
2468		  }
2469
2470		);
2471	};
2472
2473};
2474initParticles();
2475
2476function infiniteScroll() {
2477
2478	jQuery('.ivan-projects-grid').infinitescroll({
2479		navSelector  : ".infinite-nav",            
2480		nextSelector : ".infinite-more-link",
2481		itemSelector : ".ivan-projects-grid .ivan-project",
2482		loading: {
2483			img: '',
2484			msg: '',
2485			finishedMsg: '',
2486			msgText: '<span class="infinite-more-link sc-button blue" data-loading-text="spinner"><i class="fa fa-spinner fa-pulse"></i></span>',
2487			selector: '.infinite-nav-loading'
2488		},
2489	},
2490	function(newItems) {
2491		jQuery(newItems).imagesLoaded(function(){
2492			jQuery('.ivan-projects-grid').isotope( 'appended', jQuery(newItems) );
2493			jQuery('.ivan-projects-grid').isotope('layout');
2494		});
2495	});
2496};
2497
2498function moveDown() {
2499	var el = jQuery('.move-down'),
2500		contentWrapper = jQuery('.iv-layout.content-wrapper');
2501	contentWrapper.imagesLoaded(function(){
2502		contentWrapperOffsetTop = contentWrapper.offset().top;
2503		el.on('click', function(event) {
2504			event.preventDefault();
2505			TweenMax.to(window, 1, {scrollTo:{y: contentWrapperOffsetTop}, ease:Power2.easeOut});
2506		});
2507	});
2508};
2509moveDown();
2510
2511function animatedIcons(element) {
2512	var el = jQuery(element);
2513	el.each(function(i){
2514		if ( ! jQuery(this).find('.icon-container').length ) {
2515			return;
2516		} else {
2517			var $this = jQuery(this),
2518				iconContainer = $this.find('.icon-container').css('opacity', 1),
2519				animationDelay = iconContainer.data('animation-delay'),
2520				obj = $this.find('object');
2521			obj.attr('id','icon-container-' + i);
2522			var svgContext = $this.find('object')[0].contentDocument,
2523				strokeColor = svgContext.createElementNS('http://www.w3.org/2000/svg', 'style');
2524			strokeColor.textContent = 'svg, svg path, svg polyline { stroke: ' + iconContainer.data('stroke-color') + '; }';
2525			svgContext.getElementById("Layer_1").appendChild(strokeColor);
2526			var animatedIcon = new Vivus(obj.attr('id'), {type: jQuery(this).find('.icon-container').data('animation-type'), duration: 100, start: 'manual'});
2527			jQuery(window).on('scroll', function() {
2528				if ($this.inView('topOnly') == true) {
2529					setTimeout(function(){
2530						animatedIcon.play();
2531					}, animationDelay);
2532				};                        
2533			});
2534		};
2535	});
2536};
2537
2538function ivanScrollTo() {
2539
2540	var el = jQuery('.ivan-scroll-to');
2541
2542	el.each(function() {
2543		var $this = jQuery(this),
2544			target = $this.attr('href'),
2545			targetOffsetTop,
2546			header = jQuery('.header')
2547
2548		if (header.length && header.hasClass('header-fixed')) {
2549			targetOffsetTop = jQuery(target).offset().top - header.outerHeight();
2550		} else {
2551			targetOffsetTop = jQuery(target).offset().top;
2552		}
2553		$this.on('click', function(event) {
2554			event.preventDefault();
2555			TweenMax.to(window, 1, {scrollTo:{y: targetOffsetTop}, ease:Power2.easeOut});
2556		});
2557	});
2558};
2559ivanScrollTo();
2560
2561jQuery(window).on('load', function() {
2562	infiniteScroll();
2563	animatedIcons('.content-box.style12');
2564	animatedIcons('.feature');
2565});
2566
2567jQuery('.scroll-to-content a[href^="#"]').on("click", function (e) {
2568 
2569    jQuery('html,body').animate({ scrollTop: jQuery(this.hash).offset().top}, 600);
2570 
2571    return false;
2572 
2573    e.preventDefault();
2574 
2575});

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.