PageSourceSearch

https://www.colleenstonemakeup.com/wp-content/themes/oshin/js/script.js?ver=7.3.1

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