PageSourceSearch

https://www.maliaras.gr/wp-content/themes/osmosis/js/main.js?ver=3.5.3

js maliaras.gr collected 2026-10-08 23:03:22 UTC 77,384 bytes, 2,303 lines download raw bytes

1var locationOnLoad = false;
2
3(function($) {
4
5	'use strict';
6
7	//////////////////////////////////////////////////////////////////////////////////////////////////////
8	// HEADER
9	//////////////////////////////////////////////////////////////////////////////////////////////////////
10	var headerSettings = {
11
12		selector   : '#grve-inner-header',
13		header     : '#grve-header',
14		container  : '#grve-inner-header .grve-container',
15
16		init: function(){
17			if(!$(this.header).length) {
18				return;
19			}
20			// Add Helper wrapper for sticky header.
21			var $selector = $(this.selector);
22			$selector.wrap('<div id="grve-header-wrapper"></div>');
23			$selector.css({ 'top' : 0 });
24			headerSettings.stickyHeader();
25
26			// Fixed Header integration with top bar
27			headerSettings.fixedHeader();
28			$(window).smartresize( function() {
29				headerSettings.fixedHeader();
30			});
31		},
32		stickyHeader: function(){
33			var $selector        = $(this.selector),
34				innerHeight      = $selector.height(),
35				stickyStyle      = $(this.header).attr('data-sticky-header'),
36				headerOffset     = $(this.header).hasClass('grve-logo-top') ? $('.grve-bottom-header').offset().top : $selector.offset().top,
37				logoOnTop        = $(this.header).hasClass('grve-logo-top') ? true : false,
38				safeButtonHeight = $selector.find('.grve-open-button').outerHeight();
39			// General Setting
40			if( stickyStyle != 'none' && !logoOnTop ) {
41				if( headerOffset === 0 ) {
42					$selector.css({ 'position' : 'fixed', 'top' : 0 });
43				}
44				$(window).on('scroll', function() {
45					headerSettings.stickySettings( headerOffset, stickyStyle );
46					if( stickyStyle == 'shrink' ) {
47						headerSettings.shrinkSettings( innerHeight, headerOffset, safeButtonHeight );
48					}
49				});
50			}
51			if( logoOnTop && stickyStyle == 'simply' ){
52				$(window).on('scroll', function() {
53					headerSettings.logoOnTopSticky( headerOffset );
54				});
55			}
56		},
57		stickySettings: function( headerOffset, stickyStyle ){
58			var scroll      = $(window).scrollTop(),
59				$selector   = $(this.selector),
60				$header     = $(this.header),
61				$container  = $(this.container),
62				windowWidth = $(window).width();
63
64			if( scroll > headerOffset ){
65				$header.addClass('grve-header-sticky');
66				$selector.css({ 'position' : 'fixed', 'top' : wpBarHeight });
67			} else {
68				$header.removeClass('grve-header-sticky');
69				if( headerOffset > 0 ) {
70					$selector.css({ 'position' : 'absolute', 'top' : 0 });
71				}
72			}
73		},
74		shrinkSettings: function( innerHeight, headerOffset, safeButtonHeight ){
75			var scroll     = $(window).scrollTop(),
76				$selector  = $(this.selector);
77			if( scroll > headerOffset + innerHeight *4 ) {
78				$selector.css({ 'height' : innerHeight/2, 'line-height' : innerHeight/2 + 'px' });
79				$selector.find('h1.grve-logo img').css({ 'max-height' : innerHeight/2});
80				if( safeButtonHeight > innerHeight/2 ) {
81					$selector.find('.grve-open-button').css({ 'height' : innerHeight/2, 'line-height' : innerHeight/2 + 'px' });
82				}
83			} else {
84				$selector.css({ 'height' : innerHeight, 'line-height' : innerHeight + 'px' });
85				$selector.find('h1.grve-logo img').css({ 'max-height' : innerHeight});
86				if( safeButtonHeight > innerHeight/2 ) {
87					$selector.find('.grve-open-button').css({ 'height' : safeButtonHeight, 'line-height' : safeButtonHeight + 'px' });
88				}
89			}
90		},
91		logoOnTopSticky: function( headerOffset ){
92			var scroll = $(window).scrollTop(),
93				$header     = $(this.header),
94				$headerTop = $('.grve-top-header'),
95				$headerBottom = $('.grve-bottom-header'),
96				$selector   = $(this.selector),
97				windowWidth = $(window).width(),
98				posTop = windowWidth + scrollBarWidth >= tabletPortrait ? - ( $headerTop.height() - wpBarHeight ) : 0.1;
99
100			if( scroll > headerOffset ){
101				$header.addClass('grve-header-sticky');
102				$selector.css({ 'position' : 'fixed', 'top' : posTop });
103			} else {
104				$header.removeClass('grve-header-sticky');
105				$selector.css({ 'position' : '', 'top' : '' });
106			}
107		},
108		fixedHeader: function(){
109			var $header        = $(this.header),
110				$topBar        = $('#grve-top-bar'),
111				integration    = $header.data('overlap'),
112				headerPosition = $header.data('header-position');
113
114			if( $topBar.length && integration == 'yes' && headerPosition == 'above-feature'  ){
115				var topBarHeight = $topBar.outerHeight(),
116					$headerWrapper = $('#grve-header-wrapper');
117
118				$headerWrapper.css('top',topBarHeight);
119			}
120		}
121	};
122	//////////////////////////////////////////////////////////////////////////////////////////////////////
123	// MAIN MENU
124	//////////////////////////////////////////////////////////////////////////////////////////////////////
125	var  mainMenu = {
126
127		menu      : '#grve-main-menu',
128		menuItem  : '#grve-main-menu li',
129
130		init: function() {
131			$(this.menuItem).mouseenter(function() {
132				var itemHover = $(this);
133				// Mega Menu Position
134				mainMenu.menuPosition(itemHover);
135
136				if( itemHover.hasClass('megamenu') ) {
137					itemHover.find( ' > ul ' ).addClass('active');
138				} else {
139					itemHover.find( ' > ul > li > a' ).addClass('active');
140				}
141			});
142			$(this.menuItem).mouseleave(function() {
143				var itemHover = $(this);
144				if( itemHover.hasClass('megamenu') ) {
145					itemHover.find( ' > ul ' ).removeClass('active');
146				} else {
147					itemHover.find( ' > ul > li > a' ).removeClass('active');
148				}
149			});
150			$(this.menuItem).find( ' > a[href="#"]').on('click',function(e){
151				e.preventDefault();
152			});
153			mainMenu.responsiveMenu();
154
155			// Respnsive Menu Style 2
156			mainMenu.responsiveMenuStyle2();
157
158			// Fix Double Click on devices without responsive menu
159			if( isMobile.any() ) {
160				mainMenu.deviceMenu();
161			}
162
163		},
164		menuPosition: function(item){
165			var containerWidth  = $(this.menu).parent().outerWidth(),
166				subMenu         = item.find(' > ul '),
167				subMenuWidth    = subMenu.width(),
168				windowWidth     = $(window).width(),
169				menuPositionX   = item.offset().left;
170			if( (menuPositionX + subMenuWidth) > ( windowWidth - containerWidth )/2 + containerWidth ) {
171				if( item.hasClass('megamenu')) {
172					subMenu.css('left', - ((menuPositionX + subMenuWidth) - (( windowWidth - containerWidth )/2 + containerWidth )) +'px' );
173				} else {
174					subMenu.addClass('grve-position-right');
175				}
176			}
177		},
178		deviceMenu: function(){
179			var $menuItem = $(this.menuItem);
180			$menuItem.bind('touchstart touchend', function(e) {
181				var $item = $(this);
182				$item.siblings().removeClass('open-submenu');
183				if( $item.hasClass('menu-item-has-children') && $item.find('> a').attr('href') != '#' ) {
184					if( !$item.hasClass('open-submenu') ) {
185						if( $item.hasClass('megamenu') ) {
186							$item.find( ' > ul ' ).addClass('active');
187						} else {
188							$item.find( ' > ul > li > a' ).addClass('active');
189						}
190						e.preventDefault();
191						$item.addClass('open-submenu');
192					}
193				}
194			});
195		},
196		responsiveMenu: function(){
197			var menu          = $('#grve-main-menu-responsive'),
198				btnOpenMenu   = $('.grve-menu-button, .grve-responsive-menu-text'),
199				btnCloseMenu  = $('.grve-close-menu-button'),
200				themeWrapper  = $('#grve-theme-wrapper'),
201				menuLinks     = menu.find('a[href*="#"]:not( [href="#"] )');
202
203			btnOpenMenu.click(function(e){
204				e.preventDefault();
205				themeWrapper.toggleClass('grve-slide-left');
206				menu.toggleClass('grve-slide-left');
207			});
208			btnCloseMenu.click(function(e){
209				e.preventDefault();
210				themeWrapper.removeClass('grve-slide-left');
211				menu.removeClass('grve-slide-left');
212				// Close All
213				mainMenu.closeAllChilds();
214			});
215			themeWrapper.click(function(e){
216				if ( !menu.is(e.target) && menu.has(e.target).length === 0 && !btnOpe
216nMenu.is(e.target) && btnOpenMenu.has(e.target).length === 0  ) {
217					themeWrapper.removeClass('grve-slide-left');
218					menu.removeClass('grve-slide-left');
219					// Close All
220					mainMenu.closeAllChilds();
221				}
222			});
223			menuLinks.click(function(e) {
224				setTimeout(function(){
225					themeWrapper.removeClass('grve-slide-left');
226					menu.removeClass('grve-slide-left');
227					// Close All
228					mainMenu.closeAllChilds();
229				}, 1000);
230			});
231		},
232		responsiveMenuStyle2: function(){
233			var $menu = $('#grve-main-menu-responsive');
234			if( !$menu.hasClass('grve-style-2') ){
235				return;
236			}
237			$menu.find('.menu-item-has-children').append('<div class="grve-more-btn"></div>')
238
239			$('.grve-more-btn').on('click',function(){
240				$(this).toggleClass('close').parent().toggleClass('current-menu-item').children('.sub-menu').toggleClass('open');
241			});
242
243			$menu.find('a').on('click', function() {
244				if( ($(this).attr('href') == '#') || ($(this).attr('href') == '') ) {
245					$(this).parent().children('.grve-more-btn').trigger('click');
246				}
247			});
248
249		},
250		closeAllChilds: function(){
251			var $moreButton = $('.grve-more-btn');
252
253			$moreButton.removeClass('close').parent().removeClass('current-menu-item').children('.sub-menu').removeClass('open');
254		}
255	};
256	//////////////////////////////////////////////////////////////////////////////////////////////////////
257	// FEATURE SECTION SETTINGS
258	//////////////////////////////////////////////////////////////////////////////////////////////////////
259	var featureSection = {
260
261		container         : '#grve-feature-section .grve-feature-section-inner',
262		featureItem       : $( '#grve-feature-section .grve-feature-section-inner' ).attr('data-item'),
263		fullScreenMode    : $('#grve-header').attr('data-fullscreen'),
264
265		init: function(){
266			if( this.featureItem == 'image' || this.featureItem == 'slider' || this.featureItem == 'video' ) {
267				featureSection.featureImageLoad();
268			}
269			if( this.fullScreenMode == 'yes' ){
270				featureSection.fullScreen();
271				$(window).smartresize( function() {
272					featureSection.fullScreen();
273				});
274			} else {
275				featureSection.customSize();
276			}
277			$("#grve-feature-goto.grve-custom-color").css("color",$("#grve-feature-goto.grve-custom-color").attr("data-custom-color"));
278		},
279		fullScreen: function(){
280			var windowHeight    = $(window).height(),
281				headerHeight    = $('#grve-header').attr('data-overlap') == 'yes' ? 0 : $('#grve-inner-header').height(),
282				topBarHeight    = $('#grve-header').attr( 'data-topbar' ) == 'yes' ? $('#grve-top-bar').height() : 0,
283				$section        = $(this.container);
284			if( isMobile.any() &&  window.location !== window.parent.location ) {
285				windowHeight  = window.screen.height;
286			}
287			var sectionHeight = windowHeight - headerHeight - wpBarHeight - topBarHeight;
288			$section.css({ 'height' : sectionHeight });
289			$section.parent().css({ 'height' : sectionHeight });
290			if( this.featureItem == 'slider' ) {
291				$section.find('.grve-slider-item ').css({ 'height' : sectionHeight });
292			}
293			if( this.featureItem == 'map' ) {
294				$section.find('.grve-map ').css({ 'height' : sectionHeight });
295			}
296			if( this.featureItem == 'video' ) {
297				// Add Animation Class
298				$(featureSection.container).addClass('grve-animated');
299				videoResize.init( { selector : $section.find('.grve-bg-video'), container : $section } );
300				$(window).smartresize( function() {
301					videoResize.init( { selector : $section.find('.grve-bg-video'), container : $section } );
302				});
303			}
304			if(this.featureItem == 'title') {
305				// Add Animation Class
306				$(featureSection.container).addClass('grve-animated');
307			}
308		},
309		customSize: function(){
310			var $section       = $(this.container),
311				customHeight   = $section.attr('data-height');
312			featureSection.resizeFeature( $section, customHeight );
313			$(window).smartresize( function() {
314				featureSection.resizeFeature( $section, customHeight );
315			});
316			if(this.featureItem == 'title') {
317				// Add Animation Class
318				$(featureSection.container).addClass('grve-animated');
319			}
320			if(this.featureItem == 'video') {
321				// Add Animation Class
322				$(featureSection.container).addClass('grve-animated');
323			}
324		},
325		resizeFeature: function( section, customHeight ){
326			if( $(window).width() >= 1200 ) {
327				section.css({ 'height' : customHeight });
328				section.parent().css({ 'height' : customHeight });
329				if( this.featureItem == 'slider' ) {
330					section.find('.grve-slider-item ').css({ 'height' : customHeight });
331				}
332				if( this.featureItem == 'map' ) {
333					section.find('.grve-map ').css({ 'height' : customHeight });
334				}
335			} else {
336				var ratio          = customHeight / 1200,
337					resizeHeight   = parseInt($(window).width() * ratio);
338				section.css({ 'height' : resizeHeight });
339				section.parent().css({ 'height' : resizeHeight });
340				if( this.featureItem == 'slider' ) {
341					section.find('.grve-slider-item ').css({ 'height' : resizeHeight });
342				}
343				if( this.featureItem == 'map' ) {
344					section.find('.grve-map ').css({ 'height' : resizeHeight });
345				}
346			}
347		},
348		featureImageLoad: function(){
349			var $bgImage       = $(this.container).find('.grve-bg-image'),
350				totalBgImage   = $bgImage.length;
351			if (!totalBgImage) {
352				return;
353			}
354			var waitImgDone = function() {
355				totalBgImage--;
356				if (!totalBgImage) {
357					if( $(featureSection.container).find( '.grve-slider').length ) {
358						featureSlider.init();
359					} else {
360						$bgImage.addClass('show');
361						// Add Animation Class
362						$(featureSection.container).addClass('grve-animated');
363
364						// Zoom Image Effect
365						if( $(featureSection.container).data('bg-effect') == 'zoom') {
366							sectionSettings.animatedBg( $(featureSection.container) );
367						}
368					}
369				}
370			};
371			$bgImage.each(function () {
372				function imageUrl(input) {
373					return input.replace(/"/g,"").replace(/url\(|\)$/ig, "");
374				}
375				var image = new Image(),
376					$that = $(this);
377				image.src = imageUrl($that.css('background-image'));
378				$(image).load(waitImgDone).error(waitImgDone);
379			});
380		}
381	};
382	//////////////////////////////////////////////////////////////////////////////////////////////////////
383	// FEATURE SLIDER
384	//////////////////////////////////////////////////////////////////////////////////////////////////////
385	var featureSlider = {
386		init: function(){
387			var owl             = $('#grve-feature-slider'),
388				sliderItem      = owl.find('.grve-slider-item '),
389				sliderSpeed     = ( parseInt( owl.attr('data-slider-speed') ) ) ? parseInt( owl.attr('data-slider-speed') ) : 3500,
390				pauseHover      = owl.attr('data-slider-pause') == 'yes' ? true : '',
391				transition      = owl.attr('data-slider-transition') != 'slide' ? owl.attr('data-slider-transition') : false;
392			// Init Slider
393			owl.owlCarousel({
394				navigation      : false,
395				pagination      : false,
396				autoHeight      : false,
397				slideSpeed      : 400,
398				paginationSpeed : 400,
399				afterAction     : featureSlider.afterAction,
400				singleItem      : true,
401				autoPlay        : true,
402				stopOnHover     : pauseHover,
403				baseClass       : 'grve-slider',
404				theme           : 'grve-slider-style',
405				transitionStyle : transition
406			});
407			owl.trigger('owl.play',sliderSpeed);
408			// Slider Navigation
409			owl.parent().find('.grve-carousel-next').click(function(){
410				owl.trigger('owl.next');
411			});
412			owl.parent().find('.grve-carousel-prev').click(function(){
413				owl.trigger('owl.prev');
414			});
415			sliderItem.find('.grve-bg-image').addClass('show');
416			$(window).on('scroll', function() {
417				var $scroll = $(window).scrollTop();
418				if( $scroll > 10 ){
419					owl.trigger('owl.stop');//Stop Carousel
420				} else {
421					owl.trigger('owl.play',sliderSpeed);//Play Carousel
422				}
423			});
424
425			if ( !Modernizr.csstransforms3d ) {
426				sliderItem.find('.grve-bg-image').css({ 'width' : $(window).width() });
427				$(window).smartresize( function() {
428					sliderItem.find('.grve-bg-image').css({ 'width' : $(window).width() });
429				});
430			}
431		},
432		afterAction: function(){
433			var currentSlide     = this.$owlItems.eq(this.currentItem),
434				sliderColor      = currentSlide.find('.grve-slider-item').attr('data-style'),
435				color            = 'grve-' + sliderColor,
436				sliderTitleColor = currentSlide.find('.grve-slider-item').attr('data-title-color'),
437				titleColor       = 'grve-' + sliderTitleColor;
438
439			// Add Animation Class
440			if ( !Modernizr.csstransforms3d ) {
441				currentSlide.fadeIn('slow').addClass('grve-animated').siblings().hide().removeClass('grve-animated');
442			} else {
443				currentSlide.addClass('grve-animated').siblings().removeClass('grve-animated');
444			}
445			// Set Header Color
446			$('#grve-header').removeClass('grve-default grve-light grve-dark').addClass(color);
447			//Set GoTo Color
448			$('#grve-feature-goto').removeClass('grve-primary-1 grve-primary-2 grve-primary-3 grve-primary-4 grve-primary-5 grve-default grve-light grve-dark').addClass(titleColor);
449
450		}
451	};
452	//////////////////////////////////////////////////////////////////////////////////////////////////////
453	// VIDEO RESIZE
454	//////////////////////////////////////////////////////////////////////////////////////////////////////
455	var videoResize = {
456		init: function(settings){
457
458			videoResize.config = {
459				selector   : '.grve-section .grve-bg-video',
460				container  : '.grve-section'
461			},
462
463			// allow overriding the default config
464			$.extend(videoResize.config, settings);
465
466			var $video            = $(videoResize.config.selector).find('video'),
467				videoWidth        = $video.width(),
468				videoHeight       = $video.height(),
469				containerWidth    = $(videoResize.config.container).outerWidth(),
470				containerHeight   = $(videoResize.config.container).outerHeight(),
471				newSize           = videoResize.settings( containerWidth, containerHeight, videoWidth, videoHeight );
472
473			$video.width(newSize.newWidth).height(newSize.newHeight);
474		},
475		settings: function( containerWidth, containerHeight, videoWidth, videoHeight ){
476			var initW = videoWidth,
477				initH = videoHeight,
478				ratio = initH / initW;
479			videoWidth   = containerWidth;
480			videoHeight  = containerWidth * ratio;
481			if(videoHeight < containerHeight){
482				videoHeight  = containerHeight;
483				videoWidth   = videoHeight / ratio;
484			}
485			return {
486				newWidth: parseInt(videoWidth),
487				newHeight: parseInt(videoHeight)
488			};
489		}
490	};
491	//////////////////////////////////////////////////////////////////////////////////////////////////////
492	// SECTION SETTINGS
493	//////////////////////////////////////////////////////////////////////////////////////////////////////
494	var sectionSettings = {
495
496		config : {
497			section       : '#grve-main-content .grve-section',
498			parentSection : '#grve-content-area, #grve-post-area, #grve-portfolio-area'
499		},
500
501		init: function(){
502
503			$(sectionSettings.config.section).each(function(){
504				var $section      = $(this),
505					heightMode    = $section.attr('data-full-height'),
506					sectionType   = $section.attr('data-section-type'),
507					bgImageType   = $section.attr('data-image-type');
508
509				if( $section.parent().parent().is('.grve-blog-item') ) {
510					$section.css({ 'visibility': 'visible' });
511					return;
512				}
513				if( sectionType == 'fullwidth-background' ){
514					sectionSettings.fullBg($section);
515					$(window).smartresize( function() {
516						sectionSettings.fullBg($section);
517					});
518				}
519				if( sectionType == 'fullwidth-element' ){
520					sectionSettings.fullElement($section);
521					$(window).smartresize( function() {
522						sectionSettings.fullElement($section);
523					});
524				}
525				if( heightMode == 'yes' ) {
526					sectionSettings.fullHeight($section);
527					$(window).smartresize( function() {
528						sectionSettings.fullHeight($section);
529					});
530				}
531				if( bgImageType == 'animated' && !isMobile.any() ) {
532					sectionSettings.animatedBg($section);
533				}
534
535			});
536
537		},
538		fullBg: function(section){
539			var windowWidth      = $(window).width(),
540				contentWidth     = $(sectionSettings.config.parentSection).outerWidth(),
541				sidebarWidth     = $('#grve-sidebar').length && ( windowWidth + scrollBarWidth >= 1024 ) ? $('#grve-sidebar').outerWidth() : 0,
542				conteinerWidth   = contentWidth + sidebarWidth,
543				space            = (windowWidth - conteinerWidth)/2,
544				sidebarSpace     = windowWidth - contentWidth;
545			if( $('.grve-right-sidebar').length && ( windowWidth + scrollBarWidth >= 1024 ) ) {
546				section.css({ 'visibility': 'visible', 'padding-left':space, 'padding-right': sidebarSpace, 'margin-left': -space, 'margin-right': -sidebarSpace});
547			}
548			else if( $('.grve-left-sidebar').length && ( windowWidth + scrollBarWidth >= 1024 ) ) {
549				section.css({ 'visibility': 'visible', 'padding-left':sidebarSpace, 'padding-right': space, 'margin-left': -sidebarSpace, 'margin-right': -space});
550			} else {
551				section.css({ 'visibility': 'visible', 'padding-left':space, 'padding-right': space, 'margin-left': -space, 'margin-right': -space});
552			}
553		},
554		fullElement: function(section){
555			var windowWidth      = $(window).width(),
556				contentWidth     = $(sectionSettings.config.parentSection).outerWidth(),
557				sidebarWidth     = $('#grve-sidebar').length && ( windowWidth + scrollBarWidth >= 1024 ) ? $('#grve-sidebar').outerWidth() : 0,
558				conteinerWidth   = contentWidth + sidebarWidth,
559				space            = (windowWidth - conteinerWidth)/2,
560				sidebarSpace     = windowWidth - contentWidth;
561			if( $('.grve-right-sidebar').length && ( windowWidth + scrollBarWidth >= 1024 ) ) {
562				section.css({ 'visibility': 'visible', 'padding-left':0, 'padding-right': sidebarSpace, 'margin-left': -space, 'margin-right': -sidebarSpace});
563			}
564			else if( $('.grve-left-sidebar').length && ( windowWidth + scrollBarWidth >= 1024 ) ) {
565				section.css({ 'visibility': 'visible', 'padding-left':sidebarSpace, 'padding-right': 0, 'margin-left': -sidebarSpace, 'margin-right': -space});
566			} else {
567				section.css({ 'visibility': 'visible', 'padding-left':0, 'padding-right': 0, 'margin-left': -space, 'margin-right': -space});
568			}
569		},
570		fullHeight: function(section){
571			var windowHeight    = $(window).height(),
572				headerHeight    = $('#grve-header').attr('data-sticky-header') != 'none' ? $('#grve-inner-header').outerHeight() : 0,
573				fieldBarHeight  = $('.grve-fields-bar').length ? $('.grve-fields-bar').outerHeight() : 0,
574				sectionHeight   = section.find('.grve-row').outerHeight(),
575				space           = (windowHeight - headerHeight - fieldBarHeight - sectionHeight)/2;
576			section.css({ 'visibility': 'visible',  'padding-top' : 0, 'padding-bottom' : 0});
577			if(sectionHeight > (windowHeight - headerHeight)){
578				section.css({ 'visibility': 'visible', 'padding-top':40, 'padding-bottom': 40});
579			} else {
580				section.css({ 'visibility': 'visible', 'padding-top':space, 'padding-bottom': space});
581			}
582		},
583		animatedBg: function(section){
584			section.mouseenter(function() {
585				section.addClass('zoom');
586			});
587			section.mouseleave(function() {
588				section.removeClass('zoom');
589			});
590		}
591	};
592	//////////////////////////////////////////////////////////////////////////////////////////////////////
593	// CONTENT SETTINGS
594	//////////////////////////////////////////////////////////////////////////////////////////////////////
595	var pageSettings = {
596		init: function() {
597
598			// HOVERS
599			pageSettings.hovers();
600
601			// BACKGROUND LOAD
602			pageSettings.bgLoader();
603
604			// LIGHT BOX
605			pageSettings.lightBox();
606
607			// Social Share
608			pageSettings.socialShareLinks();
609
610			// Animation Title
611			pageSettings.titleAnimation();
612
613			// Fit Video
614			pageSettings.fitVid();
615
616			// Resize Page, Post, Portfolio Title
617			pageSettings.resizeTitle();
618
619			// Anchor Bar
620			pageSettings.anchorBar();
621
622			// Back to top
623			pageSettings.backtoTop();
624
625			// Goto Section
626			pageSettings.gotoFirstSection();
627
628			// Sticky Sidebar
629			pageSettings.stickySidebar();
630
631			// Footer Settings
632			pageSettings.footerSettings();
633
634			// Grve Pop up
635			pageSettings.grvePopup();
636
637			// Image Load
638			pageSettings.imageLoader();
639
640			// Pie Chart
641			pageSettings.pieChart();
642
643		},
644		hovers: function(){
645			var hoverItem = $('.grve-image-hover');
646			if ( !isMobile.any() ) {
647				hoverItem.unbind('click');
648				hoverItem.unbind('mouseenter mouseleave').bind('mouseenter mouseleave', function() {
649					$(this).toggleClass('hover');
650				});
651			} else {
652				hoverItem.unbind('mouseenter mouseleave');
653				hoverItem.unbind('click').bind('click', function() {
654					hoverItem.removeClass('hover');
655					$(this).toggleClass('hover');
656				});
657			}
658		},
659		bgLoader: function() {
660			$('#grve-main-content .grve-bg-image, #grve-footer .grve-bg-image').each(function () {
661				function imageUrl(input) {
662					return input.replace(/"/g,"").replace(/url\(|\)$/ig, "");
663				}
664				var image = new Image(),
665					$that = $(this);
666				image.src = imageUrl($that.css('background-image'));
667				image.onload = function () {
668					$that.addClass('show');
669				};
670			});
671		},
672		lightBox: function(){
673			//IMAGE
674			$('.grve-image-popup').each(function() {
675				$(this).magnificPopup({
676					type: 'image',
677					preloader: false,
678					fixedBgPos: true,
679					fixedContentPos: true,
680					removalDelay: 200,
681					callbacks: {
682						beforeOpen: function() {
683							var mfpWrap = this.wrap;
684							this.bgOverlay.fadeIn(200);
685							pageSettings.addSpinner( mfpWrap );
686						},
687						imageLoadComplete: function() {
688							var $spinner = this.wrap.find('.grve-loader'),
689								$content = this.container;
690							pageSettings.removeSpinner( $spinner, $content );
691
692						},
693						beforeClose: function() {
694							this.wrap.fadeOut(100);
695							this.bgOverlay.fadeOut(100);
696						},
697					},
698					image: {
699						verticalFit: true,
700						titleSrc: function(item) {
701							var title   = item.el.data( 'title' ) ? item.el.data( 'title' ) : '',
702								caption = item.el.data('desc') ? '<br><small>' + item.el.data('desc') + '</small>' : '';
703							if ( '' == title ) {
704								title   = item.el.find('.grve-title').html() ? item.el.find('.grve-title').html() : '';
705							}
706							if ( '' == caption ) {
707								caption = item.el.find('.grve-caption').html() ? '<br><small>' + item.el.find('.grve-caption').html() + '</small>' : '';
708							}
709							return title + caption;
710						}
711					}
712				});
713			});
714			$('.grve-gallery-popup, .grve-post-gallery-popup').each(function() {
715				$(this).magnificPopup({
716					delegate: 'a',
717					type: 'image',
718					preloader: false,
719					fixedBgPos: true,
720					fixedContentPos: true,
721					removalDelay: 200,
722					callbacks: {
723						beforeOpen: function() {
724							var mfpWrap = this.wrap;
725							this.bgOverlay.fadeIn(200);
726							pageSettings.addSpinner( mfpWrap );
727						},
728						imageLoadComplete: function() {
729							var $spinner = this.wrap.find('.grve-loader'),
730								$content = this.container;
731							pageSettings.removeSpinner( $spinner, $content );
732
733						},
734						beforeClose: function() {
735							this.wrap.fadeOut(100);
736							this.bgOverlay.fadeOut(100);
737						},
738					},
739					gallery: {
740						enabled:true
741					},
742					image: {
743						tError: '<a href="%url%">The image #%curr%</a> could not be loaded.',
744						titleSrc: function(item) {
745							var title   = item.el.data( 'title' ) ? item.el.data( 'title' ) : '',
746								caption = item.el.data('desc') ? '<br><small>' + item.el.data('desc') + '</small>' : '';
747							if ( '' == title ) {
748								title   = item.el.find('.grve-title').html() ? item.el.find('.grve-title').html() : '';
749							}
750							if ( '' == caption ) {
751								caption = item.el.find('.grve-caption').html() ? '<br><small>' + item.el.find('.grve-caption').html() + '</small>' : '';
752							}
753							return title + caption;
754						}
755					}
756				});
757			});
758
759			if( 1 == grve_main_data.grve_wp_gallery_popup ) {
760				$('.gallery').each(function() {
761					$(this).magnificPopup({
762						delegate: 'a',
763						type: 'image',
764						preloader: false,
765						fixedBgPos: true,
766						fixedContentPos: true,
767						removalDelay: 200,
768						callbacks: {
769							beforeOpen: function() {
770								var mfpWrap = this.wrap;
771								this.bgOverlay.fadeIn(200);
772								pageSettings.addSpinner( mfpWrap );
773							},
774							imageLoadComplete: function() {
775								var $spinner = this.wrap.find('.grve-loader'),
776									$content = this.container;
777								pageSettings.removeSpinner( $spinner, $content );
778
779							},
780							beforeClose: function() {
781								this.wrap.fadeOut(100);
782								this.bgOverlay.fadeOut(100);
783							},
784						},
785						gallery: {
786							enabled:true
787						},
788						image: {
789							tError: '<a href="%url%">The image #%curr%</a> could not be loaded.',
790							titleSrc: function(item) {
791								var title   = item.el.closest('.gallery-item').find('.gallery-caption').html() ? item.el.closest('.gallery-item').find('.gallery-caption').html() : '';
792								return title;
793							}
794						}
795					});
796				});
797			}
798			//VIDEOS
799			$('.grve-youtube-popup, .grve-vimeo-popup, .grve-video-popup, .grve-page-popup').each(function() {
800				$(this).magnificPopup({
801					disableOn: 0,
802					type: 'iframe',
803					preloader: false,
804					fixedBgPos: true,
805					fixedContentPos: true,
806					removalDelay: 200,
807					callbacks: {
808						beforeOpen: function() {
809							var mfpWrap = this.wrap;
810							this.bgOverlay.fadeIn(200);
811							pageSettings.addSpinner( mfpWrap );
812						},
813						open: function() {
814							var $spinner = this.wrap.find('.grve-loader'),
815								$content = this.container;
816							pageSettings.removeSpinner( $spinner, $content );
817						},
818						beforeClose: function() {
819							this.wrap.fadeOut(100);
820							this.bgOverlay.fadeOut(100);
821						},
822					}
823				});
824			});
825		},
826		addSpinner: function( mfpWrap ){
827			var spinner = '<div class="grve-loader"></div>';
828			$(spinner).appendTo( mfpWrap );
829		},
830		removeSpinner: function( spinner, content){
831			setTimeout(function(){
832				spinner.fadeOut(1000, function(){
833					content.animate({'opacity':1},600);
834				});
835			}, 700);
836		},
837		socialShareLinks: function(){
838			$('.grve-social-share-facebook').click(function (e) {
839				e.preventDefault();
840				window.open( 'https://www.fac
840ebook.com/sharer/sharer.php?u=' + $(this).attr('href'), "facebookWindow", "height=380,width=660,resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=0" );
841				return false;
842			});
843			$('.grve-social-share-twitter').click(function (e) {
844				e.preventDefault();
845				window.open( 'http://twitter.com/intent/tweet?text=' + encodeURIComponent( $(this).attr('title') ) + ' ' + $(this).attr('href'), "twitterWindow", "height=450,width=660,resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=0" );
846				return false;
847			});
848			$('.grve-social-share-linkedin').click(function (e) {
849				e.preventDefault();
850				window.open( 'http://www.linkedin.com/shareArticle?mini=true&url=' + $(this).attr('href') + '&title=' + encodeURIComponent( $(this).attr('title') ), "linkedinWindow", "height=500,width=820,resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=0" );
851				return false;
852			});
853			$('.grve-social-share-googleplus').click(function (e) {
854				e.preventDefault();
855				window.open( 'https://plus.google.com/share?url=' + $(this).attr('href'), "googleplusWindow", "height=600,width=600,resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=0" );
856				return false;
857			});
858			$('.grve-social-share-pinterest').click(function (e) {
859				e.preventDefault();
860				window.open( 'http://pinterest.com/pin/create/button/?url=' + $(this).attr('href') + '&media=' + $(this).data('pin-img') + '&description=' + encodeURIComponent( $(this).attr('title') ), "pinterestWindow", "height=600,width=600,resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=0" );
861				return false;
862			});
863			$('.grve-social-share-reddit').click(function (e) {
864				e.preventDefault();
865				window.open( '//www.reddit.com/submit?url=' + $(this).attr('href'), "redditWindow", "height=600,width=820,resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=0" );
866				return false;
867			});
868			$('.grve-like-counter-link').click(function (e) {
869				e.preventDefault();
870				var link = $(this);
871				var id = link.data('post-id'),
872					counter = link.parent().find('.grve-like-counter');
873
874				var ajaxurl = grve_main_data.ajaxurl;
875
876				$.ajax({type: 'POST', url: ajaxurl, data: 'action=grve_likes_callback&grve_likes_id=' + id, success: function(result) {
877					counter.html(result);
878				}});
879				return false;
880			});
881		},
882		postSocials: function(){
883			var $selector = $('#grve-post-title #grve-social-share');
884			if(!$selector.length || isMobile.any()) {
885				return;
886			}
887			stickyItems.init({ element : $selector, offset : 10 });
888			$(window).scroll(function(){
889				var socialTop     = $selector.offset().top,
890					fieldsBarTop  = $('.grve-fields-bar').offset().top;
891				if( socialTop ==  fieldsBarTop + 10 ) {
892					$selector.addClass('in-bar');
893				} else {
894					$selector.removeClass('in-bar');
895				}
896			});
897		},
898		titleAnimation: function(){
899			var titleContainer = $('#grve-page-title, #grve-post-title, #grve-portfolio-title, #grve-product-title');
900			titleContainer.find('.grve-container').addClass('grve-animated');
901		},
902		fitVid: function(){
903			$('.grve-video, .grve-media').fitVids();
904			$('iframe[src*="youtube"]').parent().fitVids();
905			$('iframe[src*="vimeo"]').parent().fitVids();
906		},
907		// No Parallax video
908		sectionBgVideo: function(){
909			var section = '.grve-bg-video.grve-bg-no-parallax';
910			videoResize.init( { selector : section, container : section } );
911			$(window).smartresize( function() {
912				videoResize.init( { selector : section, container : section } );
913			});
914		},
915		resizeTitle: function(){
916			var titleContainer =  $(' #grve-page-title-content');
917			if( $('#grve-post-title').length ) {
918				titleContainer =  $(' #grve-post-title-content');
919			}
920			if( $('#grve-portfolio-title').length ) {
921				titleContainer =  $(' #grve-portfolio-title-content');
922			}
923			if( $('#grve-product-title').length ) {
924				titleContainer =  $(' #grve-product-title-content');
925			}
926			if( titleContainer.length ) {
927				featureSection.resizeFeature( titleContainer, titleContainer.attr('data-height') );
928				$(window).smartresize( function() {
929					featureSection.resizeFeature( titleContainer, titleContainer.attr('data-height') );
930				});
931			}
932		},
933		anchorBar: function(){
934			var $selector   = $('#grve-anchor-menu'),
935				$section       = $('#grve-main-content .grve-section[id]'),
936				headerHeight   = 0,
937				fieldBarHeight = $('.grve-fields-bar').length ? $('.grve-fields-bar').outerHeight() : 0,
938				$menu       = $selector.find('ul'),
939				$menuIcon   = $selector.find('.grve-icon-menu');
940
941			if( $('#grve-header').data('sticky-header') != 'none' ){
942				if( $('#grve-header').hasClass('grve-logo-top') ) {
943					headerHeight = $('.grve-bottom-header').outerHeight();
944				} else {
945					headerHeight = $('#grve-inner-header').outerHeight();
946				}
947			}
948
949			var offsetTop = headerHeight + fieldBarHeight + wpBarHeight;
950
951			if(!$selector.length) {
952				return;
953			}
954			pageSettings.anchorBarUpdate( $selector, $menu );
955			$(window).smartresize( function() {
956				pageSettings.anchorBarUpdate( $selector, $menu );
957			});
958			$menuIcon.click(function(){
959				$menu.slideToggle(100);
960			});
961
962			$(window).on("scroll", function() {
963				if(!$selector.hasClass('grve-current-link')) {
964					return;
965				}
966
967				var scroll = $(window).scrollTop();
968
969				$section.each(function(){
970					var $that         = $(this),
971						currentId     = $that.attr('id'),
972						sectionOffset = $that.offset().top - offsetTop -1;
973
974					if (sectionOffset <= scroll && sectionOffset + $that.outerHeight() > scroll ) {
975						$('#grve-anchor-menu a[href*="#' + currentId + '"]').parent().addClass('current');
976					}
977					else{
978						$('#grve-anchor-menu a[href*="#' + currentId + '"]').parent().removeClass("current");
979					}
980
981				});
982			});
983		},
984		anchorBarUpdate: function( selector, menu ){
985			var $selector   = selector,
986				$menu       = menu,
987				menuWidth   = $menu.outerWidth(),
988				windowWidth = $(window).width();
989			if( menuWidth >= windowWidth ) {
990				$selector.addClass('grve-responsive-bar');
991				$menu.css('display', 'none');
992			}
993		},
994		backtoTop: function() {
995			var selectors  = {
996				topBtn     : '.grve-top-btn',
997				dividerBtn : '.grve-divider-backtotop',
998				topLink    : 'a[href="#grve-goto-header"]'
999			}
1000			// Show backtoTop Button
1001			if( $('#grve-header').attr('data-backtotop') != 'no' ) {
1002				var btnUp = $('<div/>', {'class':'grve-top-btn grve-icon-nav-up'});
1003					btnUp.appendTo('#grve-theme-wrapper');
1004
1005				$(window).on('scroll', function() {
1006					if ($(this).scrollTop() > 600) {
1007						$('.grve-top-btn').addClass('show');
1008					} else {
1009						$('.grve-top-btn').removeClass('show');
1010					}
1011				});
1012			}
1013			$.each(selectors, function(key, value){
1014				$(value).on('click', function(){
1015					$('html, body').animate({scrollTop: 0}, 900);
1016				});
1017			});
1018
1019		},
1020		gotoFirstSection: function(){
1021			var $selector    = $('#grve-feature-section .grve-goto-section'),
1022				$nextSection    = $('#grve-main-content .grve-section').first().length ? $('#grve-main-content .grve-section').first() : $('#grve-main-content'),
1023				topOffset       = 0,
1024				fieldBarHeight  = $('.grve-fields-bar').length ? $('.grve-fields-bar').outerHeight() : 0;
1025
1026			if( !isMobile.any() &&  $('#grve-header').data('sticky-header') != 'none' ){
1027				if( $('#grve-header').hasClass('grve-logo-top') ) {
1028					topOffset = $('.grve-bottom-header').outerHeight();
1029				} else {
1030					topOffset = $('#grve-inner-header').outerHeight();
1031				}
1032			}
1033
1034			if( $nextSection.length ) {
1035				$selector.on('click',function(){
1036					$('html,body').animate({
1037						scrollTop: $nextSection.offset().top - topOffset - fieldBarHeight
1038					}, 1000);
1039					return false;
1040				});
1041			}
1042		},
1043		stickySidebar: function(){
1044			var $item    = $('#grve-sidebar.grve-fixed-sidebar'),
1045				$content = $('#grve-content-area, #grve-post-area, #grve-portfolio-area');
1046			if( !$item.length ) {
1047				return;
1048			}
1049			var itemId          = $item.attr('id'),
1050				itemHeight      = $item.outerHeight(),
1051				itemWidth       = $item.outerWidth() - 1,
1052				itemFloat       = $item.css('float'),
1053				headerHeight    = $('#grve-inner-header').outerHeight(),
1054				titleHeight     = $('#grve-page-title').length ? $('#grve-page-title').outerHeight() : 0,
1055				fieldBarHeight  = $('.grve-fields-bar').length ? $('.grve-fields-bar').outerHeight() : 0,
1056				topBarHeight    = $('#grve-top-bar').length ? $('#grve-top-bar').outerHeight() : 0,
1057				offset          = headerHeight + fieldBarHeight + 30,
1058				windowHeight    = $(window).height();
1059			if( itemHeight > windowHeight || isMobile.any() ) {
1060				return false;
1061			}
1062			// Create A Helper Wrapper
1063			$item.wrap('<div id="' + itemId + '-wrapper"></div>' );
1064			$item.parent().css({
1065				'width'    : itemWidth,
1066				'height'   : itemHeight,
1067				'float'    : itemFloat,
1068				'position' : 'relative'
1069			});
1070			$item.css({
1071				'width'    : itemWidth,
1072				'position' : 'static'
1073			});
1074			$(window).on('scroll', function() {
1075				var contentHeight = $content.outerHeight(),
1076					contentTop    = $content.offset().top,
1077					contentBottom = contentTop + contentHeight;
1078				if( ( $(window).scrollTop() > contentTop - offset ) && ( $(window).scrollTop() < contentBottom - ( offset + itemHeight ) )){
1079					$item.css({'position':'fixed', 'width' : itemWidth, 'top': offset });
1080				}
1081				else if( $(window).scrollTop() > contentTop ){
1082					$item.css({'position':'absolute', 'top': contentHeight - itemHeight });
1083				}
1084				else if( $(window).scrollTop() < contentTop ){
1085					$item.css({'position':'static', 'top':'auto' });
1086				}
1087			});
1088		},
1089		footerSettings: function() {
1090			$('#grve-footer .grve-section').each(function(){
1091				var $that = $(this),
1092					sectionType = $that.attr('data-section-type');
1093				if( sectionType == 'fullwidth-background' ){
1094					pageSettings.footerFullBg($that);
1095					$(window).smartresize( function() {
1096						pageSettings.footerFullBg($that);
1097					});
1098				}
1099				if( sectionType == 'fullwidth-element' ){
1100					pageSettings.footerFullElement($that);
1101					$(window).smartresize( function() {
1102						pageSettings.footerFullElement($that);
1103					});
1104				}
1105			});
1106		},
1107		footerFullBg: function(element){
1108			var windowWidth    = $(window).width(),
1109				contentWidth   = element.parent().width(),
1110				space          = (windowWidth - contentWidth)/2;
1111			element.css({ 'visibility': 'visible', 'padding-left':space, 'padding-right': space, 'margin-left': -space, 'margin-right': -space});
1112		},
1113		footerFullElement: function(element){
1114			var windowWidth   = $(window).width(),
1115				contentWidth  = element.parent().width(),
1116				space         = (windowWidth - contentWidth)/2;
1117			element.css({ 'visibility': 'visible', 'padding-left':0, 'padding-right': 0, 'margin-left': -space, 'margin-right': -space});
1118		},
1119		grvePopup: function(){
1120			var $selector = $('.grve-open-popup-link'),
1121				delay = 0;
1122
1123			$selector.on( "click", function(e){
1124				e.preventDefault();
1125				var target = $(this).attr('href');
1126				if( !$(target).length ){
1127					return;
1128				} else {
1129					if( $(this).parents('#grve-main-menu-responsive').length ) {
1130						delay = 2000;
1131					}
1132					setTimeout(function(){
1133						$(target).addClass('grve-show-modal');
1134						if ( '#grve-search-modal' == target ) {
1135							setTimeout(function(){
1136								$("#grve-search-modal .grve-search-textfield").focus();
1137							},200);
1138						}
1139					},delay);
1140
1141					$('.grve-popup-overlay, .grve-close-modal').on( "click", function(e){
1142						if ( !$(target).is(e.target) ) {
1143							$(target).removeClass('grve-show-modal');
1144						}
1145					});
1146				}
1147			});
1148		},
1149		imageLoader: function(){
1150			var selectors  = {
1151				singleImage  : '.grve-image',
1152				media        : '.grve-media'
1153			}
1154			$.each(selectors, function(key, value){
1155				if( $(this).length ){
1156					var item     = $(this),
1157						imgLoad  = imagesLoaded( item );
1158					imgLoad.on( 'always', function() {
1159						if( $(value).parent().is('#grve-single-media') ){
1160							$(value).find('img').animate({ 'opacity': 1 },1000);
1161						} else {
1162							$(value).find('img').css('opacity', 1);
1163						}
1164					});
1165				}
1166			});
1167		},
1168		removeVideoBg: function(){
1169			var videoBg = $('.grve-bg-video');
1170			if( isMobile.any() ) {
1171				videoBg.remove();
1172			} else {
1173				$('#grve-main-content .grve-bg-image, #grve-feature-section .grve-bg-image').each(function () {
1174					var bgImage = $(this);
1175					var bgVideo = $(this).parent().find('.grve-bg-video');
1176					if ( bgVideo.length ) {
1177						var videoElement = $(this).parent().find('.grve-bg-video video');
1178						var canPlayVideo = false;
1179						$(this).parent().find('.grve-bg-video source').each(function(){
1180							if ( videoElement.get(0).canPlayType( $(this).attr('type') ) ) {
1181								canPlayVideo = true;
1182							}
1183						});
1184						if(canPlayVideo) {
1185							bgImage.remove();
1186						} else {
1187							bgVideo.remove();
1188						}
1189					}
1190				});
1191			}
1192		},
1193		gotoSection: function(){
1194			if( $('#grve-header').data('gotosection') == 'yes' ) {
1195				var $section     = $('#grve-main-content .grve-section[id]'),
1196					$anchorList  = $('<ul id="grve-anchor-list"></ul>'),
1197					$mainContent = $('#grve-main-content');
1198
1199				$anchorList.appendTo( $mainContent );
1200
1201				$section.each(function( i , n){
1202					var $that        = $(this),
1203						sectionId    = $that.attr('id'),
1204						sectionTitle = $that.data('section-title').length ? '<span>' + $that.data('section-title') + '</span>' : '',
1205						$anchorItem  = $('<li data-anclink="' + sectionId + '">' + sectionTitle + '</li>')
1206
1207					$anchorItem.appendTo('#grve-anchor-list');
1208				});
1209				// Show or Hide Go to Section
1210				pageSettings.showHideGoTo();
1211
1212				var $listItem = $('#grve-anchor-list li');
1213				$listItem.click(function(){
1214					var headerHeight = 0,
1215						fieldBarHeight  = $('.grve-fields-bar').length ? $('.grve-fields-bar').outerHeight() : 0;
1216
1217					if( $('#grve-header').data('sticky-header') != 'none' ){
1218						if( $('#grve-header').hasClass('grve-logo-top') ) {
1219							headerHeight = $('.grve-bottom-header').outerHeight();
1220						} else {
1221							headerHeight = $('#grve-inner-header').outerHeight();
1222						}
1223					}
1224					var offsetTop = headerHeight + fieldBarHeight + wpBarHeight;
1225
1226					var target = $(this).data('anclink');
1227					$('html, body').animate({scrollTop: $('#'+ target).offset().top - ( offsetTop - 1 )}, 600);
1228				});
1229			}
1230		},
1231		showHideGoTo: function(){
1232			var contentOffSet  = $('#grve-main-content').offset().top,
1233				$section       = $('#grve-main-content .grve-section'),
1234				$anchorList    = $('#grve-anchor-list'),
1235				$anchorItem    = $('#grve-anchor-list li'),
1236				headerHeight   = 0,
1237				fieldBarHeight = $('.grve-fields-bar').length ? $('.grve-fields-bar').outerHeight() : 0;
1238
1239			if( $('#grve-header').data('sticky-header') != 'none' ){
1240				if( $('#grve-header').hasClass('grve-logo-top') ) {
1241					headerHeight = $('.grve-bottom-header').outerHeight();
1242				} else {
1243					headerHeight = $('#grve-inner-header').outerHeight();
1244				}
1245			}
1246			var offsetTop = headerHeight + fieldBarHeight + wpBarHeight;
1247
1248
1249			$(window).on("scroll", function() {
1250				var scroll        = $(window).scrollTop(),
1251					sectionOffset = $section.offset().top,
1252					anchorOffset  = $anchorList.offset().top,
1253					anchorHeight  = $anchorList.height();
1254
1255				if( scroll > contentOffSet - offsetTop ){
1256					$anchorList.addClass( 'show ');
1257				} else {
1258					$anchorList.removeClass( 'show' );
1259				}
1260
1261				$anchorItem.each(function(){
1262					var currLink         = $(this).data('anclink'),
1263						refElement       = $('#' + currLink),
1264						refElementMargin = parseInt(refElement.css('margin-bottom')),
1265						refElementOffset =  refElement.offset().top - offsetTop;
1266
1267					if (refElementOffset <= anchorOffset - anchorHeight/2 && refElementOffset + refElement.outerHeight() + refElementMargin > anchorOffset - anchorHeight/2) {
1268						$(this).addClass("active");
1269					}
1270					else{
1271						$(this).removeClass("active");
1272					}
1273
1274				});
1275			});
1276
1277		},
1278		refMainMenu: function(){
1279
1280			var $section       = $('#grve-main-content .grve-section[id]'),
1281				headerHeight   = 0,
1282				fieldBarHeight = $('.grve-fields-bar').length ? $('.grve-fields-bar').outerHeight() : 0;
1283
1284
1285			if( $('#grve-header').data('sticky-header') != 'none' ){
1286				if( $('#grve-header').hasClass('grve-logo-top') ) {
1287					headerHeight = $('.grve-bottom-header').outerHeight();
1288				} else {
1289					headerHeight = $('#grve-inner-header').outerHeight();
1290				}
1291			}
1292
1293			var offsetTop = headerHeight + fieldBarHeight + wpBarHeight;
1294
1295			$(window).on("scroll", function() {
1296				var scroll = $(window).scrollTop();
1297
1298				$section.each(function(){
1299					var $that         = $(this),
1300						currentId     = $that.attr('id'),
1301						sectionOffset = $that.offset().top - offsetTop;
1302
1303					if (sectionOffset <= scroll && sectionOffset + $that.outerHeight() > scroll ) {
1304						$('#grve-main-menu a[href*="#' + currentId + '"]').parent().addClass('active');
1305					}
1306					else{
1307						$('#grve-main-menu a[href*="#' + currentId + '"]').parent().removeClass("active");
1308					}
1309
1310				});
1311			});
1312		},
1313		pieChart: function(){
1314
1315			$('.grve-chart-number').each(function() {
1316				var $element = $(this),
1317					delay       = $element.parent().attr('data-delay') !== '' ? parseInt( $element.parent().attr('data-delay') ) : 0,
1318					chartSize   = '170';
1319
1320				$element.css({ 'width' : chartSize, 'height' : chartSize, 'line-height' : chartSize + 'px' });
1321
1322				$element.appear(function() {
1323					setTimeout(function () {
1324						pageSettings.pieChartInit( $element );
1325					}, delay);
1326				});
1327			});
1328
1329		},
1330		pieChartInit: function( $element ){
1331
1332			var activeColor = $element.data('pie-active-color') !== '' ? $element.data('pie-active-color') : 'rgba(0,0,0,1)',
1333				pieColor    = $element.data('pie-color') !== '' ? $element.data('pie-color') : 'rgba(0,0,0,0.1)',
1334				pieLineCap  = $element.data('pie-line-cap') !== '' ? $element.data('pie-line-cap') : 'round',
1335				lineSize    = $element.data('pie-line-size') !== '' ? $element.data('pie-line-size') : '6',
1336				chartSize   = '170';
1337
1338
1339			$element.easyPieChart({
1340				barColor: activeColor,
1341				trackColor: pieColor,
1342				scaleColor: false,
1343				lineCap: pieLineCap,
1344				lineWidth: lineSize,
1345				animate: 1500,
1346				size: chartSize
1347			});
1348		},
1349		fixedFooter: function(){
1350			var $footer = $('#grve-footer'),
1351				sticky  = $footer.data('sticky-footer');
1352			if( sticky != 'yes' || isMobile.any() ) {
1353				return;
1354			} else {
1355				pageSettings.footerHeight();
1356				$(window).smartresize( function() {
1357					pageSettings.footerHeight();
1358				});
1359			}
1360		},
1361		footerHeight: function(){
1362			var $footer      = $('#grve-footer'),
1363				windowHeight = $(window).height(),
1364				footerHeight = $footer.outerHeight();
1365
1366			if( footerHeight > windowHeight ) {
1367				$('#grve-footer').removeClass('grve-sticky-footer').prev().css('margin-bottom',0);
1368			} else {
1369				$('#grve-footer').addClass('grve-sticky-footer').prev().css('margin-bottom',footerHeight);
1370			}
1371
1372		}
1373	};
1374
1375	// -------------------------------------------------------------------------------------------
1376	// SIDE MENU OPEN
1377	// -------------------------------------------------------------------------------------------
1378	var menuOpen = false;
1379
1380	var headerOptions = {
1381
1382		menuIcon     : $('#grve-header-options > li'),
1383		menuWrapper  : $('.grve-options-wrapper'),
1384
1385		init: function(){
1386			this.menuIcon.on('click',function(e){
1387				e.preventDefault();
1388				if(menuOpen) {
1389					headerOptions.closeMenu();
1390				} else {
1391					headerOptions.openMenu();
1392				}
1393			});
1394
1395			if( isMobile.any() ) {
1396				return;
1397			} else {
1398				this.menuIcon.on( 'mouseover', function() { headerOptions.openIconMenu(); } );
1399				this.menuWrapper.on( 'mouseover', function() { headerOptions.openMenu(); } );
1400				this.menuIcon.on( 'mouseout', function() { headerOptions.closeMenu(); });
1401			}
1402		},
1403		openIconMenu: function(){
1404			this.menuWrapper.addClass('grve-open-part');
1405			this.menuIcon.addClass('grve-open');
1406		},
1407		openMenu: function(){
1408			this.menuWrapper.addClass('grve-open-all');
1409			this.menuIcon.addClass('grve-open');
1410			menuOpen = true;
1411		},
1412		closeMenu: function(){
1413			this.menuWrapper.removeClass('grve-open-part grve-open-all');
1414			this.menuIcon.removeClass('grve-open');
1415			menuOpen = false;
1416		}
1417	};
1418
1419	//////////////////////////////////////////////////////////////////////////////////////////////////////
1420	// SET EQUAL COLUMNS HEIGHT
1421	//////////////////////////////////////////////////////////////////////////////////////////////////////
1422	var setColumnHeight = {
1423		init: function(){
1424			var section     = '.grve-section',
1425				windowWidth = $(window).width() + scrollBarWidth;
1426
1427			$(section).each(function(){
1428				var $that   = $(this),
1429					$column = $that.find('.grve-row').first().children();
1430
1431				if( $that.hasClass('grve-flex-row') ) {
1432					equalHeight( $that, $column );
1433				}
1434				if( $that.hasClass('grve-middle-content') ) {
1435					middleContent( $that, $column );
1436				}
1437			});
1438
1439			function equalHeight( section, $column ) {
1440				section.imagesLoaded('always',function(){
1441					$column.css({ 'min-height': '', 'padding-top': '', 'padding-bottom': '' });
1442					var maxHeight = setColumnHeight.getMaxHeight( section );
1443					if( ( windowWidth <= tabletLandscape && $column.hasClass('grve-tablet-column-1') ) || windowWidth <= tabletPortrait ) {
1444						$column.css({ 'min-height': '', 'visibility': 'visible'  });
1445					} else {
1446						$column.css({ 'min-height': maxHeight, 'visibility': 'visible'  });
1447					}
1448				});
1449			}
1450
1451			function middleContent( section, $column ) {
1452				section.imagesLoaded('always',function(){
1453					$column.css({ 'min-height': '', 'padding-top': '', 'padding-bottom': '' });
1454					var maxHeight = setColumnHeight.getMaxHeight( section );
1455					if( ( windowWidth <= tabletLandscape && $column.hasClass('grve-tablet-column-1') ) || windowWidth <= tabletPortrait ) {
1456						$column.css({ 'padding-top': '', 'padding-bottom': '', 'min-height': '', 'visibility': 'visible'  });
1457						section.find('.wpb_column').css({ 'visibility': 'visible'  });
1458					} else {
1459						$column.each(function(){
1460							var columnHeigth = $(this).outerHeight();
1461							if( columnHeigth <= maxHeight ) {
1462								var space = ( maxHeight - columnHeigth ) / 2;
1463								$(this).css({ 'padding-top' : space, 'padding-bottom' : space });
1464							}
1465						});
1466						section.find('.wpb_column').css({ 'visibility': 'visible'  });
1467					}
1468				});
1469			}
1470
1471		},
1472		getMaxHeight: function( section ){
1473			var $that         = section,
1474				sectionHeight = $that.height(),
1475				maxHeight     = sectionHeight;
1476
1477			return maxHeight;
1478		}
1479	};
1480	$(window).smartresize( function() {
1481		setColumnHeight.init();
1482	});
1483
1484	//////////////////////////////////////////////////////////////////////////////////////////////////////
1485	// CLASSIC ELEMENTS
1486	//////////////////////////////////////////////////////////////////////////////////////////////////////
1487	var classicElements = {
1488		init: function(){
1489			//Accordion Toggle
1490			classicElements.accordionToggle();
1491
1492			// Animation Appear
1493			classicElements.animAppear();
1494
1495			//Progress Bars
1496			classicElements.progressBars();
1497
1498			// Tabs
1499			classicElements.tabs();
1500
1501			// Vc Tabs
1502			classicElements.vcTab();
1503
1504			// Info Box
1505			classicElements.infoBox();
1506
1507			// Counters
1508			classicElements.counter();
1509
1510			// Countdown
1511			classicElements.countdown();
1512
1513			// Partner Advanced
1514			classicElements.partnerAdvanced();
1515
1516			// Portfolio Hover
1517			classicElements.portfolioHover();
1518
1519			// Woo Product
1520			classicElements.wooProduct();
1521
1522		},
1523
1524		accordionToggle: function(){
1525			$('.grve-toggle-wrapper.grve-first-open').each(function(){
1526				$(this).find('li').first().addClass('active');
1527			});
1528			$('.grve-toggle-wrapper li.active').find('.grve-title').addClass('active');
1529			$('.grve-toggle-wrapper li .grve-title').click(function () {
1530				$(this)
1531					.toggleClass('active')
1532					.next().slideToggle(350);
1533			});
1534			$('.grve-accordion-wrapper.grve-first-open').each(function(){
1535				$(this).find('li').first().addClass('active');
1536			});
1537			$('.grve-accordion-wrapper li.active').find('.grve-title').addClass('active');
1538			$('.grve-accordion-wrapper li .grve-title').click(function () {
1539				$(this)
1540					.toggleClass('active').next().slideToggle(350)
1541					.parent().siblings().find('.grve-title').removeClass('active')
1542					.next().slideUp(350);
1543			});
1544		},
1545		animAppear: function(){
1546			if(isMobile.any()) {
1547				$('.grve-animated-item').css('opacity',1);
1548			} else {
1549				$('.grve-animated-item').each(function() {
1550					var timeDelay = $(this).attr('data-delay');
1551					$(this).appear(function() {
1552					var $that = $(this);
1553						setTimeout(function () {
1554							$that.addClass('grve-animated');
1555						}, timeDelay);
1556					},{accX: 0, accY: -150});
1557				});
1558			}
1559		},
1560		progressBars: function(){
1561			var selector = '.grve-progress-bar';
1562			$(selector).each(function() {
1563				$(this).appear(function() {
1564
1565					var val         = $(this).attr('data-value'),
1566						percentage  = $('<div class="grve-percentage">'+ val + '%'+'</div>');
1567
1568					$(this).find('.grve-bar-line').animate({ width: val + '%' }, 1600);
1569
1570					percentage.appendTo($(this).find('.grve-bar'));
1571
1572					$(this).find('.grve-percentage').animate({ left: val + '%' }, 1600);
1573				});
1574			});
1575		},
1576		tabs: function(){
1577			$('.grve-tabs-title li').click(function () {
1578				$(this).addClass('active').siblings().removeClass('active');
1579				$(this).parent().parent().find('.grve-tabs-wrapper').find('.grve-tab-content').eq($(this).index()).addClass('active').siblings().removeClass('active');
1580			});
1581			$('.grve-tabs-title').each(function(){
1582				$(this).find('li').first().click();
1583			});
1584		},
1585		vcTab: function(){
1586
1587			var $tab = $('.vc_tta-tab a, .vc_tta-panel-title a');
1588
1589			$tab.on('click', function(){
1590				var $that = $(this),
1591					link  = $that.attr('href'),
1592					$panel = $(link),
1593					$iso = $panel.find('.grve-isotope');
1594				if( $iso.length > 0 ){
1595					setTimeout(function() {
1596						$iso.find('.grve-isotope-container').isotope('layout');
1597					},1000);
1598				}
1599			});
1600		},
1601		infoBox: function(){
1602			var infoMessage = $('.grve-message'),
1603			closeBtn = infoMessage.find($('.grve-close'));
1604			closeBtn.click(function () {
1605				$(this).parent().slideUp(150);
1606			});
1607		},
1608		counter: function(){
1609			var selector = '.grve-counter-item span';
1610			$(selector).each(function(i){
1611				var elements = $(selector)[i],
1612					thousandsSeparator = $(this).attr('data-thousands-separator') != '' ? $(this).attr('data-thousands-separator') : ',';
1613				$(elements).attr('id','grve-counter-' + i );
1614				var delay = $(this).parents('.grve-counter').attr('data-delay') !== '' ? parseInt( $(this).parents('.grve-counter').attr('data-delay') ) : 200,
1615					options = {
1616						useEasing    : true,
1617						useGrouping  : true,
1618						separator    : $(this).attr('data-thousands-separator-vis') != 'yes' ? thousandsSeparator : '',
1619						decimal      : $(this).attr('data-decimal-separator') != '' ? $(this).attr('data-decimal-separator') : '.',
1620						prefix       : $(this).attr('data-prefix') != '' ? $(this).attr('data-prefix') : '',
1621						suffix       : $(this).attr('data-suffix') != '' ? $(this).attr('data-suffix') : ''
1622					},
1623					counter = new countUp( $(this).attr('id') , $(this).attr('data-start-val'), $(this).attr('data-end-val'), $(this).attr('data-decimal-points'), 2.5, options);
1624				$(this).appear(function() {
1625					setTimeout(function () {
1626						counter.start();
1627					}, delay);
1628				});
1629			});
1630		},
1631		countdown: function(){
1632			$('.grve-countdown').each(function() {
1633				var $this        = $(this),
1634					finalDate    = $this.data('countdown'),
1635					numbersSize  = $this.data('numbers-size'),
1636					textSize     = $this.data('text-size'),
1637					numbersColor = $this.data('numbers-color'),
1638					textColor    = $this.data('text-color'),
1639					countdownItems = '',
1640					text = '',
1641					countdownFormat = $this.data('countdown-format').split('|');
1642
1643				$.each( countdownFormat, function( index, value ) {
1644					switch (value) {
1645						case 'w':
1646							text = grve_main_data.grve_string_weeks;
1647							break;
1648						case 'D':
1649						case 'd':
1650						case 'n':
1651							text = grve_main_data.grve_string_days;
1652							break;
1653						case 'H':
1654							text = grve_main_data.grve_string_hours;
1655							break;
1656						case 'M':
1657							text = grve_main_data.grve_string_minutes;
1658							break;
1659						case 'S':
1660							text = grve_main_data.grve_string_seconds;
1661							break;
1662						default:
1663							text = '';
1664					}
1665					countdownItems += '<div class="grve-countdown-item">'
1666					countdownItems += '<div class="grve-number grve-' + numbersSize + ' grve-color-' + numbersColor + '">%' + value + '</div>';
1667					countdownItems += '<span class="grve-' + textSize + ' grve-color-' + textColor + '">
1667' + text + '</span>';
1668					countdownItems += '</div>';
1669
1670				});
1671
1672				$this.countdown(finalDate, function(event) {
1673					$this = $(this).html(event.strftime( countdownItems ));
1674				});
1675			});
1676		},
1677		partnerAdvanced: function(){
1678			var partner = $('.grve-partner-advanced');
1679
1680			partner.parents('.grve-section').hover(function(){
1681				$(this).css('cursor','pointer');
1682			});
1683
1684			partner.parents('.grve-section').on('click',function(){
1685				var $that = $(this),
1686					$element = $that.find('.grve-partner-advanced'),
1687					offset = $that.offset().top,
1688					headerHeight    = 0,
1689					fieldBarHeight  = $('.grve-fields-bar').length ? $('.grve-fields-bar').outerHeight() : 0;
1690
1691				if( $('#grve-header').data('sticky-header') != 'none' ){
1692					if( $('#grve-header').hasClass('grve-logo-top') ) {
1693						headerHeight = $('.grve-bottom-header').outerHeight();
1694					} else {
1695						headerHeight = $('#grve-inner-header').outerHeight();
1696					}
1697				}
1698
1699				var distance = offset - ( headerHeight + fieldBarHeight - 1 );
1700
1701				if( distance > 0 && !$element.hasClass('active') ) {
1702					$('html,body').animate({
1703						scrollTop: distance
1704					}, 600,function(){
1705						$element.addClass('active').find('.grve-partner-content').slideDown(function(){
1706							$(this).addClass('grve-animated');
1707							return;
1708						});
1709					});
1710				} else {
1711					$element.toggleClass('active').find('.grve-partner-content').slideToggle(function(){
1712						$(this).toggleClass('grve-animated');
1713					});
1714				}
1715
1716			});
1717		},
1718		iconBox: function(){
1719			var $parent   = $('.grve-row');
1720
1721			$parent.each(function(){
1722				var $iconBox  = $(this).find('.grve-box-icon.grve-advanced-hover');
1723
1724				if( !$iconBox.length ) return;
1725
1726				classicElements.setIconBoxHeight( $iconBox );
1727			$(window).smartresize( function() {
1728					classicElements.setIconBoxHeight( $iconBox );
1729				});
1730
1731				$iconBox.unbind('mouseenter mouseleave').bind('mouseenter mouseleave', function() {
1732					$(this).toggleClass('hover');
1733			});
1734
1735			});
1736		},
1737		setIconBoxHeight: function( element ){
1738			var arrHeight = [],
1739				$iconBox  = element;
1740
1741
1742			$iconBox.css({ 'height' : '', 'padding-top' : '' });
1743
1744			$iconBox.each(function(){
1745				var $that          = $(this),
1746					$iconBoxHeigth = $that.height();
1747
1748				arrHeight.push( $iconBoxHeigth );
1749			});
1750
1751			var maxHeight   = Math.max.apply(Math,arrHeight),
1752				iconHeight  = $iconBox.find('.grve-icon').height(),
1753				paddingTop  = ( maxHeight - iconHeight )/2;
1754
1755			$iconBox.css({ 'height' : maxHeight, 'padding-top' : paddingTop });
1756			setTimeout(function() {
1757				$iconBox.addClass('active');
1758			}, 800);
1759
1760		},
1761		portfolioHover: function(){
1762			$(' .grve-portfolio .grve-hover-style-2 ').each( function() { $(this).hoverdir(); } );
1763		},
1764		wooProduct: function(){
1765			var $product = $('.grve-product-item'),
1766				$productOptions = $('.grve-product-options');
1767			$product.unbind('mouseenter mouseleave').bind('mouseenter mouseleave', function() {
1768				$(this).toggleClass('hover');
1769			});
1770			$productOptions.unbind('mouseenter mouseleave').bind('mouseenter mouseleave', function() {
1771				var $addButton = $(this).find('.grve-add-cart');
1772				if( $addButton.length ){
1773					$(this).toggleClass('hover');
1774				}
1775			});
1776			$('.grve-product-options .grve-add-cart').click(function(){
1777				$(this).parents('.grve-product-media').addClass('grve-product-added-to-cart');
1778			});
1779		}
1780	};
1781
1782	//////////////////////////////////////////////////////////////////////////////////////////////////////
1783	// STICKY ELEMENTS
1784	//////////////////////////////////////////////////////////////////////////////////////////////////////
1785	var stickyItems = {
1786
1787		config : {
1788			element    : '.grve-fields-bar',
1789			offset     : 0
1790		},
1791
1792		init: function(settings){
1793			// allow overriding the default config
1794			$.extend(this.config, settings);
1795
1796			if( !$(this.config.element).length || isMobile.any() || $(this.config.element).hasClass('grve-responsive-bar') ) {
1797				return;
1798			}
1799			var $item       = $(this.config.element),
1800				itemOffset  = this.config.offset,
1801				positionX   = $item.offset().left,
1802				itemId      = $item.attr('id'),
1803				itemWidth   = $item.outerWidth() + 2,
1804				itemHeight  = $item.outerHeight();
1805			// Create A Helper Wrapper
1806			$item.wrap('<div id="' + itemId + '-wrapper"></div>' );
1807			$item.parent().css({
1808				'height' : itemHeight,
1809				'position' : 'relative'
1810			});
1811			$(window).scroll(function(){
1812				var scroll       = $(window).scrollTop(),
1813					elementTop   = $item.parent().offset().top,
1814					headerHeight =  0;
1815
1816				if( $('#grve-header').data('sticky-header') != 'none' ){
1817					if( $('#grve-header').hasClass('grve-logo-top') ) {
1818						headerHeight = $('.grve-bottom-header').outerHeight();
1819					} else {
1820						headerHeight = $('#grve-inner-header').outerHeight();
1821					}
1822				}
1823
1824				var offsetTop = headerHeight + itemOffset + wpBarHeight;
1825				if( scroll > elementTop - offsetTop ) {
1826					$item.css({
1827						'position' : 'fixed',
1828						'top'      : offsetTop,
1829						'left'     : positionX,
1830						'width'    : itemWidth
1831					}).addClass('sticky');
1832				}
1833				else {
1834					$item.css({
1835						'position' : '',
1836						'top'      : '',
1837						'left'     : '',
1838						'width'    : ''
1839					}).removeClass('sticky');
1840				}
1841			});
1842		}
1843	};
1844
1845	//////////////////////////////////////////////////////////////////////////////////////////////////////
1846	// TITLE PARALLAX
1847	//////////////////////////////////////////////////////////////////////////////////////////////////////
1848	var titleParallax = {
1849
1850		selector: '.grve-feature-content',
1851		container: '#grve-feature-section',
1852
1853		init: function(){
1854			if( isMobile.any() || $(this.container).data('effect') != 'parallax' ) {
1855				return;
1856			}
1857			$(window).scroll(function(){
1858				titleParallax.update();
1859			});
1860		},
1861		update: function(){
1862
1863			$(this.selector).transition({ y: $(window).scrollTop()*.5},0)
1864							.css( 'opacity', 1 - ( $(window).scrollTop()*.002 ) );
1865		}
1866	};
1867	//////////////////////////////////////////////////////////////////////////////////////////////////////
1868	// ONEPAGE SETTINGS
1869	//////////////////////////////////////////////////////////////////////////////////////////////////////
1870	var onePageSettings = {
1871		init: function(){
1872			var topOffset = 0;
1873			if( $('#grve-header').data('sticky-header') != 'none' ){
1874				if( $('#grve-header').hasClass('grve-logo-top') ) {
1875					topOffset = $('.grve-bottom-header').outerHeight();
1876				} else {
1877					topOffset = $('#grve-inner-header').outerHeight();
1878				}
1879			}
1880			var fieldBarHeight  = $('.grve-fields-bar').length ? $('.grve-fields-bar').outerHeight() : 0;
1881
1882			$('a[href*="#"]:not( [href="#"] )').click(function(e) {
1883				if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname ) {
1884					var target = $(this.hash);
1885					target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
1886					if ( target.length && ( target.hasClass('grve-section') || target.hasClass('grve-bookmark') ) ) {
1887						$('html,body').animate({
1888							scrollTop: target.offset().top - topOffset - fieldBarHeight + 1
1889						}, 1000);
1890						return false;
1891					}
1892				}
1893			});
1894
1895			if (window.location.hash) {
1896				setTimeout(function() {
1897					$('html, body').scrollTop(0);
1898					$('#grve-main-content').css('opacity',1);
1899					var target = window.location.hash;
1900
1901					if ($(target).length) {
1902						$('html, body').delay(600).animate({
1903							scrollTop: $(target).offset().top - topOffset - fieldBarHeight
1904						}, 600);
1905					}
1906					window.location.hash = "";
1907				}, 0);
1908			}
1909			else {
1910				$('#grve-main-content').css('opacity',1);
1911			}
1912		}
1913	};
1914
1915	//////////////////////////////////////////////////////////////////////////////////////////////////////
1916	// CAROUSEL
1917	//////////////////////////////////////////////////////////////////////////////////////////////////////
1918	var  carousels = {
1919
1920		init: function() {
1921			var $elements = $('.grve-carousel-element');
1922
1923			$elements.each(function(){
1924				var	carousel = $(this);
1925
1926				var carouselSettings = {
1927					sliderSpeed : ( parseInt( carousel.attr('data-slider-speed') ) ) ? parseInt( carousel.attr('data-slider-speed') ) : 3000,
1928					paginationSpeed : ( parseInt( carousel.attr('data-pagination-speed') ) ) ? parseInt( carousel.attr('data-pagination-speed') ) : 400,
1929					autoHeight  : carousel.attr('data-slider-autoheight') == 'yes' ? true : '',
1930					sliderPause : carousel.attr('data-slider-pause') == 'yes' ? true : false,
1931					autoPlay    : carousel.attr('data-slider-autoplay') != 'no' ? true : false,
1932					itemNum     : carousel.hasClass('grve-carousel') ? parseInt( carousel.attr('data-items')) : 1,
1933					itemsTablet : carousel.hasClass('grve-carousel') ? [768,2] : [768,1],
1934					baseClass   : 'grve-carousel',
1935					pagination  : false
1936				};
1937				if ( carousel.hasClass('grve-testimonial') ) {
1938					// Testimonial Navigation
1939					carouselSettings.pagination = true;
1940				}
1941				else if ( carousel.hasClass('grve-carousel') ) {
1942					// Custom Navigation
1943					carousels.customNav(carousel);
1944				}
1945				else if ( carousel.hasClass('grve-slider') ) {
1946					// Custom Navigation
1947					carousels.customNav(carousel);
1948					carousels.customPause(carousel, carouselSettings);
1949				}
1950				// Carousel Settings
1951				carousels.carouselInit(carousel, carouselSettings);
1952			});
1953
1954		},
1955		carouselInit: function(carousel, settings){
1956			carousel.owlCarousel({
1957
1958				navigation        : false,
1959				pagination        : settings.pagination,
1960				autoHeight        : settings.autoHeight,
1961				slideSpeed        : 400,
1962				paginationSpeed   : settings.paginationSpeed,
1963				singleItem        : false,
1964				items             : settings.itemNum,
1965				autoPlay          : settings.autoPlay,
1966				stopOnHover       : settings.sliderPause,
1967				baseClass         : 'grve-carousel-element',
1968				theme             : '',
1969				itemsDesktop      : false,
1970				itemsDesktopSmall : false,
1971			 	itemsTablet       : settings.itemsTablet
1972
1973			});
1974			// Carousel Element Speed
1975			if( settings.autoPlay == true ){
1976			carousel.trigger('owl.play',settings.sliderSpeed);
1977			}
1978			carousel.css('visibility','visible');
1979
1980			var $parentSection = $(carousel.parents('.grve-section')),
1981				heightMode     = $parentSection.attr('data-full-height');
1982
1983			if( heightMode == 'yes' ) {
1984				sectionSettings.fullHeight($parentSection);
1985			}
1986		},
1987		customNav: function(carousel){
1988			// Carousel Navigation
1989			carousel.parent().find('.grve-carousel-next').click(function(){
1990				carousel.trigger('owl.next');
1991			});
1992			carousel.parent().find('.grve-carousel-prev').click(function(){
1993				carousel.trigger('owl.prev');
1994			});
1995		},
1996		// Fixed Pause on Hover ( Slider with Custom Title )
1997		customPause: function(carousel, settings){
1998			var customTitle = carousel.parent().find('.grve-custom-title-wrapper');
1999			if(settings.sliderPause){
2000				customTitle.hover(function(){
2001					carousel.trigger('owl.stop');
2002					carousel.find('.grve-image-hover').addClass('hover');
2003				},function(){
2004					carousel.trigger('owl.play',settings.sliderSpeed);
2005					carousel.find('.grve-image-hover').removeClass('hover');
2006				});
2007			}
2008			if(customTitle.length){
2009				customTitle.hover(function(){
2010					carousel.find('.grve-image-hover').addClass('hover');
2011				},function(){
2012					carousel.find('.grve-image-hover').removeClass('hover');
2013				});
2014			}
2015		}
2016	};
2017	//////////////////////////////////////////////////////////////////////////////////////////////////////
2018	// ISOTOPE SPINNER
2019	//////////////////////////////////////////////////////////////////////////////////////////////////////
2020	var isoSpinner = {
2021		init: function(){
2022			var $selector = $('.grve-isotope');
2023			$selector.each(function(){
2024				var $that = $(this),
2025					dataSpinner = $that.data('spinner');
2026				if( dataSpinner == 'yes' ){
2027					isoSpinner.addSpinner( $that );
2028				}
2029
2030			});
2031		},
2032		addSpinner: function( $that ){
2033			var $spinner = $('<div class="grve-iso-spinner" title="2"><svg version="1.1" id="spinner" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="60px" height="60px" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;" xml:space="preserve"><path fill="#000" d="M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z"><animateTransform attributeType="xml" attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="0.6s" repeatCount="indefinite"/></path></svg></div>');
2034			$spinner.appendTo( $that );
2035		},
2036		removeSpinner: function( $container ){
2037			$container.parent().find('.grve-iso-spinner').animate({'opacity':0},600,function(){
2038				$container.animate({'opacity': 1},600);
2039			});
2040		}
2041	}
2042	//////////////////////////////////////////////////////////////////////////////////////////////////////
2043	// ISOTOPE
2044	//////////////////////////////////////////////////////////////////////////////////////////////////////
2045	var iso = {
2046
2047		init: function() {
2048			var $selector = $('.grve-isotope');
2049			$selector.each(function(){
2050				var $that        = $(this),
2051					$container   = $that.find('.grve-isotope-container'),
2052					$isotopItem  = $container.find('.grve-isotope-item'),
2053					layout       = $that.data('layout') != '' ? $that.data('layout') : 'fitRows',
2054					dataSpinner  = $that.data('spinner');
2055
2056				iso.isotopeSetup( $container, layout, dataSpinner );
2057				$(window).smartresize( function() {
2058					if(layout == 'packery') {
2059						iso.packeryStyleFix( $container );
2060					}
2061				});
2062				$that.find('.grve-filter li').click(function(){
2063					var selector = $(this).attr('data-filter');
2064					$container.isotope({
2065						filter: selector
2066					});
2067					$(this).addClass('selected').siblings().removeClass('selected');
2068				});
2069			});
2070		},
2071		isotopeSetup: function( $container, layout, dataSpinner ){
2072			$container.isotope({
2073				resizable: true,
2074				itemSelector: '.grve-isotope-item',
2075				layoutMode: layout
2076			});
2077			if(layout == 'packery') {
2078				iso.packeryStyleFix( $container );
2079			}
2080			$container.isotope('layout');
2081			if( dataSpinner == 'yes' ) {
2082				setTimeout(function() {
2083					isoSpinner.removeSpinner( $container );
2084				},2000);
2085			} else {
2086				$container.animate({'opacity': 1},600);
2087			}
2088
2089			$(window).smartresize( function() {
2090				setTimeout(function() {
2091					$container.isotope('layout');
2092				},1000);
2093			});
2094		},
2095		packeryStyleFix: function( $container ) {
2096			var smallItem = $container.find('.grve-isotope-item.grve-packery-image').first(),
2097				standardHeight = smallItem.width(),
2098				wideTallHeight = (standardHeight * 2)  + parseInt(smallItem.css('margin-bottom'), 10);
2099			if (standardHeight > 0) {
2100				$container.find('.grve-isotope-item.grve-packery-image .grve-media').css('height', standardHeight);
2101				$container.find('.grve-isotope-item.grve-packery-w2 .grve-media').css('height', standardHeight);
2102				$container.find('.grve-isotope-item.grve-packery-h2 .grve-media').css('height', wideTallHeight);
2103				$container.find('.grve-isotope-item.grve-packery-h2-w2 .grve-media').css('height', wideTallHeight);
2104			}
2105			$container.isotope('layout');
2106		}
2107	};
2108
2109	//////////////////////////////////////////////////////////////////////////////////////////////////////
2110	// NON ISOTOPE FILTER
2111	//////////////////////////////////////////////////////////////////////////////////////////////////////
2112	var noniso = {
2113
2114		init: function() {
2115			var $selector = $('.grve-non-isotope');
2116			$selector.each(function(){
2117				var $that = $(this);
2118				$that.find('.grve-filter li').click(function(){
2119					var selector = $(this).attr('data-filter');
2120					if ( '*' == selector ) {
2121						$that.find('.grve-non-isotope-item').fadeIn('1000');
2122					} else {
2123						$that.find('.grve-non-isotope-item').hide();
2124						$that.find(selector).fadeIn('1000');
2125					}
2126					$(this).addClass('selected').siblings().removeClass('selected');
2127				});
2128			});
2129		}
2130	};
2131	//////////////////////////////////////////////////////////////////////////////////////////////////////
2132	// PARALLAX
2133	//////////////////////////////////////////////////////////////////////////////////////////////////////
2134	var parallax = {
2135
2136		selector : 'div[data-stellar-ratio]',
2137
2138		init: function(){
2139
2140			if( isMobile.any() || !$(this.selector).length ) {
2141				return;
2142			}
2143
2144			$(window).stellar({
2145				horizontalScrolling: false,
2146				verticalOffset: 0,
2147				horizontalOffset: 0,
2148				responsive: true,
2149				scrollProperty: 'scroll',
2150				positionProperty: 'transform',
2151				parallaxBackgrounds: false,
2152				parallaxElements: true,
2153				hideDistantElements: false,
2154			});
2155			parallax.settings();
2156			$(window).smartresize( function() {
2157				parallax.settings();
2158			});
2159		},
2160		settings: function(){
2161
2162			$(parallax.selector).each(function (){
2163				var $parallax           = $(this),
2164					$container          = $parallax.parent(),
2165					containerHeight     = $container.outerHeight(),
2166					windowHeight        = $(window).height();
2167
2168				if( 1 == grve_main_data.grve_row_stellar_auto ) {
2169					$parallax.css({
2170						'height': containerHeight + windowHeight,
2171						'top': -1 * windowHeight * 0.5 / 2
2172					});
2173				}
2174
2175				if( $parallax.is('.grve-bg-video') ) {
2176					videoResize.init( { selector : $parallax, container : $parallax } );
2177				}
2178			});
2179		}
2180	};
2181	//////////////////////////////////////////////////////////////////////////////////////////////////////
2182	// GLOBAL VARIABLES
2183	//////////////////////////////////////////////////////////////////////////////////////////////////////
2184	var wpBarHeight = $('#grve-body').hasClass('admin-bar') ? 32 : 0;
2185	var largeScreen = 2048;
2186	var tabletLandscape = 1200;
2187	var tabletPortrait = 1023;
2188	var mobileScreen = 767;
2189	var isMobile = {
2190		Android: function() {
2191			return navigator.userAgent.match(/Android/i);
2192		},
2193		BlackBerry: function() {
2194			return navigator.userAgent.match(/BlackBerry/i);
2195		},
2196		iOS: function() {
2197			return navigator.userAgent.match(/iPhone|iPad|iPod/i);
2198		},
2199		Opera: function() {
2200			return navigator.userAgent.match(/Opera Mini/i);
2201		},
2202		Windows: function() {
2203			return navigator.userAgent.match(/IEMobile/i);
2204		},
2205		any: function() {
2206			return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
2207		}
2208	};
2209
2210	// Scrollbar Width
2211	var parent, child, scrollBarWidth;
2212
2213	if( scrollBarWidth === undefined ) {
2214		parent          = $('<div style="width:50px;height:50px;overflow:auto"><div/></div>').appendTo('body');
2215		child           = parent.children();
2216		scrollBarWidth  = child.innerWidth()-child.height(99).innerWidth();
2217		parent.remove();
2218	};
2219
2220
2221
2222	$(document).ready( function() {
2223
2224		// Remove Video Bg
2225		pageSettings.removeVideoBg();
2226
2227		// FEATURE SECTION SETTINGS
2228		featureSection.init();
2229
2230		// HEADER
2231		headerSettings.init();
2232
2233		// MAIN MENU
2234		mainMenu.init();
2235
2236		// SIDE MENU
2237		headerOptions.init();
2238
2239		// CLASSIC ELEMENTS
2240		classicElements.init();
2241
2242		// PAGE SETTINGS
2243		pageSettings.init();
2244
2245		// STICKY ELEMENTS
2246		stickyItems.init();
2247
2248		// POST SOCIALS
2249		pageSettings.postSocials();
2250
2251		// TITLE PARALLAX
2252		titleParallax.init();
2253
2254		// SECTIONS
2255		sectionSettings.init();
2256
2257		// ONEPAGE SETTINGS
2258		if(!locationOnLoad) {
2259			onePageSettings.init();
2260		}
2261
2262		// ISOTOPE SPINNER
2263		isoSpinner.init();
2264
2265	});
2266
2267	$(window).load( function() {
2268
2269		// Icon Box
2270		classicElements.iconBox();
2271
2272		// Column Height
2273		setColumnHeight.init();
2274
2275		// CAROUSELS
2276		carousels.init();
2277
2278		// ISOTOPE
2279		iso.init();
2280
2281		//NON ISOTOPE FILTER
2282		noniso.init();
2283
2284		// PARALLAX
2285		parallax.init();
2286
2287		pageSettings.gotoSection();
2288
2289		pageSettings.refMainMenu();
2290
2291		// FIXED FOOTER
2292		pageSettings.fixedFooter();
2293
2294		pageSettings.sectionBgVideo();
2295
2296		// ONEPAGE SETTINGS
2297		if(locationOnLoad) {
2298			onePageSettings.init();
2299		}
2300
2301	});
2302
2303})(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.