PageSourceSearch

https://www.ludovakultura.sk/wp-content/themes/movedo/js/main.js?ver=3.6.7

js ludovakultura.sk collected 2026-10-01 12:20:41 UTC 156,628 bytes, 5,032 lines download raw bytes

1
2// ================================================================================== //
3
4	// # Document on Ready
5	// # Document on Resize
6	// # Document on Scroll
7	// # Document on Load
8
9	// # Sticky Header
10	// # Leader Post Size
11	// # Header
12	// # Post Sticky Items
13	// # Sticky Sidebar Widget
14	// # Sticky Sidebar
15	// # Feature Section
16	// # Feature Parallax
17	// # Page Title
18	// # Page Settings
19	// # Basic Elements
20	// # Isotope
21	// # Parallax Section
22	// # Section Settings
23	// # Social Bar For Post
24	// # Scroll Direction
25	// # Global Variables
26	// # Scrollbar Width
27	// # Full Page
28
29	// # Sticky Section
30
31// ================================================================================== //
32
33
34var GRVE = GRVE || {};
35var debugJs = false;
36var spinner = '<div class="grve-spinner"></div>';
37var addFeatureSpinner =  false;
38var hiddenMenuItemsAnimation = true;
39var hiddenaAreaMinWidth = 550;
40var gridEqual = true;
41var wooThumbCarouselItems = 4;
42var featureSliderHandler = true;
43
44// Animate Mask Options
45var maskLayers = 3;
46var maskColorClasses =  ['grve-bg-primary-1','grve-bg-light','grve-bg-dark'];
47
48var deviceAnimAppear =  false;
49if( 1 == movedo_grve_main_data.device_animations ) {
50	deviceAnimAppear =  true;
51}
52
53(function($){
54
55	"use strict";
56
57
58	// # Document on Ready
59	// ============================================================================= //
60	GRVE.documentReady = {
61		init: function(){
62			GRVE.safeBtnArea.init();
63			GRVE.pageSettings.bodyLoader();
64			GRVE.svgAnimation.init();
65			GRVE.pageSettings.removeVideoBg();
66			GRVE.pageSettings.addVideoBg();
67			GRVE.sectionSettings.init();
68			GRVE.slideToggleMenu.init( '#grve-hidden-menu', '#grve-hidden-menu .grve-menu' );
69			GRVE.slideToggleMenu.init( '#grve-responsive-anchor', '#grve-responsive-anchor .grve-menu' );
70			GRVE.slideToggleMenu.init( '#grve-main-header.grve-header-side', '#grve-main-menu.grve-vertical-menu .grve-menu' );
71			GRVE.slideToggleMenu.init( '#grve-sidearea', '.widget_nav_menu' );
72			if( $('#grve-feature-section').length > 0 ){
73				GRVE.featureSection.init( '#grve-feature-section' );
74				GRVE.featureSize.init( '#grve-feature-section' );
75				GRVE.featureParallax.init();
76			}
77			if( $('.grve-page-title').length > 0 ){
78				GRVE.featureSection.init( '.grve-page-title' );
79				GRVE.featureSize.init( '.grve-page-title' );
80			}
81			GRVE.pageSettings.init();
82			GRVE.leaderPostSize.init();
83			GRVE.isotope.init();
84			GRVE.isotope.noIsoFilters();
85			GRVE.basicElements.init();
86			GRVE.pageSettings.lightBox();
87			GRVE.commentsFormToggle.init();
88			GRVE.fullPage.init();
89			GRVE.pillingPage.init();
90			GRVE.parallaxSection.init('.grve-section.grve-bg-parallax');
91		}
92	};
93
94	GRVE.reCall = {
95		init: function(){
96			GRVE.sectionSettings.init();
97			GRVE.isotope.init();
98		}
99	};
100
101
102	// # Document on Resize
103	// ============================================================================= //
104		GRVE.documentResize = {
105		init: function(){
106			if( $('#grve-feature-section').length > 0 ){
107				GRVE.featureSize.init( '#grve-feature-section' );
108			}
109			if( $('.grve-page-title').length > 0 ){
110				GRVE.featureSize.init( '.grve-page-title' );
111			}
112			GRVE.sectionSettings.init();
113			GRVE.basicElements.imageText();
114			GRVE.pageSettings.resizeVideoBg();
115		}
116	};
117
118	// # Document on Scroll
119	// ============================================================================= //
120	GRVE.documentScroll = {
121		init: function(){
122			GRVE.socialBar.init();
123			GRVE.pageSettings.onePageMenu();
124		}
125	};
126
127	// # Document on Load
128	// ============================================================================= //
129	GRVE.documentLoad = {
130		init: function(){
131			GRVE.stickyHeaderTypes.init();
132			GRVE.anchorSticky.init();
133			GRVE.socialBar.init();
134			GRVE.stickySidebarWidget.init();
135			GRVE.stickySidebar.init();
136			GRVE.basicElements.iconBox();
137			GRVE.pageSettings.fullHeightSeparator();
138			GRVE.pageSettings.columnEffect();
139			GRVE.wooThumbCarousel.init();
140			GRVE.wooProductRating.init();
141			if ( $('#grve-body').hasClass( 'compose-mode' ) ) {
142				GRVE.isotope.init();
143			}
144			// Location Hash
145			if (window.location.hash) {
146				setTimeout(function() {
147					var target = window.location.hash;
148
149					if( $(target).length ){
150						if ( $(target).hasClass('grve-tab-content') || $(target).hasClass('grve-accordion-content')  ) {
151							var tabLink =  $('.grve-tab-link[data-rel="' + target + '"]:visible');
152							if ( tabLink.length ) {
153								tabLink.click();
154								setTimeout(function() {
155									GRVE.pageSettings.linkGoToTop( tabLink );
156								}, 500);
157							}
158						} else {
159							$('html, body').scrollTop( $(target).offset().top );
160						}
161					}
162				}, 0);
163			}
164		}
165	};
166	// # Fixed Custom Position Column
167	// ============================================================================= //
168	GRVE.customPositionColumn = {
169		init: function(){
170			$('.grve-column.grve-custom-position').each(function(){
171				var $column = $(this),
172					columnW, columnX, windowW;
173
174				setup();
175
176				if( !isMobile.any() ) {
177					$(window).on('resize', resizer);
178				} else {
179					$(window).on('orientationchange', resizer);
180				}
181				function setup(){
182					resetPosition();
183					updateParams();
184					if( columnW + columnX >= windowW ){
185						resetPosition();
186						fixedPositionRight();
187					}
188
189					if( columnX < 0 ){
190						resetPosition();
191						fixedPositionLeft();
192					}
193				}
194				function updateParams(){
195					columnW = $column.outerWidth();
196					columnX = $column.offset().left;
197					windowW = $(window).width();
198				}
199				function resizer(){
200					var delay;
201					window.clearTimeout(delay);
202					delay = window.setTimeout(function() {
203						setup();
204					}, 200);
205				}
206				function fixedPositionRight(){
207					var newPosX = ( windowW - columnW ) - $column.offset().left;
208					$column.css({'left' : newPosX, 'right' : '' });
209				}
210				function fixedPositionLeft(){
211					var newPosX = - $column.offset().left;
212					$column.css({'left' : newPosX, 'right' : '' });
213				}
214				function resetPosition(){
215					$column.css({'left' : '', 'right' : ''});
216				}
217			});
218		}
219	};
220
221	// SVG Animation
222	GRVE.svgAnimation = {
223		init : function(){
224			if(bodyLoader){
225				return false;
226			}
227			var $svg = $('.grve-svg-icon');
228			$svg.each(function(){
229				var $icon = $(this),
230					duration = $icon.data('duration'),
231					id = $icon.attr('id'),
232					file = $icon.data('file'),
233					myVivus,
234					parentDelay = 0;
235
236					if( $icon.parents('.grve-element').hasClass('grve-animated-item') ){
237						parentDelay = $icon.parents('.grve-element').data('delay');
238					}
239
240					$icon.appear(function() {
241						setTimeout(function () {
242							myVivus = new Vivus( id, {
243								duration : duration,
244								file : file,
245								type: 'async',
246								start : 'inViewport'
247							});
248						}, parentDelay);
249					},{accX: 0, accY: 0});
250			});
251		}
252	};
253
254	// # Safe Button Area
255	// ============================================================================= //
256	GRVE.safeBtnArea = {
257		init : function(){
258
259			var $safeButton = $('.grve-safe-button'),
260				$area = $('#grve-safebutton-area'),
261				$logo = $area.find('.grve-logo'),
262				$closeBtn = $area.find('.grve-close-button'),
263				$themeContent = $('#grve-theme-content'),
264				$link = $area.find('a[href*="#"]:not( [href="#"] )'),
265				openArea = false;
266
267			$safeButton.on('click',function(e){
268				e.preventDefault();
269				animateMask();
270			});
271
272			$closeBtn.on('click',function(e){
273				e.preventDefault();
274				animateMask();
275			});
276
277
278			// For One Page
279			$link.on('click',function(e){
280				var target = $(this.hash),
281					targetHash = this.hash,
282					dataValue = this.hash.replace('#','');
283				if ( target.length && ( target.hasClass('grve-section') || target.hasClass('grve-bookmark') || target.hasClass('grve-tab-content') || target.hasClass('grve-accordion-content') ) ) {
284					e.preventDefault();
285					animateMask();
286				}
287			});
288
289
290			var $maskWrapper = $('.grve-mask-wrapper');
291			if( $maskWrapper.length ) {
292				var nmbLayers = $maskWrapper.data('layers'),
293					colors = $maskWrapper.data('mask-colors').split(','),
294					layers = false,
295					animation = false,
296					strHTML = '';
297				$logo = $maskWrapper.find('.grve-safebutton-logo');
298				addLayers();
299			}
300
301			function addLayers(){
302				for(var i = 0; i < nmbLayers; ++i) {
303					var color = colors instanceof Array && colors[i] ? colors[i] : colors[0];
304					strHTML += '<div class="grve-mask-layer grve-layer-' + (i+1) + '" style="background-color:' + color + ';"></div>';
305				}
306				$(strHTML).appendTo( $maskWrapper );
307				layers = true;
308			}
309
310			function animateMask(){
311				if(layers && !animation) {
312					animation = true;
313					$maskWrapper.addClass('grve-layer-animate');
314					var $animLayers = $('.grve-mask-layer'),
315						layersLength = nmbLayers-1,
316						delay = 1500 * 0.375,
317						smallDelay;
318
319					toggleLogo(true);
320					onEndAnimation($animLayers[layersLength], onEnd);
321					window.clearTimeout(smallDelay);
322					smallDelay = window.setTimeout(onBeforeEnd, delay);
323				}
324			}
325
326			var support = { animations : (typeof Modernizr === 'undefined' ? true : Modernizr.cssanimations) },
327				animEndEventNames = { 'WebkitAnimation' : 'webkitAnimationEnd', 'OAnimation' : 'oAnimationEnd', 'msAnimation' : 'MSAnimationEnd', 'animation' : 'animationend' },
328				animEndEventName = animEndEventNames[ (typeof Modernizr === 'undefined' ? 'animation' : Modernizr.prefixed( 'animation' )) ];
329
330			function onEndAnimation(el, callback){
331				var onEndCallbackFn = function( ev ) {
332					if( support.animations ) {
333						if( ev.target != this ) return;
334						$(this).off( animEndEventName, onEndCallbackFn );
335					}
336					if( callback && typeof callback === 'function' ) { callback.call(); }
337				};
338				if( support.animations ) {
339					$(el).on( animEndEventName, onEndCallbackFn );
340				}
341				else {
342					onEndCallbackFn();
343				}
344			}
345
346			function toggleLogo(show){
347				if($logo.length){
348					if(show) {
349						$logo.addClass('show');
350					} else {
351						$logo.removeClass('show');
352					}
353				}
354			}
355			function onEnd() {
356				$maskWrapper.removeClass('grve-layer-animate');
357				toggleLogo(false);
358				animation = false;
359			}
360
361			function onBeforeEnd() {
362				if( !openArea ){
363					$area.addClass('grve-show-area');
364					$logo.addClass('grve-show');
365					$('html, body').scrollTop(0);
366					$('body').addClass('grve-open-safebutton-area');
367					$themeContent.css({'visibility':'hidden', 'height' : 0, 'overflow':'hidden' });
368					openArea = true;
369				} else {
370					$area.removeClass('grve-show-area');
371					$logo.removeClass('grve-show');
372					$('html, body').scrollTop(0);
373					$('body').removeClass('grve-open-safebutton-area');
374					$themeContent.css({'visibility':'', 'height' : '', 'overflow':'' });
375					openArea = false;
376					$("#grve-header").removeClass('grve-sticky-animate grve-scroll-down grve-scroll-up');
377					// Hide Back to top
378					$('.grve-back-top').removeClass('show').removeAttr("style");
379				}
380				GRVE.reCall.init();
381			}
382		}
383	};
384
385	// # Content Height with Sidebar
386	// ============================================================================= //
387	GRVE.commentsFormToggle = {
388		init: function(){
389			var $btn = $('#reply-title'),
390				$form = $('#commentform');
391
392			$btn.on('click',function(){
393				if( $(this).hasClass('open') ){
394					$form.slideUp();
395					$(this).removeClass('open');
396				} else {
397					$form.slideDown();
398					$(this).addClass('open');
399				}
400				btnGoToTop( $(this) );
401			});
402
403			function btnGoToTop( btn ){
404				var $this = btn,
405					btnTop = $this.offset().top,
406					headerHeight = $('#grve-header').length && $('#grve-header').data('sticky') != 'none' ? $('#grve-main-header').outerHeight() : 0,
407					offset       = wpBarHeight + headerHeight;
408				if( btnTop > 0 ){
409					$('html, body').delay(300).animate({
410						scrollTop: btnTop - offset
411					}, 900, 'easeInOutCubic');
412					return false;
413				}
414			}
415		}
416	};
417
418	// # Sticky Header
419	// ============================================================================= //
420	GRVE.stickyHeaderTypes = {
421		init : function(){
422			var $header = $('#grve-header'),
423				$stickyHeader = $header.find('#grve-main-header'),
424				stickyHeader = $stickyHeader.hasClass('grve-header-logo-top') ? '#grve-bottom-header' : '#grve-main-header',
425				stickyType = $header.data('sticky'),
426				stickyDevice = $header.data('devices-sticky'),
427				responsiveThreshold = parseInt(movedo_grve_main_data.responsive_thershold) - 1;
428
429			if( stickyType === 'simple' ) {
430				GRVE.stickyHeader.init({
431					header: '#grve-header',
432					stickyHeader : '#grve-main-header',
433					headerOfsset : false,
434					scrollDirection : false,
435					responsive : [responsiveThreshold,6000]
436				});
437			}
438
439			if( stickyType === 'shrink') {
440				GRVE.stickyHeader.init({
441					header: '#grve-header',
442					stickyHeader : '#grve-main-header',
443					headerOfsset : false,
444					scrollDirection : false,
445					responsive : [responsiveThreshold,6000]
446				});
447			}
448
449			if( stickyType === 'advanced') {
450				GRVE.stickyHeader.init({
451					header: '#grve-header',
452					stickyHeader : '#grve-main-header',
453					headerOfsset : true,
454					stickyTopHeader : true,
455					scrollDirection : true,
456					responsive : [responsiveThreshold,6000]
457				});
458			}
459
460			if( stickyType === 'movedo') {
461				GRVE.stickyHeader.init({
462					header : '#grve-header',
463					stickyHeader : '#grve-movedo-sticky-header',
464					headerOfsset : true,
465					stickyTopHeader : false,
466					scrollDirection : true,
467					responsive : [responsiveThreshold,6000]
468				});
469			}
470
471			if( stickyDevice === 'yes' ) {
472				GRVE.stickyHeader.init({
473					header : '#grve-responsive-header',
474					stickyHeader : '#grve-main-responsive-header',
475					headerOfsset : false,
476					stickyTopHeader : false,
477					scrollDirection : false,
478					responsive: [0,responsiveThreshold + 1]
479				});
480			}
481		}
482	};
483
484	// # Simple Sticky Header
485	// ============================================================================= //
486	var goToTop = false;
487	GRVE.stickyHeader = {
488		config : {
489			header: '#grve-header',
490			stickyHeader : '#grve-main-header',
491			stickyTopBar : '#grve-top-bar.grve-sticky-topbar .grve-wrapper',
492			headerOfsset : false,
493			stickyTopHeader : false,
494			scrollDirection : false,
495			responsive : [1023,6000]
496		},
497		init : function(settings){
498
499			$.extend(this.config, settings);
500
501			var $header = $(this.config.header),
502				$headerSticky = $(this.config.stickyHeader),
503				$topBarSticky = $(this.config.stickyTopBar),
504				headerOfsset = this.config.headerOfsset,
505				stickyTopHeader = this.config.stickyTopHeader,
506				scrollDir = this.config.scrollDirection,
507				minWidth = this.config.responsive[0],
508				maxWidth = this.config.responsive[1],
509				lastScroll = 0,
510				tolerance = { up : 0, down : 0 },
511				frameSize = 0,
512				delay, headerH, topbarH, windowW, headerT, offset, topPosition, wpBarHeight;
513
514			if( !$header ) return;
515			setup();
516
517			if( !isMobile.any() ) {
518				$(window).on('resize', resizer);
519			} else {
520				tolerance = { up : 6, down : 5 };
521				$(window).on('orientationchange', resizer);
522			}
523
524			function setup(){
525				resetParams();
526				updateParams();
527				if (windowW + scrollBarWidth > minWidth &&  windowW + scrollBarWidth < maxWidth) {
528					update();
529					$(window).on('scroll.stickyHeader', update);
530				} else {
531					$(window).off('scroll.stickyHeader', update);
532				}
533			}
534			function resetParams(){
535				removeFixedHeader();
536			}
537			function updateParams(){
538				wpBarHeight = $('body').hasClass('admin-bar') && $(window).width() > 783 ? 32 : 0;
539				wpBarHeight = $('body').hasClass('admin-bar') && $(window).width() > 600  && $(window).width() < 783 ? 46 : wpBarHeight;
540				headerH = $header.outerHeight();
541				windowW = $(window).width();
542				frameSize = $('body').hasClass('grve-framed') && windowW + scrollBarWidth > tabletPortrait ? $('#grve-frames').data('frame-size') : 0;
543				headerT = getOffset( $header );
544				topbarH = $('#grve-top-bar').length && ( $('#grve-top-bar').hasClass('grve-sticky-topbar') || $('#grve-top-bar').hasClass('grve-device-sticky-topbar') ) ? $('#grve-top-bar').outerHeight() : 0;
545				offset  = !headerOfsset ? headerT - topbarH : headerT + headerH;
546				offset  = Math.round(offset);
547				topPosition = !stickyTopHeader ? topbarH : -(headerH - topbarH);
548			}
549			function resizer(){
550				window.clearTimeout(delay);
551				delay = window.setTimeout(function() {
552					setup();
553				}, 200);
554			}
555			function getOffset(el){
556				return el.offset().top - frameSize - wpBarHeight;
557			}
558			function removeFixedTopBar(){
559				$('#grve-top-bar').removeClass('grve-fixed');
560				$header.css({ 'top' : '' });
561				$topBarSticky.css({ 'top' : '' });
562			}
563			function addFixedTopBar(){
564				$('#grve-top-bar').css({'height' : topbarH }).addClass('grve-fixed');
565				$topBarSticky.css({ 'top' : frameSize + wpBarHeight });
566			}
567			function removeFixedHeader(){
568				$header.removeClass('grve-fixed').css({ 'top' : '' });
569				$headerSticky.css({ 'top' : '' });
570				$('#grve-top-bar').removeClass('grve-fixed').css({ 'height' : '' });
571			}
572			function addFixedHeader(){
573				$header.addClass('grve-fixed');
574				$headerSticky.css({ 'top' : topPosition + frameSize + wpBarHeight });
575			}
576			function addSticky(){
577				$header.addClass('grve-sticky-header grve-sticky-animate');
578			}
579			function removeSticky(){
580				$header.removeClass('grve-sticky-header grve-scroll-up');
581			}
582			function addScrollUp(){
583				$header.addClass('grve-scroll-up').removeClass('grve-scroll-down');
584			}
585			function addScrollDown(){
586				$header.addClass('grve-scroll-down').removeClass('grve-scroll-up');
587			}
588			function toleranceExceeded(scroll, direction) {
589			  return Math.abs(scroll - lastScroll) >= tolerance[direction];
590			}
591			function shouldUnpin(scroll, toleranceExceed, sticky){
592				var scrollingDown = scroll > lastScroll;
593				return scrollingDown && toleranceExceed && sticky;
594			}
595			function shouldPin(scroll, toleranceExceed, sticky){
596				  var scrollingUp  = scroll < lastScroll;
597				return scrollingUp && toleranceExceed && sticky;
598			}
599
600			function update(){
601				var scroll = $(window).scrollTop(),
602					scrollDirection = scroll > lastScroll ? 'down' : 'up',
603					toleranceExceed = toleranceExceeded(scroll, scrollDirection),
604					sticky = false;
605
606				if( scroll < 0 || goToTop ){
607					return;
608				}
609
610				if (scroll >= offset) {
611					addFixedHeader();
612				} else {
613					removeFixedHeader();
614				}
615
616				if (scroll >= 0 ) {
617					addFixedTopBar();
618				} else {
619					removeFixedTopBar();
620				}
621
622				if (scroll > offset) {
623					addSticky();
624					sticky = true;
625				} else {
626					removeSticky();
627					sticky = false;
628				}
629
630				if(shouldUnpin(scroll, toleranceExceed, sticky) && scrollDir) {
631					addScrollDown();
632				}
633				else if(shouldPin(scroll, toleranceExceed, sticky) && scrollDir) {
634					addScrollUp();
635				}
636
637				lastScroll = scroll;
638			}
639
640		}
641	};
642
643	// # Leader Post Size
644	// ============================================================================= //
645	GRVE.leaderPostSize = {
646		init : function(){
647			var $leaderElement = $('.grve-blog-leader.grve-layout-1.grve-movedo-style');
648
649			if( !$leaderElement.length ) return;
650
651			var windowWidth,
652				maxHeight,
653				leaderHeight;
654
655			$leaderElement.each(function(){
656				var $this = $(this),
657					$leaderPost = $this.find('.grve-post-leader'),
658					resizing  = false;
659
660
661				resetHeight();
662				$(window).smartresize(resetHeight);
663
664				function resetHeight(){
665					if(!resizing){
666						resizing  = true;
667
668						$leaderPost.css({
669							'height' : ''
670						});
671
672						updateParams();
673					}
674				}
675
676				function updateParams() {
677					windowWidth = $(window).width();
678
679					$this.imagesLoaded('always',function(){
680						maxHeight = $this.outerHeight();
681						leaderHeight = $leaderPost.outerHeight();
682
683						setLeaderHeight();
684					});
685				}
686
687				function setLeaderHeight(){
688					if( maxHeight > leaderHeight && windowWidth + scrollBarWidth > tabletPortrait ){
689						$leaderPost.css({
690							'height' : maxHeight,
691							'visibility' : 'visible'
692						});
693					} else {
694						$leaderPost.css({
695							'visibility' : 'visible'
696						});
697					}
698
699					resizing = false;
700				}
701			});
702		}
703	};
704
705	// # Anchor Sticky
706	// ============================================================================= //
707	GRVE.anchorSticky = {
708		init : function(){
709			var $anchor = $('.grve-anchor-menu'),
710				delay;
711			if( $anchor.length ){
712
713				this.checkDevice();
714				this.update();
715
716				$(window).on('scroll', GRVE.anchorSticky.update);
717				if( !isMobile.any() ) {
718					$(window).on("resize",resizer);
719				} else {
720					$(window).on("orientationchange",resizer);
721				}
722			}
723
724			function resizer(){
725				window.clearTimeout(delay);
726				delay = window.setTimeout(function() {
727					GRVE.anchorSticky.checkDevice();
728				}, 300);
729			}
730		},
731		checkDevice : function(){
732			GRVE.anchorSticky.device = false;
733			var $anchor = $('.grve-anchor-menu');
734			if ( $anchor.hasClass('grve-anchor-responsive-layout') ) {
735				if( $(window).width() + scrollBarWidth < tabletPortrait ) {
736					GRVE.anchorSticky.device = true;
737					$anchor.addClass('grve-anchor-responsive');
738				} else {
739					$anchor.removeClass('grve-anchor-responsive');
740				}
741			}
742
743			GRVE.anchorSticky.resetAnchor();
744			GRVE.anchorSticky.updateParams();
745		},
746		resetAnchor : function(){
747			var $anchor = $('.grve-anchor-menu'),
748				$anchorWrapper = $anchor.find('.grve-anchor-wrapper');
749
750			$anchorWrapper
751				.removeClass('grve-sticky grve-go-up grve-go-down')
752				.css( GRVE.anchorSticky.doTranslate(0) );
753
754			GRVE.anchorSticky.topOffset = 0;
755			GRVE.anchorSticky.topPos = 0;
756			GRVE.anchorSticky.mLogoW = 0;
757			GRVE.anchorSticky.mElementsW = 0;
758		},
759		updateParams : function(){
760			var $anchor = $('.grve-anchor-menu'),
761				$header = $('#grve-header'),
762				stickyType = $header.data('sticky'),
763				headerH = $header.outerHeight(),
764				anchorT = $anchor.offset().top,
765				topBarH = $('#grve-top-bar').length && stickyType != 'none' ? $('#grve-top-bar').outerHeight() : 0,
766				frameSize = $('#grve-frames').length && !GRVE.anchorSticky.device ? $('#grve-frames').data('frame-size') : 0,
767				$mLogo = $('#grve-movedo-sticky-header .grve-logo'),
768				$mElements = $('#grve-movedo-sticky-header .grve-header-elements-wrapper');
769
770			GRVE.anchorSticky.topOffset = anchorT - topBarH - frameSize - wpBarHeight;
771			GRVE.anchorSticky.topPos = topBarH + frameSize + wpBarHeight;
772			GRVE.anchorSticky.mLogoW = $mLogo.length ? $mLogo.outerWidth() + frameSize : 0;
773			GRVE.anchorSticky.mElementsW = $mElements.length ? $mElements.outerWidth() + frameSize : 0;
774
775		},
776		getHeaderH : function(){
777			var headerH = 0,
778				$header = $('#grve-header'),
779				device = GRVE.anchorSticky.device;
780
781			if( !device ){
782				var $mainHeader = $('#grve-main-header'),
783					stickyType = $header.data('sticky');
784				if( stickyType != 'none' && stickyType != 'advanced' && stickyType != 'movedo' ) {
785					if( $header.hasClass('grve-sticky-header') ) {
786						headerH = $header.data('sticky-height');
787					} else {
788						headerH = $header.outerHeight();
789					}
790				}
791			} else {
792				var $mainHeader = $('#grve-responsive-header'),
793					stickyType = $header.data('devices-sticky');
794				if( stickyType == 'yes' ) {
795					headerH = $header.data('devices-sticky-height');
796				}
797			}
798
799			return headerH;
800
801		},
802		update : function(){
803			var $anchor = $('.grve-anchor-menu'),
804				$header = $('#grve-header'),
805				$anchorWrapper = $anchor.find('.grve-anchor-wrapper'),
806				stickyType = $header.data('sticky'),
807				device = GRVE.anchorSticky.device;
808
809			var scroll = $(window).scrollTop(),
810				topOffset = GRVE.anchorSticky.topOffset - GRVE.anchorSticky.getHeaderH(),
811				topPos = GRVE.anchorSticky.topPos + GRVE.anchorSticky.getHeaderH(),
812				positionY = $header.data('sticky-height'),
813				sticky = false;
814
815			if( scroll >= topOffset ){
816				sticky = true;
817				$anchorWrapper
818					.addClass('grve-sticky')
819					.css({'top' : topPos});
820			} else {
821				sticky = false;
822				$anchorWrapper
823					.removeClass('grve-sticky')
824					.css({'top' : ''});
825			}
826
827			if( !device ){
828				if( stickyType == 'movedo' ){
829					GRVE.anchorSticky.movedoAnchor(sticky);
830				}
831
832				if(sticky && $header.hasClass('grve-scroll-up') ){
833					$anchorWrapper
834						.addClass('grve-go-down')
835						.removeClass('grve-go-up')
836						.css( GRVE.anchorSticky.doTranslate(positionY) );
837				} else if(sticky && $header.hasClass('grve-scroll-down') ){
838					$anchorWrapper
839						.addClass('grve-go-up')
840						.removeClass('grve-go-down')
841						.css( GRVE.anchorSticky.doTranslate(0) );
842				} else {
843					$anchorWrapper
844						.removeClass('grve-go-up')
845						.removeClass('grve-go-down')
846						.css( GRVE.anchorSticky.doTranslate(0) );
847				}
848			}
849		},
850		doTranslate : function(value){
851			return {
852				'-webkit-transform' : 'translate3d(0px, ' + value + 'px, 0px) translateZ(0)',
853				'-moz-transform'    : 'translate3d(0px, ' + value + 'px, 0px) translateZ(0)',
854				'-ms-transform'     : 'translate3d(0px, ' + value + 'px, 0px) translateZ(0)',
855				'-o-transform'      : 'translate3d(0px, ' + value + 'px, 0px) translateZ(0)',
856				'transform'         : 'translate3d(0px, ' + value + 'px, 0px) translateZ(0)'
857			};
858		},
859		movedoAnchor : function(sticky){
860			var $anchor = $('.grve-anchor-menu'),
861				$header = $('#grve-header'),
862				$anchorWrapper = $anchor.find('.grve-anchor-wrapper'),
863				leftPos = $('body').hasClass('grve-boxed') ? 'auto' : GRVE.anchorSticky.mLogoW + 2,
864				rightPos = $('body').hasClass('grve-boxed') ? 'auto' : GRVE.anchorSticky.mElementsW + 2,
865				size = $('body').hasClass('grve-boxed') ? '' : 'auto',
866				headerH = $header.data('sticky-height');
867
868			if( sticky ) {
869				$anchorWrapper.css({
870					'line-height' : headerH - 2 +'px',
871					'left' : leftPos,
872					'right' : rightPos,
873					'width' : size,
874					'z-index' : 9999
875				}).addClass('grve-movedo-anchor');
876			}
877			if( sticky && $header.hasClass('grve-scroll-up') ) {
878				$anchorWrapper.css({
879					'line-height' : '',
880					'left' : '',
881					'right' : '',
882					'width' : '',
883					'z-index' : ''
884				});
885			}
886		}
887	};
888	// # Menu Slide or Toggle
889	// ============================================================================= //
890	GRVE.slideToggleMenu = {
891
892		init: function( parrent, element ){
893
894			if( !$(element).length ) return;
895
896			var $menu       = $(element),
897				$menuParent = $(parrent),
898				$menuItem   = $menu.find('li.menu-item-has-children > a'),
899				menuType    = $menuParent.hasClass('grve-slide-menu') ? 'slide' : 'toggle',
900				$arrow      = $('<i class="grve-arrow"></i>'),
901				$goBack     = $('<li class="grve-goback"><a href="#" aria-label="' + movedo_grve_main_data.string_back_to_top + '"><i class="grve-arrow"></i></a></li>');
902
903
904
905			if( menuType === 'slide' ) {
906				// Add Arrows
907				$arrow.appendTo( $menuItem.parent() );
908				// Add Go Back Button for Slide Menu
909				$goBack.prependTo( $menuItem.parent().find('>ul') );
910			} else {
911				// Add Arrows
912				$menuItem.wrap('<div class="grve-toggle-menu-item-wrapper"></div>');
913				$arrow.appendTo( $menuItem.parent() );
914				$menuItem   = $menu.find('li.menu-item-has-children .grve-toggle-menu-item-wrapper > a');
915			}
916
917			$menuItem.on('tap click',function(e){
918				var $this = $(this),
919					link  = $this.attr('href');
920
921				if( link === '#' && menuType == 'toggle' ) {
922					e.preventDefault();
923					if( !$this.parent().hasClass('open') ) {
924						$this.parent().addClass('open');
925						toggle( $this.parent(), false );
926					} else if( $this.parent().hasClass('open') ) {
927						toggle( $this.parent(), true );
928						$this.parent().removeClass('open');
929					}
930				} else if( link === '#' && menuType == 'slide' ) {
931					e.preventDefault();
932					var listLevel  = $this.parents('ul').length,
933						$firstItem = $this.parent().find('ul').first(),
934						menuOffset = $menu.offset().top,
935						offset     = $this.offset().top,
936						title      = $this.html();
937
938						appendTitle( title, $firstItem );
939
940					$firstItem.addClass('show').css({ 'top' : - ( offset - menuOffset ) });
941					var firstItemH = $firstItem.outerHeight();
942
943					if( $('body').hasClass('rtl') ) {
944						animRightMenu( firstItemH, listLevel );
945					} else {
946						animLeftMenu( firstItemH, listLevel );
947					}
948				}
949
950			});
951
952			if( menuType === 'toggle' ) {
953				var $arrowBtn = $menuItem.parent().find('.grve-arrow');
954				$arrowBtn.on('click',function(){
955					var $this = $(this);
956					if( !$this.parent().hasClass('open') ) {
957						$this.parent().addClass('open');
958						toggle( $this.parent(), false );
959					} else if( $this.parent().hasClass('open') ) {
960						toggle( $this.parent(), true );
961						$this.parent().removeClass('open');
962					}
963
964				});
965
966			} else if( menuType === 'slide' ) {
967				var $arrowBtn = $menuItem.parent().find('.grve-arrow');
968				$arrowBtn.on('click',function(){
969					var $this = $(this),
970						listLevel  = $this.parents('ul').length,
971						$firstItem = $this.parent().find('ul').first(),
972						menuOffset = $menu.offset().top,
973						offset     = $this.offset().top,
974						title      = $this.parent().find('a').first().html();
975
976					appendTitle( title, $firstItem );
977
978					$firstItem.addClass('show').css({ 'top' : - ( offset - menuOffset ) });
979					var firstItemH = $firstItem.outerHeight();
980
981					if( $('body').hasClass('rtl') ) {
982						animRightMenu( firstItemH, listLevel );
983					} else {
984						animLeftMenu( firstItemH, listLevel );
985					}
986
987				});
988			}
989
990			$('li.grve-goback a').on('click', function(e) {
991				e.preventDefault();
992				var listLevel  = $(this).parents('ul ul').length - 1,
993					$firstItem = $(this).closest('.sub-menu'),
994					firstItemH = $firstItem.closest('.menu-item-has-children').closest('ul').height();
995
996				setTimeout(function(){
997					$firstItem.removeClass('show');
998				},300);
999				if( $('body').hasClass('rtl') ) {
1000					animRightMenu( firstItemH, listLevel );
1001				} else {
1002					animLeftMenu( firstItemH, listLevel );
1003				}
1004			});
1005
1006			function toggle( $this, open ){
1007				var $subMenu = $this.parent().find('>ul');
1008				if( open ) {
1009					$subMenu.slideUp(200);
1010				} else {
1011					$subMenu.slideDown(200);
1012				}
1013			}
1014
1015			function animLeftMenu( height, listLevel ) {
1016				$menu.parent().height(height);
1017				$menu.css('transform', 'translate3d(' + - listLevel * 100 + '%,0,0)');
1018			}
1019
1020			function animRightMenu( height, listLevel ) {
1021				$menu.parent().height(height);
1022				$menu.css('transform', 'translate3d(' + listLevel * 100 + '%,0,0)');
1023			}
1024
1025			function appendTitle( title, list ){
1026				if( list.find('.grve-goback .grve-item').length ) return;
1027				$(title).appendTo( list.find('> .grve-goback a') );
1028			}
1029		}
1030
1031	};
1032
1033	// # Sticky Sidebar Widget
1034	// ============================================================================= //
1035	GRVE.stickySidebarWidget = {
1036		init: function(){
1037
1038			var $stickyWidget = $('#grve-content .grve-sticky-widget'),
1039				sidebarWidget = false;
1040
1041			$stickyWidget.each(function(){
1042				var $this = $(this);
1043
1044				if( $this.length > 0 ) {
1045
1046					if( $('.grve-sticky-widget').parent().parent().is('#grve-sidebar') ) {
1047						sidebarWidget = true;
1048					}
1049
1050					if( sidebarWidget && $('#grve-sidebar').hasClass('grve-fixed-sidebar') ) return;
1051
1052					var $content         = sidebarWidget ? $('#grve-main-content .grve-main-content-wrapper') : $this.parents('.grve-row'),
1053						$sidebar         = $this.parent(),
1054						headerHeight     = $('#grve-header').length && $('#grve-header').data('sticky') != 'none' ? $('#grve-header').data('sticky-height') : 0,
1055						anchorHeight     = $('.grve-anchor-menu').length ? $('.grve-anchor-menu').outerHeight() : 0,
1056						topOffset        = headerHeight + anchorHeight + 40;
1057
1058					var windowWidth,sidebarWidth,sidebarHeight,contentTop,contentPadding,sidebarTop;
1059
1060					var scrolling        = false,
1061						sidebarAnimation = false,
1062						resizing         = false;
1063
1064					updateParams();
1065
1066					if( windowWidth + scrollBarWidth > tabletPortrait ) {
1067						$(window).on('scroll', checkSidebar);
1068					}
1069					$(window).smartresize(resetScroll);
1070
1071				}
1072
1073				function checkSidebar() {
1074					if( !sidebarAnimation ) {
1075						sidebarAnimation = true;
1076						updateSidebarPosition();
1077					}
1078				}
1079
1080				function resetScroll() {
1081					if( !resizing ) {
1082						resizing = true;
1083						$sidebar.removeClass('fixed').attr('style', '');
1084						updateParams();
1085					}
1086				}
1087
1088				function updateParams() {
1089					windowWidth    = $(window).width();
1090					sidebarWidth   = $sidebar.width();
1091					sidebarHeight  = $sidebar.height();
1092					contentTop     = $content.offset().top;
1093					contentPadding = parseInt( $content.css('padding-top') );
1094					sidebarTop     = $this.offset().top;
1095
1096					$(window).off('scroll', checkSidebar);
1097
1098					if( windowWidth + scrollBarWidth > tabletPortrait ) {
1099						$(window).on('scroll', checkSidebar);
1100					}
1101					resizing = false;
1102				}
1103
1104				function updateSidebarPosition() {
1105					var contentHeight = $content.height(),
1106						scrollTop     = $(window).scrollTop(),
1107						topPosition   = sidebarTop - contentTop - topOffset - contentPadding;
1108
1109					if( scrollTop < sidebarTop - topOffset ) {
1110						$sidebar.removeClass('fixed').attr('style', '');
1111					} else if( scrollTop >= sidebarTop - topOffset && scrollTop < sidebarTop + contentHeight - sidebarHeight - topOffset ) {
1112						$sidebar.addClass('fixed').css({ 'top' : - topPosition, 'position' : 'fixed', 'width' : sidebarWidth });
1113					} else {
1114						if( $sidebar.hasClass('fixed') ) {
1115							$sidebar.removeClass('fixed').css({ 'top' : contentHeight - sidebarHeight + 'px', 'position' : 'relative' });
1116						}
1117					}
1118					sidebarAnimation =  false;
1119				}
1120			});
1121		}
1122	};
1123
1124	// # Sticky Sidebar
1125	// ============================================================================= //
1126	GRVE.stickySidebar = {
1127		init: function(){
1128
1129			var $sidebar = $('#grve-sidebar');
1130			if( $sidebar.length > 0 && $sidebar.hasClass('grve-fixed-sidebar') ) {
1131
1132				var $content         = $('#grve-main-content .grve-main-content-wrapper'),
1133					$sidebarWrapper  = $sidebar.find('.grve-wrapper'),
1134					headerHeight     = $('#grve-header').length && $('#grve-header').data('sticky') != 'none' ? $('#grve-header').data('sticky-height') : 0,
1135					anchorHeight     = $('.grve-anchor-menu').length ? $('.grve-anchor-menu').outerHeight() : 0,
1136					topOffset        = headerHeight + anchorHeight + 100,
1137					bottomOffset     = 0;
1138
1139				var windowWidth,sidebarWidth,sidebarHeight,contentPadding,sidebarTop;
1140
1141				var scrolling        = false,
1142					sidebarAnimation = false,
1143					resizing         = false;
1144
1145				updateParams();
1146
1147				if( windowWidth + scrollBarWidth > tabletPortrait ) {
1148					$(window).on('scroll', checkSidebar);
1149				}
1150
1151				$(window).smartresize(resetScroll);
1152			}
1153
1154			function checkSidebar() {
1155				if( !sidebarAnimation ) {
1156					sidebarAnimation = true;
1157					updateSidebarPosition();
1158				}
1159			}
1160
1161			function resetScroll() {
1162				if( !resizing ) {
1163					resizing = true;
1164					$sidebarWrapper.removeClass('fixed').attr('style', '');
1165					updateParams();
1166				}
1167			}
1168
1169			function updateParams() {
1170				windowWidth    = $(window).width();
1171				sidebarWidth   = $sidebar.width();
1172				sidebarHeight  = $sidebar.height();
1173				contentPadding = parseInt( $content.css('padding-top') );
1174				sidebarTop     = $sidebar.offset().top;
1175
1176				if( $('.grve-navigation-bar').length ) {
1177					bottomOffset = $('.grve-navigation-bar').outerHeight() + 60;
1178				}
1179
1180				$(window).off('scroll', checkSidebar);
1181
1182				if( windowWidth + scrollBarWidth > tabletPortrait ) {
1183					checkSidebar();
1184					$(window).on('scroll', checkSidebar);
1185				}
1186
1187				$sidebar.css({
1188					'visibility' : 'visible'
1189				});
1190
1191				resizing = false;
1192			}
1193
1194			function updateSidebarPosition() {
1195				var contentHeight = $content.height(),
1196					scrollTop     = $(window).scrollTop();
1197
1198				if( scrollTop < sidebarTop - topOffset + contentPadding ) {
1199					$sidebarWrapper.removeClass('fixed').attr('style', '');
1200				} else if( scrollTop >= sidebarTop - topOffset + contentPadding && scrollTop < sidebarTop + contentHeight - sidebarHeight - topOffset + contentPadding - bottomOffset ) {
1201					$sidebarWrapper.addClass('fixed').css({ 'top' : topOffset, 'position' : 'fixed', 'width' : sidebarWidth });
1202				} else {
1203					if( $sidebarWrapper.hasClass('fixed') ) {
1204						$sidebarWrapper.removeClass('fixed').css({ 'top' : contentHeight - sidebarHeight - bottomOffset + 'px', 'position' : 'relative' });
1205					}
1206				}
1207				sidebarAnimation =  false;
1208			}
1209
1210		}
1211	};
1212
1213	// # Set Feature Section Size
1214	// ============================================================================= //
1215	GRVE.featureSize = {
1216		init: function( section ){
1217			this.$section = $(section);
1218			this.topBar = $('#grve-top-bar');
1219			this.header = $('#grve-header');
1220			this.responsiveHeader = $('#grve-responsive-header');
1221			this.frameSize = $('body').hasClass('grve-framed') ? $('#grve-frames').data('frame-size') : 0;
1222			this.updateParams();
1223			var featureHeight;
1224
1225			if( this.$section.hasClass('grve-fullscreen') ) {
1226				featureHeight = this.fullscreenSize();
1227			} else if( this.$section.hasClass('grve-custom-size') ) {
1228				featureHeight = this.customSize();
1229			}
1230		},
1231		updateParams : function(){
1232			this.windowH = $(window).height();
1233			this.topBarH = this.getTopBarHeight();
1234			this.headerH = this.getHeaderHeight();
1235		},
1236		getTopBarHeight : function(){
1237			var height = 0;
1238				if( this.topBar.length && !this.topBar.hasClass('grve-sticky-topbar') ) {
1239					height = this.topBar.outerHeight();
1240				}
1241			return height;
1242		},
1243		getHeaderHeight : function(){
1244			var height = 0;
1245
1246			if( this.header.length && this.header.is(':visible') && !this.header.hasClass('grve-overlapping') && !this.header.hasClass('grve-header-below') ) {
1247				height = this.header.outerHeight();
1248			}
1249
1250			if( this.responsiveHeader.length && this.responsiveHeader.is(':visible') && !this.header.hasClass('grve-responsive-overlapping') && !this.header.hasClass('grve-header-below') ) {
1251				height = this.responsiveHeader.outerHeight();
1252			}
1253
1254			return height;
1255		},
1256		fullscreenSize : function(){
1257			var sectionH = this.windowH - this.headerH - this.topBarH - (this.frameSize * 2);
1258			this.$section.css( 'height', sectionH).find('.grve-wrapper').css( 'height', sectionH);
1259			return sectionH;
1260		},
1261		customSize : function(){
1262			var initHeight = this.$section.data('height'),
1263				newHeight  = ((this.windowH * initHeight) / 100);
1264			if( newHeight > this.windowH ) {
1265				newHeight = this.windowH;
1266			}
1267			this.$section.css( 'height', newHeight).find('.grve-wrapper').css( 'height', newHeight);
1268			return newHeight;
1269		}
1270	};
1271
1272	// # Feature Section
1273	// ============================================================================= //
1274	GRVE.featureSection = {
1275		init : function(section){
1276			var $section = $(section),
1277				$bgImage = $section.find('.grve-bg-image'),
1278				$bgVideo = $section.find('.grve-bg-video'),
1279				$spinner = $(spinner),
1280				animateContent = false;
1281
1282			if( $bgImage.length ) {
1283				// Load Background Images
1284				loadFeatureImage();
1285				// Add Spinner
1286				if( addFeatureSpinner ) {
1287					addSpinner();
1288				}
1289			} else if( !$bgImage.length && $bgVideo.length ) {
1290				// Add Spinner
1291				if( addFeatureSpinner ) {
1292					addSpinner();
1293				} else {
1294					showFeature();
1295				}
1296			} else {
1297				// Play Animation Content
1298				featureAnimation( $section );
1299			}
1300
1301			// Load Background Images
1302			function loadFeatureImage(){
1303				var totalBgImage = $bgImage.length,
1304					waitImgDone = function() {
1305						totalBgImage--;
1306						if (!totalBgImage) {
1307							// Remove Spinner
1308							if( addFeatureSpinner ) {
1309								setTimeout(function () {
1310									removeSpinner();
1311								}, 600);
1312							} else {
1313								showFeature();
1314							}
1315						}
1316					};
1317				$bgImage.each(function () {
1318					function imageUrl(input) {
1319						return input.replace(/"/g,"").replace(/url\(|\)$/ig, "");
1320					}
1321					var image = new Image(),
1322						$that = $(this);
1323					image.src = imageUrl($that.css('background-image'));
1324					$(image).on('load',waitImgDone).on( "error", waitImgDone );
1325				});
1326			}
1327
1328			// Add Spinner
1329			function addSpinner(){
1330				$spinner.appendTo( $section );
1331				$section.addClass('grve-with-spinner');
1332			}
1333
1334			// Remove Spinner
1335			function removeSpinner(){
1336				$spinner.fadeOut(900,function(){
1337					$spinner.remove();
1338					// Show Feature Section
1339					showFeature();
1340				});
1341			}
1342
1343			// Show Feature Section
1344			function showFeature(){
1345				var $overlay   = $section.find('.grve-bg-overlay'),
1346					$content   = $section.find('.grve-content'),
1347					$bgImage   = $section.find('.grve-bg-image'),
1348					$bgVideo   = $section.find('.grve-bg-video');
1349
1350				$bgImage.addClass('show');
1351				$bgVideo.addClass('show');
1352				$overlay.addClass('show');
1353
1354				animateContent = true;
1355				if( $section.hasClass('grve-with-slider') ) {
1356					// Init Feature Slider
1357					featureSlider();
1358				} else {
1359					// Play Feature Animation
1360					featureAnimation( $section );
1361				}
1362			}
1363
1364			// Feature Slider
1365			function featureSlider(){
1366				var $slider         = $('#grve-feature-slider'),
1367					pauseHover      = $slider.attr('data-slider-pause') == 'yes' ? true : '',
1368					sliderSpeed     = parseInt( $slider.attr('data-slider-speed') ) ? parseInt( $slider.attr('data-slider-speed') ) : 6000,
1369					transition      = $slider.attr('data-slider-transition'),
1370					slidersLength   = $slider.find('.grve-slider-item').length,
1371					pagination      = $slider.attr('data-pagination') != 'no' ? true : false,
1372					$nextNav        = $slider.parent().find('.grve-carousel-next'),
1373					$prevNav        = $slider.parent().find('.grve-carousel-prev'),
1374					loop = true,
1375					animateOut      = false,
1376					animateIn       = false,
1377					stopSlider      = false;
1378
1379				// Slider Trantition
1380				if( transition != 'slide' ){
1381					animateOut = 'carousel-' + transition + '-out';
1382					animateIn = 'carousel-' + transition + '-in';
1383				}
1384				$slider.on('initialized.owl.carousel changed.owl.carousel',function(event){
1385					var current = event.item.index,
1386						$currentSlide = $(event.target).find('.grve-slider-item-wrapper').eq(current),
1387						sliderColor = $currentSlide.find('.grve-slider-item').attr('data-header-color'),
1388						color = 'grve-' + sliderColor;
1389
1390					if( !$currentSlide.length) return;
1391
1392					// Slider Animation
1393					featureAnimation( $currentSlide );
1394
1395					// Set Header Color
1396					if( !$('#grve-main-header').hasClass('grve-header-side') ) {
1397						$('#grve-main-header').removeClass('grve-light grve-dark').addClass(color);
1398					}
1399
1400					// Set Navigation Color
1401					$('#grve-feature-section .grve-carousel-navigation').removeClass('grve-light grve-dark grve-default').addClass(color);
1402					$('#grve-feature-section .owl-controls').removeClass('grve-light grve-dark grve-default').addClass(color);
1403				});
1404
1405				if ( $slider.find('.grve-slider-item').length == 1 ) {
1406					loop = false;
1407				}
1408
1409				$slider.owlCarousel({
1410					items : 1,
1411					loop : loop,
1412					autoplay : true,
1413					autoplayTimeout : sliderSpeed,
1414					autoplayHoverPause : pauseHover,
1415					smartSpeed : 500,
1416					dots : pagination,
1417					animateOut : animateOut,
1418					animateIn : animateIn,
1419					itemClass : 'grve-slider-item-wrapper'
1420				});
1421
1422				$(window).on('scroll',autoplayHandler);
1423
1424				function autoplayHandler(){
1425					var scroll = $(window).scrollTop();
1426					if( scroll > 300 && !stopSlider && featureSliderHandler ){
1427						stopSlider = true;
1428						$slider.trigger('stop.owl.autoplay');
1429					} else if( scroll < 300 && stopSlider && featureSliderHandler ) {
1430						stopSlider = false;
1431						$slider.trigger('play.owl.autoplay');
1432					}
1433				}
1434
1435				// Go to the next item
1436				$nextNav.on('click', function() {
1437					$slider.trigger('next.owl.carousel');
1438				});
1439				// Go to the previous item
1440				$prevNav.on('click', function() {
1441					$slider.trigger('prev.owl.carousel');
1442				});
1443			}
1444
1445			// Feature Animation
1446			function featureAnimation(section){
1447				var $section = section,
1448					$wrapper = $section.find('.grve-title-content-wrapper'),
1449					effect = $section.find('.grve-content').data('animation'),
1450					effectClass = 'grve-animate-' + effect,
1451					delay = 200,
1452					cnt = 0,
1453					contentItems = {
1454						graphic     : $section.find(' .grve-graphic '),
1455						subheading  : $section.find(' .grve-subheading '),
1456						title       : $section.find(' .grve-title '),
1457						description : $section.find(' .grve-description '),
1458						titleMeta   : $section.find(' .grve-title-meta-content '),
1459						button1     : $section.find(' .grve-btn-1 '),
1460						button2     : $section.find(' .grve-btn-2 '),
1461						gotoArrow   : $section.find(' #grve-goto-section-wrapper ')
1462					};
1463
1464				// Show Content
1465				$section.find('.grve-content').addClass('show');
1466
1467				if( !$wrapper.hasClass('grve-bg-none') ){
1468					contentItems = {
1469						wrapper : $wrapper,
1470						gotoArrow   : $section.find(' #grve-goto-section-wrapper ')
1471					};
1472				}
1473
1474				// Add Animation Class
1475				$.each( contentItems, function( key, item ) {
1476					$(item).removeClass('grve-animate-fade-in grve-animate-fade-in-up grve-animate-fade-in-down grve-animate-fade-in-left grve-animate-fade-in-right grve-animate-zoom-in grve-animate-zoom-out');
1477
1478					if( $(item).length ){
1479						cnt++;
1480						if( effect != 'none' ){
1481							setTimeout(function(){
1482								$(item).addClass( effectClass );
1483							},cnt * delay);
1484						}
1485					}
1486				});
1487			}
1488		}
1489	};
1490
1491	// # Feature Parallax
1492	// ============================================================================= //
1493	var featureParallaxScroll = false;
1494	GRVE.featureParallax = {
1495		init: function(){
1496			var section = $('#grve-feature-section'),
1497				scroll = false,
1498				smallDelay;
1499
1500			if( !section.hasClass('grve-bg-parallax') && !section.hasClass('grve-bg-advanced-parallax') && !section.hasClass('grve-bg-fixed-section') ) {
1501				return;
1502			}
1503
1504			// Create Parallax Wrapper
1505			section.children().not('.grve-separator-bottom').wrapAll('<div class="grve-parallax-wrapper"></div>');
1506
1507			if( section.find('video').length ){
1508				section.find('video').trigger('play');
1509			}
1510
1511			updateParallax();
1512
1513			// Add window events
1514			$(window).on('resize', function(){
1515				window.clearTimeout(smallDelay);
1516				smallDelay = window.setTimeout(function () {
1517					updateParallax();
1518				}, 100);
1519			});
1520			$(window).on('scroll', onWindowScroll);
1521
1522			function onWindowScroll(){
1523				if( window.requestAnimationFrame ) {
1524					if(!scroll){
1525						window.requestAnimationFrame( updateParallax );
1526						scroll = true;
1527					}
1528				} else {
1529					updateParallax();
1530				}
1531			}
1532
1533			function updateParallax(){
1534				var wrapper = section.find('.grve-parallax-wrapper');
1535				var parallaxType;
1536				if( section.hasClass('grve-bg-advanced-parallax') ){
1537					parallaxType = 'advanced';
1538				} else if( section.hasClass('grve-bg-fixed-section') ){
1539					parallaxType = 'fixed';
1540				} else {
1541					parallaxType = 'classic';
1542				}
1543
1544				if( inViewport( section ) ){
1545					// References
1546					var scrollTop = $( window ).scrollTop();
1547					var sectionTop = section.offset().top;
1548					var sectionW = section.outerWidth();
1549					var sectionH = section.outerHeight();
1550					var position = scrollTop * 0.2;
1551					var elementH = sectionH + sectionTop;
1552					var opacity = ( ( ( sectionH + sectionTop ) - scrollTop ) / sectionH ).toFixed(2);
1553					var scale = ( ( ( sectionH + sectionTop ) + scrollTop ) / sectionH );
1554					var content = section.find('.grve-wrapper, .grve-background-wrapper');
1555					if( tSupport ){
1556
1557						if( parallaxType == 'advanced' ) {
1558							wrapper.css({
1559								'position' : 'fixed',
1560								'top' : sectionTop,
1561								'height' : elementH,
1562								'width' : sectionW,
1563								transform: 'translate3d( 0px' + ', ' + -position + 'px' + ', 0px)',
1564								visibility: 'visible'
1565							});
1566							content.css({
1567								// 'opacity' : opacity
1568							});
1569						} else if( parallaxType == 'fixed' ) {
1570							wrapper.css({
1571								'position' : 'fixed',
1572								'top' : sectionTop,
1573								'height' : elementH,
1574								'width' : sectionW,
1575								visibility: 'visible'
1576							});
1577						} else {
1578							wrapper.css({
1579								'position' : 'relative',
1580								'height' : elementH,
1581								'width' : sectionW,
1582								transform: 'translate3d( 0px' + ', ' + position + 'px' + ', 0px)',
1583								visibility: 'visible'
1584							});
1585						}
1586					}
1587				} else {
1588					wrapper.css({
1589						'position' : 'relative'
1590					});
1591				}
1592				scroll = false;
1593			}
1594
1595			function inViewport( element ){
1596				var winTop = $( window ).scrollTop();
1597				var winBottom = winTop + $( window ).height();
1598				var elTop = element.offset().top;
1599				var elBottom = elTop + element.outerHeight();
1600				return ( winBottom >= elTop && winTop <= elBottom );
1601			}
1602
1603		}
1604	};
1605
1606	// # Woocommerce Carousel Thumb Gallery
1607	// ============================================================================= //
1608	GRVE.wooThumbCarousel = {
1609		init : function(){
1610			var $thumbs = $('#grve-product-feature-image').find('.thumbnails'),
1611				$thumbsWrapper = $thumbs.find('.grve-thumbnails-wrapper'),
1612				$thumbsInner = $thumbs.find('.grve-thumbnails-inner'),
1613				$items = $thumbs.find('.grve-thumb-item'),
1614				$arrowPrev = $('<i class="grve-icon-nav-up-small grve-arrow-prev"></i>'),
1615				$arrowNext = $('<i class="grve-icon-nav-down-small grve-arrow-next"></i>'),
1616				wrapper = false,
1617				smallDelay,
1618				wrapperH,
1619				slidesLength,
1620				cnt;
1621
1622
1623			if( !$thumbs.length || $items.length <= wooThumbCarouselItems ) {
1624				$thumbsWrapper.css({
1625					'visibility' : 'visible'
1626				});
1627				return false;
1628			}
1629
1630			setSlider();
1631			$(window).on('resize', function(){
1632				window.clearTimeout(smallDelay);
1633				smallDelay = window.setTimeout(function () {
1634					setSlider();
1635				}, 300);
1636			});
1637
1638			function addWrapper(){
1639				if( !wrapper ) {
1640					for (var i = 0, len = $items.length; i < len; i += wooThumbCarouselItems) {
1641						$items.slice(i, i + wooThumbCarouselItems).wrapAll('<div class="grve-thumb-wrapper"/>');
1642					}
1643
1644					wrapperH = $('.grve-thumb-wrapper').first().outerHeight();
1645					slidesLength = $('.grve-thumb-wrapper').length - 1;
1646
1647					$thumbsWrapper.css({
1648						'height' : wrapperH,
1649						'overflow' : 'hidden',
1650						'visibility' : 'visible'
1651					});
1652
1653					addArrows();
1654					$thumbsInner.addClass('grve-with-transition');
1655
1656					wrapper = true;
1657				}
1658			}
1659
1660			function addArrows(){
1661				$arrowPrev.appendTo( $thumbs );
1662				$arrowNext.appendTo( $thumbs );
1663				// Add Classes
1664				$arrowPrev.addClass('grve-disable-arrow');
1665				$arrowNext.removeClass('grve-disable-arrow');
1666
1667				cnt = 0;
1668				bindEvents();
1669			}
1670
1671			function moveSlide(n){
1672				$thumbsInner.css( doTranslate( n * wrapperH ) );
1673			}
1674
1675			function setSlider(){
1676				if( $(window).width() + scrollBarWidth < tabletPortrait && wrapper) {
1677					resetSlider();
1678				} else if( $(window).width() + scrollBarWidth > tabletPortrait && !wrapper) {
1679					addWrapper();
1680				}
1681			}
1682
1683			function resetSlider(){
1684				$thumbsInner.removeClass('grve-with-transition');
1685				$thumbsInner.css( doTranslate( 0 ) );
1686				$items.unwrap();
1687				$thumbsWrapper.css({
1688					'height' : '',
1689					'overflow' : 'visible',
1690					'visibility' : 'visible'
1691				});
1692
1693				$arrowPrev.remove();
1694				$arrowNext.remove();
1695
1696				wrapper = false;
1697			}
1698
1699			function bindEvents(){
1700				$arrowNext.on('click.thumb-arrows',function(){
1701					var $that = $(this);
1702					if( cnt > - slidesLength ){
1703						cnt--;
1704						moveSlide( cnt );
1705						$arrowPrev.removeClass('grve-disable-arrow');
1706					}
1707					if(cnt == -slidesLength ){
1708						$that.addClass('grve-disable-arrow');
1709					}
1710				});
1711
1712				$arrowPrev.on('click.thumb-arrows',function(){
1713					var $that = $(this);
1714					if( cnt < 0 ){
1715						cnt++;
1716						moveSlide( cnt );
1717						$arrowNext.removeClass('grve-disable-arrow');
1718					}
1719					if(cnt == 0 ){
1720						$that.addClass('grve-disable-arrow');
1721					}
1722				});
1723			}
1724
1725			function doTranslate( value ){
1726				return {
1727					'-webkit-transform' : 'translate3d(0px, ' + value + 'px, 0px) translateZ(0)',
1728					'-moz-transform'    : 'translate3d(0px, ' + value + 'px, 0px) translateZ(0)',
1729					'-ms-transform'     : 'translate3d(0px, ' + value + 'px, 0px) translateZ(0)',
1730					'-o-transform'      : 'translate3d(0px, ' + value + 'px, 0px) translateZ(0)',
1731					'transform'         : 'translate3d(0px, ' + value + 'px, 0px) translateZ(0)'
1732				};
1733			}
1734		}
1735	};
1736
1737	// # Woocommerce Products Refresh
1738	// ============================================================================= //
1739	GRVE.wooProductsLoop = {
1740		init : function(){
1741			GRVE.isotope.init();
1742			GRVE.basicElements.wooProduct();
1743			GRVE.basicElements.hovers();
1744		}
1745	};
1746
1747	// # Woocommerce Product Rating
1748	// ============================================================================= //
1749	GRVE.wooProductRating = {
1750		init : function(){
1751			if ( typeof wc_single_product_params !== 'undefined' ) {
1752				var $rating = $( '.woocommerce-Reviews #respond' ).find( '#rating' );
1753				if ( $rating.length > 0 && wc_single_product_params.review_rating_required === 'no' ) {
1754					$('.woocommerce-Reviews #respond #rating').removeAttr('required');
1755				}
1756			}
1757		}
1758	};
1759
1760	// # Page Settings
1761	// ============================================================================= //
1762	GRVE.pageSettings = {
1763
1764		init: function(){
1765			this.safeButtonAnimation();
1766			this.mainMenu();
1767			this.columnFullHeight();
1768			this.columnCustomSize();
1769			this.setClippingWrappers();
1770			this.grveModal();
1771			this.gotoFirstSection();
1772			this.bgLoader();
1773			this.imageLoader();
1774			this.fitVid();
1775			this.hiddenArea();
1776			this.backtoTop();
1777			this.animatedBg();
1778			this.onePageSettings();
1779			this.socialShareLinks();
1780			this.productImageParallax();
1781
1782			this.fixedFooter();
1783		},
1784		setClippingWrappers: function(){
1785			var $element = $('.grve-clipping-animation'),
1786				wrapper = '<div class="grve-clipping-wrapper"><div class="grve-clipping-content"></div></div>';
1787			if( isMobile.any() && !deviceAnimAppear ) {
1788				$element.removeClass('grve-clipping-animation');
1789			} else {
1790				$element.wrapInner( wrapper );
1791				$element.each(function(){
1792					var $that = $(this),
1793						$wrapper = $that.find('.grve-clipping-wrapper');
1794					if( $that.hasClass('grve-colored-clipping') ) {
1795						var color = $that.data('clipping-color'),
1796							overlay = '<div class="grve-clipping-overlay grve-bg-' + color + '"></div>';
1797						$(overlay).appendTo( $wrapper );
1798					}
1799				});
1800				this.clippingAppear();
1801			}
1802		},
1803		clippingAppear: function(){
1804			var $clippingEl = $('.grve-clipping-animation');
1805			if( bodyLoader || $('body').hasClass('page-template-template-full-page') || $('body').hasClass('page-template-template-pilling-page') ){
1806				return;
1807			}
1808			if( isMobile.any() && !deviceAnimAppear ) {
1809				$clippingEl.removeClass('grve-clipping-animation');
1810			} else {
1811				$clippingEl.each(function() {
1812					var $that = $(this),
1813						timeDelay = $that.attr('data-delay');
1814
1815					$that.appear(function() {
1816						setTimeout(function () {
1817							GRVE.pageSettings.clippingAnimated( $that );
1818						}, timeDelay);
1819					},{accX: 0, accY: -150});
1820				});
1821			}
1822		},
1823		clippingAnimated: function( $element ){
1824			var delay = 700,
1825				$overlay = $element.find( '.grve-clipping-overlay' );
1826
1827			$element.addClass('grve-clipping-animated');
1828
1829			if ( $element.hasClass('grve-colored-clipping') ) {
1830				setTimeout(function(){
1831					$element.addClass('grve-clipping-show-content');
1832				},delay);
1833
1834				delay = 1400;
1835			}
1836			setTimeout(function(){
1837				$overlay.remove();
1838				$element.removeClass('grve-clipping-animation grve-clipping-animated grve-colored-clipping grve-clipping-show-content');
1839				GRVE.basicElements.animAppear();
1840			},delay);
1841		},
1842		bodyLoader: function(){
1843			var $overflow = $('#grve-loader-overflow'),
1844				$loader   = $('.grve-spinner'),
1845				$link = $('a');
1846
1847			if( $overflow.length > 0 ){
1848				bodyLoader = true;
1849			} else {
1850				return;
1851			}
1852
1853			if(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1 || navigator.userAgent.match(/(iPod|iPhone|iPad)/)){
1854				window.onpageshow = function(event) {
1855					if (event.persisted) {
1856						$overflow.removeClass('grve-visible grve-hide');
1857						window.location.reload();
1858					}
1859				};
1860			} else if(navigator.userAgent.indexOf('Firefox') != -1) {
1861				window.onunload = function(){};
1862			}
1863
1864			if( $overflow.hasClass('grve-page-transition') ) {
1865				var exclude = ['.grve-no-transition', '.grve-toggle-modal'],
1866					comp = new RegExp(location.host);
1867				if ( $('#grve-body').hasClass( 'prdctfltr-ajax' ) ) {
1868					$('.woocommerce-pagination a').addClass('grve-no-transition');
1869				}
1870				$('a:not(' + exclude + ')').on('click',function(e){
1871					var link = this;
1872					if( comp.test(link.href) && link.href.split(/\?|#/)[0] != location.href.split(/\?|#/)[0] && link.target != '_blank' && link.href[0] != '#') {
1873						if( link.href.indexOf( '#' ) == -1 &&
1874							link.href.indexOf( 'skype:' ) == -1 &&
1875							link.href.indexOf( 'mailto:' ) == -1 &&
1876							link.href.indexOf( 'tel:' ) == -1 &&
1877							link.href.indexOf( 'jpg' ) == -1 &&
1878							link.href.indexOf( 'jpeg' ) == -1 &&
1879							link.href.indexOf( 'png' ) == -1 &&
1880							link.href.indexOf( 'gif' ) == -1 &&
1881							link.href.indexOf( 'bmp' ) == -1 &&
1882							link.href.indexOf( 'pdf' ) == -1 &&
1883							link.href.indexOf( 'zip' ) == -1 &&
1884							link.href.indexOf('add-to-cart=') == -1 ) {
1885							e.preventDefault();
1886							var newLocation = this.href;
1887							$overflow.addClass('grve-visible').removeClass('grve-hide');
1888							setTimeout(function(){
1889								window.location = newLocation;
1890							}, 600);
1891						}
1892					}
1893				});
1894			}
1895
1896			$('#grve-theme-wrapper').imagesLoaded({ background: '.grve-bg-image' })
1897			.always( function( instance ) {
1898				setTimeout(function () {
1899					if( $overflow.hasClass('grve-page-transition') ) {
1900						$overflow.removeClass('grve-visible').addClass('grve-hide');
1901						setTimeout(function(){
1902							bodyLoader = false;
1903							GRVE.basicElements.animAppear();
1904							GRVE.pageSettings.clippingAppear();
1905							GRVE.svgAnimation.init();
1906							GRVE.basicElements.counter();
1907						}, 1200);
1908					} else {
1909						$loader.fadeOut(500);
1910						$overflow.delay(500).fadeOut(700,function(){
1911							bodyLoader = false;
1912							GRVE.basicElements.animAppear();
1913							GRVE.pageSettings.clippingAppear();
1914							GRVE.svgAnimation.init();
1915							GRVE.basicElements.counter();
1916						});
1917					}
1918				}, 600);
1919			})
1920			.progress( function( instance, image ) {
1921				var result = image.isLoaded ? 'loaded' : 'broken';
1922				//console.log( 'image is ' + result + ' for ' + image.img.src );
1923			});
1924
1925		},
1926		addVideoBg: function(){
1927			$('.grve-yt-bg-video').each(function() {
1928				var $element = $(this);
1929				var url = $element.data("video-bg-url");
1930				var videoID = url.match( /[\\?&]v=([^&#]*)/ )[ 1 ];
1931				if( '' != videoID ) {
1932					insertYouTubeVideo($element, videoID );
1933				}
1934			});
1935			$('.grve-html5-bg-video').each(function() {
1936				var $element = $(this);
1937				GRVE.pageSettings.resizeVideoBgElement( $element );
1938			});
1939			function insertYouTubeVideo($element, youtubeId, counter) {
1940				if ("undefined" == typeof YT || "undefined" === typeof YT.Player) {
1941					counter = "undefined" === typeof counter ? 0 : counter;
1942					if (100 < counter) {
1943						console.warn("Too many attempts to load YouTube api");
1944						return;
1945					}
1946					setTimeout(function() {
1947						insertYouTubeVideo($element, youtubeId, counter++);
1948					}, 100);
1949					return;
1950				}
1951				var startSeconds = $element.data('video-start') != undefined ? parseInt( $element.data('video-start') ) : 0;
1952				var endSeconds = $element.data('video-end') != undefined ? parseInt( $element.data('video-end') ) : 0;
1953				var $container = $element.prepend('<div class="grve-bg-youtube-video"><div class="inner"></div></div>').find(".inner");
1954				var ytPlayer = new YT.Player($container[0], {
1955					width: "100%",
1956					height: "100%",
1957					videoId: youtubeId,
1958					playerVars: {
1959						playlist: youtubeId,
1960						iv_load_policy: 3,
1961						enablejsapi: 1,
1962						disablekb: 1,
1963						autoplay: 1,
1964						controls: 0,
1965						showinfo: 0,
1966						rel: 0,
1967						loop: 1,
1968						start: startSeconds,
1969						end: endSeconds,
1970						wmode: "transparent"
1971					},
1972					events: {
1973						'onReady': onPlayerReady,
1974						'onStateChange': onPlayerStateChange
1975					}
1976				});
1977				function onPlayerReady(event) {
1978					event.target.mute().setLoop(true);
1979				}
1980				function onPlayerStateChange(event) {
1981					if ( 0 != startSeconds || 0 != endSeconds ) {
1982						if (event.data === YT.PlayerState.ENDED) {
1983							ytPlayer.loadVideoById({
1984								videoId: youtubeId,
1985								startSeconds: startSeconds,
1986								endSeconds: endSeconds
1987							});
1988						}
1989					}
1990				}
1991				// Resize Video
1992				GRVE.pageSettings.resizeVideoBgElement( $element );
1993			}
1994		},
1995		resizeVideoBg: function(){
1996			$videoBg.each(function(){
1997				GRVE.pageSettings.resizeVideoBgElement( $(this) );
1998			});
1999		},
2000		resizeVideoBgElement: function( $element ){
2001			var videoEl,
2002				videoW,
2003				videoH,
2004				marginLeft,
2005				marginTop,
2006				containerW = $element.innerWidth(),
2007				containerH = $element.innerHeight(),
2008				ratio1 = 16,
2009				ratio2 = 9;
2010
2011			if (containerW / containerH < ratio1 / ratio2) {
2012				videoW = containerH * (ratio1 / ratio2);
2013				videoH = containerH;
2014				videoW += 'px';
2015				videoH += 'px';
2016			} else {
2017				videoW = containerW;
2018				videoH = containerW * (ratio2 / ratio1);
2019				videoW += 'px';
2020				videoH += 'px';
2021			}
2022			if( $element.hasClass('grve-yt-bg-video') || $element.hasClass('grve-iframe-bg-video') ) {
2023				videoEl = 'iframe';
2024			}
2025
2026			$element.find( videoEl ).css({
2027				maxWidth: '1000%',
2028				width: videoEl == 'iframe' ? videoW : '',
2029				height: videoH
2030			});
2031		},
2032		removeVideoBg: function(){
2033			$('.grve-background-wrapper').each(function () {
2034				var $wrapper = $(this),
2035					$bgImage = $wrapper.find('.grve-bg-image'),
2036					$bgVideo = $wrapper.find('.grve-bg-video'),
2037					$bgHtml5Video = $wrapper.find('.grve-html5-bg-video'),
2038					$bgYtVideo = $wrapper.find('.grve-yt-bg-video'),
2039					$bgIFrameVideo = $wrapper.find('.grve-iframe-bg-video'),
2040					$bgVideoButton = $wrapper.find('.grve-bg-video-button-device');
2041
2042				var bgVideoDevice = $bgVideo.data('videoDevice') != undefined ? $bgVideo.data('videoDevice') : 'no';
2043				if( isMobile.any() && 'no' === bgVideoDevice) {
2044					$bgVideo.remove();
2045				} else {
2046
2047					if ( $bgHtml5Video.length ) {
2048						var $videoElement = $wrapper.find('.grve-bg-video video');
2049						var canPlayVideo = false;
2050						$wrapper.find('.grve-bg-video source').each(function(){
2051							if ( $videoElement.get(0).canPlayType( $(this).attr('type') ) ) {
2052								canPlayVideo = true;
2053							}
2054						});
2055						if(canPlayVideo) {
2056							$bgImage.remove();
2057						} else {
2058							$bgVideo.remove();
2059						}
2060					}
2061					if ( $bgYtVideo.length || $bgIFrameVideo.length ) {
2062						$bgImage.remove();
2063					}
2064					if ( $bgVideoButton.length ) {
2065						$bgVideoButton.remove();
2066					}
2067				}
2068			});
2069
2070		},
2071		safeButtonAnimation: function(){
2072
2073			var boxes = [].slice.call(document.querySelectorAll('.grve-safe-btn-icon'));
2074			boxes.forEach(function(box){
2075				var box = Snap(box),
2076					point1 = box.select('.grve-btn-point-1'),
2077					point2 = box.select('.grve-btn-point-2'),
2078					point3 = box.select('.grve-btn-point-3'),
2079					point4 = box.select('.grve-btn-point-4'),
2080					point5 = box.select('.grve-btn-point-5'),
2081					point6 = box.select('.grve-btn-point-6'),
2082					point7 = box.select('.grve-btn-point-7'),
2083					point8 = box.select('.grve-btn-point-8'),
2084					point9 = box.select('.grve-btn-point-9');
2085
2086				function dotToCross(){
2087					point1.animate({
2088						x: 29,
2089						y: 16,
2090						width: 6,
2091						height: 14
2092					}, 100),
2093					point2.animate({
2094						x: 29,
2095						y: 4,
2096						width: 6,
2097						height: 12
2098					}, 100),
2099					point3.animate({
2100						x: 34,
2101						y: 29,
2102						width: 14,
2103						height: 6
2104					}, 100),
2105					 point4.animate({
2106						x: 4,
2107						y: 29,
2108						width: 12,
2109						height: 6
2110					}, 100),
2111					point5.animate({
2112						x: 29,
2113						y: 29,
2114						width: 6,
2115						height: 6
2116					}, 100),
2117					point6.animate({
2118						x: 48,
2119						y: 29,
2120						width: 12,
2121						height: 6
2122					}, 100),
2123					point7.animate({
2124						x: 16,
2125						y: 29,
2126						width: 14,
2127						height: 6
2128					}, 100),
2129					point8.animate({
2130						x: 29,
2131						y: 48,
2132						width: 6,
2133						height: 12
2134					}, 100),
2135					point9.animate({
2136						x: 29,
2137						y: 34,
2138						width: 6,
2139						height: 14
2140					}, 100);
2141				}
2142				function crossToDot(){
2143					point1.animate({
2144						x: 12,
2145						y: 12,
2146						width: 8,
2147						height: 8
2148					}, 200),
2149					point2.animate({
2150						x: 28,
2151						y: 12,
2152						width: 8,
2153						height: 8
2154					}, 200),
2155					point3.animate({
2156						x: 44,
2157						y: 12,
2158						width: 8,
2159						height: 8
2160					}, 200),
2161					point4.animate({
2162						x: 12,
2163						y: 28,
2164						width: 8,
2165						height: 8
2166					}, 200),
2167					point5.animate({
2168						x: 28,
2169						y: 28,
2170						width: 8,
2171						height: 8
2172					}, 200),
2173					point6.animate({
2174						x: 44,
2175						y: 28,
2176						width: 8,
2177						height: 8
2178					}, 200),
2179					point7.animate({
2180						x: 12,
2181						y: 44,
2182						width: 8,
2183						height: 8
2184					}, 200),
2185					point8.animate({
2186						x: 28,
2187						y: 44,
2188						width: 8,
2189						height: 8
2190					}, 200),
2191					point9.animate({
2192						x: 44,
2193						y: 44,
2194						width: 8,
2195						height: 8
2196					}, 200);
2197				}
2198
2199				$('.grve-safe-button').on('mouseenter', function() {
2200					dotToCross();
2201				});
2202
2203				$('.grve-safe-button').on('mouseleave', function() {
2204					crossToDot();
2205				});
2206			});
2207
2208		},
2209		linkGoToTop: function( element, delay, space ){
2210
2211			var $this = element,
2212				elementTop       = $this.offset().top,
2213				header           = $('#grve-header').length && $('#grve-main-header').is(":visible") ? true : false,
2214				responsiveHeader = $('#grve-responsive-header').length && $('#grve-responsive-header').is(":visible") ? true : false,
2215				headerHeight     = header && $('#grve-header').data('sticky') != 'none' ? $('#grve-main-header').outerHeight() : 0,
2216				movedoStickyH    = $('#grve-header').data('sticky') == 'movedo' && $('#grve-header').hasClass('grve-sticky-header') ? $('#grve-header').data('sticky-height') : 0,
2217				respHeaderH      = responsiveHeader && $('#grve-header').data('devices-sticky') == 'yes' ? $('#grve-responsive-header').outerHeight() : 0,
2218				topBarHeight     = $('#grve-top-bar').length ? $('#grve-top-bar').height() : 0,
2219				anchorBarHeight  = $('.grve-anchor-menu').length ? $('.grve-anchor-menu').outerHeight() : 0,
2220				delayAnim        = delay != undefined ? delay : 300,
2221				topSpace         = space != undefined ? space : 0,
2222				offset           = topBarHeight + wpBarHeight + headerHeight + movedoStickyH + respHeaderH + anchorBarHeight + topSpace;
2223
2224			if( elementTop > 0 ){
2225				$('html, body').delay(delayAnim).animate({
2226					scrollTop: elementTop - offset
2227				}, 900, 'easeInOutCubic');
2228				$("html, body").bind("scroll mousedown DOMMouseScroll mousewheel keyup", function(){
2229					$('html, body').stop();
2230				});
2231				return false;
2232			}
2233		},
2234		mainMenu: function(){
2235			var $mainMenu = $('#grve-header .grve-horizontal-menu ul.grve-menu');
2236
2237			$('.grve-main-menu').find( 'a[href="#"]').on('click',function(e){
2238				e.preventDefault();
2239			});
2240
2241			$mainMenu.superfish({
2242				popUpSelector: '.sub-menu',
2243				delay: 300,
2244				speed: 'fast',
2245				cssArrows: false,
2246				onBeforeShow: function(){
2247					var $subMenu = $(this);
2248					if( !$subMenu.length ) return;
2249					var $li = $subMenu.parent(),
2250						windowW = $(window).width(),
2251						subMenuW = $subMenu.width(),
2252						liOffsetL = $li.offset().left;
2253
2254					if( $li.hasClass('megamenu')){
2255						setTimeout(function(){
2256							setEqualMenuColumns( $li );
2257						},50);
2258					}
2259
2260					if( $li.hasClass('megamenu') && $li.css('position') == 'relative' ){
2261						if(subMenuW + liOffsetL > windowW) {
2262							var left = windowW - (subMenuW + liOffsetL);
2263							$subMenu.css({'left' : left});
2264						}
2265					}
2266					if( $('#grve-header .grve-first-level').length > 0 ){
2267						if( !$li.hasClass('grve-first-level') && !$li.hasClass('megamenu') ){
2268							var subMenuLength = $li.find('.sub-menu').length + 1,
2269								subMenuOffsetL = $li.parents('.grve-first-level').offset().left;
2270							if( (subMenuW * subMenuLength) + subMenuOffsetL > windowW) {
2271								$li.addClass('grve-invert');
2272							}
2273						}
2274					}
2275					if( $('body').hasClass('grve-boxed') && ( $li.hasClass('megamenu column-3') || $li.hasClass('megamenu column-2') ) ){
2276						var containerW = $('#grve-theme-wrapper').width(),
2277							containerL = $('#grve-theme-wrapper').offset().left,
2278							positionL = 0;
2279
2280						if( subMenuW + liOffsetL > containerW + containerL ){
2281							positionL = (containerW + containerL) - (subMenuW + liOffsetL);
2282						}
2283
2284						$subMenu.css({
2285							'left' : positionL
2286						});
2287					}
2288				},
2289				onHide: function(){
2290					var $subMenu = $(this),
2291						$li = $subMenu.parent();
2292					$li.removeClass('grve-invert');
2293				}
2294			});
2295
2296			function setEqualMenuColumns( $li ) {
2297				var $subMenu = $li.children('ul'),
2298					$column = $subMenu.children('li'),
2299					maxHeight = 0;
2300				$column.each(function(){
2301					var columnH = $(this).outerHeight();
2302					if( columnH >= maxHeight ) {
2303						maxHeight = columnH;
2304					}
2305				});
2306				$column.css({ 'height' : maxHeight });
2307			}
2308
2309		},
2310		columnFullHeight: function(){
2311			var $column = $('.grve-column-fullheight');
2312
2313			$column.each(function(){
2314				var $that = $(this),
2315					fullTabletL = $that.data('tablet-landscape-fullheight') != undefined ? false : true,
2316					fullTabletP = $that.data('tablet-portrait-fullheight') != undefined ? false : true,
2317					fullMobileL = $that.data('mobile-fullheight') != undefined ? false : true;
2318
2319				$that.columnSize({
2320					equal: false,
2321					middleContent: false,
2322					fullHeight: true,
2323					fullTabletL : fullTabletL,
2324					fullTabletP : fullTabletP,
2325					fullMobileL : fullMobileL
2326				});
2327			});
2328		},
2329		columnCustomSize: function(){
2330			var $section = $('.grve-section.grve-custom-height');
2331			$section.each(function(){
2332				var $that = $(this),
2333					equal = false,
2334					middle = false,
2335					fullHeight = false,
2336					equalTabletL = true,
2337					equalTabletP = true,
2338					equalMobileL = true,
2339					fullTabletL = true,
2340					fullTabletP = true,
2341					fullMobileL = true;
2342
2343				if( $that.hasClass('grve-equal-column') || $that.hasClass('grve-middle-content') ){
2344					equal = true;
2345					equalTabletL = $that.data('tablet-landscape-equal-columns') != undefined ? false : true;
2346					equalTabletP = $that.data('tablet-portrait-equal-columns') != undefined ? false : true;
2347					equalMobileL = $that.data('mobile-equal-columns') != undefined ? false : true;
2348				}
2349				if( $that.hasClass('grve-middle-content') ){
2350					middle = true;
2351				}
2352				if( $that.hasClass('grve-fullheight') ){
2353					fullHeight = true;
2354					fullTabletL = $that.data('tablet-landscape-fullheight') != undefined ? false : true;
2355					fullTabletP = $that.data('tablet-portrait-fullheight') != undefined ? false : true;
2356					fullMobileL = $that.data('mobile-fullheight') != undefined ? false : true;
2357				}
2358				$that.columnSize({
2359					equal : equal,
2360					middleContent : middle,
2361					fullHeight : fullHeight,
2362					equalTabletL : equalTabletL,
2363					equalTabletP : equalTabletP,
2364					equalMobileL : equalMobileL,
2365					fullTabletL : fullTabletL,
2366					fullTabletP : fullTabletP,
2367					fullMobileL : fullMobileL
2368				});
2369			});
2370		},
2371		columnEffect: function(){
2372			var $parallaxColumn = $('.grve-parallax-effect'),
2373				$section = $parallaxColumn.parents('.grve-section');
2374
2375			$parallaxColumn.each(function(){
2376				var $that = $(this),
2377					parallaxEffect = $that.data('parallax-effect'),
2378					tabletL = $that.data('tablet-landscape-parallax-effect') != 'none' && parallaxEffect == 'vertical-parallax' ? true : false,
2379					tabletP = $that.data('tablet-portrait-parallax-effect') != 'none' && parallaxEffect == 'vertical-parallax' ? true : false,
2380					mobileL = $that.data('mobile-parallax-effect') != 'none' && parallaxEffect == 'vertical-parallax' ? true : false,
2381					$section = $that.parents('.grve-section');
2382
2383				imagesLoaded( $section, function() {
2384					$that.paraller({
2385						tabletL : [tabletLandscape, tabletL],
2386						tabletP : [tabletPortrait, tabletP],
2387						mobileL : [mobileScreen, mobileL]
2388					});
2389				});
2390			});
2391		},
2392		grveModal: function(){
2393
2394			var $button       = $('.grve-toggle-modal'),
2395				$overlay      = $('<div id="grve-modal-overlay" class="grve-body-overlay"></div>'),
2396				$closeBtn     = $('<div class="grve-close-modal"><i class="grve-icon-close"></i></div>'),
2397				$themeWrapper = $('#grve-theme-wrapper'),
2398				content;
2399
2400			$button.on('click',function(e){
2401				content = $(this).attr('href');
2402				if( content.indexOf("#") === 0 && $(content).length > 0 ) {
2403					e.preventDefault();
2404
2405					// Append Overlay on body
2406					$overlay.appendTo( $themeWrapper );
2407					// $closeBtn.appendTo( $(content) );
2408
2409					$(content).addClass('prepare-anim');
2410
2411					openModal();
2412
2413					$closeBtn.on('click',function(e){
2414						e.preventDefault();
2415						closeModal();
2416					});
2417
2418					$(content).on('click',function(e){
2419						if ( !$('.grve-modal-item').is(e.target) && $('.grve-modal-item').has(e.target).length === 0 ) {
2420							e.preventDefault();
2421							closeModal();
2422						}
2423					});
2424				}
2425			});
2426
2427			// Search Modal
2428			var $searchContent = $('#grve-search-modal'),
2429				$placeholder = $('.grve-search-placeholder'),
2430				$typedEl = $searchContent.find('.grve-search-placeholder'),
2431				$searchButton = $searchContent.find('.grve-search-btn'),
2432				$searchTextField = $searchContent.find('.grve-search-textfield'),
2433				typedContent = $typedEl.html(),
2434				typedText = false;
2435
2436			// Clear Typed Html
2437			if ( $placeholder.hasClass('grve-typed-placeholder') ) {
2438				$typedEl.html('');
2439			}
2440
2441			$placeholder.on('click',function(){
2442				$typedEl.addClass('hide');
2443				$searchTextField.show().focus();
2444			});
2445
2446			// Open Modal
2447			function openModal() {
2448				$overlay.fadeIn(function(){
2449					$(content).addClass('animate');
2450
2451					// Search Typed Title
2452					if( $(content).is('#grve-search-modal') ){
2453						$searchTextField.val('');
2454						if( $placeholder.hasClass('grve-typed-placeholder') ){
2455							typedTitle();
2456						} else {
2457							staticTitle();
2458						}
2459					}
2460				});
2461			}
2462
2463			// Close Modal
2464			function closeModal() {
2465				$(content).removeClass('animate mobile');
2466				setTimeout(function(){
2467					$overlay.fadeOut(function(){
2468						$(content).removeClass('prepare-anim');
2469						$overlay.remove();
2470						$closeBtn.remove();
2471
2472						// Search Modal Remove Classes
2473						if( $(content).is('#grve-search-modal') ){
2474							if ( $placeholder.hasClass('grve-typed-placeholder') ) {
2475								$typedEl.removeClass('hide').html('');
2476								$searchTextField.hide();
2477								$searchButton.removeClass('show');
2478								typedText = false;
2479							} else {
2480								$typedEl.removeClass('hide');
2481								$searchTextField.hide();
2482							}
2483						}
2484					});
2485				},600);
2486			}
2487
2488			function typedTitle(){
2489
2490				if(!typedText){
2491					typedText = true;
2492					$typedEl.data('typed', null).typed({
2493						strings: [typedContent],
2494						showCursor: false,
2495						typeSpeed: 60,
2496						callback: function() {
2497							$searchButton.addClass('show');
2498						}
2499					});
2500				}
2501			}
2502			function staticTitle(){
2503				$typedEl.addClass('show');
2504				$searchButton.addClass('show');
2505			}
2506
2507			$(document).on('keyup',function(evt) {
2508				if (evt.keyCode == 27 && $(content).hasClass('animate') ) {
2509					closeModal();
2510				}
2511			});
2512
2513		},
2514		gotoFirstSection: function(){
2515			var $selector    = $('#grve-feature-section #grve-goto-section'),
2516				$nextSection = $('#grve-content'),
2517				$stickyHeader = $('#grve-header').data('sticky') != 'none' ? $('#grve-header').data('sticky-height') : 0;
2518
2519			$selector.on('click',function(){
2520				if( $nextSection.length ){
2521					$('html,body').animate({
2522						scrollTop: $nextSection.offset().top - $stickyHeader
2523					}, 1000);
2524					return false;
2525				}
2526			});
2527		},
2528		bgLoader: function() {
2529
2530			var $selector = $('#grve-header .grve-bg-image, #grve-content .grve-bg-image, #grve-footer .grve-bg-image, .grve-navigation-bar .grve-bg-image, #grve-sidearea .grve-bg-image, #grve-safebutton-area .grve-bg-image');
2531			$selector.each(function () {
2532				var $selector = $(this);
2533				if( $selector.data('loader') == 'yes' ){
2534					GRVE.pageSettings.addSpinner( $selector );
2535				}
2536				function imageUrl(input) {
2537					return input.replace(/"/g,"").replace(/url\(|\)$/ig, "");
2538				}
2539				var image = new Image(),
2540					$that = $(this);
2541				image.src = imageUrl($that.css('background-image'));
2542				image.onload = function () {
2543					if( $selector.data('loader') == 'yes' ){
2544						GRVE.pageSettings.removeSpinner( $selector );
2545					} else {
2546						$that.addClass('show');
2547					}
2548				};
2549			});
2550		},
2551		imageLoader: function(){
2552			var selectors  = {
2553				singleImage  : '.grve-image',
2554				media        : '.grve-media'
2555			};
2556			$.each(selectors, function(key, value){
2557				if( $(this).length ){
2558					var item     = $(this),
2559						imgLoad  = imagesLoaded( item );
2560					imgLoad.on( 'always', function() {
2561						$(value).find('img').animate({ 'opacity': 1 },1000);
2562					});
2563				}
2564			});
2565		},
2566		addSpinner: function( $selector ){
2567			var $section = $selector;
2568			$(spinner).appendTo( $section.parent() );
2569		},
2570		removeSpinner: function( $selector ){
2571
2572			var $section   = $selector.parent(),
2573				$spinner   = $section.find('.grve-spinner');
2574
2575			$spinner.fadeOut(600,function(){
2576				$selector.addClass('show');
2577				$spinner.remove();
2578			});
2579		},
2580		fitVid: function(){
2581			$('.grve-video, .grve-media').fitVids();
2582			$('iframe[src*="youtube"]').parent(":not(.grve-bg-youtube-video)").fitVids();
2583			$('iframe[src*="vimeo"]').parent().fitVids();
2584		},
2585		hiddenArea: function(){
2586			var $btn          = $('.grve-toggle-hiddenarea'),
2587				$themeWrapper = $('#grve-theme-wrapper'),
2588				$closeBtn     = $('.grve-hidden-area').find('.grve-close-btn'),
2589				startTimer = false,
2590				itemLength = 0,
2591				areaWidth = 0,
2592				content,
2593				$overlay;
2594
2595			$btn.on('click',function(e){
2596				content = $(this).attr('href');
2597				if( content.indexOf("#") === 0 && $(content).length > 0 ) {
2598					e.preventDefault();
2599
2600					$(content).each(function(){
2601						var $content = $(this);
2602						var overlayId = $content.attr('id');
2603
2604						$content.addClass('prepare-anim');
2605						$overlay = $('<div id="' + overlayId + '-overlay" class="grve-body-overlay"></div>');
2606
2607						// Append Overlay on body
2608						$overlay.appendTo( $themeWrapper );
2609
2610						// Calculate Width
2611						areaWidth = hiddenAreaWidth( $content );
2612						$(window).smartresize(function(){
2613							areaWidth = hiddenAreaWidth( $content );
2614						});
2615
2616						// Menu First Level Animation
2617						if(hiddenMenuItemsAnimation){
2618							$content.addClass('grve-animated-menu-items');
2619						}
2620						setTimeout(function(){
2621							if(hiddenMenuItemsAnimation){
2622								animMenuItems( $content );
2623							}
2624						},1000);
2625
2626						if( $content.hasClass('open') ) {
2627							closeHiddenArea();
2628						} else {
2629							openHiddenArea();
2630						}
2631
2632						// For One Page
2633						var $link = $content.find('a[href*="#"]:not( [href="#"] )');
2634						$link.on('click',function(){
2635							var target = $(this.hash),
2636								targetHash = this.hash,
2637								dataValue = this.hash.replace('#','');
2638							if ( target.length && ( target.hasClass('grve-section') || target.hasClass('grve-bookmark') || target.hasClass('grve-tab-content') || target.hasClass('grve-accordion-content') ) ) {
2639								closeHiddenArea();
2640							}
2641							// For Fullpage Scrolling
2642							if( $('[data-anchor="' + dataValue + '"]').length ){
2643								closeHiddenArea();
2644							}
2645							//For go to header
2646							if( 'grve-goto-header' == dataValue ){
2647								closeHiddenArea();
2648							}
2649						});
2650
2651					});
2652				}
2653			});
2654
2655			$closeBtn.on('click',function(){
2656				closeHiddenArea();
2657			});
2658
2659			// Open Hidden Area
2660			function openHiddenArea() {
2661				$overlay.fadeIn(function(){
2662					$(window).trigger('grve_open_hidden_area');
2663					$('.grve-hiddenarea-wrapper').scrollTop( 0 );
2664					$(content).addClass('open');
2665					$(this).on('click',function(){
2666						closeHiddenArea();
2667					});
2668				});
2669			}
2670			// Close Hidden Area
2671			function closeHiddenArea() {
2672				$themeWrapper.css({ 'height' : 'auto' });
2673				$(content).removeClass('open');
2674				$overlay.fadeOut(function(){
2675					$overlay.remove();
2676					$(content).removeClass('prepare-anim');
2677					$(window).trigger('grve_close_hidden_area');
2678				});
2679			}
2680			// Calculate Area Width
2681			function hiddenAreaWidth( $area ){
2682				var windowWidth  = $(window).width();
2683
2684				if( $(window).width() + scrollBarWidth <= mobileScreen ) {
2685					$area.css({ 'width' : windowWidth + 30 });
2686				} else {
2687					if( $area.hasClass('grve-large-width') ) {
2688						$area.css({ 'width' : Math.max(hiddenaAreaMinWidth, (windowWidth / 2)) });
2689					} else if( $area.hasClass('grve-medium-width') ) {
2690						$area.css({ 'width' : Math.max(hiddenaAreaMinWidth, (windowWidth / 3)) });
2691					} else {
2692						$area.css({ 'width' : Math.max(hiddenaAreaMinWidth, (windowWidth / 4)) });
2693					}
2694				}
2695
2696				return areaWidth;
2697			}
2698
2699			// Menu First Level Animation
2700			function animMenuItems( $area ) {
2701				var $menu = $area.find('ul.grve-menu'),
2702					$firstLevel = $menu.find('li.grve-first-level'),
2703					itemLength = $firstLevel.length,
2704					count = -1,
2705					counter;
2706
2707				if( itemLength > 0 && !startTimer ){
2708					startTimer = true;
2709					counter = setInterval(function(){
2710						timer($firstLevel);
2711					}, 200);
2712				}
2713
2714				function timer($menuItem){
2715					count += 1;
2716					if (count >= itemLength) {
2717						clearInterval(counter);
2718						startTimer = false;
2719					}
2720					$menuItem.eq(count).addClass('show');
2721				}
2722			}
2723
2724		},
2725		backtoTop: function() {
2726			var selectors  = {
2727				topBtn     : '.grve-back-top',
2728				dividerBtn : '.grve-divider-backtotop',
2729				topLink    : 'a[href="#grve-goto-header"]'
2730				},
2731				footerBarHeight = $('.grve-footer-bar.grve-fullwidth').length ? $('.grve-footer-bar.grve-fullwidth').outerHeight() : 0;
2732
2733				if( $( selectors.topBtn ).length ) {
2734
2735					$(window).on('scroll', function() {
2736						var scroll = $(this).scrollTop(),
2737							$topBtn = $( selectors.topBtn );
2738
2739						if (scroll > 600) {
2740							$topBtn.addClass('show');
2741						} else {
2742							$topBtn.removeClass('show');
2743						}
2744						if( scroll + $(window).height() > $(document).height() - footerBarHeight ) {
2745							$topBtn.css({ 'transform': 'translate(0, ' + -( footerBarHeight + 80 ) + 'px)' });
2746						} else {
2747							$topBtn.css({ 'transform': '' });
2748						}
2749
2750					});
2751				}
2752
2753			$.each(selectors, function(key, value){
2754				$(value).on('click', function(e){
2755					e.preventDefault();
2756					if( $('#grve-header').data('sticky') === 'movedo' ){
2757						goToTop = true;
2758						$('#grve-header').removeClass('grve-fixed grve-sticky-header grve-sticky-animate grve-scroll-up grve-scroll-down').css({'top':''});
2759						$('#grve-main-header').css({'top':''});
2760					}
2761					var scrollTop = Math.abs($(window).scrollTop()) / 2,
2762						speed = scrollTop < 1000 ? 1000 : scrollTop;
2763					$('html, body').animate({scrollTop: 0}, speed, 'easeInOutCubic',function(){
2764						goToTop = false;
2765					});
2766				});
2767			});
2768
2769		},
2770		animatedBg: function(){
2771			var $section = $('.grve-section');
2772
2773			$section.each(function(){
2774				var $this = $(this);
2775
2776				if( $this.hasClass('grve-bg-animated') ) {
2777					zoomBg( $this );
2778				} else if( $this.hasClass('grve-bg-horizontal') ) {
2779					horizontalBg( $this );
2780				}
2781			});
2782
2783			function zoomBg( $this ){
2784				$this.mouseenter(function() {
2785					$this.addClass('zoom');
2786				});
2787				$this.mouseleave(function() {
2788					$this.removeClass('zoom');
2789				});
2790			}
2791
2792			function horizontalBg( $this ){
2793				var bgPosition = 0;
2794				setInterval(function(){
2795					bgPosition++;
2796					$this.find('.grve-bg-image').css({ 'background-position' : bgPosition+'px center', 'background-repeat' : 'repeat' });
2797				},75);
2798			}
2799		},
2800		onePageSettings: function(){
2801			$('a[href*="#"]:not( [href="#"] )').on('click', function(e) {
2802				var anchorBarHeight = $('.grve-anchor-menu').length ? $('.grve-anchor-menu').outerHeight() : 0,
2803					topbarH         = $('#grve-top-bar').length && ( $('#grve-top-bar').hasClass('grve-sticky-topbar') || $('#grve-top-bar').hasClass('grve-device-sticky-topbar') ) ? $('#grve-top-bar').outerHeight() : 0,
2804					target          = $(this.hash),
2805					targetHash      = this.hash;
2806
2807				if( $("#grve-responsive-header").is(":visible") ) {
2808					var headerHeight = $('#grve-header').length && $('#grve-header').data('devices-sticky') != 'no' ? $('#grve-header').data('devices-sticky-height') : 0;
2809				} else {
2810					var headerHeight = $('#grve-header').length && $('#grve-header').data('sticky') != 'none' ? $('#grve-header').data('sticky-height') : 0;
2811					if( target.length ){
2812						headerHeight = ( 'advanced' == $('#grve-header').data('sticky') && target.offset().top > $(this).offset().top ) ? 0 : headerHeight;
2813					}
2814				}
2815
2816				if ( target.length && ( target.hasClass('grve-section') || target.hasClass('grve-bookmark') ) ) {
2817					$('html,body').animate({
2818						scrollTop: target.offset().top - headerHeight - wpBarHeight - anchorBarHeight - topbarH + 1
2819					}, 1000);
2820					return false;
2821				}
2822
2823				if ( target.length && ( target.hasClass('grve-tab-content') || target.hasClass('grve-accordion-content') ) ) {
2824					var tabLink =  $('.grve-tab-link[data-rel="' + targetHash + '"]:visible');
2825					if ( tabLink.length ) {
2826						tabLink.click();
2827						setTimeout(function() {
2828							GRVE.pageSettings.linkGoToTop( tabLink );
2829						}, 500);
2830					}
2831					return false;
2832				}
2833			});
2834		},
2835		onePageMenu: function(){
2836			var $section       = $('#grve-main-content .grve-section[id]');
2837			if (!$section.length > 0 ) return;
2838
2839			var headerHeight   = $('#grve-header').length && $('#grve-header').attr('data-sticky-header') != 'none' && !$('#grve-main-header').hasClass('grve-header-side') ? $('#grve-main-header').outerHeight() : 0,
2840				anchorBarHeight = $('.grve-anchor-menu').length ? $('.grve-anchor-menu').outerHeight() : 0,
2841				topbarH         = $('#grve-top-bar').length && ( $('#grve-top-bar').hasClass('grve-sticky-topbar') || $('#grve-top-bar').hasClass('grve-device-sticky-topbar') ) ? $('#grve-top-bar').outerHeight() : 0,
2842				offsetTop      = headerHeight + anchorBarHeight + topbarH + wpBarHeight,
2843				scroll         = $(window).scrollTop();
2844
2845			$section.each(function(){
2846				var $that         = $(this),
2847					currentId     = $that.attr('id'),
2848					sectionOffset = $that.offset().top - offsetTop;
2849
2850				if (sectionOffset <= scroll && sectionOffset + $that.outerHeight() > scroll ) {
2851					$('a[href*="#' + currentId + '"]').parent().addClass('active');
2852				}
2853				else{
2854					$('a[href*="#' + currentId + '"]').parent().removeClass("active");
2855				}
2856
2857			});
2858		},
2859		fixedFooter: function(){
2860			var $footer      = $('#grve-footer'),
2861				sticky       = $footer.data('sticky-footer'),
2862				prevSection  = $footer.prev(),
2863				prevMargin = parseInt( prevSection.css('margin-bottom') ),
2864				delay;
2865
2866			if( !$footer.length || sticky != 'yes' || isMobile.any() ) return;
2867
2868			// On window events
2869			$( window ).on( 'scroll', function(){
2870				update();
2871			});
2872			$(window).on('resize',resizer);
2873
2874			function resizer(){
2875				window.clearTimeout(delay);
2876				delay = window.setTimeout(function() {
2877					$footer.prev().css( 'margin-bottom','' );
2878					prevMargin = parseInt( prevSection.css('margin-bottom') );
2879					update();
2880				}, 900);
2881			}
2882
2883			update();
2884
2885			function update(){
2886				var windowWidth = $(window).width(),
2887					windowHeight = $(window).height(),
2888					footerHeight = $footer.outerHeight(),
2889					margin       = footerHeight + prevMargin;
2890
2891				if( ( windowWidth + scrollBarWidth <= tabletLandscape ) || ( footerHeight > windowHeight ) ) {
2892					$footer.removeClass('grve-fixed-footer').prev().css( 'margin-bottom','' );
2893				} else {
2894					$footer.addClass('grve-fixed-footer').prev().css( 'margin-bottom',margin );
2895				}
2896			}
2897
2898		},
2899		productImageParallax: function(){
2900			$('#grve-product-feature-image .grve-product-parallax-image img').paraller({
2901				wrapper : '.grve-product-area-wrapper',
2902				effect : 'mouse-move-x',
2903				sensitive : 'normal',
2904				invert : true
2905			});
2906		},
2907		lightBox: function(){
2908			//IMAGE
2909			$('.grve-image-popup').each(function() {
2910				$(this).magnificPopup({
2911					type: 'image',
2912					preloader: false,
2913					fixedBgPos: true,
2914					fixedContentPos: true,
2915					removalDelay: 200,
2916					closeMarkup: '<div class="mfp-close grve-close-modal"></div>',
2917					closeOnBgClick: true,
2918					callbacks: {
2919						beforeOpen: function() {
2920							var mfpWrap = this.wrap;
2921							this.bgOverlay.fadeIn(200);
2922							addSpinner( mfpWrap );
2923						},
2924						imageLoadComplete: function() {
2925							var $spinner = this.wrap.find('.grve-spinner'),
2926								$content = this.container;
2927							removeSpinner( $spinner, $content );
2928
2929						},
2930						beforeClose: function() {
2931							this.wrap.fadeOut(100);
2932							this.container.css({'opacity' : 0});
2933							this.bgOverlay.fadeOut(100);
2934						},
2935					},
2936					image: {
2937						verticalFit: true,
2938						titleSrc: function(item) {
2939							var title   = item.el.data( 'title' ) ? item.el.data( 'title' ) : '',
2940								caption = item.el.data('desc') ? '<br><small>' + item.el.data('desc') + '</small>' : '';
2941							if ( '' === title ) {
2942								title   = item.el.find('.grve-title').html() ? item.el.find('.grve-title').html() : '';
2943							}
2944							if ( '' === caption ) {
2945								caption = item.el.find('.grve-caption').html() ? '<br><small>' + item.el.find('.grve-caption').html() + '</small>' : '';
2946							}
2947							return title + caption;
2948						}
2949					}
2950				});
2951
2952			});
2953			$('.grve-gallery-popup, .grve-post-gallery-popup').each(function() {
2954				var $that = $(this);
2955
2956				$(this).magnificPopup({
2957					delegate: 'a',
2958					type: 'image',
2959					preloader: false,
2960					fixedBgPos: true,
2961					fixedContentPos: true,
2962					removalDelay: 200,
2963					closeMarkup: '<div class="mfp-close grve-close-modal"></div>',
2964					closeOnBgClick: true,
2965					callbacks: {
2966						beforeOpen: function() {
2967							var mfpWrap = this.wrap;
2968							this.bgOverlay.fadeIn(200);
2969							addSpinner( mfpWrap );
2970						},
2971						imageLoadComplete: function() {
2972							var $spinner = this.wrap.find('.grve-spinner'),
2973								$content = this.container;
2974							removeSpinner( $spinner, $content );
2975
2976						},
2977						beforeClose: function() {
2978							this.wrap.fadeOut(100);
2979							this.container.css({'opacity' : 0});
2980							this.bgOverlay.fadeOut(100);
2981						},
2982						markupParse: function(template, values, item) {
2983							var title   = item.el.data( 'title' ) ? item.el.data( 'title' ) : '',
2984								social = $that.data('social') ? 'yes' : '';
2985
2986							if ( '' != social ) {
2987								social = '<div class="grve-element grve-social grve-align-right">';
2988								social += '<ul>';
2989								if ( $that.data('social-email') ) {
2990								social += '<li><a class="grve-extra-small grve-no-shape grve-social-share-email" href="mailto:?body=' + item.el.attr('href') + '" title="' + title + '"><i class="fa fa-envelope"></i></a></li>';
2991								}
2992								if ( $that.data('social-facebook') ) {
2993								social += '<li><a class="grve-extra-small grve-no-shape grve-social-share-facebook" href="' + item.el.attr('href') + '" title="' + title + '"><i class="fa fa-facebook"></i></a></li>';
2994								}
2995								if ( $that.data('social-twitter') ) {
2996								social += '<li><a class="grve-extra-small grve-no-shape grve-social-share-twitter" href="' + item.el.attr('href') + '" title="' + title + '"><i class="fa fa-twitter"></i></a></li>';
2997								}
2998								if ( $that.data('social-linkedin') ) {
2999								social += '<li><a class="grve-extra-small grve-no-shape grve-social-share-linkedin" href="' + item.el.attr('href') + '" title="' + title + '"><i class="fa fa-linkedin"></i></a></li>';
3000								}
3001								if ( $that.data('social-googleplus') ) {
3002								social += '<li><a class="grve-extra-small grve-no-shape grve-social-share-googleplus" href="' + item.el.attr('href') + '" title="' + title + '"><i class="fa fa-google-plus"></i></a></li>';
3003								}
3004								if ( $that.data('social-reddit') ) {
3005								social += '<li><a class="grve-extra-small grve-no-shape grve-social-share-reddit" href="' + item.el.attr('href') + '" title="' + title + '"><i class="fa fa-reddit"></i></a></li>';
3006								}
3007								if ( $that.data('social-pinterest') ) {
3008								social += '<li><a class="grve-social-share-pinterest" href="' + item.el.attr('href') + '" data-pin-img="' + item.el.attr('href') + '" title="' + title + '"><i class="fa fa-pinterest"></i></a></li>';
3009								}
3010								if ( $that.data('social-tumblr') ) {
3011								social += '<li><a class="grve-extra-small grve-no-shape grve-social-share-tumblr" href="' + item.el.attr('href') + '" title="' + title + '"><i class="fa fa-tumblr"></i></a></li>';
3012								}
3013								social += '</ul>';
3014								social += '</div>';
3015
3016								template.find('.grve-mfp-social').html( social );
3017								setTimeout(function() {
3018									GRVE.pageSettings.socialShareLinks();
3019								}, 1000 );
3020							}
3021						}
3022					},
3023					gallery: {
3024						enabled:true,
3025						tCounter: '%curr% / %total%'
3026					},
3027					image: {
3028						markup: '<div class="mfp-figure">'+
3029							'<div class="mfp-close grve-close-modal"></div>'+
3030							'<div class="mfp-img"></div>'+
3031							'<div class="mfp-bottom-bar">'+
3032							  '<div class="mfp-title"></div>'+
3033							  '<div class="mfp-counter"></div>'+
3034							  '<div class="grve-mfp-social"></div>'+
3035							'</div>'+
3036						  '</div>',
3037						tError: '<a href="%url%">The image #%curr%</a> could not be loaded.',
3038						titleSrc: function(item) {
3039							var title   = item.el.data( 'title' ) ? item.el.data( 'title' ) : '',
3040								caption = item.el.data('desc') ? '<br><small>' + item.el.data('desc') + '</small>' : '';
3041							if ( '' === title ) {
3042								title   = item.el.find('.grve-title').html() ? item.el.find('.grve-title').html() : '';
3043							}
3044							if ( '' === caption ) {
3045								caption = item.el.find('.grve-caption').html() ? '<br><small>' + item.el.find('.grve-caption').html() + '</small>' : '';
3046							}
3047							return title + caption;
3048						}
3049					}
3050				});
3051			});
3052
3053			if( 1 == movedo_grve_main_data.wp_gallery_popup ) {
3054				$('.gallery').each(function() {
3055					$(this).magnificPopup({
3056						delegate: 'a',
3057						type: 'image',
3058						preloader: false,
3059						fixedBgPos: true,
3060						fixedContentPos: true,
3061						removalDelay: 200,
3062						closeMarkup: '<div class="mfp-close grve-close-modal"></div>',
3063						closeOnBgClick: true,
3064						callbacks: {
3065							beforeOpen: function() {
3066								var mfpWrap = this.wrap;
3067								this.bgOverlay.fadeIn(200);
3068								addSpinner( mfpWrap );
3069							},
3070							imageLoadComplete: function() {
3071								var $spinner = this.wrap.find('.grve-spinner'),
3072									$content = this.container;
3073								removeSpinner( $spinner, $content );
3074
3075							},
3076							beforeClose: function() {
3077								this.wrap.fadeOut(100);
3078								this.container.css({'opacity' : 0});
3079								this.bgOverlay.fadeOut(100);
3080							},
3081						},
3082						gallery: {
3083							enabled:true,
3084							tCounter: '%curr% / %total%'
3085						},
3086						image: {
3087							tError: '<a href="%url%">The image #%curr%</a> could not be loaded.',
3088							titleSrc: function(item) {
3089								var title   = item.el.closest('.gallery-item').find('.gallery-caption').html() ? item.el.closest('.gallery-item').find('.gallery-caption').html() : '';
3090								return title;
3091							}
3092						}
3093					});
3094				});
3095			}
3096			//Inline Modal Popup
3097			$('.grve-modal-popup').each(function() {
3098				$(this).magnificPopup({
3099					disableOn: 0,
3100					type: 'inline',
3101					preloader: false,
3102					prependTo: '#grve-theme-wrapper',
3103					fixedBgPos: true,
3104					fixedContentPos: true,
3105					removalDelay: 200,
3106					closeMarkup: '<div class="mfp-close grve-close-modal"></div>',
3107					closeOnBgClick: true,
3108					callbacks: {
3109						beforeOpen: function() {
3110							var mfpWrap = this.wrap;
3111							this.bgOverlay.fadeIn(200);
3112							addSpinner( mfpWrap );
3113						},
3114						open: function() {
3115							var $spinner = this.wrap.find('.grve-spinner'),
3116								$content = this.container;
3117							removeSpinner( $spinner, $content );
3118
3119							if( $content.find('.grve-isotope').length ) {
3120								$('.grve-modal-popup').trigger( "grve_relayout_isotope" );
3121							}
3122							if( $content.find('.owl-carousel').length ) {
3123								setTimeout(function(){
3124									$content.find('.owl-carousel').each(function(){
3125										var owl = $(this).data('owlCarousel');
3126										owl.onResize();
3127									});
3128								},300);
3129							}
3130							if( $content.find('.grve-map').length ) {
3131								$('.grve-map').trigger( "grve_redraw_map" );
3132							}
3133							if( $content.find('.rev_slider').length ) {
3134								$('.rev_slider').revredraw();
3135							}
3136						},
3137						beforeClose: function() {
3138							this.wrap.fadeOut(100);
3139							this.container.css({'opacity' : 0});
3140							this.bgOverlay.fadeOut(100);
3141						},
3142					}
3143				});
3144			});
3145			//VIDEOS
3146			if ( $('#grve-body').hasClass( 'grve-privacy-video-embeds-disabled' ) ) {
3147				$('.grve-youtube-popup, .grve-vimeo-popup, .grve-video-popup').each(function() {
3148					$(this).attr({"target" : "_blank"});
3149				});
3150			} else {
3151				$('.grve-youtube-popup, .grve-vimeo-popup, .grve-video-popup').each(function() {
3152					$(this).magnificPopup({
3153						disableOn: 0,
3154						type: 'iframe',
3155						preloader: false,
3156						fixedBgPos: true,
3157						fixedContentPos: true,
3158						removalDelay: 200,
3159						closeMarkup: '<div class="mfp-close grve-close-modal"></div>',
3160						closeOnBgClick: true,
3161						callbacks: {
3162							beforeOpen: function() {
3163								var mfpWrap = this.wrap;
3164								this.bgOverlay.fadeIn(200);
3165								addSpinner( mfpWrap );
3166							},
3167							open: function() {
3168								var $spinner = this.wrap.find('.grve-spinner'),
3169									$content = this.container;
3170								removeSpinner( $spinner, $content );
3171							},
3172							beforeClose: function() {
3173								this.wrap.fadeOut(100);
3174								this.container.css({'opacity' : 0});
3175								this.bgOverlay.fadeOut(100);
3176							},
3177						}
3178					});
3179				});
3180			}
3181			//PAGE POPUP
3182			$('.grve-page-popup').each(function() {
3183				$(this).magnificPopup({
3184					disableOn: 0,
3185					type: 'iframe',
3186					preloader: false,
3187					fixedBgPos: true,
3188					fixedContentPos: true,
3189					removalDelay: 200,
3190					closeMarkup: '<div class="mfp-close grve-close-modal"></div>',
3191					closeOnBgClick: true,
3192					callbacks: {
3193						beforeOpen: function() {
3194							var mfpWrap = this.wrap;
3195							this.bgOverlay.fadeIn(200);
3196							addSpinner( mfpWrap );
3197						},
3198						open: function() {
3199							var $spinner = this.wrap.find('.grve-spinner'),
3200								$content = this.container;
3201							removeSpinner( $spinner, $content );
3202						},
3203						beforeClose: function() {
3204							this.wrap.fadeOut(100);
3205							this.container.css({'opacity' : 0});
3206							this.bgOverlay.fadeOut(100);
3207						},
3208					}
3209				});
3210			});
3211
3212			function addSpinner( mfpWrap ){
3213				if( 1 == movedo_grve_main_data.popup_spinner ) {
3214					$(spinner).appendTo( mfpWrap );
3215				}
3216			}
3217
3218			function removeSpinner( spinner, content ){
3219
3220				var speed = movedo_grve_main_data.popup_open_speed;
3221				var	spinnerFadeOutDuration, contentAnimateDuration, timeout;
3222
3223				switch (speed) {
3224					case 'fast':
3225						spinnerFadeOutDuration, 250,
3226						contentAnimateDuration = 150,
3227						timeout = 175;
3228						break;
3229					case 'normal':
3230						spinnerFadeOutDuration, 500,
3231						contentAnimateDuration = 300,
3232						timeout = 350;
3233						break;
3234					default:
3235						spinnerFadeOutDuration, 1000,
3236						contentAnimateDuration = 600,
3237						timeout = 700;
3238						break;
3239				}
3240				if( 1 == movedo_grve_main_data.popup_spinner ) {
3241					setTimeout(function(){
3242						spinner.fadeOut(spinnerFadeOutDuration, function(){
3243							content.animate({'opacity':1},contentAnimateDuration);
3244							$('.grve-modal-popup').trigger( 'grve_open_modal' );
3245							$(spinner).remove();
3246						});
3247					}, timeout);
3248				} else {
3249					setTimeout(function(){
3250						content.animate({'opacity':1},contentAnimateDuration);
3251						$('.grve-modal-popup').trigger( 'grve_open_modal' );
3252					}, timeout);
3253				}
3254			}
3255		},
3256		socialShareLinks: function(){
3257			$(document).on('click','.grve-social-share-facebook',function(e){
3258				e.preventDefault();
3259				window.open( 'https://www.facebook.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" );
3260				return false;
3261			});
3262			$(document).on('click','.grve-social-share-twitter',function(e){
3263				e.preventDefault();
3264				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" );
3265				return false;
3266			});
3267			$(document).on('click','.grve-social-share-linkedin',function(e){
3268				e.preventDefault();
3269				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" );
3270				return false;
3271			});
3272			$(document).on('click','.grve-social-share-pinterest',function(e){
3273				e.preventDefault();
3274				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" );
3275				return false;
3276			});
3277			$(document).on('click','.grve-social-share-reddit',function(e){
3278				e.preventDefault();
3279				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=1" );
3280				return false;
3281			});
3282			$(document).on('click','.grve-social-share-tumblr',function(e){
3283				e.preventDefault();
3284				window.open( '//www.tumblr.com/share/link?url=' + $(this).attr('href') + '&name=' + encodeURIComponent( $(this).attr('title') ) , "tumblrWindow", "height=600,width=600,resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=0" );
3285				return false;
3286			});
3287			$(document).on('click','.grve-like-counter-link',function(e){
3288				e.preventDefault();
3289				var link = $(this);
3290				var id = link.data('post-id'),
3291					counter = link.parent().find('.grve-like-counter'),
3292					icon = link.find('i');
3293
3294				var dataParams = {
3295					action:'movedo_grve_likes_callback',
3296					grve_likes_id: id,
3297					_grve_nonce: movedo_grve_main_data.nonce_likes
3298				};
3299
3300				$.post( movedo_grve_main_data.ajaxurl, dataParams , function( response ) {
3301					if ( '-1' != response ) {
3302						if( 'active' == response.status ){
3303							link.addClass('active');
3304							icon.removeClass('grve-icon-heart-o').addClass('grve-icon-heart');
3305						} else {
3306							link.removeClass('active');
3307							icon.removeClass('grve-icon-heart').addClass('grve-icon-heart-o');
3308						}
3309						counter.html(response.likes);
3310					}
3311				}).fail(function(xhr, status, error) {
3312				});
3313
3314				return false;
3315			});
3316		},
3317		fullHeightSeparator : function(){
3318			var $section = $('.grve-separator-fullheight');
3319			$section.each(function(){
3320				var $that = $(this),
3321					$separator = $that.find('.grve-separator'),
3322					delay;
3323
3324				setSeparatorH();
3325				$that.css({
3326					'visibility' : 'visible'
3327				});
3328
3329				if( !isMobile.any() ) {
3330					$(window).on("resize",resizer);
3331				} else {
3332					$(window).on("orientationchange",resizer);
3333				}
3334
3335				function resizer(){
3336					window.clearTimeout(delay);
3337					delay = window.setTimeout(function() {
3338						setSeparatorH();
3339					}, 300);
3340				}
3341				function getHeight(){
3342					var height = $that.outerHeight();
3343					return height;
3344				}
3345
3346				function setSeparatorH(){
3347					$separator.css({
3348						'height' : getHeight()
3349					});
3350				}
3351			});
3352		}
3353	};
3354
3355	// # Basic Elements
3356	// ============================================================================= //
3357	GRVE.basicElements = {
3358		init: function(){
3359			this.splitTitle();
3360			this.autoHeadings();
3361			this.pieChart();
3362			this.progressBars();
3363			this.counter();
3364			this.slider();
3365			this.splitContentSlider();
3366			this.testimonial();
3367			this.flexibleCarousel();
3368			this.carousel();
3369			this.advancedPromo();
3370			this.imageText();
3371			this.imageTextParallax();
3372			this.doubleImageText();
3373			this.portfolioParallax();
3374			this.teamParallax();
3375			this.testimonialParallax();
3376			this.sliderParallax();
3377			this.messageBox();
3378			this.wooProduct();
3379			this.wooProductZoom();
3380			this.animAppear();
3381			this.htmlVideoPlayWhenAppear();
3382			this.accordionToggle();
3383			this.tabs();
3384			this.productSocials();
3385			this.countdown();
3386			this.hovers();
3387		},
3388		splitTitle: function(){
3389			var $title = $('.grve-split-title span');
3390			$title.each(function(){
3391				var $that = $(this),
3392					text = $that.text(),
3393					str = text.trim(),
3394					charLength = str.length;
3395
3396				$that.html('');
3397				for (var i in str) {
3398					var $char = $('<span class="grve-char"></span>');
3399					$char.appendTo( $that );
3400					$char.text(str[i]);
3401					$that.append($char);
3402
3403					if( str[i] == ' ' ){
3404						$char.addClass('space');
3405					}
3406				}
3407				$that.addClass('grve-show');
3408			});
3409		},
3410		autoHeadings: function(){
3411			var $portfolio = $('.grve-portfolio.grve-auto-headings .grve-isotope-item-inner');
3412			$portfolio.autoHeading({
3413				compressor : 20,
3414				items : [
3415					{ 'item' : '.grve-title', 'min' : 18, 'max' : 50 },
3416					{ 'item' : '.grve-description', 'min' : 11, 'max' : 18 }
3417				]
3418			});
3419			$('.grve-blog-item.grve-style-2 .grve-blog-item-inner').autoHeading({
3420				compressor : 10,
3421				items : [
3422					{ 'item' : '.grve-post-title', 'min' : 16, 'max' : 30 }
3423				]
3424			});
3425		},
3426		pieChart: function(){
3427
3428			$('.grve-chart-number').each(function() {
3429				var $element  = $(this),
3430					delay     = $element.parent().data('delay') !== '' ? parseInt( $element.parent().data('delay') ) : 0,
3431					size      = $element.data('pie-size'),
3432					chartSize = '130';
3433				if( size == 'small' ){
3434					chartSize = '100';
3435				}
3436				if( size == 'large' ){
3437					chartSize = '160';
3438				}
3439
3440				$element.css({ 'width' : chartSize, 'height' : chartSize, 'line-height' : chartSize + 'px' });
3441
3442				if( $element.parents('.grve-modal-element').length ){
3443					$('.grve-modal-popup').on( 'grve_open_modal', function(){
3444						GRVE.basicElements.pieChartInit( $element, chartSize );
3445					});
3446				} else {
3447					$element.appear(function() {
3448						setTimeout(function () {
3449							GRVE.basicElements.pieChartInit( $element, chartSize );
3450						}, delay);
3451					});
3452				}
3453			});
3454
3455		},
3456		pieChartInit: function( $element, size ){
3457
3458			var activeColor = $element.data('pie-active-color') !== '' ? $element.data('pie-active-color') : 'rgba(0,0,0,1)',
3459				pieColor    = $element.data('pie-color') !== '' ? $element.data('pie-color') : 'rgba(0,0,0,0.1)',
3460				pieLineCap  = $element.data('pie-line-cap') !== '' ? $element.data('pie-line-cap') : 'round',
3461				lineSize    = $element.data('pie-line-size') !== '' ? $element.data('pie-line-size') : '6',
3462				chartSize   = size;
3463
3464
3465			$element.easyPieChart({
3466				barColor: activeColor,
3467				trackColor: pieColor,
3468				scaleColor: false,
3469				lineCap: pieLineCap,
3470				lineWidth: lineSize,
3471				animate: 1500,
3472				size: chartSize
3473			});
3474		},
3475		progressBars: function(){
3476			$('.grve-progress-bar').each(function() {
3477
3478				var $element  = $(this);
3479				if( $element.parents('.grve-modal-element').length ){
3480					$('.grve-modal-popup').on( 'grve_open_modal', function(){
3481						GRVE.basicElements.progressBarsInit( $element );
3482					});
3483				} else {
3484					$element.appear(function() {
3485						GRVE.basicElements.progressBarsInit( $element );
3486					});
3487				}
3488			});
3489		},
3490		progressBarsInit: function( $element ){
3491			var val = $element.attr('data-value'),
3492				percentage = $('<span class="grve-percentage">'+ val + '%'+'</span>');
3493
3494			$element.find('.grve-bar-line').animate({ width: val + '%' }, 1600);
3495			if( $element.parent().hasClass('grve-style-1') ) {
3496				percentage.appendTo($element.find('.grve-bar')).animate({ left: val + '%' }, 1600);
3497			} else {
3498				percentage.appendTo($element.find('.grve-bar-title'));
3499			}
3500		},
3501		counter: function(){
3502			if( bodyLoader === true ){
3503				return;
3504			}
3505			var selector = '.grve-counter-item span';
3506			$(selector).each(function(i){
3507				var elements = $(selector)[i],
3508					thousandsSeparator = $(this).attr('data-thousands-separator') !== '' ? $(this).attr('data-thousands-separator') : ',';
3509				$(elements).attr('id','grve-counter-' + i );
3510				var delay = $(this).parents('.grve-counter').attr('data-delay') !== '' ? parseInt( $(this).parents('.grve-counter').attr('data-delay') ) : 200,
3511					options = {
3512						useEasing    : true,
3513						useGrouping  : true,
3514						separator    : $(this).attr('data-thousands-separator-vis') !== 'yes' ? thousandsSeparator : '',
3515						decimal      : $(this).attr('data-decimal-separator') !== '' ? $(this).attr('data-decimal-separator') : '.',
3516						prefix       : $(this).attr('data-prefix') !== '' ? $(this).attr('data-prefix') : '',
3517						suffix       : $(this).attr('data-suffix') !== '' ? $(this).attr('data-suffix') : ''
3518					},
3519					counter = new CountUp( $(this).attr('id') , $(this).attr('data-start-val'), $(this).attr('data-end-val'), $(this).attr('data-decimal-points'), 2.5, options);
3520				$(this).appear(function() {
3521					setTimeout(function () {
3522						counter.start();
3523					}, delay);
3524				});
3525			});
3526		},
3527		slider: function(){
3528
3529			var $element = $('#grve-main-content .grve-slider-element, #grve-single-media .grve-slider-element, .mfp-content .grve-slider-element, #grve-safebutton-area .grve-slider-element');
3530
3531			$element.each(function(){
3532
3533				var $slider = $(this),
3534					$nextNav = $slider.parents('.grve-slider').find('.grve-carousel-next'),
3535					$prevNav = $slider.parents('.grve-slider').find('.grve-carousel-prev'),
3536					sliderSpeed = ( parseInt( $slider.attr('data-slider-speed') ) ) ? parseInt( $slider.attr('data-slider-speed') ) : 3000,
3537					transition = $slider.attr('data-slider-transition'),
3538					loop = $slider.attr('data-slider-loop') != 'no' ? true : false,
3539					autoPlay = $slider.attr('data-slider-autoplay') != 'no' ? true : false,
3540					autoHeight = $slider.attr('data-slider-autoheight') == 'yes' ? true : false,
3541					sliderPause = $slider.attr('data-slider-pause') == 'yes' ? true : false,
3542					pagination = $slider.attr('data-pagination') != 'no' ? true : false,
3543					animateOut = false,
3544					animateIn = false;
3545
3546				// Slider Trantition
3547				if( $slider.parents('.grve-slider').hasClass('grve-layout-2') || 'fade' == transition ){
3548					animateOut = 'carousel-fade-out';
3549					animateIn = 'carousel-fade-in';
3550				}
3551
3552				if ( $slider.find('.grve-slider-item').length == 1 ) {
3553					loop = false;
3554				}
3555
3556				// Slider Init
3557				$slider.owlCarousel({
3558					items : 1,
3559					loop : loop,
3560					autoplay : autoPlay,
3561					autoplayTimeout : sliderSpeed,
3562					autoplayHoverPause : sliderPause,
3563					smartSpeed : 500,
3564					dots : pagination,
3565					animateOut : animateOut,
3566					animateIn : animateIn,
3567					autoHeight : autoHeight,
3568					itemClass : 'grve-slider-item-wrapper'
3569				});
3570
3571				// Fixed for Carousel middle content
3572				if( $slider.parents('.grve-section').hasClass('grve-middle-content') ){
3573					var smallDelay;
3574					GRVE.basicElements.fixMiddleCarousel( $slider );
3575					$slider.parents('.grve-section').data('plugin_columnSize').reCalculate();
3576					$(window).on('resize',function(){
3577						window.clearTimeout(smallDelay);
3578						smallDelay = window.setTimeout(function () {
3579							GRVE.basicElements.fixMiddleCarousel( $slider );
3580						}, 300);
3581					});
3582				}
3583
3584				$slider.parents('.grve-slider').css('visibility','visible');
3585
3586				// Go to the next item
3587				$nextNav.on('click', function() {
3588					$slider.trigger('next.owl.carousel');
3589				});
3590				// Go to the previous item
3591				$prevNav.on('click', function() {
3592					$slider.trigger('prev.owl.carousel');
3593				});
3594
3595			});
3596
3597		},
3598		splitContentSlider: function(){
3599
3600			var $element = $('.grve-slit-content-slider');
3601
3602			$element.each(function(){
3603
3604				var $slider = $(this),
3605					$dots = $slider.parents('.grve-split-content').find('.grve-slider-dots'),
3606					sliderSpeed = ( parseInt( $slider.attr('data-slider-speed') ) ) ? parseInt( $slider.attr('data-slider-speed') ) : 3000,
3607					transition = $slider.attr('data-slider-transition'),
3608					loop = $slider.attr('data-slider-loop') != 'no' ? true : false,
3609					autoPlay = $slider.attr('data-slider-autoplay') != 'no' ? true : false,
3610					autoHeight = $slider.attr('data-slider-autoheight') == 'yes' ? true : false,
3611					animateOut = false,
3612					animateIn = false;
3613
3614				// Slider Trantition
3615				if( $slider.parents('.grve-slider').hasClass('grve-layout-2') || 'fade' == transition ){
3616					animateOut = 'carousel-fade-out';
3617					animateIn = 'carousel-fade-in';
3618				}
3619
3620				if ( $slider.find('.grve-slider-item').length == 1 ) {
3621					loop = false;
3622				}
3623
3624				// Slider Init
3625				$slider.owlCarousel({
3626					items : 1,
3627					loop : loop,
3628					autoplay : autoPlay,
3629					autoplayTimeout : sliderSpeed,
3630					autoplayHoverPause : false,
3631					smartSpeed : 500,
3632					dots : true,
3633					animateOut : animateOut,
3634					dotsContainer : $dots,
3635					animateIn : animateIn,
3636					autoHeight : autoHeight,
3637					itemClass : 'grve-slider-item-wrapper'
3638				});
3639
3640				$slider.parents('.grve-slider').css('visibility','visible');
3641
3642			});
3643
3644		},
3645		testimonial: function(){
3646
3647			var $element = $('.grve-testimonial.grve-carousel-element');
3648
3649			$element.each(function(){
3650				var $testimonial = $(this),
3651					sliderSpeed = ( parseInt( $testimonial.attr('data-slider-speed') ) ) ? parseInt( $testimonial.attr('data-slider-speed') ) : 3000,
3652					pagination = $testimonial.attr('data-pagination') != 'no' ? true : false,
3653					paginationSpeed = ( parseInt( $testimonial.attr('data-pagination-speed') ) ) ? parseInt( $testimonial.attr('data-pagination-speed') ) : 400,
3654					transition = $testimonial.attr('data-slider-transition'),
3655					autoHeight = $testimonial.attr('data-slider-autoheight') == 'yes' ? true : false,
3656					autoPlay = $testimonial.attr('data-slider-autoplay') != 'no' ? true : false,
3657					sliderPause = $testimonial.attr('data-slider-pause') == 'yes' ? true : false,
3658					loop = true,
3659					animateOut = false,
3660					animateIn = false;
3661
3662				// Testimonial Trantition
3663				if( $testimonial.hasClass('grve-layout-2') || 'fade' == transition ){
3664					animateOut = 'carousel-fade-out';
3665					animateIn = 'carousel-fade-in';
3666				}
3667				if ( $testimonial.find('.grve-testimonial-element').length == 1 ) {
3668					loop = false;
3669				}
3670
3671				// Testimonial Init
3672				$testimonial.owlCarousel({
3673					items : 1,
3674					loop : loop,
3675					autoplay : autoPlay,
3676					autoplayTimeout : sliderSpeed,
3677					autoplayHoverPause : sliderPause,
3678					smartSpeed : 500,
3679					dots : pagination,
3680					animateOut : animateOut,
3681					animateIn : animateIn,
3682					autoHeight : autoHeight,
3683					itemClass : 'grve-testimonial-item-wrapper'
3684				});
3685
3686				// Fixed for Carousel middle content
3687				if( $testimonial.parents('.grve-section').hasClass('grve-middle-content') ){
3688					var smallDelay;
3689					GRVE.basicElements.fixMiddleCarousel( $testimonial );
3690					$testimonial.parents('.grve-section').data('plugin_columnSize').reCalculate();
3691					$(window).on('resize',function(){
3692						window.clearTimeout(smallDelay);
3693						smallDelay = window.setTimeout(function () {
3694							GRVE.basicElements.fixMiddleCarousel( $testimonial );
3695						}, 300);
3696					});
3697				}
3698
3699				$testimonial.css('visibility','visible');
3700
3701			});
3702		},
3703		flexibleCarousel: function(){
3704
3705			var $element = $('.grve-flexible-carousel-element');
3706
3707			$element.each(function(){
3708
3709				var $carousel = $(this),
3710					$nextNav = $carousel.parents('.grve-flexible-carousel').find('.grve-carousel-next'),
3711					$prevNav = $carousel.parents('.grve-flexible-carousel').find('.grve-carousel-prev'),
3712					sliderSpeed = ( parseInt( $carousel.attr('data-slider-speed') ) ) ? parseInt( $carousel.attr('data-slider-speed') ) : 3000,
3713					pagination = $carousel.attr('data-pagination') != 'no' ? true : false,
3714					paginationSpeed = ( parseInt( $carousel.attr('data-pagination-speed') ) ) ? parseInt( $carousel.attr('data-pagination-speed') ) : 400,
3715					autoHeight = $carousel.attr('data-slider-autoheight') == 'yes' ? true : false,
3716					autoPlay = $carousel.attr('data-slider-autoplay') != 'no' ? true : false,
3717					sliderPause = $carousel.attr('data-slider-pause') == 'yes' ? true : false,
3718					loop = true,
3719					itemNum = parseInt( $carousel.attr('data-items')),
3720					tabletLandscapeNum = $carousel.attr('data-items-tablet-landscape') ? parseInt( $carousel.attr('data-items-tablet-landscape')) : 4,
3721					tabletPortraitNum = $carousel.attr('data-items-tablet-portrait') ? parseInt( $carousel.attr('data-items-tablet-portrait')) : 2,
3722					mobileNum = $carousel.attr('data-items-mobile') ? parseInt( $carousel.attr('data-items-mobile')) : 1,
3723					gap = $carousel.parents('.grve-flexible-carousel').hasClass('grve-with-gap') ? 30 : 0,
3724					padding = $carousel.parents('.grve-flexible-carousel').hasClass('grve-with-gap') && $carousel.parents('.grve-section').hasClass('grve-fullwidth') ? 30 : 0;
3725
3726				if ( $carousel.find('.grve-flexible-carousel-element').length == 1 ) {
3727					loop = false;
3728				}
3729
3730				// Carousel Init
3731				$carousel.owlCarousel({
3732					items : 1,
3733					loop : loop,
3734					autoplay : autoPlay,
3735					autoplayTimeout : sliderSpeed,
3736					autoplayHoverPause : sliderPause,
3737					smartSpeed : 500,
3738					dots : pagination,
3739					responsive : {
3740						0 : {
3741							items : mobileNum
3742						},
3743						768 : {
3744							items : tabletPortraitNum
3745						},
3746						1024 : {
3747							items : tabletLandscapeNum
3748						},
3749						1200 : {
3750							items : itemNum
3751						}
3752					},
3753					margin : gap,
3754					stagePadding : padding,
3755					autoHeight : autoHeight,
3756					itemClass : 'grve-carousel-item-wrapper'
3757				});
3758
3759				// Fixed for Carousel middle content
3760				if( $carousel.parents('.grve-section').hasClass('grve-middle-content') ){
3761					var smallDelay;
3762					GRVE.basicElements.fixMiddleCarousel( $carousel );
3763					$carousel.parents('.grve-section').data('plugin_columnSize').reCalculate();
3764					$(window).on('resize',function(){
3765						window.clearTimeout(smallDelay);
3766						smallDelay = window.setTimeout(function () {
3767							GRVE.basicElements.fixMiddleCarousel( $carousel );
3768						}, 300);
3769					});
3770				}
3771
3772				$carousel.css('visibility','visible');
3773
3774				// Go to the next item
3775				$nextNav.on('click', function() {
3776					$carousel.trigger('next.owl.carousel');
3777				});
3778				// Go to the previous item
3779				$prevNav.on('click', function() {
3780					$carousel.trigger('prev.owl.carousel');
3781				});
3782
3783			});
3784		},
3785		carousel: function(){
3786
3787			var $element = $('.grve-carousel-element');
3788
3789			$element.each(function(){
3790
3791				var $carousel = $(this),
3792					$nextNav = $carousel.parents('.grve-carousel').find('.grve-carousel-next'),
3793					$prevNav = $carousel.parents('.grve-carousel').find('.grve-carousel-prev'),
3794					sliderSpeed = ( parseInt( $carousel.attr('data-slider-speed') ) ) ? parseInt( $carousel.attr('data-slider-speed') ) : 3000,
3795					pagination = $carousel.attr('data-pagination') != 'no' ? true : false,
3796					paginationSpeed = ( parseInt( $carousel.attr('data-pagination-speed') ) ) ? parseInt( $carousel.attr('data-pagination-speed') ) : 400,
3797					autoHeight = $carousel.attr('data-slider-autoheight') == 'yes' ? true : false,
3798					autoPlay = $carousel.attr('data-slider-autoplay') != 'no' ? true : false,
3799					sliderPause = $carousel.attr('data-slider-pause') == 'yes' ? true : false,
3800					loop = $carousel.attr('data-slider-loop') != 'no' ? true : false,
3801					itemNum = parseInt( $carousel.attr('data-items')),
3802					tabletLandscapeNum = $carousel.attr('data-items-tablet-landscape') ? parseInt( $carousel.attr('data-items-tablet-landscape')) : 3,
3803					tabletPortraitNum = $carousel.attr('data-items-tablet-portrait') ? parseInt( $carousel.attr('data-items-tablet-portrait')) : 3,
3804					mobileNum = $carousel.attr('data-items-mobile') ? parseInt( $carousel.attr('data-items-mobile')) : 1,
3805					gap = $carousel.parents('.grve-carousel').hasClass('grve-with-gap') && !isNaN( $carousel.data('gutter-size') ) ? Math.abs( $carousel.data('gutter-size') ) : 0,
3806					padding = $carousel.parents('.grve-carousel').hasClass('grve-with-gap') && $carousel.parents('.grve-section').hasClass('grve-fullwidth') && !isNaN( $carousel.data('gutter-size') ) ? Math.abs( $carousel.data('gutter-size') ) : 0;
3807
3808				if ( $carousel.find('.grve-carousel-item').length == 1 ) {
3809					loop = false;
3810				}
3811
3812				// Carousel Init
3813				$carousel.owlCarousel({
3814					loop : loop,
3815					autoplay : autoPlay,
3816					autoplayTimeout : sliderSpeed,
3817					autoplayHoverPause : sliderPause,
3818					smartSpeed : 500,
3819					dots : pagination,
3820					responsive : {
3821						0 : {
3822							items : mobileNum
3823						},
3824						768 : {
3825							items : tabletPortraitNum
3826						},
3827						1024 : {
3828							items : tabletLandscapeNum
3829						},
3830						1200 : {
3831							items : itemNum
3832						}
3833					},
3834					margin : gap,
3835					stagePadding : padding,
3836					itemClass : 'grve-carousel-item-wrapper'
3837				});
3838
3839				// Fixed for Carousel middle content
3840				if( $carousel.parents('.grve-section').hasClass('grve-middle-content') ){
3841					var smallDelay;
3842					GRVE.basicElements.fixMiddleCarousel( $carousel );
3843					$carousel.parents('.grve-section').data('plugin_columnSize').reCalculate();
3844					$(window).on('resize',function(){
3845						window.clearTimeout(smallDelay);
3846						smallDelay = window.setTimeout(function () {
3847							GRVE.basicElements.fixMiddleCarousel( $carousel );
3848						}, 300);
3849					});
3850				}
3851
3852				$carousel.css('visibility','visible');
3853
3854				// Go to the next item
3855				$nextNav.on('click', function() {
3856					$carousel.trigger('next.owl.carousel');
3857				});
3858				// Go to the previous item
3859				$prevNav.on('click', function() {
3860					$carousel.trigger('prev.owl.carousel');
3861				});
3862
3863			});
3864		},
3865		fixMiddleCarousel : function( $element ){
3866			$element.css({ 'width' : '0' });
3867			var $column = $element.parents('.grve-column-wrapper'),
3868				columnW = $column.width() - 1,
3869				owl = $element.data('owlCarousel');
3870			$element.css({ 'width' : columnW });
3871			owl.onResize();
3872		},
3873		advancedPromo: function(){
3874			var $item = $('.grve-expandable-info');
3875			$item.each(function(){
3876				var $that         = $(this),
3877					$wrapper      = $that.parents('.grve-section'),
3878					$content      = $that.find('.grve-expandable-info-content'),
3879					paddingTop    = parseInt( $wrapper.css('padding-top') ),
3880					paddingBottom = parseInt( $wrapper.css('padding-bottom') );
3881
3882				$wrapper.addClass('grve-pointer-cursor');
3883				$wrapper.on('click',function(){
3884
3885					var headerHeight   = $('#grve-header').length && $('#grve-header').data('sticky') != 'none' ? $('#grve-main-header').outerHeight() : 0,
3886						fieldBarHeight = $('.grve-fields-bar').length ? $('.grve-fields-bar').outerHeight() : 0,
3887						offset         = $(this).offset().top,
3888						distance       = offset - ( headerHeight + fieldBarHeight );
3889
3890					if( $content.is(":visible") ){
3891						$content.slideUp( 600, function(){
3892							$content.removeClass('show');
3893						});
3894					} else {
3895
3896						$('html,body').animate({
3897							scrollTop: distance
3898						}, 600,function(){
3899							$content.slideDown( function(){
3900								$content.addClass('show');
3901								return;
3902							});
3903						});
3904					}
3905				});
3906				$wrapper.mouseenter(function() {
3907					$(this).css({ 'padding-top' : paddingTop + 40, 'padding-bottom' : paddingBottom + 40 });
3908				});
3909				$wrapper.mouseleave(function() {
3910					$(this).css({ 'padding-top' : paddingTop, 'padding-bottom' : paddingBottom });
3911				});
3912			});
3913		},
3914		imageText: function(){
3915			var $el = $('.grve-image-text.grve-layout-1');
3916			if( !$el.length > 0 ) return;
3917			$el.each(function(){
3918				var $that = $(this),
3919					$img = $that.find('img'),
3920					$cont = $that.find('.grve-content');
3921				$img.css({ 'padding-top' : '', 'padding-bottom' : '' });
3922				$cont.css({ 'padding-top' : '', 'padding-bottom' : '' });
3923				$that.css('visibility','hidden');
3924				$img.imagesLoaded( function() {
3925					var imgHeight = $img.height(),
3926						contHeight = $cont.height(),
3927						space = parseInt( (imgHeight - contHeight)/2 );
3928					if( $(window).width() + scrollBarWidth >= mobileScreen ) {
3929						if( imgHeight < contHeight ){
3930							space = parseInt( (contHeight - imgHeight)/2 );
3931							$img.css({ 'padding-top' : space, 'padding-bottom' : space });
3932						} else {
3933							$cont.css({ 'padding-top' : space, 'padding-bottom' : space });
3934						}
3935					}
3936					$that.css('visibility','visible');
3937				});
3938
3939			});
3940		},
3941		imageTextParallax: function(){
3942			var $el = $('.grve-image-text.grve-layout-2'),
3943				$paraller = $el.find('.grve-paraller');
3944
3945			imagesLoaded( $el, function() {
3946				$paraller.paraller({
3947					wrapper : '.grve-paraller-wrapper',
3948					invert : false,
3949					tabletL : [1200, true],
3950					tabletP : [1023, false],
3951					mobileL : [767, false]
3952				});
3953			});
3954		},
3955		doubleImageText: function(){
3956			var $el = $('.grve-double-image-text'),
3957				$paraller = $el.find('.grve-paraller');
3958
3959			imagesLoaded( $el, function() {
3960				$paraller.paraller({
3961					wrapper : '.grve-paraller-wrapper',
3962					invert : false,
3963					tabletL : [1200, true],
3964					tabletP : [1023, true],
3965					mobileL : [767, false]
3966				});
3967			});
3968		},
3969		portfolioParallax: function(){
3970			var $el = $('.grve-portfolio-movedo-style'),
3971				$paraller = $el.find('.grve-paraller');
3972
3973			imagesLoaded( $el, function() {
3974				$paraller.paraller({
3975					wrapper : '.grve-paraller-wrapper',
3976					invert : false,
3977					tabletL : [1200, true],
3978					tabletP : [1023, true],
3979					mobileL : [767, false]
3980				});
3981			});
3982		},
3983		teamParallax: function(){
3984			var $el = $('.grve-team.grve-layout-2'),
3985				$paraller = $el.find('.grve-paraller');
3986
3987			imagesLoaded( $el, function() {
3988				$paraller.paraller({
3989					wrapper : '.grve-paraller-wrapper',
3990					invert : false,
3991					tabletL : [1200, true],
3992					tabletP : [1023, true],
3993					mobileL : [767, false]
3994				});
3995			});
3996		},
3997		testimonialParallax: function(){
3998			var $el = $('.grve-testimonial.grve-layout-2'),
3999				$paraller = $el.find('.grve-paraller');
4000
4001			imagesLoaded( $el, function() {
4002				$paraller.paraller({
4003					wrapper : '.grve-paraller-wrapper',
4004					invert : false,
4005					tabletL : [1200, true],
4006					tabletP : [1023, true],
4007					mobileL : [767, false]
4008				});
4009			});
4010		},
4011		sliderParallax: function(){
4012			var $el = $('.grve-content-slider.grve-layout-2'),
4013				$paraller = $el.find('.grve-paraller');
4014
4015			imagesLoaded( $el, function() {
4016				$paraller.paraller({
4017					wrapper : '.grve-paraller-wrapper',
4018					invert : false,
4019					tabletL : [1200, true],
4020					tabletP : [1023, true],
4021					mobileL : [767, false]
4022				});
4023			});
4024		},
4025		iconBox: function(){
4026			var $iconBox = $('.grve-box-icon.grve-advanced-hover');
4027			if( isMobile.any() ) {
4028				$iconBox.css({'visibility' : 'visible'});
4029				return false;
4030			}
4031			$iconBox.each(function(){
4032				var $that = $(this),
4033					$text = $that.find('p'),
4034					$column = $that.parents('.grve-column'),
4035					space = 0,
4036					resize = false;
4037
4038				setup();
4039				$(window).smartresize(setup);
4040
4041				function updateParams(){
4042					space = $text.outerHeight();
4043				}
4044
4045				function resetIcon(){
4046					$that.css({ 'top' : '' });
4047					$text.css({ 'opacity' : 1, 'bottom' : '' });
4048				}
4049
4050				function setup(){
4051					if(!resize){
4052						resize = true;
4053
4054						resetIcon();
4055						updateParams();
4056
4057						$column.css({ 'overflow' : 'hidden' });
4058						$that.css({ 'top' : space, 'visibility' : 'visible' });
4059						$text.css({ 'opacity' : 0, 'position' : 'relative', 'bottom' : '-120%' });
4060
4061						resize = true;
4062					}
4063				}
4064
4065				$column.hover(function(){
4066					$that.stop( true, true ).animate({
4067						'top' : 0
4068					},400, 'easeOutBack');
4069					$text.stop( true, true ).delay( 100 ).animate({
4070						'opacity' : 1,
4071						'bottom' : 0
4072					},600, 'easeOutBack');
4073				},function(){
4074					$that.stop( true, true ).animate({
4075						'top' : space
4076					},500, 'easeOutBack');
4077					$text.stop( true, true ).animate({
4078						'opacity' : 0,
4079						'bottom' : '-120%'
4080					},400, 'easeOutBack');
4081				});
4082
4083				function resize(){
4084					var delay;
4085					window.clearTimeout(delay);
4086					delay = window.setTimeout(function() {
4087						setup();
4088					}, 200);
4089				}
4090
4091			});
4092
4093		},
4094		messageBox: function(){
4095			var infoMessage = $('.grve-message'),
4096			closeBtn = infoMessage.find($('.grve-close'));
4097			closeBtn.on('click', function() {
4098				$(this).parent().slideUp(150);
4099			});
4100		},
4101		wooProduct: function(){
4102			var $item   = $('.grve-product-item'),
4103				$addBtn = $item.find('.add_to_cart_button');
4104			$addBtn.on('click',function(){
4105				$(this).parents('.grve-product-item').addClass('grve-product-added');
4106			});
4107		},
4108		wooProductZoom: function(){
4109			if( !isMobile.any() ){
4110				if ( $('.grve-product-image.easyzoom').length ) {
4111					var $easyzoom = $('.grve-product-image.easyzoom').easyZoom();
4112					var api = $easyzoom.data('easyZoom');
4113					$( ".variations_form" ).on( 'woocommerce_variation_select_change', function( event, variation ){
4114						var imageZoom = $('.grve-product-image .woocommerce-main-image').attr('href');
4115						var imageSrc = $('.grve-product-image .woocommerce-main-image img').attr('src');
4116						api.swap( imageSrc , imageZoom );
4117					} );
4118				}
4119			}
4120		},
4121		animAppear: function(){
4122			if( bodyLoader || $('body').hasClass('page-template-template-full-page') || $('body').hasClass('page-template-template-pilling-page') ){
4123				return;
4124			}
4125			if( isMobile.any() && !deviceAnimAppear ) {
4126				$('.grve-animated-item').css('opacity',1);
4127			} else {
4128				$('.grve-animated-item').each(function() {
4129					var $that = $(this),
4130						timeDelay = $that.attr('data-delay');
4131
4132					if( $that.parents('.grve-clipping-animation').length ) return;
4133
4134					$that.appear(function() {
4135						setTimeout(function () {
4136							$that.addClass('grve-animated');
4137						}, timeDelay);
4138					},{accX: 0, accY: -150});
4139				});
4140			}
4141		},
4142		htmlVideoPlayWhenAppear: function(){
4143			var $video = $('.grve-embed-video');
4144			$video.each(function(){
4145				var $that = $(this);
4146				$that[0].pause();
4147				$that.appear(function(){
4148					if( $that[0].autoplay ){
4149						$that[0].play();
4150					}
4151				},{accX: 0, accY: -150});
4152			});
4153		},
4154		accordionToggle: function(){
4155			$('.grve-accordion-wrapper.grve-action-toggle li .grve-title-wrapper').on('click', function() {
4156
4157				var $that = $(this);
4158				$that
4159					.toggleClass('active')
4160					.next().slideToggle(350);
4161
4162				var $content = $that.parent();
4163				if( $content.find('.grve-isotope').length ) {
4164					setTimeout(function(){
4165						GRVE.isotope.init();
4166					},100);
4167				}
4168				if( $content.find('.grve-blog-leader.grve-movedo-style').length ) {
4169					GRVE.leaderPostSize.init();
4170				}
4171				if( $content.find('.owl-carousel').length ) {
4172					$content.find('.owl-carousel').each(function(){
4173						var owl = $(this).data('owlCarousel');
4174						owl.onResize();
4175					});
4176				}
4177			});
4178			$('.grve-accordion-wrapper.grve-action-accordion li .grve-title-wrapper').on('click', function() {
4179
4180				var $that = $(this);
4181				$that
4182					.toggleClass('active').next().slideToggle(350)
4183					.parent().siblings().find('.grve-title-wrapper').removeClass('active')
4184					.next().slideUp(350);
4185
4186				var $content = $that.parent();
4187				if( $content.find('.grve-isotope').length ) {
4188					setTimeout(function(){
4189						GRVE.isotope.init();
4190					},100);
4191				}
4192				if( $content.find('.grve-blog-leader.grve-movedo-style').length ) {
4193					GRVE.leaderPostSize.init();
4194				}
4195				if( $content.find('.owl-carousel').length ) {
4196					$content.find('.owl-carousel').each(function(){
4197						var owl = $(this).data('owlCarousel');
4198						owl.onResize();
4199					});
4200				}
4201			});
4202		},
4203		tabs: function(){
4204			$('.grve-tab-title').click(function () {
4205				var $that = $(this),
4206					$title = $that.parents('.grve-tab').find('.grve-tab-title'),
4207					$content = $that.parents('.grve-tab').find('.grve-tab-content'),
4208					contentId = $that.data('rel');
4209				$title.removeClass('active');
4210				$that.addClass('active');
4211				if( $that.hasClass('grve-responsive-tab-link') && $that.parents('.grve-tab').find('.grve-tabs-title').hasClass('grve-tabs-collapse') ) {
4212					$that.parents('.grve-tab').find(contentId).toggleClass('active');
4213				} else {
4214					$content.removeClass('active');
4215					$that.parents('.grve-tab').find(contentId).addClass('active');
4216				}
4217
4218				if( $content.find('.grve-isotope').length ) {
4219					setTimeout(function(){
4220						GRVE.isotope.init();
4221					},100);
4222				}
4223				if( $content.find('.grve-blog-leader.grve-movedo-style').length ) {
4224					GRVE.leaderPostSize.init();
4225				}
4226				if( $content.find('.owl-carousel').length ) {
4227					$content.find('.owl-carousel').each(function(){
4228						var owl = $(this).data('owlCarousel');
4229						owl.onResize();
4230					});
4231				}
4232
4233				// Go tot top
4234				if( $that.parents().hasClass('grve-tabs-go-top') ) {
4235					GRVE.pageSettings.linkGoToTop( $that.parent(), 300, 30 );
4236				}
4237			});
4238		},
4239		productSocials: function(){
4240			var $socials = $('.grve-product-social'),
4241				$item    = $socials.find('li');
4242			if( !$socials.length ) return;
4243
4244			$socials.appear(function() {
4245				$item.each(function(i,n){
4246					var $this = $(this);
4247					setTimeout(function(){
4248						$this.addClass('grve-animated');
4249					},150 * i);
4250				});
4251			},{accX: 0, accY: -50});
4252		},
4253		countdown: function(){
4254			$('.grve-countdown').each(function() {
4255				var $this        = $(this),
4256					finalDate    = $this.data('countdown'),
4257					numbersSize  = $this.data('numbers-size'),
4258					textSize     = $this.data('text-size'),
4259					numbersColor = $this.data('numbers-color'),
4260					textColor    = $this.data('text-color'),
4261					countdownItems = '',
4262					text = '',
4263					countdownFormat = $this.data('countdown-format').split('|');
4264
4265				$.each( countdownFormat, function( index, value ) {
4266					switch (value) {
4267						case 'w':
4268							text = movedo_grve_main_data.string_weeks;
4269							break;
4270						case 'D':
4271						case 'd':
4272						case 'n':
4273							text = movedo_grve_main_data.string_days;
4274							break;
4275						case 'H':
4276							text = movedo_grve_main_data.string_hours;
4277							break;
4278						case 'M':
4279							text = movedo_grve_main_data.string_minutes;
4280							break;
4281						case 'S':
4282							text = movedo_grve_main_data.string_seconds;
4283							break;
4284						default:
4285							text = '';
4286					}
4287					countdownItems += '<div class="grve-countdown-item">';
4288					countdownItems += '<div class="grve-number grve-' + numbersSize + ' grve-text-' + numbersColor + '">%' + value + '</div>';
4289					countdownItems += '<span class="grve-' + textSize + ' grve-text-' + textColor + '">
4289' + text + '</span>';
4290					countdownItems += '</div>';
4291
4292				});
4293
4294				$this.countdown(finalDate, function(event) {
4295					$this = $(this).html(event.strftime( countdownItems ));
4296				});
4297			});
4298		},
4299		hovers: function(){
4300			var $hoverItem = $('.grve-image-hover');
4301			if( isMobile.any() && 0 == movedo_grve_main_data.device_hover_single_tap ) {
4302				var touchevent = 'touchend';
4303				if( $hoverItem.parent().parent().hasClass('grve-carousel-item') ) {
4304					touchevent = 'touchstart';
4305				}
4306				$hoverItem.on(touchevent, function(e) {
4307					var $item = $(this);
4308					if ( !$item.hasClass('hover') ) {
4309						$item.addClass('hover');
4310						$hoverItem.not(this).removeClass('hover');
4311						e.preventDefault();
4312					}
4313				});
4314				$(document).on('touchstart touchend', function(e) {
4315					if ( !$hoverItem.is(e.target) && $hoverItem.has(e.target).length === 0 ) {
4316						$hoverItem.removeClass('hover');
4317					}
4318				});
4319			} else {
4320				$hoverItem.off('click');
4321				$hoverItem.off('mouseenter mouseleave').on('mouseenter mouseleave', function() {
4322					$(this).toggleClass('hover');
4323				});
4324			}
4325		}
4326	};
4327
4328	// # Parallax Section
4329	// ============================================================================= //
4330	GRVE.parallaxSection = {
4331		init : function( section ){
4332			var $section = $(section);
4333			imagesLoaded( $(section), function() {
4334				$(section).bgParallax({
4335					elClass : '.grve-html5-bg-video, .grve-bg-image'
4336				});
4337			});
4338		}
4339	};
4340
4341	// # Section Settings
4342	// ============================================================================= //
4343	GRVE.sectionSettings = {
4344		init: function(){
4345
4346			if( !$('#grve-sidebar').length > 0 ) return;
4347
4348			var section      = '#grve-content .grve-section',
4349				windowWidth  = $(window).width(),
4350				themeWidth   = $('#grve-theme-wrapper').width(),
4351				wrapperWidth = $('.grve-content-wrapper').width(),
4352				contentWidth = $('#grve-main-content').width(),
4353				sidebarWidth = $('#grve-sidebar').outerWidth(),
4354				space        = (themeWidth - wrapperWidth)/2,
4355				sidebarSpace = space + wrapperWidth - contentWidth;
4356
4357
4358			$(section).each(function(){
4359				var $section = $(this);
4360				if( $section.hasClass('grve-fullwidth-background') ){
4361					fullBg($section);
4362				}
4363				if( $section.hasClass('grve-fullwidth') ){
4364					fullElement($section);
4365				}
4366
4367			});
4368
4369			function fullBg( section ) {
4370				if( windowWidth + scrollBarWidth >= tabletPortrait ) {
4371					if( $('.grve-right-sidebar').length ) {
4372						section.css({ 'visibility': 'visible', 'padding-left':space, 'padding-right': sidebarSpace, 'margin-left': -space, 'margin-right': -sidebarSpace});
4373					}
4374					else {
4375						section.css({ 'visibility': 'visible', 'padding-left':sidebarSpace, 'padding-right': space, 'margin-left': -sidebarSpace, 'margin-right': -space});
4376					}
4377				} else {
4378					section.css({ 'visibility': 'visible', 'padding-left':'', 'padding-right': '', 'margin-left': '', 'margin-right': ''});
4379				}
4380
4381			}
4382
4383			function fullElement( section ) {
4384				if( windowWidth + scrollBarWidth >= tabletPortrait ) {
4385					if( $('.grve-right-sidebar').length ) {
4386						section.css({ 'visibility': 'visible', 'padding-left':0, 'padding-right': sidebarSpace, 'margin-left': -space, 'margin-right': -sidebarSpace});
4387					}
4388					else {
4389						section.css({ 'visibility': 'visible', 'padding-left':sidebarSpace, 'padding-right': 0, 'margin-left': -sidebarSpace, 'margin-right': -space});
4390					}
4391				} else {
4392					section.css({ 'visibility': 'visible', 'padding-left':'', 'padding-right': '', 'margin-left': -space, 'margin-right': -space});
4393				}
4394			}
4395		}
4396	};
4397
4398	// # Isotope
4399	// ============================================================================= //
4400	GRVE.isotope = {
4401
4402		init: function(){
4403			var $selector = $('.grve-isotope');
4404			if( !$selector.length ) return;
4405			$selector.each(function(){
4406				var $element = $(this);
4407				GRVE.isotope.settings($element);
4408			});
4409
4410		},
4411		settings: function($element){
4412			var $container   = $element.find('.grve-isotope-container'),
4413				$curCategory = $element.find('.grve-current-category'),
4414				$isotopItem  = $container.find('.grve-isotope-item'),
4415				layout       = $element.data('layout') !== '' ? $element.data('layout') : 'fitRows',
4416				columnWidth  = $element.hasClass('grve-portfolio') ? '.grve-image-square' : '',
4417				dataSpinner  = $element.data('spinner'),
4418				gap          = $element.hasClass('grve-with-gap') && !isNaN( $element.data('gutter-size') ) ? Math.abs( $element.data('gutter-size') )/2 : 0,
4419				isOriginLeft = $('body').hasClass('rtl') ? false : true;
4420
4421			var offset       = $element.parents('.grve-section').hasClass('grve-fullwidth') ? -(gap * 2) : gap * 2,
4422				windowWidth  = $(window).width() + scrollBarWidth,
4423				wrapperW, columns, columnW, containerW;
4424
4425			if( $element.hasClass('grve-with-gap') && $element.parents('.grve-section').hasClass('grve-fullwidth') ) {
4426				$element.css({'padding-left' : gap*2, 'padding-right' : gap*2 });
4427			}
4428
4429			// Add Spinner
4430			if( dataSpinner == 'yes' ) {
4431				addSpinner();
4432			}
4433			// Filters
4434			filter();
4435
4436			var resizing = false,
4437				initIso  = false,
4438				smallDelay;
4439
4440			updateParams( initIsotope );
4441
4442			if( !isMobile.any() || isMobile.Android() ) {
4443				$(window).smartresize(updateParams);
4444			} else {
4445				$(window).on("orientationchange",function(){
4446					setTimeout(updateParams, 100);
4447				});
4448			}
4449
4450			$('.grve-modal-popup').on( "grve_relayout_isotope", function() {
4451				updateParams();
4452			});
4453
4454			function updateParams(callback){
4455				if( !resizing ) {
4456					resizing = true;
4457					windowWidth = $(window).width() + scrollBarWidth;
4458					wrapperW = $element.innerWidth() -2;
4459					columns = setColumns();
4460					columnW = ( wrapperW + offset ) / columns;
4461					columnW = (columnW % 1 !== 0) ? Math.ceil(columnW) : columnW;
4462					containerW = columnW * columns;
4463
4464					itemSize();
4465					containerSize();
4466					if( callback && !initIso ) callback();
4467
4468					if( initIso ) {
4469						window.clearTimeout(smallDelay);
4470						smallDelay = window.setTimeout( function(){
4471							// Equal Columns
4472							if( layout === 'fitRows' && gridEqual ) {
4473								gridEqualColumns();
4474							}
4475							if( $container.parents('.grve-section').hasClass('grve-custom-height') ){
4476								$container.parents('.grve-section').data('plugin_columnSize').reCalculate();
4477							}
4478						}, 200 );
4479					}
4480
4481					$container.isotope('layout');
4482					resizing = false;
4483				}
4484			}
4485
4486			function setColumns(){
4487				var columns = {
4488						largeS   : $element.data('columns-large-screen'),
4489						desktop  : $element.data('columns'),
4490						tabletL  : $element.data('columns-tablet-landscape'),
4491						tabletP  : $element.data('columns-tablet-portrait'),
4492						mobile  : $element.data('columns-mobile')
4493					};
4494				$element.removeClass('grve-isotope-column-5 grve-isotope-column-4 grve-isotope-column-3 grve-isotope-column-2 grve-isotope-column-1');
4495				if ( windowWidth > largeScreen ) {
4496					columns = columns.largeS;
4497				} else if ( windowWidth > tabletLandscape && windowWidth <= largeScreen ) {
4498					columns = columns.desktop;
4499				} else if ( windowWidth > tabletPortrait && windowWidth <= tabletLandscape ) {
4500					columns = columns.tabletL;
4501				} else if ( windowWidth > mobileScreen && windowWidth <= tabletPortrait ) {
4502					columns = columns.tabletP;
4503				} else {
4504					columns = columns.mobile;
4505				}
4506
4507				$element.addClass('grve-isotope-column-' + columns);
4508				return columns;
4509			}
4510
4511			function itemSize(){
4512
4513				$isotopItem.css({ 'padding-left' : gap, 'padding-right' : gap, 'margin-bottom' : gap * 2, 'width' : columnW });
4514				// Item Width * 2
4515				if( columns != 1 ) {
4516					$container.find('.grve-image-landscape').css({ 'width': columnW * 2 }).find('.grve-media').css({ 'height': columnW - ( gap * 2 ) });
4517					$container.find('.grve-image-portrait').css({ 'width': columnW }).find('.grve-media').css({ 'height': ( columnW * 2 ) - ( gap * 2 ) });
4518				}
4519
4520				// Item Column 2
4521				if( columns == 2 ) {
4522					if( windowWidth > mobileScreen ){
4523						$container.find('.grve-image-landscape').css({ 'width': columnW  }).find('.grve-media').css({ 'height': ( columnW / 2 ) - ( gap * 2 ) });
4524					} else {
4525						$container.find('.grve-image-landscape').css({ 'width': columnW  }).find('.grve-media').css({ 'height': columnW - ( gap * 2 ) });
4526					}
4527				}
4528
4529				// Item Column 1
4530				if( columns == 1 ) {
4531					$container.find('.grve-image-landscape').css({ 'width': columnW  }).find('.grve-media').css({ 'height': '' });
4532					$container.find('.grve-image-portrait').css({ 'width': columnW }).find('.grve-media').css({ 'height': '' });
4533				}
4534			}
4535
4536			function containerSize(){
4537				$container.css({'margin-left' : - gap, 'margin-right' : - gap, 'width' : containerW });
4538			}
4539
4540			function initIsotope(){
4541				$container.isotope({
4542					itemSelector: '.grve-isotope-item',
4543					stamp: '.grve-isotope-stamp-item',
4544					layoutMode: layout,
4545					animationEngine : 'jquery',
4546					masonry: {
4547						columnWidth: columnWidth
4548					},
4549					resize: false,
4550					isOriginLeft: isOriginLeft
4551				});
4552				// layout Isotope after each image loads
4553				$container.imagesLoaded('always',function(){
4554					$container.isotope('layout');
4555					// Spinner
4556					var dataSpinner = $container.parent().data('spinner');
4557					if( dataSpinner == 'yes' ) {
4558						setTimeout(function() {
4559							removeSpinner();
4560						},2000);
4561					} else {
4562						$container.css({'opacity': 1});
4563						// Isotope Animation
4564						if( !isMobile.any() ){
4565							animation($container);
4566						} else {
4567							$container.find('.grve-isotope-item-inner').addClass('grve-animated');
4568						}
4569					}
4570				});
4571
4572				initIso = true;
4573			}
4574
4575			function addSpinner(){
4576				var $spinner = $('<div class="grve-spinner"></div>');
4577				$spinner.appendTo( $element );
4578			}
4579
4580			function removeSpinner(){
4581				$element.find('.grve-spinner').fadeOut(600,function(){
4582					$container.css({'opacity': 1});
4583					animation();
4584				});
4585			}
4586
4587			function animation(){
4588				var cnt = 1,
4589					itemAppeared = 1;
4590				$isotopItem.appear(function() {
4591					var $this = $(this),
4592						delay = 200 * cnt++;
4593
4594					setTimeout(function () {
4595						itemAppeared++;
4596						if( itemAppeared == cnt ){
4597							cnt = 1;
4598						}
4599						$this.find('.grve-isotope-item-inner').addClass('grve-animated');
4600					}, delay);
4601				});
4602			}
4603
4604			function filter(){
4605				$element.find('.grve-filter li').on('click', function() {
4606					var $filter      = $(this),
4607						selector     = $filter.attr('data-filter'),
4608						gototop      = $filter.parents('.grve-filter').attr('data-gototop') == 'no' ? false : true,
4609						title        = $filter.html(),
4610						$curCategory = $element.find('.grve-current-category');
4611
4612					if( $curCategory.length > 0 ){
4613						$curCategory.find('span').html( title );
4614					}
4615
4616					$container.isotope({
4617						filter: selector
4618					});
4619
4620					// Go tot top
4621					if( gototop ) {
4622						GRVE.pageSettings.linkGoToTop( $filter.parent(), 300, 30 );
4623					}
4624
4625					$(this).addClass('selected').siblings().removeClass('selected');
4626				});
4627			}
4628
4629			function gridEqualColumns(){
4630				var $elContent = $container.find('.grve-blog-item-inner'),
4631					heightArr = [],
4632					columnMaxH = 0;
4633
4634				// Reset Height
4635				$container.find('.grve-isotope-item .grve-post-content').css('height','auto');
4636				$container.find('.grve-isotope-item .grve-blog-item-inner').css('height','auto');
4637				$container.find('.grve-isotope-item .grve-post-meta-wrapper').removeClass('grve-bottom');
4638
4639				$elContent.each(function(){
4640					var $that = $(this),
4641						height = $that.outerHeight();
4642					heightArr.push( height );
4643				});
4644
4645				columnMaxH = heightArr.length > 0 ? Math.max.apply(Math, heightArr) : 0;
4646
4647				$container.find('.grve-isotope-item .grve-blog-item-inner').css('height',columnMaxH);
4648				$container.find('.grve-isotope-item .grve-post-meta-wrapper').addClass('grve-bottom');
4649				$container.find('.grve-isotope-item.grve-style-2').addClass('grve-middle');
4650
4651				$container.isotope('layout');
4652			}
4653		},
4654		noIsoFilters: function() {
4655			var $selector = $('.grve-non-isotope');
4656			$selector.each(function(){
4657				var $that = $(this);
4658				$that.find('.grve-filter li').on('click', function() {
4659					var selector = $(this).attr('data-filter');
4660					if ( '*' == selector ) {
4661						$that.find('.grve-non-isotope-item').fadeIn('1000');
4662					} else {
4663						$that.find('.grve-non-isotope-item').hide();
4664						$that.find(selector).fadeIn('1000');
4665					}
4666					$(this).addClass('selected').siblings().removeClass('selected');
4667				});
4668			});
4669		}
4670	};
4671
4672	// # Social Bar For Post
4673	// ============================================================================= //
4674	GRVE.socialBar = {
4675		init : function(){
4676			var $bar = $('#grve-socials-bar');
4677			if( !$bar.length > 0 ) {
4678				return;
4679			}
4680			if( isMobile.any() ) {
4681				$bar.addClass('grve-no-animation');
4682				return;
4683			}
4684			var posTop       = $bar.offset().top,
4685				scroll       = $(window).scrollTop(),
4686				windowHeight = $(window).height(),
4687				offset       = ( $bar.offset().top - windowHeight ) + 50;
4688
4689			if( scroll > offset ) {
4690				this.showSocials();
4691			} else {
4692				this.hideSocials();
4693			}
4694		},
4695		showSocials : function(){
4696			var $item = $('#grve-socials-bar').find('ul.grve-socials li a'),
4697				i = 0;
4698			$item.each(function(){
4699				var $that = $(this);
4700				i++;
4701				setTimeout(function () {
4702					$that.addClass('show');
4703				}, i * 200 );
4704			});
4705		},
4706		hideSocials : function(){
4707			var $item = $('#grve-socials-bar').find('ul.grve-socials li a');
4708			$item.removeClass('show');
4709		}
4710	};
4711
4712
4713	// # Scroll Direction
4714	// ============================================================================= //
4715	GRVE.scrollDir = {
4716		init: function(){
4717			var scroll = $(window).scrollTop();
4718			if (scroll > lastScrollTop){
4719				lastScrollTop = scroll;
4720				return { direction : 'scrollDown'  };
4721			} else {
4722				lastScrollTop = scroll;
4723				return { direction : 'scrollUp'  };
4724			}
4725
4726			lastScrollTop = scroll;
4727		}
4728	};
4729
4730	// # Full Page
4731	// ============================================================================= //
4732	GRVE.fullPage = {
4733		init: function(){
4734			var $fPage = $('#grve-fullpage');
4735			if( !$fPage.length > 0 ) return;
4736				var $section = $fPage.find('.grve-row-section');
4737				var deviceNavigation = true;
4738				var deviceAutoScrolling = true;
4739				var scrollOverflow = true;
4740				var fitToSection = true;
4741				var speed = $fPage.data('scroll-speed');
4742				var deviceFullPageEnable = $fPage.data('device-scrolling') == 'yes' ? true : false;
4743				var lockAnchors = $fPage.data('lock-anchors') == 'yes' ? true : false;
4744				var loop = $fPage.data('scroll-loop');
4745				var loopTop = false;
4746				var loopBottom = false;
4747				if ( 'both' == loop || 'top' == loop ) {
4748					loopTop = true;
4749				}
4750				if ( 'both' == loop || 'bottom' == loop ) {
4751					loopBottom = true;
4752				}
4753
4754				if( isMobile.any() && !deviceFullPageEnable ) {
4755					deviceNavigation = false;
4756					deviceAutoScrolling = false;
4757					scrollOverflow = false;
4758					fitToSection = false;
4759					$section.find('.grve-animated-item').addClass('grve-animated');
4760				}
4761
4762				var navigationAnchorTooltips = $('[data-anchor-tooltip]').map(function(){
4763					return $(this).data('anchor-tooltip').toString();
4764				}).get();
4765
4766			$fPage.fullpage({
4767				navigation: deviceNavigation,
4768				navigationPosition: 'right',
4769				navigationTooltips: navigationAnchorTooltips,
4770				sectionSelector: $section,
4771				css3: true,
4772				scrollingSpeed: speed,
4773				autoScrolling : deviceAutoScrolling,
4774				fitToSection : fitToSection,
4775				lockAnchors : lockAnchors,
4776				loopTop : loopTop,
4777				loopBottom : loopBottom,
4778				scrollOverflow: scrollOverflow,
4779				afterLoad: function(anchorLink, index){
4780
4781					var sectionHeaderColor = $($section[index-1]).attr('data-header-color');
4782					var color = 'grve-' + sectionHeaderColor;
4783
4784					$section.find('.fp-tableCell').css('visibility','visible');
4785
4786					// Set Header Color
4787					if( !$('#grve-main-header').hasClass('grve-header-side') ) {
4788						$('#grve-main-header').removeClass('grve-light grve-dark').addClass(color);
4789					}
4790					$('#fp-nav').removeClass('grve-light grve-dark').addClass(color);
4791
4792					GRVE.scrollingPageAnimations.addAnim( $section, index );
4793				},
4794				afterRender: function(){
4795
4796					$('.grve-bg-video').each(function(){
4797						var $that = $(this),
4798							$video = $that.find('video');
4799						if( $video.length ){
4800							$video[0].play();
4801						}
4802						GRVE.pageSettings.resizeVideoBgElement( $that );
4803					});
4804
4805				},
4806				onLeave: function(index){
4807					if( !isMobile.any() ) {
4808						GRVE.scrollingPageAnimations.removeAnim( $section, index, speed );
4809					}
4810				}
4811			});
4812
4813			$(window).on('grve_open_hidden_area', function(){
4814				$.fn.fullpage.setFitToSection(false);
4815				$.fn.fullpage.setAutoScrolling(false);
4816				$('html, body').scrollTop(0);
4817			});
4818			$(window).on('grve_close_hidden_area', function(){
4819				if( isMobile.any() && deviceFullPageEnable ) {
4820					$.fn.fullpage.setFitToSection(true);
4821					$.fn.fullpage.setAutoScrolling(true);
4822				}
4823				$.fn.fullpage.silentMoveTo('firstSlide');
4824			});
4825
4826		}
4827	};
4828
4829	// # Pilling Page
4830	// ============================================================================= //
4831	GRVE.pillingPage = {
4832		init: function(){
4833			var $fPage = $('#grve-pilling-page');
4834			if( !$fPage.length > 0 ) return;
4835				var $section = $fPage.find('.grve-row-section');
4836				var deviceFullPageEnable = $fPage.data('device-scrolling') == 'yes' ? true : false;
4837				var lockAnchors = $fPage.data('lock-anchors') == 'yes' ? true : false;
4838				var direction = $fPage.data('scroll-direction');
4839				var loop = $fPage.data('scroll-loop');
4840				var speed = $fPage.data('scroll-speed');
4841				var loopTop = false;
4842				var loopBottom = false;
4843				if ( 'both' == loop || 'top' == loop ) {
4844					loopTop = true;
4845				}
4846				if ( 'both' == loop || 'bottom' == loop ) {
4847					loopBottom = true;
4848				}
4849
4850				if( isMobile.any() && !deviceFullPageEnable ) {
4851					$fPage.addClass('grve-disable-on-device');
4852					$section.find('.grve-animated-item').addClass('grve-animated');
4853					$section.children().wrap('<div class="pp-tableCell"></div>');
4854					$('.grve-row-section').each(function(){
4855						if ( $(this).attr('data-anchor').length ) {
4856							$(this).attr('id',  $(this).attr('data-anchor') );
4857						}
4858					});
4859					return;
4860				}
4861
4862				var navigationAnchorTooltips = $('[data-anchor-tooltip]').map(function(){
4863					return $(this).data('anchor-tooltip').toString();
4864				}).get();
4865
4866
4867				var navigationAnchors = [];
4868				if ( !lockAnchors ) {
4869					navigationAnchors  = $('[data-anchor]').map(function(){
4870						return $(this).data('anchor').toString();
4871					}).get();
4872				}
4873
4874				$('html').addClass('fp-enabled');
4875
4876
4877			$fPage.pagepiling({
4878				sectionSelector: $section,
4879				css3: true,
4880				scrollingSpeed: speed,
4881				anchors: navigationAnchors,
4882				direction: direction,
4883				lockAnchors : lockAnchors,
4884				loopTop : loopTop,
4885				loopBottom : loopBottom,
4886				navigation: {
4887					'tooltips': navigationAnchorTooltips
4888				},
4889				afterLoad: function(anchorLink, index){
4890
4891					var sectionHeaderColor = $($section[index-1]).attr('data-header-color');
4892					var color = 'grve-' + sectionHeaderColor;
4893					// Set Header Color
4894					if( !$('#grve-main-header').hasClass('grve-header-side') ) {
4895						$('#grve-main-header').removeClass('grve-light grve-dark').addClass(color);
4896					}
4897					$('#pp-nav').removeClass('grve-light grve-dark').addClass(color);
4898
4899					GRVE.scrollingPageAnimations.addAnim( $section, index );
4900				},
4901				afterRender: function(){
4902					var sectionHeaderColor = $($section[0]).attr('data-header-color');
4903					var color = 'grve-' + sectionHeaderColor;
4904
4905					$('.grve-bg-video').each(function(){
4906						var $that = $(this),
4907							$video = $that.find('video');
4908						if( $video.length ){
4909							$video[0].play();
4910						}
4911						GRVE.pageSettings.resizeVideoBgElement( $that );
4912					});
4913					// Set Header Color
4914					if( !$('#grve-main-header').hasClass('grve-header-side') ) {
4915						$('#grve-main-header').removeClass('grve-light grve-dark').addClass(color);
4916					}
4917					$('#pp-nav').removeClass('grve-light grve-dark').addClass(color);
4918
4919					if( $section.find('.grve-isotope').length ) {
4920						GRVE.isotope.init();
4921					}
4922
4923					GRVE.scrollingPageAnimations.addAnim( $section, 1 );
4924				},
4925				onLeave: function(index){
4926					GRVE.scrollingPageAnimations.removeAnim( $section, index, speed );
4927				}
4928			});
4929		}
4930	};
4931
4932	// # Scrolling Page Animations
4933	// ============================================================================= //
4934	GRVE.scrollingPageAnimations = {
4935		addAnim: function( section, index ){
4936			var $section = $(section[index-1]),
4937				$element = $section.find('.grve-animated-item'),
4938				$column = $section.find('.grve-clipping-animation');
4939
4940			$element.each(function(){
4941				var $that = $(this),
4942					delay = $that.data('delay');
4943				if( $that.parents('.grve-clipping-animation').length ) return;
4944				setTimeout(function(){
4945					$that.addClass('grve-animated');
4946				},delay);
4947			});
4948
4949			$column.each(function(){
4950				var $that = $(this),
4951					$element = $that.find('.grve-animated-item'),
4952					delay = $that.data('delay');
4953				setTimeout(function(){
4954					GRVE.pageSettings.clippingAnimated( $that );
4955					setTimeout(function(){
4956						$element.addClass('grve-animated');
4957					},700);
4958				},delay);
4959			});
4960
4961
4962		},
4963		removeAnim: function(section, index, speed){
4964			var $section = $(section[index-1]),
4965				$element = $section.find('.grve-animated-item');
4966			setTimeout(function(){
4967				$element.removeClass('grve-animated');
4968			},speed);
4969		}
4970	};
4971
4972	// # Global Variables
4973	// ============================================================================= //
4974	var bodyLoader = false;
4975	var largeScreen = 2048;
4976	var tabletLandscape = 1200;
4977	var tabletPortrait = 1023;
4978	var mobileScreen = 767;
4979	var lastScrollTop = 0;
4980	var wpBarHeight = $('#grve-body').hasClass('admin-bar') ? 32 : 0;
4981	var $videoBg = $('.grve-bg-video');
4982	var isMobile = {
4983		Android: function() {
4984			return navigator.userAgent.match(/Android/i);
4985		},
4986		BlackBerry: function() {
4987			return navigator.userAgent.match(/BlackBerry/i);
4988		},
4989		iOS: function() {
4990			return navigator.userAgent.match(/iPhone|iPad|iPod/i);
4991		},
4992		Opera: function() {
4993			return navigator.userAgent.match(/Opera Mini/i);
4994		},
4995		Windows: function() {
4996			return navigator.userAgent.match(/IEMobile/i);
4997		},
4998		any: function() {
4999			return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
5000		}
5001	};
5002
5003	// Animation support & prefixing
5004	var t = document.body || document.documentElement;
5005	var s = t.style;
5006	var tSupport = s.transition !== undefined || s.WebkitTransition !== undefined || s.MozTransition !== undefined || s.MsTransition !== undefined || s.OTransition !== undefined;
5007	var property = [ 'WebkitTransform', 'MozTransform', 'OTransform', 'msTransform' ];
5008	var prefix;
5009	for( var i in property ){
5010		if( s[ property[ i ] ] !== undefined ){
5011			prefix = '-' + property[ i ].replace( 'Transform', '' ).toLowerCase();
5012		}
5013	}
5014	var transform = prefix + '-transform';
5015
5016	// # Scrollbar Width
5017	// ============================================================================= //
5018	var parent, child, scrollBarWidth;
5019
5020	if( scrollBarWidth === undefined ) {
5021		parent          = $('<div style="width:50px;height:50px;overflow:auto"><div/></div>').appendTo('body');
5022		child           = parent.children();
5023		scrollBarWidth  = child.innerWidth()-child.height(99).innerWidth();
5024		parent.remove();
5025	}
5026
5027	$(document).ready(function(){ GRVE.documentReady.init(); });
5028	$(window).smartresize(function(){ GRVE.documentResize.init(); });
5029	$(window).on('load',function () { GRVE.documentLoad.init(); });
5030	$(window).on('scroll', function() { GRVE.documentScroll.init(); });
5031
5032})(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.