PageSourceSearch

https://sparkconsultants.co.uk/wp-content/themes/oshin/js/script.js?ver=1790295093

js sparkconsultants.co.uk collected 2026-09-30 16:14:39 UTC 105,530 bytes, 2,436 lines download raw bytes

1;(function($) {
2    jQuery.fn.center = function(parent) {
3        if (parent) {
4            parent = this.parent();
5        } else {
6            parent = window;
7        }
8        this.css({
9            "position": "absolute",
10            "top": (((jQuery(parent).height() - this.outerHeight()) / 2) + jQuery(parent).scrollTop() + "px"),
11            "left": (((jQuery(parent).width() - this.outerWidth()) / 2) + jQuery(parent).scrollLeft() + "px")
12        });
13        return this;
14    }
15})(jQuery);
16
17// Custom Side with Fade Animation
18;(function($) {
19    jQuery.fn.slideFadeToggle  = function(speed, easing, callback) {
20        return this.animate({opacity: 'toggle', height: 'toggle', padding: 'toggle', margin: 'toggle'}, speed, easing, callback);
21    };
22})();
23
24/**OS SCROLLBAR**/
25;(function($) {
26	var scrollbarWidth = 0;
27	$.getScrollbarWidth = function() {
28		if ( !scrollbarWidth ) {
29			// if ( $.browser.msie ) {
30			if (navigator.userAgent.match(/MSIE ([0-9]+)\./)){
31				var $textarea1 = $('<textarea cols="10" rows="2"></textarea>')
32						.css({ position: 'absolute', top: -1000, left: -1000 }).appendTo('body'),
33					$textarea2 = $('<textarea cols="10" rows="2" style="overflow: hidden;"></textarea>')
34						.css({ position: 'absolute', top: -1000, left: -1000 }).appendTo('body');
35				scrollbarWidth = $textarea1.width() - $textarea2.width();
36				$textarea1.add($textarea2).remove();
37			} else {
38				var $div = $('<div />')
39					.css({ width: 100, height: 100, overflow: 'auto', position: 'absolute', top: -1000, left: -1000 })
40					.prependTo('body').append('<div />').find('div')
41						.css({ width: '100%', height: 200 });
42				scrollbarWidth = 100 - $div.width();
43				$div.parent().remove();
44			}
45		}
46		return scrollbarWidth;
47	};
48})(jQuery);
49
50//Parallax
51;(function( $ ) {
52	var $window = $(window), update_parallax;
53	var windowHeight = $window.height();
54
55	$window.resize(function () {
56		windowHeight = $window.height();
57	});
58
59	$.fn.parallax = function(xpos, speedFactor, outerHeight) {
60		var $this = $(this);
61		var getHeight;
62		var firstTop;
63		var paddingTop = 0;
64		//get the starting position of each element to have parallax applied to it    
65		$this.each(function(){
66			firstTop = $this.offset().top;
67		});
68		if (outerHeight) {
69			getHeight = function(jqo) {
70			return jqo.outerHeight(true);
71		};
72		} else {
73			getHeight = function(jqo) {
74				return jqo.height();
75			};
76		}
77		// setup defaults if arguments aren't specified
78		if (arguments.length < 1 || xpos === null) xpos = "50%";
79		if (arguments.length < 2 || speedFactor === null) speedFactor = 0.5;
80		if (arguments.length < 3 || outerHeight === null) outerHeight = true;
81		// function to be called whenever the window is scrolled or resized
82		update_parallax = function() {
83			var pos = $window.scrollTop();
84			$this.each(function() {
85				var $element = $(this);
86				var top = $element.offset().top;
87				var height = getHeight($element);
88				// Check if totally above or totally below viewport
89				if (top + height < pos || top > pos + windowHeight) {
90					return;
91				}
92				$this.css('backgroundPosition', xpos + " " + Math.round((firstTop - pos) * speedFactor) + "px");
93			});
94		}
95		$window.on('scroll.parallaxscroll', update_parallax);
96		$window.on('smartresize.parallaxresize', update_parallax);
97		update_parallax();
98	};
99	jQuery(document).on("update_content", function() {
100		if(jQuery(this).find('.be-section.be-bg-parallax').length == 0) {
101			$window.off('scroll.parallaxscroll', update_parallax);
102			$window.off('scroll.parallaxresize', update_parallax);
103		}
104    });
105})(jQuery);
106
107
108;(function( $ ) {
109    'use strict';
110
111	var vendorScriptsUrl = oshineThemeConfig.vendorScriptsUrl,
112		dependencies = oshineThemeConfig.dependencies || {};
113
114	if( 'undefined' != typeof dependencies ) {
115		for( var dependency in dependencies ) {
116			if( dependencies.hasOwnProperty( dependency ) ) {
117				asyncloader.register( dependencies[ dependency ], dependency );
118			}
119		}
120	}
121	
122	/**
123	 * youtube player api
124	 */
125	(function($) {
126		if( $( '.be-youtube-embed' ).length ) {
127			var tag = document.createElement('script');
128			tag.src = "https://www.youtube.com/iframe_api";
129			var firstScriptTag = document.getElementsByTagName('script')[0];
130			firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
131			var previousAPIReadyCallback = window.onYouTubeIframeAPIReady;
132			window.onYouTubeIframeAPIReady =  function() {
133				if( 'function' == typeof previousAPIReadyCallback ) {
134					previousAPIReadyCallback();
135				}
136				$(document).trigger( 'YTAPIReady' );
137			}
138		}
139	})(jQuery);
140
141	asyncloader.register( 'https://f.vimeocdn.com/js/froogaloop2.min.js' , 'vimeo' );
142	asyncloader.register( "https://player.vimeo.com/api/player.js", 'vimeonew' );
143
144	
145    function Selector_Cache() {
146	    var collection = {};
147
148	    function get_from_cache( selector ) {
149	        if ( undefined === collection[ selector ] ) {
150	            collection[ selector ] = jQuery( selector );
151	        }
152
153	        return collection[ selector ];
154	    }
155
156	    return { get: get_from_cache };
157	}
158
159    jQuery(document).ready( function() {
160
161
162	    var oshine_scripts = (function() {
163
164	    	var page_loader = jQuery('.page-loader'), 
165	    	 	 ajax_url = jQuery('#ajax_url').val(), 
166				 fixedFooter = jQuery( '#be-fixed-footer-wrap' ),
167				 fixedFooterPlaceholder = jQuery( '#be-fixed-footer-placeholder' ),
168	    	 	 transition, 
169	    	 	 exclude_links,
170	    	 	 body = jQuery('body'),
171                  html = jQuery('html'),
172                  $win = jQuery(window),
173                  $doc = jQuery(document),
174	    	 	 selectors = new Selector_Cache(),
175	    	 	 to_top_button = jQuery('#back-to-top'),
176	    	 	 fullscreen_wrap = jQuery('.hero-section-wrap, .full-screen-section, .tatsu-fullscreen'),
177				 didScroll = false, 
178	    	 	 
179
180	    	resize_gallery_video =  function() {
181		        if (jQuery(window).width() < 769) {
182		        	var width = jQuery('#gallery-container-wrap').width();
183		            jQuery('iframe.gallery').each(function () {
184		                jQuery(this).width( width );
185		            });
186		        } else {
187		            jQuery('iframe.gallery').each(function () {
188		                jQuery(this).width( ( jQuery(this).height() * 1.77 ) );
189		            });
190		        }
191	    	},
192
193	    	menu_link_animation = function() {
194		        var delay = 100, 
195		            index = 0,
196		            slidebar_menu = document.getElementById("slidebar-menu").children,
197		            child_count = slidebar_menu.length;
198				setTimeout( function(){
199					jQuery('#slidebar-menu').children('li').each( function(i, el ){
200						setTimeout( function(){
201							jQuery(this).addClass("menu-loaded");
202						}.bind(this), delay * i );
203					}); 
204				}, 500 );  				
205	    	},
206
207	    	custom_scrollbar = function() {
208	    		if( !body.hasClass('tatsu-frame') ) {
209		    		var gallery_content = jQuery('.simplebar-content');
210				        if ( gallery_content.length > 0 ) {
211							gallery_content.perfectScrollbar();
212							
213				        }
214				} 		
215	    	}, 
216
217	    	single_page_nav = function() {
218	    		if ( body.hasClass('single-page-version') && !body.hasClass('section-scroll') ) {
219			        var append_section = '',
220			            specific_section = jQuery('.tatsu-section'),
221			            section_length = specific_section.length,
222			            section_id, 
223			            section_title,
224			            index = 0;
225			        if( jQuery('.single-page-nav-wrap').length > 0 ){
226			            body.find('.single-page-nav-wrap').remove();
227			        }
228		           
229		            if( jQuery('#hero-section').length > 0 ){
230		                append_section = '<a class="single-page-nav-link back-to-top" href="#"><span>Home</span></a>';
231		            }
232		            for ( index; index < section_length; index++ ) {
233		                section_id = specific_section.eq(index).attr('id');
234		                section_title = specific_section.eq(index).attr('data-title');
235		                if( section_id ){
236		                    if( section_title ){   
237		                        section_title = "<span>" + section_title + "</span>";                                                 
238		                    } else {
239		                        section_title = '';
240		                    }
241		                    append_section += '<a class="single-page-nav-link" href="#'+section_id+'">'+section_title+'</a>';       
242		                }
243		            }
244		            body.append('<div class="single-page-nav-wrap clearfix"><div class="single-page-nav-wrap-inner clearfix"><div class="sinle-page-nav-links">'+append_section+'</div></div></div>');
245		        } 
246		        
247	    	},
248
249	    	menu_item_update = function() {
250		        var header_height = jQuery('#wpadminbar').height() + 1,
251		            main_menu_items = jQuery('li.menu-item'),
252		            single_page_nav_dots = jQuery('.single-page-nav-link'),  //Should add context after converting single-page-nav-wrap and single-page-nav-links to ID
253		            total_sections = jQuery('.tatsu-section'),
254		            section_count = total_sections.length,
255		            window_height = jQuery(window),
256		            header_bottom_bar = jQuery('#header-bottom-bar'),
257		            index = 0;
258		        if( body.hasClass('top-header') ){
259		            header_height += Number_or_zero( jQuery('#header-wrap').attr('data-default-height') );
260		            if( header_bottom_bar.length > 0 ){
261		                header_height += header_bottom_bar.height();
262		            }
263		        }
264		        if( body.hasClass('single-page-version') ){
265		            main_menu_items.removeClass('current-menu-item');
266		            for( index; index < section_count; index++ ) {
267		                var current_object = total_sections.eq(index),
268		                    current_object_id = current_object.attr('id');           
269		                if( window_height.scrollTop() + header_height >= current_object.offset().top ){
270		                    main_menu_items.removeClass('current-menu-item current-section');
271		                    single_page_nav_dots.removeClass('current-section-nav-link');
272		                    if( current_object_id ){
273		                        main_menu_items.find('a[href$="#'+ current_object_id +'"]').closest('li.menu-item').addClass('current-menu-item current-section');
274		                        single_page_nav_dots.filter('a[href$="#' + current_object_id + '"]').addClass('current-section-nav-link');
275		                    }
276		                }
277		            }
278		        }
279	    	},
280
281
282
283	    	open_leftstrip = function() {
284				if( jQuery( 'body' ).hasClass( 'left-sliding' ) || jQuery( 'body' ).hasClass( 'top-overlay-menu' ) ){
285					jQuery('.left-strip-wrapper').removeClass('hide');
286					html = html.removeClass('hide-overflow');	    
287				}		
288	    	},
289
290
291
292	    	animate_scroll = function( element ) {
293		        if ( body.hasClass('section-scroll') && ( jQuery(window).width() > 1024 ) && html.hasClass('csstransforms') ) {
294		            jQuery.fn.translate(element);
295		            return false;
296				}
297				if (jQuery(element).hasClass('be-gdpr-popup') || jQuery(element).hasClass('white-popup') ){
298                    return false;
299                }
300		        var $scroll_to = 1, 
301		        $sticky_offset,
302		        header_wrap = jQuery('#header-wrap'),
303		        header_wrap_default_height = Number_or_zero( header_wrap.attr('data-default-height') ),
304		        header_wrap_sticky_height = Number_or_zero( header_wrap.attr('data-sticky-height') ),
305		        top_bar_height = Number_or_zero( jQuery('#header-top-bar-wrap').innerHeight() ),
306		        bottom_bar_height = Number_or_zero( jQuery('#header-bottom-bar').innerHeight() ),
307		        admin_bar_height = Number_or_zero( jQuery('#wpadminbar').height() ),
308		        hero_section = jQuery('.header-hero-section'),
309		        first_pb_section = jQuery( '#page-content div' ).children( '.tatsu-section:nth-child(1)'),
310		        bordered_header_layout = jQuery('#main').hasClass('layout-border-header-top');
311
312
313		        if ( element.length > 0 ) {
314					$scroll_to = Number_or_zero( element.offset().top ) - admin_bar_height;
315		        }
316
317		        if ( jQuery(window).width() > 960 && !( body.hasClass('page-template-page-splitscreen-left')  || body.hasClass('page-template-page-splitscreen-right') ) ) {
318		            if ( body.hasClass('sticky-header') || body.hasClass('transparent-sticky') ) {
319		                if ( body.hasClass('sticky-header') ) {
320		                    $sticky_offset = jQuery('#header').offset().top + header_wrap_default_height + top_bar_height + bottom_bar_height;
321		                }
322		                if ( body.hasClass('transparent-sticky') ) {
323		                    if( hero_section.length > 0 ){
324		                        $sticky_offset = Number_or_zero( hero_section.offset().top ) + Number_or_zero( hero_section.height() )  - admin_bar_height;    
325		                    } else if( first_pb_section.length > 0 ) {
326		                        $sticky_offset = Number_or_zero( first_pb_section.offset().top ) + Number_or_zero( first_pb_section.height() ) - admin_bar_height;
327		                    }
328						}
329						
330		                if( bordered_header_layout ) { 
331		                    $scroll_to = $scroll_to - ( header_wrap_default_height + bottom_bar_height );
332		                } else {
333		                    if ($scroll_to > $sticky_offset) {
334		                        $scroll_to = $scroll_to - ( header_wrap_sticky_height + bottom_bar_height );
335		                    }
336		                    if ($scroll_to < $sticky_offset) {
337		                        $scroll_to = $scroll_to - ( header_wrap_default_height + bottom_bar_height );
338		                    }
339		                    if ($scroll_to === $sticky_offset && jQuery('body').hasClass('transparent-sticky')) {
340		                        $scroll_to = $scroll_to - ( header_wrap_sticky_height + bottom_bar_height );
341		                    }
342						} 
343						
344						
345		            } else {
346		                if( bordered_header_layout ) {
347							$scroll_to = $scroll_to - Number_or_zero( jQuery('#header-inner-wrap' ).innerHeight() );
348		                }
349		            }
350		        }
351				//console.log("$scroll_to",$scroll_to);
352		        jQuery('body, html').animate({scrollTop: $scroll_to }, 1000, 'easeOutQuart', function () {
353		            close_sidebar();
354		            open_leftstrip();
355		            menu_item_update();
356		        });	    		
357	    	},
358
359		    sticky_sidebar = function() {
360		        var $window = jQuery(window), 
361		        $sidebar = jQuery( ".floting-sidebar" ), 
362		        offset = jQuery( '#content-wrap' ).offset(), 
363		        $scrollHeight = jQuery( "#page-content" ).height(), 
364		        $scrollOffset = jQuery( "#page-content" ).offset(), 
365		        $headerHeight = 0,
366		        admin_bar_height = Number_or_zero( jQuery('#wpadminbar').innerHeight() );
367
368		        if ( $sidebar.length > 0 && !body.hasClass('tatsu-frame') ) {
369		            if ( body.hasClass('sticky-header') || body.hasClass('transparent-sticky')) {
370		                $headerHeight = Number_or_zero( jQuery('#header-inner-wrap').innerHeight() ) + admin_bar_height;
371		            } else {
372		                $headerHeight = admin_bar_height;
373		            }
374		            if ( $window.width() > 960 ) {
375		                if ( ( $window.scrollTop() + $headerHeight ) > offset.top ) {
376		                    if ( $window.scrollTop() + $headerHeight + $sidebar.height() + 50 < $scrollOffset.top + $
376scrollHeight ) {
377		                        $sidebar.stop().animate({
378		                            marginTop: ( $window.scrollTop() - offset.top ) + $headerHeight + 30,
379		                            paddingTop: 30
380		                        });
381		                    } else {
382		                        $sidebar.stop().animate({
383		                            marginTop: ( $scrollHeight - $sidebar.height() - 80 ) + 30,
384		                            paddingTop: 30
385		                        });
386		                    }
387		                } else {
388		                    $sidebar.stop().animate({
389		                        marginTop: 0,
390		                        paddingTop: 0
391		                    });
392		                }
393		            } else {
394		                $sidebar.css('margin-top', 0);
395		            }
396		        }
397		        if ( jQuery(".fixed-sidebar").length > 0 ) {
398		            var $sidebarSelector = jQuery(".fixed-sidebar"),
399					offset = jQuery('#content-wrap').offset(),
400					$mainWrapper = jQuery( '#main-wrapper' ),
401					isOverflow = $sidebarSelector.closest( '.fixed-sidebar-page' ).hasClass( 'be-content-overflow' ),
402					overflowWrapper = jQuery( '#be-overflow-image-content-inner' ),
403					marginLeftOffset = 0,
404		            $scrollHeight = jQuery("#page-content").height(),
405		            $scrollOffset = jQuery("#page-content").offset(),
406		            $scroll_top = $window.scrollTop(),
407		            $footerHeight = Number_or_zero(jQuery('#footer').outerHeight()),
408		            $widgetsHeight = Number_or_zero(jQuery('#bottom-widgets').outerHeight()),
409		            $sidebarHeight = $sidebarSelector.find('.fixed-sidebar-content .be-section').outerHeight(),
410					$portfolioNavigationHeight = Number_or_zero(jQuery( '#portfolio-navigation-bottom-wrap' ).outerHeight()),
411		            $headerHeight = Number_or_zero( jQuery( '#header-wrap' ).attr( 'data-sticky-height' ) ) || Number_or_zero(jQuery('#header-inner-wrap').height()),// + Number_or_zero(jQuery('#wpadminbar').height()),
412					$heroSectionHeight = Number_or_zero(jQuery('.hero-section-wrap').height()),
413					$sidebar_width = ( $sidebarSelector.attr('data-sidebar-width')/100 ) || 0.428,
414		            $headerTopPadding = 0,
415		            $breakingPoint1 = 0,
416					$breakingPoint2 = 0;
417					if( isOverflow ) {
418						marginLeftOffset = (overflowWrapper.parent().width()) - ( body.outerWidth()/2 );
419					}
420					asyncloader.require( 'imagesloaded' , function(){
421						jQuery( '.content-single-sidebar' ).imagesLoaded( function() {
422							$sidebarSelector.closest( '#content-wrap' ).css( 'min-height', $sidebarSelector.outerHeight() );
423						} );
424					});
425					
426		            // Sticky Default Header
427		            if (( body.hasClass('sticky-header') || body.hasClass('transparent-sticky') )){ // && !isOverflow ) {
428		                $headerTopPadding = $headerHeight;
429		            } 
430
431		            // Non Sticky Header 
432		            if(  body.hasClass('header-transparent') ){ //Transparent 
433		                if($heroSectionHeight > 0){ //With Hero Section
434		                    $breakingPoint1 = $heroSectionHeight;
435		                }else{ //Without Hero Section
436		                    $breakingPoint1 = 1;
437		                }
438		            }else{ //Non Transparent
439		                if($heroSectionHeight > 0){ //With Hero Section
440		                    $breakingPoint1 = $heroSectionHeight + $headerHeight;
441		                }else{ //Without Hero Section
442		                    $breakingPoint1 = $headerHeight;
443		                }
444					}
445					
446					if( jQuery( '#header-top-bar-wrap' ).length ){
447						$breakingPoint1 = $breakingPoint1 + jQuery( '#header-top-bar-wrap' ).outerHeight();
448					}
449
450					if ( jQuery("#portfolio-title-nav-wrap").length > 0 ) {
451                        $breakingPoint1 = $breakingPoint1 + jQuery('#portfolio-title-nav-wrap').outerHeight();
452					} 					
453					
454					$breakingPoint2 = (jQuery(document).height()) - ($scroll_top +  jQuery(window).height() + $footerHeight + $widgetsHeight + $portfolioNavigationHeight);
455					
456					var contentPosition = jQuery('#content').index();
457					jQuery( '#content' ).siblings().each(function(i,e){
458						if( $(e).hasClass( 'tatsu-section' ) ){
459							if( i < contentPosition ) {
460								$breakingPoint1 = $breakingPoint1 + $(e).outerHeight();
461							} else {
462								$breakingPoint2 = $breakingPoint2 - $(e).outerHeight();
463							}
464						}
465					});
466					if ($window.width() > 940 ) {
467						if( isOverflow ) {
468							if( overflowWrapper.closest( '.be-content-overflow' ).hasClass( 'left-overflow-page' ) ) {
469								overflowWrapper.css( { marginLeft: ( 0 > marginLeftOffset ) ? ( marginLeftOffset + 'px' ) : '0px', opacity : '1'} );
470							}else{
471								overflowWrapper.css( { marginRight : ( 0 > marginLeftOffset ) ? ( marginLeftOffset + 'px' ) : '0px', opacity : '1'} );
472							}
473						}
474		                if ($scroll_top < $breakingPoint1) {
475							$sidebarSelector.removeClass('active-fixed').css('top', 0);
476							if( !isOverflow ) {
477							   $sidebarSelector.width($sidebarSelector.parent().outerWidth() * $sidebar_width);
478							}else{
479								$sidebarSelector.css( 'left', '' );
480								$sidebarSelector.width($sidebarSelector.closest( '#content-wrap' ).outerWidth() * $sidebar_width);
481							}
482		                } 
483		                else if($breakingPoint2 <= 0){
484							var $negative;
485							if( ( body.hasClass('sticky-header') || body.hasClass('transparent-sticky') ) ){
486								$negative = $breakingPoint2 + $headerHeight;
487							} else {
488								$negative = $breakingPoint2;
489							}
490							$sidebarSelector.addClass('active-fixed').removeClass('top-animate').css('top', $negative);
491							if( !isOverflow ) {
492								$sidebarSelector.width($sidebarSelector.parent().outerWidth() * $sidebar_width);
493							}else{
494								$sidebarSelector.css( 'left', $sidebarSelector.parent().offset().left );
495								$sidebarSelector.width($sidebarSelector.closest( '#content-wrap' ).outerWidth() * $sidebar_width);
496							}
497
498		                }
499		                else if(($scroll_top >= $breakingPoint1) && ($breakingPoint2 > 0)){
500							$sidebarSelector.css( 'top', '0' );
501							$sidebarSelector.addClass('active-fixed  top-animate');
502							if( 0 != $headerTopPadding ) {
503								if( $scroll_top > window.innerHeight ) {
504									$sidebarSelector.css({
505										top : $headerTopPadding
506									});
507								}else{
508									$sidebarSelector.css({
509										top : 0
510									});
511								}
512							}
513							if( !isOverflow ) {
514								$sidebarSelector.width($sidebarSelector.parent().outerWidth() * $sidebar_width);
515							}else{
516								$sidebarSelector.css( 'left', $sidebarSelector.parent().offset().left );
517								$sidebarSelector.width($sidebarSelector.closest( '#content-wrap' ).outerWidth() * $sidebar_width);
518							}
519		                }		                
520		            }else{
521						if( isOverflow ) {
522							if( '0px' != overflowWrapper.css( 'margin-left' ) ) {
523								overflowWrapper.css( 'margin-left', '0' );
524							}
525							if( '0' == overflowWrapper.css( 'opacity' ) ) {
526								overflowWrapper.css( 'opacity', '1' );
527							}
528						}
529					}
530		        }
531		    },
532
533		    split_screen = function() {
534		        if ( ( jQuery(".page-template-page-splitscreen-left").length > 0 ) || ( jQuery(".page-template-page-splitscreen-right").length > 0 ) ) {
535		            var $heroSection = jQuery("#hero-section"),
536		            $window = jQuery(window),
537		            $scroll_top = $window.scrollTop(),
538		            $footerHeight = Number_or_zero(jQuery('#footer').outerHeight()),
539		            $widgetsHeight = Number_or_zero(jQuery('#bottom-widgets').outerHeight()),
540		            $headerHeight = Number_or_zero(jQuery('#header-inner-wrap').height()),
541		            $headerTopPadding = 0,
542		            $headerTopPaddingonScroll = 0,
543		            $breakingPoint1 = 0,
544		            $breakingPoint2 = 0;
545
546		            // Non Sticky Header 
547		            if(  body.hasClass('header-transparent') ){ //Transparent 
548		                $breakingPoint1 = 1;
549		                $headerTopPadding = 0;
550		            }else{ //Non Transparent
551		                $breakingPoint1 = $headerHeight;
552		                $headerTopPadding = $headerHeight;
553		            }
554
555		            $breakingPoint2 = (jQuery(document).height()) - ($scroll_top +  $window.height() + $footerHeight + $widgetsHeight);
556					//console.log("$breakingPoint2",$breakingPoint2);
557		            if ($window.width() > 960) {
558		                $heroSection.css('top', $headerTopPadding);
559		                if ($scroll_top < $breakingPoint1) {
560		                    $heroSection.css('top', $headerTopPadding - ($scroll_top));
561		                } 
562		                else if($breakingPoint2 <= 0){
563		                    $heroSection.css('top', $breakingPoint2);
564		                }
565		                else if(($scroll_top >= $breakingPoint1) && ($breakingPoint2 > 0)){
566		                    $heroSection.css('top', 0 );
567		                }
568		            }
569		        }
570		    },
571
572		    superfish = function() {
573		    	asyncloader.require( [ 'superfish', 'hoverintent' ], function(){
574			        var $menu = jQuery('#navigation .menu, #navigation-left-side .menu, #navigation-right-side .menu').children('ul');
575			        $menu.superfish({
576			            animation: {opacity: 'show'},
577			            animationOut: {opacity: 'hide'},
578			            speed : 400,
579			            delay: 600
580			        });
581			    });		    	
582		    },
583
584			sliders = function() {
585		    	var gallery_wrap = jQuery('#gallery-container-wrap');
586		        if ( gallery_wrap.length > 0 ) {	
587					var deps = [ 'horizontalcarousel', 'fitvids', 'resizetoparent', 'mousewheel' ];
588					if( jQuery('be-vimeo-embed').length ){
589						deps.push('vimeo');
590					}
591		        	asyncloader.require( deps, function(){
592			            gallery_wrap.fitVids();
593			            gallery_wrap.CenteredSlider();
594			            //gallery_wrap.thumbnailSlider();
595			            resize_gallery_video();
596			            jQuery('.be-carousel-thumb').thumbnailSlider();
597			        });
598		        }		    	
599		    },
600
601			carousel_thumb = function() {
602		        jQuery(document).on('mouseenter', '.carousel_bar_dots', function () {
603		            jQuery(this).parent().find('.carousel_bar_wrap').css('opacity', '0').stop().animate({ opacity: 1, bottom: '0px' }, 500);
604		        });
605		        jQuery(document).on('mouseleave', '.carousel_bar_area', function () {
606		            jQuery(this).find('.carousel_bar_wrap').stop().animate({ opacity: 0, bottom: '-500px' }, 500);
607		        });				
608			},
609
610			carouselIOSFix = function() {
611				var touchingCarousel = false,
612					touchStartCoords;
613			
614				document.body.addEventListener('touchstart', function(e) {
615					if (e.target.closest('.flickity-slider')) {
616					touchingCarousel = true;
617					} else {
618					touchingCarousel = false;
619					return;
620					}
621			
622					touchStartCoords = {
623					x: e.touches[0].pageX,
624					y: e.touches[0].pageY
625					}
626	
627				});
628			
629				document.body.addEventListener('touchmove', function(e) {
630					if (!(touchingCarousel && e.cancelable)) {
631					return;
632					}
633			
634					var moveVector = {
635					x: e.touches[0].pageX - touchStartCoords.x,
636					y: e.touches[0].pageY - touchStartCoords.y
637					};
638			
639					if (Math.abs(moveVector.x) > 7)
640					e.preventDefault()
641			
642				}, {passive: false});
643			},
644
645		    rev_slider_bg_check = function() {
646	
647		        if ( !body.hasClass('disable_rev_slider_bg_check') && !body.hasClass('semi') ) {
648
649					var rev_slider_wrapper = jQuery('#hero-section').find('.rev_slider_wrapper');
650					if( 0 === jQuery('#hero-section').length ) {
651						rev_slider_wrapper = jQuery( '.tatsu-section:first-child' ).find('.rev_slider_wrapper');
652					}
653		            if ( body.hasClass('header-transparent') && rev_slider_wrapper.length > 0 ) {
654		            	asyncloader.require( 'backgroundcheck', function() {
655			                rev_slider_wrapper.each(function () {
656			                    var $wrapper = jQuery(this).attr('id'), 
657			                    $instance = jQuery(this).find('.rev_slider').attr('id'), 
658			                    be_revapi = $instance.split('_');
659			                    window['revapi'+be_revapi[2]].bind("revolution.slide.onchange", function (e, data) {
660			                        setTimeout(function () {
661			                            BackgroundCheck.init({
662			                                targets: '#header #header-inner-wrap',
663			                                images: '.active-revslide .tp-bgimg'
664			                            });
665			                            BackgroundCheck.refresh();
666			                        }, 100);
667			                    });
668			                });
669			            });
670		            }
671		        }
672		    },
673
674		    header_search = function() {
675		        jQuery(document).on('click', '.header-search-controls .search-button', function () {
676		        	var search_box = jQuery('.search-box-wrapper');
677		            search_box.fadeToggle().find('.s').focus();
678		            if ( search_box.hasClass('style2-header-search-widget') ) {
679						if( !( ( jQuery( 'body' ).hasClass( 'overlay-center-align-menu' ) || jQuery( 'body' ).hasClass( 'overlay-left-align-menu' ) || jQuery( 'body' ).hasClass( 'overlay-horizontal-menu' ) ) && jQuery( '.be-sidemenu' ).hasClass( 'opened' ) ) ){
680							// Incase the user has opened the overlaymenu and has clicked the search button, then don't toggle the 'hide-overflow', as the class is already added
681		                	html = html.toggleClass('hide-overflow');
682						}
683		            }
684		        });
685
686		        jQuery(document).on('click', '.header-search-form-close', function (e) {
687		            e.preventDefault();
688		            close_search_box();
689		        });		        		    	
690		    },
691
692		    mobile_menu = function() {   	
693		        jQuery(document).on('click','#mobile-menu li a', function() {
694		            if( jQuery(this).attr('href') != '#' && !jQuery(this).closest('li').hasClass('menu-item-has-children') ){
695		                close_mobile_menu();   
696		            }
697		        });
698
699		        jQuery(document).on('click', '.mobile-nav-controller-wrap', function () {
700		            jQuery('.mobile-menu').slideFadeToggle();
701		            jQuery('.mobile-nav-controller .be-mobile-menu-icon').toggleClass('is-cl
701icked'); 
702		        });
703
704		        jQuery(document).on('click', '.mobile-sub-menu-controller', function () {
705		            jQuery(this).siblings('.sub-menu').slideFadeToggle();
706		            jQuery(this).toggleClass('isClicked');
707		        });
708		    },
709
710		    falling_menu = function() {
711		        jQuery(document).on('click', '.menu-falling-animate-controller', function () {
712		            //var delay = 0, 
713		            var $this = jQuery(this);  
714					body.toggleClass('menu-animate-fall-active');
715					jQuery('.menu-falling-animate-controller .be-mobile-menu-icon').toggleClass('is-clicked');
716	                jQuery('#menu, #left-menu, #right-menu').children('.menu-item').each(function(i, el) {
717							var delay =  i * 50;
718							jQuery(this).css('transition-delay', delay+'ms');		
719	                });
720		        });		    	
721			},
722
723			top_page_stack = function() {
724				if( jQuery( 'body' ).hasClass( 'page-stack-top' ) ){
725					//Check if the class is there in body
726					asyncloader.require( ['modernizr', 'classie'], function(){
727						var backToTop = jQuery( '#back-to-top' ).detach();
728						backToTop.appendTo(jQuery( 'body' ));
729						jQuery( '#header' ).insertBefore( jQuery( "#main-wrapper" ) );
730						asyncloader.require( 'page_stack_top', function(){			
731						});
732					} );
733				}	    	
734			},
735
736			perspective_navigation = function(){
737				if( jQuery( 'body' ).hasClass( 'perspective-left' ) || jQuery( 'body' ).hasClass('perspective-right') ){
738					//Check if the class is there in body
739					asyncloader.require( ['modernizr', 'classie'], function(){
740						asyncloader.require( 'perspective_navigation', function(){
741							var backToTop = jQuery( '#back-to-top' ).detach();
742							backToTop.appendTo(jQuery( 'body' ));
743							jQuery( '#header' ).insertBefore( jQuery( "#main-wrapper" ) );				
744						});
745					} );
746				}
747			},
748
749			multi_level_menu = function(){
750				/*Convert normal menu to multilevel menu in case of
751					Page stack right
752					Page stack left
753					Overlay center align
754					Overlay left align
755					special left menu
756					special right menu
757					perspective left
758					perspective right
759					left-static-menu
760					left-strip-menu
761				*/
762				if( 'newMultilevelMenu' == jQuery( '.be-sidemenu' ).attr( 'data-submenu' ) ){
763					asyncloader.require( ['modernizr', 'classie'], function(){
764						var dataSubMenu = 1,
765								menuUls = jQuery( '.special-header-menu > ul' );
766						$( menuUls ).attr( 'data-menu', 'main' );
767						menuUls = menuUls.find( 'ul' );
768						Array.prototype.forEach.call( menuUls, function( menuUl ){
769							jQuery( menuUl ).addClass( 'menu-container' );
770							$( menuUl ).attr( 'data-menu', 'submenu-' + dataSubMenu );
771							$($( menuUl ).siblings( 'a' )).attr( 'data-submenu', 'submenu-' + dataSubMenu++ );
772							$( menuUl ).detach().appendTo( '.special-header-menu' );
773						} );
774						asyncloader.require( 'multi_level_menu', function(){			
775
776							var menuEl = document.getElementsByClassName('special-header-menu')[0],
777								mlmenu = new MLMenu(menuEl, {
778									backCtrl : true, // show back button
779									direction : jQuery( '.be-sidemenu' ).attr( 'data-link-animation-direction' )
780								});
781						});
782					});
783				} else if( 'oldMultilevelMenu' == jQuery( '.be-sidemenu' ).attr( 'data-submenu' ) ){
784					asyncloader.require( ['modernizr', 'classie'], function(){
785						asyncloader.require( 'old_menu_animation', function(){
786							var menuEl = document.getElementsByClassName('special-header-menu')[0],
787								mlmenu = new OldMenu(menuEl, {
788									direction : jQuery( '.be-sidemenu' ).attr( 'data-link-animation-direction' )
789								});
790						})
791					});
792				}
793			},
794
795			sticky_sections = function() {
796				if( body.hasClass( 'be-sticky-sections' ) && !jQuery( 'body' ).hasClass( 'tatsu-frame' ) ) {
797					asyncloader.require( 'sticky_sections', function() {
798						var stickyScrollType = jQuery( '.be-sections-wrap' ).attr( 'data-sticky-scroll' ),
799							$win = jQuery(window),
800							globalSections = jQuery('.tatsu-global-section'),
801							sectionsContainer = jQuery('#content .tatsu-section').parent(),
802							stickyContainer = '#main-wrapper',
803							defaultHeaderHeight = jQuery( '#header'  ).outerHeight() + ( jQuery( '#wpadminbar' ).length ? jQuery( '#wpadminbar' ).height() : 0 );
804						if( jQuery( '#tatsu-header-wrap'  ).outerHeight() > 0 ){
805							stickyContainer = '#be-sticky-section-fixed-wrap'
806							defaultHeaderHeight = jQuery( '#tatsu-header-wrap'  ).outerHeight() + ( jQuery( '#wpadminbar' ).length ? jQuery( '#wpadminbar' ).height() : 0 );
807						}							
808						var	transparentHeaderDynamicColorChange = function() {
809								var curSection = jQuery( this ),
810									headerInnerWrap = jQuery( '#header-inner-wrap' ),
811									headerScheme,
812									headerSchemeFromSection = curSection.attr( 'data-headerscheme' );
813								if( body.hasClass( 'header-transparent' ) ) {
814									headerScheme = headerInnerWrap.attr( 'data-headerscheme' );
815									if( headerScheme != headerSchemeFromSection ) {
816										headerInnerWrap.find( '#navigation' ).css( 'transition', 'none' );
817										headerInnerWrap.removeClass( 'background--dark' == headerSchemeFromSection ? 'background--light' : 'background--dark' );
818										headerInnerWrap.find( '#navigation' ).css( 'transition', 'color 700ms cubic-bezier(0.645, 0.045, 0.355, 1)' );
819										headerInnerWrap.addClass( headerSchemeFromSection );
820										headerInnerWrap.attr( 'data-headerscheme', headerSchemeFromSection );
821									}
822								}
823							},
824							triggerTatsuAnimation = function() {
825								if( null != tatsu ) {
826									tatsu.cssAnimate( false, '', jQuery(this) );
827								}
828							},
829							stickySectionDotsDynamicColorChange = function() {
830								var curSection = jQuery( this ),
831									dotsNav = jQuery( '#sticky-dots-navigation' ),
832									headerScheme,
833									headerSchemeFromSection = curSection.attr( 'data-headerscheme' );
834								if( 0 < dotsNav.length ) {
835									headerScheme = dotsNav.attr( 'data-headerscheme' );
836									if( headerScheme != headerSchemeFromSection ) {
837										dotsNav.find( 'span' ).css( 'transition', 'none' );
838										dotsNav.removeClass( 'background--dark' == headerSchemeFromSection ? 'background--light' : 'background--dark' );
839										dotsNav.find( 'span' ).css( 'transition', 'background 700ms cubic-bezier(0.645, 0.045, 0.355, 1)' );
840										dotsNav.addClass( headerSchemeFromSection );
841										dotsNav.attr( 'data-headerscheme', headerSchemeFromSection );
842									}
843								}
844							},
845							triggerPortfolio = function() {
846								var curSection = jQuery( this ),
847									portfolio = curSection.find( '.portfolio' );
848								if( 0 < portfolio.length && null != oshinePortfolio ) {
849									if( portfolio.hasClass( 'portfolio-delay-load' ) ) {
850										oshinePortfolio.portfolioScrollReveal( portfolio.find( '.element' ) );
851									}
852									if( portfolio.hasClass( 'portfolio-lazy-load' ) ) {
853										oshinePortfolio.portfolioLazyReveal( portfolio.find( '.thumb
853-wrap' ).find( 'img' ) );
854									}
855								}
856							},
857							setCurrentActiveMenu = function() {
858								var menuItems = jQuery( 'li.menu-item' ),
859									curActiveSection = jQuery( this );
860								if( curActiveSection.length && ( ( defaultHeaderHeight + $win.scrollTop() ) >= curActiveSection.offset().top ) ) {
861									menuItems.removeClass( 'current-menu-item' );
862									menuItems.find('a[href$="#'+ curActiveSection.attr( 'id' ) +'"]').closest('li.menu-item').addClass('current-menu-item current-section');
863								}
864							},
865							initCallBack = function( activeSection ) {
866								stickySectionDotsDynamicColorChange.call(activeSection);
867								triggerPortfolio.call(activeSection);
868								setCurrentActiveMenu.call(activeSection);
869								triggerTatsuAnimation.call(activeSection);
870								if( body.hasClass( 'be-themes-layout-layout-border-header-top' ) || body.hasClass( 'be-themes-layout-layout-border' ) ) {
871									if( 0 < jQuery( '#sticky-dots-navigation' ).length ) {
872										if( 0 < jQuery( '.layout-box-right' ).length ) {
873											jQuery( '#sticky-dots-navigation' ).css( 'right', jQuery( '.layout-box-right' ).width() + 17 + 'px' );
874										}
875									}
876								}
877							},
878							enableOverlay = jQuery( '.be-sections-wrap' ).attr( 'data-sticky-overlay' ),
879							stickyOptions = {
880								autoScroll : 'auto_scroll' == stickyScrollType ? true : false,
881								fixedParent : stickyContainer,
882								scrollCallback : function( secIndex ) {
883									triggerTatsuAnimation.call(this);
884									triggerPortfolio.call(this);
885								},
886								scrollingSpeed : 1200,
887								overlay : 0 == enableOverlay ? false : true,
888								fullScreenOffset : [ '#wpadminbar', '#header', '.layout-box-top', '.layout-box-bottom' ],
889								dots : true,
890								footer : [ '.tatsu-global-section-bottom', '#bottom-widgets', '#footer' ],
891								navigationPosition : 'right',
892								afterLoad : function() {
893									triggerPortfolio.call(this);
894									triggerTatsuAnimation.call(this);
895									transparentHeaderDynamicColorChange.call(this, arguments);
896									stickySectionDotsDynamicColorChange.call(this);
897									setCurrentActiveMenu.call(this);
898								}
899							};
900						if( 0 < globalSections.length && 0 < sectionsContainer.length ) {
901							sectionsContainer.prepend( jQuery('.tatsu-global-section-top') ).append( jQuery('.tatsu-global-section-penultimate') );
902						}
903						if( 967 < jQuery( window ).width() ) {
904							stickySections.initialize( '.be-sections-wrap', stickyOptions , initCallBack );
905						}
906						jQuery(window).on( 'resize', function() {
907							if( 967 < jQuery(window).width() && !body.hasClass( 'sticky-enabled' ) ) {
908								stickySections.initialize( '.be-sections-wrap', stickyOptions , initCallBack );
909							}else if( 968 > jQuery(window).width() && body.hasClass( 'sticky-enabled' ) ) {
910								stickySections.destroy();
911							}
912						} )
913					} );
914				}
915			},
916
917			sub_menu = function() {
918		        jQuery(document).on('click', '.top-overlay-menu .menu-item-has-children a, .left-header .menu-item-has-children a , #mobile-menu .menu-item-has-children a', function () {
919		            if(jQuery(this).attr('href') == '#'){
920		                jQuery(this).siblings('.sub-menu').slideFadeToggle();
921		                jQuery(this).siblings('.mobile-sub-menu-controller').toggleClass('isClicked');
922		            }
923		        });				
924			},
925
926			local_scroll = function() {
927				asyncloader.require( 'easing', function() {
928			        jQuery(document).on('click', 'a[href="#"]', function (e) {
929			            e.preventDefault();
930			        });
931			        jQuery(document).on('click', 'a', function (e) {
932			            var $link_to = jQuery(this).attr('href'), 
933			            url_arr, 
934			            $element,
935			            mobile_menu = jQuery('.mobile-menu'),
936			            $path = window.location.href;
937			            if ( jQuery(this).hasClass('ui-tabs-anchor') || jQuery(this).closest('.wc-tabs').length > 0 ) {
938			                return false;
939						}
940			            if ( $link_to && !( ( jQuery( 'body' ).hasClass( 'perspective-left' ) || jQuery( 'body' ).hasClass( 'perspective-right' ) || jQuery( 'body' ).hasClass( 'page-stack-top' ) ) && jQuery(window).width() >= 960  ) ) {
941			                url_arr = $link_to.split('#');
942			                if ($link_to.indexOf('#') >= 0 && $path.indexOf(url_arr[0]) >= 0) {
943			                    $element = $link_to.substring($link_to.indexOf('#') + 1);
944			                    if ($element) {
945			                        if (jQuery('#' + $element).length > 0) {
946										e.preventDefault();
947										if( jQuery( body ).hasClass( 'be-sticky-sections' ) && 960 < window.innerWidth ) {
948											var section = jQuery( '#' + $element ),
949												secIndex = stickySections.getStickyIndex( section[0] );
950											if( -1 < secIndex && secIndex < jQuery( '.sticky-section' ).length ) {
951												if( body.scrollTop() === 0 ) {
952													body.scrollTop(1);
953												}
954												stickySections.moveTo( secIndex );
955											}
956										}else if( jQuery( body ).hasClass( 'be-sticky-active' ) && 960 < window.innerWidth ) {
957
958												var getElement = jQuery( '#' + $element );
959
960												if(jQuery(getElement).length){
961													var  getOffset = jQuery(getElement ).offset().top;
962													var  top = jQuery('#header-inner-wrap').position().top;
963													var  height = jQuery('#header-inner-wrap').height() + top;
964													jQuery('html,body').animate({
965														scrollTop: getOffset - height
966													}, 500);
967												}
968
969
970										}else if (jQuery(window).width() < 960 && mobile_menu.length > 0 ) {
971			                                mobile_menu.slideUp(500, function () {
972			                                    animate_scroll(jQuery('#' + $element));
973			                                });
974			                            } else {
975			                                animate_scroll(jQuery('#' + $element));
976			                            }
977			                        }
978			                    }
979			                }
980			            }
981			        });	
982			    });			
983			},
984
985			sliderbar_navigation = function() {
986		        jQuery(document).on('click', '.sliderbar-nav-controller-wrap', function () {
987		            jQuery('.sb-slidebar').toggleClass('opened');
988		            body = body.toggleClass('slider-bar-opened');
989
990		            if( body.hasClass('top-overlay-menu') ) {
991		               html = html.toggleClass('hide-overflow');
992		                // jQuery('.layout-box-container').fadeOut();
993		                if( body.hasClass('be-themes-layout-layout-border-header-top') ){
994		                    jQuery('.sliderbar-menu-controller .be-mobile-menu-icon').toggleClass('is-cl
994icked');
995		                }
996		            } else{
997		                jQuery('.sliderbar-menu-controller .be-mobile-menu-icon').toggleClass('is-clicked');
998		            }
999		        });				
1000			},
1001
1002			special_menu_view_handler = function() {		
1003				jQuery('.be-sidemenu').toggleClass('opened');
1004				body = body.toggleClass('side-menu-opened');
1005				
1006				if( jQuery('body').hasClass( 'overlay-center-align-menu' ) || jQuery('body').hasClass( 'overlay-left-align-menu' ) || jQuery('body').hasClass( 'overlay-horizontal-menu' ) ){
1007					if( jQuery( 'body' ).hasClass( 'side-menu-opened' ) ){
1008						jQuery( '#header' ).css( 'z-index', '16' );
1009						jQuery( '.be-sidemenu' ).css({ 'z-index' : '15', 'visibility' : 'visible' });
1010						jQuery('html').toggleClass('hide-overflow');
1011						var transEndEvent = function( ev ){
1012							ev.stopPropagation();
1013							if( ! (jQuery( 'body' ).hasClass( 'side-menu-opened' ) ) && jQuery(ev.target).hasClass('be-sidemenu') ){
1014								jQuery(this).unbind( 'webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', transEndEvent );
1015								jQuery( '.be-sidemenu' ).css({ 'z-index' : '-1', 'visibility' : 'hidden' });
1016								jQuery( '#header' ).css('z-index' , '10');
1017								if( jQuery( '.search-box-wrapper' ).css( 'display' ) == 'none' || jQuery( '.search-box-wrapper' ).length == 0 || jQuery('.search-box-wrapper').hasClass( 'style1-header-search-widget' ) ){
1018									// This condition for, in case after opening the overlay menu, user clicks the search button, then 'hide-overflow' shouldnt be removed
1019									jQuery( 'html' ).removeClass( 'hide-overflow' );
1020								}
1021							}
1022						};
1023						jQuery( '.be-sidemenu' ).bind('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', transEndEvent);
1024					}
1025					if( jQuery('#be-left-strip').length != 0 ){
1026						/* Resize the masterslider when menu is opend and closed */
1027						if( 'undefined' != typeof window.masterslider_instances && ( jQuery('body').hasClass( 'overlay-left-align-menu' ) || jQuery('body').hasClass( 'overlay-center-align-menu' ) ) ){							
1028							var masterSliderResizeHandler = function( ev ){
1029								jQuery(this).unbind( 'webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', masterSliderResizeHandler );
1030								window.masterslider_instances.forEach( function( item ){
1031									item._updateLayout();
1032								} );
1033							}
1034							jQuery( '.be-sidemenu' ).bind('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', masterSliderResizeHandler );	
1035						}
1036					}
1037				} else {
1038					jQuery('html').toggleClass('hide-overflow');	
1039				}
1040			},
1041
1042			sidemenu_navigation = function(){
1043				if( !( jQuery( 'body' ).hasClass( 'perspective-left' ) || jQuery( 'body' ).hasClass( 'perspective-right' ) || jQuery( 'body' ).hasClass( 'page-stack-top' ) || jQuery( 'body' ).hasClass( 'menu-animate-fall' ) ) ){
1044					//Attach click events for the hamburger menu except for page stack top case. For page stack top, the event is attached in page_stack_top.js
1045					jQuery(document).on('click', '.hamburger-nav-controller-wrap', function (ev) {
1046						ev.stopPropagation();
1047						special_menu_view_handler();
1048						jQuery( '.hamburger-nav-controller .be-mobile-menu-icon' ).toggleClass( 'is-clicked' );
1049					})
1050				}
1051			},
1052
1053			left_strip = function() {
1054		        jQuery(document).on('click', '#sb-left-strip', function () {
1055		            var $this = jQuery(this);
1056		            jQuery('.sb-slidebar').toggleClass('opened');   
1057		            if( $this.hasClass('menu_push_main') ){
1058		                body = jQuery('body').toggleClass('slider-bar-opened');  
1059		            }
1060		            if($this.hasClass('overlay')) {
1061		                html = html.toggleClass('hide-overflow');
1062		                jQuery('.layout-box-container').fadeOut();     
1063		            }
1064		            if( $this.hasClass('strip') ) {
1065		                jQuery('.left-strip-wrapper').toggleClass('hide');    
1066		                jQuery('#main-wrapper').toggleClass('hidden-strip'); 
1067		            }
1068		        });				
1069			},
1070
1071			be_left_strip = function() {
1072				if( !( jQuery( 'body' ).hasClass( 'perspective-right' ) ) ) {
1073					jQuery(document).on( 'click', '#be-left-strip', function( ev ){
1074						special_menu_view_handler();
1075						jQuery( '#be-left-strip .be-mobile-menu-icon' ).toggleClass( 'is-clicked' );
1076					});
1077				}
1078			},
1079
1080			left_header_close_overlay = function(){
1081				if( jQuery( 'body' ).hasClass( 'left-header' ) && ( jQuery( 'body' ).hasClass( 'overlay-center-align-menu' ) || jQuery( 'body' ).hasClass( 'overlay-left-align-menu' ) ) ){
1082					jQuery( document ).on( 'click', '.be-overlay-menu-close', function( ev ){
1083						ev.stopPropagation();
1084						// Don't call special_menu_view_handler() function here to do the closing of overlay menu. Its causing a bug on double click of close button as the code does toggling of classes
1085						jQuery('.be-sidemenu').removeClass('opened');
1086						body = body.removeClass('side-menu-opened');
1087						jQuery( '#be-left-strip .be-mobile-menu-icon' ).removeClass( 'is-clicked' );
1088						if( 'undefined' != typeof window.masterslider_instances ){							
1089							var masterSliderResizeHandler = function( ev ){
1090								jQuery(this).unbind( 'webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', masterSliderResizeHandler );
1091								window.masterslider_instances.forEach( function( item ){
1092									item._updateLayout();
1093								} );
1094							}
1095							jQuery( '.be-sidemenu' ).bind('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', masterSliderResizeHandler );	
1096						}
1097					} )
1098				}
1099			},
1100
1101	    	close_sidebar = function() {		        
1102		        if( body.hasClass('top-overlay-menu') || body.hasClass('left-overlay-menu') ){
1103		            if( body.hasClass('be-themes-layout-layout-border-header-top')){
1104		                close_slidebar_menu();
1105		            }
1106		            jQuery('.layout-box-container').fadeIn();  
1107		            jQuery('#slidebar-menu li').removeClass('menu-loaded');
1108		        } else {
1109		            close_slidebar_menu();
1110		        }
1111		        jQuery('.sb-slidebar').removeClass('opened');
1112
1113		        body = body.removeClass( 'slider-bar-opened' );  
1114	    	},
1115
1116			close_sidemenu = function(){
1117				if( !jQuery( 'body' ).hasClass( 'page-stack-top' ) ){
1118					//Add the close sidemenu event on cliking of #main except for page stack top. For Page Stack top, the event is attached in page_stack_top.js
1119					jQuery(document).on('click', '#main', function () {
1120						setTimeout( function(){
1121							if( jQuery('body').hasClass( 'side-menu-opened' ) ){
1122								special_menu_view_handler();
1123								jQuery( '.hamburger-nav-controller .be-mobile-menu-icon' ).toggleClass( 'is-clicked' );
1124								jQuery( '#be-left-strip .be-mobile-menu-icon' ).toggleClass( 'is-clicked' );
1125							}
1126						}, 0 );
1127					})
1128
1129					jQuery( document ).on( 'keyup', function( ev ) {
1130						if( jQuery('body').hasClass( 'side-menu-opened' ) ){
1131							var keyCode = ev.keyCode || ev.which;
1132							if( keyCode === 27 ) {
1133								setTimeout( function(){
1134									special_menu_view_handler();
1135									jQuery( '.hamburger-nav-controller .be-mobile-menu-icon' ).toggleClass( 'is-clicked' );
1136									jQuery( '#be-left-strip .be-mobile-menu-icon' ).toggleClass( 'is-clicked' );
1137								}, 0);
1138							}
1139						}
1140					} );
1141
1142					var path = window.location.href;
1143					jQuery( '.special-header-menu .menu-item a' ).each( function( index, item ){
1144						var href = item.getAttribute( 'href' ),
1145							urlArr = href.split('#');
1146
1147						if( href == "#" ){
1148							return false;	
1149						}
1150						if( href.indexOf( '#' ) >= 0 && path.indexOf(urlArr[0]) >= 0 )
1151						{
1152							var pageid = href.split('#')[1];
1153							item.addEventListener('click', function(ev) {
1154								// ev.preventDefault();
1155								if( jQuery('body').hasClass( 'side-menu-opened' ) ){
1156									setTimeout( function(){
1157										special_menu_view_handler();
1158										jQuery( '.hamburger-nav-controller .be-mobile-menu-icon' ).toggleClass( 'is-clicked' );
1159										jQuery( '#be-left-strip .be-mobile-menu-icon' ).toggleClass( 'is-clicked' );
1160									}, 0);
1161								}
1162							} );
1163						}
1164					});
1165				}
1166			},
1167
1168	    	close_slidebar_menu = function() {
1169		        var be_sidebar_mobile_menu = jQuery('.sliderbar-menu-controller').find('.be-mobile-menu-icon');
1170		        if( body.hasClass( 'slider-bar-opened') && body.hasClass('top-header' ) ){
1171		            be_sidebar_mobile_menu.toggleClass('is-clicked');
1172		        }	    		
1173	    	},
1174
1175	    	close_mobile_menu = function() {
1176	    		var mobile_menu = jQuery('.mobile-menu');
1177		        if ( mobile_menu.is(":visible") ) {
1178		            mobile_menu.slideFadeToggle();
1179		            jQuery('.mobile-nav-controller .be-mobile-menu-icon').toggleClass('is-clicked');
1180		        }
1181	    	},
1182
1183	    	close_search_box = function() {
1184	    		var search_box = jQuery('.search-box-wrapper');
1185		        if ( search_box.is(":visible") ) {
1186		            search_box.fadeOut();
1187					if( search_box.hasClass('style2-header-search-widget') ){
1188		            	html = html.toggleClass('hide-overflow');
1189					}
1190		        }
1191	    	},			
1192
1193			close_overlay_menu = function() {
1194		        jQuery(document).on('click', '.overlay-menu-close', function () {
1195		            close_sidebar();
1196		            open_leftstrip();
1197		        });				
1198			},
1199
1200			close_gallery_info_box = function() {
1201		        jQuery(document).on('click', '.single_portfolio_info_close', function () {
1202		            jQuery(this).closest('.gallery_content').toggleClass('show');
1203		            //jQuery(".gallery_content_area").mCustomScrollbar("update");
1204		        });				
1205            },
1206            portfolioTemplateZoro = function() {
1207                var pauseYTJson = JSON.stringify({
1208                        'event': 'command',
1209                        'func': 'pauseVideo'
1210                    }),
1211                    playYTJson = JSON.stringify({
1212                        'event': 'command',
1213                        'func': 'playVideo'
1214                    }),
1215                    curActiveIndex = -1,
1216                    lockWheel = false,
1217                    container,
1218                    slides,
1219                    nav,
1220                    pauseVideoSlide = function(slide) {
1221                        if( slide && slide.hasClass('ps-fade-slide-video') ) {
1222                            if( slide.hasClass('ps-fade-slide-video-youtube') ) {
1223                                if(slide.find('iframe').length) {
1224                                    slide.find('iframe')[0].contentWindow.postMessage(pauseYTJson, '*');
1225                                }
1226                            }else if( slide.hasClass('ps-fade-slide-video-vimeo') ) {
1227                                var player = slide.data('player');
1228                                if( player ) {
1229                                    player.pause();
1230                                }
1231                            }else{
1232                                if( slide.find('video').length ) {
1233                                    slide.find('video')[0].pause();
1234                                }
1235                            }
1236                        }
1237                    },
1238                    playVideoSlide = function(slide, triggerGDPRPopup) {
1239                        if( slide.hasClass('ps-fade-slide-video') ) {
1240                            if( slide.hasClass('ps-fade-slide-video-youtube') ) {
1241                                if( slide.find('iframe').length ) {
1242                                    slide.find('iframe')[0].contentWindow.postMessage(playYTJson, '*');
1243                                }else if( triggerGDPRPopup && slide.find('.be-gdpr-consent-message').length ) {
1244                                    slide.find('.privacy-settings').trigger('click');
1245                                }
1246                            }else if( slide.hasClass('ps-fade-slide-video-vimeo') ) {
1247                                var player = slide.data('player');
1248                                if( player ) {
1249                                    player.play();
1250                                }else if( triggerGDPRPopup && slide.find('.be-gdpr-consent-message').length ) {
1251                                    slide.find('.privacy-settings').trigger('click');
1252                                }
1253                            }else{
1254                                if( slide.find('video').length ) {
1255                                    slide.find('video')[0].play();
1256                                }
1257                            }
1258                        }
1259                    },
1260                    setActive = function(index, triggerGDPRPopup, handleColorChange) {
1261                        if(index === curActiveIndex ) {
1262                            return;
1263                        }
1264                        var target = nav.eq(index),
1265                            targetParent = target.parent(),
1266                            prevIndex = curActiveIndex,
1267                            prevSlide = slides.eq(prevIndex),
1268                            prevTarget = nav.eq(prevIndex),
1269                            curSlide = slides.eq(index);
1270                        pauseVideoSlide(prevSlide);
1271                        nav.removeClass('is-active');
1272                        prevTarget.css('color', '');
1273                        slides.removeClass('is-active');
1274                        target.addClass('is-active');
1275                        curSlide.addClass('is-active');
1276                        playVideoSlide(curSlide, triggerGDPRPopup);
1277                        if( handleColorChange ) {
1278                            if( targetParent.attr('data-color') ) {
1279                                target.css('color', targetParent.attr('data-color'));
1280                            }
1281                            if( targetParent.attr('data-bg-color') ) {
1282                                container.css('background', targetParent.attr('data-bg-color'));
1283                            }else {
1284                                container.css('background', '');
1285                            }
1286                        }
1287                        curActiveIndex = index;
1288                    },
1289                    createVimeoPlayerInstances = function() {
1290                        $doc.on( 'be_video_loaded', function( event, iframeEle ) {
1291                            if(iframeEle.closest('.be-vimeo-embed').length) {
1292                                asyncloader.require('vimeonew', function() {
1293                                    var player = new Vimeo.Player(iframeEle[0]);
1294                                    iframeEle.closest('.ps-fade-slide-video').data('player', player);
1295                                });
1296                            }                                                             
1297                        });
1298                    },
1299                    lazyLoadSlideImages = function() {
1300                        var slideImages = $( '.ps-fade-slide-img' );
1301                        if( slideImages.length ) {
1302                            slideImages.each(function() {                                
1303                                var curImg = $(this);
1304                                if( null != curImg.attr( 'data-src' ) ) {
1305                                    curImg.on( 'load', function() {
1306                                        curImg.addClass('ps-fade-slide-img-lazyloaded');
1307                                    });
1308                                    curImg.attr( 'src', curImg.attr( 'data-src' ) );
1309                                    if( this.complete) {
1310                                        curImg.load();
1311                                    }
1312                                }
1313                            });
1314                        }
1315                    };
1316                if($('.ps-fade').length) {
1317                    container = $('.ps-fade');
1318                    slides = container.find('.ps-fade-slide'),
1319                    nav = container.find('.ps-fade-nav-item-inner');
1320                    var reloadCellsOnVideoLoad = function() {
1321                            $doc.on( 'be_video_loaded', function( event, iframeEle ) {
1322                                if($win.width() < 768) {
1323                                    $('.ps-fade-gallery-inner').flickity('reloadCells');
1324                                }
1325                            });
1326                        },
1327                        mouseEnterHandler = function() {
1328                            setActive($(this).parent().index(), false, true);
1329                        },
1330                        addAnimationDelay = function() {
1331                            nav.each(function(index){
1332                                $(this).parent().css('transition-delay', (index * 100) + 'ms');
1333                            });
1334                        },
1335                        setGalleryHeight = function() {
1336                            var offsetHeight = 0;
1337                            if( $('.ps-fade-nav').outerHeight() < $('.ps-fade-gallery-inner').outerHeight() ) {
1338                                offsetHeight += $('#header').outerHeight();
1339							}
1340							if( jQuery('#tatsu-header-container').length > 0 ){
1341								offsetHeight += jQuery('#tatsu-header-container').height();
1342							}
1343							if( jQuery('#tatsu-footer-container').length > 0 ){
1344								offsetHeight += jQuery('#tatsu-footer-container').height();
1345							}
1346                            if(body.hasClass('admin-bar')) {
1347                                offsetHeight += 32;
1348                            }
1349                            $('.ps-fade-gallery-inner').css('height', ($win.height() - offsetHeight));
1350                        },
1351                        checkIfStickykitNeeded = function() {
1352                            var scrollContainer = $('.ps-fade-nav'),
1353                                galleryContainer = $('.ps-fade-gallery-inner'),
1354                                offsetTop = 0;
1355                            if( body.hasClass('admin-bar') ) {
1356                                offsetTop += $('#wpadminbar').height();
1357                            }
1358                            if( scrollContainer.outerHeight() > galleryContainer.outerHeight() ) {
1359                                asyncloader.require('stickykit', function(){
1360                                    galleryContainer.stick_in_parent({
1361                                        parent : galleryContainer.closest( '.ps-fade-inner' ),
1362                                        offset_top : offsetTop
1363                                    });
1364                                });
1365                            }
1366                        },
1367                        removeZoroDesktop = function() {
1368                            $('.ps-fade-gallery-inner').css('height', '');
1369                            nav.off( 'mouseenter', mouseEnterHandler );
1370                            $('.ps-fade-nav').addClass('ps-fade-nav-vert-center');
1371                            $('.ps-fade-gallery-inner').trigger("sticky_kit:detach");                           
1372                        },
1373                        initZoroMobile = function() {
1374                            container.addClass('ps-fade-mobile');
1375                            asyncloader.require('flickity', function() {
1376                                $('.ps-fade-gallery-inner').on( 'change.flickity', function(event, index) {
1377                                    $('.ps-fade-nav-inner').flickity('select', index);
1378                                    setActive(index, false, true);
1379                                });
1380                                $('.ps-fade-gallery-inner').on( 'ready.flickity', function() {
1381                                    setActive(0, false, true);
1382                                    container.addClass('ps-fade-initialized');
1383                                } );
1384                                $('.ps-fade-nav-inner').on( 'change.flickity', function(event, index) {
1385                                    $('.ps-fade-gallery-inner').flickity('select', index);
1386                                    setActive(index, false, true);
1387                                });
1388                                $('.ps-fade-gallery-inner').flickity({pageDots : false, adaptiveHeight : true, prevNextButtons: false});
1389                                $('.ps-fade-nav-inner').flickity({adaptiveHeight : true, prevNextButtons: false});
1390                            });
1391                        },
1392                        removeZoroMobile = function() {
1393                            container.removeClass('ps-fade-mobile');
1394                            $('.ps-fade-gallery-inner').flickity('destroy');
1395                            $('.ps-fade-nav-inner').flickity('destroy');
1396                        },
1397                        addResizeEvent = function() {
1398                            $win.on('resize', function() {
1399                                if( $win.width() < 1025 ) {
1400                                    if( !container.hasClass('ps-fade-mobile') ) {  
1401                                    removeZoroDesktop();
1402                                    initZoroMobile();
1403                                    }
1404                                }else {
1405                                    if( container.hasClass('ps-fade-mobile') ) {
1406                                    removeZoroMobile();
1407                                    initZoro();
1408                                    }
1409                                }
1410                            });
1411                        },
1412                        checkIfVertAlignNav = function() {
1413                            if( $('.ps-fade-nav').outerHeight() < $('.ps-fade-gallery-inner').outerHeight() ) {
1414                                $('.ps-fade-nav').addClass('ps-fade-nav-vert-center');
1415                            }
1416                        },
1417                        initZoro = function() {
1418                            setGalleryHeight();
1419                            checkIfStickykitNeeded();
1420                            checkIfVertAlignNav();
1421                            nav.on( 'mouseenter', mouseEnterHandler );
1422                            nav.eq(0).trigger('mouseenter');
1423                            container.addClass('ps-fade-initialized');
1424                        };
1425                    createVimeoPlayerInstances();
1426                    reloadCellsOnVideoLoad();
1427                    addResizeEvent();
1428                    lazyLoadSlideImages();
1429                    if( $(window).width() > 1024 ) {
1430                        addAnimationDelay();
1431                        initZoro();
1432                    }else {
1433                        initZoroMobile();
1434                    }
1435                }
1436
1437                if($('.ps-fade-horizontal').length) {
1438                    container = $('.ps-fade-horizontal');
1439                    nav = container.find('.ps-fade-horizontal-nav-item-inner');
1440                    slides = container.find('.ps-fade-slide');
1441                    var navSlider = $('.ps-fade-horizontal-nav'),
1442                        mouseWheelNav = null != container.attr('data-mousewheel-nav'),
1443                        navParent = nav.parent(),
1444                        setGalleryHeight = function() {
1445                            var offsetHeight = 0;
1446                            if( body.hasClass('admin-bar') ) {
1447                                offsetHeight += 32;
1448                            }
1449                            offsetHeight += Number_or_zero($('#header').height());
1450                            offsetHeight += Number_or_zero($('#bottom-widgets').height());
1451							offsetHeight += Number_or_zero($('#footer').height());
1452							//console.log("offsetHeight",offsetHeight);
1453                            navParent.css('height', $win.height() - offsetHeight);
1454                        },
1455                        addAnimationDelay = function() {
1456                            nav.each(function(index){
1457                                $(this).css('transition-delay', ((index + 1) * 100) + 'ms');
1458                                setTimeout(function() {
1459                                    $(this).css('transition-delay', ''); //reset so color transition and other transitions don't get affected by this delay
1460                                }.bind(this), ((index + 1) * 100));
1461                            });
1462                        },
1463                        initNavSliderAndSlides = function() {
1464                            asyncloader.require('flickity', function() {
1465                                var initialIndex = null != container.attr( 'data-start-from-center' ) ? Math.floor(slides.length/2) : 0;
1466                                navSlider.on('ready.flickity', function() {
1467                                    if( lockWheel ) {
1468                                        lockWheel = false;
1469                                    }
1470                                    setActive(initialIndex, true);
1471                                    container.addClass('ps-fade-horizontal-initialized');
1472                                });
1473                                navSlider.on( 'change.flickity', function(event, index) {
1474                                    lockWheel = true;
1475                                    setActive(index, true);
1476                                });
1477                                navSlider.on('settle.flickity', function() {
1478                                    lockWheel = false;
1479                                });
1480                                navSlider.flickity({
1481                                    prevNextButtons : false,
1482                                    pageDots : false,
1483                                    initialIndex : initialIndex
1484                                });
1485                            });
1486                        },
1487                        mouseEnterHandler = function() {
1488                            if(!lockWheel) {
1489                                setActive($(this).parent().index(), true);
1490                            }
1491                        },
1492                        scrollHandler = function(event) {
1493                            if( !lockWheel ) {
1494                                if( event.originalEvent.wheelDelta > 0 || event.originalEvent.detail < 0 ) {
1495                                    navSlider.flickity('previous', true);                          
1496                                }else { 
1497                                    navSlider.flickity('next', true);
1498                                }
1499                            }
1500                        },
1501                        initTemplate = function() {
1502                            setGalleryHeight();
1503                            addAnimationDelay();
1504                            if( 1024 < $win.width() ) {
1505                                //nav.on('mouseenter', mouseEnterHandler);
1506                                if( mouseWheelNav ) {
1507                                    $win.on('mousewheel DOMMouseScroll', scrollHandler);    
1508                                }
1509                            }else {
1510                                container.addClass('ps-fade-horizontal-mobile');
1511                            }
1512                            initNavSliderAndSlides();
1513                        },
1514                        addResizeEvent = function() {
1515                            $win.on('resize', function() {
1516                                if( 1024 < $win.width() && container.hasClass('ps-fade-horizontal-mobile') ) {
1517                                    setGalleryHeight();
1518                                    //nav.on('mouseenter', mouseEnterHandler);
1519                                    if( mouseWheelNav ) {
1520                                        $win.on('mousewheel DOMMouseScroll', scrollHandler);
1521                                    }
1522                                    container.removeClass('ps-fade-horizontal-mobile');
1523                                }else if( 1025 > $win.width() && !container.hasClass('ps-fade-horizontal-mobile') ) {
1524                                    setGalleryHeight();
1525                                    //nav.off('mouseenter', mouseEnterHandler);
1526                                    if( mouseWheelNav ) {
1527                                        $win.off('mousewheel DOMMouseScroll', scrollHandler);                                      
1528                                    }
1529                                    container.addClass('ps-fade-horizontal-mobile');  
1530                                }
1531                            });
1532                        };
1533                    addResizeEvent();
1534                    createVimeoPlayerInstances();
1535                    lazyLoadSlideImages();
1536                    initTemplate();
1537                }
1538            },
1539			close_popups = function() {
1540		        jQuery(document).on('mouseup', '.sliderbar-menu-controller, .sb-slidebar, .mobile-nav-controller, .mobile-menu, .header-search-controls .search-button, .search-box-wrapper', function () {
1541		            if (jQuery(this).hasClass('sliderbar-menu-controller') || jQuery(this).hasClass('sb-slidebar')) {
1542		                close_mobile_menu();
1543		                close_search_box();
1544		            }
1545		            if (jQuery(this).hasClass('mobile-nav-controller') || jQuery(this).hasClass('mobile-menu')) {
1546		                close_sidebar();
1547		                close_search_box();
1548		            }
1549		            if (jQuery(this).hasClass('search-button') || jQuery(this).hasClass('search-box-wrapper')) {
1550		                close_mobile_menu();
1551		                close_sidebar();
1552		            }
1553		            return false;
1554		        });	
1555
1556		        jQuery(document).on('mouseup', function () {
1557		            close_sidebar();
1558		            open_leftstrip();
1559		            close_mobile_menu();
1560		            close_search_box();
1561		        });
1562
1563		        jQuery(document).on('keyup', function (e) {
1564		            if (e.keyCode === 27) {
1565		                close_sidebar();
1566		                open_leftstrip();
1567		                close_search_box();
1568		                if (jQuery('.gallery_content').hasClass('show')) {
1569		                    jQuery('.gallery_content').removeClass('show');
1570		                } else {
1571		                    if (jQuery('.gallery-slider-wrap').hasClass('opened')) {
1572		                        jQuery('html').removeClass('overflow-hidden');
1573		                        jQuery('.gallery-slider-wrap').css('left', '100%').css('opacity', 0);
1574		                        setTimeout(function () {
1575		                            jQuery('.gallery-slider-wrap').removeClass('opened');
1576		                            jQuery('.gallery-slider-content').empty();
1577		                            jQuery('.gallery-slider-wrap').css('left', '-100%');
1578		                        }, 300);
1579		                    }
1580		                }
1581		            }
1582		        });
1583			},
1584
1585			back_to_top = function() {
1586		        jQuery(document).on('click', '#back-to-top, .back-to-top', function (e) {
1587		            e.preventDefault();
1588		            jQuery('body,html').animate({ scrollTop: 0 }, 1000, 'easeInOutQuint');
1589		        });				
1590			},
1591
1592			show_back_to_top_button = function() {
1593		        if ( jQuery(window).scrollTop() > 10 ) {
1594		            to_top_button.fadeIn();
1595		        } else {
1596		            to_top_button.fadeOut();
1597		        }
1598			},
1599
1600		    flickity_default_header = function(){   
1601		        if(jQuery('.portfolio-sliders').length){
1602		            if(jQuery('body.header-transparent').length){
1603		                if(Number_or_zero(jQuery(window).width()) <= 960){
1604		                    jQuery('#header-inner-wrap').css('position','relative');
1605		                }
1606		                else{
1607		                    jQuery('#header-inner-wrap').css('position','absolute');
1608		                }
1609		            }
1610		        }
1611			},  
1612			
1613			Number_or_zero = function(num){
1614				num = Number(num);
1615				if(isNaN(num)){
1616					num = 0;
1617				}
1618				return num;
1619			},
1620
1621		    flickity_getHeight = function(){
1622		        if(jQuery('#content.portfolio-sliders').length){
1623		            var $this = jQuery('#content.portfolio-sliders'),
1624		                $gutter_width = Number_or_zero($this.attr('data-gutter-width')),
1625		                $slider_type = $this.attr('data-slider-type'),
1626		                $window_width = Number_or_zero(jQuery(window).width()) + jQuery.getScrollbarWidth(), //Number_or_zero(jQuery('#main-wrapper').width()) + jQuery.getScrollbarWidth()
1627		                $mobile_calculation = true,
1628		                $full_window_height = Number_or_zero(jQuery(window).height()),
1629		                $window_height = $full_window_height-(Number_or_zero(jQuery('#header').innerHeight())+Number_or_zero(jQuery('#wpadminbar').innerHeight())+Number_or_zero(jQuery('#portfolio-title-nav-wrap').innerHeight()));
1630
1631
1632		            if($this.find('.disable-flickity-mobile').length){
1633		                $mobile_calculation = false;
1634		            }
1635		            if(jQuery('body').hasClass('be-themes-layout-layout-border-header-top')) {
1636		                var $border_length = 1;  
1637		            }else{
1638		                var $border_length = 2;
1639		            }
1640		            //Calculate Height and Width of Image Wrappers
1641		            //CONDITION 1 - If Flickity is Disabled for Mobile Devices 
1642		            if($mobile_calculation == false && $window_width <= 960){  
1643		                //Remove Scrollbar in Mobile View
1644		                var $scrollable_content =  $this.find('.gallery_content_slide');
1645		                $scrollable_content.height('auto');
1646		               // if( 'undefined' !== typeof mCustomScrollbar ) {
1647		                	//$scrollable_content.mCustomScrollbar("disable"); 
1648		               // }
1649		                //Add Image URL to src tag
1650		                $this.find('.be-flickity .img-wrap').each(function(){
1651		                    var $this_img_wrap = jQuery(this),
1652		                        $this_img = $this_img_wrap.find('img'),
1653		                        $data_source = $this_img.attr('data-flickity-lazyload');
1654
1655		                    $this_img.removeAttr("data-flickity-lazyload");
1656		                    $this_img.attr('src',$data_source);
1657		                    $this_img_wrap.width('100%').height('100%');
1658		                }); 
1659		            }
1660		            //CONDITION 2 - Calculation for all Desktop Screen Sizes. And for Mobile Screen Size when Flickity is Enabled.
1661		            if($mobile_calculation == true || $window_width > 960){  
1662		                if($window_width <= 960 ) {
1663		                    if($window_width >= 480 && $window_width < 640){
1664		                        $window_height = $full_window_height;
1665		                    }
1666		                    $this.find('.img-wrap').width($window_width).height($window_height);
1667		                    $this.find('.be-flickity').css('padding',0);
1668		                }else{ 
1669
1670		                    if($slider_type == 'be-ribbon-carousel' || $slider_type == 'be-center-carousel'){ 
1671		                        if(jQuery('#bottom-widgets').length){
1672		                            var $footer_height = 0;
1673		                        }else{
1674		                            var $footer_height = Number_or_zero(jQuery('#footer').innerHeight()) ;
1675		                        }
1676		                        var $window_height_addl = $window_height-((Number_or_zero(jQuery('.layout-box-bottom:visible').height())*$border_length)+$footer_height),
1677		                            $given_slider_height = $this.attr('data-height');
1678		                        
1679		                        //Set Height and Width according to above Calculations
1680		                        var $slider_height = Math.round(($window_height_addl/100)*parseInt($given_slider_height)),
1681		                            $padding = ($window_height_addl-$slider_height)/2;
1682		                        
1683		                        $this.find('.img-wrap').height($slider_height);
1684		                        $this.find('.gallery_content_slide').height($slider_height);
1685		                        
1686		                        $this.find('.be-flickity').css('padding', $padding+'px 0px '+$padding+'px 0px').css('opacity', 1);
1687		                        $this.find('.be-flickity .img-wrap').each(function(){
1688		                            var $this_img = jQuery(this),
1689		                                $img = $this_img.find('img'),
1690		                                $img_actual_width = $this_img.attr('data-image-width'),
1691		                                $img_actual_height = $this_img.attr('data-image-height'),
1692		                                $img_width = Math.round(($img_actual_width * $slider_height)/$img_actual_height);  
1693
1694		                            $this_img.width($img_width);
1695		                        }); 
1696
1697		                    } else if ($slider_type == 'be-centered' || $slider_type == 'be-fullscreen'){
1698
1699		                        $given_slider_height = $this.attr('data-height');//100;
1700		                        //Larger Screens
1701		                        if(jQuery('#bottom-widgets').length){
1702		                            var $footer_height = 0;
1703		                        }else{
1704		                            var $footer_height = Number_or_zero(jQuery('#footer').innerHeight()) ;
1705		                        }                            
1706		                        var $window_height_addl = $window_height-((Number_or_zero(jQuery('.layout-box-bottom:visible').height())*$border_length)+$footer_height);
1707
1708		                        //Set Height and Width according to above Calculations
1709		                        var $slider_height = (($window_height_addl/100)*parseInt($given_slider_height)),
1710		                            $padding = ($window_height_addl-$slider_height)/2;
1711
1712		                        $this.find('.be-flickity').css('padding', $padding+'px 0px '+$padding+'px 0px').css('opacity', 1);
1713		                        $this.find('.img-wrap').height($slider_height).width('100%'); 
1714		                    }
1715		                }
1716		            } 
1717		            
1718		            //Calculation of Thumbnail Position if Flickity is Enabled for Mobile Devices
1719		            if($mobile_calculation == true){
1720		                if($window_width <= 960){
1721		                    var $thumbnail_position =  $window_height+37 - Number_or_zero(jQuery('#header').innerHeight()); 
1722		                    jQuery('.portfolio-sliders .single-portfolio-slider.carousel_bar_area').css('top',$thumbnail_position);  
1723		                }else{
1724		                    jQuery('.portfolio-sliders .single-portfolio-slider.carousel_bar_area').css('top','initial'); 
1725		                }
1726		            }
1727		        }
1728		    },
1729
1730		    flickity_call = function(){
1731		        var $flickity_gallery = jQuery('.main-gallery.be-flickity');
1732		        if( $flickity_gallery.length > 0 ) {
1733			        var    $slider_type = $flickity_gallery.closest('.portfolio-sliders').attr('data-sli
1733der-type'),
1734			            $nav_arrow = Boolean($flickity_gallery.attr('data-nav-arrow')),
1735			            $auto_play_time = parseInt($flickity_gallery.attr('data-auto-play')),
1736			            $free_scroll = Boolean($flickity_gallery.attr('data-free-scroll')),
1737			            $keyboard_crtl = Boolean($flickity_gallery.attr('data-keyboard-crtl')),
1738			            $loop_ctrl = Boolean($flickity_gallery.attr('data-loop-crtl')),
1739			            $cell_align = 'center',
1740			            $percentPosition = true,
1741			            $body = jQuery('body');
1742
1743			        if($auto_play_time <= 0){
1744			            $auto_play_time = false;
1745			        }
1746			        
1747			        if($slider_type == 'be-ribbon-carousel'){
1748			            $cell_align = 'left';
1749			            $percentPosition = false;
1750			        }
1751			        if($slider_type == 'be-center-carousel'){
1752			            $cell_align = 'center';
1753			            $percentPosition = false;
1754			        }
1755			        if((Number_or_zero(jQuery(window).width()) + jQuery.getScrollbarWidth()) <= 960){
1756			            $free_scroll = false;
1757			        }
1758			        var $flickity_gallery = jQuery('.main-gallery.be-flickity').flickity({
1759			            lazyLoad: 3,
1760			            prevNextButtons: $nav_arrow,
1761			            wrapAround: $loop_ctrl,
1762			            freeScroll: $free_scroll,
1763			            accessibility: $keyboard_crtl,
1764			            autoPlay: $auto_play_time,
1765			            contain: true,
1766			            cellAlign: $cell_align,
1767			            percentPosition:$percentPosition,
1768			            pageDots: false,
1769			            watchCSS: true,
1770			            arrowShape: { 
1771			              x0: 20,
1772			              x1: 40, y1: 20,
1773			              x2: 45, y2: 20,
1774			              x3: 25
1775			            }   
1776			        });
1777
1778			        var $flickity_instance = $flickity_gallery.data('flickity');
1779			       
1780			        var iframes = $flickity_gallery.find('.img-wrap iframe');
1781			        if($slider_type == 'be-ribbon-carousel' || $slider_type == 'be-center-carousel'){
1782			            flickity_resetGutter($flickity_gallery);
1783			        }
1784			        $flickity_gallery.on('lazyLoad.flickity',function(event, cellElement){
1785			            var img = event.originalEvent.target;
1786			            // Resize to Parent
1787			            if($slider_type != 'be-centered'){
1788			                if(Number_or_zero(jQuery(window).width()) > 960){
1789			                    jQuery(img).resizeToParent(); 
1790			                }
1791			            }
1792
1793			        })
1794			        // Apply Fit Vids
1795			        $flickity_gallery.find('.img-wrap iframe').fitVids();
1796			        $flickity_gallery.find('.img-wrap iframe').css('opacity',1);
1797			        $flickity_gallery.find('.img-wrap .img-overlay-wrap').css('display','block');
1798
1799			        if($slider_type == 'be-fullscreen'){
1800			            $flickity_gallery.flickity('resize');
1801			        }
1802
1803			        $flickity_gallery.on( 'settle.flickity', function( event, pointer ){
1804			            // Pause Video on Slider Movement
1805			            iframes.each( function() {
1806			                var iframe_id = jQuery(this).attr('id');
1807			                if( iframe_id ) {
1808			                    var iframe = document.getElementById( iframe_id );
1809			                    var player = $f(iframe);
1810			                    player.api("pause");
1811			                }
1812			            });
1813
1814			            var $this_img_wrap = jQuery($flickity_instance.selectedElement);
1815			            // Increment Slider Count
1816			            jQuery('.current-slide-count').text(($flickity_instance.selectedIndex) + 1);
1817			            // Remove Overlay Wrapper
1818			            $flickity_gallery.find('.img-wrap.is-selected').css('z-index','-1');
1819			            // Background Check
1820			            if (!($body.hasClass('disable_rev_slider_bg_check')) && !($body.hasClass('semi'))){
1821			                if($slider_type == 'be-fullscreen' && ($this_img_wrap.find('iframe').length <= 0) ){
1822			                    
1823			                    BackgroundCheck.init({
1824			                        targets: '#header #header-inner-wrap, .portfolio-sliders .transparent-nav-bar',
1825			                        images: '.be-fullscreen .img-wrap.is-selected img'
1826			                    });
1827			                    
1828			                    BackgroundCheck.refresh();
1829			                }
1830			            }
1831			        });
1832				}
1833		        // BackgroundCheck.destroy();
1834		    },
1835
1836		    flickity_resize = function(){
1837		        var $flickity_gallery = jQuery('.main-gallery.be-flickity'),
1838		            $slider_type = $flickity_gallery.closest('.portfolio-sliders').attr('data-slider-type'); 
1839
1840		        if($slider_type != 'be-centered'){
1841		            if(Number_or_zero(jQuery(window).width()) > 960){
1842		                $flickity_gallery.find('.img-wrap img').resizeToParent(); 
1843		            }
1844		        }
1845		    },
1846
1847		    flickity_resetGutter = function(onFlickityGallery){
1848		        var $flickity_slider = onFlickityGallery.find('.flickity-slider'),
1849		            $flickity_wrapper = onFlickityGallery.closest('#content'),
1850		            $gutter_width = $flickity_wrapper.attr('data-gutter-width');
1851		        
1852		        if(Number_or_zero(jQuery(window).width()) <= 960 ) {
1853		            $flickity_slider.css('left',0);
1854		        }else{
1855		            $flickity_slider.css('left',Number_or_zero($gutter_width)); 
1856		        }
1857			},
1858				
1859			blog_category_hover_bg = function() {
1860
1861				var blogContainer = jQuery( '.style8-blog' );
1862				blogContainer.on( 'mouseenter', '.post-meta.post-category a',  function( event ) {
1863
1864					var curElement = jQuery( this ),
1865						bgColor = curElement.attr( 'data-background-color' ) || '';
1866					curElement.css( {
1867						backgroundColor : bgColor,
1868						borderColor : bgColor 
1869					} );
1870
1871				} );
1872				blogContainer.on( 'mouseleave', '.post-meta.post-category a', function( event ) {
1873
1874					var curElement = jQuery( this );
1875					curElement.css( {
1876						backgroundColor : '',
1877						borderColor : ''
1878					} );
1879
1880				} );
1881
1882			},
1883
1884		    flickity_thumb_call = function(){
1885
1886		        var $flickity_thumb_gallery = jQuery('.be-flickity-thumb').flickity({
1887		            asNavFor: '.main-gallery', 
1888		            freeScroll: true,
1889		            contain: true, 
1890		            pageDots: false,
1891		            prevNextButtons: false
1892		        });
1893		    },
1894
1895		    carousel_thumb_call = function(){
1896
1897		        var $flickity_thumb_gallery = jQuery('.be-carousel-thumb').flickity({
1898		            freeScroll: true,
1899		            contain: true, 
1900		            pageDots: false,
1901		            prevNextButtons: false
1902		        });
1903		    },
1904
1905			triggerStackShare = function( hoverTargets ) {
1906
1907				var hoverTargets = hoverTargets || jQuery( '.be-share-stack-mask' );
1908				hoverTargets.each( function() {
1909
1910					var	hoverTarget = jQuery( this ),
1911						hoverTargetChildren = hoverTarget.children(),
1912						shareTargets = hoverTargetChildren.slice( 1 ),
1913						stackTop = hoverTarget.parent().hasClass( 'be-stack-top' );
1914					hoverTarget.on( 'mouseenter', function( event ) {
1915
1916						if( !stackTop ) {
1917							hoverTarget.css( 'width', ( ( hoverTargetChildren.length * 15 ) + ( ( hoverTargetChildren.length - 1 ) * 10 ) ) + 'px' );
1918							shareTargets.each( function(i, e) {
1919								
1920								var left = ( ( i + 1 ) * 25 ) + 'px';
1921								jQuery( this ).css({
1922									left : left,
1923									opacity : 1
1924								});
1925
1926							} );
1927						}else{
1928							hoverTarget.css( 'height', ( ( hoverTargetChildren.length * 17 ) + ( ( hoverTargetChildren.length - 1 ) * 10 ) ) + 'px' );
1929							hoverTarget.css( 'bottom', 0 );
1930							shareTargets.each(function( i, e ) {
1931								
1932								var bottom = ( ( i + 1 ) * 25 ) + 'px';
1933								jQuery( this ).css({
1934									bottom : bottom,
1935									opacity : 1
1936								});
1937
1938							} );						
1939						}
1940					
1941					} );
1942					hoverTarget.on( 'mouseleave', function( event ) {
1943
1944						if( !stackTop ) {
1945							hoverTarget.css( 'width', '' );
1946							shareTargets.each( function( i, e ) {
1947								
1948								jQuery( this ).css({
1949									left : 0,
1950									opacity : 0
1951								});
1952
1953							} );
1954						}else{
1955							hoverTarget.css( 'height', '' );
1956							shareTargets.each( function( i, e ) {
1957								
1958								jQuery( this ).css({
1959									bottom : 0,
1960									opacity : 0
1961								});
1962
1963							} );
1964						}
1965					
1966					} );    
1967
1968				});
1969
1970			},
1971
1972			triggerFixedFooter = function() {
1973
1974				if( 0 < fixedFooter.length && 0 < fixedFooterPlaceholder.length && !jQuery( 'body' ).hasClass( 'be-fixed-footer-disable' ) ) {
1975					if( 1024 < jQuery( window ).width() ) {
1976						fixedFooterPlaceholder.css( 'display', 'block' );
1977						fixedFooterPlaceholder.height( fixedFooter.outerHeight() );
1978						fixedFooter.css('visibility', 'visible');
1979						if( 'fixed'  != fixedFooter.css( 'position' ) ) {
1980							fixedFooter.css( 'position', 'fixed' );
1981						}
1982						jQuery( 'body' ).addClass( 'be-fixed-footer' );
1983					}else{
1984						fixedFooterPlaceholder.css( 'display', 'none' );
1985						fixedFooter.css( 'position', 'relative' );
1986						fixedFooter.css( 'visibility', 'visible' );
1987						jQuery( 'body' ).removeClass( 'be-fixed-footer' );
1988					}
1989				}
1990
1991			},
1992
1993		    woocommerce = function() {
1994				jQuery(document).on( 'mouseenter', '.header-cart-controls', function() {
1995					if(jQuery(this).find('.cart_list.product_list_widget ').length > 0) {
1996						jQuery(this).find('.widget_shopping_cart_wrap').stop(true, false).fadeIn();
1997					}
1998				});
1999
2000				jQuery(document).on( 'mouseleave', '.header-cart-controls', function() {
2001					if(jQuery(this).find('.cart_list.product_list_widget ').length > 0) {
2002						jQuery(this).find('.widget_shopping_cart_wrap').stop(true, false).fadeOut();
2003					}
2004				});
2005
2006				asyncloader.require( 'magnificpopup', function() {
2007					jQuery('.product-single-boxed-content .images').magnificPopup({
2008						delegate: 'a',
2009						type: 'image',
2010						tLoading: 'Loading image #%curr%...',
2011						mainClass: 'mfp-img-mobile',
2012						gallery: {
2013							enabled: true,
2014				            navigateByImgClick: true,
2015				            preload: [0,1] // Will preload 0 - before current, and 1 after the current image
2016						},
2017						image: {
2018				            tError: '<a href="%url%">The image #%curr%</a> could not be loaded.'
2019						}
2020				    });	
2021				});	    	
2022		    },
2023
2024		    heroSectionParallax = function() {
2025		    	var parallax = jQuery('.be-section.be-bg-parallax');
2026		        if( parallax.length > 0 ) {
2027		            parallax.each(function (i, el) {
2028		                var el = jQuery(el);
2029		                if (el.visible(true)) {
2030		                    if(!jQuery(this).hasClass('parallaxed')) {
2031		                        jQuery(this).parallax("50%", 0.4);
2032		                        jQuery(this).addClass('parallaxed');
2033		                    }
2034		                }
2035		            });
2036		        }		    	
2037		    },
2038
2039		    tatsuFirstSection = function() {
2040		    	if( jQuery('#hero-section').length == 0 ) {
2041		    		//jQuery('#header-inner-wrap').addClass( jQuery('.tatsu-section:first-child').attr('data-headerscheme') );
2042		    	}
2043			},
2044			
2045			video = function() {
2046				var vimeoVideos = $( '.be-vimeo-embed' ),
2047					youtubeVideos = $( '.be-youtube-embed' ),
2048					loadYoutubeVideos,
2049					videoReadyCallback;
2050				videoReadyCallback = function( iframeEle ) {
2051					asyncloader.require( ['fitvids'], function(){
2052						if( null != iframeEle && 0 < iframeEle.length ) {
2053							iframeEle.closest( '.be-video-embed' ).removeClass( 'be-embed-
2053placeholder' );
2054							iframeEle.parent().fitVids();
2055							$(document).trigger( 'be_video_loaded', [ iframeEle ] );
2056						}  
2057					});        
2058				};
2059				loadYoutubeVideos = function() {
2060					youtubeVideos.each(function() {
2061						var curVideo = $(this),
2062							curPlayer = null,
2063							id = null != curVideo.attr( 'data-video-id' ) ? curVideo.attr( 'data-video-id' ) : null,
2064							autoplay = null != curVideo.attr( 'data-autoplay' ) ? parseInt(curVideo.attr( 'data-autoplay' )) : null,
2065							loopVideo = null != curVideo.attr( 'data-loop' ) ? parseInt(curVideo.attr( 'data-loop' )) : null;
2066	
2067						if( null != id ) {
2068							var playerVariables = { 
2069								'autoplay': autoplay,
2070								'loop' : loopVideo,
2071								'rel' : 0
2072							};
2073							if(loopVideo){
2074								playerVariables.playlist = id;
2075							}
2076							
2077							var ytPlayerSettings = {
2078								videoId : id,
2079								playerVars: playerVariables,
2080								width : curVideo.width(),
2081								height : curVideo.width()/1.7777,
2082								events: {
2083									'onReady': function (e) {
2084										if( autoplay ){
2085											e.target.mute();   
2086										}
2087									}
2088								}
2089							};
2090							//fix - Revslider background video 
2091							if(0< $('rs-bgvideo').length){
2092								ytPlayerSettings.host='https://www.youtube-nocookie.com';
2093								ytPlayerSettings.origin=window.location.hostname;
2094							}
2095							
2096							curPlayer = new YT.Player( this, ytPlayerSettings);
2097
2098							// curPlayer = new YT.Player( this, {
2099							// 	videoId : id,
2100							// 	playerVars: playerVariables,
2101							// 	width : curVideo.width(),
2102							// 	height : curVideo.width()/1.7777,
2103							// 	events: {
2104							// 		'onReady': function (e) {
2105							// 			if( autoplay ){
2106							// 				e.target.mute();   
2107							// 			}
2108							// 		}
2109							// 	}
2110							// });
2111							videoReadyCallback( $( curPlayer.getIframe() ) );
2112						}
2113					});
2114				}
2115				//vimeo videos
2116				if( 0 < vimeoVideos.length ) {
2117					asyncloader.require( [ 'vimeonew' ], function() {
2118						vimeoVideos.each( function() {
2119							var curVideo = $(this),
2120								curPlayer = null,
2121								id = !isNaN( Number( curVideo.attr( 'data-video-id' ) ) ) ? Number( curVideo.attr( 'data-video-id' ) ) : null,
2122								autoplay = null != curVideo.attr( 'data-autoplay' ) ? parseInt(curVideo.attr( 'data-autoplay' )) : false,
2123								loopVideo = null != curVideo.attr( 'data-loop' ) ? parseInt(curVideo.attr( 'data-loop' )) : false;
2124							if( null != id ) {
2125								var curPlayer = new Vimeo.Player( this, {
2126									id : id,
2127									autoplay : autoplay ? true : false,
2128									loop : loopVideo ? true : false,
2129									muted : autoplay ? true : false,
2130									width : curVideo.width(),
2131									height : Math.ceil(curVideo.width()/1.7777),    
2132								});
2133								curPlayer.ready().then( function() {
2134									videoReadyCallback( curVideo.children( 'iframe' ) );
2135								});
2136							}
2137						} );
2138					} );
2139				}
2140	
2141				if( 0 < youtubeVideos.length ) {
2142					if( 'undefined' != typeof YT && 'function' == typeof YT.Player ) {
2143						loadYoutubeVideos();
2144					}else {
2145						$(document).on( 'YTAPIReady', loadYoutubeVideos );
2146					}
2147				}
2148			},
2149
2150		    ready = function() {
2151
2152				//jQuery( 'body' ).css( 'display', 'none' );
2153				tatsuFirstSection();
2154				blog_category_hover_bg();
2155				triggerFixedFooter();
2156				sticky_sidebar();
2157		    	jQuery('.component ul li:first-child').addClass('current');
2158
2159		    	asyncloader.require( 'fitvids' , function(){
2160	    	        body.find('iframe').not('.rev_slider iframe').each(function () {
2161						if(jQuery(this).parents('rs-bgvideo').length==0){
2162							jQuery(this).parent().fitVids();console.log("not rev slider");
2163						}
2164	            		//jQuery(this).parent().fitVids();
2165	        		});
2166	    	    });
2167
2168		        jQuery( document ).on( 'click', '.top-overlay-menu .sliderbar-nav-controller-wrap, .left-overlay-menu .left-strip-wrapper',  menu_link_animation );	
2169
2170		        //Handle Transparent & Sticky Headers
2171		        asyncloader.require( [ 'transparentheader' ], function(){
2172		        	jQuery('#header').Transparent();
2173		        });	 
2174
2175		        //Handle Scroll to Sections
2176		        if( body.hasClass('section-scroll') && !body.hasClass('tatsu-frame') ) {
2177					var deps = [ 'scrolltosections', 'mousewheel' ];
2178					if( jQuery('be-vimeo-embed').length ){
2179						deps.push('vimeo');
2180					}
2181		        	asyncloader.require( deps, function(){
2182		        		body.SectionScroll();
2183		        	});
2184		        }
2185
2186		        if( jQuery('#galaxy-canvas').length > 0 ) {
2187		        	asyncloader.require( [ 'greensock', 'request_animation_frame', 'galaxycanvas' ], function(){
2188		            	galaxy_canvas();
2189		            });
2190		        }
2191
2192		        if( jQuery('#pattern-canvas').length > 0 ) {
2193		        	asyncloader.require( [ 'greensock', 'request_animation_frame', 'patterncanvas' ], function(){
2194		            	pattern_canvas();  
2195		          });
2196		        }
2197
2198		        if( jQuery('#waterdrops-canvas').length > 0 ) {
2199		        	asyncloader.require( [ 'greensock', 'request_animation_frame', 'waterdropcanvas' ], function(){
2200		            	water_drop_canvas();
2201		            });
2202		        }
2203
2204		        if( fullscreen_wrap.length > 0 ) {
2205					asyncloader.require( [ 'fullscreenheight' ], function(){
2206						fullscreen_wrap.FullScreen();
2207					});		        	
2208		        }	
2209
2210				
2211				//Perspective Left & right
2212				perspective_navigation();			
2213				//Top Page Stack
2214				top_page_stack();
2215				
2216		        custom_scrollbar();
2217		        close_sidebar();
2218		        open_leftstrip();
2219		        menu_item_update();
2220		        single_page_nav();
2221		        superfish();
2222                sliders();
2223		        rev_slider_bg_check();
2224		        woocommerce();
2225		        heroSectionParallax();
2226
2227				//sticky_sections
2228				sticky_sections();
2229
2230
2231				//stack share icons trigger
2232				triggerStackShare();
2233
2234		        //Handle Click Events
2235		        close_overlay_menu();
2236		        close_gallery_info_box();
2237		        close_popups();
2238		        back_to_top();
2239		        left_strip();
2240		        sliderbar_navigation();
2241		        local_scroll();
2242		        sub_menu();
2243		        falling_menu();
2244		        mobile_menu();
2245		        header_search();
2246				
2247				//BE Left strip
2248				be_left_strip();
2249				left_header_close_overlay();
2250				//Side menu
2251				sidemenu_navigation();
2252				close_sidemenu();
2253
2254		        //Handle Mouseover events
2255		        carousel_thumb();
2256
2257		        //Flickity
2258		        if( jQuery('.main-gallery.be-flickity').length > 0 ) {
2259					var hasVimeo = jQuery('.main-gallery.be-flickity').attr('data-vimeo'),
2260						flickityDeps = ['flickity', 'backgroundcheck', 'resizetoparent' ];
2261					if( "1" == hasVimeo && jQuery('be-vimeo-embed').length ) {
2262						flickityDeps.push( 'vimeo' );
2263					}
2264			        asyncloader.require( flickityDeps, function() {
2265				        flickity_default_header();
2266		        		flickity_getHeight();
2267		        		flickity_call();
2268		        		flickity_thumb_call();
2269		        				        	
2270			        });
2271				}
2272				
2273
2274			    if( jQuery('.be-carousel-thumb').length > 0 ) {
2275			    	asyncloader.require('flickity', function() {
2276						carousel_thumb_call();  		
2277			    	});
2278				}
2279				carouselIOSFix();
2280				//Multi Level Menu
2281				multi_level_menu();
2282                video();
2283                portfolioTemplateZoro();
2284
2285		    },
2286
2287		    run = function() {
2288
2289		    	ready();
2290
2291		    	//On Window Scroll Event
2292
2293		    	jQuery(window).on('scroll', function () {	    		
2294					didScroll = true;
2295		    	});
2296
2297				setInterval( function(){
2298					if( didScroll ) {
2299						didScroll = false;
2300						show_back_to_top_button();
2301					}
2302				},100 );
2303
2304				if( body.hasClass('single-page-version') ){
2305					jQuery(window).on('scroll', function () {
2306						menu_item_update();
2307					});
2308				}
2309
2310			    if( jQuery(".floting-sidebar").length > 0 || jQuery(".fixed-sidebar").length > 0 ) {
2311					jQuery(window).on('scroll', function () {
2312						sticky_sidebar();
2313					});					
2314				}
2315
2316				if( body.hasClass('page-template-page-splitscreen-left') || body.hasClass('page-template-page-splitscreen-right') ) {
2317					jQuery(window).on('scroll', function () {
2318						split_screen();
2319					});						
2320				}
2321
2322		    	//On Window Resize Event
2323		    	jQuery(window).on( 'resize.oshine', function() {
2324		    		sticky_sidebar();
2325		    		split_screen();
2326					triggerFixedFooter();
2327		    		//close_mobile_menu();
2328		    		menu_item_update();
2329			        if (jQuery(window).width() > 960) {
2330			            jQuery('.mobile-menu').slideUp();
2331						jQuery( '.mobile-nav-controller .be-mobile-menu-icon' ).removeClass( 'is-clicked' );
2332			        } else {
2333						jQuery( 'body' ).removeClass( 'side-menu-opened' );
2334						jQuery( '.be-sidemenu' ).removeClass( 'opened' );
2335						jQuery( '.hamburger-nav-controller .be-mobile-menu-icon' ).removeClass( 'is-clicked' );
2336						jQuery( '#be-left-strip .be-mobile-menu-icon' ).removeClass( 'is-clicked' );
2337						jQuery('html').removeClass('hide-overflow');
2338						if( jQuery('body').hasClass( 'overlay-center-align-menu' ) || jQuery('body').hasClass( 'overlay-left-align-menu' ) || jQuery('body').hasClass( 'overlay-horizontal-menu' ) ){
2339							jQuery( '#header' ).css( 'z-index', '10' );
2340							jQuery( '.be-sidemenu' ).css({ 'z-index' : '-1', 'visibility' : 'hidden' });
2341						}
2342					}
2343
2344	        	 	//jQuery(".gallery_content_area, .ps-content-inner, .gallery_content_slide").mCustomScrollbar("update");
2345
2346
2347					if( jQuery('.main-gallery.be-flickity').length > 0 ) {
2348						asyncloader.require( ['flickity', 'backgroundcheck', 'resizetoparent'], function() {
2349						    flickity_default_header();
2350						    flickity_getHeight();
2351						    var $flickity_gallery = jQuery('.main-gallery.be-flickity');
2352
2353						    if(jQuery(window).width() > 960){
2354						        $flickity_gallery.find('.img-wrap').each(function(){
2355						            var $this_img = jQuery(this),
2356						                $img = $this_img.find('img');
2357						            //Reassign Img Source Attribute to Enable Lazyload in Larger Screen Sizes
2358						            if( ($img.attr('src') ) && !($img.hasClass('flickity-lazyloaded') ) ) {
2359						            var $data_source = $img.attr('src');
2360						                $img.removeAttr("src");
2361						                $img.attr('data-flickity-lazyload',$data_source);
2362						            }
2363						        });
2364						    }
2365						    $flickity_gallery.flickity('reloadCells');
2366						    // Resize to Parent
2367						    flickity_resize();
2368						    flickity_resetGutter($flickity_gallery);
2369						    flickity_thumb_call();
2370						});
2371					}
2372
2373				    if( jQuery('.be-carousel-thumb').length > 0 ) {
2374				    	asyncloader.require( 'flickity', function() {
2375							carousel_thumb_call();  		
2376				    	});
2377					}	
2378		    	});
2379
2380		    	// On Window Load Event
2381				jQuery(window).load(function () {
2382						var $hash = window.location.hash;
2383				        if ($hash) {
2384				            if (jQuery($hash).length > 0) {
2385								if( body.hasClass( 'be-sticky-sections' ) ) {
2386									var secIndex = jQuery( $hash ).index();
2387									if( null != stickySections && -1 < secIndex && secIndex < jQuery( '.sticky-section' ).length ) {
2388										stickySections.moveTo( secIndex );
2389									}
2390								}else{
2391									animate_scroll( jQuery($hash) );
2392								}
2393				            }
2394				        }
2395				        setTimeout(function () {
2396				        	asyncloader.require( 'imagesloaded' , function(){
2397					            body.imagesLoaded(function () {
2398									split_screen();
2399									if( body.hasClass( 'be-sticky-sections' ) && !body.hasClass( 'tatsu-frame' ) && 967 < jQuery( window ).width() ) {
2400										stickySections.updateLayout();										
2401									}
2402					            });
2403					        });    
2404				        }, 200);
2405				        custom_scrollbar();
2406				});
2407		    }
2408
2409
2410			return {
2411				run: run,
2412				animate_scroll : animate_scroll,
2413				triggerStackShare : triggerStackShare
2414			}
2415
2416	    })();
2417		
2418	    oshine_scripts.run();
2419		window.oshine_scripts = oshine_scripts;
2420
2421	});    
2422
2423})( jQuery );
2424
2425;(function($) {
2426    if($(".ps-fade").length > 0 ){
2427        console.log("ps-fade in");
2428        if( $(window).width() < 768 ){
2429            console.log("flickity mobile");
2430            setTimeout(function(){
2431                $(".ps-fade-gallery-inner").flickity("destroy");
2432                $(".ps-fade-gallery-inner").flickity({pageDots:!1,adaptiveHeight:!0,prevNextButtons:!1});
2433            },1000);
2434        }
2435    }
2436})(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.