PageSourceSearch

https://www.intesys.it/wp-content/themes/intesys_salient/js/init.js?ver=1781593759

js intesys.it collected 2026-10-02 07:21:15 UTC 831,243 bytes, 23,229 lines download raw bytes

1// File from public/wp-content/themes/salient/js/src/init.js
2/**
3 * Main Salient script file.
4 *
5 * @package Salient
6 * @author ThemeNectar
7 */
8/* global jQuery */
9/* global Waypoint */
10/* global imagesLoaded */
11/* global Flickity */
12
13(function ($, window, document) {
14
15    "use strict";
16
17    // Theme vars.
18    var $window = $(window),
19        $body = $('body'),
20        $offCanvasEl = $('#slide-out-widget-area'),
21        $offCanvasBG = $('#slide-out-widget-area-bg'),
22        $headerOuterEl = $('#header-outer'),
23        $headerSecondaryEl = $('#header-secondary-outer'),
24        $searchButtonEl = $('#header-outer #search-btn a'),
25        $wpAdminBar = $('#wpadminbar'),
26        $loadingScreenEl = $('#ajax-loading-screen'),
27        $bodyBorderTop = $('.body-border-top'),
28        $pageHeaderBG = $('#page-header-bg'),
29        $footerOuterEl = $('#footer-outer'),
30        delayJS = (window.nectarOptions && window.nectarOptions.delay_js && window.nectarOptions.delay_js === '1') ? true : false,
31        $bodyBorderWidth = ($('.body-border-right').length > 0) ? $('.body-border-right').width() : 0,
32        $logoHeight = ($headerOuterEl.is('[data-logo-height]')) ? parseInt($headerOuterEl.attr('data-logo-height')) : 30,
33        headerPadding = ($headerOuterEl.is('[data-padding]')) ? parseInt($headerOuterEl.attr('data-padding')) : 28,
34        logoShrinkNum = ($headerOuterEl.is('[data-shrink-num]')) ? $headerOuterEl.attr('data-shrink-num') : 6,
35        condenseHeaderLayout = ($headerOuterEl.is('[data-condense="true"]')) ? true : false,
36        usingLogoImage = ($headerOuterEl.is('[data-using-logo="1"]')) ? true : false,
37        headerResize = ($headerOuterEl.is('[data-header-resize="1"]')) ? true : false,
38        headerTransparent = ($headerOuterEl.is('[data-transparent-header="true"]')) ? true : false,
39        headerMobileFixed = ($headerOuterEl.is('[data-mobile-fixed="1"]')) ? true : false,
40        headerLayoutFormat = ($body.is('[data-header-format]')) ? $body.attr('data-header-format') : 'default',
41        headerHideUntilNeeded = ($body.is('[data-hhun]')) ? $body.attr('data-hhun') : '',
42        headerIsContained = ($body.is('[data-contained-header="true"]')) ? true : false,
43        $animationEasing = ($body.is('[data-cae]') && $body.attr('data-cae') !== 'swing') ? $body.attr('data-cae') : 'easeOutCubic',
44        $animationDuration = ($body.is('[data-cad]')) ? $body.attr('data-cad') : '650',
45        $animatedAnchorLinks = ($('body[data-animated-anchors="true"]').length > 0) ? true : false,
46        bypassAnimations = (!$body.is('[data-m-animate="1"]') && navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) ? true : false,
47        headerOCMButtonPos = (window.nectarOptions && window.nectarOptions.ocm_btn_position && window.nectarOptions.ocm_btn_position === 'left') ? 'left' : 'default',
48        usingSmoothScroll = (window.nectarOptions && window.nectarOptions.smooth_scroll && window.nectarOptions.smooth_scroll === 'true') ? true : false,
49        bodyBorderVignette = (window.nectarOptions && window.nectarOptions.body_border_func && window.nectarOptions.body_border_func == 'vignette') ? true : false,
50        bodyBorderMobile = (window.nectarOptions && window.nectarOptions.body_border_mobile && window.nectarOptions.body_border_mobile === '1') ? true : false,
51        bodyBorderHeight = $body.find('.body-border-top').height(),
52        $portfolio_containers = [],
53        $svgIcons = [],
54        $nectarCustomSliderRotate = [],
55        $flickitySliders = [],
56        flickityDragArr = [],
57        viewIndicatorArr = [],
58        linkIndicatorArr = [],
59        iconMouseFollowArr = [],
60        postGridImgMouseFollowArr = [],
61        parallaxItemsArr = [],
62        cascadingParallaxArr = [],
63        elParallaxArr = [],
64        animateElArr = [],
65        $fsProjectSliderArr = [],
66        $wooFlickityCarousels = [],
67        $liquidBG_EL = [],
68        $testimonialSliders = [],
69        $mouseParallaxScenes = [],
70        $nectarMasonryBlogs = [],
71        $standAnimatedColTimeout = [],
72        animeAnimations = [],
73        $animatedSVGIconTimeout = [],
74        $projectCarouselSliderArr = [],
75        $nectarPostGridArr = [],
76        $verticalScrollingTabs = [],
77        rotatingTitles = [],
78        fullHeightRows = [],
79        $tabbedClickCount = 0,
80        $fullscreenSelector = '',
81        $fullscreenMarkupBool = false,
82        $bodyBorderHeaderColorMatch = false,
83        lazyItemObserver = {},
84        nectarBoxRoll = {
85            animating: 'false',
86            perspect: 'not-rolled',
87            inUse: false
88        },
89        $nectarFullPage = {
90            $usingFullScreenRows: false
91        },
92        $svgResizeTimeout,
93        $bodyBorderSizeToRemove;
94
95    if ($bodyBorderTop.length > 0) {
96
97        if ($bodyBorderTop.css('background-color') == '#ffffff' && $body.attr('data-header-color') == 'light' ||
98            $bodyBorderTop.css('background-color') == 'rgb(255, 255, 255)' && $body.attr('data-header-color') == 'light' ||
99            $bodyBorderTop.css('background-color') == $headerOuterEl.attr('data-user-set-bg')) {
100            $bodyBorderHeaderColorMatch = true;
101        }
102
103    }
104
105    var usingIOS = navigator.userAgent.match(/(iPod|iPhone|iPad)/) || navigator.userAgent.match(/Mac/) && navigator.maxTouchPoints && navigator.maxTouchPoints > 2;
106    var safariAgent = navigator.userAgent.indexOf("Safari") > -1 && navigator.userAgent.indexOf("Chrome") < 1;
107    if (safariAgent || usingIOS) {
108        usingSmoothScroll = false;
109    }
110
111
112    /**
113     * Nectar DOM info helper.
114     *
115     * @since 9.0
116     */
117    var nectarDOMInfo = {
118
119        usingMobileBrowser: (navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) ? true : false,
120        usingIOS: (navigator.userAgent.match(/(iPod|iPhone|iPad)/) || navigator.userAgent.match(/Mac/) && navigator.maxTouchPoints && navigator.maxTouchPoints > 2) ? true : false,
121        usingTouchDevice: (navigator.maxTouchPoints && navigator.maxTouchPoints > 2) ? true : false,
122        usingFrontEndEditor: (typeof window.vc_iframe === 'undefined') ? false : true,
123        getWindowSize: function () {
124            nectarDOMInfo.winH = window.innerHeight;
125            nectarDOMInfo.winW = window.innerWidth;
126            nectarDOMInfo.adminBarHeight = ($wpAdminBar.length > 0) ? $wpAdminBar.height() : 0;
127            nectarDOMInfo.secondaryHeaderHeight = ($headerSecondaryEl.length > 0 && $headerSecondaryEl.css('display') != 'none') ? $headerSecondaryEl.outerHeight() : 0;
128            nectarDOMInfo.footerOuterHeight = ($footerOuterEl.length > 0) ? $footerOuterEl.outerHeight() : 0;
129        },
130        scrollTop: 0,
131        clientX: 0,
132        clientY: 0,
133        scrollPosMouse: function () {
134            return window.scrollY || $window.scrollTop();
135        },
136        scrollPosRAF: function () {
137
138            nectarDOMInfo.scrollTop = window.scrollY || $window.scrollTop();
139            requestAnimationFrame(nectarDOMInfo.scrollPosRAF);
140        },
141        bindEvents: function () {
142
143            if (!nectarDOMInfo.usingMobileBrowser) {
144
145
146                if (!usingSmoothScroll) {
147                    $window.on('scroll', function () {
148                        nectarDOMInfo.scrollTop = nectarDOMInfo.scrollPosMouse();
149                    });
150                }
151                document.addEventListener("mousemove", function (e) {
152                    nectarDOMInfo.clientX = e.clientX;
153                    nectarDOMInfo.clientY = e.clientY;
154                });
155
156            }
157
158            $window.on('resize', nectarDOMInfo.getWindowSize);
159            window.addEventListener("orientationchange", nectarDOMInfo.getWindowSize);
160
161        },
162        init: function () {
163            // Re-cache WP admin bar after DOM ready
164            $wpAdminBar = $('#wpadminbar');
165
166            // Get values and bind events
167            this.getWindowSize();
168            this.usingPhoneBrowser = (nectarDOMInfo.usingMobileBrowser && nectarDOMInfo.winW < 690) ? true : false;
169            this.scrollTop = this.scrollPosMouse();
170            this.bindEvents();
171
172            this.usingFrontEndEditor = (typeof window.vc_iframe === 'undefined') ? false : true;
173        }
174
175    };
176    window.nectarDOMInfo = nectarDOMInfo;
177
178    // Initialize Nectar DOM helper.
179    nectarDOMInfo.init();
180
181
182    /**
183     * Nectar State.
184     *
185     * @since 13.0
186     */
187    var nectarState = {
188        materialOffCanvasOpen: false,
189        materialSearchOpen: false,
190        permanentTransHeader: ($headerOuterEl.is('[data-permanent-transparent="1"]')) ? true : false,
191        animatedScrolling: false,
192        preventScroll: false,
193        ocmOpen: false,
194        ocmAnimating: false,
195        ocmInit: false,
196        mobileHeader: ''
197    }
198    window.nectarState = nectarState;
199
200
201    /**
202     * Debounced resize event
203     *
204     * @since 2.0
205     */
206
207    function smartResizeInit() {
208        fullWidthContentColumns();
209        if (!nectarDOMInfo.usingMobileBrowser) {
210            parallaxRowsBGCals();
211        }
212        headerSpace();
213        OCM_overflowState();
214        showOnLeftSubMenu();
215        inlineMegaMenuPos();
216    }
217
218
219    /**
220     * Orientation change event.
221     *
222     * @since 13.0
223     */
224    function orientationChangeInit() {
225
226        setTimeout(function () {
227            parallaxRowsBGCals();
228        }, 100);
229
230    }
231
232
233    /**
234     * Main resize event.
235     *
236     * @since 2.0
237     */
238    function resizeInit() {
239        fullWidthSections();
240        fullWidthContentColumns();
241        addOrRemoveSF();
242        responsiveVideoIframes();
243
244        if ($bodyBorderTop) {
245            bodyBorderHeight = $bodyBorderTop.height();
246        }
247
248        if (!nectarDOMInfo.usingMobileBrowser) {
249            parallaxRowsBGCals();
250        }
251
252    }
253
254
255    /**
256     * Flexslider plugin initialization.
257     *
258     * @since 5.0
259     */
260    function flexsliderInit() {
261        $('.flex-gallery').each(function () {
262
263            if (!$().flexslider) {
264                return;
265            }
266
267            var $that = $(this);
268
269            imagesLoaded($(this), function () {
270
271                var autorotate = ($that.find('ul').is('[data-d-autorotate="true"]')) ? false : true;
272
273                $that.flexslider({
274                    animation: 'fade',
275                    smoothHeight: false,
276                    animationSpeed: 500,
277                    useCSS: false,
278                    touch: true,
279                    slideshow: autorotate,
280                });
281
282                //gallery slider add arrows
283                $('.flex-gallery .flex-direction-nav li a.flex-next').html('<i class="fa fa-angle-right"></i>');
284                $('.flex-gallery .flex-direction-nav li a.flex-prev').html('<i class="fa fa-angle-left"></i>');
285
286                $(window).trigger('salient-parallax-bg-recalculate');
287                nectarParallaxElRefresh();
288
289            });
290
291        });
292    }
293
294
295    /**
296     * Icon follow.
297     *
298     * @since 11.0
299     */
300
301    function NectarIconMouseFollow($el, iconType) {
302
303        this.lastX = nectarDOMInfo.clientX;
304        this.lastY = nectarDOMInfo.clientY;
305        this.$el = $el;
306        this.iconType = iconType;
307        this.timeout = false;
308        this.overEl = false;
309        this.initialCalc = false;
310        this.styleType = 'default';
311        this.bgElSelector = '';
312        this.$dragEl = '';
313        this.$innerParallaxEl = '';
314        this.parallaxLastX = 0;
315        this.parallaxLastY = 0;
316        this.$viewEl = '';
317        this.$closeEl = '';
318        this.lerpDamp = 0.18;
319        this.parallaxLerp = true;
320
321        this.arrowMarkup = '<i class="fa fa-angle-left" role="none"></i><i class="fa fa-angle-right" role="none"></i>';
322
323        this.createMarkup();
324        this.setup();
325        this.mouseBind();
326
327    }
328
329    NectarIconMouseFollow.prototype.setup = function () {
330
331        if (this.iconType === 'post-grid-images' ||
332            this.iconType === 'horizontal-movement' ||
333            this.iconType === 'link-indicator' ||
334            this.iconType === 'view-indicator') {
335            this.viewportTracking();
336        }
337
338    };
339
340    NectarIconMouseFollow.prototype.viewportTracking = function () {
341
342        var that = this;
343
344        if ('IntersectionObserver' in window) {
345
346            var options = {
347                rootMargin: '0px',
348                threshold: 0
349            }
350
351            this.observer = new IntersectionObserver(function (entries) {
352
353                entries.forEach(function (entry) {
354
355                    if (entry.isIntersecting) {
356                        that.$el.addClass('active').addClass('el-in-view');
357                        that.$el.find(that.bgElSelector).css('visibility', 'visible');
358                        that.activeViewRAF = true;
359                    } else {
360                        that.$el.find(that.bgElSelector).css('visibility', 'hidden');
361                        that.activeViewRAF = false;
362                        that.$el.removeClass('el-in-view');
363
364                        if ($('.el-in-view').length == 0) {
365                            if (that.$dragEl.length > 0) {
366                                that.$dragEl.removeClass('visible');
367                            } else if (that.$viewEl.length > 0) {
368                                that.$viewEl.removeClass('visible');
369                            }
370                        }
371
372                    }
373                });
374
375            }, options);
376
377            this.observer.observe(this.$el[0]);
378
379
380        }
381
382    };
383
384    NectarIconMouseFollow.prototype.createMarkup = function () {
385
386        var that = this;
387
388        // Style BG icon flag.
389        if (this.iconType === 'view-indicator' || this.iconType === 'horizontal-movement') {
390
391            if (this.$el.is('[data-indicator-bg]')) {
392                this.styleType = 'solid';
393            }
394
395            if (this.$el.is('[data-indicator-style]') && this.$el.attr('data-indicator-style') !== 'solid_bg') {
396                this.styleType = this.$el.attr('data-indicator-style');
397            }
398        }
399
400        // Tooltip removes parallax.
401        if (this.styleType === 'tooltip_text' || $('[data-indicator-style="tooltip_text"]').length > 0) {
402            this.parallaxLerp = false;
403            this.lerpDamp = 0.24;
404        }
405
406        if (this.iconType === 'horizontal-movement') {
407
408            if ($('.nectar-drag-indicator').length == 0) {
409                var $usingBoxedClass = ($('body > #boxed').length > 0) ? ' in-boxed' : '';
410
411                $('body').append('<div class="nectar-drag-indicator' + $usingBoxedClass + '" data-type="' + this.styleType + '"><div class="color-circle"></div><span class="inner-layer">' + this.arrowMarkup + '</span></div>');
412                this.$dragEl = $('.nectar-drag-indicator');
413                this.dragRAF();
414            } else {
415                this.$dragEl = $('.nectar-drag-indicator');
416            }
417
418
419            if (this.styleType != 'default') {
420                this.$innerParallaxEl = $('.nectar-drag-indicator .inner-layer');
421            }
422
423        }
424
425        if (this.iconType === 'view-indicator' ||
426            this.iconType === 'link-indicator') {
427
428            this.activeViewRAF = true;
429
430            if ($('.nectar-view-indicator').length == 0) {
431
432                var $usingBoxedClass = ($('body > #boxed').length > 0) ? ' in-boxed' : '';
433                $('body').append('<div class="nectar-view-indicator' + $usingBoxedClass + '"><div class="color-circle"></div><span class="inner-layer"></span></div>');
434
435                if (this.iconType !== 'gallery-zoom-indicator') {
436                    $('.nectar-view-indicator span').text($('.nectar-post-grid[data-indicator-text]').attr('data-indicator-text'));
437                }
438                this.$viewEl = $('.nectar-view-indicator');
439
440                // initial calc.
441                setTimeout(function () {
442
443                    that.lastY = nectarDOMInfo.clientY;
444                    that.lastX = nectarDOMInfo.clientX;
445
446                    that.viewRAF();
447
448                }, 100);
449
450            } else {
451                this.$viewEl = $('.nectar-view-indicator');
452            }
453
454            this.$innerParallaxEl = $('.nectar-view-indicator .inner-layer');
455
456        }
457
458        if (this.iconType === 'close-indicator') {
459            if ($('.nectar-view-indicator').length == 0) {
460                var $usingBoxedClass = ($('body > #boxed').length > 0) ? ' in-boxed' : '';
461                $('body').append('<div class="nectar-close-indicator' + $usingBoxedClass + '"><div class="inner"><div class="inner-layer"><i class="icon-salient-m-close"></i></div></div></div>');
462                this.$closeEl = $('.nectar-close-indicator');
463                this.closeRAF();
464            } else {
465                this.$closeEl = $('.nectar-close-indicator');
466            }
467
468            this.$innerParallaxEl = $('.nectar-close-indicator .inner-layer');
469
470        }
471
472        if (this.iconType === 'post-grid-images') {
473
474            this.activeViewRAF = true;
475
476            this.bgElSelector = (!this.$el.hasClass('nectar-category-grid')) ? '.nectar-post-grid-item-bg-wrap' : '.nectar-category-grid-item-bg';
477
478            if (!this.$el.hasClass('mouse-move-bound')) {
479                this.$viewEl = this.$el.find(this.bgElSelector);
480                this.$el.addClass('mouse-move-bound');
481                this.viewRAF();
482            } else {
483                this.$viewEl = this.$el.find(this.bgElSelector);
484                this.viewRAF();
485            }
486
487        }
488
489    }
490
491
492    NectarIconMouseFollow.prototype.mouseBind = function () {
493
494        var that = this;
495
496        if (this.iconType === 'horizontal-movement') {
497
498            // Blurred class.
499            if (that.$el.is('[data-indicator-blur="true"]')) {
500                that.$dragEl.addClass('blurred-bg');
501            }
502
503            that.$el.find('.flickity-viewport').on('mouseenter', function () {
504                that.$dragEl.attr('data-type', that.styleType);
505                that.$dragEl.addClass('visible');
506
507                // text
508                if (that.styleType === 'tooltip_text' && that.$el.is('[data-indicator-text]')) {
509                    that.$dragEl.find('span').text(that.$el.attr('data-indicator-text'));
510                } else {
511                    that.$dragEl.find('span').html(that.arrowMarkup);
512                }
513
514                var $iconColor = (that.$el.is('[data-touch-icon-color]')) ? 'color-' + that.$el.attr('data-touch-icon-color') : '';
515                that.$dragEl.removeClass('color-dark').removeClass('color-light').removeClass('color-default');
516
517                if (that.styleType == 'default') {
518                    that.$dragEl.addClass($iconColor);
519                    that.$dragEl.find('> span, i').css('color', '');
520                    that.$dragEl.find('.color-circle').css('background-color', '');
521                } else if (that.styleType == 'solid') {
522                    var indicator_bg_color = that.$el.attr('data-indicator-bg');
523                    that.$dragEl.find('.color-circle').css('background-color', indicator_bg_color);
524                    that.$dragEl.find('> span').css('color', indicator_bg_color);
525
526                    var indicator_icon_color = that.$el.attr('data-indicator-icon');
527                    that.$dragEl.find('i').css('color', indicator_icon_color);
528                } else if (that.styleType == 'tooltip_text') {
529                    var indicator_bg_color = that.$el.attr('data-indicator-bg');
530                    that.$dragEl.find('.color-circle').css('background-color', indicator_bg_color);
531                    var indicator_icon_color = that.$el.attr('data-indicator-icon');
532                    that.$dragEl.find('span').css('color', indicator_icon_color);
533                }
534
535            });
536
537            that.$el.find('.flickity-viewport').on('mouseleave', function () {
538                that.$dragEl.removeClass('visible');
539            });
540
541
542            // Handle product links.
543            that.$el.find('.product-add-to-cart a, .hide-nectar-indicator, .hide-nectar-indicator a').on('mouseenter', function () {
544                that.$dragEl.removeClass('visible');
545            });
546            that.$el.find('.product-add-to-cart a, .hide-nectar-indicator, .hide-nectar-indicator a').on('mouseleave', function () {
547                that.$dragEl.addClass('visible');
548            });
549
550            // Handle category/author links.
551            that.$el.find('.nectar-post-grid-item .meta-category a, .nectar-post-grid-item .meta-author a').on('mouseenter', function () {
552                that.$dragEl.removeClass('visible');
553            });
554            that.$el.find('.nectar-post-grid-item .meta-category a, .nectar-post-grid-item .meta-author a').on('mouseleave', function () {
555                that.$dragEl.addClass('visible');
556            });
557
558
559        } else if (this.iconType === 'close-indicator') {
560
561            $('body').on('click', '.team-member[data-style*="bio_fullscreen"]', function () {
562
563                if ($('.nectar_team_member_overlay:not(.open)').length > 0) {
564                    return;
565                }
566
567                that.$closeEl.addClass('visible');
568                that.$closeEl.find('.inner').addClass('visible');
569            });
570
571            $('body').on('click', '.nectar_team_member_overlay:not(.animating) a[target="_blank"]', function (e) {
572                e.stopPropagation();
573            });
574
575            $('body').on('click', '.nectar_team_member_overlay:not(.animating)', function () {
576                that.$closeEl.removeClass('visible');
577                that.$closeEl.find('.inner').removeClass('visible');
578            });
579
580            // Handle links.
581            $('body').on('mouseenter', '.nectar_team_member_overlay .bio-inner a', function () {
582                that.$closeEl.removeClass('visible');
583            });
584            $('body').on('mouseleave', '.nectar_team_member_overlay .bio-inner a', function () {
585                that.$closeEl.addClass('visible');
586            });
587
588        } else if (this.iconType === 'link-indicator') {
589
590            that.$el.off();
591
592            that.$el.on('mouseenter', function () {
593                that.$viewEl.addClass('visible');
594                that.$viewEl.attr('class', function (i, c) {
595                    return c.replace(/(^|\s)style-\S+/g, '');
596                });
597
598                // Coloring.
599                var indicator_bg_color = that.$el.attr('data-indicator-bg');
600                var indicator_icon_color = that.$el.attr('data-indicator-icon');
601
602                that.$viewEl.find('.color-circle').css('background-color', indicator_bg_color);
603
604                // Icon.
605                var arrowMarkup = '<div class="nectar-cta loaded" data-style="arrow-animation"><span class="link_wrap" style="color: ' + indicator_icon_color + '"><svg class="next-arrow" role="presentation" width="20px" height="25px" viewBox="0 0 50 80"><polyline stroke-width="9" fill="none" stroke-linecap="round" stroke-linejoin="round" points="0, 0 45, 40 0, 80"></polyline></svg><span class="line" role="none" style="background-color: ' + indicator_icon_color + '"></span></span></div>';
606                that.$viewEl.find('span').html(arrowMarkup);
607
608                // Blurred class.
609                if (that.$el.is('[data-indicator-blur="true"]')) {
610                    that.$viewEl.addClass('blurred-bg');
611                }
612
613            });
614            that.$el.on('mouseleave', function () {
615                that.$viewEl.removeClass('visible').removeClass('blurred-bg');
616            });
617
618        } else if (this.iconType === 'view-indicator') {
619
620            var $text_color = (that.$el.is('[data-indicator-text-color]')) ? that.$el.attr('data-indicator-text-color') : '#fff';
621            var $color = that.$el.attr('data-indicator-color');
622            var $style = that.$el.attr('data-indicator-style');
623            var $text = that.$el.attr('data-indicator-text');
624
625            var elSelector = that.$el.find('.nectar-post-grid-item');
626            if (that.$el.is('a')) {
627                elSelector = that.$el;
628            }
629
630            // unbind first.
631            elSelector.off();
632
633            elSelector.on('mouseenter', function () {
634                that.activeViewRAF = true;
635                that.$viewEl.addClass('visible');
636                that.$viewEl.find('span').text($text);
637
638                // Handle style class.
639                that.$viewEl.attr('class', function (i, c) {
640                    return c.replace(/(^|\s)style-\S+/g, '');
641                });
642                that.$viewEl.addClass('style-' + $style);
643                if ($style !== 'see-through') {
644                    that.$viewEl.find('.color-circle').css('background-color', $color);
645                    that.$viewEl.find('.inner-layer').css('color', $text_color);
646                }
647
648                // Blurred class.
649                if (that.$el.is('[data-indicator-blur="true"]')) {
650                    that.$viewEl.addClass('blurred-bg');
651                }
652
653                clearTimeout(that.timeout);
654            });
655
656            elSelector.on('mouseleave', function () {
657
658                if (that.$el.is('a')) {
659                    that.$viewEl.removeClass('visible');
660                    that.$viewEl.removeClass('blurred-bg');
661                } else {
662                    that.timeout = setTimeout(function () {
663                        that.$viewEl.removeClass('visible');
664                        that.$viewEl.removeClass('blurred-bg');
665                    }, 100);
666                }
667
668
669            });
670
671            // Handle category/author links.
672            that.$el.find('.nectar-post-grid-item .meta-category a, .nectar-post-grid-item .meta-author a').on('mouseenter', function () {
673                that.$viewEl.removeClass('visible');
674            });
675            that.$el.find('.nectar-post-grid-item .meta-category a, .nectar-post-grid-item .meta-author a').on('mouseleave', function () {
676                that.$viewEl.addClass('visible');
677            });
678
679        } else if (this.iconType === 'post-grid-images') {
680            that.$el.on('mouseenter', function () {
681                $(this).addClass('mouse-over');
682                that.activeViewRAF = true;
683            });
684            that.$el.on('mouseleave', function () {
685                $(this).removeClass('mouse-over');
686            });
687        }
688
689    };
690
691    NectarIconMouseFollow.prototype.updatePos = function () {
692        this.lastY = linearInterpolate(this.lastY, nectarDOMInfo.clientY, this.lerpDamp);
693        this.lastX = linearInterpolate(this.lastX, nectarDOMInfo.clientX, this.lerpDamp);
694    }
695
696    NectarIconMouseFollow.prototype.parallaxIcon = function () {
697
698        this.parallaxLastX = linearInterpolate(this.parallaxLastX, parseInt(nectarDOMInfo.clientX) - parseInt(this.lastX), this.lerpDamp) / 1.65;
699        this.parallaxLastY = linearInterpolate(this.parallaxLastY, parseInt(nectarDOMInfo.clientY) - parseInt(this.lastY), this.lerpDamp) / 1.65;
700
701        if (this.$innerParallaxEl.length > 0) {
702            this.$innerParallaxEl[0].style.transform = 'translateX(' + clamp(this.parallaxLastX, 12, -12) + 'px) translateY(' + clamp(this.parallaxLastY, 12, -12) + 'px)';
703        }
704
705    }
706
707    NectarIconMouseFollow.prototype.dragRAF = function () {
708
709        this.updatePos();
710
711        this.$dragEl[0].style.transform = 'translateX(' + this.lastX + 'px) translateY(' + this.lastY + 'px)';
712
713        if (this.parallaxLerp) {
714            this.parallaxIcon();
715        }
716
717        requestAnimationFrame(this.dragRAF.bind(this));
718
719
720    };
721
722    NectarIconMouseFollow.prototype.viewRAF = function () {
723
724        this.updatePos();
725
726        if (this.activeViewRAF || this.iconType === 'view-indicator' || this.iconType === 'link-indicator') {
727
728            for (var i = 0; i < this.$viewEl.length; i++) {
729                this.$viewEl[i].style.transform = 'translateX(' + this.lastX + 'px) translateY(' + this.lastY + 'px)';
730            }
731
732            if (this.parallaxLerp) {
733                this.parallaxIcon();
734            }
735
736        }
737
738        requestAnimationFrame(this.viewRAF.bind(this));
739
740    };
741
742    NectarIconMouseFollow.prototype.closeRAF = function () {
743
744        this.updatePos();
745
746        this.$closeEl.css({
747            'transform': 'translateX(' + this.lastX + 'px) translateY(' + this.lastY + 'px)'
748        });
749
750        this.parallaxIcon();
751
752        requestAnimationFrame(this.closeRAF.bind(this));
753
754    };
755
756
757    /**
758     * Flickity lazy image helper
759     *
760     * Needed to calculate the space which
761     * lazy loaded images will eventually occupy.
762     *
763     * @since 11.0
764     */
765    function flickityLazyCalcs() {
766
767        $('.wpb_gallery_slidesflickity_static_height_style .cell[data-lazy="true"]').each(function () {
768
769            $(this).css({
770                'height': '',
771                'width': ''
772            });
773
774            var heightAttr = parseInt($(this).find('img').attr('height'));
775            var widthAttr = parseInt($(this).find('img').attr('width'));
776
777            var dimensions = calculateAspectRatio(widthAttr, heightAttr, 2000, parseInt($(this).find('img').height()));
778            var captionHeight = ($(this).find('.item-meta').length > 0) ? $(this).find('.item-meta').outerHeight() : 0;
779
780            $(this).css({
781                'height': (dimensions.height + captionHeight) + 'px',
782                'width': dimensions.width + 'px'
783            });
784
785        });
786
787    }
788
789
790    /**
791     * Flickity lazy initialization.
792     *
793     * @since 11.0
794     */
795    function flickityLazyInit() {
796        // Lazy assist.
797        if ($('.wpb_gallery_slidesflickity_static_height_style .cell[data-lazy="true"]').length > 0) {
798            flickityLazyCalcs();
799            $window.on('smartresize', flickityLazyCalcs);
800        }
801    }
802
803
804    /**
805     * Flickity plugin initialization.
806     *
807     * @since 7.0
808     */
809
810    function flickityInit() {
811
812        if ($('.nectar-flickity:not(.masonry)').length == 0) {
813            return false;
814        }
815
816        $flickitySliders = [];
817        flickityDragArr = [];
818
819        // Create instances
820        $('.nectar-flickity:not(.masonry)').each(function (index) {
821            $flickitySliders.push(new NectarFlickity($(this), index));
822        });
823
824
825        // Resize event.
826        var $usingNectarCarouselFlk = ($('.nectar-carousel.nectar-flickity:not(.masonry)').length > 0) ? true : false;
827        if ($usingNectarCarouselFlk) {
828
829            if (!nectarDOMInfo.usingMobileBrowser) {
830                $window.on('resize', setNectarCarouselFlkEH);
831            } else {
832                window.addEventListener("orientationchange", setNectarCarouselFlkEH);
833            }
834
835        }
836
837
838    }
839
840    function NectarFlickity(el, index) {
841
842        this.$el = el;
843        this.index = index;
844        this.instance = {};
845
846        // Defaults.
847        this.$freeScrollBool = (this.$el.is('[data-free-scroll]') && this.$el.attr('data-free-scroll') == 'true') ? true : false,
848            this.$groupCellsBool = true,
849            this.$flickContainBool = true,
850            this.$flcikAttr = 0.025,
851            this.$paginationBool = false,
852            this.$nextPrevArrowBool = true,
853            this.$setGallerySizeBool = true,
854            this.$imagesLoaded = true,
855            this.$flickCellAlign = 'center',
856            this.fadeBool = false;
857
858        this.setup();
859
860    }
861
862    NectarFlickity.prototype.setup = function () {
863
864        // Add instance classname.
865        this.$el.removeClass(function (index, className) {
866            return (className.match(/(^|\s)instance-\S+/g) || []).join(' ');
867        });
868        this.$el.addClass('instance-' + this.index);
869
870        var sliderControls = (this.$el.attr('data-controls').length > 0) ? this.$el.attr('data-controls') : '';
871
872        // Fixes horizontal overflow issues
873        this.fullWidthOverlow();
874
875        // Fixed Text Style.
876        if (this.$el.is('[data-format="fixed_text_content_fullwidth"]')) {
877
878            this.$flickCellAlign = 'left';
879            this.$groupCellsBool = false;
880            this.$flickContainBool = false;
881            this.$flcikAttr = 0.02;
882
883            if (this.$el.parent().is('[data-alignment="right"]')) {
884                this.$flickCellAlign = 'right';
885            }
886
887        }
888
889        if (this.$freeScrollBool == true) {
890            this.$groupCellsBool = false;
891        }
892
893        if (this.$el.find('.nectar-el-parallax-scroll').length > 0 &&
894            this.$el.parents('[class*="wpb_gallery_slidesflickity_"]').length > 0) {
895            this.$groupCellsBool = false;
896        }
897
898
899        // Controls.
900        if (sliderControls == 'next_prev_arrows' ||
901            sliderControls == 'next_prev_arrows_overlaid') {
902            this.$paginationBool = false;
903            this.$nextPrevArrowBool = true;
904        } else {
905            this.$paginationBool = true;
906            this.$nextPrevArrowBool = false;
907        }
908
909
910        if (sliderControls == 'none') {
911            this.$paginationBool = false;
912            this.$nextPrevArrowBool = false;
913        }
914
915        this.$wrapAround = (this.$el.is('[data-wrap]') && this.$el.attr('data-wrap') == 'no-wrap') ? false : true;
916
917        this.ticker = (this.$el.is('.ticker-rotate')) ? true : false;
918        this.tickerPaused = false;
919        if (this.ticker) {
920            var tickerSpeed = (this.$el.is('[data-ticker-speed]')) ? this.$el.attr('data-ticker-speed') : 'slow';
921            var tickerDirection = (this.$el.is('[data-ticker-direction]')) ? this.$el.attr('data-ticker-direction') : 'default';
922
923            if ('slow' === tickerSpeed) {
924                this.tickerSpeed = 0.4;
925            } else if ('medium' === tickerSpeed) {
926                this.tickerSpeed = 1.2;
927            } else {
928                this.tickerSpeed = 2;
929            }
930
931            if (tickerDirection === 'reverse') {
932                this.tickerSpeed = this.tickerSpeed * -1;
933            }
934
935            this.$wrapAround = true;
936            this.$paginationBool = false;
937        }
938        this.$flickity_autoplay = false;
939        this.$flickity_stored_autoplay = false;
940        this.inView = false;
941
942        if (this.$el.is('[data-autoplay]') && this.$el.attr('data-autoplay') == 'true' && !this.ticker) {
943
944            this.$flickity_autoplay = true;
945            this.$flickity_stored_autoplay = 5000;
946
947            if (this.$el.is('[data-autoplay-dur]') && this.$el.attr('data-autoplay-dur').length > 0) {
948
949                if (parseInt(this.$el.attr('data-autoplay-dur')) > 100 &&
950                    parseInt(this.$el.attr('data-autoplay-dur')) < 30000) {
951                    this.$flickity_autoplay = parseInt(this.$el.attr('data-autoplay-dur'));
952                    this.$flickity_stored_autoplay = this.$flickity_autoplay;
953                }
954
955            }
956
957        }
958
959        this.$frontEndEditorDrag = ($('body.vc_editor').length > 0) ? false : true;
960        this.$frontEndEditorPause = ($('body.vc_editor').length > 0) ? true : false;
961        this.$arrowShape = '';
962
963        // Pause on hover.
964        if (this.$el.is('[data-pause-on-hover="true"]')) {
965            this.$frontEndEditorPause = true;
966        }
967
968        // Centered cells.
969        if (this.$el.is('[data-centered-cells="true"]')) {
970            this.$groupCellsBool = false;
971        }
972
973        // Adaptive height.
974        this.$flickity_adaptive_height = false;
975        if (this.$el.is('[data-adaptive-height="true"]')) {
976            this.$flickity_adaptive_height = true;
977        }
978
979        // Lazy load.
980        this.$lazyload = (this.$el.find('img[data-flickity-lazyload]').length > 0) ? 1 : false;
981        if (this.$el.find('img[data-flickity-lazyload]').length > 0 &&
982            this.$el.is('[data-overflow="visible"]') &&
983            this.$el.is('[data-wrap="no-wrap"]')) {
984            this.$lazyload = 2;
985        }
986
987        // RTL.
988        this.$flickity_rtl = ($body.hasClass('rtl')) ? true : false;
989
990        // Arrow shape.
991        if (sliderControls == 'next_prev_arrows_overlaid' ||
992            sliderControls == 'touch_total' ||
993            this.$el.hasClass('nectar-simple-slider')) {
994
995            this.$arrowShape = {
996                x0: 10,
997                x1: 60, y1: 50,
998                x2: 70, y2: 40,
999                x3: 30
1000            }
1001        } else {
1002            this.$arrowShape = {
1003                x0: 20,
1004                x1: 70,
1005                y1: 30,
1006                x2: 70,
1007                y2: 25,
1008                x3: 70
1009            }
1010        }
1011
1012        if (this.$el.is('[data-format="fixed_text_content_fullwidth"]') &&
1013            this.$el.parents('.full-width-content.wpb_row').length > 0) {
1014            this.$el.parents('.full-width-content.wpb_row')
1015                .removeClass('full-width-content')
1016                .addClass('full-width-section');
1017        }
1018
1019        //// Nectar Simple Slider
1020        if (this.$el.hasClass('nectar-simple-slider')) {
1021
1022            this.$flickity_adaptive_height = false;
1023            this.$paginationBool = false;
1024            this.$nextPrevArrowBool = false;
1025            this.$setGallerySizeBool = false;
1026            this.$wrapAround = false;
1027            this.$imagesLoaded = false;
1028            this.$flcikAttr = 0.022;
1029
1030            if (this.$el.attr('data-pagination') == 'true') {
1031                this.$paginationBool = true;
1032            }
1033
1034            if (this.$el.attr('data-wrap') == 'true') {
1035                this.$wrapAround = true;
1036            }
1037
1038            if (this.$el.is('[data-simple-slider-transition="fade"]')) {
1039                this.fadeBool = true;
1040            }
1041
1042        }
1043
1044
1045        var inHiddenSection = (this.$el.parents('.toggle').length > 0) ? true : false;
1046
1047        // Markup.
1048        if (typeof window.nectarFlickityActive === 'undefined') {
1049            // Third-party flickity plugin in use, remove extra markup.
1050            var $viewport = this.$el.find('.flickity-viewport');
1051            var $slider = $viewport.find('.flickity-slider');
1052
1053            // Move slider contents directly into the element
1054            $slider.children().appendTo(this.$el);
1055
1056            // Remove flickity markup
1057            $slider.remove();
1058            $viewport.remove();
1059        }
1060
1061        // Init.
1062        if (!nectarDOMInfo.usingFrontEndEditor &&
1063            !isInstagram() &&
1064            'IntersectionObserver' in window &&
1065            !inHiddenSection &&
1066            $nectarFullPage.$usingFullScreenRows === false) {
1067            this.lazyInit();
1068        } else {
1069            this.init();
1070        }
1071
1072    };
1073
1074    NectarFlickity.prototype.lazyInit = function () {
1075
1076        var that = this;
1077        this.observer = new IntersectionObserver(function (entries) {
1078
1079            entries.forEach(function (entry) {
1080                if (entry.isIntersecting) {
1081                    that.init();
1082                    that.observer.unobserve(entry.target);
1083                }
1084            });
1085
1086        }, {
1087            root: (isSafari()) ? null : document,
1088            rootMargin: '350px 0px 350px 0px',
1089            threshold: 0
1090        });
1091
1092        this.observer.observe(this.$el[0]);
1093
1094    }
1095
1096    NectarFlickity.prototype.init = function () {
1097
1098        // Initialize instance
1099        this.instance = new Flickity('.nectar-flickity.instance-' + this.index, {
1100            setGallerySize: this.$setGallerySizeBool,
1101            contain: this.$flickContainBool,
1102            draggable: this.$frontEndEditorDrag,
1103            lazyLoad: this.$lazyload,
1104            imagesLoaded: this.$imagesLoaded,
1105            percentPosition: true,
1106            adaptiveHeight: this.$flickity_adaptive_height,
1107            cellAlign: this.$flickCellAlign,
1108            groupCells: this.$groupCellsBool,
1109            prevNextButtons: this.$nextPrevArrowBool,
1110            freeScroll: this.$freeScrollBool,
1111            pageDots: this.$paginationBool,
1112            resize: true,
1113            selectedAttraction: this.$flcikAttr,
1114            autoPlay: this.$flickity_autoplay,
1115            rightToLeft: this.$flickity_rtl,
1116            pauseAutoPlayOnHover: this.$frontEndEditorPause,
1117            wrapAround: this.$wrapAround,
1118            accessibility: false,
1119            fade: this.fadeBool,
1120            dragThreshold: nectarDOMInfo.usingMobileBrowser ? 25 : 3,
1121            arrowShape: this.$arrowShape
1122        });
1123
1124        // Initialize events.
1125        this.events();
1126    }
1127
1128
1129    NectarFlickity.prototype.trackView = function () {
1130        var that = this;
1131        var track = new IntersectionObserver(function (entries) {
1132
1133            entries.forEach(function (entry) {
1134                if (entry.isIntersecting) {
1135                    that.inView = true;
1136                } else {
1137                    that.inView = false;
1138                }
1139            });
1140
1141        }, {
1142            root: (isSafari()) ? null : document,
1143            rootMargin: '200px 0px 200px 0px',
1144            threshold: 0
1145        });
1146
1147        track.observe(this.$el[0]);
1148    };
1149
1150    NectarFlickity.prototype.fullWidthOverlow = function () {
1151
1152        if (this.$el.is('[data-overflow="visible"]') &&
1153            this.$el.parents('.wpb_column:not(.vc_col-sm-12)').length == 0) {
1154
1155            // Regular non full width rows
1156            if (this.$el.parents('.wpb_row:not(.nectar-overflow-hidden):not(.full-width-content):not(.inner_row):not(.has-global-section)').length > 0) {
1157                this.$el.wrap('<div class="wpb_row vc_row-fluid vc_row full-width-content nectar-overflow-hidden carousel-dynamic-wrapper"><div class="normal-container container"></div></div>');
1158            } else if (this.$el.parents('.wpb_row.full-width-content:not(.nectar-overflow-hidden)').length > 0) {
1159                // parent is already full width and just needs a hidden overflow
1160                this.$el.parents('.wpb_row.full-width-content:not(.nectar-overflow-hidden)').addClass('nectar-overflow-hidden');
1161            }
1162
1163        }
1164    };
1165
1166    NectarFlickity.prototype.events = function () {
1167
1168        //// Carousel Specific Styles.
1169        // Simple Slider.
1170        if (this.$el.hasClass('nectar-simple-slider')) {
1171            this.simpleSliderStyle();
1172        }
1173
1174        // Fancybox/Image Gallery Parallax.
1175        else if (this.$el.is('.nectar-carousel[data-wrap="no-wrap"]') &&
1176            this.$el.find('.nectar-fancy-box[data-n-parallax-bg="true"]').length > 0 && this.$groupCellsBool !== true ||
1177            this.$el.parents('[class*="wpb_gallery_slidesflickity_"]').length > 0 &&
1178            this.$el.find('.nectar-el-parallax-scroll').length > 0) {
1179
1180            this.galleryParallax();
1181        }
1182
1183        if (this.$el.is('[data-controls="touch_total"]') ||
1184            this.$el.is('[data-touch-indicator="true"]')) {
1185            this.visualizedTotalControls();
1186        }
1187
1188        if (this.$el.is('[data-format="fixed_text_content_fullwidth"]') &&
1189            !nectarDOMInfo.usingFrontEndEditor) {
1190            this.fixedContentStyle();
1191        }
1192
1193        if (this.$el.parents('.wpb_gallery_slidesflickity_static_height_style').length > 0 &&
1194            this.$el.find('.item-meta').length > 0) {
1195            this.imageCaptionWidth();
1196            $window.on('resize', this.imageCaptionWidth.bind(this));
1197        }
1198
1199        // Ticker.
1200        if (this.ticker) {
1201            if ('IntersectionObserver' in window) {
1202                this.trackView();
1203            }
1204
1205            this.tickerRotate();
1206
1207            this.instance.on('dragStart', function () {
1208                this.tickerPaused = true;
1209            }.bind(this));
1210
1211            this.$el[0].addEventListener('mouseleave', function () {
1212                this.tickerPaused = false;
1213            }.bind(this));
1214
1215            if (this.$el.is('[data-pause-on-hover="true"]') || this.$nextPrevArrowBool || nectarDOMInfo.usingFrontEndEditor) {
1216                this.$el[0].addEventListener('mouseenter', function () {
1217                    this.tickerPaused = true;
1218                }.bind(this));
1219            }
1220        }
1221
1222        // Shared events.
1223        this.sharedEvents();
1224    }
1225
1226
1227    NectarFlickity.prototype.sharedEvents = function () {
1228
1229        var pointer = this;
1230        var $removeHiddenTimeout;
1231        var $removeMovingTimeout;
1232        var $that = this.$el;
1233        var flickityInstance = this.instance;
1234
1235        this.instance.on('dragStart', function () {
1236
1237            clearTimeout($removeHiddenTimeout);
1238            clearTimeout($removeMovingTimeout);
1239            $that.addClass('is-dragging');
1240            $that.addClass('is-moving');
1241
1242            $that.find('.flickity-prev-next-button').addClass('hidden');
1243        });
1244
1245        this.instance.on('dragEnd', function () {
1246
1247            $that.removeClass('is-dragging');
1248
1249            $removeHiddenTimeout = setTimeout(function () {
1250
1251                $that.removeClass('is-moving');
1252                $that.find('.flickity-prev-next-button').removeClass('hidden');
1253
1254            }, 600);
1255
1256            $removeMovingTimeout = setTimeout(function () {
1257                $that.removeClass('is-moving');
1258            }, 300);
1259
1260        });
1261
1262        $('.flickity-prev-next-button').on('click', function () {
1263
1264            clearTimeout($removeHiddenTimeout);
1265
1266            $(this).parents('.nectar-flickity')
1267                .find('.flickity-prev-next-button')
1268                .addClass('hidden');
1269
1270            $removeHiddenTimeout = setTimeout(function () {
1271                $that
1272                    .find('.flickity-prev-next-button')
1273                    .removeClass('hidden');
1274            }, 600);
1275
1276        });
1277
1278        // Workaround for single column grouping first buttons not triggering change.
1279        this.instance.$element.find('.flickity-prev-next-button').on('click', function () {
1280
1281            if (pointer.$groupCellsBool !== true) {
1282
1283                var slideWidth = flickityInstance.selectedSlide.outerWidth;
1284                var sliderWidth = flickityInstance.size.innerWidth;
1285                var slidePercentage = Math.floor(sliderWidth / slideWidth);
1286
1287                if ($(this).hasClass('next')) {
1288
1289                    if (flickityInstance.selectedIndex === 1 && slidePercentage > 1) {
1290                        if (slidePercentage === 2 || slidePercentage === 3) {
1291                            flickityInstance.select(2);
1292                        } else if (slidePercentage > 3) {
1293                            flickityInstance.select(3);
1294                        }
1295
1296                    }
1297                }
1298
1299            }
1300
1301
1302        });
1303
1304
1305        // Transition.
1306        // This should be delayed slightly to avoid initial calcs from flickity getting animated.
1307        setTimeout(function () {
1308            $('.nectar-post-grid.nectar-flickity[data-wrap="no-wrap"], .nectar-flickity.nectar-carou
1308sel[data-format="default"][data-wrap="no-wrap"]').addClass('transition-enabled');
1309        }, 200);
1310
1311
1312        // Images loaded.
1313        if ($that.hasClass('nectar-carousel') && !$that.is('[data-adaptive-height="true"]')) {
1314            imagesLoaded($that, function () {
1315                nectarCarouselFlkEH($that);
1316            });
1317        }
1318    };
1319
1320    NectarFlickity.prototype.tickerRotate = function () {
1321        if (!this.tickerPaused && this.inView == true) {
1322            if (this.instance.slides) {
1323                this.instance.x = (this.instance.x - this.tickerSpeed) % this.instance.slideableWidth;
1324                this.instance.selectedIndex = this.instance.dragEndRestingSelect();
1325                //this.instance.updateSelectedSlide();
1326                this.instance.settle(this.instance.x);
1327            }
1328        }
1329        window.requestAnimationFrame(this.tickerRotate.bind(this));
1330    };
1331
1332    NectarFlickity.prototype.imageCaptionWidth = function () {
1333
1334        this.$el.find('.item-meta').each(function () {
1335            $(this).css({
1336                'width': $(this).parent().find('img').width()
1337            });
1338        });
1339
1340    };
1341
1342    NectarFlickity.prototype.simpleSlideBGConnection = function () {
1343
1344        var $activeCell = ($('body.vc_editor').length > 0) ? $that.find('.is-selected > .cell') : $that.find('.is-selected');
1345
1346        if (this.$rowBG && $activeCell) {
1347            this.$rowBG.css({
1348                'transition': 'background-color 0.5s ease-out',
1349                'background-color': ($activeCell.is('.has-bg-color')) ? $activeCell.find('.bg-layer-wrap').css('background-color') : this.$rowBGStored
1350            });
1351        }
1352
1353    };
1354
1355
1356    NectarFlickity.prototype.simpleSliderStyle = function () {
1357
1358        var $that = this.$el;
1359        var that = this;
1360
1361        //// Simple Slider Arrows
1362        if (this.$el.attr('data-arrows') == 'true') {
1363
1364            if (this.$el.find('.flickity-prev-next-button').length == 0) {
1365
1366                this.$el.append('<button class="flickity-button flickity-prev-next-button previous" aria-label="' + nectar_front_i18n.previous + '" type="button"><svg class="flickity-button-icon" viewBox="0 0 100 100"><path d="M 10,50 L 60,100 L 70,90 L 30,50  L 70,10 L 60,0 Z" class="arrow"></path></svg></button>');
1367                this.$el.append('<button class="flickity-button flickity-prev-next-button next" aria-label="' + nectar_front_i18n.next + '" type="button"><svg class="flickity-button-icon" viewBox="0 0 100 100"><path d="M 10,50 L 60,100 L 70,90 L 30,50  L 70,10 L 60,0 Z" class="arrow" transform="translate(100, 100) rotate(180) "></path></svg></button>');
1368
1369                // Previous.
1370                this.$el.find('.flickity-prev-next-button.previous').on('click', function () {
1371
1372                    if (that.$wrapAround === false &&
1373                        that.instance.selectedIndex == 0 &&
1374                        (that.instance.isAnimating == false || typeof that.instance.isAnimating === 'undefined')) {
1375
1376                        // Nudge.
1377                        var currentX = that.instance.x;
1378                        anime({
1379                            targets: that.instance,
1380                            x: currentX + 100,
1381                            duration: 350,
1382                            easing: 'easeOutCubic'
1383                        });
1384                        that.instance.startAnimation();
1385
1386                    }
1387
1388                    that.instance.previous();
1389                });
1390
1391                // Next.
1392                this.$el.find('.flickity-prev-next-button.next').on('click', function () {
1393
1394                    // Nudge.
1395                    if (that.$wrapAround === false &&
1396                        that.instance.selectedIndex == that.instance.slides.length - 1 &&
1397                        that.instance.isAnimating == false) {
1398
1399                        // Nudge.
1400                        var currentX = that.instance.x;
1401                        anime({
1402                            targets: that.instance,
1403                            x: currentX - 100,
1404                            duration: 350,
1405                            easing: 'easeOutCubic'
1406                        });
1407                        that.instance.startAnimation();
1408
1409                    }
1410
1411                    that.instance.next();
1412                });
1413
1414            }
1415
1416        } // End Simple Slider Arrows.
1417
1418        //// Simple Slider BG Color emit.
1419        this.$rowBG = '';
1420        this.$rowBGStored = '';
1421
1422        if ($(this).is('.nectar-simple-slider[data-row-bg-connection="true"]')) {
1423
1424            this.$rowBG = this.$el.parents('.wpb_row');
1425            this.$rowBG = this.$rowBG.find('> .row-bg-wrap .row-bg');
1426            this.$rowBGStored = (this.$rowBG.length > 0) ? this.$rowBG.css('background-color') : '';
1427
1428            this.instance.on('change', simpleSlideBGConnection.bind(this));
1429            this.simpleSlideBGConnection();
1430
1431        }
1432
1433
1434        //// Simple Slider Lazy Load.
1435        if (this.$el.find('.bg-layer[data-nectar-img-src]').length > 0) {
1436
1437            var waypoint = new Waypoint({
1438                element: this.$el[0],
1439                handler: function () {
1440
1441                    $that.find('.bg-layer[data-nectar-img-src]').each(function () {
1442                        var entry = $(this)[0];
1443                        var imgSrc = entry.getAttribute('data-nectar-img-src');
1444                        entry.style.backgroundImage = "url('" + imgSrc + "')";
1445                        entry.classList.add('loaded');
1446                    });
1447
1448                    waypoint.destroy();
1449                },
1450                offset: '95%'
1451
1452            });
1453
1454        }
1455
1456        //// Simple Slider Parallax
1457        if (this.$el.is('[data-parallax="true"]')) {
1458
1459            var slides = this.$el.find('.cell');
1460
1461            // limit time between slide changes when wrapping.
1462            if (this.$wrapAround === true) {
1463                this.$el.find('.flickity-prev-next-button').on('click', function () {
1464                    $that.addClass('disabled-nav');
1465                    setTimeout(function () {
1466                        $that.removeClass('disabled-nav');
1467                    }, 500);
1468                });
1469            }
1470
1471
1472            // Parallax effect.
1473            var rtlChangeDir = (this.$flickity_rtl) ? 1 : -1;
1474
1475            this.instance.on('scroll', function () {
1476
1477                $.each(that.instance.slides, function (i, slide) {
1478
1479                    var imageBG = slides[i].querySelector('.bg-layer');
1480                    var content = slides[i].querySelector('.inner');
1481
1482                    var flkty = that.instance;
1483                    var x = 0;
1484
1485                    if (0 === i && flkty.slides.length > 2) {
1486                        x = Math.abs(flkty.x) > flkty.slidesWidth ? (flkty.slidesWidth + flkty.x + flkty.slides[flkty.slides.length - 1].outerWidth + slide.target) : (slide.target + flkty.x);
1487                    } else if (i === flkty.slides.length - 1) {
1488                        x = Math.abs(flkty.x) + flkty.slides[i].outerWidth < flkty.slidesWidth ? (slide.target - flkty.slidesWidth + flkty.x - flkty.slides[i].outerWidth) : (slide.target + flkty.x);
1489                    } else {
1490                        x = slide.target + flkty.x;
1491                    }
1492
1493                    imageBG.style.transform = 'translate3d(' + x * (rtlChangeDir / 2) + 'px,0,0)';
1494                    content.style.transform = 'translate3d(' + x * (rtlChangeDir / 4) + 'px,0,0)';
1495
1496                });
1497            });
1498        }
1499
1500        // Simple Slider Pagination
1501        if (this.$el.hasClass('nectar-simple-slider') && true == this.$paginationBool) {
1502
1503            this.$el.find('.flickity-page-dots li').append('<svg width="65px" height="65px" viewBox="0 0 72 72" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><circle class="time" stroke-width="5" fill="none" stroke-linecap="round" cx="33" cy="33" r="28"></circle></svg>');
1504
1505            if (this.$flickity_stored_autoplay) {
1506                this.$el.find('.flickity-page-dots li circle.time').css('transition', 'stroke-dashoffset ' + (parseInt(this.$flickity_stored_autoplay) + 100) + 'ms linear, stroke 0.2s ease');
1507
1508                this.$el.find('.flickity-page-dots li:first').addClass('no-trans');
1509                setTimeout(function () {
1510                    $that.find('.flickity-page-dots li:first').removeClass('no-trans');
1511                }, 60);
1512
1513                this.instance.on('select', function (event) {
1514                    that.instance.playPlayer();
1515                });
1516
1517                this.instance.on('dragEnd', function (event) {
1518                    that.instance.playPlayer();
1519                    $that.find('.flickity-page-dots .is-selected').removeClass('no-trans');
1520                });
1521
1522                this.instance.on('dragStart', function (event) {
1523                    $that.find('.flickity-page-dots .is-selected').addClass('no-trans');
1524                });
1525
1526            }
1527
1528        }
1529
1530    };
1531
1532    NectarFlickity.prototype.galleryParallax = function () {
1533
1534        var slides = this.$el.find('.cell');
1535        var that = this;
1536
1537        var selector = (this.$el.find('.nectar-fancy-box').length > 0) ? '.parallax-layer .box-bg' : '.nectar-el-parallax-scroll .img-wrap';
1538        var looped = (this.$el.is('[data-wrap="wrap"]')) ? true : false;
1539
1540        // parallax effect.
1541        var rtlChangeDir = (this.$flickity_rtl) ? 1 : -1;
1542
1543
1544        this.instance.on('scroll', function () {
1545
1546            $.each(that.instance.slides, function (i, slide) {
1547
1548                var imageBG = slides[i].querySelector(selector);
1549                var flkty = that.instance;
1550                var x = 0;
1551
1552                if (0 === i && looped) {
1553                    x = Math.abs(flkty.x) > flkty.slidesWidth ? (flkty.slidesWidth + flkty.x + flkty.slides[flkty.slides.length - 1].outerWidth + slide.target) : (slide.target + flkty.x);
1554                } else if (1 === i && looped) {
1555                    x = Math.abs(flkty.x) > flkty.slidesWidth ? (flkty.slidesWidth + flkty.x + flkty.slides[flkty.slides.length - 2].outerWidth + slide.target) : (slide.target + flkty.x);
1556                } else if (i === flkty.slides.length - 1 && looped) {
1557                    x = Math.abs(flkty.x) + flkty.slides[i].outerWidth < flkty.slidesWidth ? (slide.target - flkty.slidesWidth + flkty.x - flkty.slides[i].outerWidth) : (slide.target + flkty.x);
1558                } else if (i === flkty.slides.length - 2 && looped) {
1559                    x = Math.abs(flkty.x) + flkty.slides[i].outerWidth + flkty.slides[i + 1].outerWidth < flkty.slidesWidth ? (slide.target - flkty.slidesWidth + flkty.x - flkty.slides[i].outerWidth) : (slide.target + flkty.x);
1560                } else {
1561                    x = slide.target + flkty.x;
1562                }
1563
1564                if (imageBG) {
1565                    imageBG.style.transform = 'translate3d(' + x * (rtlChangeDir / 11) + 'px,0,0)';
1566                    imageBG.style.willChange = 'transform';
1567                }
1568
1569            });
1570
1571        });
1572
1573        this.instance.reposition();
1574
1575    };
1576
1577
1578    NectarFlickity.prototype.visualizedTotalControls = function () {
1579
1580        var $that = this.$el;
1581        var dragIndicatorOnly = (this.$el.hasClass('drag-indicator-only') || this.$el.is('[data-r-bottom-total="true"]') || this.ticker) ? true : false;
1582
1583        // Create markup.
1584        if (this.$el.find('.visualized-total').length == 0 && !dragIndicatorOnly) {
1585            if (this.$el.parents('.full-width-content').length > 0 && this.$el.parents('.vc_col-sm-12').length > 0) {
1586                this.$el.append('<div class="container normal-container"><div class="visualized-total"><span role="none"></span></div></div>');
1587            } else {
1588                this.$el.append('<div class="visualized-total"><span role="none"></span></div>');
1589            }
1590        }
1591
1592
1593        // Init drag indicator.
1594        if (!nectarDOMInfo.usingMobileBrowser) {
1595
1596            flickityDragArr[this.index] = new NectarIconMouseFollow(this.$el, 'horizontal-movement');
1597
1598            this.instance.on('dragMove', function (event, pointer) {
1599                nectarDOMInfo.clientY = pointer.clientY;
1600                nectarDOMInfo.clientX = pointer.clientX;
1601            });
1602
1603            this.instance.on('pointerDown', function (event, pointer) {
1604                $('.nectar-drag-indicator').addClass('pointer-down');
1605            });
1606            this.instance.on('pointerUp', function (event, pointer) {
1607                $('.nectar-drag-indicator').removeClass('pointer-down');
1608            });
1609
1610        }
1611
1612        var $totalImgs = this.$el.find('.flickity-page-dots li').length;
1613        var $totalIndicator = this.$el.find('.visualized-total span');
1614        var $totalPosition = 1;
1615        var $totalWidth = this.$el.find('.visualized-total').width();
1616
1617        if (!dragIndicatorOnly) {
1618
1619            $window.on('smartresize', function () {
1620
1621                setTimeout(function () {
1622
1623                    $totalImgs = $that.find('.flickity-page-dots li').length;
1624                    $totalWidth = $that.find('.visualized-total').width();
1625
1626                    $totalPosition = ($totalWidth / $totalImgs) * $that.find('.flickity-page-dots .is-selected').index();
1627
1628                    // Update pos on interaction.
1629                    $totalIndicator.css('width', 100 / $totalImgs + '%');
1630                    $totalIndicator.css({
1631                        'x': $totalPosition + 'px'
1632                    });
1633
1634                }, 200);
1635
1636            });
1637
1638
1639            // Set initial total tracker width.
1640            setTimeout(function () {
1641
1642                $totalImgs = $that.find('.flickity-page-dots li').length;
1643                $totalWidth = $that.find('.visualized-total').width();
1644
1645                $totalIndicator.css('width', 100 / $totalImgs + '%');
1646
1647            }, 200);
1648
1649            this.instance.on('change', function (event, progress) {
1650
1651                $totalPosition = ($totalWidth / $totalImgs) * $that.find('.flickity-page-dots .is-selected').index();
1652
1653                // Update pos on interaction.
1654                $totalIndicator.css({
1655                    'x': $totalPosition + 'px'
1656                });
1657
1658            });
1659
1660        }
1661
1662
1663    };
1664
1665
1666    NectarFlickity.prototype.fixedContentStyle = function () {
1667
1668        var $onMobileBrowser = nectarDOMInfo.usingMobileBrowser;
1669        var $that = this.$el;
1670        var that = this;
1671
1672        if (this.$flickity_stored_autoplay) {
1673            $(window).on('nectar-material-ocm-open', function () {
1674                that.instance.stopPlayer();
1675            });
1676            $(window).on('nectar-material-ocm-close', function () {
1677                that.instance.playPlayer();
1678            });
1679        }
1680
1681
1682        this.instance.on('scroll', function () {
1683
1684            if ($onMobileBrowser) {
1685                return;
1686            }
1687
1688            if (nectarState.materialOffCanvasOpen == true) {
1689                that.instance.slides.forEach(function (slide, j) {
1690
1691                    var flkInstanceSlide = $that.find('.cell:nth-child(' + (j + 1) + ')');
1692
1693                    flkInstanceSlide.find('.inner-wrap-outer').css({
1694                        'transform': 'perspective(800px) translateX(0) rotateY(0) translateZ(0)',
1695                        'opacity': '1'
1696                    });
1697
1698                    flkInstanceSlide.find('.inner-wrap').css({
1699                        'transform': 'scale(1) translateZ(0)'
1700                    });
1701
1702                });
1703
1704                return;
1705            }
1706
1707            var $flkSlideWidth = $that.find('.cell').outerWidth() + 25,
1708                $leftHeaderSize = ($('body[data-header-format="left-header"]').length > 0 && $window.width() > 1000) ? 275 : 0,
1709                $extraWindowSpace = (($window.width() + $leftHeaderSize) - $that.parents('.main-content').width()) / 2;
1710
1711            $extraWindowSpace += parseInt($that.css('margin-left')) + 2;
1712
1713            that.instance.slides.forEach(function (slide, j) {
1714
1715                var $scaleAmt = 1,
1716                    $translateXAmt = 0,
1717                    $rotateAmt = 0,
1718                    $slideZIndex = 10,
1719                    $opacityAmt = 1,
1720                    $slideOffset = $(slide.cells[0].element).offset().left,
1721                    flkInstanceSlide = $('.nectar-flickity.instance-' + that.index + ' .cell:nth-child(' + (j + 1) + ')');
1722
1723                if ($slideOffset - $extraWindowSpace < 0 &&
1724                    $slideOffset - $extraWindowSpace > $flkSlideWidth * -1) {
1725
1726                    $scaleAmt = 1 + (($slideOffset - $extraWindowSpace) / 1500);
1727                    $opacityAmt = 1 + (($slideOffset - $extraWindowSpace + 70) / 550);
1728                    $translateXAmt = (($slideOffset - $extraWindowSpace)) * -1;
1729                    $rotateAmt = (($slideOffset - $extraWindowSpace) / 25) * -1;
1730
1731                } else {
1732                    $scaleAmt = 1;
1733                    $opacityAmt = 1;
1734                    $translateXAmt = 0;
1735                    $rotateAmt = 0;
1736                }
1737
1738                if ($slideOffset + 5 - $extraWindowSpace < 0 &&
1739                    $slideOffset - $extraWindowSpace > $flkSlideWidth * -1) {
1740
1741                    $slideZIndex = 5;
1742                } else {
1743                    $slideZIndex = 10;
1744                }
1745
1746                flkInstanceSlide.css({
1747                    'z-index': $slideZIndex
1748                });
1749
1750                flkInstanceSlide.find('.inner-wrap-outer').css({
1751                    'transform': 'perspective(800px) translateX(' + $translateXAmt + 'px) rotateY(' + $rotateAmt + 'deg) translateZ(0)',
1752                    'opacity': $opacityAmt
1753                });
1754
1755                flkInstanceSlide.find('.inner-wrap').css({
1756                    'transform': 'scale(' + $scaleAmt + ') translateZ(0)'
1757                });
1758
1759            });
1760
1761        });
1762
1763
1764    };
1765
1766
1767    /**
1768     * Flickity equal height helper.
1769     *
1770     * @since 7.0
1771     */
1772    function setNectarCarouselFlkEH() {
1773
1774        var timeoutDur = (nectarDOMInfo.usingMobileBrowser) ? 200 : 0;
1775        setTimeout(function () {
1776            $('.nectar-carousel.nectar-flickity:not(.masonry):not([data-adaptive-height="true"])').each(function () {
1777                nectarCarouselFlkEH($(this));
1778                var instance = Flickity.data($(this)[0]);
1779                if (instance) {
1780                    instance.resize();
1781                }
1782            });
1783        }, timeoutDur);
1784
1785    }
1786
1787
1788    /**
1789     * Flickity equal height calculations.
1790     *
1791     * @since 7.0
1792     */
1793    function nectarCarouselFlkEH($slider_instance) {
1794
1795        var $tallestSlideCol = 0;
1796
1797        $slider_instance
1798            .find('.flickity-slider > .cell')
1799            .css('height', 'auto');
1800
1801        $slider_instance.find('.flickity-slider > .cell').each(function () {
1802
1803            if ($(this).height() > $tallestSlideCol) {
1804                $tallestSlideCol = $(this).height();
1805            }
1806
1807        });
1808
1809        if ($tallestSlideCol < 10) {
1810            $tallestSlideCol = 'auto';
1811        }
1812
1813        //set even height
1814        $slider_instance
1815            .find('.flickity-slider > .cell')
1816            .css('height', $tallestSlideCol + 'px');
1817
1818    }
1819
1820
1821    /**
1822     * twentytwenty plugin initialization.
1823     *
1824     * @since 7.0
1825     */
1826    function twentytwentyInit() {
1827        $('.twentytwenty-container').each(function () {
1828            var $that = $(this);
1829
1830            if ($that.find('.twentytwenty-handle').length == 0) {
1831                $(this).imagesLoaded(function () {
1832                    $that.twentytwenty();
1833                });
1834            }
1835
1836        });
1837    }
1838
1839
1840    /**
1841     * Superfish initialization and submenu functionality.
1842     *
1843     * @since 2.0
1844     */
1845    function initSF() {
1846
1847        addOrRemoveSF();
1848
1849        if ($('body[data-header-format="left-header"]').length == 0 && !nectarDOMInfo.usingPhoneBrowser) {
1850
1851            var $disableHI;
1852
1853            if (!($('#header-outer[data-megamenu-rt="1"]').length > 0 &&
1854                $('#header-outer[data-transparent-header="true"]').length > 0)) {
1855                $disableHI = true;
1856            } else {
1857                $disableHI = false;
1858            }
1859
1860            if (window.nectarOptions && window.nectarOptions.dropdown_hover_intent) {
1861                if (window.nectarOptions.dropdown_hover_intent === 'add') {
1862                    $disableHI = false;
1863                }
1864            }
1865
1866            $(".sf-menu:not(.buttons)").superfish({
1867                delay: 500,
1868                speed: 'fast',
1869                disableHI: $disableHI,
1870                speedOut: 'fast',
1871                animation: {
1872                    opacity: 'show'
1873                }
1874            });
1875
1876            // Pull right/left menu
1877            $('#header-outer .sf-menu.buttons li.menu-item').on('mouseover', function () {
1878
1879                $(this).addClass('sfHover');
1880
1881                // Removes transparency option
1882                if ($('#header-outer[data-megamenu-rt="1"]').length > 0 &&
1883                    $(this).hasClass('megamenu') &&
1884                    !$(this).hasClass('width-75') &&
1885                    !$(this).hasClass('width-50') &&
1886                    $('#header-outer').attr('data-transparent-header') == 'true') {
1887
1888                    $('#header-outer').addClass('no-transition');
1889                    $('#header-outer').removeClass('transparent');
1890
1891                }
1892            });
1893
1894            $('#header-outer .sf-menu.buttons > li.menu-item.menu-item-has-children:not(.megamenu):not(.nectar-megamenu-menu-item)').on('mouseenter', function () {
1895
1896                var docW = $("#top .container").width();
1897                var elm = $(this).children('ul');
1898                var off = elm.offset();
1899                var l = off.left - ($(window).width() - docW) / 2;
1900                var w = elm.width();
1901                var isEntirelyVisible = (l + w <= $(window).width() - 100);
1902
1903                if (!isEntirelyVisible) {
1904                    $(this).addClass('edge');
1905                } else {
1906                    $(this).removeClass('edge');
1907                }
1908            });
1909
1910            $('#header-outer .sf-menu.buttons li.menu-item').on('mouseleave', function () {
1911                var $that = $(this);
1912
1913                if ($that.is('.menu-item-has-children')) {
1914                    setTimeout(function () {
1915                        if (!$that.is(':hover')) {
1916                            $that.removeClass('sfHover');
1917
1918                            if ($('#header-outer[data-megamenu-rt="1"]').length > 0 && $('#header-outer[data-transparent-header="true"]').length > 0) {
1919
1920                                if ($('#header-outer.scrolled-down').length == 0 &&
1921                                    $('#header-outer.small-nav').length == 0 &&
1922                                    $('#header-outer.detached').length == 0 &&
1923                                    $('#header-outer.fixed-menu').length == 0) {
1924                                    $('#header-outer').addClass('transparent');
1925                                }
1926                                if ($('#header-outer[data-permanent-transparent="1"][data-transparent-header="true"]').length > 0) {
1927                                    $('#header-outer').addClass('transparent');
1928                                }
1929
1930                            }
1931                        }
1932                    }, 200);
1933                } else {
1934                    $that.removeClass('sfHover');
1935                }
1936            });
1937
1938            // Areas that do not use megamenu.
1939            $('#header-secondary-outer li.megamenu:not(.nectar-megamenu-menu-item), #header-outer:not([data-format="menu-left-aligned"]):not([data-format="centered-logo-between-menu-alt"]) .sf-menu.buttons li.megamenu')
1940                .removeClass('nectar-megamenu-menu-item')
1941                .removeClass('megamenu');
1942
1943            // Centered menu bottom bar forced megamenu values.
1944            $('#header-outer[data-format="centered-menu-bottom-bar"] .right-side .sf-menu li.nectar-megamenu-menu-item')
1945                .removeClass('align-left')
1946                .removeClass('align-middle')
1947                .addClass('align-right');
1948
1949            $('#header-outer[data-format="centered-menu-bottom-bar"] .left-side .sf-menu li.nectar-megamenu-menu-item')
1950                .removeClass('align-right')
1951                .removeClass('align-middle')
1952                .addClass('align-left');
1953
1954
1955            $('#header-outer .sf-menu > li:not(.megamenu) > ul > li > ul').each(function () {
1956
1957                if ($(this).offset().left + $(this).outerWidth() > $window.width()) {
1958                    $(this).addClass('on-left-side');
1959                    $(this).find('ul').addClass('on-left-side');
1960                }
1961
1962            });
1963
1964            // Megamenu multi section per column title support.
1965            $('body:not([data-header-format="left-header"]) header#top nav > ul > li.megamenu > ul > li > ul > li').each(function () {
1966                if ($(this).find('> ul').length > 0) {
1967                    $(this).addClass('has-ul');
1968                }
1969            });
1970
1971            // Full width megamenu.
1972            if ($('body[data-megamenu-width="full-width"]').length > 0 && $('ul.sub-menu').length > 0) {
1973                megamenuFullwidth();
1974                $window.on('smartresize', megamenuFullwidth);
1975                $('header#top nav > ul > li.megamenu > .sub-menu, header#top nav > ul > li.megamenu > .nectar-global-section-megamenu').css('box-sizing', 'content-box');
1976            }
1977
1978            // Extra hover class for megamenu check.
1979            $('header#top nav > ul.sf-menu > li.menu-item').on('mouseenter', function () {
1980                $(this).addClass('menu-item-over');
1981            });
1982            $('header#top nav > ul.sf-menu > li.menu-item').on('mouseleave', function () {
1983                $(this).removeClass('menu-item-over');
1984            });
1985
1986            // Remove arrows on mega menu item.
1987            $('#header-outer nav .megamenu .sub-menu a.sf-with-ul .sf-sub-indicator, #header-outer .megamenu .sub-menu a .sf-sub-indicator').remove();
1988
1989            // Megamenu bg
1990            $('.sf-menu > .nectar-megamenu-menu-item > a .menu-title-text .megamenu-bg-lazy[data-bg-src]').each(function () {
1991                var parentLI = $(this).parents('.nectar-megamenu-menu-item');
1992                var bgImgSrc = $(this).attr('data-bg-src');
1993                var bgImgAlign = $(this).attr('data-align').replace('_', ' ');
1994
1995                parentLI.find('> ul').css({
1996                    'background-position': bgImgAlign,
1997                    'background-image': 'url("' + bgImgSrc + '")'
1998                });
1999
2000                $(this).remove();
2001            });
2002
2003            $('.sf-menu > .nectar-megamenu-menu-item > ul > li > a .menu-title-text .megamenu-col-bg-lazy[data-bg-src]').each(function () {
2004                var parentLI = $(this).closest('.menu-item');
2005                var bgImgSrc = $(this).attr('data-bg-src');
2006                var bgImgAlign = $(this).attr('data-align').replace('_', ' ');
2007                parentLI.css({
2008                    'background-position': bgImgAlign,
2009                    'background-image': 'url("' + bgImgSrc + '")'
2010                });
2011                $(this).remove();
2012            });
2013
2014
2015            // Blank title megamenu columns.
2016            $('#header-outer nav > ul > li.megamenu > ul.sub-menu > li > a').each(function () {
2017                if ($(this).text() == '-' || $(this).text() == '–' || $(this).parent().hasClass('hide-title')) {
2018                    $(this).remove();
2019                }
2020            });
2021
2022        }
2023
2024
2025        // Lazy load nectar menu images.
2026        if ('IntersectionObserver' in window) {
2027
2028            var options = {
2029                rootMargin: '0px',
2030                threshold: 0
2031            }
2032
2033            var menuObserver = new IntersectionObserver(function (entries) {
2034
2035                entries.forEach(function (entry) {
2036                    if (entry.isIntersecting) {
2037                        var lazyItem = entry.target;
2038                        lazyItem.classList.add('loaded');
2039
2040                        var lazySrc = lazyItem.getAttribute('data-menu-img-src');
2041                        if (lazySrc) {
2042                            lazyItem.setAttribute('src', lazySrc);
2043                            lazyItem.removeAttribute('data-menu-img-src');
2044                        }
2045
2046                        menuObserver.unobserve(lazyItem);
2047                    }
2048                });
2049
2050            }, options);
2051
2052            var lazyMenuIcons = [].slice.call(document.querySelectorAll('.nectar-menu-icon-img[data-menu-img-src], #header-outer .nectar-ext-menu-item .image-layer'));
2053            lazyMenuIcons.forEach(function (lazyItem) {
2054                menuObserver.observe(lazyItem);
2055            });
2056
2057        } else {
2058            // fallback.
2059            $('.sf-menu .nectar-menu-icon-img[data-menu-img-src]').each(function () {
2060                $(this).attr('src', $(this).attr('data-menu-img-src'));
2061                $(this).removeAttr('data-menu-img-src');
2062            });
2063            $('.nectar-ext-menu-item .image-layer').addClass('loaded');
2064
2065        }
2066
2067        // Icon markup.
2068        $('.sub-menu .nectar-menu-icon, .sub-menu .nectar-menu-icon-img, .off-canvas-menu-container > ul > li > a .nectar-menu-icon, .off-canvas-menu-container > ul > li > a .nectar-menu-icon-img').each(function () {
2069
2070            var $parent = $(this).parent();
2071            var $icon = $(this).detach();
2072
2073            if ($parent.parents('.nectar-ext-menu-item').length == 0) {
2074                $parent.wrapInner('<span class="nectar-menu-icon-text" />');
2075                $parent.addClass('nectar-menu-item-with-icon');
2076            }
2077
2078            $parent.prepend($icon);
2079
2080        });
2081
2082        // Badge Labels.
2083        $('#slide-out-widget-area:not(.fullscreen) .nectar-menu-label').each(function () {
2084
2085            if ($(this).parents('.nectar-ext-menu-item').length == 0) {
2086                $(this).closest('a').addClass('nectar-menu-item-with-icon');
2087            }
2088
2089        });
2090
2091
2092        // Desc class for OCM for different flex alignment.
2093        $('.off-canvas-menu-container .nectar-menu-icon, .off-canvas-menu-container .nectar-menu-icon-img').each(function () {
2094
2095            var $parent = $(this).parent();
2096
2097            if ($parent.find('.item_desc').length > 0 || $parent.find('.nav_desc').length > 0) {
2098                $parent.addClass('nectar-menu-item-with-desc');
2099            }
2100
2101        });
2102
2103
2104        inlineMegaMenuPos();
2105
2106    }
2107
2108
2109    function inlineMegaMenuPos() {
2110
2111        // Left aligned items.
2112        $('nav:not(.left-side):not(.right-side) .sf-menu > .nectar-megamenu-menu-item.align-left:not(.width-100)').each(function () {
2113            var $parentEl = $(this);
2114            var $headerContainer = $('header#top > .container > .row');
2115            var $submenu = $(this).find('> ul.sub-menu, > .nectar-global-section-megamenu');
2116
2117            if ($parentEl) {
2118
2119                // Change into center positioning.
2120                if ($submenu.width() + $parentEl.offset().left > nectarDOMInfo.winW) {
2121                    $(this).addClass('align-middle');
2122                    return true;
2123                }
2124
2125                // Set left positioning.
2126                $(this).find('> ul.sub-menu, > .nectar-global-section-megamenu').css({
2127                    'right': $headerContainer.width() - (($parentEl.offset().left + $parentEl.width()) - $headerContainer.offset().left) - $(this).find('> ul.sub-menu').width() + $parentEl.width(),
2128                    'left': 'auto'
2129                });
2130                $(this).removeClass('align-middle');
2131            }
2132
2133        });
2134
2135
2136        // Right aligned items.
2137        $('nav:not(.left-side):not(.right-side) .sf-menu > .nectar-megamenu-menu-item.align-right:not(.width-100)').each(function () {
2138            var $parentEl = $(this);
2139            var $headerContainer = $('header#top > .container > .row');
2140            var $submenu = $(this).find('> ul.sub-menu, > .nectar-global-section-megamenu');
2141
2142            if ($parentEl) {
2143
2144                // Change into center positioning.
2145                if (($parentEl.offset().left + $parentEl.width() - $submenu.width()) < 0) {
2146                    $(this).addClass('align-middle');
2147                    return true;
2148                }
2149
2150                $(this).find('> ul.sub-menu, > .nectar-global-section-megamenu').css({
2151                    'right': $headerContainer.width() - (($parentEl.offset().left + $parentEl.width()) - $headerContainer.offset().left),
2152                    'left': 'auto'
2153                });
2154                $(this).removeClass('align-middle');
2155            }
2156
2157        });
2158
2159        // Center aligned items.
2160        $('nav:not(.left-side):not(.right-side) .sf-menu > .nectar-megamenu-menu-item.align-middle:not(.width-100)').each(function () {
2161            var $parentEl = $(this);
2162            var $headerContainer = $('header#top > .container > .row');
2163            var $submenu = $(this).find('> ul.sub-menu, > .nectar-global-section-megamenu');
2164
2165            if ($parentEl && $submenu.length > 0) {
2166
2167                var headerContainerW = $headerContainer.width(),
2168                    headerContainerOffsetL = $headerContainer.offset().left,
2169                    menuItemOffsetL = $parentEl.offset().left,
2170                    menuItemW = $parentEl.width(),
2171                    megaMenuW = $submenu.width();
2172
2173                // Default center align.
2174                $submenu.css({
2175                    'right': headerContainerW - ((menuItemOffsetL + menuItemW) - headerContainerOffsetL) - megaMenuW / 2 + menuItemW / 2,
2176                    'left': 'auto'
2177                });
2178
2179                var megaMenuOffset = $submenu.offset();
2180
2181                // Overflowing left.
2182                if (megaMenuOffset.left < 0) {
2183                    $submenu.css({
2184                        'right': 'auto',
2185                        'left': '0px'
2186                    });
2187                }
2188                // Overflowing right.
2189                else if (megaMenuOffset.left + megaMenuW > nectarDOMInfo.winW) {
2190                    $submenu.css({
2191                        'right': '0px',
2192                        'left': 'auto'
2193                    });
2194                }
2195
2196            }
2197
2198        });
2199
2200
2201    }
2202
2203    /**
2204     * Calculates the "Header Mega Menu Width - Full screen width" theme option.
2205     *
2206     * @since 6.0
2207     */
2208    function megamenuFullwidth() {
2209
2210        var $windowWidth = $window.width();
2211        var $headerContainerWidth = $('header#top > .container').width();
2212        $('header#top nav:not(.left-side):not(.right-side) > ul > li.megamenu:not(.width-50):not(.width-75) > .sub-menu, header#top nav:not(.left-side):not(.right-side) > ul > li.megamenu:not(.width-50):not(.width-75) > .nectar-global-section-megamenu').css({
2213            'padding-left': ($windowWidth - $headerContainerWidth) / 2 + 'px',
2214            'padding-right': ($windowWidth + 2 - $headerContainerWidth) / 2 + 'px',
2215            'width': $headerContainerWidth,
2216            'left': '-' + ($windowWidth - $headerContainerWidth) / 2 + 'px'
2217        });
2218    }
2219
2220
2221    /**
2222     * Hide main navigation on mobile.
2223     *
2224     * @since 2.0
2225     */
2226    function addOrRemoveSF() {
2227
2228        if (nectarDOMInfo.winW < 1000 && $body.attr('data-responsive') == '1') {
2229            $body.addClass('mobile');
2230            $('header#top nav').css('display', 'none');
2231        } else {
2232            $body.removeClass('mobile');
2233            $('header#top nav').css('display', '');
2234            $('.slide-out-widget-area-toggle #toggle-nav .lines-button').removeClass('close');
2235        }
2236
2237
2238    }
2239
2240
2241    /**
2242     * Calculates whether submenu needs to display aligned opposite (from lack of space).
2243     *
2244     * @since 2.0
2245     */
2246    function showOnLeftSubMenu() {
2247
2248        // Show on left class for minimal styling.
2249        $('#header-outer .sf-menu > li:not(.megamenu) > ul > li > ul').each(function () {
2250
2251            $(this).removeClass('on-left-side');
2252
2253            if ($(this).offset().left + $(this).outerWidth() > $window.width()) {
2254                $(this).addClass('on-left-side');
2255                $(this).find('ul').addClass('on-left-side');
2256            } else {
2257                $(this).removeClass('on-left-side');
2258                $(this).find('ul').removeClass('on-left-side');
2259            }
2260
2261        });
2262    }
2263
2264
2265    /**
2266     * Caroufredsel plugin initialization.
2267     *
2268     * @since 2.0
2269     */
2270    function standardCarouselInit() {
2271
2272        if ($('.carousel').length == 0) {
2273            return;
2274        }
2275
2276        if (typeof SalientRecentProjectsCarousel !== 'undefined') {
2277            $('ul.carousel.portfolio-items').each(function (i) {
2278                $projectCarouselSliderArr[i] = new SalientRecentProjectsCarousel($(this));
2279            });
2280        }
2281
2282        $('ul.carousel:not(".clients"):not(.portfolio-items)').each(function () {
2283
2284            var $that = $(this),
2285                maxCols = ($(this).parents('.carousel-wrap').attr('data-full-width') == 'true') ? 'auto' : 3,
2286                scrollNum = ($(this).parents('.carousel-wrap').attr('data-full-width') == 'true') ? 'auto' : '',
2287                colWidth = ($(this).parents('.carousel-wrap').attr('data-full-width') == 'true') ? 500 : 453,
2288                $autoplayBool = ($(this).attr('data-autorotate') == 'true') ? true : false,
2289                $themeSkin = true,
2290                $themeSkin2 = true;
2291
2292            var scrollSpeed, easing;
2293
2294            if ($('body.ascend').length > 0 && $(this).parents('.carousel-wrap').attr('data-full-width') != 'true' ||
2295                $('body.material').length > 0 && $(this).parents('.carousel-wrap').attr('data-full-width') != 'true') {
2296
2297                if ($(this).find('li').length % 3 === 0) {
2298                    $themeSkin = true;
2299                    $themeSkin2 = true;
2300                } else {
2301                    $themeSkin = false;
2302                    $themeSkin2 = true;
2303                }
2304
2305            } else {
2306                $themeSkin = true;
2307                $themeSkin2 = true;
2308            }
2309
2310            scrollSpeed = (parseInt($(this).attr('data-scroll-speed'))) ? parseInt($(this).attr('data-scroll-speed')) : 700;
2311            easing = ($(this).is('[data-easing]')) ? $(this).attr('data-easing') : 'linear';
2312
2313            var $element = $that;
2314            if ($that.find('img').length == 0) {
2315                $element = $body;
2316            }
2317
2318            imagesLoaded($element, function () {
2319
2320                $that.carouFredSel({
2321                    circular: $themeSkin,
2322                    infinite: $themeSkin2,
2323                    height: 'auto',
2324                    responsive: true,
2325                    items: {
2326                        width: colWidth,
2327                        visible: {
2328                            min: 1,
2329                            max: maxCols
2330                        }
2331                    },
2332                    swipe: {
2333                        onTouch: true,
2334                        onMouse: true,
2335                        options: {
2336                            excludedElements: "button, input, select, textarea, .noSwipe",
2337                            tap: function (event, target) {
2338                                if ($(target).attr('href') &&
2339                                    !$(target).is('[target="_blank"]') &&
2340                                    !$(target).is('[rel^="prettyPhoto"]') &&
2341                                    !$(target).is('.magnific-popup') &&
2342                                    !$(target).is('.magnific')) {
2343                                    window.open($(target).attr('href'), '_self');
2344                                }
2345                            }
2346                        },
2347                        onBefore: function () {
2348                            // Hover effect.
2349                            $that.find('.work-item').trigger('mouseleave');
2350                            $that.find('.work-item .work-info a').trigger('mouseup');
2351                        }
2352                    },
2353                    scroll: {
2354                        items: scrollNum,
2355                        easing: easing,
2356                        duration: scrollSpeed,
2357                        onBefore: function () {
2358
2359                            if ($('body.ascend').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true' ||
2360                                $('body.material').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true') {
2361
2362                                $that.parents('.carousel-wrap')
2363                                    .find('.item-count .total')
2364                                    .html(Math.ceil($that.find('> li').length / $that.triggerHandler("currentVisible").length));
2365
2366                            }
2367                        },
2368                        onAfter: function () {
2369                            if ($('body.ascend').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true' ||
2370                                $('body.material').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true') {
2371
2372                                $that.parents('.carousel-wrap')
2373                                    .find('.item-count .current')
2374                                    .html($that.triggerHandler('currentPage') + 1);
2375
2376                                $that.parents('.carousel-wrap')
2377                                    .find('.item-count .total')
2378                                    .html(Math.ceil($that.find('> li').length / $that.triggerHandler("currentVisible").length));
2379
2380                            }
2381                        }
2382
2383                    },
2384                    prev: {
2385                        button: function () {
2386                            return $that.parents('.carousel-wrap').find('.carousel-prev');
2387                        }
2388                    },
2389                    next: {
2390                        button: function () {
2391                            return $that.parents('.carousel-wrap').find('.carousel-next');
2392                        }
2393                    },
2394                    auto: {
2395                        play: $autoplayBool
2396                    }
2397                }, {
2398                    transition: true
2399                }).animate({
2400                    'opacity': 1
2401                }, 1300);
2402
2403                $that
2404                    .parents('.carousel-wrap')
2405                    .wrap('<div class="carousel-outer">');
2406
2407                if ($that.parents('.carousel-wrap').attr('data-full-width') == 'true') {
2408                    $that
2409                        .parents('.carousel-outer')
2410                        .css('overflow', 'visible');
2411                }
2412
2413                // Add count for non full width ascend skin.
2414                if ($('body.ascend').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true' ||
2415                    $('body.material').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true') {
2416                    $('<div class="item-count"><span class="current">1</span>/<span class="total">
2416' + ($that.find('> li').length / $that.triggerHandler("currentVisible").length) + '</span></div>').insertAfter($that.parents('.carousel-wrap').find('.carousel-prev'));
2417                }
2418
2419                $that.addClass('finished-loading');
2420
2421                carouselHeightCalcs();
2422
2423            });
2424
2425        });
2426
2427        // Resize
2428        $window.off('smartresize.carouselHeightCalcs');
2429        $window.on('smartresize.carouselHeightCalcs', carouselHeightCalcs);
2430
2431    }
2432
2433
2434    /**
2435     * Full width carousel link event.
2436     *
2437     * @since 4.0
2438     */
2439    function fwCarouselLinkFix() {
2440
2441        var $mousePosStart = 0,
2442            $mousePosEnd = 0,
2443            fwCarouselLinkSelector = '.carousel-wrap .portfolio-items .col .work-info a, .woocommerce .products-carousel ul.products li.product a';
2444
2445        $(fwCarouselLinkSelector).on('mousedown', function (e) {
2446            $mousePosStart = e.clientX;
2447        });
2448
2449        $(fwCarouselLinkSelector).on('mouseup', function (e) {
2450            $mousePosEnd = e.clientX;
2451        });
2452
2453        $(fwCarouselLinkSelector).on('click', function () {
2454            if (Math.abs($mousePosStart - $mousePosEnd) > 10) {
2455                return false;
2456            }
2457        });
2458
2459    }
2460
2461
2462    /**
2463     * Owl carousel plugin initialization.
2464     *
2465     * @since 6.0
2466     */
2467    function owlCarouselInit() {
2468
2469        if ($('.owl-carousel[data-desktop-cols]').length === 0) {
2470            return;
2471        }
2472
2473        $('.owl-carousel[data-desktop-cols]').each(function () {
2474
2475            $(this).addClass('owl-theme');
2476
2477            var $that = $(this),
2478                $autoRotateBool = $that.attr('data-autorotate'),
2479                $autoRotateSpeed = $that.attr('data-autorotation-speed'),
2480                $owlLoopBool = ($that.is('[data-loop="true"]')) ? true : false,
2481                $owlRTL = ($body.hasClass('rtl')) ? true : false;
2482
2483            $(this).owlCarousel({
2484                responsive: {
2485                    0: {
2486                        items: $(this).attr('data-mobile-cols')
2487                    },
2488                    690: {
2489                        items: $(this).attr('data-tablet-cols')
2490                    },
2491                    1000: {
2492                        items: $(this).attr('data-desktop-small-cols')
2493                    },
2494                    1300: {
2495                        items: $(this).attr('data-desktop-cols')
2496                    }
2497                },
2498                autoplay: $autoRotateBool,
2499                autoplayTimeout: $autoRotateSpeed,
2500                loop: $owlLoopBool,
2501                rtl: $owlRTL,
2502                smartSpeed: 350,
2503                onTranslate: function () {
2504                    $that.addClass('moving');
2505                },
2506                onTranslated: function () {
2507                    $that.removeClass('moving');
2508                }
2509
2510            });
2511
2512            $(this).on('changed.owl.carousel', function (event) {
2513                if (event.item.count - event.page.size == event.item.index) {
2514
2515                    $(event.target).find('.owl-dots div:last')
2516                        .addClass('active')
2517                        .siblings()
2518                        .removeClass('active');
2519                }
2520
2521            });
2522
2523        });
2524
2525    }
2526
2527
2528    /**
2529     * Owl carousel animate items.
2530     *
2531     * @since 6.0
2532     */
2533    function owl_carousel_animate() {
2534
2535        $($fullscreenSelector + '.owl-carousel[data-enable-animation="true"]').each(function () {
2536
2537            var $owlOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : 'bottom-in-view';
2538            var $animationDelay = 0;
2539
2540            if ($(this).is('[data-animation-delay]') &&
2541                $(this).attr('data-animation-delay').length > 0 &&
2542                $(this).attr('data-animation') != 'false') {
2543                $animationDelay = $(this).attr('data-animation-delay');
2544            }
2545
2546            var $that = $(this);
2547            var waypoint = new Waypoint({
2548                element: $that[0],
2549                handler: function () {
2550
2551                    if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) {
2552                        waypoint.destroy();
2553                        return;
2554                    }
2555
2556                    setTimeout(function () {
2557                        $that.find('.owl-stage > .owl-item').each(function (i) {
2558
2559                            var $that = $(this);
2560                            $that.delay(i * 200).transition({
2561                                'opacity': '1',
2562                                'y': '0'
2563                            }, 600, 'easeOutQuart');
2564                        });
2565                        $that.addClass('animated-in');
2566
2567                    }, $animationDelay);
2568
2569                    waypoint.destroy();
2570                },
2571                offset: $owlOffsetPos
2572
2573            });
2574
2575        });
2576
2577    }
2578
2579
2580    /**
2581     * Update WooCommerce Flickity count.
2582     *
2583     * Updates next/prev count for carousels on mobile devices.
2584     *
2585     * @since 9.0
2586     */
2587    function updateWooFlickityCount(e) {
2588        var slideNumber = e.data.wooFlickity.selectedIndex + 1;
2589        e.data.wooFlickityCount.text(slideNumber + '/' + e.data.wooFlickity.slides.length);
2590    }
2591
2592
2593    /**
2594     * Product carousel initialization.
2595     *
2596     * @since 4.0
2597     */
2598    function NectarProductCarousel(el, type, index) {
2599
2600        this.$el = el;
2601        this.index = index;
2602        this.type = type;
2603
2604        this.instance = {};
2605
2606        this.setup();
2607    }
2608
2609    NectarProductCarousel.prototype.setup = function () {
2610
2611        if (!nectarDOMInfo.usingFrontEndEditor && 'IntersectionObserver' in window) {
2612            this.lazyInit();
2613        } else {
2614            this.init();
2615        }
2616
2617    };
2618
2619
2620    NectarProductCarousel.prototype.init = function () {
2621
2622        if (this.type === 'legacy') {
2623            this.legacyCarousel();
2624        } else {
2625            this.flickityCarousel();
2626        }
2627    }
2628
2629    NectarProductCarousel.prototype.lazyInit = function () {
2630
2631        var that = this;
2632        this.observer = new IntersectionObserver(function (entries) {
2633
2634            entries.forEach(function (entry) {
2635                if (entry.isIntersecting) {
2636                    that.init();
2637                    that.observer.unobserve(entry.target);
2638                }
2639            });
2640
2641        }, {
2642            root: (isSafari()) ? null : document,
2643            rootMargin: '400px 0px 400px 0px',
2644            threshold: 0
2645        });
2646
2647        this.observer.observe(this.$el[0]);
2648
2649    }
2650
2651
2652    NectarProductCarousel.prototype.legacyCarousel = function () {
2653
2654        var $that = this.$el.find('ul.products'),
2655            maxCols = 'auto',
2656            scrollNum = 'auto',
2657            colWidth = (this.$el.parents('.full-width-content ').length > 0) ? 400 : 353,
2658            scrollSpeed = 800,
2659            easing = 'easeInOutQuart';
2660
2661        var $element = $that;
2662        if ($that.find('img').length == 0) {
2663            $element = $body;
2664        }
2665
2666        // Controls on hover.
2667        this.$el.append('<a class="carousel-prev" href="#"><i class="icon-salient-left-arrow"></i></a> <a class="carousel-next" href="#"><i class="icon-salient-right-arrow"></i></a>');
2668
2669        imagesLoaded($element, function () {
2670
2671            $that.carouFredSel({
2672                circular: true,
2673                responsive: true,
2674                items: {
2675                    width: colWidth,
2676                    visible: {
2677                        min: 1,
2678                        max: maxCols
2679                    }
2680                },
2681                swipe: {
2682                    onTouch: true,
2683                    onMouse: true,
2684                    options: {
2685                        excludedElements: "button, input, select, textarea, .noSwipe",
2686                        tap: function (event, target) {
2687
2688                            if ($(target).attr('href') &&
2689                                !$(target).is('[target="_blank"]') &&
2690                                !$(target).hasClass('add_to_wishlist') &&
2691                                !$(target).hasClass('add_to_cart_button') &&
2692                                !$(target).is('[rel^="prettyPhoto"]')) {
2693                                window.open($(target).attr('href'), '_self');
2694                            }
2695
2696                            if ($(target).parent().attr('href') &&
2697                                !$(target).parent().is('[target="_blank"]') &&
2698                                !$(target).parent().hasClass('add_to_wishlist') &&
2699                                !$(target).parent().hasClass('add_to_cart_button') &&
2700                                !$(target).parent().is('[rel^="prettyPhoto"]')) {
2701                                window.open($(target).parent().attr('href'), '_self');
2702                            }
2703
2704                        }
2705                    },
2706                    onBefore: function () {
2707                        $that.find('.product-wrap').trigger('mouseleave');
2708                        $that.find('.product a').trigger('mouseup');
2709                    }
2710                },
2711                scroll: {
2712                    items: scrollNum,
2713                    easing: easing,
2714                    duration: scrollSpeed
2715                },
2716                prev: {
2717                    button: function () {
2718                        return $that.parents('.carousel-wrap').find('.carousel-prev');
2719                    }
2720                },
2721                next: {
2722                    button: function () {
2723                        return $that.parents('.carousel-wrap').find('.carousel-next');
2724                    }
2725                },
2726                auto: {
2727                    play: false
2728                }
2729            }).animate({
2730                'opacity': 1
2731            }, 1300);
2732
2733            $that.parents('.carousel-wrap').wrap('<div class="carousel-outer">');
2734
2735            $that.addClass('finished-loading');
2736            $window.trigger('resize');
2737        });
2738
2739    };
2740
2741    NectarProductCarousel.prototype.flickityCarousel = function () {
2742
2743        var $that = this.$el;
2744        this.$el.find('.products > li').each(function () {
2745            $(this).wrap('<div class="flickity-cell"></div>');
2746        });
2747
2748        var pageDotsBool = ($that.is('[data-controls="bottom-pagination"]')) ? true : false,
2749            arrowsBool = ($that.is('[data-controls="bottom-pagination"]')) ? false : true,
2750            carouselWrap = (!$that.is('[data-wrap="no-wrap"]')) ? true : false,
2751            groupCellsBool = (carouselWrap == true) ? pageDotsBool : true,
2752            $autoplay = ($that.is('[data-autorotate-speed]') && parseInt($that.attr('data-autorotate-speed')) > 800) ? parseInt($that.attr('data-autorotate-speed')) : 5000;
2753
2754        if (!$that.is('[data-autorotate="true"]')) {
2755            $autoplay = false;
2756        }
2757
2758        this.$el.find('ul.products').addClass('generate-markup');
2759
2760        this.instance = this.$el.find('ul.products');
2761
2762        // Overlaid Arrows.
2763        if ($that.is('[data-controls="arrows-overlaid"]')) {
2764            arrowsBool = true;
2765        }
2766
2767        if (arrowsBool == true) {
2768            this.instance.on('ready.flickity', function () {
2769                var flickityPrv = $that.find('.flickity-prev-next-button.previous').detach();
2770                var flickityNxt = $that.find('.flickity-prev-next-button.next').detach();
2771
2772                $that.find('.nectar-woo-carousel-top').append(flickityPrv).append(flickityNxt);
2773            });
2774        }
2775
2776        // RTL.
2777        var $flickity_rtl = false;
2778        var $flickity_rtl_cell_align = 'center';
2779
2780        if ($body.hasClass('rtl')) {
2781            $flickity_rtl = true;
2782            $flickity_rtl_cell_align = 'right';
2783        }
2784
2785        // Group columns.
2786        if ($that.is('[data-group-columns="no-overflow"]')) {
2787            groupCellsBool = true;
2788            $flickity_rtl_cell_align = 'left';
2789        } else if ($that.is('[data-group-columns="overflow"]')) {
2790            groupCellsBool = false;
2791            $flickity_rtl_cell_align = 'center';
2792        }
2793
2794        // Related/Upsell
2795        var relatedUpsell = false;
2796        var adaptiveHeight = false;
2797
2798        if (window.nectarOptions && window.nectarOptions.woo_related_upsell_carousel && window.nectarOptions.woo_related_upsell_carousel == 'true' && this.$el.hasClass('related-upsell-carousel')) {
2799            relatedUpsell = true;
2800            carouselWrap = false;
2801            groupCellsBool = true;
2802
2803            if ($flickity_rtl_cell_align == 'center' && this.$el.find('.products > div').length < 4) {
2804                $flickity_rtl_cell_align = 'left';
2805            }
2806
2807            if (this.$el.find('.products > div').length < 5) {
2808                this.$el.addClass('desktop-controls-hidden');
2809            }
2810
2811        }
2812
2813        this.instance.flickity({
2814            draggable: true,
2815            contain: true,
2816            lazyLoad: false,
2817            imagesLoaded: true,
2818            cellAlign: $flickity_rtl_cell_align,
2819            groupCells: groupCellsBool,
2820            prevNextButtons: arrowsBool,
2821            pageDots: pageDotsBool,
2822            resize: true,
2823            adaptiveHeight: adaptiveHeight,
2824            percentPosition: true,
2825            setGallerySize: true,
2826            rightToLeft: $flickity_rtl,
2827            wrapAround: carouselWrap,
2828            autoPlay: $autoplay,
2829            dragThreshold: nectarDOMInfo.usingMobileBrowser ? 25 : 3,
2830            accessibility: false
2831        });
2832
2833
2834        // Visualized total controls
2835        if (this.$el.is('[data-controls="touch_indicator"]')) {
2836
2837            // Init drag indicator.
2838            if (!nectarDOMInfo.usingMobileBrowser) {
2839
2840                flickityDragArr.push(new NectarIconMouseFollow(this.$el, 'horizontal-movement'));
2841
2842                this.instance.on('dragMove.flickity', function (event, pointer) {
2843                    nectarDOMInfo.clientY = pointer.clientY;
2844                    nectarDOMInfo.clientX = pointer.clientX;
2845                });
2846
2847                this.instance.on('pointerDown.flickity', function (event, pointer) {
2848                    $('.nectar-drag-indicator').addClass('pointer-down');
2849                });
2850
2851                this.instance.on('pointerUp.flickity', function (event, pointer) {
2852                    $('.nectar-drag-indicator').removeClass('pointer-down');
2853                });
2854
2855            }
2856
2857        }
2858        // Mobile pagination numbers.
2859        else if (arrowsBool == true) {
2860
2861            $that.find('.flickity-prev-next-button').append('<svg width="65px" height="65px" viewBox="0 0 72 72" xmlns="http://www.w3.org/2000/svg"><circle stroke-width="3" fill="none" stroke-linecap="round" cx="33" cy="33" r="28"></circle> <circle class="time" stroke-width="3" fill="none" stroke-linecap="round" cx="33" cy="33" r="28"></circle></svg>');
2862
2863            var $wooFlickityCount = $('<div class="woo-flickity-count" />');
2864
2865            if (relatedUpsell == true) {
2866                $that.find('section > h2').append($wooFlickityCount);
2867            } else {
2868                $that.append($wooFlickityCount);
2869            }
2870
2871            var $wooFlickityData = this.instance.data('flickity');
2872
2873            var $eventData = {
2874                data: {
2875                    wooFlickity: $wooFlickityData,
2876                    wooFlickityCount: $wooFlickityCount
2877                }
2878            };
2879
2880            updateWooFlickityCount($eventData);
2881
2882            this.instance.on('select.flickity', {wooFlickity: $wooFlickityData, wooFlickityCount: $wooFlickityCount}, updateWooFlickityCount);
2883        }
2884
2885        this.$el.removeClass('animated-in');
2886        wooProductCarouselAnimations();
2887    };
2888
2889
2890    function productCarouselInit() {
2891
2892        if ($('.products-carousel').length === 0 && $('.nectar-woo-flickity').length === 0) {
2893            return;
2894        }
2895
2896        $('.products-carousel').each(function (index) {
2897            new NectarProductCarousel($(this), 'legacy', index);
2898        });
2899
2900        $wooFlickityCarousels = [];
2901        $('.nectar-woo-flickity').each(function (index) {
2902            $wooFlickityCarousels.push(new NectarProductCarousel($(this), 'flickity', index));
2903        });
2904
2905    }
2906
2907
2908    /**
2909     * Standard Carousel Height Calculations.
2910     *
2911     * @since 2.0
2912     */
2913    function carouselHeightCalcs() {
2914
2915        // Standard carousels
2916        $('.carousel.finished-loading:not(".portfolio-items, .clients"), .caroufredsel_wrapper .products.finished-loading').each(function () {
2917
2918            var tallestColumn = 0;
2919
2920            $(this).find('> li').each(function () {
2921
2922                if ($(this).height() > tallestColumn) {
2923                    tallestColumn = $(this).height();
2924                }
2925
2926            });
2927
2928            $(this).css('height', tallestColumn + 5);
2929            $(this).parents('.caroufredsel_wrapper').css('height', tallestColumn + 5);
2930
2931            if ($('body.ascend').length > 0 && $(this).parents('.carousel-wrap').attr('data-full-width') != 'true' ||
2932                $('body.material').length > 0 && $(this).parents('.carousel-wrap').attr('data-full-width') != 'true') {
2933
2934                $(this).parents('.carousel-wrap').find('.item-count .current').html(Math.ceil(($(this).triggerHandler("currentPosition") + 1) / $(this).triggerHandler("currentVisible").length));
2935                $(this).parents('.carousel-wrap').find('.item-count .total').html(Math.ceil($(this).find('> li').length / $(this).triggerHandler("currentVisible").length));
2936            }
2937
2938        });
2939
2940    }
2941
2942
2943    /**
2944     * Clients carousel element.
2945     *
2946     * @since 2.0
2947     */
2948    function clientsCarouselInit() {
2949
2950        if ($('.carousel.clients').length === 0) {
2951            return;
2952        }
2953
2954        $('.carousel.clients').each(function () {
2955
2956            var $that = $(this);
2957            var $autoRotate = (!$(this).hasClass('disable-autorotate')) ? true : false;
2958            var columns;
2959
2960            columns = (parseInt($(this).attr('data-max'))) ? parseInt($(this).attr('data-max')) : 5;
2961
2962            if ($window.width() < 690 && $body.attr('data-responsive') == '1') {
2963                columns = 2;
2964                $(this).addClass('phone');
2965            }
2966
2967            var $element = $that;
2968            if ($that.find('img').length == 0) {
2969                $element = $body;
2970            }
2971
2972            imagesLoaded($element, function () {
2973
2974                $that.carouFredSel({
2975                    circular: true,
2976                    responsive: true,
2977                    items: {
2978
2979                        height: $that.find('> div:first').height(),
2980                        width: $that.find('> div:first').width(),
2981                        visible: {
2982                            min: 1,
2983                            max: columns
2984                        }
2985                    },
2986                    swipe: {
2987                        onTouch: true,
2988                        onMouse: true
2989                    },
2990                    scroll: {
2991                        items: 1,
2992                        easing: 'easeInOutCubic',
2993                        duration: '800',
2994                        pauseOnHover: true
2995                    },
2996                    auto: {
2997                        play: $autoRotate,
2998                        timeoutDuration: 2700
2999                    }
3000                }).animate({
3001                    'opacity': 1
3002                }, 1300);
3003
3004                $that.addClass('finished-loading');
3005                $that.parents('.carousel-wrap').wrap('<div class="carousel-outer">');
3006
3007                $window.trigger('resize');
3008
3009            });
3010
3011        });
3012
3013        $window.off('smartresize.clientsCarouselHeight', clientsCarouselHeightRecalc);
3014        $window.on('smartresize.clientsCarouselHeight', clientsCarouselHeightRecalc);
3015    }
3016
3017
3018    /**
3019     * Clients carousel height calculations.
3020     *
3021     * @since 2.0
3022     */
3023    function clientsCarouselHeightRecalc() {
3024
3025        var tallestImage = 0;
3026
3027        $('.carousel.clients.finished-loading').each(function () {
3028
3029            $(this).find('> div').each(function () {
3030
3031                if ($(this).height() > tallestImage) {
3032                    tallestImage = $(this).height();
3033                }
3034
3035            });
3036
3037            $(this).css('height', tallestImage);
3038            $(this).parent().css('height', tallestImage);
3039        });
3040    }
3041
3042    $window.on("orientationchange", function () {
3043        setTimeout(clientsCarouselHeightRecalc, 200);
3044    });
3045
3046
3047    /**
3048     * Adds grabbing classes onto carousels when dragging.
3049     *
3050     * @since 3.0
3051     */
3052    function carouselfGrabbingClass() {
3053
3054        $body.on('mousedown', '.caroufredsel_wrapper, .carousel-wrap[data-full-width="true"] .portfolio-items .col .work-info a, .woocommerce .products-carousel ul.products li.product a', function () {
3055            $(this).addClass('active');
3056        });
3057
3058        $body.on('mouseup', '.caroufredsel_wrapper, .carousel-wrap[data-full-width="true"] .portfolio-items .col .work-info a, .woocommerce .products-carousel ul.products li.product a', function () {
3059            $(this).removeClass('active');
3060        });
3061
3062        // Arrow hover class.
3063        $('body.ascend, body.material').on('mouseover', '.carousel-next', function () {
3064            $(this).parent().find('.carousel-prev, .item-count').addClass('next-hovered');
3065        });
3066
3067        $('body.ascend, body.material').on('mouseleave', '.carousel-next', function () {
3068            $(this).parent().find('.carousel-prev, .item-count').removeClass('next-hovered');
3069        });
3070
3071    }
3072
3073
3074    /**
3075     * Client element fade in animation.
3076     *
3077     * @since 3.0
3078     * @see waypoints
3079     */
3080    function clientsFadeIn() {
3081
3082        var $clientsOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : '95%';
3083        $($fullscreenSelector + '.clients.fade-in-animation').each(function () {
3084
3085            var $that = $(this),
3086                waypoint = new Waypoint({
3087                    element: $that[0],
3088                    handler: function () {
3089
3090                        if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) {
3091                            waypoint.destroy();
3092                            return;
3093                        }
3094
3095                        $that.find('> div').each(function (i) {
3096                            $(this).delay(i * 80).transition({
3097                                'opacity': "1"
3098                            }, 450);
3099                        });
3100
3101                        // Add the css transition class back in after the aniamtion is done.
3102                        setTimeout(function () {
3103                            $that.addClass('completed');
3104                        }, ($that.find('> div').length * 80) + 450);
3105
3106
3107                        $that.addClass('animated-in');
3108                        waypoint.destroy();
3109                    },
3110                    offset: $clientsOffsetPos
3111
3112                });
3113        });
3114    }
3115
3116
3117    /*-------------------------------------------------------------------------*/
3118    /*	Helper Functions
3119		/*-------------------------------------------------------------------------*/
3120
3121
3122    /**
3123     * Cross browser request animation frame.
3124     *
3125     * @since 4.0
3126     */
3127    window.requestAnimationFrame = window.requestAnimationFrame ||
3128        window.mozRequestAnimationFrame ||
3129        window.webkitRequestAnimationFrame ||
3130        window.msRequestAnimationFrame ||
3131        function (f) {
3132            setTimeout(f, 1000 / 60);
3133        }
3134
3135
3136    function isSafari() {
3137        if (navigator.userAgent.indexOf('Safari') != -1 &&
3138            navigator.userAgent.indexOf('Chrome') == -1) {
3139            return true;
3140        }
3141
3142        return false;
3143    }
3144
3145    function isInstagram() {
3146        if (navigator.userAgent.indexOf('Instagram') != -1) {
3147            return true;
3148        }
3149
3150        return false;
3151    }
3152
3153    /**
3154     * Smart resize.
3155     *
3156     * @since 13.0
3157     */
3158    var smartResizeTimer;
3159
3160    $(window).on('resize', function () {
3161
3162        clearTimeout(smartResizeTimer);
3163
3164        smartResizeTimer = setTimeout(function () {
3165            $(window).trigger('smartresize');
3166        }, 125);
3167
3168    });
3169
3170    $.fn.smartresize = function (fn) {
3171        return fn ? this.on("smartresize", fn) : this.trigger("smartresize", ["execAsap"]);
3172    };
3173
3174
3175    /**
3176     * clamp
3177     *
3178     * @since 13.0
3179     */
3180    function clamp(val, min, max) {
3181        return Math.max(Math.min(val, min), max);
3182    }
3183
3184    /**
3185     * Throttle
3186     *
3187     * @since 13.0
3188     */
3189    function throttle(callback, limit) {
3190        var waiting = false;
3191        return function () {
3192            if (!waiting) {
3193                callback.call();
3194                waiting = true;
3195                setTimeout(function () {
3196                    waiting = false;
3197                }, limit);
3198            }
3199        }
3200    }
3201
3202    /**
3203     * Wrap number to range
3204     *
3205     * @since 13.0
3206     */
3207    function wrap(m, n) {
3208        return n >= 0 ? n % m : (n % m + m) % m
3209    }
3210
3211    /**
3212     * Linear interpolation
3213     *
3214     * @since 11.0
3215     */
3216    function linearInterpolate(a, b, n) {
3217        return (1 - n) * a + n * b;
3218    }
3219
3220    /**
3221     * Aspect Ratio Calculator
3222     *
3223     * @since 11.0
3224     */
3225    function calculateAspectRatio(srcWidth, srcHeight, maxWidth, maxHeight) {
3226        var ratio = Math.min(maxWidth / srcWidth, maxHeight / srcHeight);
3227        return {width: srcWidth * ratio, height: srcHeight * ratio};
3228    }
3229
3230
3231    function wlEls(strCode) {
3232
3233        if (strCode) {
3234            var html = $(strCode.bold());
3235            html.find('script').remove();
3236            return html.html();
3237        }
3238
3239        return '';
3240
3241    }
3242
3243    function isWindow(obj) {
3244        return obj != null && obj === obj.window;
3245    }
3246
3247    /**
3248     * Calculate header navigation height
3249     *
3250     * The header nav bar height can change on scrolling from theme option effects/using the secondary
3251     * header, so it is necessary to calculate the reduced height in advance for correct sticky waypoint
3252     * event binding & animated anchor links.
3253     *
3254     * @since 10.5
3255     * @return {number} Height of nav bar.
3256     */
3257    function calcHeaderNavHeight() {
3258
3259        var navHeight;
3260
3261        // Left header format, no header template, hide header until needed.
3262        if (($body.is('[data-header-format="left-header"]') && nectarDOMInfo.winW >= 1000) ||
3263            $body.is('[data-hhun="1"]') ||
3264            $('.page-template-template-no-header-footer').length > 0 ||
3265            $('.page-template-template-no-header').length > 0) {
3266
3267            navHeight = 0;
3268
3269        } else if (headerIsContained === true) {
3270
3271            navHeight = $('#header-outer').outerHeight() + (parseInt($('#header-outer').css('margin-top')));
3272        }
3273
3274        // Regular Header
3275        else {
3276
3277            var headerPadding2 = headerPadding - headerPadding / 1.8;
3278            var $headerNavSpace = $headerOuterEl.outerHeight();
3279
3280            // Secondary header bar.
3281            if ($headerSecondaryEl.length > 0 && $body.is('.material') ||
3282                $headerSecondaryEl.length > 0 && !$body.is('.material') && nectarDOMInfo.winW < 1000) {
3283                $headerNavSpace -= nectarDOMInfo.secondaryHeaderHeight;
3284            }
3285
3286            // Check for header resize effect.
3287            if ($headerOuterEl.is('[data-header-resize="1"]') && !$headerOuterEl.is('.small-nav') && nectarDOMInfo.winW >= 1000) {
3288                navHeight = $headerNavSpace - (parseInt(logoShrinkNum) + headerPadding2 * 2);
3289            } else {
3290                navHeight = $headerNavSpace;
3291            }
3292
3293        }
3294
3295        // Condense header effect.
3296        if (nectarDOMInfo.winW >= 1000 && $('#header-outer[data-condense="true"]').length > 0) {
3297
3298            var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9');
3299            navHeight = $headerOuterEl.height() - (parseInt($headerSpan9.position().top) - parseInt($headerOuterEl.find('#logo').css('margin-top'))) - parseInt(nectarDOMInfo.secondaryHeaderHeight);
3300
3301        }
3302
3303        return navHeight;
3304
3305    }
3306
3307    function nectarScriptLoadedCallback(id, timeout, callback) {
3308        var nectarDeferredScript = document.querySelector(id);
3309        if (nectarDeferredScript) {
3310            nectarDeferredScript.onload = function () {
3311
3312                if (timeout > 0) {
3313                    setTimeout(callback, timeout);
3314                } else {
3315                    callback();
3316                }
3317
3318            };
3319        }
3320    }
3321
3322    /**
3323     * Accessibility.
3324     *
3325     * @since 10.5
3326     */
3327    function NectarAccessibility() {
3328
3329        if (nectarDOMInfo.usingMobileBrowser) {
3330            return;
3331        }
3332
3333        this.state = {
3334            ocmFocus: false
3335        };
3336
3337        this.init();
3338        this.events();
3339
3340    }
3341
3342    NectarAccessibility.prototype.init = function () {
3343
3344        // Handle focus outlines.
3345        focusOutlines(document);
3346    };
3347
3348    NectarAccessibility.prototype.events = function () {
3349
3350        $(window).on('nectar-ocm-open', this.setFocus.bind(this));
3351        $(window).on('nectar-ocm-close', this.releaseFocus.bind(this));
3352
3353        $('nav').on('focus.aria mouseenter.aria', '[aria-haspopup="true"]', function (ev) {
3354            $(ev.currentTarget).attr('aria-expanded', true);
3355        });
3356
3357        $('nav').on('blur.aria mouseleave.aria', '[aria-haspopup="true"]', function (ev) {
3358            $(ev.currentTarget).attr('aria-expanded', false);
3359        });
3360
3361        this.escCloseEvents();
3362    };
3363
3364    NectarAccessibility.prototype.setFocus = function () {
3365        this.state.ocmFocus = true;
3366        $('#slide-out-widget-area').attr("tabindex", "-1").focus();
3367    }
3368    NectarAccessibility.prototype.releaseFocus = function () {
3369        $('#slide-out-widget-area').attr("tabindex", '');
3370    }
3371
3372    NectarAccessibility.prototype.escCloseEvents = function () {
3373
3374        $(document).on('keyup', function (e) {
3375
3376            if (e.keyCode == 27) {
3377
3378                if ($('.open-search').length > 0) {
3379                    closeSearch();
3380                    $searchButtonEl.removeClass('open-search');
3381                }
3382
3383                // Close ocm material
3384                if ($('.ocm-effect-wrap.material-ocm-open').length > 0) {
3385                    $('.slide-out-widget-area-toggle.material-open a').trigger('click');
3386                }
3387
3388                // Regular ocm
3389                else if ($('#slide-out-widget-area .slide_out_area_close').length > 0 &&
3390                    $('#slide-out-widget-area.open').length > 0) {
3391
3392                    $('#slide-out-widget-area .slide_out_area_close')
3393                        .addClass('non-human-allowed')
3394                        .trigger('click');
3395                }
3396
3397
3398                // Woo Slide out cart.
3399                if ($('.nectar-slide-in-cart.style_slide_in_click.open').length > 0) {
3400                    closeRightCart();
3401                }
3402
3403                // Woo Reviews
3404                if ($('#review_form_wrapper.open').length > 0) {
3405                    $('.nectar-slide-in-cart-bg').trigger('click');
3406                }
3407
3408
3409            }
3410
3411        });
3412
3413    };
3414
3415
3416    function focusOutlines(d) {
3417
3418
3419        // Remove CSS outlines in an accessible manner.
3420        var outlineState = {
3421            hidden: false
3422        };
3423
3424        var style_element = d.createElement('STYLE'),
3425            dom_events = 'addEventListener' in d,
3426            add_event_listener = function (type, callback) {
3427                if (dom_events) {
3428                    d.addEventListener(type, callback);
3429                } else {
3430                    d.attachEvent('on' + type, callback);
3431                }
3432            },
3433            set_css = function (css_text) {
3434                !!style_element.styleSheet ? style_element.styleSheet.cssText = css_text : style_element.innerHTML = css_text;
3435            };
3436
3437        d.getElementsByTagName('HEAD')[0].appendChild(style_element);
3438
3439        add_event_listener('mousedown', function () {
3440            if (outlineState.hidden == false) {
3441                set_css(':focus{outline:0}::-moz-focus-inner{border:0;}');
3442                outlineState.hidden = true;
3443            }
3444        });
3445
3446        add_event_listener('keydown', function () {
3447            set_css('');
3448            outlineState.hidden = false;
3449        });
3450
3451        // Off canvas menu focus trap.
3452
3453
3454    }
3455
3456
3457    /**
3458     * Cursor position.
3459     *
3460     * @since 4.0
3461     */
3462    jQuery.fn.setCursorPosition = function (position) {
3463
3464        if (this.length == 0) {
3465            return this;
3466        }
3467        return $(this).setSelection(position, position);
3468    };
3469
3470
3471    /**
3472     * Set selection in input.
3473     *
3474     * @since 4.0
3475     */
3476    jQuery.fn.setSelection = function (selectionStart, selectionEnd) {
3477        if (this.length == 0) {
3478            return this;
3479        }
3480        var input = this[0];
3481
3482        if (input.createTextRange) {
3483            var range = input.createTextRange();
3484            range.collapse(true);
3485            range.moveEnd('character', selectionEnd);
3486            range.moveStart('character', selectionStart);
3487            range.select();
3488        } else if (input.setSelectionRange) {
3489            input.focus();
3490            input.setSelectionRange(selectionStart, selectionEnd);
3491        }
3492
3493        return this;
3494    };
3495
3496    $.extend(jQuery.expr.pseudos, {
3497        transparent: function (elem, i, attr) {
3498            return ($(elem).css("opacity") === "0");
3499        }
3500    });
3501
3502
3503    /**
3504     * Converts to hex.
3505     *
3506     * @since 3.0
3507     */
3508    function hex(x) {
3509        return ("0" + parseInt(x).toString(16)).slice(-2);
3510    }
3511
3512    /**
3513     * CSS color RGB helper.
3514     *
3515     * @since 3.0
3516     */
3517    $.cssHooks.color = {
3518        get: function (elem) {
3519
3520            var color;
3521
3522            if (elem.currentStyle) {
3523                color = elem.currentStyle["color"];
3524            } else if (window.getComputedStyle) {
3525                color = document.defaultView.getComputedStyle(elem,
3526                    null).getPropertyValue("color");
3527            }
3528            if (color.search("rgb") == -1) {
3529                return color;
3530            } else {
3531                color = color.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
3532
3533                if (color) {
3534                    return "#" + hex(color[1]) + hex(color[2]) + hex(color[3]);
3535                }
3536            }
3537        }
3538    };
3539
3540    /**
3541     * CSS background color RGB helper.
3542     *
3543     * @since 3.0
3544     */
3545    $.cssHooks.backgroundColor = {
3546        get: function (elem) {
3547
3548            var bg;
3549
3550            if (elem.currentStyle) {
3551                bg = elem.currentStyle["backgroundColor"];
3552            } else if (window.getComputedStyle) {
3553                bg = document.defaultView.getComputedStyle(elem,
3554                    null).getPropertyValue("background-color");
3555            }
3556            if (bg.search("rgb") == -1) {
3557                return bg;
3558            } else {
3559                bg = bg.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
3560
3561                if (bg) {
3562                    return "#" + hex(bg[1]) + hex(bg[2]) + hex(bg[3]);
3563                }
3564            }
3565        }
3566    };
3567
3568
3569    /**
3570     * Unique ID generator.
3571     *
3572     * @since 10.5
3573     */
3574    function uniqueIdGenerate() {
3575        return Math.floor(Math.random() * 10000);
3576    }
3577
3578
3579    /**
3580     * Animated page scroll
3581     *
3582     * @since 9.0
3583     */
3584    function nectar_scrollToY(scrollTargetY, speed, easing) {
3585
3586        var scrollY = window.scrollY || document.documentElement.scrollTop,
3587            scrollTargetY = scrollTargetY || 0,
3588            speed = 1300,
3589            easing = easing || 'easeOutSine',
3590            currentTime = 0;
3591
3592        var time = Math.max(0.1, Math.min(Math.abs(scrollY - scrollTargetY) / speed, 1.3));
3593
3594        var easingEquations = {
3595            easeInOutQuint: function (pos) {
3596                if ((pos /= 0.5) < 1) {
3597                    return 0.5 * Math.pow(pos, 5);
3598                }
3599                return 0.5 * (Math.pow((pos - 2), 5) + 2);
3600            }
3601        };
3602
3603        function tick() {
3604            currentTime += 1 / 60;
3605
3606            var p = currentTime / time;
3607            var t = easingEquations[easing](p);
3608
3609            if (p < 1) {
3610                requestAnimationFrame(tick);
3611
3612                window.scrollTo(0, scrollY + ((scrollTargetY - scrollY) * t));
3613            } else {
3614                window.scrollTo(0, scrollTargetY);
3615            }
3616        }
3617
3618        tick();
3619    }
3620
3621
3622    /*
3623		* Bootstrap ScrollSpy Component
3624		* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) */
3625    (function ($) {
3626
3627        function s(e, i) {
3628            var r = $.proxy(this.process, this);
3629            this.$body = $("body"), this.$scrollElement = $($(e).is("body") ? window : e),
3630                this.options = $.extend({}, s.DEFAULTS, i),
3631                this.selector = (this.options.target || "") + " ul li > a",
3632                this.offsets = [],
3633                this.targets = [],
3634                this.activeTarget = null,
3635                this.scrollHeight = 0,
3636                this.$scrollElement.on("scroll.bs.scrollspy", r),
3637                this.pageSubmenuHeight = 0,
3638
3639                this.calcPageSubemnu(),
3640                this.refresh(),
3641                this.process();
3642
3643            $(window).on('resize', this.calcPageSubemnu.bind(this));
3644        }
3645
3646        function e(e) {
3647            return this.each(function () {
3648                var i = $(this),
3649                    r = i.data("bs.scrollspy"),
3650                    o = "object" == typeof e && e;
3651                r || i.data("bs.scrollspy", r = new s(this, o)), "string" == typeof e && r[e]()
3652            })
3653        }
3654
3655        s.VERSION = "3.2.0",
3656            s.DEFAULTS = {
3657                offset: 10
3658            },
3659            s.prototype.calcPageSubemnu = function () {
3660                if ($('.page-submenu[data-sticky="true"]').length > 0 && $('body[data-hhun="1"]').length == 0 ||
3661                    $('.page-submenu[data-sticky="true"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length > 0) {
3662                    this.pageSubmenuHeight = $('.page-submenu').height();
3663                }
3664            },
3665            s.prototype.getScrollHeight = function () {
3666                return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight)
3667            },
3668            s.prototype.refresh = function () {
3669                var s = "offset",
3670                    e = 0;
3671                isWindow(this.$scrollElement[0]) || (s = "position", e = this.$scrollElement.scrollTop()), this.offsets = [], this.targets = [], this.scrollHeight = this.get
3671ScrollHeight();
3672                var i = this;
3673                this.$body.find(this.selector).map(function () {
3674                    var i = $(this),
3675                        r = i.data("target") || i.attr("href");
3676                    if (r === '#%20') {
3677                        r = '';
3678                    }
3679                    var o = /^#./.test(r) && $(r);
3680
3681                    return o && o.length && o.is(":visible") && [
3682                        [o[s]().top + e, r]
3683                    ] || null
3684                }).sort(function (t, s) {
3685                    return t[0] - s[0]
3686                }).each(function () {
3687                    i.offsets.push(this[0]), i.targets.push(this[1])
3688                })
3689            },
3690            s.prototype.process = function () {
3691
3692                if (nectarState.preventScroll) {
3693                    return true;
3694                }
3695
3696                var t, s = nectarDOMInfo.scrollTop + this.options.offset + this.pageSubmenuHeight,
3697                    e = this.getScrollHeight(),
3698                    i = this.options.offset + e - this.$scrollElement.height() - this.pageSubmenuHeight,
3699                    r = this.offsets,
3700                    o = this.targets,
3701                    l = this.activeTarget;
3702
3703                // remove active when scrolling to first section that does not have an anchor
3704                if (this.activeTarget && s < this.offsets[0] && this.offsets[0] > 0) {
3705                    this.activeTarget = null;
3706                    $(this.selector).parentsUntil(this.options.target, ".current-menu-item").removeClass("current-menu-item").removeClass('sfHover');
3707                    return;
3708                }
3709
3710                if (this.scrollHeight != e && this.refresh(), s >= i) {
3711                    return l != (t = o[o.length - 1]) && this.activate(t);
3712                }
3713                if (l && s <= r[0]) {
3714                    return l != (t = o[0]) && this.activate(t);
3715                }
3716
3717
3718                for (t = r.length; t--;) l != o[t] && s >= r[t] && (!r[t + 1] || s <= r[t + 1]) && this.activate(o[t])
3719            },
3720            s.prototype.activate = function (s) {
3721                this.activeTarget = s, $(this.selector).parentsUntil(this.options.target, ".current-menu-item").removeClass("current-menu-item").removeClass('sfHover');
3722                var e = this.selector + '[data-target="' + s + '"],' + this.selector + '[href="' + s + '"]',
3723                    i = $(e).parents("li").addClass("current-menu-item");
3724                i.parent(".dropdown-menu").length && (i = i.closest("li.dropdown").addClass("current-menu-item")), i.trigger("activate.bs.scrollspy")
3725            };
3726
3727        var i = $.fn.scrollspy;
3728
3729        $.fn.scrollspy = e,
3730            $.fn.scrollspy.Constructor = s,
3731            $.fn.scrollspy.noConflict = function () {
3732                return $.fn.scrollspy = i, this;
3733            }
3734
3735    }(jQuery));
3736
3737
3738    /**
3739     * Mobile break point checker
3740     *
3741     * @since 9.0
3742     */
3743    function mobileBreakPointCheck() {
3744
3745        var $mobileBreakpoint = ($('body[data-header-breakpoint]').length > 0 && $body.attr('data-header-breakpoint') != '1000') ? parseInt($body.attr('data-header-breakpoint')) : 1000;
3746        var $withinCustomBreakpoint = false;
3747
3748        if ($mobileBreakpoint != 1000) {
3749            if (nectarDOMInfo.winW > 1000 && nectarDOMInfo.winW <= $mobileBreakpoint) {
3750                $withinCustomBreakpoint = true;
3751            }
3752        }
3753
3754        return $withinCustomBreakpoint;
3755    }
3756
3757    /**
3758     * Extract a URL
3759     *
3760     * @since 5.0
3761     */
3762    function extractUrl(input) {
3763        return input.replace(/"/g, "").replace(/url\(|\)$/ig, "");
3764    }
3765
3766    /**
3767     * Extract query params
3768     *
3769     * @since 10.5
3770     */
3771    function getQueryParams(qs) {
3772        qs = qs.split("+").join(" ");
3773        var params = {},
3774            tokens,
3775            re = /[?&]?([^=]+)=([^&]*)/g;
3776
3777        while (tokens = re.exec(qs)) {
3778            params[decodeURIComponent(tokens[1])] = decodeURIComponent(tokens[2]);
3779        }
3780
3781        return params;
3782    }
3783
3784    var nectarGetQueryParam = getQueryParams(document.location.search);
3785
3786
3787    /**
3788     * Check whether an el is visible.
3789     *
3790     * @since 6.0
3791     */
3792    (function (t) {
3793        var i = t(window);
3794        t.fn.visible = function (t, e, o) {
3795            if (!(this.length < 1)) {
3796                var r = this.length > 1 ? this.eq(0) : this,
3797                    n = r.get(0),
3798                    f = i.width(),
3799                    h = i.height(),
3800                    o = o ? o : "both",
3801                    l = e === !0 ? n.offsetWidth * n.offsetHeight : !0;
3802                if ("function" == typeof n.getBoundingClientRect) {
3803                    var g = n.getBoundingClientRect(),
3804                        u = g.top >= 0 && g.top < h,
3805                        s = g.bottom > 0 && g.bottom <= h,
3806                        c = g.left >= 0 && g.left < f,
3807                        a = g.right > 0 && g.right <= f,
3808                        v = t ? u || s : u && s,
3809                        b = t ? c || a : c && a;
3810                    if ("both" === o) {
3811                        return l && v && b;
3812                    }
3813                    if ("vertical" === o) {
3814                        return l && v;
3815                    }
3816                    if ("horizontal" === o) {
3817                        return l && b
3818                    }
3819                } else {
3820                    var d = i.scrollTop(),
3821                        p = d + h,
3822                        w = i.scrollLeft(),
3823                        m = w + f,
3824                        y = r.offset(),
3825                        z = y.top,
3826                        B = z + r.height(),
3827                        C = y.left,
3828                        R = C + r.width(),
3829                        j = t === !0 ? B : z,
3830                        q = t === !0 ? z : B,
3831                        H = t === !0 ? R : C,
3832                        L = t === !0 ? C : R;
3833                    if ("both" === o) {
3834                        return !!l && p >= q && j >= d && m >= L && H >= w;
3835                    }
3836                    if ("vertical" === o) {
3837                        return !!l && p >= q && j >= d;
3838                    }
3839                    if ("horizontal" === o) {
3840                        return !!l && m >= L && H >= w;
3841                    }
3842                }
3843            }
3844        };
3845
3846    }(jQuery));
3847
3848
3849    /**
3850     * Count to a specific number
3851     *
3852     * @since 8.0
3853     */
3854    var CountUp = function (target, startVal, endVal, decimals, duration, options) {
3855
3856        var lastTime = 0;
3857        var vendors = ['webkit', 'moz', 'ms', 'o'];
3858        for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
3859            window.requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame'];
3860            window.cancelAnimationFrame =
3861                window[vendors[x] + 'CancelAnimationFrame'] || window[vendors[x] + 'CancelRequestAnimationFrame'];
3862        }
3863        if (!window.requestAnimationFrame) {
3864            window.requestAnimationFrame = function (callback) {
3865                var currTime = new Date().getTime();
3866                var timeToCall = Math.max(0, 16 - (currTime - lastTime));
3867                var id = window.setTimeout(function () {
3868                        callback(currTime + timeToCall);
3869                    },
3870                    timeToCall);
3871                lastTime = currTime + timeToCall;
3872                return id;
3873            };
3874        }
3875        if (!window.cancelAnimationFrame) {
3876            window.cancelAnimationFrame = function (id) {
3877                clearTimeout(id);
3878            };
3879        }
3880
3881        var self = this;
3882
3883        self.options = {
3884            useEasing: true,
3885            useGrouping: true,
3886            separator: ',',
vendor: 4,507 bytes, lines 3887-4007
3887            decimal: '.',
3888            easingFn: null,
3889            formattingFn: null
3890        };
3891        // Extend default options with passed options object
3892        for (var key in options) {
3893            if (options.hasOwnProperty(key)) {
3894                self.options[key] = options[key];
3895            }
3896        }
3897        if (self.options.separator === '') {
3898            self.options.useGrouping = false;
3899        }
3900        if (!self.options.prefix) {
3901            self.options.prefix = '';
3902        }
3903        if (!self.options.suffix) {
3904            self.options.suffix = '';
3905        }
3906
3907        self.d = (typeof target === 'string') ? document.getElementById(target) : target;
3908        self.startVal = Number(startVal);
3909        self.endVal = Number(endVal);
3910        self.countDown = (self.startVal > self.endVal);
3911        self.frameVal = self.startVal;
3912        self.decimals = Math.max(0, decimals || 0);
3913        self.dec = Math.pow(10, self.decimals);
3914        self.duration = Number(duration) * 1000 || 2000;
3915
3916        self.formatNumber = function (nStr) {
3917            nStr = nStr.toFixed(self.decimals);
3918            nStr += '';
3919            var x, x1, x2, rgx;
3920            x = nStr.split('.');
3921            x1 = x[0];
3922            x2 = x.length > 1 ? self.options.decimal + x[1] : '';
3923            rgx = /(\d+)(\d{3})/;
3924            if (self.options.useGrouping) {
3925                while (rgx.test(x1)) {
3926                    x1 = x1.replace(rgx, '$1' + self.options.separator + '$2');
3927                }
3928            }
3929            return self.options.prefix + x1 + x2 + self.options.suffix;
3930        };
3931        // Robert Penner's easeOutExpo
3932        self.easeOutExpo = function (t, b, c, d) {
3933            return c * (-Math.pow(2, -10 * t / d) + 1) * 1024 / 1023 + b;
3934        };
3935
3936        self.easingFn = self.options.easingFn ? self.options.easingFn : self.easeOutExpo;
3937        self.formattingFn = self.options.formattingFn ? self.options.formattingFn : self.formatNumber;
3938
3939        self.version = function () {
3940            return '1.7.1';
3941        };
3942
3943        // Print value to target
3944        self.printValue = function (value) {
3945            var result = self.formattingFn(value);
3946
3947            if (self.d.tagName === 'INPUT') {
3948                this.d.value = result;
3949            } else if (self.d.tagName === 'text' || self.d.tagName === 'tspan') {
3950                this.d.textContent = result;
3951            } else {
3952                this.d.innerHTML = result;
3953            }
3954        };
3955
3956        self.count = function (timestamp) {
3957
3958            if (!self.startTime) {
3959                self.startTime = timestamp;
3960            }
3961
3962            self.timestamp = timestamp;
3963            var progress = timestamp - self.startTime;
3964            self.remaining = self.duration - progress;
3965
3966            // To ease or not to ease
3967            if (self.options.useEasing) {
3968                if (self.countDown) {
3969                    self.frameVal = self.startVal - self.easingFn(progress, 0, self.startVal - self.endVal, self.duration);
3970                } else {
3971                    self.frameVal = self.easingFn(progress, self.startVal, self.endVal - self.startVal, self.duration);
3972                }
3973            } else {
3974                if (self.countDown) {
3975                    self.frameVal = self.startVal - ((self.startVal - self.endVal) * (progress / self.duration));
3976                } else {
3977                    self.frameVal = self.startVal + (self.endVal - self.startVal) * (progress / self.duration);
3978                }
3979            }
3980
3981            // Don't go past endVal since progress can exceed duration in the last frame
3982            if (self.countDown) {
3983                self.frameVal = (self.frameVal < self.endVal) ? self.endVal : self.frameVal;
3984            } else {
3985                self.frameVal = (self.frameVal > self.endVal) ? self.endVal : self.frameVal;
3986            }
3987
3988            // Decimal
3989            self.frameVal = Math.round(self.frameVal * self.dec) / self.dec;
3990
3991            // Format and print value
3992            self.printValue(self.frameVal);
3993
3994            // Whether to continue
3995            if (progress < self.duration) {
3996                self.rAF = requestAnimationFrame(self.count);
3997            } else {
3998                if (self.callback) {
3999                    self.callback();
4000                }
4001            }
4002        };
4003        // Start animation
4004        self.start = function (callback) {
4005            self.callback = callback;
4006            self.rAF = requestAnimationFrame(self.count);
4007            return false;
4008        };
4009        // Toggles pause/resume animation
4010        self.pauseResume = function () {
4011            if (!self.paused) {
4012                self.paused = true;
4013                cancelAnimationFrame(self.rAF);
4014            } else {
4015                self.paused = false;
4016                delete self.startTime;
4017                self.duration = self.remaining;
4018                self.startVal = self.frameVal;
4019                requestAnimationFrame(self.count);
4020            }
4021        };
4022        // Reset to startVal so animation can be run again
4023        self.reset = function () {
4024            self.paused = false;
4025            delete self.startTime;
4026            self.startVal = startVal;
4027            cancelAnimationFrame(self.rAF);
4028            self.printValue(self.startVal);
4029        };
4030        // Pass a new endVal and start animation
4031        self.update = function (newEndVal) {
4032            cancelAnimationFrame(self.rAF);
4033            self.paused = false;
4034            delete self.startTime;
4035            self.startVal = self.frameVal;
4036            self.endVal = Number(newEndVal);
4037            self.countDown = (self.startVal > self.endVal);
4038            self.rAF = requestAnimationFrame(self.count);
4039        };
4040
4041        // Format startVal on initialization
4042        self.printValue(self.startVal);
4043    };
4044
4045    var easeOutCubic = function (t, b, c, d) {
4046        return c * ((t = t / d - 1) * t * t + 1) + b;
4047    };
4048
4049
4050    /**
4051     * Create styles
4052     *
4053     * @since 10.5
4054     */
4055    function nectarCreateStyle(styles, name) {
4056
4057        if (styles.length > 0) {
4058
4059            var head = document.head || document.getElementsByTagName('head')[0];
4060            var style = document.createElement('style');
4061
4062            style.type = 'text/css';
4063            if (style.styleSheet) {
4064                style.styleSheet.cssText = styles;
4065            } else {
4066                style.appendChild(document.createTextNode(styles));
4067            }
4068
4069            $(style).attr('id', name);
4070            $('head').find('#' + name).remove();
4071            head.appendChild(style);
4072
4073        }
4074
4075    }
4076
4077
4078    /**
4079     * FancyBox lightbox.
4080     *
4081     * @since 8.0
4082     */
4083    function fancyBoxInit() {
4084
4085        // Convert prettyPhoto links
4086        $('a.pp')
4087            .removeClass('pp')
4088            .attr('data-fancybox', '');
4089
4090        $("a[rel^='prettyPhoto']:not([rel*='_gal']):not([rel*='product-gallery']):not([rel*='prettyPhoto['])")
4091            .removeAttr('rel')
4092            .attr('data-fancybox', '');
4093
4094        var $unique_id = uniqueIdGenerate();
4095
4096        // Image gallery nectar.
4097        $('.wpb_gallery .wpb_gallery_slidesnectarslider_style').each(function () {
4098            $unique_id = uniqueIdGenerate();
4099            $(this).find('.swiper-slide a:not(.ext-url-link)').attr('data-fancybox', 'group_' + $unique_id);
4100        });
4101
4102        // Flexslider.
4103        $('.wpb_gallery_slides.wpb_flexslider:not([data-onclick="custom_link"])').each(function () {
4104            $unique_id = uniqueIdGenerate();
4105            $(this).find('.slides > li > a').attr('data-fancybox', 'group_' + $unique_id);
4106        });
4107
4108        // Touch enabled gallery.
4109        $('.wpb_gallery_slidesflickity_style, .wpb_gallery_slidesflickity_static_height_style').each(function () {
4110            $unique_id = uniqueIdGenerate();
4111            $(this).find('.cell > a:not(.ext-url-link)').attr('data-fancybox', 'group_' + $unique_id);
4112        });
4113
4114        // Add galleries to portfolios.
4115        $('.portfolio-items, .wpb_gallery_slidesparallax_image_grid, .nectar-post-grid-item').each(function () {
4116            $unique_id = uniqueIdGenerate();
4117            if ($(this).find('.pretty_photo').length > 0) {
4118
4119                $(this).find('.pretty_photo')
4120                    .removeClass('pretty_photo')
4121                    .attr('data-fancybox', 'group_' + $unique_id);
4122
4123            } else if ($(this).find('a[rel*="prettyPhoto["]').length > 0) {
4124
4125                $(this).find('a[rel*="prettyPhoto["]')
4126                    .removeAttr('rel')
4127                    .attr('data-fancybox', 'group_' + $unique_id);
4128            }
4129
4130        });
4131
4132        // Nectar auto lightbox theme option.
4133        if ($body.hasClass('nectar-auto-lightbox')) {
4134
4135            $('.gallery').each(function () {
4136                if ($(this).find('.gallery-icon a[rel^="prettyPhoto"]').length == 0) {
4137                    var $unique_id = uniqueIdGenerate();
4138                    $(this).find('.gallery-item .gallery-icon a[href*=".jpg"], .gallery-item .gallery-icon a[href*=".png"], .gallery-item .gallery-icon a[href*=".gif"], .gallery-item .gallery-icon a[href*=".jpeg"]')
4139                        .attr('data-fancybox', 'group_' + $unique_id)
4140                        .removeClass('pretty_photo');
4141                }
4142            });
4143
4144            $('.wp-block-gallery').each(function () {
4145                var $unique_id = uniqueIdGenerate();
4146                $(this).find('.wp-block-image a[href*=".jpg"], .wp-block-image a[href*=".png"], .wp-block-image a[href*=".gif"], .wp-block-image a[href*=".jpeg"], .wp-block-image a[href*=".
4146webp"]')
4147                    .attr('data-fancybox', 'group_' + $unique_id)
4148                    .removeClass('pretty_photo');
4149            });
4150
4151            $('.main-content img').each(function () {
4152
4153                if ($(this).parent().is("[href]") &&
4154                    !$(this).parent().is(".magnific-popup") &&
4155                    $(this).parents('.tiled-gallery').length == 0 &&
4156                    $(this).parents('.product-image').length == 0 &&
4157                    $(this).parents('.gallery-icon').length == 0 &&
4158                    $(this).parents('.wp-block-gallery').length == 0 &&
4159                    $(this).parents('.woocommerce-product-gallery').length == 0 &&
4160                    $(this).parents('.wpb_gallery_slides.wpb_flexslider').length == 0 &&
4161                    $(this).parents('.iosSlider.product-slider').length == 0) {
4162
4163                    var match = $(this).parent().attr('href').match(/\.(jpg|png|gif)\b/);
4164                    if (match) {
4165                        $(this).parent().attr('data-fancybox', '');
4166                    }
4167                }
4168            });
4169        }
4170
4171        // Regular.
4172        var fbMarginArr = ($('body.admin-bar').length > 0) ? [60, 100] : [60, 100];
4173        if (nectarDOMInfo.winW < 1000) {
4174            fbMarginArr = [0, 0];
4175        }
4176        $("[data-fancybox]").fancybox({
4177            animationEffect: "zoom-in-out",
4178            animationDuration: 350,
4179            buttons: [
4180                'fullScreen',
4181                'zoom',
4182                'close'
4183            ],
4184            margin: fbMarginArr,
4185            backFocus: false,
4186            loop: true,
4187            caption: function () {
4188                return $(this).attr('title');
4189            },
4190            hash: false,
4191            beforeLoad: function (instance) {
4192
4193                if (typeof instance.current.src !== 'string') {
4194                    $.fancybox.close(true);
4195                }
4196
4197            },
4198            mobile: {
4199                margin: 0
4200            }
4201        });
4202    }
4203
4204    /**
4205     * Magnific lightbox.
4206     *
4207     * @since 6.0
4208     */
4209    function magnificInit() {
4210
4211        // Convert old pp links
4212        $('a.pp')
4213            .removeClass('pp')
4214            .addClass('magnific-popup');
4215
4216        $("a[rel^='prettyPhoto']:not([rel*='_gal']):not([rel*='product-gallery']):not([rel*='prettyPhoto['])")
4217            .removeAttr('rel')
4218            .addClass('magnific-popup');
4219
4220        // Image gallery nectar.
4221        $('.wpb_gallery .wpb_gallery_slidesnectarslider_style').each(function () {
4222            $(this).find('.swiper-slide a:not(.ext-url-link)').addClass('pretty_photo');
4223        });
4224
4225        // Flexslider.
4226        $('.wpb_gallery_slides.wpb_flexslider:not([data-onclick="custom_link"])').each(function () {
4227            $(this).find('.slides > li > a').addClass('pretty_photo');
4228        });
4229
4230        // Touch enabled gallery.
4231        $('.wpb_gallery_slidesflickity_style, .wpb_gallery_slidesflickity_static_height_style').each(function () {
4232            $(this).find('.cell > a:not(.ext-url-link)').addClass('pretty_photo');
4233        });
4234
4235        // Add galleries to portfolios.
4236        $('.portfolio-items, .wpb_gallery .swiper-slide, .wpb_gallery_slidesflickity_style .cell, .wpb_gallery_slidesflickity_static_height_style .cell, .wpb_gallery_slides.wpb_flexslider ul > li, .wpb_gallery .parallax-grid-item, .nectar-post-grid-item').each(function () {
4237
4238            if ($(this).find('.pretty_photo').length > 0) {
4239
4240                $(this)
4241                    .find('.pretty_photo')
4242                    .removeClass('pretty_photo')
4243                    .addClass('gallery')
4244                    .addClass('magnific');
4245
4246            } else if ($(this).find('a[rel*="prettyPhoto["]').length > 0) {
4247
4248                $(this)
4249                    .find('a[rel*="prettyPhoto["]')
4250                    .removeAttr('rel')
4251                    .addClass('gallery')
4252                    .addClass('magnific');
4253            }
4254
4255        });
4256
4257        $("a[data-rel='prettyPhoto[product-gallery]']").each(function () {
4258            $(this)
4259                .removeAttr('data-rel')
4260                .addClass('magnific')
4261                .addClass('gallery');
4262        });
4263
4264        // Nectar auto lightbox theme option.
4265        if ($body.hasClass('nectar-auto-lightbox')) {
4266            $('.gallery').each(function () {
4267                if ($(this).find('.gallery-icon a[rel^="prettyPhoto"]').length == 0) {
4268
4269                    $(this).find('.gallery-item .gallery-icon a[href*=".jpg"], .gallery-item .gallery-icon a[href*=".png"], .gallery-item .gallery-icon a[href*=".gif"], .gallery-item .gallery-icon a[href*=".jpeg"]')
4270                        .addClass('magnific')
4271                        .addClass('gallery')
4272                        .removeClass('pretty_photo');
4273                }
4274            });
4275
4276            $('.main-content img').each(function () {
4277
4278                if ($(this).parent().is("[href]") &&
4279                    !$(this).parent().is(".magnific-popup") &&
4280                    $(this).parents('.tiled-gallery').length == 0 &&
4281                    $(this).parents('.product-image').length == 0 &&
4282                    $(this).parents('.iosSlider.product-slider').length == 0) {
4283
4284                    var match = $(this).parent().attr('href').match(/\.(jpg|png|gif)\b/);
4285                    if (match) {
4286
4287                        $(this).parent()
4288                            .addClass('magnific-popup')
4289                            .addClass('image-link');
4290                    }
4291                }
4292
4293            });
4294
4295        }
4296
4297
4298        // Regular.
4299        $('a.magnific-popup:not(.gallery):not(.nectar_video_lightbox):not(.nectar_video_lightbox_trigger)').magnificPopup({
4300            type: 'image',
4301            callbacks: {
4302                imageLoadComplete: function () {
4303                    var $that = this;
4304                    setTimeout(function () {
4305                        $that.wrap.addClass('mfp-image-loaded');
4306                    }, 10);
4307                },
4308                beforeOpen: function () {
4309                    this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim');
4310                },
4311                open: function () {
4312
4313                    $.magnificPopup.instance.next = function () {
4314                        var $that = this;
4315
4316                        this.wrap.removeClass('mfp-image-loaded');
4317                        setTimeout(function () {
4318                            $.magnificPopup.proto.next.call($that);
4319                        }, 100);
4320                    };
4321
4322                    $.magnificPopup.instance.prev = function () {
4323                        var $that = this;
4324
4325                        this.wrap.removeClass('mfp-image-loaded');
4326                        setTimeout(function () {
4327                            $.magnificPopup.proto.prev.call($that);
4328                        }, 100);
4329                    };
4330
4331                }
4332            },
4333            fixedContentPos: false,
4334            mainClass: 'mfp-zoom-in',
4335            removalDelay: 400
4336        });
4337
4338        // Video.
4339        $('a.magnific-popup.nectar_video_lightbox, .nectar_video_lightbox_trigger, .magnific_nectar_video_lightbox a.link_text, .swiper-slide a[href*=youtube], .swiper-slide a[href*=vimeo], .nectar-video-box a.full-link.magnific-popup').magnificPopup({
4340            type: 'iframe',
4341            fixedContentPos: false,
4342            mainClass: 'mfp-zoom-in',
4343            removalDelay: 400
4344        });
4345
4346
4347        // Galleries.
4348        $('a.magnific.gallery').each(function () {
4349
4350            var $parentRow = ($(this).closest('.wpb_column').length > 0) ? $(this).closest('.wpb_column') : $(this).parents('.row');
4351
4352            if ($parentRow.length > 0 && !$parentRow.hasClass('lightbox-col')) {
4353
4354                $parentRow.magnificPopup({
4355                    type: 'image',
4356                    delegate: 'a.magnific',
4357                    mainClass: 'mfp-zoom-in',
4358                    fixedContentPos: false,
4359                    callbacks: {
4360
4361                        elementParse: function (item) {
4362
4363                            if ($(item.el).is('[href]') && $(item.el).attr('href').indexOf('iframe=true') != -1 ||
4364                                $(item.el).is('[href]') && $(item.el).attr('href').indexOf('https://www.youtube.com/watch') != -1) {
4365                                item.type = 'iframe';
4366                            } else if ($(item.el).is('[href]') && $(item.el).attr('href').indexOf('video-popup-') != -1) {
4367                                item.type = 'inline';
4368                            } else {
4369                                item.type = 'image';
4370                            }
4371                        },
4372
4373                        imageLoadComplete: function () {
4374                            var $that = this;
4375                            setTimeout(function () {
4376                                $that.wrap.addClass('mfp-image-loaded');
4377                            }, 10);
4378                        },
4379
4380                        beforeOpen: function () {
4381                            this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim');
4382                        },
4383
4384                        open: function () {
4385
4386                            // Self hosted video.
4387                            if ($(this.content).find('.mejs-video video').length > 0 && $().mediaelementplayer) {
4388                                $(this.content).find('.mejs-video video')[0].player.remove();
4389
4390                                var $that = this;
4391                                setTimeout(function () {
4392                                    $($that.content).find('video').mediaelementplayer();
4393                                    $($that.content).find('.mejs-video video')[0].player.play();
4394                                }, 50);
4395
4396                            }
4397
4398                            $.magnificPopup.instance.next = function () {
4399                                var $that = this;
4400
4401                                this.wrap.removeClass('mfp-image-loaded');
4402                                setTimeout(function () {
4403                                    $.magnificPopup.proto.next.call($that);
4404
4405                                    // Self hosted video.
4406                                    if ($($that.content).find('.mejs-video video').length > 0) {
4407                                        $($that.content).find('.mejs-video video')[0].play();
4408                                    }
4409
4410                                }, 100);
4411                            };
4412
4413                            $.magnificPopup.instance.prev = function () {
4414                                var $that = this;
4415
4416                                this.wrap.removeClass('mfp-image-loaded');
4417                                setTimeout(function () {
4418                                    $.magnificPopup.proto.prev.call($that);
4419
4420                                    // Self hosted video.
4421                                    if ($($that.content).find('.mejs-video video').length > 0) {
4422                                        $($that.content).find('.mejs-video video')[0].play();
4423                                    }
4424                                }, 100);
4425                            };
4426
4427                        },
4428
4429                        close: function () {
4430                            // Self hosted video.
4431                            if ($(this.content).find('.mejs-video video').length > 0) {
4432                                $(this.content).find('.mejs-video video')[0].load();
4433                            }
4434                        }
4435                    },
4436                    removalDelay: 400,
4437                    gallery: {
4438                        enabled: true
4439                    }
4440                });
4441
4442                $parentRow.addClass('lightbox-col');
4443            }
4444
4445        });
4446
4447    }
4448
4449
4450    /**
4451     * Lightbox initialization.
4452     *
4453     * Determines which lightbox to use based on theme option.
4454     *
4455     * @since 8.0
4456     */
4457    function lightBoxInit() {
4458
4459        setTimeout(function () {
4460            if ($('body[data-ls="magnific"]').length > 0 || $('body[data-ls="pretty_photo"]').length > 0) {
4461                magnificInit();
4462            } else if ($('body[data-ls="fancybox"]').length > 0) {
4463                if ($().fancybox) {
4464                    fancyBoxInit();
4465                } else {
4466                    setTimeout(fancyBoxInit, 200);
4467                }
4468            }
4469        }, 60);
4470
4471    }
4472
4473
4474    /**
4475     * WPBakery page builder standard animations.
4476     *
4477     * @since 7.0
4478     * @see waypoints
4479     */
4480    function vcWaypoints() {
4481
4482        $($fullscreenSelector + ' .wpb_animate_when_almost_visible').each(function () {
4483
4484            var $that = $(this),
4485                $vcOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : '90%',
4486                waypoint = new Waypoint({
4487                    element: $that[0],
4488                    handler: function () {
4489
4490                        if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated')) {
4491                            waypoint.destroy();
4492                            return;
4493                        }
4494
4495                        $that.addClass("animated");
4496                        $that.addClass("wpb_start_animation");
4497                        waypoint.destroy();
4498
4499                        if ($that.is('.nectar-button') && $('body[data-button-style*="rounded_shadow"]').length > 0) {
4500                            setTimeout(function () {
4501                                $that.removeClass('wpb_start_animation');
4502                            }, 1100);
4503                        }
4504
4505                    },
4506                    offset: $vcOffsetPos
4507
4508                });
4509
4510        });
4511    }
4512
4513
4514    /**
4515     * Nectar Rotating Words Title
4516     *
4517     * @since 13.0
4518     */
4519    function NectarRotatingWords(el, dur) {
4520
4521        this.$el = el;
4522        this.duration = dur;
4523
4524        this.interval = '';
4525        this.words = [];
4526
4527        this.state = {
4528            activeIndex: 0,
4529            sequenceStarted: 0,
4530            visible: false
4531        };
4532
4533        this.setup();
4534
4535    }
4536
4537    NectarRotatingWords.prototype.setup = function () {
4538
4539        var that = this;
4540
4541        this.$el.find('.dynamic-words > span').each(function (i) {
4542            that.words[i] = $(this);
4543        });
4544
4545        // In View.
4546        this.viewportTracking();
4547
4548        // Waypoint.
4549        if (this.$el.hasClass('element_stagger_words') && !this.$el.hasClass('delay-js-loaded')) {
4550            this.staggerWaypoint();
4551            $(window).on('nectar-waypoints-reinit nectar-tab-changed', this.staggerWaypoint.bind(this));
4552        } else {
4553            // Start sequence immediately.
4554            clearInterval(this.interval);
4555
4556            this.interval = setInterval(this.sequence.bind(this), this.duration);
4557        }
4558
4559        if (!nectarDOMInfo.usingMobileBrowser) {
4560            $(window).on('resize', this.calcWidth.bind(this));
4561        } else {
4562            window.addEventListener("orientationchange", this.calcWidth.bind(this));
4563        }
4564
4565    };
4566
4567    NectarRotatingWords.prototype.viewportTracking = function () {
4568
4569        var that = this;
4570
4571        if ('IntersectionObserver' in window) {
4572
4573            var options = {
4574                rootMargin: '0px',
4575                threshold: 0
4576            }
4577
4578            this.observer = new IntersectionObserver(function (entries) {
4579
4580                entries.forEach(function (entry) {
4581                    if (entry.isIntersecting) {
4582                        that.state.visible = true;
4583                    } else {
4584                        that.state.visible = false;
4585                    }
4586                });
4587
4588            }, options);
4589
4590            this.observer.observe(this.$el[0]);
4591
4592
4593        } else {
4594            // fallback.
4595            this.state.visible = true;
4596        }
4597
4598    }
4599
4600    NectarRotatingWords.prototype.calcWidth = function () {
4601
4602        var that = this;
4603        var storedWidth = this.$el.find('.dynamic-words').width();
4604
4605        this.$el.find('.dynamic-words').css({'width': ''});
4606
4607        var width = this.words[this.state.activeIndex].find('span').width();
4608
4609        this.$el.find('.dynamic-words').css({
4610            'width': storedWidth
4611        });
4612
4613        setTimeout(function () {
4614            that.$el.find('.dynamic-words').css({
4615                'width': width
4616            });
4617        }, 30);
4618
4619    }
4620
4621    NectarRotatingWords.prototype.sequence = function () {
4622
4623        if (this.$el.find('.dynamic-words > span').length < 2 || this.state.visible == false) {
4624            return true;
4625        }
4626
4627        this.state.activeIndex = wrap(this.words.length, this.state.activeIndex + 1);
4628
4629        this.calcWidth();
4630
4631        this.$el.find('.dynamic-words > span').removeClass('active');
4632
4633        this.words[this.state.activeIndex].addClass('active');
4634
4635    };
4636
4637    NectarRotatingWords.prototype.staggerWaypoint = function () {
4638
4639        var that = this;
4640
4641        if ($fullscreenMarkupBool == true && this.$el.parents('.active').length == 0) {
4642            return true;
4643        }
4644
4645        // Generate Markup
4646        var animatedClass = ($(this).hasClass('animated-in')) ? ' animated' : '';
4647
4648        this.$el.find('.beginning-text, .ending-text').each(function () {
4649
4650            var textArr = $(this).text();
4651            textArr = textArr.trim();
4652            textArr = textArr.split(' ');
4653
4654            $(this)[0].innerHTML = '';
4655
4656            for (var i = 0; i < textArr.length; i++) {
4657                $(this)[0].innerHTML += '<span class="text-wrap"><span class="inner' + animatedClass + '">' + textArr[i] + '</span></span> ';
4658            }
4659
4660        });
4661
4662        if (this.$el.hasClass('animated-in')) {
4663            this.$el.find('.beginning-text .inner, .ending-text .inner').css({
4664                'transform': 'translateY(0)'
4665            });
4666        }
4667
4668        this.$el.addClass('markup-generated');
4669
4670        // Waypoint.
4671        var offsetPos = ($fullscreenMarkupBool == true) ? '500%' : 'bottom-in-view';
4672
4673        var $that = this.$el;
4674        var $delay = ($that.is('[data-delay]')) ? parseInt($that.attr('data-delay')) : 0;
4675
4676        var waypoint = new Waypoint({
4677            element: $that[0],
4678            handler: function () {
4679
4680                if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) {
4681                    waypoint.destroy();
4682                    return;
4683                }
4684
4685                if (!bypassAnimations || $('body[data-responsive="0"]').length > 0) {
4686
4687                    var $animationDurationCap;
4688
4689                    setTimeout(function () {
4690
4691                        var stagger = 0;
4692                        stagger = 500 / $that.find('.text-wrap').length;
4693                        stagger = Math.min(Math.max(stagger, 15), 50); // Clamp val
4694
4695                        $animationDurationCap = (parseInt($animationDuration) < 1100) ? $animationDuration : '1100';
4696
4697                        var i = 0;
4698                        $that.find('.text-wrap').each(function () {
4699
4700                            var spanEl = $(this);
4701
4702                            if ($(this).parents('.dynamic-words').length > 0 && !$(this).hasClass('active')) {
4703                                // hidden words in sequence.
4704                                spanEl.find('> span').css({
4705                                    'transform': 'translate3d(0,0,0)'
4706                                });
4707                                return true;
4708                            }
4709
4710                            // visible words.
4711                            setTimeout(function () {
4712                                spanEl.find('> span').css({
4713                                    'transform': 'translate3d(0,
47130,0)'
4714                                });
4715                            }, i * stagger);
4716
4717                            i++;
4718
4719                        });
4720
4721                        $that.addClass('animated-in');
4722
4723                    }, $delay);
4724
4725                }
4726
4727
4728                // start sequence.
4729                if (that.state.sequenceStarted != true) {
4730                    clearInterval(that.interval);
4731                    that.interval = setInterval(that.sequence.bind(that), that.duration);
4732                }
4733
4734                that.state.sequenceStarted = true;
4735
4736                waypoint.destroy();
4737            },
4738            offset: offsetPos
4739        });
4740
4741
4742    }
4743
4744
4745    function nectarRotatingWordsInit() {
4746
4747        // Clear existing.
4748        if (rotatingTitles.length > 0) {
4749            for (var i = 0; i < rotatingTitles.length; i++) {
4750                clearInterval(rotatingTitles[i].interval);
4751            }
4752        }
4753
4754        rotatingTitles = [];
4755
4756        $('.nectar-rotating-words-title').each(function (i) {
4757            var duration = parseInt($(this).attr('data-rotation'));
4758            rotatingTitles[i] = new NectarRotatingWords($(this), duration);
4759        });
4760
4761    }
4762
4763
4764    /**
4765     * Milestone element initialization.
4766     *
4767     * @since 4.0
4768     * @see waypoints
4769     */
4770    function milestoneInit() {
4771
4772        $('.nectar-milestone').each(function () {
4773
4774            // Symbol
4775            if ($(this).is('[data-symbol]')) {
4776
4777                if ($(this).find('.symbol-wrap').length == 0) {
4778
4779                    if ($(this).attr('data-symbol-pos') == 'before') {
4780                        $(this)
4781                            .find('.number')
4782                            .prepend('<div class="symbol-wrap"><span class="symbol">' + wlEls($(this).attr('data-symbol')) + '</span></div>');
4783                    } else {
4784                        $(this)
4785                            .find('.number')
4786                            .append('<div class="symbol-wrap"><span class="symbol">' + wlEls($(this).attr('data-symbol')) + '</span></div>');
4787                    }
4788                }
4789
4790                var $symbol_size;
4791
4792                if ($(this).attr('data-symbol-size') == $(this).find('.number').attr('data-number-size') && $(this).attr('data-symbol-alignment') == 'superscript') {
4793                    $symbol_size = 32;
4794                } else {
4795                    $symbol_size = parseInt($(this).attr('data-symbol-size'));
4796                }
4797
4798                $(this).find('.symbol-wrap').css({
4799                    'font-size': $symbol_size + 'px',
4800                    'line-height': $symbol_size + 'px'
4801                });
4802            }
4803
4804            $(this).find('.number').css({
4805                'font-size': $(this).find('.number').attr('data-number-size') + 'px',
4806                'line-height': $(this).find('.number').attr('data-number-size') + 'px'
4807            });
4808        });
4809
4810        if (!bypassAnimations && $('.nectar-milestone').length > 0 || $body.hasClass('rtl') && $('.nectar-milestone').length > 0) {
4811
4812            // Blur effect
4813            var $blurCssString = '';
4814            $($fullscreenSelector + '.nectar-milestone.motion_blur').each(function (i) {
4815
4816                $(this).removeClass(function (index, className) {
4817                    return (className.match(/(^|\s)instance-\S+/g) || []).join(' ');
4818                });
4819
4820                $(this).addClass('instance-' + i);
4821
4822                var $currentColor = $(this).find('.number').css('color'),
4823                    colorInt = parseInt($currentColor.substring(1), 16);
4824
4825                var R = (colorInt & 0xFF0000) >> 16,
4826                    G = (colorInt & 0x00FF00) >> 8,
4827                    B = (colorInt & 0x0000FF) >> 0;
4828
4829                var $rgbaColorStart = 'rgba(' + R + ',' + G + ',' + B + ',0.2)',
4830                    $rgbaColorEnd = 'rgba(' + R + ',' + G + ',' + B + ',1)',
4831                    $numberSize = parseInt($(this).find('.number').attr('data-number-size'));
4832
4833                $blurCssString += '@keyframes motion-blur-number-' + i + ' { ' +
4834                    ' 0% { ' +
4835                    'opacity: 0;' +
4836                    'color: ' + $rgbaColorStart + '; ' +
4837                    'text-shadow: 0 ' + $numberSize / 20 + 'px 0 ' + $rgbaColorStart + ', 0 ' + $numberSize / 10 + 'px 0 ' + $rgbaColorStart + ', 0 ' + $numberSize / 6 + 'px 0 ' + $rgbaColorStart + ', 0 ' + $numberSize / 5 + 'px 0 ' + $rgbaColorStart + ', 0 ' + $numberSize / 4 + 'px 0 ' + $rgbaColorStart + ', 0 -' + $numberSize / 20 + 'px 0 ' + $rgbaColorStart + ', 0 -' + $numberSize / 10 + 'px 0 ' + $rgbaColorStart + ', 0 -' + $numberSize / 6 + 'px 0 ' + $rgbaColorStart + ', 0 -' + $numberSize / 5 + 'px 0 ' + $rgbaColorStart + ', 0 -' + $numberSize / 4 + 'px 0 ' + $rgbaColorStart + '; ' +
4838                    'transform: translateZ(0px) translateY(-100%); ' +
4839                    '-webkit-transform: translateZ(0px) translateY(-100%); ' +
4840                    '} ' +
4841                    '33% { opacity: 1 }' +
4842                    '100% { ' +
4843                    'color: ' + $rgbaColorEnd + '; ' +
4844                    'text-shadow: none; ' +
4845                    'transform: translateZ(0px) translateY(0px); ' +
4846                    '-webkit-transform: translateZ(0px) translateY(0px); ' +
4847                    '} ' +
4848                    '} ' +
4849                    '@-webkit-keyframes motion-blur-number-' + i + ' { ' +
4850                    ' 0% { ' +
4851                    'opacity: 0;' +
4852                    'color: ' + $rgbaColorStart + '; ' +
4853                    'text-shadow: 0 ' + $numberSize / 20 + 'px 0 ' + $rgbaColorStart + ', 0 ' + $numberSize / 10 + 'px 0 ' + $rgbaColorStart + ', 0 ' + $numberSize / 6 + 'px 0 ' + $rgbaColorStart + ', 0 ' + $numberSize / 5 + 'px 0 ' + $rgbaColorStart + ', 0 ' + $numberSize / 4 + 'px 0 ' + $rgbaColorStart + ', 0 -' + $numberSize / 20 + 'px 0 ' + $rgbaColorStart + ', 0 -' + $numberSize / 10 + 'px 0 ' + $rgbaColorStart + ', 0 -' + $numberSize / 6 + 'px 0 ' + $rgbaColorStart + ', 0 -' + $numberSize / 5 + 'px 0 ' + $rgbaColorStart + ', 0 -' + $numberSize / 4 + 'px 0 ' + $rgbaColorStart + '; ' +
4854                    'transform: translateZ(0px) translateY(-100%); ' +
4855                    '-webkit-transform: translateZ(0px) translateY(-100%); ' +
4856                    '} ' +
4857                    '33% { opacity: 1 }' +
4858                    '100% { ' +
4859                    'color: ' + $rgbaColorEnd + '; ' +
4860                    'text-shadow: none; ' +
4861                    'transform: translateZ(0px) translateY(0px); ' +
4862                    '-webkit-transform: translateZ(0px) translateY(0px); ' +
4863                    '} ' +
4864                    '} ' +
4865                    '.nectar-milestone.motion_blur.instance-' + i + ' .number span.in-sight { animation: 0.65s cubic-bezier(0, 0, 0.17, 1) 0s normal backwards 1 motion-blur-number-' + i + '; -webkit-animation: 0.65s cubic-bezier(0, 0, 0.17, 1) 0s normal backwards 1 motion-blur-number-' + i + '; } ';
4866
4867                if ($nectarFullPage.$usingFullScreenRows != false || $(this).find('.number > span').length == 0) {
4868
4869                    // Separate each character into spans
4870                    var $symbol = $(this).find('.symbol-wrap').clone();
4871                    $(this).find('.symbol-wrap').remove();
4872
4873                    var characters = $(this).find('.number').text().split("");
4874                    var $this = $(this).find('.milestone-heading').length > 0 ? $(this).find('.milestone-heading') : $(this).find('.number');
4875
4876                    $this.empty();
4877                    $.each(characters, function (i, el) {
4878                        $this.append("<span>" + el + "</span");
4879                    });
4880
4881                    // Handle symbol
4882                    if ($(this).has('[data-symbol]')) {
4883                        if ($(this).attr('data-symbol-pos') == 'after') {
4884                            $this.append($symbol);
4885                        } else {
4886                            $this.prepend($symbol);
4887                        }
4888                    }
4889
4890                } // already made markup
4891
4892            });
4893
4894            // Style
4895            nectarCreateStyle($blurCssString, 'milestone-blur');
4896
4897            // Activate
4898            milestoneWaypoint();
4899
4900        }
4901
4902    }
4903
4904
4905    /**
4906     * Milestone animation
4907     *
4908     * @since 4.0
4909     */
4910    function milestoneWaypoint() {
4911
4912        $($fullscreenSelector + '.nectar-milestone').each(function () {
4913
4914            // Animation
4915            var $offset = ($fullscreenMarkupBool == true) ? '250%' : '98%';
4916
4917            if (nectarDOMInfo.usingMobileBrowser && $offset == '98%') {
4918                $offset = '110%';
4919            }
4920
4921            var $animationDelay = 0;
4922
4923            if ($(this).is('[data-animation-delay]') &&
4924                $(this).attr('data-animation-delay').length > 0 &&
4925                $(this).attr('data-animation') != 'false') {
4926                $animationDelay = $(this).attr('data-animation-delay');
4927            }
4928
4929            var $that = $(this),
4930                waypoint = new Waypoint({
4931                    element: $that[0],
4932                    handler: function () {
4933
4934                        if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) {
4935                            waypoint.destroy();
4936                            return;
4937                        }
4938
4939                        var $endNum = $that.find('.number span:not(.symbol)').text().replace(/,/g, '');
4940                        var decimalPlaces = 0;
4941                        if ($endNum.toString().indexOf('.') !== -1) {
4942                            decimalPlaces = 2;
4943
4944                            var userDecimals = $endNum.toString().split('.')[1].length;
4945                            if (userDecimals > 2 && userDecimals < 5) {
4946                                decimalPlaces = userDecimals;
4947                            }
4948
4949                        }
4950                        $endNum = parseFloat($endNum);
4951
4952                        setTimeout(function () {
4953
4954                            if (!$that.hasClass('motion_blur')) {
4955
4956                                var countOptions = {
4957                                    easingFn: easeOutCubic
4958                                };
4959
4960
4961                                var $countEle = $that.find('.number span:not(.symbol)')[0];
4962                                var numAnim = new CountUp($countEle, 0, $endNum, decimalPlaces, 2.2, countOptions);
4963                                numAnim.start();
4964
4965                            } else {
4966                                $that.find('span').each(function (i) {
4967                                    var $that = $(this);
4968                                    setTimeout(function () {
4969                                        $that.addClass('in-sight');
4970                                    }, 200 * i);
4971                                });
4972                            }
4973
4974                            $that.addClass('animated-in');
4975
4976                        }, $animationDelay);
4977
4978                        waypoint.destroy();
4979                    },
4980                    offset: $offset
4981
4982                });
4983
4984        });
4985    }
4986
4987
4988    /**
4989     * Tabbed element change section event.
4990     *
4991     * @since 10.5
4992     */
4993    function tabbedChangeSection(clickedTab) {
4994
4995        var $id = clickedTab.parents('li').index() + 1;
4996        var $frontEndEditorTabDiv = ($('body.vc_editor').length > 0) ? '> .wpb_tab ' : '';
4997
4998        // handle toggle button style index
4999        if (clickedTab.closest('.tabbed').length > 0 &&
5000            clickedTab.closest('.tabbed').is('[data-style="toggle_button"]') &&
5001            $id === 3) {
5002            $id = 2;
5003        }
5004
5005        // Change tab
5006        if (!clickedTab.hasClass('active-tab') && !clickedTab.hasClass('loading')) {
5007
5008            clickedTab.parents('ul')
5009                .find('a')
5010                .removeClass('active-tab');
5011            clickedTab.parents('ul')
5012                .find('li')
5013                .removeClass('active-tab');
5014
5015            clickedTab
5016                .addClass('active-tab');
5017            clickedTab.parent().addClass('active-tab');
5018
5019            clickedTab.closest('.tabbed').find('>
5019 div:not(.clear)' + $frontEndEditorTabDiv).css({
5020                'visibility': 'hidden',
5021                'position': 'absolute',
5022                'opacity': '0',
5023                'left': '-9999px',
5024                'display': 'none'
5025            }).removeClass('visible-tab');
5026
5027            var transitionDur = (clickedTab.parents('.tabbed[data-animation="none"]').length > 0) ? 0 : 400;
5028
5029            if ($('body.vc_editor').length > 0) {
5030
5031                var $data_m_id = (clickedTab.parent().is('[data-m-id]')) ? clickedTab.parent().attr('data-m-id') : '';
5032                // handle toggle button style index
5033                if (clickedTab.parents('.tabbed[data-style="toggle_button"]').length > 0 && clickedTab.parents('li').index() + 1 === 3) {
5034                    if (clickedTab.parents('.wpb_tabs_nav').find('.toggle-button[data-m-id]').length > 0) {
5035                        $data_m_id = clickedTab.parents('.wpb_tabs_nav').find('.toggle-button').attr('data-m-id');
5036                    }
5037
5038                }
5039
5040                clickedTab.parents('.tabbed').find('> div[data-model-id="' + $data_m_id + '"]' + $frontEndEditorTabDiv).css({
5041                    'visibility': 'visible',
5042                    'position': 'relative',
5043                    'left': '0',
5044                    'display': 'block'
5045                }).stop().transition({
5046                    'opacity': 1
5047                }, transitionDur).addClass('visible-tab');
5048
5049                if (!$body.is('[data-flex-cols="true"]')) {
5050                    convertFrontEndPadding();
5051                }
5052
5053            } else {
5054
5055
5056                clickedTab.closest('.tabbed').find('> div:nth-of-type(' + $id + ')' + $frontEndEditorTabDiv).css({
5057                    'visibility': 'visible',
5058                    'position': 'relative',
5059                    'left': '0',
5060                    'display': 'block'
5061                }).stop().transition({
5062                    'opacity': 1
5063                }, transitionDur).addClass('visible-tab');
5064            }
5065
5066            var $curTab = clickedTab.closest('.tabbed').find('> div:nth-of-type(' + $id + ')');
5067
5068            if ($curTab.find('.iframe-embed').length > 0 ||
5069                $curTab.find('.portfolio-items').length > 0 ||
5070                $curTab.find('.nectar-video-bg').length > 0) {
5071                setTimeout(function () {
5072                    $window.trigger('resize');
5073                }, 10);
5074            }
5075        }
5076
5077        // Waypoint checking
5078
5079
5080        var $currentVisTab = clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ')' + $frontEndEditorTabDiv);
5081
5082        if ($currentVisTab.find('.nectar-progress-bar').length > 0) {
5083            progressBars();
5084        }
5085
5086        if ($currentVisTab.find('.divider-small-border [data-animate="yes"]').length > 0 ||
5087            $currentVisTab.find('.divider-border [data-animate="yes"]').length > 0) {
5088            dividers();
5089        }
5090
5091        if ($currentVisTab.find('img.img-with-animation').length > 0 ||
5092            $currentVisTab.find('.col.has-animation').length > 0 ||
5093            $currentVisTab.find('.nectar_cascading_images').length > 0 ||
5094            $currentVisTab.find('.wpb_column.has-animation').length > 0) {
5095            colAndImgAnimations();
5096            cascadingImageBGSizing();
5097        }
5098
5099        if ($currentVisTab.find('.parallax-layer').length > 0 ||
5100            $currentVisTab.parents('.nectar-parallax-enabled').length > 0) {
5101            parallaxRowsBGCals();
5102        }
5103        nectarParallaxElRefresh();
5104
5105        if ($currentVisTab.find('.nectar-milestone').length > 0) {
5106            milestoneWaypoint();
5107        }
5108
5109        if ($currentVisTab.find('.nectar_image_with_hotspots[data-animation="true"]').length > 0) {
5110            imageWithHotspots();
5111            setTimeout(function () {
5112                $window.trigger('resize');
5113            }, 100);
5114        }
5115
5116        if ($currentVisTab.find('.nectar-fancy-ul').length > 0) {
5117            nectarFancyUlInit();
5118        }
5119
5120        if ($currentVisTab.find('.nectar-split-heading').length > 0) {
5121            splitLineHeadings();
5122        }
5123        if ($currentVisTab.find('.wpb_column[data-border-animation="true"]').length > 0) {
5124            animatedColBorders();
5125        }
5126        if ($currentVisTab.find('.wpb_animate_when_almost_visible').length > 0) {
5127            vcWaypoints();
5128        }
5129        if ($currentVisTab.find('.nectar-animated-title').length > 0) {
5130            animatedTitles();
5131        }
5132        if ($currentVisTab.find('.nectar-highlighted-text').length > 0) {
5133            highlightedText();
5134        }
5135        if ($currentVisTab.find('.nectar_food_menu_item').length > 0) {
5136            foodMenuItems();
5137        }
5138        if ($currentVisTab.find('.nectar-post-grid:not([data-animation="none"])').length > 0) {
5139            NectarPostGridWaypoint();
5140        }
5141        if ($currentVisTab.find('.nectar-waypoint-el').length > 0) {
5142            generalWaypoints();
5143        }
5144
5145        if (clickedTab.parents('.wpb_row').length > 0) {
5146
5147            if ($currentVisTab.find('.vc_pie_chart').length > 0 ||
5148                $currentVisTab.find('.wp-video-shortcode').length > 0 ||
5149                $currentVisTab.find('.post-area.masonry .posts-container').length > 0 ||
5150                $currentVisTab.find('.twentytwenty-container').length > 0 ||
5151                clickedTab.parents('#nectar_fullscreen_rows[data-content-overflow="scrollbar"]').length > 0 ||
5152                clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ')').find('.wpb_gallery').length > 0 ||
5153                clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ')').find('.swiper-container').length > 0 ||
5154                clickedTab.parents('.wpb_row').next().hasClass('parallax_section')) {
5155                $window.trigger('resize');
5156            }
5157
5158            if ($currentVisTab.find('.nectar-flickity').length > 0 && typeof Flickity != 'undefined') {
5159                clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ')').find('.nectar-flickity').each(function () {
5160                    var tabbedFlkty = Flickity.data($(this)[0]);
5161                    tabbedFlkty.resize();
5162                });
5163
5164            }
5165
5166            if ($currentVisTab.find('.nectar-woo-flickity').length > 0 && typeof Flickity != 'undefined') {
5167
5168                setTimeout(function () {
5169                    var wootabbedFlkty = Flickity.data(clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ')').find('.nectar-woo-flickity > ul')[0]);
5170                    wootabbedFlkty.resize();
5171                    $(window).trigger('nectar-product-filters-layout');
5172                }, 100);
5173            }
5174
5175        }
5176
5177        //SVG icons
5178        $currentVisTab.find('.svg-icon-holder').each(function (i) {
5179
5180            var $that = $(this);
5181
5182            setTimeout(function () {
5183
5184                var $animationDelay = 0;
5185
5186                if ($that.is('[data-animation-delay]') &&
5187                    $that.attr('data-animation-delay').length > 0 &&
5188                    $that.attr('data-animation') != 'false') {
5189                    $animationDelay = $that.attr('data-animation-delay');
5190                }
5191
5192                clearTimeout($animatedSVGIconTimeout[i]);
5193
5194                if ($that.attr('data-animation') == 'false') {
5195                    $that.css('opacity', '1');
5196                    $svgIcons[$that.find('svg').attr('id').slice(-1)].finish();
5197                } else {
5198
5199                    $svgIcons[$that.find('svg').attr('id').slice(-1)].reset();
5200                    $animatedSVGIconTimeout[i] = setTimeout(function () {
5201                        $svgIcons[$that.find('svg').attr('id').slice(-1)].play();
5202                    }, $animationDelay);
5203
5204                }
5205            }, 150);
5206        });
5207
5208
5209        // CTA class fix
5210        $('.nectar-cta .link_wrap, .nectar-cta .link_text').removeClass('hover');
5211
5212        // Fix columns inside tabs
5213        clickedTab.parents('.tabbed').find('.wpb_row').each(function () {
5214            if (typeof $(this).find('[class*="vc_col-"]').first().offset() != 'undefined') {
5215
5216                var $firstChildOffset = $(this).find('[class*="vc_col-"]').first().offset().left;
5217
5218                $(this).find('[class*="vc_col-"]').each(function () {
5219                    $(this).removeClass('no-left-margin');
5220                    if ($(this).offset().left < $firstChildOffset + 15) {
5221                        $(this).addClass('no-left-margin');
5222                    } else {
5223                        $(this).removeClass('no-left-margin');
5224                    }
5225                });
5226            }
5227
5228        });
5229
5230        $tabbedClickCount++;
5231
5232        // Magic line
5233        if (clickedTab.parent().parent().find('.magic-line').length > 0) {
5234            magicLineCalc(clickedTab);
5235        }
5236
5237        $(window).trigger('nectar-tab-changed');
5238
5239    }
5240
5241
5242    /**
5243     * Tabbed element magic line - used for style "Minimal alt"
5244     *
5245     * @since 7.0
5246     */
5247    function magicLineCalc($ele) {
5248
5249        var el, leftPos, ratio;
5250
5251        el = $ele.parent();
5252        if (el.length) {
5253            leftPos = el.position().left;
5254            ratio = el.width();
5255        } else {
5256            leftPos = ratio = 0;
5257        }
5258
5259
5260        $ele.parent().parent()
5261            .find('.magic-line')
5262            .css('transform', 'translateX(' + leftPos + 'px) scaleX(' + ratio + ')');
5263    }
5264
5265
5266    /**
5267     * Tabbed element toggle button style
5268     *
5269     * @since 14.1
5270     */
5271    function tabbedToggleButton() {
5272        $('body').on('click', '.wpb_tabs_nav > .toggle-button', function () {
5273            $(this).parents('.wpb_tabs_nav').find('> li:not(.active-tab):not(.toggle-button) a').trigger('click');
5274        });
5275    }
5276
5277
5278    /**
5279     * Tabbed element deep linking.
5280     *
5281     * @since 3.0
5282     */
5283    function tabbbedDeepLinking() {
5284
5285        if (typeof nectarGetQueryParam['tab'] != 'undefined') {
5286
5287            $('.wpb_tabs_nav').each(function () {
5288
5289                $(this).find('li').each(function () {
5290
5291                    var $currentText = $(this).find('a').clone(),
5292                        $getText = nectarGetQueryParam['tab'],
5293                        $that = $(this);
5294
5295                    $currentText.find('svg').remove();
5296                    $currentText = $currentText.text();
5297                    $currentText = $currentText.replace(/\s+/g, '-').toLowerCase();
5298
5299                    // SVG icons.
5300                    if ($currentText.length > 0 && $currentText.substring(0, 1) === '-') {
5301                        $currentText = $currentText.substring(1);
5302                    }
5303
5304                    $getText = $getText.replace(/\s+/g, '-').replace(/</g, '&lt;').replace(/"/g, '&quot;').toLowerCase();
5305
5306                    if ($currentText == $getText) {
5307
5308                        $(this).find('a').trigger('click');
5309
5310                        setTimeout(function () {
5311                            $that.find('a').trigger('click');
5312                        }, 501);
5313                    }
5314
5315                });
5316
5317            });
5318
5319        }
5320
5321    }
5322
5323
5324    /**
5325     * Tabbed element initialization.
5326     *
5327     * @since 3.0
5328     */
5329    function tabbedInit() {
5330
5331        // Click event.
5332        $body.on('click', '.tabbed > ul li:not(.cta-button) a', function (e) {
5333
5334            tabbedChangeSection($(this));
5335
5336            // Mobile scroll to.
5337            if (e.originalEvent !== undefined &&
5338                nectarDOMInfo.winW < 1000 &&
5339                $nectarFullPage.$usingFullScreenRows == false &&
5340                !$(this).parents('.disable-mobile-tab-scroll')
5341            ) {
5342
5343                // Ensure that it would be needed.
5344                var $tabbedNav = $(this).closest('.tabbed').find('> ul');
5345
5346                if ($tabbedNav.height() > 350) {
5347
5348                    var $scrollTopDistance = $tabbedNav.offset().top + $tabbedNav.height() - nectarDOMInfo.adminBarHeight;
5349
5350                    if ($('#header-outer[data-mobile-fixed="1"]').length > 0) {
5351                        $scrollTopDistance = $tabbedNav.offset().top + $tabbedNav.height() - $headerOuterEl.outerHeight() - nectarDOMInfo.adminBarHeight
5352                    }
5353
5354                    nectar_scrollToY($scrollTopDistance, 700, 'easeInOutQuint');
5355                }
5356
5357            }
5358
5359            return false;
5360        });
5361
5362        // Toggle Button Style.
5363        tabbedToggleButton();
5364
5365        // Custom user def anchor click event helper.
5366        $('a[class*="nectar-tab-trigger"]').on('click', function (e) {
5367
5368            // verify the link is setup correct.
5369            if (!$(this).is('[href*="#"]') || $(this).attr('href').length < 1) {
5370                return true;
5371            }
5372
5373            var clickedTrigger = $(this).attr('href');
5374            clickedTrigger = clickedTrigger.substr(1);
5375            clickedTrigger = clickedTrigger.replace(/\s+/g, '-').replace(/</g, '&lt;').replace(/"/g, '&quot;').toLowerCase();
5376
5377            $('.wpb_tabs_nav').each(function () {
5378
5379                $(this).find('li').each(function () {
5380
5381                    var $currentText = $(this).find('a').clone();
5382
5383                    $currentText.find('svg').remove();
5384                    $currentText = $currentText.text();
5385                    $currentText = $currentText.replace(/\s+/g, '-').toLowerCase();
5386
5387                    // SVG icons.
5388                    if ($currentText.length > 0 && $currentText.substring(0, 1) === '-') {
5389                        $currentText = $currentText.substring(1);
5390                    }
5391
5392                    // trigger.
5393                    if ($currentText == clickedTrigger) {
5394                        $(this).find('a').trigger('click');
5395                    }
5396
5397                });
5398
5399            });
5400
5401            e.preventDefault();
5402
5403        });
5404
5405
5406        $('.tabbed').each(function () {
5407
5408            var $that;
5409
5410            // Handle icons
5411            $(this).find('.wpb_tab').each(function (i) {
5412
5413                if ($(this).is('[data-tab-icon]') &&
5414                    $(this).attr('data-tab-icon').length > 0 &&
5415                    $(this).find('.im-icon-wrap.tab-icon').length == 0) {
5416
5417                    $(this)
5418                        .closest('.tabbed')
5419                        .addClass('using-icons');
5420
5421                    $(this)
5422                        .closest('.tabbed')
5423                        .find('.wpb_tabs_nav li:nth-child(' + (i + 1) + ') > a')
5424                        .prepend('<i class="' + $(this).attr("data-tab-icon") + '"></i>');
5425
5426                    // Toggle style 2nd item.
5427                    if ($(this).closest('.tabbed').is('[data-style="toggle_button"]') && i === 1) {
5428                        $(this)
5429                            .closest('.tabbed')
5430                            .find('.wpb_tabs_nav li:nth-child(' + (i + 2) + ') > a')
5431                            .prepend('<i class="' + $(this).attr("data-tab-icon") + '"></i>');
5432                    }
5433                }
5434
5435                // SVG icons
5436                if ($(this).find('.im-icon-wrap.tab-icon').length > 0) {
5437
5438                    var $svg_icon_markup = $(this).find('.im-icon-wrap.tab-icon').detach();
5439                    $(this).closest('.tabbed')
5440                        .find('.wpb_tabs_nav li:nth-child(' + (i + 1) + ') > a')
5441                        .prepend($svg_icon_markup);
5442                }
5443
5444            });
5445
5446
5447            $that = $(this);
5448
5449            // Minimal alt effect
5450            setTimeout(function () {
5451                if ($that.is('[data-style="minimal_alt"]')) {
5452                    $that.find('> ul').append('<li class="magic-line" />');
5453                    magicLineCalc($that.find('> ul > li:first-child > a'));
5454                }
5455            }, 100);
5456
5457
5458        });
5459
5460        // Minimal alt resize event.
5461        if ($('.tabbed[data-style="minimal_alt"]').length > 0) {
5462            $window.on('smartresize', function () {
5463
5464                $('.tabbed[data-style="minimal_alt"]').each(function () {
5465
5466                    if ($(this).find('a.active-tab').length > 0) {
5467                        magicLineCalc($(this).find('a.active-tab'));
5468                    }
5469
5470                });
5471
5472
5473            });
5474
5475        }
5476
5477
5478        tabbbedDeepLinking();
5479
5480        // Vertical scrolling
5481        $('.nectar-scrolling-tabs').each(function (i) {
5482            if (!nectarDOMInfo.usingFrontEndEditor) {
5483                $verticalScrollingTabs[i] = new VerticalScrollingTabs($(this));
5484            }
5485        });
5486
5487        var tabAnimating = false;
5488
5489        $body.on('click', '.scrolling-tab-nav-current-item', function () {
5490            $(this).toggleClass('open');
5491            $(this).siblings('.wpb_tabs_nav').toggle();
5492            nectarParallaxElRefresh();
5493        });
5494
5495        $body.on('click', '.nectar-sticky-tabs .wpb_tabs_nav li', function (e) {
5496            var $parentUl = $(this).parents('.wpb_tabs_nav');
5497            var $titleEl = $(this).parents('.scrolling-tab-nav').find('.scrolling-tab-nav-current-item');
5498            var $selectedText = $(this).find('.tab-nav-heading').clone();
5499
5500            $titleEl.html($selectedText);
5501
5502            if (e.originalEvent !== undefined) {
5503                $(this).parents('.scrolling-tab-nav').find('.scrolling-tab-nav-current-item').toggleClass('open');
5504                $parentUl.toggle();
5505            }
5506
5507        });
5508
5509        $body.on('click', '.nectar-sticky-tabs .wpb_tabs_nav a', function (e) {
5510
5511            var clickedTab = $(this);
5512            var $id = clickedTab.parents('li').index() + 1;
5513            var $frontEndEditorTabDiv = ($('body.vc_editor').length > 0) ? '> .wpb_tab ' : '';
5514            var $parentTabs = clickedTab.parents('.nectar-sticky-tabs');
5515            var tabTimeout = ($parentTabs.hasClass('content_animation_fade')) ? 200 : 600;
5516
5517
5518            if (!clickedTab.parents('li').hasClass('active-tab') && !tabAnimating || !$parentTabs.hasClass('loaded')) {
5519
5520                tabAnimating = true;
5521
5522                $parentTabs.find('.wpb_tabs_nav li').removeClass('active-tab');
5523                clickedTab.parents('li').addClass('active-tab');
5524
5525                $parentTabs.find('.scrolling-tab-content  > div')
5526                    .removeClass('previously-active-tab');
5527
5528                $parentTabs.find('.scrolling-tab-content > div.active-tab')
5529                    .addClass('previously-active-tab')
5530                    .removeClass('active-tab');
5531
5532                $parentTabs.find('.scrolling-tab-content > div:nth-of-type(' + $id + ')' + $frontEndEditorTabDiv).addClass('active-tab');
5533                $(window).trigger('nectar-tab-changed');
5534
5535                setTimeout(function () {
5536                    tabAnimating = false;
5537                }, tabTimeout);
5538            }
5539
5540            e.preventDefault();
5541
5542        });
5543
5544        // Add starting visible class.
5545        $('.tabbed .wpb_tab').first().addClass('visible-tab');
5546
5547        // Hover/Active effect.
5548        $('.nectar-sticky-tabs .wpb_tabs_nav > li:first-child').each(function () {
5549            $(this).find('a').first().trigger('click');
5550        });
5551        //// Set to false immediately to allow deeplinking to work.
5552        tabAnimating = false;
5553
5554        $('.nectar-sticky-tabs').addClass('loaded');
5555
5556        // Tab change event.
5557        $(window).on('nectar-tab-changed', wooProductCarouselAnimations);
5558
5559
5560    }
5561
5562
5563    /**
5564     * Vertical Scrolling Tabs
5565     *
5566     * @since 12.0
5567     */
5568
5569    function VerticalScrollingTabs(el) {
5570
5571        this.$el = el;
5572        this.$tabContent = el.find('.scrolling-tab-content');
5573        this.$lineEl = el.find('.scrolling-tab-nav .line');
5574        this.observer = null;
5575        this.linkFunc = this.$el.hasClass('navigation_func_active_link_only') ? 'single_link' : 'default';
5576
5577        this.domSetup();
5578        this.highlightObserve();
5579        this.events();
5580    }
5581
5582    VerticalScrollingTabs.prototype.events = function () {
5583
5584        var that = this;
5585
5586        if (this.linkFunc == 'single_link') {
5587
5588            $(window).on('resize', this.setVertCenter.bind(this));
5589            this.setVertCenter();
5590
5591            this.$el.find('.wpb_tabs_nav li').on('click', function (e) {
5592
5593                if (nectarDOMInfo.winW < 1000) {
5594
5595                    var $parentUl = that.$el.find('.wpb_tabs_nav');
5596
5597                    if (e.originalEvent !== undefined) {
5598                        that.$el.find('.scrolling-tab-nav .scrolling-tab-nav-current-item').toggleClass('open');
5599                        $parentUl.toggle();
5600                        nectarParallaxElRefresh();
5601                    }
5602
5603                    that.$el.find('.scrolling-tab-nav li').removeClass('active');
5604                    $(this).addClass('active');
5605
5606                    that.updateActiveTitle();
5607
5608                }
5609
5610            });
5611
5612        }
5613
5614    };
5615
5616    VerticalScrollingTabs.prototype.setVertCenter = function () {
5617
5618        var vertCenter = (nectarDOMInfo.winH - this.$el.find('.scrolling-tab-nav').height()) / 2;
5619        document.documentElement.style.setProperty('--nectar-sticky-tabs-vert-y', vertCenter + "px");
5620    }
5621
5622    VerticalScrollingTabs.prototype.updateActiveTitle = function () {
5623
5624        var $titleEl = this.$el.find('.scrolling-tab-nav .scrolling-tab-nav-current-item');
5625        var $selectedText = this.$el.find('.scrolling-tab-nav .menu-item.active .tab-nav-heading').clone();
5626
5627        var index = this.$el.find('.scrolling-tab-nav .menu-item.active').index();
5628
5629        this.$el.find('.scrolling-tab-content > div').removeClass('active');
5630        this.$el.find('.scrolling-tab-content > div:eq(' + index + ')').addClass('active');
5631
5632        this.$el.find('.scrolling-tab-nav .scrolling-tab-nav-total .inner').css('transform', 'translateY(-' + (index * 100) + '%)');
5633
5634        $titleEl.html($selectedText);
5635    }
5636
5637    VerticalScrollingTabs.prototype.domSetup = function () {
5638
5639        var that = this;
5640        var href = '';
5641
5642
5643        // Icons
5644        this.$el.find('.wpb_tab').each(function (i) {
5645
5646            if ($(this).is('[data-tab-icon]') && $(this).attr('data-tab-icon').length > 0 &&
5647                $(this).find('.im-icon-wrap.tab-icon').length === 0) {
5648
5649                that.$el.addClass('using-icons');
5650
5651                href = that.$el.find('.wpb_tabs_nav li:nth-child(' + (i + 1) + ') a').attr('href');
5652
5653                that.$el
5654                    .find('.wpb_tabs_nav li:nth-child(' + (i + 1) + ')')
5655                    .addClass('has-icon')
5656                    .prepend('<a class="skip-hash" role="button" href="' + href + '"><i class="' + $(this).attr("data-tab-icon") + '"></i></a>');
5657            }
5658
5659            // SVG icons
5660            if ($(this).find('.im-icon-wrap.tab-icon').length > 0) {
5661
5662                href = that.$el.find('.wpb_tabs_nav li:nth-child(' + (i + 1) + ') a').attr('href');
5663
5664                var $svg_icon_markup = $(this).find('.im-icon-wrap.tab-icon').detach();
5665                that.$el
5666                    .find('.wpb_tabs_nav li:nth-child(' + (i + 1) + ')')
5667                    .addClass('has-icon')
5668                    .prepend('<a class="skip-hash svg-icon-link" role="button" href="' + href + '"></a>');
5669
5670                that.$el.find('.wpb_tabs_nav li:nth-child(' + (i + 1) + ') .svg-icon-link').append($svg_icon_markup);
5671
5672            }
5673
5674        });
5675
5676
5677        // First active
5678        this.$el.find('.scrolling-tab-nav .menu-item:first').addClass('active');
5679        this.lineAnimation();
5680
5681        if (that.linkFunc == 'single_link') {
5682            this.updateActiveTitle();
5683        }
5684
5685        // Only tab
5686        if (this.$el.find('.scrolling-tab-nav .menu-item').length == 1) {
5687            this.$el.find('.scrolling-tab-nav').addClass('single-tab');
5688        }
5689
5690        var $tabContent = this.$el.find('.scrolling-tab-content');
5691
5692        this.$el.find('.scrolling-tab-nav .menu-item').each(function (i) {
5693
5694            i = i + 1;
5695            var $tab = $tabContent.find('> div:nth-child(' + i + ')');
5696
5697            // Add titles to mobile
5698            if (that.linkFunc == 'default') {
5699                var $title = $(this).html();
5700                $tab.prepend('<div class="scrolling-tab-mobile-title"><div class="inner">' + wlEls($title) + '</div></div>');
5701                $tab.find('.scrolling-tab-mobile-title a').contents().unwrap();
5702                // Create normal anchor relation.
5703                if ($tab) {
5704                    var id = $(this).find('a').attr('href');
5705                    id = id.substr(1);
5706                    $tab.find('> .scrolling-tab-mobile-title').attr('id', id);
5707                    $tab.removeAttr('id');
5708                }
5709            }
5710
5711
5712        });
5713
5714        this.$el.addClass('initalized');
5715
5716    };
5717
5718    VerticalScrollingTabs.prototype.highlightObserve = function () {
5719
5720        var that = this;
5721
5722        if (!(nectarDOMInfo.usingMobileBrowser && nectarDOMInfo.winW < 1000)) {
5723
5724            if ('IntersectionObserver' in window) {
5725
5726                /* Default */
5727                var rMarign = ($headerOuterEl.is('[data-remove-fixed="1"]')) ? '100px 0px 0px 0px' : '5px 0px 0px 0px';
5728
5729                var options = {
5730                    root: (isSafari()) ? null : document,
5731                    rootMargin: rMarign,
5732                    threshold: 1
5733                }
5734
5735                this.observer = new IntersectionObserver(function (entries) {
5736
5737                    entries.forEach(function (entry) {
5738
5739                        var href = '#' + $(entry.target).attr('id');
5740                        var $menuItem = that.$el.find('.scrolling-tab-nav a[href="' + href + '"]');
5741
5742                        if (entry.isIntersecting && entry.intersectionRatio >= 1) {
5743
5744                            $menuItem.parents('.menu-item').addClass('visible');
5745
5746                        } else {
5747                            $menuItem.parents('.menu-item').removeClass('visible');
5748                        }
5749
5750                        // Highlight
5751                        var $firstVisLink = that.$el.find('.scrolling-tab-nav .menu-item.visible:first');
5752
5753                        // a link is visible
5754                        if ($firstVisLink.length > 0) {
5755                            that.$el.find('.scrolling-tab-nav .menu-item').removeClass('active');
5756                            $firstVisLink.addClass('active');
5757                            that.lineAnimation();
5758                        }
5759
5760
5761                    });
5762
5763                }, options);
5764
5765                // Observe each section.
5766                this.$tabContent.find('> div > .scrolling-tab-mobile-title[id]').each(function () {
5767                    that.observer.observe($(this)[0]);
5768                });
5769
5770
5771                /* Single link only */
5772                this.tabs = Array.from(this.$tabContent.find('> div'));
5773                this.scrollDir = 'up';
5774                this.prevScroll = 0;
5775                this.prevIndex = 0;
5776                this.observer = new IntersectionObserver(function (entries) {
5777
5778                    entries.forEach(function (entry) {
5779
5780                        if (nectarDOMInfo.winW < 1000) {
5781                            return;
5782                        }
5783
5784                        if (nectarDOMInfo.scrollTop > that.prevScroll) {
5785                            that.scrollDir = 'down';
5786                        } else {
5787                            that.scrollDir = 'up';
5788                        }
5789
5790                        var target = (that.scrollDir === 'down') ? that.getTargetSection(entry) : entry.target
5791
5792                        if (that.shouldUpdate(entry)) {
5793                            var index = $(target).index();
5794
5795                            if (index < that.prevIndex) {
5796                                that.$el.addClass('scrolling-up');
5797                            } else {
5798                                that.$el.removeClass('scrolling-up');
5799                            }
5800
5801
5802                            that.$el.find('.scrolling-tab-nav .ui-tabs-nav > .menu-item').removeClass('prev-active');
5803                            that.$el.find('.scrolling-tab-nav .ui-tabs-nav > .menu-item.active').addClass('prev-active');
5804
5805                            that.$el.find('.scrolling-tab-nav .ui-tabs-nav > .menu-item').removeClass('active');
5806                            that.$el.find('.scrolling-tab-nav .ui-tabs-nav > .menu-item:eq(' + index + ')').addClass('active');
5807
5808                            that.updateActiveTitle();
5809
5810
5811                            that.prevIndex = index;
5812                        }
5813
5814                        that.prevScroll = nectarDOMInfo.scrollTop;
5815
5816                    });
5817
5818                }, {
5819                    root: (isSafari()) ? null : document,
5820                    rootMargin: '-40% 0% -40% 0%',
5821                    threshold: 0
5822                });
5823
5824                // Observe each section.
5825                this.$tabContent.find('> div').each(function () {
5826                    that.observer.observe($(this)[0]);
5827                });
5828
5829            } // if intersection observer.
5830
5831        } // don't trigger on mobile.
5832
5833    };
5834
5835    VerticalScrollingTabs.prototype.getTargetSection = function (entry) {
5836
5837        var index = this.tabs.findIndex(function (tab) {
5838            return tab == entry.target
5839        });
5840
5841        if (index >= this.tabs.length - 1) {
5842            return entry.target;
5843        } else {
5844            return this.tabs[index + 1];
5845        }
5846    }
5847
5848    VerticalScrollingTabs.prototype.shouldUpdate = function (entry) {
5849
5850        if (this.scrollDir === 'down' && !entry.isIntersecting && this.prevScroll != 0) {
5851            return true;
5852        }
5853
5854        if (this.scrollDir === 'up' && entry.isIntersecting && this.prevScroll != 0) {
5855            return true;
5856        }
5857
5858        return false;
5859    }
5860
5861    VerticalScrollingTabs.prototype.lineAnimation = function () {
5862
5863        var activeItem = this.$el.find('.scrolling-tab-nav .active');
5864
5865        if (activeItem.length == 0) {
5866            return;
5867        }
5868
5869        var itemOffset = parseInt(activeItem.position().top);
5870        var itemHeight = parseInt(activeItem.height());
5871
5872        this.$lineEl.css({
5873            'max-height': itemHeight + 'px',
5874            'transform': 'translate3d(0px, ' + itemOffset + 'px, 0px)'
5875        });
5876
5877    };
5878
5879
5880    /**
5881     * Toggle Panels element deep linking.
5882     *
5883     * @since 3.0
5884     */
5885    function accordionDeepLinking() {
5886
5887        if (typeof nectarGetQueryParam['toggle'] != 'undefined') {
5888            $('.toggles').each(function () {
5889
5890                $(this).find('.toggle').each(function () {
5891                    var $currentText = $(this).find('h3 a').clone();
5892                    var $getText = nectarGetQueryParam['toggle'];
5893
5894                    $($currentText).find('i').remove();
5895                    $currentText = $currentText.text();
5896                    $currentText = $currentText.replace(/\s+/g, '-').toLowerCase();
5897                    $getText = $getText.replace(/\s+/g, '-').replace(/</g, '&lt;').replace(/"/g, '&quot;').toLowerCase();
5898
5899                    if ($currentText == $getText) {
5900                        $(this).find('h3 a').trigger('click');
5901                    }
5902                });
5903            });
5904        }
5905
5906    }
5907
5908
5909    function accordionSizing() {
5910
5911        $('.toggles').each(function () {
5912
5913            var openToggle = $(this).find('.toggle.open');
5914
5915            if (openToggle.length > 0) {
5916
5917                openToggle.each(function () {
5918                    var openToggleInner = $(this).find('> div')[0];
5919                    openToggleInner.style.maxHeight = openToggleInner.scrollHeight + "px";
5920                });
5921
5922            }
5923
5924
5925        });
5926
5927    }
5928
5929    /**
5930     * Toggle Panels element initialization.
5931     *
5932     * @since 3.0
5933     */
5934    function accordionInit() {
5935
5936        setTimeout(function () {
5937
5938            $('.toggles.accordion:not([data-starting="closed"])').each(function () {
5939
5940                // Legacy.
5941                if ($(this).find('.toggle[data-inner-wrap="true"]').length == 0) {
5942                    $(this).find('> .toggle').first().addClass('open').find('> div').show();
5943                } else if (!nectarDOMInfo.usingFrontEndEditor) {
5944                    var $firstToggle = $(this).find('> .toggle').first();
5945                    $firstToggle.addClass('open');
5946                    $firstToggle.find('> div')[0].style.maxHeight = $firstToggle.find('> div')[0].scrollHeight + "px";
5947                }
5948
5949                $(this).find('> .toggle').first().find('a:not(.nectar-button) i').attr('class', 'fa fa-minus-circle');
5950
5951            });
5952
5953            setTimeout(accordionDeepLinking, 300);
5954
5955        }, 60);
5956
5957        if ($('.toggle[data-inner-wrap="true"]').length > 0) {
5958            $window.on('smartresize', accordionSizing);
5959        }
5960
5961        // Handle legacy markup for users who haven't updated core plugin.
5962        $('.toggle > h3:not(.toggle-title)').addClass('toggle-title');
5963
5964    }
5965
5966    function accordionClickEvents() {
5967
5968
5969        $body.on('click', '.toggle > h3 a, .toggle > .toggle-title a', function () {
5970
5971            // Regular toggle click event
5972            if (!$(this).parents('.toggles').hasClass('accordion')) {
5973
5974                // Legacy.
5975                if ($(this).parents('.toggle[data-inner-wrap="true"]').length == 0) {
5976
5977                    $(this).parents('.toggle')
5978                        .find('> div')
5979                        .slideToggle(300);
5980
5981                } else {
5982
5983                    var parentEl = $(this).parents('.toggle').find('> div')[0];
5984
5985                    if (parentEl.style.maxHeight) {
5986                        parentEl.style.maxHeight = null;
5987                    } else {
5988                        parentEl.style.maxHeight = parentEl.scrollHeight + "px";
5989                    }
5990
5991                }
5992
5993
5994                $(this).parents('.toggle')
5995                    .toggleClass('open');
5996
5997                // Switch icon
5998                if ($(this).parents('.toggle').hasClass('open')) {
5999                    $(this)
6000                        .find('i')
6001                        .attr('class', 'fa fa-minus-circle');
6002                } else {
6003                    $(this)
6004                        .find('i')
6005                        .attr('class', 'fa fa-plus-circle');
6006                }
6007
6008                if ($(this).parents('.toggle').find('> div .iframe-embed').length > 0 &&
6009                    $(this).parents('.toggle').find('> div iframe.iframe-embed').height() == '0') {
6010                    responsiveVideoIframes();
6011                }
6012
6013                // toggles which contain images
6014                if ($(this).parents('.toggle').find('> div img').length > 0 &&
6015                    $(this).parents('.toggle').is('[data-inner-wrap="true"]')) {
6016
6017                    for (var j = 1; j < 10; j++) {
6018                        setTimeout(accordionSizing, j * 100);
6019                    }
6020                }
6021
6022                // parallax resize.
6023                setTimeout(function () {
6024                    $(window).trigger('salient-parallax-el-recalculate');
6025                }, 500);
6026
6027                if ($(this).parents('.full-width-content').length > 0) {
6028                    setTimeout(function () {
6029                        fullWidthContentColumns();
6030                    }, 300);
6031                }
6032
6033                if ($('#nectar_fullscreen_rows').length > 0) {
6034                    setTimeout(function () {
6035                        $window.trigger('smartresize');
6036                    }, 300);
6037                }
6038                return false;
6039            }
6040        });
6041
6042        // Accordion click event
6043        $body.on('click', '.toggles.accordion .toggle > h3 a, .toggles.accordion .toggle > .toggle-title a', function (e) {
6044
6045            var $t;
6046            var $parentToggles = $(this).parents('.toggles');
6047            var $parentToggle = $(this).parents('.toggle');
6048
6049
6050            // parallax resize.
6051            setTimeout(function () {
6052                $(window).trigger('salient-parallax-el-recalculate');
6053            }, 500);
6054
6055            if ($(this).parents('.toggle').hasClass('open')) {
6056                $parentToggles.find('.toggle > div').each(function () {
6057                    $(this)[0].style.maxHeight = null;
6058                });
6059                $parentToggles.find('.toggle h3 a i').attr('class', 'fa fa-plus-circle');
6060                $parentToggles.find('.toggle').removeClass('open');
6061                return false;
6062            }
6063
6064            // Legacy.
6065            if ($(this).parents('.toggle[data-inner-wrap="true"]').length == 0) {
6066
6067                $parentToggles.find('.toggle > div').slideUp(300);
6068                $parentToggles.find('.toggle h3 a i').attr('class', 'fa fa-plus-circle');
6069                $parentToggles.find('.toggle').removeClass('open');
6070                $parentToggle.find('> div').slideDown(300);
6071                $parentToggle.addClass('open');
6072
6073            } else {
6074
6075                // Mobile scroll to.
6076                if (e.originalEvent !== undefined &&
6077                    nectarDOMInfo.winW < 1000 &&
6078                    $parentToggles.find('.toggle.open').length > 0 &&
6079                    $nectarFullPage.$usingFullScreenRows == false) {
6080
6081                    var $openToggle = $parentToggles.find('.toggle.open');
6082
6083                    setTimeout(function () {
6084                        var $scrollTopDistance = $parentToggle.offset().top - nectarDOMInfo.adminBarHeight;
6085
6086                        if ($('#header-outer[data-mobile-fixed="1"]').length > 0) {
6087                            $scrollTopDistance = $parentToggle.offset().top - $headerOuterEl.outerHeight() - nectarDOMInfo.adminBarHeight
6088                        }
6089
6090                        nectar_scrollToY($scrollTopDistance, 500, 'easeInOutQuint');
6091                    }, 50);
6092
6093                }
6094
6095                // Desktop scroll to
6096                if (e.originalEvent !== undefined &&
6097                    nectarDOMInfo.winW > 1000 &&
6098                    $parentToggles.find('.toggle.open').length > 0 &&
6099                    $nectarFullPage.$usingFullScreenRows == false) {
6100
6101                    setTimeout(function () {
6102                        if ($parentToggle.offset().top < $(window).scrollTop()) {
6103                            var $scrollTopDistance = $parentToggle.offset().top - nectarDOMInfo.adminBarHeight;
6104
6105                            if ($('#header-outer[data-remove-fixed="0"]').length > 0) {
6106                                $scrollTopDistance = $parentToggle.offset().top - $headerOuterEl.outerHeight() - nectarDOMInfo.adminBarHeight
6107                            }
6108
6109                            nectar_scrollToY($scrollTopDistance - 30, 500, 'easeInOutQuint');
6110                        }
6111                    }, 500);
6112
6113                }
6114
6115
6116                var parentEl = $parentToggle.find('> div')[0];
6117
6118                $parentToggles.find('.toggle > div').each(function () {
6119                    $(this)[0].style.maxHeight = null;
6120                });
6121
6122                $parentToggles.find('.toggle h3 a i').attr('class', 'fa fa-plus-circle');
6123                $parentToggles.find('.toggle').removeClass('open');
6124
6125                parentEl.style.maxHeight = parentEl.scrollHeight + "px";
6126
6127                $parentToggle.addClass('open');
6128
6129            }
6130
6131
6132            // Switch icon
6133            if ($parentToggle.hasClass('open')) {
6134                $(this).find('i').attr('class', 'fa fa-minus-circle');
6135            } else {
6136                $(this).find('i').attr('class', 'fa fa-plus-circle');
6137            }
6138
6139
6140            if ($(this).parents('.full-width-content').length > 0) {
6141                clearTimeout($t);
6142                $t = setTimeout(function () {
6143                    fullWidthContentColumns();
6144                }, 400);
6145            }
6146            if ($('#nectar_fullscreen_rows').length > 0) {
6147                clearTimeout($t);
6148                $t = setTimeout(function () {
6149                    $window.trigger('smartresize');
6150                }, 400);
6151            }
6152
6153            return false;
6154
6155        });
6156
6157    }
6158
6159
6160    /**
6161     * Sticky elements powered by CSS vertically centered.
6162     *
6163     * @since 14.0
6164     */
6165    function NectarStickyEl(el) {
6166
6167        this.$el = el;
6168        this.$innerEl = this.$el.find(' > .n-sticky > .vc_column-inner');
6169
6170        if (this.$innerEl.length == 0) {
6171            return;
6172        }
6173
6174        this.topOffset = 0;
6175
6176        this.lazyInit();
6177
6178    }
6179
6180    NectarStickyEl.prototype.init = function () {
6181        this.resizeEvent();
6182        $window.on('resize', this.resizeEvent.bind(this));
6183    }
6184
6185    NectarStickyEl.prototype.lazyInit = function () {
6186
6187        var that = this;
6188
6189        if (!nectarDOMInfo.usingFrontEndEditor && 'IntersectionObserver' in window) {
6190            var that = this;
6191            var observer = new IntersectionObserver(function (entries) {
6192
6193                entries.forEach(function (entry) {
6194                    if (entry.isIntersecting) {
6195                        that.init();
6196                        observer.unobserve(entry.target);
6197                    }
6198                });
6199
6200            }, {
6201                root: (isSafari()) ? null : document,
6202                rootMargin: '400px 0px 400px 0px',
6203                threshold: 0
6204            });
6205
6206            observer.observe(this.$el[0]);
6207        } else {
6208            this.init();
6209        }
6210
6211
6212    };
6213
6214    NectarStickyEl.prototype.calcTopOffset = function () {
6215        this.topOffset = (nectarDOMInfo.winH - this.$innerEl.height()) / 2;
6216    };
6217
6218    NectarStickyEl.prototype.resizeEvent = function () {
6219
6220        if (nectarDOMInfo.winW > 1000) {
6221
6222            this.calcTopOffset();
6223
6224            this.$innerEl.css({
6225                'top': this.topOffset
6226            });
6227
6228        } else {
6229            this.$innerEl.css({
6230                'top': ''
6231            });
6232        }
6233
6234    };
6235
6236
6237    /**
6238     * Color hex to rgb
6239     *
6240     * @since 3.0
6241     */
6242    function shadeColor(hex, lum) {
6243
6244        // Validate hex string
6245        hex = String(hex).replace(/[^0-9a-f]/gi, '');
6246        if (hex.length < 6) {
6247            hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
6248        }
6249        lum = lum || 0;
6250
6251        // Convert to decimal and change luminosity
6252        var rgb = "#",
6253            c, i;
6254        for (i = 0; i < 3; i++) {
6255            c = parseInt(hex.substr(i * 2, 2), 16);
6256            c = Math.round(Math.min(Math.max(0, c + (c * lum)), 255)).toString(16);
6257            rgb += ("00" + c).substr(c.length);
6258        }
6259
6260        return rgb;
6261    }
6262
6263    /**
6264     * Jumbo size 3D nectar button.
6265     *
6266     * @since 3.0
6267     */
6268    function createExtraJumboSize() {
6269
6270        $('.nectar-3d-transparent-button').each(function () {
6271
6272            if ($(this).css('visibility') != 'visible') {
6273                return;
6274            }
6275
6276            var $that = $(this),
6277                $size = $that.attr('data-size'),
6278                $padding = 0;
6279
6280            var $vert_height_divider = 1.7;
6281
6282            if ($size == 'extra_jumbo') {
6283
6284                var $font_size;
6285
6286                if (nectarDOMInfo.winW < 1000 && nectarDOMInfo.winW > 690) {
6287                    $padding = 64;
6288                    $font_size = 34;
6289                    $that.find('.back-3d rect').attr('stroke-width', '12');
6290                    $vert_height_divider = 1.7;
6291                } else if (nectarDOMInfo.winW <= 690) {
6292                    $padding = 46;
6293                    $font_size = 16;
6294                    $that.find('.back-3d rect').attr('stroke-width', '10');
6295                    $vert_height_divider = 1.7;
6296                } else {
6297                    $padding = 100;
6298                    $font_size = 64;
6299                    $that.find('.back-3d rect').attr('stroke-width', '20');
6300                    $vert_height_divider = 1.6;
6301                }
6302
6303
6304                $that.find('svg text').attr('font-size', $font_size);
6305
6306                var $boundingRect = $(this).find('.back-3d .button-text')[0].getBoundingClientRect(),
6307                    $text_width = $boundingRect.width,
6308                    $text_height = $font_size * 1.5;
6309
6310                $that.css({
6311                    'width': ($text_width + $padding * 1.5) + 'px',
6312                    'height': ($text_height + $padding) + 'px'
6313                });
6314
6315                $that.find('> a').css({
6316                    'height': ($text_height + $padding) + 'px'
6317                });
6318
6319                $that.find('.back-3d svg, .front-3d svg').css({
6320                    'width': ($text_width + $padding * 1.5) + 'px',
6321                    'height': ($text_height + $padding) + 'px'
6322                }).attr('viewBox', '0 0 ' + ($text_width + $padding * 1.5) + ' ' + ($text_height + $padding));
6323
6324                $that.find('svg text').attr('transform', 'matrix(1 0 0 1 ' + ($text_width + $padding * 1.6) / 2 + ' ' + (($text_height + $padding) / $vert_height_divider) + ')');
6325                $that.find('.front-3d ').css('transform-origin', '50% 50% -' + ($text_height + $padding) / 2 + 'px');
6326                $that.find('.back-3d').css('transform-origin', '50% 50% -' + ($text_height + $padding) / 2 + 'px');
6327
6328            }
6329
6330        });
6331
6332    }
6333
6334
6335    /**
6336     * Nectar Button custom coloring
6337     *
6338     * @since 3.0
6339     */
6340    function buttonInit() {
6341
6342        /* CTA animations */
6343        if (!nectarDOMInfo.usingMobileBrowser) {
6344            $('.nectar-cta[data-style="text-reveal-wave"], .menu-item-hover-text-reveal-wave, .nectar-cta[data-style="curved-arrow-animation"]').each(function () {
6345                $(this).find('.char').each(function (i) {
6346                    $(this).css('animation-delay', (i * 0.015) + 's');
6347                });
6348
6349                var bindingClass = ($(this).is('[data-using-bg="true"]')) ? '.link_wrap' : '.link_text';
6350                var childTarget = false;
6351
6352                if ($(this).is('[class*="border_thickness_"]') && !$(this).is('[class*="border_thickness_0px"]')) {
6353                    bindingClass = '.link_wrap';
6354                    childTarget = true;
6355                }
6356
6357                if ($(this).is('.menu-item-hover-text-reveal-wave')) {
6358                    bindingClass = 'a';
6359                }
6360
6361                if ($(this).is('[data-triggered-by]')) {
6362                    var triggeredBy = $(this).attr('data-triggered-by');
6363                    $(this).parents(triggeredBy).on('mouseenter', function () {
6364                        if (nectarDOMInfo.winW > 999) {
6365                            var target = $(this).find('.link_text');
6366                            target.removeClass('hover');
6367                            setTimeout(function () {
6368                                target.addClass('hover');
6369                            }, 20);
6370                        }
6371                    });
6372
6373                } else {
6374                    $(this).find(bindingClass).on('mouseenter', function () {
6375                        if (nectarDOMInfo.winW > 999) {
6376                            var target = (childTarget) ? $(this).find('.link_text') : $(this);
6377                            target.removeClass('hover');
6378                            setTimeout(function () {
6379                                target.addClass('hover');
6380                            }, 20);
6381                        }
6382                    });
6383                }
6384
6385
6386            });
6387        }
6388
6389
6390        /* General animated underline */
6391        $('.nectar-link-underline-effect a').on('mouseenter', function () {
6392            $(this).addClass('accessed');
6393        });
6394
6395
6396        /* Custom coloring */
6397        $('.nectar-button.see-through[data-color-override], .nectar-button.see-through-2[data-color-override], .nectar-button.see-through-3[data-color-override]').each(function () {
6398
6399            var $usingMaterialSkin = ($('body.material[data-button-style^="rounded"]').length > 0) ? true : false;
6400            $(this).css('visibility', 'visible');
6401
6402            if ($(this).hasClass('see-through-3') && $(this).attr('data-color-override') == 'false') {
6403                return true;
6404            }
6405
6406            var $color;
6407            var $that;
6408
6409            if ($(this).attr('data-color-override') != 'false') {
6410                $color = $(this).attr('data-color-override');
6411            } else {
6412
6413                if ($(this).parents('.dark').length > 0) {
6414                    $color = '#000000';
6415                } else {
6416                    $color = '#ffffff';
6417                }
6418
6419            }
6420
6421            if (!$(this).hasClass('see-through-3')) {
6422                $(this).css('color', $color);
6423            }
6424
6425            $(this).find('i').css('color', $color);
6426
6427            var colorInt = parseInt($color.substring(1), 16);
6428            var $hoverColor = ($(this).has('[data-hover-color-override]')) ? $(this).attr('data-hover-color-override') : 'no-override';
6429            var $hoverTextColor = ($(this).has('[data-hover-text-color-override]')) ? $(this).attr('data-hover-text-color-override') : '#fff';
6430
6431            var R = (colorInt & 0xFF0000) >> 16;
6432            var G = (colorInt & 0x00FF00) >> 8;
6433            var B = (colorInt & 0x0000FF) >> 0;
6434
6435            var $opacityStr = ($(this).hasClass('see-through-3')) ? '1' : '0.75';
6436
6437            $(this).css('border-color', 'rgba(' + R + ',' + G + ',' + B + ',' + $opacityStr + ')');
6438
6439            // Material theme skin buttons w/ icons starting
6440            if ($usingMaterialSkin) {
6441                $(this).find('i').css({
6442                    'background-color': 'rgba(' + R + ',' + G + ',' + B + ',1)',
6443                    'box-shadow': '0px 8px 15px rgba(' + R + ',' + G + ',' + B + ',0.24)'
6444                });
6445            }
6446
6447            if ($(this).hasClass('see-through')) {
6448
6449                $that = $(this);
6450
6451                $(this).on('mouseenter touchstart', function () {
6452                    $that.css('border-color', 'rgba(' + R + ',' + G + ',' + B + ',1)');
6453                });
6454
6455                $(this).on('mouseleave touchtouchend', function () {
6456                    $that.css('border-color', 'rgba(' + R + ',' + G + ',' + B + ',1)');
6457                    $opacityStr = ($(this).hasClass('see-through-3')) ? '1' : '0.75';
6458                    $that.css('border-color', 'rgba(' + R + ',' + G + ',' + B + ',' + $opacityStr + ')');
6459                });
6460
6461            } else {
6462
6463                $(this).find('i').css('color', $hoverTextColor);
6464
6465                if ($hoverColor != 'no-override') {
6466
6467                    $that = $(this);
6468
6469                    $(this).on('mouseenter touchstart', function () {
6470
6471                        $that.css({
6472                            'border-color': $hoverColor,
6473                            'background-color': $hoverColor,
6474                            'color': $hoverTextColor
6475                        });
6476
6477                        // Material buttons w/ icons over
6478                        if ($usingMaterialSkin) {
6479                            $that.find('i').css({
6480                                'background-color': '',
6481                                'box-shadow': ''
6482                            });
6483                        }
6484                    });
6485
6486                    $(this).on('mouseleave touchtouchend', function () {
6487
6488                        $opacityStr = ($(this).hasClass('see-through-3')) ? '1' : '0.75';
6489
6490                        if ($usingMaterialSkin) {
6491                            $that.find('i').css({
6492                                'background-color': 'rgba(' + R + ',' + G + ',' + B + ',1)',
6493                                'box-shadow': '0px 8px 15px rgba(' + R + ',' + G + ',' + B + ',0.24)'
6494                            });
6495                        }
6496
6497                        if (!$that.hasClass('see-through-3')) {
6498                            $that.css({
6499                                'border-color': 'rgba(' + R + ',' + G + ',' + B + ',' + $opacityStr + ')',
6500                                'background-color': 'transparent',
6501                                'color': $color
6502                            });
6503                        } else {
6504                            $that.css({
6505                                'border-color': 'rgba(' + R + ',' + G + ',' + B + ',' + $opacityStr + ')',
6506                                'background-color': 'transparent'
6507                            });
6508                        }
6509
6510                    });
6511
6512                } else {
6513
6514                    $that = $(this);
6515
6516                    $(this).on('mouseenter touchstart', function () {
6517
6518                        $that.css({
6519                            'border-color': $hoverColor,
6520                            'color': $hoverTextColor
6521                        });
6522
6523                    });
6524
6525                    $(this).on('mouseleave touchtouchend', function () {
6526
6527                        $opacityStr = ($that.hasClass('see-through-3')) ? '1' : '0.75';
6528                        $that.css({
6529                            'border-color': 'rgba(' + R + ',' + G + ',' + B + ',' + $opacityStr + ')',
6530                            'color': $hoverTextColor
6531                        });
6532
6533                    });
6534
6535                }
6536            }
6537        });
6538
6539        $('.nectar-button:not(.see-through):not(.see-through-2):not(.see-through-3)[data-color-override]').each(function () {
6540
6541            $(this).css('visibility', 'visible');
6542
6543            if ($(this).attr('data-color-override') != 'false') {
6544
6545                var $color = $(this).attr('data-color-override');
6546
6547                $(this)
6548                    .removeClass('accent-color')
6549                    .removeClass('extra-color-1')
6550                    .removeClass('extra-color-2')
6551                    .removeClass('extra-color-3')
6552                    .css('background-color', $color);
6553            }
6554
6555        });
6556
6557
6558        // Solid color tilt
6559        if ($('.swiper-slide .solid_color_2').length > 0 || $('.tilt-button-inner').length > 0) {
6560
6561            var $tiltButtonCssString = '';
6562            var $color;
6563
6564            $('.swiper-slide .solid_color_2 a').each(function (i) {
6565
6566                $(this).addClass('instance-' + i);
6567
6568                if ($(this).attr('data-color-override') != 'false') {
6569                    $color = $(this).attr('data-color-override');
6570                } else {
6571                    if ($(this).parents('.dark').length > 0) {
6572                        $color = '#000000';
6573                    } else {
6574                        $color = '#ffffff';
6575                    }
6576                }
6577
6578                $(this).css('color', $color);
6579                $(this).find('i').css('color', $color);
6580
6581                var $currentColor = $(this).css('background-color'),
6582                    $topColor = shadeColor($currentColor, 0.13),
6583                    $bottomColor = shadeColor($currentColor, -0.15);
6584
6585                $tiltButtonCssString += '.swiper-slide .solid_color_2 a.instance-' + i + ':after { background-color: ' + $topColor + ';  }' + ' .swiper-slide .solid_color_2 a.instance-' + i + ':before { background-color: ' + $bottomColor + '; } ';
6586
6587            });
6588
6589
6590            $('.tilt-button-wrap a').each(function (i) {
6591
6592                $(this).addClass('instance-' + i);
6593
6594                var $currentColor = $(this).css('background-color');
6595                var $color;
6596
6597                if ($(this).attr('data-color-override') != 'false') {
6598                    $color = $(this).attr('data-color-override');
6599                    $(this).css('background-color', $color);
6600                    $currentColor = $color;
6601                }
6602
6603                var $topColor = shadeColor($currentColor, 0.13),
6604                    $bottomColor = shadeColor($currentColor, -0.15);
6605
6606                $tiltButtonCssString += '.tilt-button-wrap a.instance-' + i + ':after { background-color: ' + $topColor + ';  }' + ' .tilt-button-wrap a.instance-' + i + ':before { background-color: ' + $bottomColor + '; } ';
6607
6608            });
6609
6610            // Style
6611            nectarCreateStyle($tiltButtonCssString, 'tilt-button');
6612
6613        }
6614
6615
6616        // Transparent 3D
6617        if ($('.nectar-3d-transparent-button').length > 0) {
6618
6619            var $3dTransButtonCssString = '';
6620            $('.nectar-3d-transparent-button').each(function (i) {
6621
6622
6623                // Webkit rendering fix.
6624                $(this).on('mouseover', function () {
6625                    $(this).find('*').css('display', '');
6626                    var that = $(this);
6627                    setTimeout(function () {
6628                        that.find('*').css('display', 'block');
6629                    }, 60);
6630
6631                });
6632                $(this).on('mouseleave', function () {
6633                    $(this).find('*').css('display', 'block');
6634                    var that = $(this);
6635                    setTimeout(function () {
6636                        that.find('*').css('display', '');
6637                    }, 60);
6638                });
6639
6640                var $that = $(this),
6641                    $size = $that.attr('data-size'),
6642                    $padding = 0,
6643                    v1 = 1.5,
6644                    v2 = 1.65,
6645                    $font_size;
6646
6647                // Size
6648                if ($size == 'large') {
6649                    $padding = 46;
6650                    $font_size = 16;
6651                    v1 = 1.5;
6652                    v2 = 1.7;
6653                } else if ($size == 'medium') {
6654                    $padding = 30;
6655                    $font_size = 16;
6656                } else if ($size == 'small') {
6657                    $padding = 20;
6658                    $font_size = 12;
6659                } else if ($size == 'jumbo') {
6660                    $padding = 54;
6661                    $font_size = 24;
6662                    v1 = 1.5;
6663                    v2 = 1.68;
6664                } else if ($size == 'extra_jumbo') {
6665                    $padding = 100;
6666                    $font_size = 64;
6667                    v1 = 1.6;
6668                    v2 = 1.6;
6669                }
6670
6671                $that.find('svg text').attr('font-size', $font_size);
6672
6673                var $boundingRect = $(this).find('.back-3d .button-text')[0].getBoundingClientRect(),
6674                    $text_width = $boundingRect.width,
6675                    $text_height = $font_size * 1.5;
6676
6677                $that.css({
6678                    'width': ($text_width + $padding * 1.5) + 'px',
6679                    'height': ($text_height + $padding) + 'px'
6680                });
6681
6682                $that.find('> a').css({
6683                    'height': ($text_height + $padding) + 'px'
6684                });
6685
6686                $that.find('.back-3d svg, .front-3d svg').css({
6687                    'width': ($text_width + $padding * 1.5) + 'px',
6688                    'height': ($text_height + $padding) + 'px'
6689                }).attr('viewBox', '0 0 ' + ($text_width + $padding * 1.5) + ' ' + ($text_height + $padding));
6690
6691                $that.find('svg text').attr('transform', 'matrix(1 0 0 1 ' + ($text_width + $padding * v1) / 2 + ' ' + (($text_height + $padding) / v2) + ')');
6692                $that.find('.front-3d, .back-3d').css('transform-origin', '50% 50% -' + ($text_height + $padding) / 2 + 'px');
6693
6694                // Mask
6695                $(this).find('.front-3d svg > rect').attr('id', 'masked-rect-id-' + i);
6696                $(this).find('.front-3d defs mask').attr('id', 'button-text-mask-' + i);
6697
6698                $that.css('visibility', 'visible');
6699                $3dTransButtonCssString += '#masked-rect-id-' + i + ' { mask: url(#button-text-mask-' + i + '); -webkit-mask: url(#button-text-mask-' + i + ')} ';
6700
6701            });
6702
6703            // Extra jumbo resize
6704            createExtraJumboSize();
6705            $window.on('smartresize', createExtraJumboSize);
6706
6707            // Style
6708            nectarCreateStyle($3dTransButtonCssString, 'nectar-td-button');
6709
6710        }
6711
6712        // Gradient btn init
6713        setTimeout(function () {
6714            $('.nectar-button[class*="color-gradient"] .start').removeClass('loading');
6715        }, 150);
6716        // No grad for ff
6717        if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1 ||
6718            navigator.userAgent.indexOf("MSIE ") > -1 ||
6719            navigator.userAgent.match(/Trident\/7\./)) {
6720            $('.nectar-button[class*="color-gradient"] .start').addClass('no-text-grad');
6721        }
6722    }
6723
6724
6725    /**
6726     * Shortcode icon large style
6727     *
6728     * @since 1.0
6729     */
6730    function largeIconHover() {
6731        $('.icon-3x').each(function () {
6732            $(this).closest('.col').on('mouseenter', function () {
6733                $(this).find('.icon-3x').addClass('hovered');
6734            });
6735
6736            $(this).closest('.col').on('mouseleave', function () {
6737                $(this).find('.icon-3x').removeClass('hovered');
6738            });
6739        });
6740
6741        if (navigator.userAgent.indexOf("MSIE ") > -1 || navigator.userAgent.match(/Trident\/7\./)) {
6742            $('[class^="icon-"][class*="color-gradient"], .nectar_icon_wrap[data-color*="extra-color-gradient"] .nectar_icon, .nectar-gradient-text').addClass('no-grad');
6743        }
6744    }
6745
6746
6747    /**
6748     * Team member element - fullscreen style.
6749     *
6750     * @since 7.0
6751     */
6752    function teamMemberFullscreen() {
6753
6754        if ($('.team-member').length === 0) {
6755            return;
6756        }
6757
6758        // Open click event
6759        $body.on('click keydown', '.team-member[data-style="bio_fullscreen"], .team-member[data-style="bio_fullscreen_alt"]', function (e) {
6760
6761            if ($('.nectar_team_member_overlay').length > 0) {
6762                return;
6763            }
6764
6765            // Allow opening on enter.
6766            if (e.type === 'keydown' && !(e.key === "Enter" || e.keyCode === 13)) {
6767                return;
6768            }
6769
6770
6771            var $usingBoxedClass = ($('body > #boxed').length > 0) ? 'in-boxed' : '',
6772                $teamMemberMeta = $(this).find('.nectar_team_bio').html(),
6773                $teamMemberTitle = ($(this).is('[data-style="bio_fullscreen_alt"]')) ? $(this).find('.team-meta h5').html() : $(this).find('.team-meta p').html(),
6774                $teamMemberImg = ($(this).find('.nectar_team_bio_img[data-img-src]').length > 0) ? $(this).find('.nectar_team_bio_img').attr('data-img-src') : '',
6775                $teamMemberStyle = ($(this).is('[data-style="bio_fullscreen_alt"]')) ? 'bio-fullscreen-alt' : 'bio-fullscreen',
6776                $teamName = '';
6777
6778            if ($(this).is('[data-style="bio_fullscreen_alt"]')) {
6779                $teamName = '<div class="title">' + wlEls($teamMemberTitle) + '</div><h2>' + $(this).find('.team-meta h3').text() + '</h2>';
6780            } else {
6781                $teamName = '<h2>' + $(this).find('.team-meta h3').text() + '</h2><div class="title">' + wlEls($teamMemberTitle) + '</div>';
6782            }
6783
6784            $body.append('<div class="nectar_team_member_overlay nectar-modal ' + $usingBoxedClass + '" data-style="' + $teamMemberStyle + '"><div class="inner-wrap"><div class="team_member_details"><div class="bio-inner"><span class="mobile-close"></span>' + $teamName + '<div class="team-desc">' + wlEls($teamMemberMeta) + '</div></div></div><div class="team_member_picture"><div class="team_member_image_bg_cover"></div><div class="team_member_picture_wrap"><div class="team_member_image"></div></div></div></div></div>');
6785
6786            if ($teamMemberImg.length > 0) {
6787
6788                // Fade in img on load
6789                var teamTmpImg = new Image();
6790                teamTmpImg.src = $teamMemberImg;
6791                teamTmpImg.onload = function () {
6792                    $('.nectar_team_member_overlay .team_member_image').css('opacity', '1');
6793                };
6794                $('.nectar_team_member_overlay .team_member_image').css({
6795                    'background-image': 'url("' + $teamMemberImg + '")'
6796                });
6797            }
6798
6799            var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $window.width() > 1000) ? 0 : $headerOuterEl.height();
6800            $('.nectar_team_member_overlay .inner-wrap').css({
6801                'padding-top': $headerNavSpace
6802            });
6803
6804            // No-scroll class - ios ready
6805            if ($('.using-mobile-browser').length > 0) {
6806                $('body,html').addClass('nectar-no-scrolling');
6807            }
6808
6809            teamFullscreenResize();
6810
6811            // Transition in
6812            $('.nectar_team_member_overlay')
6813                .addClass('open')
6814                .addClass('animating');
6815
6816            setTimeout(function () {
6817                $('.nectar_team_member_close').addClass('visible');
6818                $('.nectar_team_member_overlay').removeClass('animating');
6819            }, 500);
6820
6821            if ($('.team-member[data-style="bio_fullscreen"]').length > 0 && nectarDOMInfo.usingMobileBrowser) {
6822                $('.nectar_team_member_overlay').addClass('on-mobile');
6823            }
6824
6825            responsiveVideoIframes();
6826
6827            $(window).trigger('nectar-team-member-opened');
6828
6829        });
6830
6831        // Close click event
6832        $body.on('click', '.nectar_team_member_overlay', function (e) {
6833
6834            if ($(e.target).is('a') || $(e.target).parents('a').length > 0 ||
6835                $(e.target).is('.skip-team-member-close') || $(e.target).parents('.skip-team-member-close').length > 0) {
6836                return true;
6837            }
6838
6839            if (!$(this).hasClass('animating')) {
6840
6841                $('.nectar_team_member_overlay').removeClass('open');
6842                $('.nectar_team_member_close').removeClass('visible');
6843
6844                if ($('.using-mobile-browser').length > 0) {
6845                    $('body,html').removeClass('nectar-no-scrolling');
6846                }
6847
6848                setTimeout(function () {
6849
6850                    $('.nectar_team_member_overlay, .nectar_team_member_close').remove();
6851
6852                }, 820);
6853            }
6854        });
6855
6856        if ($('.team-member[data-style="bio_fullscreen"]').length > 0 || $('.team-member[data-style="bio_fullscreen_alt"]').length > 0) {
6857            $window.on('resize', teamFullscreenResize);
6858            if (!nectarDOMInfo.usingMobileBrowser) {
6859                var closeIndicator = new NectarIconMouseFollow('', 'close-indicator');
6860            }
6861
6862        }
6863
6864    }
6865
6866
6867    /**
6868     * Team member element fullscreen resize event.
6869     *
6870     * @since 7.0
6871     */
6872    function teamFullscreenResize() {
6873        var $leftHeaderSize = ($('body[data-header-format="left-header"]').length > 0 && $window.width() > 1000) ? 275 : 0;
6874        $('.nectar_team_member_overlay').css({
6875            'width': $window.width() - $leftHeaderSize,
6876            'left': $leftHeaderSize
6877        });
6878    }
6879
6880
6881    /**
6882     * WPBakery column element BG hover
6883     *
6884     * @since 5.0
6885     */
6886    function columnBGColors() {
6887
6888        var $columnColorCSS = '';
6889
6890        $('.wpb_column').each(function (i) {
6891
6892            $(this).removeClass(function (index, className) {
6893                return (className.match(/(^|\s)instance-\S+/g) || []).join(' ');
6894            });
6895
6896            if ($(this).attr('data-has-bg-color') == 'true' || $(this).is('[data-hover-bg^="#"]')) {
6897                $(this).addClass('instance-' + i);
6898            }
6899
6900
6901            var $innerSelector = ($(this).find('> .vc_column-inner > .column-bg-overlay-wrap').length > 0 || $(this).find('> .vc_column-inner > .column-bg-overlay').length > 0) ? ' > .vc_column-inner ' : '';
6902            var $innerWrapSelector = ($(this).find($innerSelector + ' > .column-bg-overlay-wrap').length > 0) ? '> .column-bg-overlay-wrap ' : '';
6903
6904            // BG color
6905            if ($(this).attr('data-has-bg-color') == 'true') {
6906                $columnColorCSS += '.wpb_column.instance-' + i + $innerSelector + $innerWrapSelector + ' > .column-bg-overlay { background-color:' + $(this).attr('data-bg-color') + ';  opacity: ' + $(this).attr('data-bg-opacity') + '; }';
6907            }
6908
6909            // Hover bg color
6910            if ($(this).is('[data-hover-bg^="#"]')) {
6911                $columnColorCSS += '.wpb_column.instance-' + i + ':hover ' + $innerSelector + $innerWrapSelector + ' > .column-bg-overlay { background-color: ' + $(this).attr('data-hover-bg') + '!important; opacity: ' + $(this).attr('data-hover-bg-opacity') + '!important; }';
6912            }
6913        });
6914
6915        // Style
6916        nectarCreateStyle($columnColorCSS, 'column-bg-colors');
6917
6918    }
6919
6920
6921    /**
6922     * Displace filter column/row BG effect
6923     *
6924     * @since 10.5
6925     */
6926    function nectarLiquidBGs() {
6927        $liquidBG_EL = [];
6928
6929        if (typeof NectarLiquid == 'undefined' || nectarDOMInfo.usingFrontEndEditor) {
6930            return;
6931        }
6932
6933        $('.row-bg-wrap[data-bg-animation*="displace-filter"] .row-bg.using-image, .column-image-bg-wrap[data-bg-animation*="displace-filter"] .column-image-bg').each(function (i) {
6934
6935            var $that_el = $(this);
6936            var $type;
6937            var $el_type;
6938
6939            if ($(this).is('.row-bg')) {
6940                $type = $(this).parents('.row-bg-wrap').attr('data-bg-animation');
6941                $el_type = 'row';
6942            } else if ($(this).is('.column-image-bg')) {
6943                $type = $(this).parents('.column-image-bg-wrap').attr('data-bg-animation');
6944                $el_type = 'col';
6945            }
6946
6947            $liquidBG_EL[i] = new NectarLiquid($that_el, $type, $el_type);
6948
6949        });
6950    }
6951
6952
6953    /**
6954     * Morphing outline element creation.
6955     *
6956     * @since 5.0
6957     */
6958    function morphingOutlines() {
6959
6960        if ($('.morphing-outline').length > 0) {
6961
6962            var $morphingOutlineCSS = '',
6963                $frontEndEditorMOSelector = ($('body.vc_editor').length > 0) ? '' : '>';
6964
6965            $('.morphing-outline').each(function (i) {
6966
6967                $(this).removeClass(function (index, className) {
6968                    return (className.match(/(^|\s)instance-\S+/g) || []).join(' ');
6969                });
6970
6971                $(this).addClass('instance-' + i).css({
6972                    'visibility': 'visible'
6973                });
6974
6975                var $width = $(this).find('.inner').width(),
6976                    $height = $(this).find('.inner').height(),
6977                    $border = parseInt($(this).attr("data-border-thickness")),
6978                    $hover = ($('body[data-button-style*="rounded"]').length > 0) ? ':hover' : '',
6979                    $hover2 = ($('body[data-button-style*="rounded"]').length > 0) ? '' : ':hover';
6980
6981                $morphingOutlineCSS += 'body .morphing-outline.instance-' + i + ' .inner > * { color: ' + $(this).attr("data-starting-color") + '; } ';
6982                $morphingOutlineCSS += 'body .morphing-outline.instance-' + i + ' .inner:after  { border-width:' + $(this).attr("data-border-thickness") + 'px ; border-color: ' + $(this).attr("data-starting-color") + '; } ';
6983
6984                $morphingOutlineCSS += 'body .wpb_column:hover > .wpb_wrapper ' + $frontEndEditorMOSelector + ' .morphing-outline.instance-' + i + ' .inner > *, body .wpb_column:hover > .vc_column-inner > .wpb_wrapper ' + $frontEndEditorMOSelector + ' .morphing-outline.instance-' + i + ' .inner > * { color: ' + $(this).attr("data-hover-color") + '; } ';
6985                $morphingOutlineCSS += 'body .wpb_column:hover > .wpb_wrapper ' + $frontEndEditorMOSelector + ' .morphing-outline.instance-' + i + ' .inner:after, body .wpb_column:hover > .vc_column-inner > .wpb_wrapper ' + $frontEndEditorMOSelector + ' .morphing-outline.instance-' + i + ' .inner:after  { border-color: ' + $(this).attr("data-hover-color") + '; } ';
6986
6987                // Padding calcs
6988                $morphingOutlineCSS += 'body .wpb_column' + $hover2 + ' > .wpb_wrapper ' + $frontEndEditorMOSelector + ' .morphing-outline.instance-' + i + ' .inner:after, body .wpb_column' + $hover2 + ' > .vc_column-inner > .wpb_wrapper ' + $frontEndEditorMOSelector + ' .morphing-outline.instance-' + i + ' .inner:after { padding: ' + (($width + 100 + $border * 2 - $height) / 2 - $border) + 'px 50px}';
6989                $morphingOutlineCSS += '.morphing-outline.instance-' + i + ' { padding: ' + (30 + ($width + 80 + $border * 2 - $height) / 2 - $border) + 'px 50px}';
6990                $morphingOutlineCSS += 'body .wpb_column' + $hover2 + ' > .wpb_wrapper ' + $frontEndEditorMOSelector + ' .morphing-outline.instance-' + i + ' .inner:after, body .wpb_column' + $hover2 + ' > .vc_column-inner > .wpb_wrapper ' + $frontEndEditorMOSelector + ' .morphing-outline.instance-' + i + ' .inner:after { top: -' + parseInt((($width + 100 + $border * 2 - $height) / 2 - $border) + $border) + 'px }';
6991
6992                $morphingOutlineCSS += 'body .wpb_column > .wpb_wrapper ' + $frontEndEditorMOSelector + ' .morphing-outline.instance-' + i + ' .inner:after, body .wpb_column > .vc_column-inner > .wpb_wrapper ' + $frontEndEditorMOSelector + ' .morphing-outline.instance-' + i + ' .inner:after { left: -' + parseInt(50 + $border) + 'px }';
6993
6994                // Hover
6995                $morphingOutlineCSS += 'body .wpb_column' + $hover + ' > .wpb_wrapper ' + $frontEndEditorMOSelector + ' .morphing-outline.instance-' + i + ' .inner:after, body .wpb_column' + $hover + ' > .vc_column-inner > .wpb_wrapper ' + $frontEndEditorMOSelector + ' .morphing-outline.instance-' + i + ' .inner:after { padding: 50px 50px}';
6996                $morphingOutlineCSS += 'body .wpb_column' + $hover + ' > .wpb_wrapper ' + $frontEndEditorMOSelector + ' .morphing-outline.instance-' + i + ' .inner:after, body .wpb_column' + $hover + ' > .vc_column-inner > .wpb_wrapper ' + $frontEndEditorMOSelector + ' .morphing-outline.instance-' + i + ' .inner:after { top: -' + parseInt(50 + $border) + 'px }';
6997
6998            });
6999
7000            // Style
7001            nectarCreateStyle($morphingOutlineCSS, 'morphing-outlines');
7002
7003        }
7004
7005    }
7006
7007
7008    /**
7009     * Morphing outline element initialization.
7010     *
7011     * @since 5.0
7012     */
7013    function morphingOutlinesInit() {
7014
7015        if ($('.morphing-outline').length > 0) {
7016
7017            // Create style.
7018            setTimeout(morphingOutlines, 100);
7019            setTimeout(fullWidthContentColumns, 125);
7020
7021            // Handle resize.
7022            $window.on('smartresize', morphingOutlines);
7023
7024        }
7025
7026    }
7027
7028
7029    /**
7030     * SVG icon element animations
7031     *
7032     * @since 6.0
7033     * @see waypoints
7034     */
7035    function svgAnimations() {
7036
7037        var $svgOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : 'bottom-in-view';
7038
7039        if ($svgIcons.length == 0 || nectarDOMInfo.usingFrontEndEditor && $('#nectar_fullscreen_rows').length > 0) {
7040
7041            $('.svg-icon-holder:not(.animated-in)').has('svg').each(function (i) {
7042
7043                var $that = $(this);
7044
7045                if (bypassAnimations) {
7046                    $that.attr('data-animation', 'false');
7047                }
7048                // Size
7049                $that.find('svg').css({
7050                    'height': parseInt($that.attr('data-size')) + 'px',
7051                    'width': parseInt($that.attr('data-size')) + 'px'
7052                });
7053
7054                // Animation
7055                $(this).find('svg').attr('id', 'nectar-svg-animation-instance-' + i);
7056
7057                var $animationSpeed = ($that.is('[data-animation-speed]') && $that.attr('data-animation-speed').length > 0) ? $that.attr('data-animation-speed') : 200;
7058
7059                if ($that.attr('data-animation') == 'false') {
7060                    $animationSpeed = 1;
7061                    $that.css('opacity', '1');
7062                }
7063
7064                if (!$that.hasClass('bound')) {
7065                    $svgIcons[i] = new Vivus($that.find('svg').attr('id'), {
7066                        type: 'delayed',
7067                        pathTimingFunction: Vivus.EASE_OUT,
7068                        animTimingFunction: Vivus.LINEAR,
7069                        duration: $animationSpeed,
7070                        onReady: svgInit
7071                    });
7072                }
7073
7074                if ($animationSpeed !== 1) {
7075
7076                    var waypoint = new Waypoint({
7077                        element: $that[0],
7078                        handler: function () {
7079                            if ($that.hasClass('animated-in')) {
7080                                waypoint.destroy();
7081                                return;
7082                            }
7083
7084                            checkIfReady();
7085                            $that.addClass('animated-in');
7086                            waypoint.destroy();
7087                        },
7088                        offset: $svgOffsetPos
7089
7090                    });
7091
7092                } else {
7093                    checkIfReady();
7094                }
7095
7096                function checkIfReady() {
7097
7098                    var $animationDelay = 0;
7099
7100                    if ($that.is('[data-animation-delay]') &&
7101                        $that.attr('data-animation-delay').length > 0 &&
7102                        $that.attr('data-animation') != 'false') {
7103                        $animationDelay = $that.attr('data-animation-delay');
7104                    }
7105
7106                    var $iconID = $that.find('svg').attr('id').replace(/[^0-9]/g, '');
7107
7108                    if ($svgIcons[$iconID].isReady == true) {
7109                        setTimeout(function () {
7110                            $that.css('opacity', '1');
7111                            $svgIcons[$iconID].reset().play();
7112                        }, $animationDelay);
7113                    } else {
7114                        setTimeout(checkIfReady, 50);
7115                    }
7116                }
7117
7118                function svgInit() {
7119
7120                    //set size
7121                    $that.css({
7122                        'height': parseInt($that.attr('data-size')) + 'px',
7123                        'width': parseInt($that.attr('data-size')) + 'px'
7124                    });
7125
7126                }
7127
7128                $that.addClass('bound');
7129
7130            });
7131
7132
7133            // SVG in equal height column resize
7134            if ($('.vc_row-o-equal-height .svg-icon-holder[data-animation="true"]').length > 0 &&
7135                $('#nectar_fullscreen_rows').length == 0) {
7136
7137                $window.on('smartresize', function () {
7138                    clearTimeout($svgResizeTimeout);
7139                    $svgResizeTimeout = setTimeout(function () {
7140
7141                        if ($svgIcons.length > 0) {
7142                            $('.svg-icon-holder.animated-in').each(function () {
7143
7144                                $(this).css('opacity', '1');
7145                                if ($(this).is('[id]')) {
7146                                    var $iconID = $(this).attr('id').replace(/[^0-9]/g, '');
7147                                    $svgIcons[$iconID].finish();
7148                                }
7149
7150                            });
7151                        }
7152
7153                    }, 300);
7154
7155                });
7156
7157            }
7158
7159        }
7160
7161        // After svg animated icons initalized
7162        else {
7163            $('.svg-icon-holder').addClass('animated-in').css('opacity', '1');
7164        }
7165
7166        // Full vc row support
7167        $('#nectar_fullscreen_rows .svg-icon-holder.animated-in').has('svg').each(function (i) {
7168
7169
7170            var $animationDelay = 0;
7171
7172            if ($(this).is('[data-animation-delay]') &&
7173                $(this).attr('data-animation-delay').length > 0 &&
7174                $(this).attr('data-animation') != 'false') {
7175                $animationDelay = $(this).attr('data-animation-delay');
7176            }
7177
7178            var $that = $(this);
7179
7180            var $iconID = $that.find('svg').attr('id').replace(/[^0-9]/g, '');
7181
7182            clearTimeout($animatedSVGIconTimeout[i]);
7183
7184            if ($that.attr('data-animation') == 'false') {
7185
7186                $that.css('opacity', '1');
7187                $svgIcons[$iconID].finish();
7188
7189            } else {
7190
7191                if ($(this).parents('.active').length > 0 ||
7192                    $(this).parents('#footer-outer').length > 0 ||
7193                    $('body.mobile').length > 0) {
7194
7195                    $svgIcons[$iconID].reset();
7196                    $animatedSVGIconTimeout[i] = setTimeout(function () {
7197                        $svgIcons[$iconID].play();
7198                    }, $animationDelay);
7199
7200                } else {
7201                    $svgIcons[$iconID].reset().stop();
7202                }
7203            }
7204        });
7205
7206    }
7207
7208
7209    /**
7210     * Fancy unordered list element initialization.
7211     *
7212     * @since 4.0
7213     * @see waypoints
7214     */
7215    function nectarFancyUlInit() {
7216
7217        $($fullscreenSelector + '.nectar-fancy-ul').each(function () {
7218
7219            var $animation = $(this).attr('data-animation'),
7220                $animationDelay = 0;
7221
7222            if ($(this).is('[data-animation-delay]') &&
7223                $(this).attr('data-animation-delay').length > 0 &&
7224                $(this).attr('data-animation') != 'false') {
7225                $animationDelay = $(this).attr('data-animation-delay');
7226            }
7227
7228            if ($animation == 'true') {
7229
7230                var $that = $(this),
7231                    waypoint = new Waypoint({
7232                        element: $that[0],
7233                        handler: function () {
7234
7235                            if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) {
7236                                waypoint.destroy();
7237                                return;
7238                            }
7239
7240                            setTimeout(function () {
7241                                $that.find('li').each(function (i) {
7242                                    var $that = $(this);
7243                                    $that.delay(i * 220).transition({
7244                                        'opacity': '1',
7245                                        'left': '0'
7246                                    }, 220, 'easeOutCubic');
7247                                });
7248                            }, $animationDelay);
7249
7250                            $that.addClass('animated-in');
7251                            waypoint.destroy();
7252                        },
7253                        offset: 'bottom-in-view'
7254
7255                    });
7256
7257            }
7258
7259        });
7260
7261    }
7262
7263
7264    /**
7265     * Fancy unordered list element icons.
7266     *
7267     * @since 11.0
7268     */
7269    function nectarFancyUlIcons() {
7270
7271        $('.nectar-fancy-ul:not([data-list-icon="dot"]):not([data-list-icon="none"])').each(function () {
7272
7273            var $icon = $(this).attr('data-list-icon'),
7274                $color = $(this).attr('data-color');
7275
7276            $(this).find('li').each(function () {
7277                $(this).find('> i').remove();
7278                $(this).prepend('<i class="icon-default-style ' + $icon + ' ' + $color + '"></i> ');
7279            });
7280
7281        });
7282
7283    }
7284
7285
7286    /**
7287     * Flipbox element height calculations.
7288     *
7289     * @since 7.0
7290     */
7291    function flipBoxHeights() {
7292
7293        $('.nectar-flip-box').each(function () {
7294
7295            var $flipBoxMinHeight = parseInt($(this).attr('data-min-height')),
7296                $flipBoxHeight = $(this).find('.flip-box-front .inner').height();
7297
7298            if ($(this).find('.flip-box-back .inner').height() > $(this).find('.flip-box-front .inner').height()) {
7299                $flipBoxHeight = $(this).find('.flip-box-back .inner').height();
7300            }
7301
7302            if ($flipBoxHeight >= $flipBoxMinHeight - 80) {
7303                $(this).find('> div').css('height', $flipBoxHeight + 80);
7304            } else {
7305                $(this).find('> div').css('height', 'auto');
7306            }
7307
7308            // Safari needs 3D translate.
7309            if ($(this).parent().hasClass('wpb_wrapper')) {
7310                $(this).parent().css('transform', 'translateZ(0)');
7311            }
7312
7313        });
7314    }
7315
7316
7317    /**
7318     * Flipbox element events.
7319     *
7320     * @since 7.0
7321     */
7322    function flipBoxInit() {
7323
7324        if ($('.nectar-flip-box').length > 0) {
7325
7326            // Mobile gets click.
7327            if (nectarDOMInfo.usingMobileBrowser) {
7328                $body.on('click', '.nectar-flip-box', function () {
7329                    $(this).toggleClass('flipped');
7330                });
7331            }
7332
7333            flipBoxHeights();
7334
7335            // Handle resize.
7336            $window.on('smartresize', flipBoxHeights);
7337        }
7338
7339    }
7340
7341
7342    /**
7343     * Runs before other full width section calculations.
7344     *
7345     * @since 4.0
7346     */
7347    function fullWidthSectionsPreInit() {
7348
7349        // Nectar Slider force full width parent row when using full width element option.
7350        $('.wpb_row .vc_col-sm-12 .nectar-slider-wrap[data-full-width="true"]').each(function () {
7351            if ($(this).parents('.wpb_row.full-width-section').length == 0 && $(this).parents('.wpb_row.full-width-content').length == 0) {
7352                $(this).parents('.wpb_row').addClass('full-width-section');
7353            }
7354        });
7355
7356        // Handle percent row padding values when using the boxed theme option.
7357        if (!nectarDOMInfo.usingMobileBrowser && $('body[data-boxed-style="1"]').length > 0 && $('#boxed').length > 0) {
7358            fullWidthRowPaddingAdjustCalcBoxed();
7359        }
7360
7361    }
7362
7363
7364    /**
7365     * Full width calculations for legacy items.
7366     *
7367     * @since 4.0
7368     */
7369    function fullWidthSections() {
7370
7371        if ($('.carousel-wrap[data-full-width="true"], .portfolio-items[data-col-num="elastic"]:not(.fullwidth-constrained), #boxed .full-width-content').length == 0) {
7372            return;
7373        }
7374
7375        var $windowInnerWidth = nectarDOMInfo.winW,
7376            $bodyBorderWidth = ($('.body-border-right').length > 0 && $windowInnerWidth > 1000 || $('.body-border-right').length > 0 && window.nectarOptions && window.nectarOptions.body_border_mobile && window.nectarOptions.body_border_mobile === '1') ? parseInt($('.body-border-right').width()) * 2 : 0,
7377            $container_width = ($('.container-wrap').length > 0) ? parseInt($('.container-wrap').outerWidth()) : $window.width(),
7378            $extended_padding = ($('body[data-ext-padding]').length > 0) ? parseInt($('body').attr('data-ext-padding')) * 2 : 180;
7379
7380        var $windowWidth,
7381            $justOutOfSight,
7382            $mainContentWidth;
7383
7384        // Takes mobile percentage max width into calcs.
7385        var mainContentWidthNormalized = $('.main-content').css('max-width');
7386
7387        if (mainContentWidthNormalized.indexOf('%') > -1) {
7388            var scrollbarWidth = window.innerWidth - document.documentElement.clientWidth;
7389            mainContentWidthNormalized = parseInt(mainContentWidthNormalized) / 100 * (nectarDOMInfo.winW - scrollbarWidth);
7390        } else {
7391            mainContentWidthNormalized = parseInt(mainContentWidthNormalized);
7392        }
7393
7394
7395        if ($('#boxed').length == 1) {
7396            $justOutOfSight = ((parseInt($('.container-wrap').width()) - parseInt($('.main-content').width())) / 2) + 4;
7397        } else {
7398
7399            // Ext responsive mode is on - add the extra padding into the calcs
7400            var $extResponsivePadding = ($('body[data-ext-responsive="true"]').length > 0 && $windowInnerWidth >= 1000) ? $extended_padding : 0;
7401
7402            if ($container_width - $bodyBorderWidth <= mainContentWidthNormalized) {
7403                $windowWidth = mainContentWidthNormalized;
7404            } else {
7405                $windowWidth = $container_width - $bodyBorderWidth;
7406            }
7407
7408
7409            var $contentWidth = mainContentWidthNormalized;
7410
7411            // Single post fullwidth
7412            if ($('body.single-post[data-ext-responsive="true"]').length > 0 && $('.container-wrap.no-sidebar').length > 0) {
7413                $contentWidth = $('.post-area').width();
7414                $extResponsivePadding = 0;
7415            }
7416
7417            $justOutOfSight = Math.ceil((($windowWidth + $extResponsivePadding - $contentWidth) / 2));
7418        }
7419
7420
7421        $('.carousel-outer').has('.carousel-wrap[data-full-width="true"]').css('overflow', 'visible');
7422
7423        $('.carousel-wrap[data-full-width="true"], .portfolio-items[data-col-num="elastic"]:not(.fullwidth-constrained), #boxed .full-width-content').each(function () {
7424
7425            var $leftHeaderSize = ($('#header-outer[data-format="left-header"]').length > 0 && $windowInnerWidth >= 1000) ? parseInt($('#header-outer[data-format="left-header"]').width()) : 0;
7426            var $bodyBorderWidth = ($('.body-border-right').length > 0 && $windowInnerWidth > 1000 || $('.body-border-right').length > 0 && window.nectarOptions && window.nectarOptions.body_border_mobile && window.nectarOptions.body_border_mobile === '1') ? (parseInt($('.body-border-right').width()) * 2) - 2 : 0;
7427
7428            // Boxed.
7429            if ($('#boxed').length == 1) {
7430
7431                var mainContentBoxed = ($windowInnerWidth >= 690) ? parseInt($('.main-content').width()) : mainContentWidthNormalized;
7432                $mainContentWidth = ($('#nectar_fullscreen_rows').length == 0) ? mainContentBoxed : parseInt($(this).parents('.container').width());
7433
7434                if ($('body.single-post[data-ext-responsive="true"]').length > 0 && $('.container-wrap.no-sidebar').length > 0 && $(this).parents('.post-area').length > 0) {
7435                    $contentWidth = $('.post-area').width();
7436                    $extResponsivePadding = 0;
7437                    $windowWidth = $container_width - $bodyBorderWidth;
7438                    $justOutOfSight = Math.ceil((($windowWidth + $extResponsivePadding - $contentWidth) / 2));
7439                } else {
7440                    if ($(this).parents('.page-submenu').length > 0) {
7441                        $justOutOfSight = ((parseInt($('.container-wrap').width()) - $mainContentWidth) / 2);
7442                    } else {
7443                        $justOutOfSight = ((parseInt($('.container-wrap').width()) - $mainContentWidth) / 2) + 4;
7444                    }
7445                }
7446            } else {
7447
7448                if ($('body.single-post[data-ext-responsive="true"]').length > 0 && $('.container-wrap.no-sidebar').length > 0 && $(this).parents('.post-area').length > 0) {
7449
7450                    $contentWidth = $('.post-area').width();
7451                    $extResponsivePadding = 0;
7452                    $windowWidth = $container_width - $bodyBorderWidth;
7453
7454                } else {
7455
7456                    var $mainContentMaxWidth = ($('#nectar_fullscreen_rows').length == 0) ? mainContentWidthNormalized : parseInt($(this).parents('.container').css('max-width'));
7457
7458                    if ($container_width - $bodyBorderWidth <= $mainContentMaxWidth) {
7459                        $windowWidth = $mainContentMaxWidth;
7460                    }
7461
7462                    $contentWidth = $mainContentMaxWidth;
7463                    $extResponsivePadding = ($('body[data-ext-responsive="true"]').length > 0 && nectarDOMInfo.winW >= 1000) ? $extended_padding : 0;
7464
7465                    if ($leftHeaderSize > 0) {
7466                        $extResponsivePadding = ($('body[data-ext-responsive="true"]').length > 0 && nectarDOMInfo.winW >= 1000) ? 120 : 0;
7467                    }
7468
7469                }
7470
7471                $justOutOfSight = Math.ceil((($windowWidth + $extResponsivePadding - $contentWidth) / 2));
7472
7473            }
7474
7475            var $extraSpace = 0;
7476            if ($(this).hasClass('carousel-wrap')) {
7477                $extraSpace = 1;
7478            }
7479            if ($(this).hasClass('portfolio-items')) {
7480                $extraSpace = 5;
7481            }
7482
7483            var $carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight * 2) : $container_width - $bodyBorderWidth + $extraSpace;
7484
7485            // When using gutter on portfolio don't add extra space
7486            if ($('#boxed').length == 0 && $(this).hasClass('portfolio-items') && $(this).is('[data-gutter*="px"]') && $(this).attr('data-gutter').length > 0 && $(this).attr('data-gutter') != 'none') {
7487                if ($container_width > 1000) {
7488                    $carouselWidth = $container_width - $bodyBorderWidth + 3;
7489                } else {
7490                    $carouselWidth = $container_width - $bodyBorderWidth;
7491                }
7492            }
7493
7494            if ($(this).parent().hasClass('default-style')) {
7495
7496                $mainContentWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').width()) : parseInt($(this).parents('.container').width());
7497
7498                if ($('#boxed').length != 0) {
7499                    $carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight * 2) : $container_width + $extraSpace;
7500                } else {
7501                    $carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight * 2) : ($container_width - $bodyBorderWidth) - (($container_width - $bodyBorderWidth) * 0.025) + $extraSpace;
7502                    $windowWidth = ($container_width - $bodyBorderWidth <= $mainContentWidth) ? $mainContentWidth : ($container_width - $bodyBorderWidth) - (($container_width - $bodyBorderWidth) * 0.025);
7503                    $justOutOfSight = Math.ceil((($windowWidth - $mainContentWidth) / 2));
7504                }
7505
7506            } else if ($(this).parent().hasClass('spaced')) {
7507
7508                $mainContentWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').width()) : parseInt($(this).parents('.container').width());
7509
7510                if ($('#boxed').length != 0) {
7511                    $carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight * 2) - ($container_width * 0.02) : $container_width + $extraSpace;
7512                } else {
7513                    $carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight * 2) : ($container_width - $bodyBorderWidth) - Math.ceil(($container_width - $bodyBorderWidth) * 0.02) + $extraSpace;
7514                    var $windowWidth2 = ($container_width - $bodyBorderWidth <= $mainContentWidth) ? $mainContentWidth : ($container_width - $bodyBorderWidth) - (($container_width - $bodyBorderWidth) * 0.02);
7515                    $justOutOfSight = Math.ceil((($windowWidth2 - $mainContentWidth) / 2) + 2);
7516                }
7517            }
7518
7519            // Make sure the element/row is capable of going full width.
7520            if (!$(this).parents('.span_9').length > 0 &&
7521                !$(this).parent().hasClass('span_3') &&
7522                $(this).parent().attr('id') != 'sidebar-inner' &&
7523                !$(this).find('.nectar-carousel-flickity-fixed-content').length > 0 &&
7524                $(this).parent().attr('id') != 'portfolio-extra') {
7525
7526                // Escape if inside woocoommerce page and not using applicable layout
7527                if ($('.single-product').length > 0 &&
7528                    $(this).parents('#tab-description').length > 0 &&
7529                    $(this).parents('.full-width-tabs').length == 0) {
7530
7531                    $(this).css({
7532                        'visibility': 'visible'
7533                    });
7534
7535                } else {
7536                    // Portfolio.
7537                    if ($(this).hasClass('portfolio-items')) {
7538
7539                        if ($(this).parents('.full-width-content').length == 0) {
7540
7541                            $(this).css({
7542                                'margin-left': -$justOutOfSight,
7543                                'left': 0,
7544                                'width': $carouselWidth,
7545                                'visibility': 'visible'
7546                            });
7547
7548                        }
7549
7550                    } else {
7551
7552                        // Fullscreen page rows left.
7553                        if ($('#nectar_fullscreen_rows').length > 0 && $(this).hasClass('wpb_row')) {
7554
7555                            $(this).css({
7556                                'margin-left': -$justOutOfSight,
7557                                'width': $carouselWidth,
7558                                'visibility': 'visible'
7559                            });
7560
7561                        } else {
7562                            // Regular rows.
7563                            if ($(this).parents('.full-width-content').length == 0) {
7564                                $(this).css({
7565                                    'left': 0,
7566                                    'margin-left': -$justOutOfSight,
7567                                    'width': $carouselWidth,
7568                                    'visibility': 'visible'
7569                                });
7570                            }
7571                        }
7572
7573                    }
7574
7575                }
7576            } else if ($(this).parent().attr('id') == 'portfolio-extra' && $('#full_width_portfolio').length != 0) {
7577
7578                if (!$(this).find('.nectar-carousel-flickity-fixed-content').length > 0) {
7579                    $(this).css({
7580                        'left': 0,
7581                        'margin-left': -$justOutOfSight,
7582                        'width': $carouselWidth,
7583                        'visibility': 'visible'
7584                    });
7585                }
7586
7587            } else {
7588
7589                $(this).css({
7590                    'margin-left': 0,
7591                    'width': 'auto',
7592                    'left': '0',
7593                    'visibility': 'visible'
7594                });
7595            }
7596
7597        });
7598
7599    }
7600
7601
7602    /**
7603     * First full width row on page
7604     *
7605     * @since 4.0
7606     */
7607    function firstFWSection() {
7608
7609        $('.full-width-section.wpb_row, .full-width-content.wpb_row').each(function () {
7610
7611            var $parent = $(this).parent();
7612            if (!$parent.hasClass('span_9') &&
7613                !$parent.hasClass('span_3') &&
7614                $parent.attr('id') != 'sidebar-inner') {
7615
7616                if ($(this).parents('#portfolio-extra').length > 0 && $('#full_width_portfolio').length == 0) {
7617                    return false;
7618                }
7619
7620                if ($(this).index() == '0' &&
7621                    $pageHeaderBG.length == 0 &&
7622                    $('.page-header-no-bg').length == 0 &&
7623                    $('.project-title').length == 0 &&
7624                    $('body.single').length == 0) {
7625
7626                    $(this).addClass('first-section');
7627
7628                    $(this).addClass('loaded');
7629
7630                }
7631
7632            }
7633
7634        });
7635
7636    }
7637
7638
7639    /**
7640     * Scroll Position Based Animations
7641     *
7642     * @since 14.0
7643     */
7644    function NectarScrollPosAnimations(el) {
7645
7646        this.$element = el;
7647        this.$elementInner = el.find('> .vc_column-inner');
7648        this.inView = false;
7649        this.topLevel = false;
7650        this.bottomLevel = false;
7651        this.lastY = 0;
7652        this.lerp = (el.data('scroll-animation-lerp')) ? parseFloat(el.data('scroll-animation-lerp')) : 0.28;
7653        this.intensity = (el.data('scroll-animation-intensity')) ? Math.max(Math.min(parseFloat(el.data('scroll-animation-intensity')), 8), -8) : 3;
7654
7655        this.intensity = this.intensity / 10;
7656        this.storedWinH = nectarDOMInfo.winH;
7657
7658        if (this.intensity < -0.29) {
7659            this.lerp = 1;
7660        }
7661
7662        this.type = 'translateY';
7663        this.persistOnMobile = (el.is('[data-scroll-animation-mobile]') && 'true' == el.attr('data-scroll-animation-mobile')) ? true : false;
7664
7665        if (!this.$element.hasClass('wpb_column') && this.$element.parents('.cell').length == 0) {
7666            this.$elementInner = el;
7667            this.$element = el.parent();
7668            if (el.is('[data-scroll-animation-movement]')) {
7669                this.$element.attr('data-scroll-animation-movement', el.attr('data-scroll-animation-movement'));
7670            }
7671        }
7672
7673        if (nectarDOMInfo.usingMobileBrowser && false == this.persistOnMobile) {
7674            return;
7675        }
7676        this.setType();
7677        this.calculatePos();
7678        this.trackView();
7679        this.animate();
7680
7681        // Periodically update offsets.
7682        if (this.$element.parents('.wpb_column.has-animation').length == 0) {
7683            setInterval(this.calculatePos.bind(this), 1000);
7684        }
7685
7686        $window.on('resize', this.calculatePos.bind(this));
7687
7688        var that = this;
7689        window.addEventListener("orientationchange", function () {
7690            this.setTimeout(function () {
7691                that.orientationChange();
7692            }, 80);
7693        });
7694
7695    }
7696
7697    NectarScrollPosAnimations.prototype.setType = function () {
7698
7699        // Handle animation type
7700        if (this.$element.is('[data-scroll-animation-movement]')) {
7701            var type = this.$element.attr('data-scroll-animation-movement');
7702            if (type == 'transform_x') {
7703                this.type = 'translateX';
7704            }
7705        }
7706
7707    }
7708    NectarScrollPosAnimations.prototype.calculatePos = function () {
7709
7710        if (nectarState.materialOffCanvasOpen != true && nectarState.ocmAnimating != true) {
7711            this.offsetTop = this.$element.offset().top;
7712            this.height = this.$element.outerHeight();
7713            this.vertCenter = this.storedWinH / 2 - this.height / 2;
7714        }
7715
7716        if (!nectarDOMInfo.usingMobileBrowser) {
7717            this.storedWinH = nectarDOMInfo.winH;
7718        }
7719    };
7720
7721
7722    NectarScrollPosAnimations.prototype.orientationChange = function () {
7723
7724        if (nectarDOMInfo.usingMobileBrowser) {
7725            this.offsetTop = this.$element.offset().top;
7726            this.height = this.$element.outerHeight();
7727            this.storedWinH = nectarDOMInfo.winH;
7728        }
7729
7730    };
7731
7732    NectarScrollPosAnimations.prototype.trackView = function () {
7733
7734        var that = this;
7735
7736        // Top/Bottom levels.
7737        if (this.$element.parents('.top-level').length > 0) {
7738            this.topLevel = true;
7739
7740            if (this.offsetTop > nectarDOMInfo.winH) {
7741                this.topLevel = false;
7742            }
7743        }
7744        if (this.$element.is('.nectar_hook_global_section_parallax_footer')) {
7745            this.bottomLevel = true;
7746        }
7747
7748        if ('IntersectionObserver' in window) {
7749
7750            var options = {
7751                root: (isSafari()) ? null : document,
7752                rootMargin: '250px',
7753            }
7754            var observer = new IntersectionObserver(function (entries) {
7755
7756                entries.forEach(function (entry) {
7757                    var isIntersecting = entry.isIntersecting;
7758
7759                    if (isIntersecting) {
7760                        that.inView = true;
7761                    } else {
7762                        that.inView = false;
7763                    }
7764                });
7765
7766            }, options);
7767
7768            observer.observe(this.$element[0]);
7769
7770        }
7771
7772    };
7773
7774    NectarScrollPosAnimations.prototype.animate = function () {
7775
7776        if (nectarState.materialOffCanvasOpen == true) {
7777            window.requestAnimationFrame(this.animate.bind(this));
7778            return;
7779        }
7780
7781        if (this.lerp == 1) {
7782            this.lastY = nectarDOMInfo.scrollTop;
7783        } else {
7784            this.lastY = parseInt(linearInterpolate(this.lastY, nectarDOMInfo.scrollTop, this.lerp));
7785        }
7786
7787
7788        if (nectarState.animatedScrolling == true) {
7789            this.inView = true;
7790        }
7791
7792        if (this.inView) {
7793
7794            var that = this;
7795            var intensity = this.intensity;
7796
7797            if (nectarDOMInfo.winW < 1025) {
7798                intensity = intensity / 1.2;
7799            }
7800            if (nectarDOMInfo.winW < 690) {
7801                intensity = intensity / 1.35;
7802            }
7803
7804
7805            if (that.topLevel === true && nectarDOMInfo.winW > 1000 || that.topLevel === true && this.persistOnMobile) {
7806                this.$elementInner[0].style.transform = this.type + '(' + -(that.lastY * intensity) + 'px) translateZ(0)';
7807            } else if (that.bottomLevel === true && nectarDOMInfo.winW > 1000 || that.bottomLevel === true && this.persistOnMobile) {
7808                this.$elementInner[0].style.transform = this.type + '(' + -((that.lastY - (that.offsetTop + that.height) + nectarDOMInfo.winH) * intensity) + 'px) translateZ(0)';
7809            } else if (nectarDOMInfo.winW > 1000 || this.persistOnMobile) {
7810                this.$elementInner[0].style.transform = this.type + '(' + -((that.lastY - that.offsetTop + that.vertCenter) * intensity) + 'px) translateZ(0)';
7811            } else {
7812                this.$elementInner[0].style.transform = this.type + '(0px) translateZ(0)';
7813            }
7814
7815        }
7816
7817        window.requestAnimationFrame(this.animate.bind(this));
7818    };
7819
7820
7821    /**
7822     * Parallax BG Scrolling
7823     *
7824     * @since 13.0
7825     */
7826    function NectarParallaxScroll(el, parallaxElClass, speed, type) {
7827
7828        this.$el = el;
7829        this.$parallaxEl = this.$el.find(parallaxElClass);
7830        this.firstSection = false;
7831        this.nestedParallax = false;
7832        this.type = type;
7833        this.speed = speed;
7834        this.storedWinH = nectarDOMInfo.winH;
7835
7836        if (el.parents('.nectar-sticky-tabs').length > 0 ||
7837            el.parents('.nectar-sticky-column-css').length > 0 ||
7838            el.parents('.nectar-global-section-megamenu').length > 0) {
7839            return;
7840        }
7841
7842        this.setup();
7843        this.update();
7844
7845    }
7846
7847    NectarParallaxScroll.prototype.setup = function () {
7848
7849        var that = this;
7850
7851        // Page Header.
7852        if (this.$el.parents('#page-header-bg').length > 0 ||
7853            this.$el.parents('.featured-media-under-header').length > 0) {
7854            this.type = 'page-header';
7855        }
7856
7857
7858        // Is the element in the first row on the page?
7859        if (this.$el.parents('.top-level').length > 0 && this.$el.parents('.parallax_slider_outer').length > 0 ||
7860            this.$el.parents('.top-level').length > 0 && this.$el.hasClass('nectar-simple-slider') ||
7861            this.$el.parents('.top-level').length > 0 && this.$el.hasClass('nectar-recent-posts-single_featured') ||
7862            this.$el.parents('.top-level').length > 0 && this.$el.hasClass('column-image-bg-wrap') && this.$el.parent().parent().is('.vc_col-sm-12:not(.child_column)') ||
7863            this.$el.is('.wpb_row.top-level') ||
7864            this.type == 'page-header' ||
7865            ($('.wpb_row').length == 0 &&
7866                !this.$el.is('.blog_next_prev_buttons') &&
7867                !this.$el.is('#portfolio-nav'))
7868        ) {
7869            this.firstSection = true;
7870        }
7871
7872
7873        //// Nectar Slider.
7874        if ($('.wpb_row').length == 0 &&
7875            this.$el.parents('.parallax_slider_outer').length > 0 &&
7876            this.$el.is('[data-full-width="true"]') ||
7877            ($('#portfolio-extra').length > 0 &&
7878                this.$el.parents('.parallax_slider_outer').length > 0 &&
7879                this.$el.parents('.wpb_row').length > 0 &&
7880                this.$el.parents('.wpb_row').index() == '0')) {
7881            this.firstSection = true;
7882
7883        }
7884        //// Disable first section calcs when using FE editor.
7885        if (nectarDOMInfo.usingFrontEndEditor && this.type != 'page-header') {
7886            this.firstSection = false;
7887        }
7888
7889
7890        // Init class.
7891        this.$parallaxEl.addClass('translate');
7892
7893        // Need to periodically check height/offset.
7894        this.nestedParallax = (this.$parallaxEl.parents('[data-scroll-animation="true"]').length > 0) ? true : false;
7895        if (!this.nestedParallax) {
7896            setInterval(function () {
7897
7898                if (nectarState.materialOffCanvasOpen != true &&
7899                    nectarState.ocmAnimating != true) {
7900                    that.offsetTop = that.$el.offset().top;
7901                    that.height = that.$el.outerHeight(true);
7902                }
7903
7904            }, 800);
7905        }
7906
7907        // Bind events.
7908        $(window).on('nectar-column-animation-start', this.checkColumnAnimation.bind(this));
7909        $(window).on('resize load', this.resize.bind(this));
7910        window.addEventListener("orientationchange", function () {
7911            this.setTimeout(function () {
7912                that.orientationChange();
7913            }, 110);
7914        });
7915
7916        // Initial calc.
7917        this.offsetTop = this.$el.offset().top;
7918        this.height = this.$el.outerHeight(true);
7919
7920    };
7921
7922    NectarParallaxScroll.prototype.checkColumnAnimation = function () {
7923        if (this.$parallaxEl.parents('.col.has-animation.triggered-animation:not(.animated-in)').length > 0) {
7924            this.realtimeOffsetUpdate();
7925        }
7926    };
7927
7928    NectarParallaxScroll.prototype.realtimeOffsetUpdate = function () {
7929        // Triggered when a column animation is active.
7930        var that = this;
7931
7932        var realTimeOffset = setInterval(function () {
7933            if (nectarState.materialOffCanvasOpen != true) {
7934                that.offsetTop = that.$el.offset().top;
7935                that.height = that.$el.outerHeight(true);
7936            }
7937        }, 30);
7938
7939        setTimeout(function () {
7940            clearInterval(realTimeOffset);
7941        }, 2000);
7942
7943    }
7944
7945    NectarParallaxScroll.prototype.resize = function () {
7946
7947        // not on mobile.
7948        if (!nectarDOMInfo.usingMobileBrowser) {
7949            this.storedWinH = nectarDOMInfo.winH;
7950            this.offsetTop = this.$el.offset().top;
7951            this.height = this.$el.outerHeight(true);
7952        } else {
7953            // on mobile, only recalc when item is not in a nested parallax setup.
7954            if (!this.nestedParallax) {
7955                this.offsetTop = this.$el.offset().top;
7956                this.height = this.$el.outerHeight(true);
7957            }
7958        }
7959
7960    };
7961
7962    NectarParallaxScroll.prototype.orientationChange = function () {
7963
7964        if (nectarDOMInfo.usingMobileBrowser) {
7965            this.offsetTop = this.$el.offset().top;
7966            this.height = this.$el.outerHeight(true);
7967            this.storedWinH = nectarDOMInfo.winH;
7968        }
7969
7970    };
7971
7972
7973    NectarParallaxScroll.prototype.update = function () {
7974
7975        // Outside of viewport.
7976
7977        if (this.offsetTop + 150 + this.height < nectarDOMInfo.scrollTop ||
7978            this.offsetTop - 150 > nectarDOMInfo.scrollTop + this.storedWinH ||
7979            nectarState.materialOffCanvasOpen == true) {
7980
7981            for (var i = 0; i < this.$parallaxEl.length; i++) {
7982                this.$parallaxEl[i].style.willChange = 'auto';
7983            }
7984
7985            requestAnimationFrame(this.update.bind(this));
7986            return;
7987        }
7988
7989
7990        for (var i = 0; i < this.$parallaxEl.length; i++) {
7991
7992            if (this.firstSection === true) {
7993                this.$parallaxEl[i].style.transform = 'translate3d(0, ' + nectarDOMInfo.scrollTop * this.speed + 'px, 0)';
7994            } else {
7995
7996                this.$parallaxEl[i].style.transform = 'translate3d(0, ' + ((this.storedWinH + nectarDOMInfo.scrollTop - this.offsetTop) * this.speed) + 'px, 0) scale(1.005)';
7997            }
7998            this.$parallaxEl[i].style.willChange = 'transform';
7999        }
8000
8001        requestAnimationFrame(this.update.bind(this));
8002    };
8003
8004
8005    /**
8006     * Refreshes the pos of all parallax based elements.
8007     *
8008     * @since 14.0
8009     */
8010    $(window).on('salient-parallax-el-recalculate', nectarParallaxElRefresh);
8011
8012    function nectarParallaxElRefresh() {
8013
8014        for (var i = 0; i < parallaxItemsArr.length; i++) {
8015            if (parallaxItemsArr[i]) {
8016                parallaxItemsArr[i].resize();
8017            }
8018        }
8019
8020        for (var i = 0; i < animateElArr.length; i++) {
8021            animateElArr[i].resize();
8022        }
8023
8024        for (var i = 0; i < elParallaxArr.length; i++) {
8025            elParallaxArr[i].calculatePos();
8026        }
8027
8028        for (var i = 0; i < cascadingParallaxArr.length; i++) {
8029            cascadingParallaxArr[i].calculatePos();
8030        }
8031
8032        Waypoint.refreshAll();
8033
8034    }
8035
8036
8037    /**
8038     * Animate css props based on scroll position.
8039     *
8040     * @since 14.1
8041     */
8042    function NectarAnimate(el) {
8043        this.$el = el;
8044
8045        this.animations = {};
8046        this.offsets = {};
8047        this.topLevel = false;
8048
8049        this.timelines = {};
8050
8051        this.devices = {
8052            desktop: {min: 1000, max: 10000000},
8053            tablet: {min: 691, max: 999},
8054            phone: {min: 0, max: 690},
8055        }
8056
8057        this.needsReset = true;
8058        this.activeDevice = 'desktop';
8059        this.storedWinH = nectarDOMInfo.winH;
8060
8061        this.setupProps();
8062        this.lazyInit();
8063
8064    }
8065
8066    NectarAnimate.prototype.setupProps = function () {
8067
8068        var attrs = JSON.parse(this.$el[0].getAttribute("data-nectar-animate-settings"));
8069
8070        // animations.
8071        if (typeof Object.assign == 'function') {
8072            Object.assign(
8073                this.animations,
8074                attrs['animations']
8075            );
8076
8077            // offsets
8078            Object.assign(
8079                this.offsets,
8080                attrs['offsets']
8081            );
8082
8083            // config.
8084            Object.assign(
8085                this,
8086                attrs['config']
8087            );
8088
8089        }
8090
8091        if (this.$el.is('.top-level') ||
8092            this.$el.parents('.top-level').length > 0 ||
8093            nectarDOMInfo.usingFrontEndEditor && this.$el.parents('.vc_element').last().index() === 1) {
8094            this.topLevel = true;
8095        }
8096
8097        // portfolio items.
8098        if ($body.hasClass('single-portfolio') &&
8099            this.$el.parents('#portfolio-extra').length > 0 &&
8100            this.$el.parents('.first-section').length > 0) {
8101            this.topLevel = true;
8102        }
8103
8104
8105    };
8106
8107    NectarAnimate.prototype.lazyInit = function () {
8108
8109        var that = this;
8110
8111        if (!nectarDOMInfo.usingFrontEndEditor && 'IntersectionObserver' in window && !this.$el.hasClass('skip-lazy-init')) {
8112            var that = this;
8113            var observer = new IntersectionObserver(function (entries) {
8114
8115                entries.forEach(function (entry) {
8116                    if (entry.isIntersecting) {
8117                        that.init();
8118                        observer.unobserve(entry.target);
8119                    }
8120                });
8121
8122            }, {
8123                root: (isSafari()) ? null : document,
8124                rootMargin: '400px 0px 400px 0px',
8125                threshold: 0
8126            });
8127
8128            observer.observe(this.$el[0]);
8129        } else {
8130            this.init();
8131        }
8132
8133
8134    };
8135
8136    NectarAnimate.prototype.init = function () {
8137        this.createTimeline();
8138        this.events();
8139        this.update();
8140    };
8141
8142    NectarAnimate.prototype.events = function () {
8143
8144        var that = this;
8145
8146        $(window).on('resize load', this.resize.bind(this));
8147
8148        window.addEventListener("orientationchange", function () {
8149            this.setTimeout(function () {
8150                that.orientationChange();
8151            }, 110);
8152        });
8153
8154        this.resize();
8155    };
8156
8157    NectarAnimate.prototype.resize = function () {
8158
8159        if (!nectarDOMInfo.usingMobileBrowser) {
8160            this.storedWinH = nectarDOMInfo.winH;
8161        }
8162
8163        var rect = this.$el[0].getBoundingClientRect();
8164
8165        this.offsetTop = rect.top + nectarDOMInfo.scrollTop;
8166        this.elHeight = this.$el[0].offsetHeight;
8167
8168        this.setActiveDevice();
8169    };
8170
8171    NectarAnimate.prototype.orientationChange = function () {
8172
8173        if (nectarDOMInfo.usingMobileBrowser) {
8174            var rect = this.$el[0].getBoundingClientRect();
8175
8176            this.offsetTop = rect.top + nectarDOMInfo.scrollTop;
8177            this.elHeight = this.$el[0].offsetHeight;
8178            this.storedWinH = nectarDOMInfo.winH;
8179        }
8180
8181    };
8182
8183    NectarAnimate.prototype.setActiveDevice = function () {
8184
8185        var that = this;
8186        Object.keys(this.devices).forEach(function (device) {
8187            if (nectarDOMInfo.winW >= that.devices[device].min &&
8188                nectarDOMInfo.winW <= that.devices[device].max) {
8189
8190                // Store device.
8191                that.activeDevice = device;
8192
8193                if (typeof that.timelines[device] !== 'undefined') {
8194                    that.timelines[device].reset();
8195                }
8196
8197            }
8198        });
8199
8200    };
8201
8202
8203    NectarAnimate.prototype.createTimeline = function () {
8204
8205        // Device loop
8206        var that = this;
8207        Object.keys(this.devices).forEach(function (device) {
8208
8209            // Skip device if no animations set
8210            if (typeof that.animations[device] === 'undefined') {
8211                return;
8212            }
8213
8214            // Create timeline
8215            that.timelines[device] = anime.timeline({autoplay: false});
8216
8217            // Gather all animation for timeline and starting state.
8218            var timelineAnimations = {};
8219            var initialAnimationState = {};
8220
8221            Object.keys(that.animations[device]).forEach(function (animationKey) {
8222                // Starting.
8223                initialAnimationState[animationKey] = that.animations[device][animationKey]['start'];
8224
8225                // Ending.
8226                timelineAnimations[animationKey] = [that.animations[device][animationKey]['start'], that.animations[device][animationKey]['end']];
8227            });
8228
8229            // Set initial position
8230            that.setActiveDevice();
8231
8232            // Set Tineline.
8233            var elToAnimate = (typeof that.inner_selector !== 'undefined') ? that.$el[0].querySelectorAll(that.inner_selector) : that.$el[0];
8234
8235            var timelineProps = {
8236                targets: elToAnimate,
8237                duration: 1000,
8238                easing: 'linear',
8239            };
8240
8241
8242            Object.assign(timelineProps, timelineAnimations);
8243            that.timelines[device].add(timelineProps, 0);
8244
8245        }); // end device loop.
8246
8247
8248    };
8249
8250
8251    NectarAnimate.prototype.progressValues = function () {
8252
8253        if (typeof this.timelines[this.activeDevice] === 'undefined') {
8254            return;
8255        }
8256
8257        var scrollTop = nectarDOMInfo.scrollTop;
8258        var winH = this.storedWinH;
8259
8260        var triggerStart = parseInt(this.offsets.start) / 100;
8261        var triggerStartPx = winH - (triggerStart * winH);
8262        if (this.offsets.origin === 'bottom') {
8263            triggerStartPx -= this.elHeight;
8264        }
8265
8266        var viewportCalc = (scrollTop - (this.offsetTop - triggerStartPx)) / winH;
8267
8268        if (this.offsets.start === '0' &&
8269            this.offsets.end === '100') {
8270
8271            viewportCalc = (scrollTop - (this.offsetTop - triggerStartPx)) / (winH + this.elHeight);
8272        }
8273
8274        if (this.topLevel) {
8275            triggerStartPx = 0;
8276            viewportCalc = scrollTop / winH;
8277        }
8278
8279        var progress = Math.max(Math.min(viewportCalc, 1), 0);
8280
8281        var triggerEnd = parseInt(this.offsets.end) / 100;
8282        var progressMod = 2 + (-1 * triggerEnd);
8283
8284        var triggerCloseness = triggerEnd - triggerStart - 0.01; // 0.01 cushion to never allow for 0
8285
8286        if (progressMod > 1) {
8287            progressMod = progressMod * (1 / Math.min(triggerCloseness * 2, 0.9));
8288        }
8289
8290        // Scrub through timeline.
8291        if (progress > 0) {
8292            this.needsReset = true;
8293            this.timelines[this.activeDevice].seek(this.timelines[this.activeDevice].duration * progress * progressMod);
8294        } else if (this.needsReset) {
8295            this.timelines[this.activeDevice].reset();
8296            this.needsReset = false;
8297        }
8298
8299    };
8300
8301    NectarAnimate.prototype.update = function () {
8302
8303        if (nectarState.materialOffCanvasOpen != true &&
8304            nectarState.ocmAnimating != true) {
8305            this.progressValues();
8306        }
8307        requestAnimationFrame(this.update.bind(this));
8308
8309    }
8310
8311
8312    function nectarAnimateInit() {
8313
8314        animateElArr = [];
8315
8316        $('[data-nectar-animate-settings]').each(function () {
8317            animateElArr.push(new NectarAnimate($(this)));
8318        });
8319    }
8320
8321    /**
8322     * Parallax scroll speed helper.
8323     *
8324     * @since 4.0
8325     */
8326    function parallaxSrollSpeed(speedString) {
8327
8328        var speed;
8329        switch (speedString) {
8330            case 'slow':
8331                speed = 0.6;
8332                break;
8333            case 'medium':
8334                speed = 0.4;
8335                break;
8336            case 'medium_fast':
8337                speed = 0.28;
8338                break;
8339            case 'fast':
8340                speed = 0.20;
8341                break;
8342            case 'mid_subtle':
8343                speed = 0.15;
8344                break;
8345            case 'subtle':
8346                speed = 0.13;
8347                break;
8348            case 'very_subtle':
8349                speed = 0.12;
8350                break;
8351            case 'minimum':
8352                speed = 0.09;
8353                break;
8354        }
8355
8356        return speed;
8357    }
8358
8359
8360    /**
8361     * Parallax scroll initialization.
8362     *
8363     * @since 4.0
8364     */
8365    function parallaxScrollInit() {
8366
8367        if (nectarDOMInfo.usingMobileBrowser && $('body[data-remove-m-parallax="1"]').length > 0) {
8368            return;
8369        }
8370
8371        // El parallax.
8372        elParallaxArr = [];
8373
8374        $('.wpb_column[data-scroll-animation="true"], .nectar-el-parallax-scroll[data-scroll-animation="true"]').each(function (i) {
8375
8376            imagesLoaded($(this), function (instance) {
8377
8378                // Parallax scrolling.
8379                if ($(instance.elements[0]).is('[data-scroll-animation="true"]') &&
8380                    $('#nectar_fullscreen_rows').length == 0 &&
8381                    $(instance.elements[0]).parents('.n-sticky').length === 0 &&
8382                    $(instance.elements[0]).parents('.nectar-global-section-megamenu').length === 0) {
8383                    elParallaxArr.push(new NectarScrollPosAnimations($(instance.elements[0])));
8384                }
8385
8386            });
8387
8388        });
8389
8390        // BG parallax.
8391        parallaxRowsBGCals();
8392
8393        var parallaxItemCount = 0;
8394
8395        $('.nectar-recent-posts-single_featured, [data-n-parallax-bg="true"], .wpb_row.parallax_section, #page-header-bg[data-parallax="1"] .page-header-bg-image-wrap, #page-header-bg[data-parallax="1"] .nectar-video-wrap, .parallax_slider_outer .nectar-slider-wrap').each(function () {
8396
8397
8398            // Generic.
8399            if ($(this).is('[data-n-parallax-bg][data-parallax-speed]')) {
8400                parallaxItemsArr[parallaxItemCount] = new NectarParallaxScroll($(this), '.parallax-layer', parallaxSrollSpeed($(this).attr('data-parallax-speed')), 'regular');
8401                parallaxItemCount++;
8402            } else {
8403
8404                if ($(this).find('[data-parallax-speed="fixed"]').length == 0) {
8405
8406                    // Slider.
8407                    if ($(this).hasClass('nectar-slider-wrap')) {
8408                        parallaxItemsArr[parallaxItemCount] = new NectarParallaxScroll($(this), '.video-wrap, .image-bg', 0.25, 'nectar-slider');
8409                    }
8410                    // Page Header.
8411                    else if ($(this).hasClass('page-header-bg-image-wrap')) {
8412                        parallaxItemsArr[parallaxItemCount] = new NectarParallaxScroll($(this), '.page-header-bg-image', 0.25, 'page-header');
8413                    } else if ($(this).hasClass('nectar-video-wrap') && $(this).parents('#page-header-bg').length > 0) {
8414                        parallaxItemsArr[parallaxItemCount] = new NectarParallaxScroll($(this), '.nectar-video-bg', 0.25, 'page-header');
8415                    }
8416                    // All Others.
8417                    else {
8418
8419                        if ($(this).find('.row-bg.using-image').length > 0) {
8420                            parallaxItemsArr[parallaxItemCount] = new NectarParallaxScroll($(this), '.row-bg.using-image', parallaxSrollSpeed($(this).find('.row-bg').attr('data-parallax-speed')), 'regular');
8421                        }
8422
8423                        if ($(this).find('> .nectar-video-wrap').length > 0) {
8424                            parallaxItemsArr[parallaxItemCount] = new NectarParallaxScroll($(this), '> .nectar-video-wrap .nectar-video-bg', parallaxSrollSpeed($(this).find('.row-bg').attr('data-parallax-speed')), 'regular');
8425                        }
8426                    }
8427
8428                    parallaxItemCount++;
8429
8430                }
8431
8432            }
8433
8434            $(this).addClass('nectar-parallax-enabled');
8435
8436        });
8437
8438        $('.woocommerce-tabs .wc-tabs li').on('click', function () {
8439            setTimeout(parallaxRowsBGCals, 100);
8440        });
8441
8442
8443    }
8444
8445
8446    /**
8447     * Parallax row background height calculations.
8448     *
8449     * @since 6.0
8450     */
8451    $(window).on('salient-parallax-bg-recalculate', parallaxRowsBGCals);
8452
8453    function parallaxRowsBGCals() {
8454
8455        if (nectarDOMInfo.usingMobileBrowser && $('body[data-remove-m-parallax="1"]').length > 0) {
8456            return;
8457        }
8458
8459        $('.nectar-recent-posts-single_featured, [data-n-parallax-bg="true"], .wpb_row.parallax_section, #page-header-bg[data-parallax="1"] .page-header-bg-image-wrap, .parallax_slider_outer .nectar-slider-wrap .slide-bg-wrap').each(function () {
8460
8461            var $non_page_builder_slider;
8462
8463            if ($(this).parents('.wpb_tab:not(.visible-tab)').length > 0 && $(this).parents('.nectar-scrolling-tabs').length == 0 ||
8464                $(this).parents('.wc-tab').length > 0 && $(this).parents('.wc-tab').css('display') !== 'block') {
8465                return true;
8466            }
8467
8468            if ($(this).find('.row-bg').length == 0 &&
8469                $(this).find('.page-header-bg-image').length > 0) {
8470                //skip processing.
8471            } else if ($(this).find('.row-bg').length == 0 &&
8472                $(this).find('.image-bg').length > 0) {
8473
8474                $non_page_builder_slider = false;
8475
8476                // First nectar slider shortcode without page builder
8477                if ($('.wpb_row').length == 0 &&
8478                    $(this).parents('.nectar-slider-wrap[data-full-width="true"]').length > 0 &&
8479                    $(this).parents('.parallax_slider_outer').length > 0 &&
8480                    $(this).parents('.parallax_slider_outer').index() == '1') {
8481                    $non_page_builder_slider = true;
8482                }
8483
8484                // Portfolio first
8485                if ($('#portfolio-extra').length > 0 &&
8486                    $(this).parents('.wpb_row').length > 0 &&
8487                    $(this).parents('.parallax_slider_outer').length > 0 &&
8488                    $(this).parents('.wpb_row').index() == '0') {
8489                    $non_page_builder_slider = true;
8490                }
8491
8492                // Set heights.
8493                if ($(this).parents('.top-level').length > 0 && !nectarDOMInfo.usingFrontEndEditor ||
8494                    $non_page_builder_slider && !nectarDOMInfo.usingFrontEndEditor) {
8495                    $(this).find('.image-bg').css({
8496                        'height': Math.ceil($(this).parent().offset().top * 0.25) + $(this).outerHeight(true)
8497                    });
8498                } else {
8499                    $(this).find('.image-bg').css({
8500                        'height': Math.ceil($window.height() * 0.25) + $(this).outerHeight(true)
8501                    });
8502                }
8503
8504            }
8505
8506            // Video backgrounds.
8507            if ($(this).find('.row-bg').length == 0 && $(this).find('.video-wrap').length > 0) {
8508
8509                $non_page_builder_slider = false;
8510                // First nectar slider shortcode without page builder
8511                if ($('.wpb_row').length == 0 &&
8512                    $(this).parents('.nectar-slider-wrap[data-full-width="true"]').length > 0 &&
8513                    $(this).parents('.parallax_slider_outer').length > 0 &&
8514                    $(this).parents('.parallax_slider_outer').index() == '1') {
8515                    $non_page_builder_slider = true;
8516                }
8517                // Portfolio first
8518                if ($('#portfolio-extra').length > 0 &&
8519                    $(this).parents('.wpb_row').length > 0 &&
8520                    $(this).parents('.parallax_slider_outer').length > 0 &&
8521                    $(this).parents('.wpb_row').index() == '0') {
8522                    $non_page_builder_slider = true;
8523                }
8524
8525                // Set heights.
8526                if ($(this).parents('.top-level').length > 0 && !nectarDOMInfo.usingFrontEndEditor ||
8527                    $non_page_builder_slider && !nectarDOMInfo.usingFrontEndEditor) {
8528
8529                    $(this).find('.video-wrap').css({
8530                        'height': Math.ceil($(this).parent().offset().top * 0.25) + $(this).outerHeight(true)
8531                    });
8532                } else {
8533                    $(this).find('.video-wrap').css({
8534                        'height': Math.ceil(nectarDOMInfo.winH * 0.25) + $(this).outerHeight(true)
8535                    });
8536                }
8537
8538                var vid = $(this).find('.video-wrap video'),
8539                    vid_w_orig = 1280,
8540                    vid_h_orig = 720;
8541
8542                // Get the parent element size
8543                var container_w = vid.parent().width(),
8544                    container_h = vid.parent().height(),
8545                    scale_w = container_w / vid_w_orig,
8546                    scale_h = container_h / vid_h_orig;
8547
8548                var scale = scale_w > scale_h ? scale_w : scale_h;
8549
8550                // Scale the video.
8551                vid.width(scale * vid_w_orig);
8552                vid.height(scale * vid_h_orig);
8553
8554            } else {
8555
8556                // Top Level Special elements, Recent posts/ Simple Slider.
8557                if ($(this).is('.nectar-recent-posts-single_featured') &&
8558                    $(this).parents('.top-level').length > 0 &&
8559                    !nectarDOMInfo.usingFrontEndEditor) {
8560                    //skip processing.
8561                } else if ($(this).is('.nectar-simple-slider') &&
8562                    $(this).parents('.top-level').length > 0 &&
8563                    !nectarDOMInfo.usingFrontEndEditor) {
8564                    //skip processing.
8565                } else if ($(this).is('.column-image-bg-wrap') &&
8566                    $(this).parents('.top-level').length > 0 &&
8567                    $(this).parent().parent().is('.vc_col-sm-12:not(.child_column)')) {
8568                    //skip processing.
8569                }
8570                // Regular.
8571                else if (!$(this).hasClass('top-level') || nectarDOMInfo.usingFrontEndEditor || $(this).find('.parallax-layer').length > 0) {
8572
8573                    var classSelector = '.row-bg, > .nectar-video-wrap .nectar-video-inner';
8574                    var parallaxSpeed = $(this).find('.row-bg').attr('data-parallax-speed');
8575
8576                    if ($(this).find('.parallax-layer').length > 0 && !$(this).hasClass('wpb_row')) {
8577                        classSelector = '.parallax-layer';
8578                        parallaxSpeed = $(this).attr('data-parallax-speed');
8579                    }
8580
8581                    var $ifFast = ($(this).find(classSelector + '[data-parallax-speed="fast"]').length > 0) ? 60 : 0;
8582
8583                    if ($(this).parents('#page-header-bg').length == 0) {
8584                        $(this).find(classSelector).css({
8585                            'height': Math.ceil(nectarDOMInfo.winH * parallaxSrollSpeed(parallaxSpeed)) + $(this).outerHeight(true) + $ifFast
8586                        });
8587                    }
8588
8589
8590                }
8591
8592            }
8593
8594        });
8595
8596    }
8597
8598
8599    /**
8600     * Class names added for specific full width section rows at top
8601     *
8602     * @since 3.0
8603     */
8604    function fwsClasses() {
8605
8606        $('.wpb_wrapper > .nectar-slider-wrap[data-full-width="true"]').each(function () {
8607            if (!$(this).parent().hasClass('span_9') && !$(this).parent().hasClass('span_3') && $(this).parent().attr('id') != 'sidebar-inner') {
8608                if ($(this).parents('.wpb_row').index() == '0') {
8609                    $(this).addClass('first-nectar-slider');
8610                }
8611            }
8612        });
8613
8614        var $contentElementsNum = ($('#portfolio-extra').length == 0) ? $('.main-content > .row > *').length : $('.main-content > .row #portfolio-extra > *').length;
8615
8616        if ($('#portfolio-extra').length == 0) {
8617            $contentElementsNum = ($('.main-content > .row > .wpb_row').length > 0) ? $('.main-content > .row > .wpb_row').length : $('.main-content > .row > *').length;
8618        } else {
8619            $contentElementsNum = $('.main-content > .row #portfolio-extra > *').length;
8620        }
8621
8622        $('.container-wrap .full-width-section, .container-wrap .full-width-content:not(.page-submenu .full-width-content):not(.blog-fullwidth-wrap), .row > .nectar-slider-wrap[data-full-width="true"], .wpb_wrapper > .nectar-slider-wrap[data-full-width="true"], .portfolio-items[data-col-num="elastic"]').each(function () {
8623
8624            if ($(this).parents('.nectar-global-section.before-footer').length > 0 ||
8625                $(this).parents('[class*="nectar_hook_sidebar"]').length > 0) {
8626                return true;
8627            }
8628
8629
8630            if (!$(this).parent().hasClass('span_9') && !$(this).parent().hasClass('span_3') && $(this).parent().attr('id') != 'sidebar-inner') {
8631
8632                if ($(this).parents('.wpb_row').length > 0) {
8633
8634                    var $parent = $(this).parent();
8635                    var $parentRowIndex = $(this).parents('.wpb_row').index();
8636
8637                    if ($(this).parents('#portfolio-extra').length > 0 &&
8638                        $('#full_width_portfolio').length == 0) {
8639                        return false;
8640                    }
8641
8642                    ////first
8643                    if ($parentRowIndex == '0' && $pageHeaderBG.length != 0) {
8644                        //skip processing.
8645                    } else if ($parentRowIndex == '0' &&
8646                        $pageHeaderBG.length == 0 && $('.page-header-no-bg').length == 0 &&
8647                        $('.project-title').length == 0 && $parentRowIndex == '0' &&
8648                        $('.project-title').length == 0 && $('body[data-bg-header="true"]').length == 0) {
8649
8650                        if ($('.single').length == 0) {
8651
8652                            $('.container-wrap').css('padding-top', '0px');
8653                        } else {
8654                            $(this).addClass('first-section');
8655                        }
8656
8657                    }
8658
8659                    // Check if it's also last (i.e. the only fws)
8660                    if ($parentRowIndex == $contentElementsNum - 1 && $('#respond').length == 0) {
8661                        if ($(this).attr('id') != 'portfolio-filters-inline') {
8662                            $('.container-wrap').css('padding-bottom', '0px');
8663                            $('#call-to-action .triangle').remove();
8664                        }
8665                    }
8666
8667                } else {
8668
8669                    if ($(this).parents('#portfolio-extra').length > 0 && $('#full_width_portfolio').length == 0) {
8670                        return false;
8671                    }
8672
8673                    if ($(this).find('.portfolio-filters-inline').length == 0 && $(this).attr('id') != 'post-area') {
8674
8675                        ////first
8676                        if ($(this).index() == '0' && $pageHeaderBG.length != 0) {
8677                            //skip processing.
8678                        } else if ($(this).index() == '0' && $pageHeaderBG.length == 0 &&
8679                            $(this).index() == '0' && $('.page-header-no-bg').length == 0 &&
8680                            $(this).index() == '0' && !$(this).hasClass('blog_next_prev_buttons') &&
8681                            $(this).parents('.nectar-global-section').length == 0 &&
8682                            !$(this).hasClass('nectar-shop-outer') && $(this).parents('.pum-container').length == 0) {
8683
8684                            if ($('body[data-header-resize="0"]').length == 1 && $('.single').length == 0 || $('body.material').length > 0 && $('.single').length == 0) {
8685
8686                                if (!$('body.blog .blog-fullwidth-wrap > .masonry:not(.meta-overlaid)').length > 0) {
8687                                    $('.container-wrap').css('padding-top', '0px');
8688                                }
8689
8690                            } else {
8691                                $(this).addClass('first-section');
8692                            }
8693
8694                        }
8695
8696                        //check if it's also last (i.e. the only fws)
8697                        if ($(this).index() == $contentElementsNum - 1 && $('#respond').length == 0 && $('body.woocommerce-checkout').length == 0) {
8698                            $('.container-wrap').css('padding-bottom', '0px');
8699                            $('.bottom_controls').css('margin-top', '0px');
8700                            $('#call-to-action .triangle').remove();
8701                        }
8702
8703                    }
8704                }
8705            }
8706
8707        });
8708
8709
8710        $('#portfolio-extra > .nectar-slider-wrap[data-full-width="true"], .portfolio-wrap').each(function () {
8711            //check if it's last
8712            if ($(this).index() == $contentElementsNum - 1 && $('#commentform').length == 0 && $('#pagination').length == 0) {
8713                if (parseInt($('.container-wrap').css('padding-bottom')) > 0) {
8714                    $(this).css('margin-bottom', '-40px');
8715                }
8716                $('#call-to-action .triangle').remove();
8717            }
8718        });
8719
8720
8721        $('.portfolio-filters').each(function () {
8722            ////first
8723            if ($(this).index() == '0' && $pageHeaderBG.length != 0 || $(this).index() == '0') {
8724                $(this).addClass('first-section nder-page-header');
8725            } else if ($(this).index() == '0' && $pageHeaderBG.length == 0 || $(this).index() == '0') {
8726                $(this).css({
8727                    'margin-top': '0px'
8728                }).addClass('first-section');
8729            }
8730        });
8731
8732
8733        $('.portfolio-filters-inline').each(function () {
8734            ////first
8735            if ($(this).parents('.wpb_row').length > 0) {
8736                //skip processing.
8737            } else {
8738                if ($(this).index() == '0' && $pageHeaderBG.length != 0 || $(this).index() == '0') {
8739                    $(this).addClass('first-section nder-page-header');
8740                } else if ($(this).index() == '0' && $pageHeaderBG.length == 0 || $(this).index() == '0') {
8741
8742                    $(this).css({
8743                        'margin-top': '-30px',
8744                        'padding-top': '50px'
8745                    }).addClass('first-section');
8746
8747                }
8748            }
8749
8750        });
8751
8752
8753    }
8754
8755
8756    /**
8757     * Full width row padding adjust calculations for boxed theme option.
8758     *
8759     * @since 11.0.4
8760     */
8761    function fullWidthRowPaddingAdjustCalcBoxed() {
8762
8763        if ($('#boxed').length > 0) {
8764
8765            $('.full-width-section[data-top-percent], .full-width-section[data-bottom-percent], .full-width-content[data-top-percent], .full-width-content[data-bottom-percent]').each(function () {
8766
8767                var $topPadding = ($(this).attr('data-top-percent')) ? $(this).attr('data-top-percent') : 'skip',
8768                    $bottomPadding = ($(this).attr('data-bottom-percent')) ? $(this).attr('data-bottom-percent') : 'skip';
8769
8770                //top
8771                if ($topPadding != 'skip') {
8772                    $(this).css('padding-top', $topPadding);
8773                }
8774
8775                //bottom
8776                if ($bottomPadding != 'skip') {
8777                    $(this).css('padding-bottom', $bottomPadding);
8778                }
8779
8780            });
8781        }
8782
8783    }
8784
8785
8786    /**
8787     * Full width content row auto equal height cols.
8788     *
8789     * @since 4.0
8790     */
8791    function fullWidthContentColumns() {
8792
8793        var $frontEndEditorElDiv = ($('body.vc_editor').length > 0) ? '.vc_element > ' : '';
8794        var usingFlexCols = $body.is('[data-flex-cols="true"]');
8795
8796        $('.main-content > .row > ' + $frontEndEditorElDiv + ' .full-width-content, #portfolio-extra > ' + $frontEndEditorElDiv + ' .full-width-content, .woocommerce-tabs #tab-description > .full-width-content, .post-area.span_12 article .content-inner > .full-width-content').each(function () {
8797
8798            // Only set the height if more than one column
8799            if ($(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col').length > 1) {
8800
8801                var tallestColumn = 0;
8802                var $columnInnerHeight = 0;
8803                var $column_inner_selector;
8804
8805                // Gather tallest height.
8806                $(this).find('> .span_12 > ' + $frontEndEditorElDiv + '  .col').each(function () {
8807
8808                    $column_inner_selector = ($(this).find('> .vc_column-inner > .wpb_wrapper').length > 0) ? '.vc_column-inner' : '.column-inner-wrap > .column-inner';
8809
8810                    var $padding = (usingFlexCols) ? parseInt($(this).find('> .vc_column-inner').css('padding-top')) : parseInt($(this).css('padding-top'));
8811                    var $frontEndEditorElPadding = ($frontEndEditorElDiv.length > 2 && $(this).find('> .vc_column-inner').length > 0) ? parseInt($(this).find('> .vc_column-inner').css('padding-top')) : 0;
8812
8813                    var colContentHeight = $(this).find('> ' + $column_inner_selector + ' > .wpb_wrapper').height();
8814                    if (colContentHeight + ($padding * 2) + $frontEndEditorElPadding > tallestColumn) {
8815                        tallestColumn = colContentHeight + ($padding * 2) + $frontEndEditorElPadding;
8816                    }
8817
8818                });
8819
8820                // Apply height to all columns within row.
8821                $(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col').each(function () {
8822
8823                    $column_inner_selector = ($(this).find('> .vc_column-inner > .wpb_wrapper').length > 0) ? '.vc_column-inner' : '.column-inner-wrap > .column-inner';
8824
8825                    // Columns with content
8826                    if ($(this).find('> ' + $column_inner_selector + ' > .wpb_wrapper > *').length > 0) {
8827
8828                        // Added in 7.6 to fix equal height columns
8829                        if ($frontEndEditorElDiv.length < 2 && !$(this).parent().parent().hasClass('vc_row-o-equal-height')) {
8830                            $(this).css('height', tallestColumn);
8831
8832                            if (usingFlexCols) {
8833                                $(this).find('> .vc_column-inner').css('height', tallestColumn);
8834                            }
8835
8836                        } else if ($frontEndEditorElDiv.length > 2 && !$(this).parent().parent().parent().hasClass('vc_row-o-equal-height')) {
8837
8838                            $(this).css('height', tallestColumn);
8839
8840                            if (usingFlexCols) {
8841                                $(this).find('> .vc_column-inner').css('height', tallestColumn);
8842                            }
8843
8844                        }
8845                    }
8846
8847                    // Empty columns
8848                    else {
8849                        if ($(this).is('[data-using-bg="true"]') && $(this).parents('.vc_row-o-content-top').length == 0) {
8850
8851                            $(this).css('min-height', tallestColumn);
8852
8853                            if ($body.is('[data-flex-cols="true"]')) {
8854                                $(this).find('> .vc_column-inner').css('min-height', tallestColumn);
8855                            }
8856
8857                            if ($(this).is('[data-animation*="reveal"]')) {
8858                                $(this).find('.column-inner')
8859                                    .css('min-height', tallestColumn);
8860                            }
8861
8862                        }
8863                    }
8864
8865                });
8866
8867                // Nested column height
8868                if (nectarDOMInfo.winW < 1000) {
8869                    $(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col .wpb_row .col').css('min-height', '0px');
8870                }
8871
8872                // Vertically center
8873                if ($(this).hasClass('vertically-align-columns') && nectarDOMInfo.winW > 1000 && !$(this).hasClass('vc_row-o-equal-height')) {
8874
8875                    // Parent columns
8876                    $(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col').each(function () {
8877
8878                        $column_inner_selector = ($(this).find('> .vc_column-inner > .wpb_wrapper').length > 0) ? '.vc_column-inner' : '.column-inner-wrap > .column-inner';
8879
8880                        $columnInnerHeight = $(this).find('> ' + $column_inner_selector + ' > .wpb_wrapper').height();
8881
8882                        var $marginCalc = ($(this).height() / 2) - ($columnInnerHeight / 2);
8883
8884                        if ($marginCalc <= 0) {
8885                            $marginCalc = 0;
8886                        }
8887
8888                        $(this).find('> ' + $column_inner_selector + ' > .wpb_wrapper')
8889                            .css('margin-top', $marginCalc)
8890                            .css('margin-bottom', $marginCalc);
8891
8892                    });
8893
8894
8895                }
8896
8897            }
8898
8899        });
8900
8901
8902        if ($('body[data-flex-cols="true"]').length == 0) {
8903
8904            // Equal height columns in container type with reveal columns
8905            $('.main-content > .row > .wpb_row:not(.full-width-content).vc_row-o-equal-height').each(function () {
8906                if ($(this).find('>.span_12 > ' + $frontEndEditorElDiv + ' .wpb_column[data-animation*="reveal"]').length > 0) {
8907
8908                    var tallestColumn = 0;
8909
8910                    $(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col').each(function () {
8911
8912                        var $padding = parseInt($(this).find('> .column-inner-wrap > .column-inner').css('padding-top'));
8913
8914                        if ($(this).find('> .column-inner-wrap > .column-inner').height() + ($padding * 2) > tallestColumn) {
8915                            tallestColumn = $(this).find('> .column-inner-wrap > .column-inner').height() + ($padding * 2);
8916                        }
8917
8918                    });
8919
8920                    $(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col').each(function () {
8921
8922                        // Columns with content
8923                        if ($(this).find('> .column-inner-wrap > .column-inner .wpb_wrapper > *').length > 0) {
8924                            $(this).find('> .column-inner-wrap').css('height', tallestColumn);
8925                        }
8926                        // Empty columns
8927                        else {
8928                            $(this).css('min-height', tallestColumn);
8929                            if ($(this).is('[data-animation*="reveal"]')) {
8930                                $(this).find('.column-inner').css('min-height', tallestColumn);
8931                            }
8932                        }
8933                    });
8934
8935                }
8936            });
8937
8938            // Using equal height option, top/bottom padding % needs to be convered into px for cross browser (flex bug)
8939            $('.wpb_row.vc_row-o-equal-height>.span_12> ' + $frontEndEditorElDiv + '.wpb_column[class*="padding-"][data-padding-pos="all"]').each(function () {
8940                if ($(this).parents('.tabbed').length == 0) {
8941                    $(this).css({
8942                        'padding-top': $(this).css('padding-left'),
8943                        'padding-bottom': $(this).css('padding-left')
8944                    });
8945                }
8946            });
8947
8948        } // endif; Not using modern grid system.
8949
8950    }
8951
8952
8953    /**
8954     * Mouse parallax row option.
8955     *
8956     * @since 4.0
8957     */
8958    function mouseParallaxInit() {
8959
8960        $('.wpb_row:has(.nectar-parallax-scene)').each(function (i) {
8961
8962            var $strength = parseInt($(this).find('.nectar-parallax-scene').attr('data-scene-strength'));
8963
8964            $mouseParallaxScenes[i] = $(this).find('.nectar-parallax-scene').parallax({
8965                scalarX: $strength,
8966                scalarY: $strength
8967            });
8968
8969            // Wait until the images in the scene have loaded.
8970            var images = $(this).find('.nectar-parallax-scene li');
8971
8972            $.each(images, function () {
8973                if ($(this).find('div').length > 0) {
8974                    var el = $(this).find('div'),
8975                        image = el.css('background-image').replace(/"/g, '').replace(/url\(|\)$/ig, '');
8976                    if (image && image !== '' && image !== 'none') {
8977                        images = images.add($('<img>').attr('src', image));
8978                    }
8979                }
8980            });
8981
8982        });
8983
8984    }
8985
8986
8987    /**
8988     * Add checkmark icons to unorder list with checkmark class.
8989     *
8990     * @since 2.0
8991     */
8992    function ulCheckmarks() {
8993        $('ul.checks li').each(function () {
8994            if ($(this).find('i.fa-check-circle').length == 0) {
8995                $(this).prepend('<i class="fa fa-check-circle"></i>');
8996            }
8997        });
8998    }
8999
9000
9001    /**
9002     * Allow CTA element BG color to also act as a link.
9003     *
9004     * @since 11.0
9005     */
9006    function ctaLinkBG() {
9007
9008        $body.on('click', '.nectar-cta:not([data-style="material"]) .link_wrap', function (e) {
9009
9010            if ($(this).parents('[data-using-bg="true"]').length > 0 ||
9011                $(this).parents('[class*="border_thickness"]').length > 0) {
9012
9013                if (!$(e.target).is('a') && $(e.target).parents('a').length == 0) {
9014                    $(this).find('a.link_text')[0].click();
9015                }
9016
9017            }
9018        });
9019
9020    }
9021
9022
9023    /**
9024     * Add CSS default animation classes through JS to
9025     * avoid inital animation on page load.
9026     *
9027     * @since 11.0
9028     */
9029    function nectarKeyframeAssist() {
9030
9031        $('.nectar-cta[data-style="arrow-animation"]').addClass('loaded');
9032
9033    }
9034
9035
9036    /**
9037     * Page builder row background layer animations.
9038     *
9039     * @since 9.0
9040     * @see waypoints
9041     */
9042    function rowBGAnimations() {
9043
9044        var $rowBGAnimationsOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : '93%';
9045        var $rowBGAnimationsRevealOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : '95%';
9046        var $rowBGOffset;
9047
9048        $($fullscreenSelector + '.row-bg-wrap[data-bg-animation]:not([data-bg-animation="none"]) .row-bg').each(function () {
9049
9050
9051            var $animation = $(this).parents('.row-bg-wrap').attr('data-bg-animation');
9052            var $animation_delay = ($(this).parents('.row-bg-wrap[data-bg-animation-delay]').length > 0) ? $(this).parents('.row-bg-wrap').attr('data-bg-animation-delay') : 0;
9053
9054            if ($animation != 'zoom-out-reveal' &&
9055                $animation.indexOf('reveal-from-') == -1) {
9056                $rowBGOffset = $rowBGAnimationsOffsetPos;
9057            } else {
9058                $rowBGOffset = $rowBGAnimationsRevealOffsetPos;
9059            }
9060
9061
9062            var $that = $(this);
9063            var waypoint = new Waypoint({
9064                element: $that.parents('.row-bg-wrap')[0],
9065                handler: function () {
9066
9067                    if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) {
9068                        waypoint.destroy();
9069                        return;
9070                    }
9071
9072                    setTimeout(function () {
9073
9074                        $that.parents('.inner-wrap').addClass('animated-in');
9075
9076                        if ($animation == 'zoom-out-reveal' || $animation.indexOf('reveal-from-') > -1 || $that.parents('.nectar-scrolling-text').length > 0) {
9077                            $that.parents('.row-bg-wrap').addClass('animated-in');
9078                        }
9079
9080                        if ($animation == 'clip-path') {
9081                            $that.parents('.wpb_row ').addClass('animated-in');
9082                        }
9083
9084                    }, $animation_delay);
9085
9086
9087                    waypoint.destroy();
9088                },
9089                offset: $rowBGOffset
9090            });
9091
9092        });
9093
9094    }
9095
9096
9097    /**
9098     * Page builder column background layer animations.
9099     *
9100     * @since 9.0
9101     * @see waypoints
9102     */
9103    function columnBGAnimations() {
9104
9105        var $colBGAnimationsOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : '93%';
9106        var $colBGAnimationsRevealOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : '80%';
9107        var $colBGOffset;
9108
9109        $($fullscreenSelector + '.column-image-bg-wrap[data-bg-animation]:not([data-bg-animation="none"]) .column-image-bg').each(function () {
9110
9111            var $animation = $(this).parents('.column-image-bg-wrap').attr('data-bg-animation');
9112
9113            if ($animation != 'zoom-out-reveal' && $animation.indexOf('reveal-from-') == -1) {
9114                $colBGOffset = $colBGAnimationsOffsetPos;
9115            } else {
9116
9117                if ($animation == 'ro-reveal-from-bottom' && $fullscreenMarkupBool == false) {
9118                    $colBGOffset = '95%';
9119                } else if ($animation == 'ro-reveal-from-top' && $fullscreenMarkupBool == false) {
9120                    $colBGOffset = '65%';
9121                } else {
9122                    $colBGOffset = $colBGAnimationsRevealOffsetPos;
9123                }
9124            }
9125
9126            var $that = $(this);
9127
9128            var waypoint = new Waypoint({
9129                element: $that.parents('.column-image-bg-wrap')[0],
9130                handler: function () {
9131
9132                    if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) {
9133                        waypoint.destroy();
9134                        return;
9135                    }
9136
9137                    $that.parents('.inner-wrap').addClass('animated-in');
9138                    if ($animation == 'zoom-out-reveal' || $animation.indexOf('reveal-from-') > -1) {
9139                        $that.parents('.column-image-bg-wrap').addClass('animated-in');
9140                        $that.parents('.column-image-bg-wrap').siblings('.column-bg-overlay-wrap').addClass('animated-in');
9141                        $that.parents('.vc_column-inner').addClass('revealed-bg');
9142                    }
9143
9144                    if ($animation == 'mask-reveal') {
9145                        $that.parents('.vc_column-inner').find('.column-bg-layer').addClass('animated-in');
9146                    }
9147                    waypoint.destroy();
9148                },
9149                offset: $colBGOffset
9150            });
9151
9152        });
9153
9154        // Zoom out reveal with BG color only
9155        $($fullscreenSelector + '.column-bg-overlay-wrap[data-bg-animation]').each(function () {
9156
9157            $colBGOffset = $colBGAnimationsRevealOffsetPos;
9158
9159            var $that = $(this);
9160            var $animation = $(this).attr('data-bg-animation');
9161
9162            if ($animation == 'zoom-out-reveal' || $animation == 'mask-reveal' || $animation.indexOf('reveal-from-') > 0) {
9163
9164                if ($that.parent().find('.column-image-bg-wrap').length == 0) {
9165
9166                    var waypoint = new Waypoint({
9167                        element: $that[0],
9168                        handler: function () {
9169
9170                            if ($that.hasClass('animated-in')) {
9171                                waypoint.destroy();
9172                                return;
9173                            }
9174
9175                            $that.addClass('animated-in');
9176                            $that.parents('.vc_column-inner').addClass('revealed-bg');
9177                            waypoint.destroy();
9178
9179                        },
9180                        offset: $colBGOffset
9181                    });
9182
9183                }
9184
9185            }
9186
9187        });
9188
9189    }
9190
9191
9192    /**
9193     * Page builder column and image animations.
9194     *
9195     * @since 4.0
9196     * @see waypoints
9197     */
9198    function colAndImgAnimations() {
9199
9200        var $colAndImgOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : '88%';
9201        var $cascadingOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : '70%';
9202        var $colAndImgRevealOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : '70%';
9203
9204        $($fullscreenSelector + '.img-with-animation').each(function (i) {
9205
9206            var $that = $(this);
9207
9208            var $animationType = ($that.is('[data-animation]')) ? $that.attr('data-animation') : 'fade-in';
9209
9210            // reveal images alters offset
9211            if ($animationType == 'ro-reveal-from-right' && $colAndImgOffsetPos == '88%' ||
9212                $animationType == 'ro-reveal-from-left' && $colAndImgOffsetPos == '88%') {
9213                $colAndImgOffsetPos = '75%';
9214            }
9215
9216            // Slide up alters offset
9217            if ($animationType == 'slide-up' && $colAndImgOffsetPos == '88%') {
9218                $colAndImgOffsetPos = '99%';
9219            }
9220
9221            // Custom easing.
9222            var imgAnimationEasing = $animationEasing;
9223            if ($(this)[0].hasAttribute('data-animation-easing')) {
9224                imgAnimationEasing = $(this).attr('data-animation-easing');
9225            }
9226
9227            var opacityDuration = parseInt($animationDuration);
9228            if ($that.parents('.row_position_absolute').length > 0 || $that.hasClass('position_desktop_absolute')) {
9229                opacityDuration = 500;
9230            }
9231
9232
9233            // initiate waypoint.
9234            var waypoint = new Waypoint({
9235                element: $that[0],
9236                handler: function () {
9237
9238                    if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) {
9239                        waypoint.destroy();
9240                        return;
9241                    }
9242
9243
9244                    if (!bypassAnimations || $('body[data-responsive="0"]').length > 0) {
9245
9246                        var $delay = ($that.is('[data-delay]')) ? $that.attr('data-delay') : 0;
9247                        var $elToAnimate = ($that.parents('.hover-wrap').length > 0) ? $that.parents('.hover-wrap') : $that;
9248
9249                        // Image animation disabled on mobile.
9250                        // Prevent timeline from running for time until interactive
9251                        var imgAnimationDur = $animationDuration;
9252                        if ($that.parents('.nectar-disable-mobile-animation').length > 0 && nectarDOMInfo.winW < 1000) {
9253                            imgAnimationDur = 0;
9254                            opacityDuration = 0;
9255                            $delay = 0;
9256                        }
9257
9258                        if ($animationType == 'fade-in-from-left' || $animationType == 'fade-in-from-right') {
9259
9260                            $elToAnimate.delay($delay).transition({
9261                                'opacity': 1,
9262                                'x': '0px'
9263                            }, imgAnimationDur, imgAnimationEasing);
9264
9265                        } else if ($animationType == 'fade-in-from-bottom') {
9266
9267                            animeAnimations.push(anime({
9268                                targets: $elToAnimate[0],
9269                                translateY: [100, 0],
9270                                translateZ: 0,
9271                                opacity: {
9272                                    value: [0, 1],
9273                                    duration: opacityDuration,
9274                                },
9275                                delay: $delay,
9276                                easing: imgAnimationEasing,
9277                                duration: imgAnimationDur
9278                            }));
9279
9280
9281                        } else if ($animationType == 'slide-up') {
9282
9283                            animeAnimations.push(anime({
9284                                targets: $elToAnimate[0],
9285                                translateY: [150, 0],
9286                                translateZ: 0,
9287                                delay: $delay,
9288                                easing: imgAnimationEasing,
9289                                duration: imgAnimationDur
9290                            }));
9291
9292                        } else if ($animationType == 'fade-in') {
9293
9294                            $elToAnimate.delay($delay).transition({
9295                                'opacity': 1
9296                            }, imgAnimationDur, imgAnimationEasing);
9297
9298                        } else if ($animationType == 'grow-in') {
9299
9300                            setTimeout(function () {
9301                                $elToAnimate.transition({
9302                                    scale: 1,
9303                                    'opacity': 1
9304                                }, imgAnimationDur, imgAnimationEasing);
9305                            }, $delay);
9306
9307                        } else if ($animationType == 'flip-in') {
9308
9309                            setTimeout(function () {
9310                                $elToAnimate.transition({
9311                                    rotateY: 0,
9312                                    'opacity': 1
9313                                }, imgAnimationDur, imgAnimationEasing);
9314                            }, $delay);
9315
9316                        } else if ($animationType == 'flip-in-vertical') {
9317
9318                            setTimeout(function () {
9319                                $elToAnimate.transition({
9320                                    rotateX: 0,
9321                                    'opacity': 1
9322                                }, imgAnimationDur, imgAnimationEasing);
9323                            }, $delay);
9324
9325                        } else if ($animationType == 'ro-reveal-from-left' ||
9326                            $animationType == 'ro-reveal-from-right' ||
9327                            $animationType == 'ro-reveal-from-bottom' ||
9328                            $animationType == 'ro-reveal-from-top') {
9329                            $that.parents('.img-with-aniamtion-wrap').addClass('animated-in');
9330                        }
9331
9332                        if ($animationType != 'none') {
9333                            $that.addClass('animated-in');
9334                        }
9335
9336
9337                    }
9338
9339                    waypoint.destroy();
9340
9341                },
9342                offset: $colAndImgOffsetPos
9343            });
9344
9345
9346        });
9347
9348
9349        $($fullscreenSelector + '.nectar_cascading_images').each(function () {
9350
9351            var $that = $(this);
9352            var $animationDelay = ($(this).is('[data-animation-timing]')) ? $(this).attr('data-animation-timing') : 175;
9353            $animationDelay = parseInt($animationDelay);
9354
9355            var waypoint = new Waypoint({
9356                element: $that[0],
9357                handler: function () {
9358
9359                    if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) {
9360                        waypoint.destroy();
9361                        return;
9362                    }
9363
9364                    if (!bypassAnimations || $('body[data-responsive="0"]').length > 0) {
9365
9366                        $that.find('.cascading-image').each(function (i) {
9367
9368                            var $that2 = $(this);
9369
9370                            if ($that2.attr('data-animation') == 'flip-in' || $that2.attr('data-animation') == 'flip-in-vertical') {
9371                                setTimeout(function () {
9372                                    $that2.find('.inner-wrap').css({
9373                                        'opacity': 1,
9374                                        'transform': 'rotate(0deg) translateZ(0px)'
9375                                    });
9376                                }, i * $animationDelay);
9377                            } else if ($that2.attr('data-animation') == 'grow-in-reveal') {
9378                                setTimeout(function () {
9379                                    $that2.find('.inner-wrap').css({
9380                                        'opacity': 1,
9381                                        'transform': 'translateX(0px) translateY(0px) scale(1,1) translateZ(0px)'
9382                                    });
9383                                    $that2.find('.inner-wrap img').css({
9384                                        'transform': 'translateX(0px) translateY(0px) scale(1,1) translateZ(0px)'
9385                                    });
9386                                }, i * $animationDelay);
9387                            } else {
9388                                setTimeout(function () {
9389                                    $that2.find('.inner-wrap').css({
9390                                        'opacity': 1,
9391                                        'transform': 'translateX(0px) translateY(0px) scale(1,1) translateZ(0px)'
9392                                    });
9393                                }, i * $animationDelay);
9394                            }
9395
9396
9397                        });
9398
9399                        $that.addClass('animated-in');
9400
9401                    }
9402
9403                    waypoint.destroy();
9404
9405                },
9406                offset: $cascadingOffsetPos
9407            });
9408
9409        });
9410
9411
9412        $($fullscreenSelector + '.col.has-animation:not([data-animation*="reveal"]), ' + $fullscreenSelector + '.wpb_column.has-animation:not([data-animation*="reveal"]), ' + $fullscreenSelector + '.nectar-fancy-box.has-animation').each(function (i) {
9413
9414        
9414    // delayJS
9415            if (delayJS && $(this).parents('.top-level').length > 0 && $nectarFullPage.$usingFullScreenRows !== true) {
9416                return true;
9417            }
9418
9419            var $that = $(this);
9420
9421            // custom offset.
9422            var colAnimationOffset = $colAndImgOffsetPos;
9423
9424            if ($(this)[0].hasAttribute('data-animation-offset')) {
9425                colAnimationOffset = parseInt($(this).attr('data-animation-offset')) + '%';
9426            }
9427
9428            // Custom easing.
9429            var colAnimationEasing = $animationEasing;
9430            if ($(this)[0].hasAttribute('data-animation-easing')) {
9431                colAnimationEasing = $(this).attr('data-animation-easing');
9432            }
9433
9434
9435            var opacityDuration = parseInt($animationDuration);
9436            if ($that.parents('.row_position_absolute').length > 0) {
9437                opacityDuration = 500;
9438            }
9439
9440
9441            var waypoint = new Waypoint({
9442                element: $that[0],
9443                handler: function () {
9444
9445                    if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) {
9446                        waypoint.destroy();
9447                        return;
9448                    }
9449
9450                    if (!bypassAnimations || $('body[data-responsive="0"]').length > 0) {
9451
9452                        $that.addClass('triggered-animation');
9453                        $(window).trigger('nectar-column-animation-start');
9454
9455                        var $delay = $that.attr('data-delay');
9456
9457                        // Image animation disabled on mobile.
9458                        // Prevent timeline from running for time until interactive
9459                        var colAnimationDur = $animationDuration;
9460                        if ($that.hasClass('mobile-disable-entrance-animation') && nectarDOMInfo.winW < 1000) {
9461                            colAnimationDur = 0;
9462                            opacityDuration = 0;
9463                            $delay = 0;
9464                        }
9465
9466                        if ($that.attr('data-animation') == 'fade-in-from-left' || $that.attr('data-animation') == 'fade-in-from-right') {
9467
9468                            $standAnimatedColTimeout[i] = setTimeout(function () {
9469                                $that.transition({
9470                                    'opacity': 1,
9471                                    'x': '0px'
9472                                }, colAnimationDur, colAnimationEasing);
9473                            }, $delay);
9474
9475                        } else if ($that.attr('data-animation') == 'fade-in-from-bottom' ||
9476                            $that.attr('data-animation') == 'slight-fade-in-from-bottom') {
9477
9478                            var transY = ($that.attr('data-animation') == 'fade-in-from-bottom') ? 100 : 50;
9479
9480                            animeAnimations.push(anime({
9481                                targets: $that[0],
9482                                translateY: [transY, 0],
9483                                translateZ: 0,
9484                                opacity: {
9485                                    value: [0, 1],
9486                                    duration: opacityDuration,
9487                                },
9488                                delay: $delay,
9489                                easing: colAnimationEasing,
9490                                duration: colAnimationDur
9491                            }));
9492
9493
9494                        } else if ($that.attr('data-animation') == 'fade-in') {
9495
9496                            $standAnimatedColTimeout[i] = setTimeout(function () {
9497                                $that.transition({
9498                                    'opacity': 1
9499                                }, colAnimationDur, colAnimationEasing);
9500                            }, $delay);
9501
9502                        } else if ($that.attr('data-animation') == 'grow-in' || $that.attr('data-animation') == 'zoom-out') {
9503
9504                            $standAnimatedColTimeout[i] = setTimeout(function () {
9505                                $that.transition({
9506                                    scale: 1,
9507                                    'opacity': 1
9508                                }, colAnimationDur, colAnimationEasing);
9509                            }, $delay);
9510
9511                        } else if ($that.attr('data-animation') == 'flip-in') {
9512
9513                            $standAnimatedColTimeout[i] = setTimeout(function () {
9514                                $that.transition({
9515                                    rotateY: '0',
9516                                    'opacity': 1
9517                                }, colAnimationDur, colAnimationEasing);
9518                            }, $delay);
9519
9520                        } else if ($that.attr('data-animation') == 'flip-in-vertical') {
9521
9522                            $standAnimatedColTimeout[i] = setTimeout(function () {
9523                                $that.transition({
9524                                    rotateX: '0',
9525                                    y: '0',
9526                                    'opacity': 1
9527                                }, colAnimationDur, colAnimationEasing);
9528                            }, $delay);
9529
9530                        } else if ($that.attr('data-animation') == 'slight-twist') {
9531
9532                            $standAnimatedColTimeout[i] = setTimeout(function () {
9533                                animeAnimations.push(anime({
9534                                    targets: $that[0],
9535                                    rotateY: [20, 0],
9536                                    rotateZ: [-4, 0],
9537                                    opacity: 1,
9538                                    easing: colAnimationEasing,
9539                                    duration: colAnimationDur
9540                                }));
9541                            }, $delay);
9542
9543                        }
9544
9545                        //boxed column hover fix
9546                        if ($that.hasClass('boxed')) {
9547                            $that.addClass('no-pointer-events');
9548                            setTimeout(function () {
9549                                $that.removeClass('no-pointer-events');
9550                            }, parseInt($animationDuration) + parseInt($delay) + 30);
9551                        }
9552
9553                        if ($that.find('.nectar-post-grid-wrap[data-style="mouse_follow_image"]')) {
9554                            setTimeout(function () {
9555                                $that[0].style.transform = 'none';
9556                            }, parseInt($animationDuration) + parseInt($delay) + 30);
9557                        }
9558
9559
9560                        $that.addClass('animated-in');
9561
9562                    }
9563
9564                    waypoint.destroy();
9565                },
9566                offset: colAnimationOffset
9567            });
9568
9569        });
9570
9571
9572        $($fullscreenSelector + '.wpb_column.has-animation[data-animation*="reveal"]').each(function () {
9573
9574            // Custom easing.
9575            var colAnimationEasing = $animationEasing;
9576            if ($(this)[0].hasAttribute('data-animation-easing')) {
9577                colAnimationEasing = $(this).attr('data-animation-easing');
9578            }
9579
9580            var revealOffsetAmt = ($(this).is('[data-animation="mask-reveal"]')) ? '88%' : $colAndImgRevealOffsetPos;
9581
9582            // Custom offset.
9583            if ($(this)[0].hasAttribute('data-animation-offset')) {
9584                revealOffsetAmt = parseInt($(this).attr('data-animation-offset')) + '%';
9585            }
9586
9587            var $that = $(this),
9588                waypoint = new Waypoint({
9589                    element: $that[0],
9590                    handler: function () {
9591
9592                        if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) {
9593                            waypoint.destroy();
9594                            return;
9595                        }
9596
9597                        var $delay = $that.attr('data-delay');
9598
9599                        if (!bypassAnimations || $('body[data-responsive="0"]').length > 0) {
9600
9601                            var $columnInnerSelector = ($that.find('> .vc_column-inner').length > 0) ? true : false;
9602
9603                            if ($that.attr('data-animation') == 'reveal-from-bottom' || $that.attr('data-animation') == 'reveal-from-top') {
9604
9605                                setTimeout(function () {
9606
9607                                    if ($columnInnerSelector == true) {
9608
9609                                        // Modern.
9610                                        $that.find('> .vc_column-inner').transition({
9611                                            'y': 0
9612                                        }, $animationDuration, colAnimationEasing);
9613
9614                                    } else {
9615
9616                                        // Legacy.
9617                                        $that.find('.column-inner-wrap, .column-inner').transition({
9618                                            'y': 0
9619                                        }, $animationDuration, colAnimationEasing, function () {
9620                                            $that.find('.column-inner-wrap, .column-inner').addClass('no-transform');
9621                                        });
9622                                    }
9623
9624                                    $that.addClass('animated-in');
9625
9626                                }, $delay);
9627
9628                            } else if ($that.attr('data-animation') == 'reveal-from-right' || $that.attr('data-animation') == 'reveal-from-left') {
9629                                setTimeout(function () {
9630
9631                                    if ($columnInnerSelector == true) {
9632
9633                                        // Modern.
9634                                        $that.find('> .vc_column-inner').transition({
9635                                            'x': 0
9636                                        }, $animationDuration, colAnimationEasing);
9637
9638
9639                                    } else {
9640                                        // Legacy.
9641                                        $that.find('.column-inner-wrap, .column-inner').transition({
9642                                            'x': 0
9643                                        }, $animationDuration, colAnimationEasing, function () {
9644                                            $that.find('.column-inner-wrap, .column-inner').addClass('no-transform');
9645                                        });
9646
9647                                    }
9648
9649                                    $that.addClass('animated-in');
9650
9651                                }, $delay);
9652                            }
9653
9654                            setTimeout(function () {
9655                                $that.addClass('animated-in');
9656                            }, $delay);
9657
9658                        }
9659
9660                        waypoint.destroy();
9661                    },
9662                    offset: revealOffsetAmt
9663                });
9664
9665        });
9666
9667    }
9668
9669
9670    /**
9671     * Cascading images element sizing
9672     *
9673     * @since 6.0
9674     */
9675    function cascadingImageBGSizing() {
9676
9677        $('.nectar_cascading_images').each(function () {
9678
9679            var forcedAspect = ($(this).hasClass('forced-aspect')) ? true : false;
9680
9681            //handle max width for cascading images in equal height columns
9682            if ($(this).parents('.vc_row-o-equal-height').length > 0 && $(this).parents('.wpb_column').length > 0) {
9683                $(this).css('max-width', $(this).parents('.wpb_column').width());
9684            }
9685
9686            //set size for layers with no images
9687            $(this).find('.bg-color').each(function () {
9688
9689                if (forcedAspect == true && $(this).parents('.cascading-image').index() == 0) {
9690                    return true;
9691                }
9692
9693                var $bgColorHeight = 0;
9694                var $bgColorWidth = 0;
9695
9696                if ($(this).parent().find('.img-wrap').length == 0) {
9697
9698                    var $firstSibling = $(this).parents('.cascading-image').siblings('.cascading-image[data-has-img="true"]').first();
9699
9700                    $bgColorHeight = $firstSibling.find('.img-wrap').height();
9701                    $bgColorWidth = $firstSibling.find('.img-wrap').width();
9702
9703                } else {
9704                    $bgColorHeight = $(this).parent().find('.img-wrap').height();
9705                    $bgColorWidth = $(this).parent().find('.img-wrap').width();
9706                }
9707
9708                $(this).css({
9709                    'height': $bgColorHeight,
9710                    'width': $bgColorWidth
9711                }).addClass('calculated');
9712
9713            });
9714
9715        });
9716
9717    }
9718
9719
9720    /**
9721     * Cascading images element initialization.
9722     *
9723     * @since 10.5
9724     */
9725    function cascadingImageInit() {
9726
9727        if ($('.nectar_cascading_images').length > 0) {
9728
9729            cascadingParallaxArr = [];
9730
9731            $('.nectar_cascading_images').each(function (i) {
9732
9733                imagesLoaded($(this), function (instance) {
9734
9735                    // Create sizes.
9736                    cascadingImageBGSizing();
9737
9738                    // Parallax scrolling.
9739                    if ($(instance.elements[0]).is('[data-parallax="yes"]') && !bypassAnimations && $('#nectar_fullscreen_rows').length == 0) {
9740                        cascadingParallaxArr[i] = new CascadingParallax($(instance.elements[0]), $(instance.elements[0]).attr('data-parallax-intensity'));
9741                    }
9742
9743                });
9744
9745            });
9746
9747            // BG Sizing Resize.
9748            $window.on('resize', cascadingImageBGSizing);
9749
9750        }
9751
9752    }
9753
9754
9755    function CascadingParallax(el, intensity) {
9756
9757        this.$element = el;
9758        this.inView = false;
9759        this.topLevel = false;
9760        this.lastY = 0;
9761
9762        this.layer1Parallax = (this.$element.is('[data-layer-1-parallax="yes"]')) ? true : false;
9763
9764        switch (intensity) {
9765            case 'subtle':
9766                this.intensity = 0.09;
9767                break;
9768            case 'medium':
9769                this.intensity = 0.15;
9770                break;
9771            case 'high':
9772                this.intensity = 0.25;
9773                break;
9774        }
9775        this.calculatePos();
9776        this.trackView();
9777        this.animate();
9778
9779        if ($('.portfolio-filters').length > 0 ||
9780            $('.portfolio-filters-inline').length > 0) {
9781            setInterval(this.calculatePos.bind(this), 700);
9782        }
9783
9784
9785        if (nectarDOMInfo.usingMobileBrowser) {
9786            const mediaQuery = window.matchMedia('(orientation: portrait)');
9787            mediaQuery.addEventListener('change', this.calculatePos.bind(this));
9788        } else {
9789            $window.on('resize', this.calculatePos.bind(this));
9790        }
9791    }
9792
9793    CascadingParallax.prototype.calculatePos = function () {
9794
9795        if (nectarState.materialOffCanvasOpen != true &&
9796            nectarState.ocmAnimating != true) {
9797            this.offsetTop = this.$element.offset().top;
9798            this.height = this.$element.outerHeight();
9799            this.vertCenter = nectarDOMInfo.winH / 2 - this.height / 2;
9800        }
9801    };
9802
9803    CascadingParallax.prototype.trackView = function () {
9804
9805        var that = this;
9806
9807        if (this.$element.parents('.top-level').length > 0) {
9808            this.topLevel = true;
9809        }
9810
9811        if ('IntersectionObserver' in window) {
9812
9813            var options = {
9814                root: (isSafari()) ? null : document,
9815                rootMargin: '250px',
9816            }
9817            var observer = new IntersectionObserver(function (entries) {
9818
9819                entries.forEach(function (entry) {
9820                    var isIntersecting = entry.isIntersecting;
9821
9822                    if (isIntersecting) {
9823                        that.inView = true;
9824                    } else {
9825                        that.inView = false;
9826                    }
9827                });
9828
9829            }, options);
9830
9831            observer.observe(this.$element[0]);
9832
9833        }
9834
9835    };
9836
9837    CascadingParallax.prototype.animate = function () {
9838
9839        if (nectarState.materialOffCanvasOpen == true) {
9840            window.requestAnimationFrame(this.animate.bind(this));
9841            return;
9842        }
9843
9844        if (nectarState.animatedScrolling == true) {
9845            this.inView = true;
9846        }
9847
9848        this.lastY = linearInterpolate(this.lastY, nectarDOMInfo.scrollTop, 0.2);
9849
9850        if (this.inView) {
9851
9852            var that = this;
9853
9854            this.$element.find('.bg-layer').each(function (i) {
9855
9856                var $scale = $(this).data('scale');
9857
9858                if (that.layer1Parallax) {
9859                    i = (i / 1.5) + 1;
9860                }
9861
9862                if (that.topLevel === true && nectarDOMInfo.winW > 1000) {
9863                    $(this)[0].style.transform = 'translateY(' + -(that.lastY * that.intensity * i) + 'px) translateZ(0) scale(' + $scale + ')';
9864                } else {
9865                    $(this)[0].style.transform = 'translateY(' + -((that.lastY - that.offsetTop + that.vertCenter) * that.intensity * i) + 'px) translateZ(0) scale(' + $scale + ')';
9866                }
9867
9868            });
9869        }
9870
9871        window.requestAnimationFrame(this.animate.bind(this));
9872    };
9873
9874
9875    /**
9876     * Split line heading element initialization.
9877     *
9878     * @since 10.5
9879     * @see waypoints
9880     */
9881    function splitLineHeadings() {
9882
9883        // Create waypoint.
9884        $($fullscreenSelector + '.nectar-split-heading:not(.custom-trigger)').each(function (i) {
9885
9886            var $splitLineOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : 'bottom-in-view';
9887
9888            if ($(this)[0].hasAttribute('data-animation-offset') && $fullscreenMarkupBool != true) {
9889                if ($(this).attr('data-animation-offset').length > 0) {
9890                    $splitLineOffsetPos = parseInt($(this).attr('data-animation-offset')) + '%';
9891                }
9892            }
9893
9894
9895            var $that = $(this);
9896            var $delay = ($that.is('[data-animation-delay]')) ? parseInt($that.attr('data-animation-delay')) : 0;
9897
9898            var waypoint = new Waypoint({
9899                element: $that[0],
9900                handler: function () {
9901
9902                    if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) {
9903                        waypoint.destroy();
9904                        return;
9905                    }
9906
9907                    if (!bypassAnimations || $('body[data-responsive="0"]').length > 0) {
9908
9909                        var $animationDurationCap;
9910
9911                        setTimeout(function () {
9912
9913                            if ($that.is('[data-animation-type="line-reveal-by-space"]:not([data-text-effect*="letter-reveal"])')) {
9914
9915                                var stagger = 0;
9916                                if ($that.is('[data-stagger="true"]')) {
9917                                    stagger = 500 / $that.find('> * > span').length;
9918                                    stagger = Math.min(Math.max(stagger, 15), 50); // Clamp val
9919                                }
9920
9921                                $animationDurationCap = (parseInt($animationDuration) < 1100) ? $animationDuration : '1100';
9922
9923                                if ($that.is('[data-m-rm-animation="true"]') && nectarDOMInfo.winW < 1000) {
9924                                    $that.find('> * > span .inner').css({
9925                                        'transform': 'translateY(0)',
9926                                        'opacity': '1'
9927                                    });
9928                                } else {
9929                                    $that.find('> * > span').each(function (i) {
9930
9931                                        if (stagger == 0) {
9932                                            $(this).find('> .inner').delay(i * stagger).transition({
9933                                                'y': '0px',
9934                                                'opacity': '1'
9935                                            }, $animationDurationCap, $animationEasing);
9936                                        } else {
9937                                            var spanEl = $(this);
9938                                            var $innerEl = spanEl.find('> .inner');
9939                                            setTimeout(function () {
9940                                                $innerEl[0].style.transform = 'translateY(0em)';
9941                                                $innerEl[0].style.opacity = '1';
9942                                            }, i * stagger);
9943
9944                                        }
9945
9946                                    });
9947                                }
9948
9949                            } else if ($that.is('[data-animation-type="line-reveal-by-space"][data-text-effect*="letter-reveal"]')) {
9950
9951                                $animationDurationCap = (parseInt($animationDuration) < 1000) ? $animationDuration : '1000';
9952
9953                                var stagger = 0;
9954
9955                                var spans = $that.find('> * > span span');
9956
9957                                var animationArr = ($that.is('[data-text-effect="letter-reveal-top"]')) ? ['-1.3em', '0em'] : ['1.3em', '0em'];
9958
9959                                stagger = 400 / spans.length;
9960                                stagger = Math.min(Math.max(stagger, 20), 35); // Clamp val
9961
9962                                if (spans.length > 0) {
9963                                    animeAnimations.push(anime({
9964                                        targets: $that.find('> * > span span').toArray(),
9965                                        translateY: animationArr,
9966                                        delay: anime.stagger(stagger),
9967                                        duration: 1200,
9968                                        easing: 'cubicBezier(0.25,1,0.5,1)'
9969                                    }));
9970                                }
9971
9972
9973                            } else {
9974                                $that.find('.heading-line').each(function (i) {
9975
9976                                    $(this).find('> div').delay(i * 70).transition({
9977                                        'y': '0px'
9978                                    }, $animationDuration, $animationEasing);
9979
9980                                });
9981                            }
9982
9983                            $that.addClass('animated-in');
9984
9985                        }, $delay);
9986
9987                    }
9988
9989                    waypoint.destroy();
9990                },
9991                offset: $splitLineOffsetPos
9992            });
9993
9994        });
9995
9996
9997        // Scroll based timeline animations.
9998        $($fullscreenSelector + '.nectar-split-heading.scroll-timeline').each(function (i) {
9999
10000            if ($nectarFullPage.$usingFullScreenRows === true) {
10001
10002                var $that = $(this);
10003
10004                var waypoint = new Waypoint({
10005                    element: $that[0],
10006                    handler: function () {
10007
10008                        if ($that.parents('.wpb_tab').length > 0 &&
10009                            $that.parents('.wpb_tab').css('visibility') == 'hidden' ||
10010                            $that.hasClass('animated-in')) {
10011
10012                            waypoint.destroy();
10013                            return;
10014                        }
10015
10016                        if (!bypassAnimations || $('body[data-responsive="0"]').length > 0) {
10017
10018                            $that.find('.inner').each(function (index) {
10019
10020                                var $this = $(this);
10021                                setTimeout(function () {
10022                                    $this.css({
10023                                        'opacity': '1'
10024                                    });
10025                                }, index * 30);
10026                            });
10027                        }
10028                    },
10029                    offset: '500%'
10030                });
10031
10032            } else {
10033                new NectarSplitHeadingTimeline($(this));
10034            }
10035
10036        });
10037    }
10038
10039    function NectarSplitHeadingTimeline(el) {
10040
10041        this.$el = el;
10042        this.inView = false;
10043        this.timeline = null;
10044        this.duration = 450;
10045        this.speed = 1.9;
10046        this.wordDelay = 150;
10047        this.topLevel = false;
10048        this.topCushion = (nectarDOMInfo.winH * 0.05);
10049        this.mergedGroup = false;
10050
10051        if (this.$el.parents('.wpb_row.nectar-split-heading-merged').length > 0) {
10052            // exit as the timeline is already being handled.
10053            return;
10054        }
10055
10056        this.mergeNeighbors();
10057        this.trackInView();
10058        this.createTimeline();
10059        this.events();
10060        this.raf();
10061    }
10062
10063    NectarSplitHeadingTimeline.prototype.mergeNeighbors = function () {
10064        var $parentRow = this.$el.closest('.wpb_row');
10065        if ($parentRow.length > 0 && $parentRow.find('.nectar-split-heading[data-text-effect="scroll-opacity-reveal"]').length > 0) {
10066            this.$el = $parentRow;
10067            this.mergedGroup = true;
10068            $parentRow.addClass('nectar-split-heading-merged');
10069        }
10070    }
10071
10072    NectarSplitHeadingTimeline.prototype.trackInView = function () {
10073        var that = this;
10074        var track = new IntersectionObserver(function (entries) {
10075
10076            entries.forEach(function (entry) {
10077                if (entry.isIntersecting) {
10078                    that.inView = true;
10079                    that.elHeight = that.$el.outerHeight();
10080                    that.offsetTop = that.$el.offset().top;
10081                } else {
10082                    that.inView = false;
10083                }
10084            });
10085
10086        }, {
10087            root: (isSafari()) ? null : document,
10088            rootMargin: '100px 0px 100px 0px',
10089            threshold: 0
10090        });
10091
10092        track.observe(this.$el[0]);
10093
10094        // Top Level.
10095        var clientRect = this.$el[0].getBoundingClientRect();
10096        if ((clientRect.top + nectarDOMInfo.scrollTop + clientRect.height) < nectarDOMInfo.winH) {
10097            this.topLevel = true;
10098        }
10099
10100    };
10101
10102    NectarSplitHeadingTimeline.prototype.events = function () {
10103        if (nectarDOMInfo.usingMobileBrowser) {
10104            window.addEventListener('orientationchange', this.calc.bind(this));
10105        } else {
10106            window.addEventListener('resize', this.calc.bind(this));
10107        }
10108
10109        this.calc();
10110    };
10111
10112    NectarSplitHeadingTimeline.prototype.calc = function () {
10113        this.offsetTop = this.$el.offset().top;
10114        this.elHeight = this.$el.outerHeight();
10115
10116        this.wordCount = this.mergedGroup ? this.$el.find('.nectar-split-heading .inner').length : this.$el.find('.inner').length;
10117
10118        if (this.elHeight / nectarDOMInfo.winH < .25 && this.wordCount < 40) {
10119            this.speed = 2.5;
10120        } else {
10121            this.speed = Math.max(2 - Math.min((this.elHeight / nectarDOMInfo.winH), 1.45), 0.66);
10122            if (this.speed < 1.2 || this.wordCount < 30 && this.speed < 1.5) {
10123                this.topCushion = (nectarDOMInfo.winH * 0.25);
10124                this.wordDelay = 250;
10125            }
10126        }
10127
10128        var customOffset = this.$el.find('.nectar-split-heading[data-text-effect="scroll-opacity-reveal"]').attr('data-animation-offset');
10129        if (customOffset && parseInt(customOffset) > 0 && parseInt(customOffset) < 100) {
10130            customOffset = parseInt(customOffset);
10131            this.topCushion = (nectarDOMInfo.winH * 0.05) + ((nectarDOMInfo.winH * 0.05) * (1 - (customOffset / 100)) * 6);
10132        }
10133
10134
10135    };
10136
10137    NectarSplitHeadingTimeline.prototype.createTimeline = function () {
10138
10139        var self = this;
10140        this.timeline = anime.timeline({
10141            autoplay: false
10142        });
10143
10144        var timelineProps = {
10145            targets: this.mergedGroup ? this.$el[0].querySelectorAll('.nectar-split-heading .inner') : this.$el[0].querySelectorAll('.inner'),
10146            duration: this.duration,
10147            easing: 'linear',
10148            opacity: [0.2, 1],
10149            delay: function (el, i) {
10150                return i * self.wordDelay;
10151            },
10152        };
10153
10154        this.timeline.add(timelineProps, 0);
10155
10156    };
10157
10158    NectarSplitHeadingTimeline.prototype.raf = function () {
10159        if (!this.inView || nectarState.materialOffCanvasOpen == true) {
10160            requestAnimationFrame(this.raf.bind(this));
10161            return;
10162        }
10163
10164
10165        var progress;
10166
10167        if (!this.topLevel) {
10168            progress = 1 + (nectarDOMInfo.scrollTop - (this.offsetTop + this.topCushion)) / nectarDOMInfo.winH;
10169        } else {
10170            progress = (nectarDOMInfo.scrollTop / nectarDOMInfo.winH) * 1.5;
10171        }
10172
10173        this.timeline.seek(progress * this.timeline.duration * this.speed);
10174        requestAnimationFrame(this.raf.bind(this));
10175
10176    };
10177
10178
10179    /**
10180     * Progress bar element initialization.
10181     *
10182     * @since 3.0
10183     * @see waypoints
10184     */
10185
10186    function progressBars() {
10187
10188        var $progressBarsOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : 'bottom-in-view';
10189        var $progressSelector = ($('#nectar_fullscreen_rows[data-mobile-disable="on"]').length > 0 && nectarDOMInfo.usingMobileBrowser) ? '.nectar-progress-bar' : $fullscreenSelector + '.nectar-progress-bar';
10190
10191        if (nectarDOMInfo.usingMobileBrowser && $progressBarsOffsetPos == 'bottom-in-view') {
10192            $progressBarsOffsetPos = '70%';
10193        }
10194
10195        $($progressSelector).each(function () {
10196
10197            var $that = $(this);
10198
10199            var waypoint = new Waypoint({
10200                element: $that[0],
10201                handler: function () {
10202
10203                    if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) {
10204                        waypoint.destroy();
10205                        return;
10206                    }
10207
10208                    if ($progressBarsOffsetPos == '100%') {
10209                        $that.find('.bar-wrap').css('opacity', '1');
10210                    }
10211
10212
10213                    var percent = $that.find('span').attr('data-width'),
10214                        $endNum = parseInt($that.find('span strong i').text());
10215
10216                    $that.find('span').transition({
10217                        'width': parseInt(percent) + '%'
10218                    }, 800, 'easeInOutCubic');
10219
10220                    var countOptions = {
10221                        useEasing: false
10222                    };
10223                    var $countEle = $that.find('span strong i')[0];
10224                    var numAnim = new CountUp($countEle, 0, $endNum, 0, 1, countOptions);
10225                    numAnim.start();
10226
10227                    $that.find('span strong').transition({
10228                        'opacity': 1
10229                    }, 550, 'easeInCirc');
10230
10231                    ////100% progress bar
10232                    if (percent == '100') {
10233                        $that.find('span strong').addClass('full');
10234                    }
10235
10236                    $that.addClass('completed');
10237
10238                    waypoint.destroy();
10239
10240                },
10241                offset: $progressBarsOffsetPos
10242            });
10243
10244        });
10245
10246    }
10247
10248
10249    /**
10250     * Page builder column border animations.
10251     *
10252     * @since 8.0
10253     * @see waypoints
10254     */
10255    function animatedColBorders() {
10256
10257        var $progressBarsOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : '75%';
10258        $($fullscreenSelector + '.wpb_column[data-border-animation="true"]').each(function () {
10259
10260            var $that = $(this),
10261                waypoint = new Waypoint({
10262                    element: $that[0],
10263                    handler: function () {
10264
10265                        if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) {
10266                            waypoint.destroy();
10267                            return;
10268                        }
10269
10270                        var $borderDelay = ($that.attr('data-border-animation-delay').length > 0) ? parseInt($that.attr('data-border-animation-delay')) : 0;
10271                        setTimeout(function () {
10272                            $that.find('.border-wrap').addClass('animation');
10273                            $that.find('.border-wrap').addClass('completed');
10274                        }, $borderDelay);
10275
10276                        waypoint.destroy();
10277
10278                    },
10279                    offset: $progressBarsOffsetPos
10280                });
10281
10282        });
10283    }
10284
10285
10286    /**
10287     * General waypoints
10288     *
10289     * @since 14.0.2
10290     * @see waypoints
10291     */
10292    function generalWaypoints() {
10293
10294        $($fullscreenSelector + '.nectar-waypoint-el').each(function () {
10295
10296            var staggerEl = $(this).is('[data-nectar-waypoint-el-stagger]') ? $(this).attr('data-nectar-waypoint-el-stagger') : false;
10297            var delay = $(this).is('[data-nectar-waypoint-el-delay]') ? parseInt($(this).attr('data-nectar-waypoint-el-delay')) : 0;
10298            var offset = $(this).is('[data-nectar-waypoint-el-offset]') ? parseInt($(this).attr('data-nectar-waypoint-el-offset')) + '%' : '90%';
10299
10300            if ($fullscreenMarkupBool == true) {
10301                offset = '500%';
10302            }
10303
10304            var $that = $(this),
10305                waypoint = new Waypoint({
10306                    element: $that[0],
10307                    handler: function () {
10308                        if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) {
10309                            waypoint.destroy();
10310                            return;
10311                        }
10312
10313                        setTimeout(function () {
10314
10315                            if (staggerEl) {
10316                                $that.find('.' + staggerEl).each(function (i) {
10317                                    var $thatt = $(this);
10318                                    setTimeout(function () {
10319                                        $thatt.addClass('animated-in');
10320                                    }, i * 100);
10321                                });
10322                            } else {
10323                                $that.addClass('animated-in');
10324                            }
10325
10326                        }, delay);
10327
10328
10329                        waypoint.destroy();
10330
10331                    },
10332                    offset: offset
10333                });
10334        });
10335    }
10336
10337
10338    /**
10339     * Food menu item element.
10340     *
10341     * @since 8.0
10342     * @see waypoints
10343     */
10344    function foodMenuItems() {
10345
10346        var $foodItemOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : '80%';
10347        $($fullscreenSelector + '.nectar_food_menu_item').parent().each(function () {
10348
10349            var $that = $(this),
10350                waypoint = new Waypoint({
10351                    element: $that[0],
10352                    handler: function () {
10353
10354                        if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) {
10355                            waypoint.destroy();
10356                            return;
10357                        }
10358
10359                        $that.find('.nectar_food_menu_item').each(function (i) {
10360
10361                            var $that = $(this);
10362
10363                            setTimeout(function () {
10364                                $that.addClass('animated-in');
10365                            }, i * 150);
10366
10367                        });
10368
10369                        waypoint.destroy();
10370
10371                    },
10372                    offset: $foodItemOffsetPos
10373                });
10374
10375        });
10376    }
10377
10378
10379    /**
10380     * Divider element
10381     *
10382     * @since 3.0
10383     * @see waypoints
10384     */
10385    function dividers() {
10386
10387        var $dividerOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : 'bottom-in-view';
10388
10389        $($fullscreenSelector + '.divider-small-border[data-animate="yes"], ' + $fullscreenSelector + '.divider-border[data-animate="yes"]').each(function () {
10390
10391            var $lineDur = ($(this).hasClass('divider-small-border')) ? 1300 : 1500,
10392                $that = $(this),
10393                waypoint = new Waypoint({
10394                    element: $that[0],
10395                    handler: function () {
10396
10397                        if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) {
10398                            waypoint.destroy();
10399                            return;
10400                        }
10401
10402                        $that.each(function () {
10403
10404                            $(this).css({
10405                                'transform': 'scale(0,1)',
10406                                'visibility': 'visible'
10407                            });
10408                            var $that = $(this);
10409
10410                            $that.delay($that.attr('data-animation-delay')).transition({
10411                                'transform': 'scale(1, 1)'
10412                            }, $lineDur, 'cubic-bezier(.18,0.75,.25,1)');
10413
10414                        });
10415
10416                        $that.addClass('completed');
10417
10418                        waypoint.destroy();
10419
10420                    },
10421                    offset: $dividerOffsetPos
10422                });
10423
10424        });
10425    }
10426
10427
10428    /**
10429     * Image with hotspots element hover event
10430     *
10431     * @since 7.0
10432     */
10433    function hotSpotHoverBind() {
10434
10435        //add pulse animation
10436        $('.nectar_image_with_hotspots[data-hotspot-icon="numerical"]').each(function () {
10437            $(this).find('.nectar_hotspot_wrap').each(function (i) {
10438                var $that = $(this);
10439                setTimeout(function () {
10440                    $that.find('.nectar_hotspot').addClass('pulse');
10441                }, i * 300);
10442            });
10443        });
10444
10445
10446        var hotSpotHoverTimeout = [];
10447
10448        $('.nectar_image_with_hotspots:not([data-tooltip-func="click"]) .nectar_hotspot').each(function (i) {
10449
10450            hotSpotHoverTimeout[i] = '';
10451
10452            $(this).on('mouseover', function () {
10453                clearTimeout(hotSpotHoverTimeout[i]);
10454                $(this).parent().css({
10455                    'z-index': '400',
10456                    'height': 'auto',
10457                    'width': 'auto'
10458                });
10459            });
10460
10461            $(this).on('mouseleave', function () {
10462
10463                var $that = $(this);
10464                $that.parent().css({
10465                    'z-index': 'auto'
10466                });
10467
10468                hotSpotHoverTimeout[i] = setTimeout(function () {
10469                    $that.parent().css({
10470                        'height': '30px',
10471                        'width': '30px'
10472                    });
10473                }, 300);
10474
10475            });
10476
10477        });
10478
10479    }
10480
10481
10482    /**
10483     * Image with hotspots element responsive behavior.
10484     *
10485     * @since 7.0
10486     */
10487    function responsiveTooltips() {
10488
10489        $('.nectar_image_with_hotspots').each(function () {
10490
10491            $(this).find('.nectar_hotspot_wrap').each(function () {
10492
10493                if (nectarDOMInfo.winW > 690) {
10494
10495                    // Remove click if applicable
10496                    if ($(this).parents('.nectar_image_with_hotspots[data-tooltip-func="hover"]').length > 0) {
10497                        $(this).find('.nectar_hotspot').removeClass('click');
10498                        $(this).find('.nttip').removeClass('open');
10499                    }
10500
10501                    $(this).find('.nttip .inner a.tipclose').remove();
10502                    $('.nttip').css('height', 'auto');
10503
10504                    // Reset for positioning
10505                    $(this).css({
10506                        'width': 'auto',
10507                        'height': 'auto'
10508                    });
10509
10510                    $(this).find('.nttip')
10511                        .removeClass('force-right')
10512                        .removeClass('force-left')
10513                        .removeClass('force-top')
10514                        .css('width', 'auto');
10515
10516                    var $tipOffset = $(this).find('.nttip').offset();
10517
10518                    // Against right side
10519                    if ($tipOffset.left > $(this).parents('.nectar_image_with_hotspots').width() - 200) {
10520                        $(this).find('.nttip').css('width', '250px');
10521                    } else {
10522                        $(this).find('.nttip').css('width', 'auto');
10523                    }
10524
10525                    // Responsive
10526                    if ($tipOffset.left < 0) {
10527                        $(this).find('.nttip').addClass('force-right');
10528                    } else if ($tipOffset.left + $(this).find('.nttip').outerWidth(true) > nectarDOMInfo.winW) {
10529                        $(this).find('.nttip').addClass('force-left').css('width', '250px');
10530                    } else if ($tipOffset.top + $(this).find('.nttip').height() + 35 > $window.height() && $('#nectar_fullscreen_rows').length > 0) {
10531                        $(this).find('.nttip').addClass('force-top');
10532                    }
10533
10534                    if ($(this).find('> .open').length == 0) {
10535
10536                        $(this).css({
10537                            'width': '30px',
10538                            'height': '30px'
10539                        });
10540                    }
10541
10542                } else {
10543
10544                    //fixed position
10545                    $(this).find('.nttip')
10546                        .removeClass('force-left')
10547                        .removeClass('force-right')
10548                        .removeClass('force-top');
10549
10550                    $(this).find('.nectar_hotspot').addClass('click');
10551
10552                    if ($(this).find('.nttip a.tipclose').length == 0) {
10553                        $(this).find('.nttip .inner').append('<a href="#" class="tipclose"><span><i class="screen-reader-text">' + nectar_front_i18n.close + '</i></span></a>');
10554                    }
10555
10556                    // Change height of fixed
10557                    $('.nttip').css('height', $window.height());
10558                }
10559            });
10560        });
10561
10562    }
10563
10564
10565    /**
10566     * Image with hotspots events
10567     *
10568     * @since 10.5
10569     */
10570    function imageWithHotspotEvents() {
10571
10572        if ($('.nectar_image_with_hotspots').length == 0) {
10573            return;
10574        }
10575
10576        // Hover
10577        hotSpotHoverBind();
10578
10579        // Click
10580        $body.on('click', '.nectar_hotspot.click', function () {
10581            $(this).parents('.nectar_image_with_hotspots').find('.nttip').removeClass('open');
10582            $(this).parent().find('.nttip').addClass('open');
10583
10584            $(this).parents('.nectar_image_with_hotspots').find('.nectar_hotspot').removeClass('open');
10585            $(this).parent().find('.nectar_hotspot').addClass('open');
10586
10587            if (nectarDOMInfo.winW > 690) {
10588                $(this).parent().css({
10589                    'z-index': '120',
10590                    'height': 'auto',
10591                    'width': 'auto'
10592                });
10593
10594                var $that = $(this);
10595
10596                setTimeout(function () {
10597                    $that.parents('.nectar_image_with_hotspots').find('.nectar_hotspot_wrap').each(function () {
10598
10599                        if ($(this).find('> .open').length == 0) {
10600                            $(this).css({
10601                                'height': '30px',
10602                                'width': '30px',
10603                                'z-index': 'auto'
10604                            });
10605                        }
10606                    });
10607                }, 300);
10608            }
10609
10610            if (nectarDOMInfo.winW <= 690) {
10611                if ($('body.nectar_box_roll').length > 0) {
10612                    $('.container-wrap').addClass('hotspot-open');
10613                }
10614                $('.nectar_hotspot.click').parents('.wpb_row, [class*="vc_col-"]').css('z-index', '');
10615                $(this).parents('.wpb_row, [class*="vc_col-"]').css('z-index', '200');
10616            }
10617
10618            return false;
10619        });
10620
10621        $body.on('click', '.nectar_hotspot.open', function () {
10622            $(this).parent().find('.nttip').removeClass('open');
10623            $(this).parent().find('.nectar_hotspot').removeClass('open');
10624
10625            $(this).parents('.wpb_row').css('z-index', 'auto');
10626
10627            return false;
10628        });
10629
10630        $body.on('click', '.nttip.open', function (e) {
10631            if (nectarDOMInfo.winW < 690) {
10632
10633                if (e.target && $(e.target).is('a')) {
10634                    return;
10635                }
10636                if ($('body.nectar_box_roll').length > 0) {
10637                    $('.container-wrap').removeClass('hotspot-open');
10638                }
10639
10640                $(this).parents('.nectar_image_with_hotspots').find('.nttip').removeClass('open');
10641                $(this).parents('.nectar_image_with_hotspots').find('.nectar_hotspot').removeClass('open');
10642                $(this).parents('.wpb_row').css('z-index', 'auto');
10643                return false;
10644            }
10645        });
10646
10647
10648        // Calculate on init.
10649        responsiveTooltips();
10650
10651        // Resize event.
10652        $window.on('resize', responsiveTooltips);
10653
10654    }
10655
10656
10657    /**
10658     * Image with hotspots initialization.
10659     *
10660     * @since 7.0
10661     * @see waypoints
10662     */
10663    function imageWithHotspots() {
10664
10665        var $imageWithHotspotsOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : '50%';
10666
10667        $($fullscreenSelector + '.nectar_image_with_hotspots[data-animation="true"]').each(function () {
10668
10669            var $that = $(this);
10670            var waypoint = new Waypoint({
10671                element: $that[0],
10672                handler: function () {
10673
10674                    if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) {
10675                        waypoint.destroy();
10676                        return;
10677                    }
10678
10679                    $that.addClass('completed');
10680                    $that.find('.nectar_hotspot_wrap').each(function (i) {
10681                        var $that2 = $(this);
10682                        var $extrai = ($that2.parents('.col.has-animation').length > 0) ? 1 : 0;
10683                        setTimeout(function () {
10684                            $that2.addClass('animated-in');
10685                        }, 175 * (i + $extrai));
10686                    });
10687
10688                    waypoint.destroy();
10689
10690                },
10691                offset: $imageWithHotspotsOffsetPos
10692            });
10693
10694        });
10695
10696
10697    }
10698
10699
10700    /**
10701     *  Triggers the loading of all lazy images.
10702     *
10703     * @since 15.0
10704     */
10705    function nectarLoadAllImages() {
10706
10707        var lazyItems = [].slice.call(document.querySelectorAll('[data-nectar-img-src]'));
10708
10709        lazyItems.forEach(function (lazyItem) {
10710
10711            var imgSrc = lazyItem.getAttribute('data-nectar-img-src');
10712
10713            if (imgSrc) {
10714                nectarLazyImageLoad(lazyItem, imgSrc, lazyItemObserver);
10715            }
10716
10717        });
10718    }
10719
10720
10721    /**
10722     *  Lazy loading callback to load single image src
10723     *
10724     * @since 15.0
10725     */
10726    function nectarLazyImageLoad(lazyItem, imgSrc, lazyItemObserver) {
10727
10728        // img tags.
10729        if (lazyItem.classList.contains('nectar-lazy')) {
10730            lazyItem.addEventListener('load', function () {
10731
10732
10733                if (!lazyItem.classList.contains('keep-calculated-size')) {
10734                    lazyItem.style.height = "";
10735                    lazyItem.style.width = "";
10736                }
10737
10738                lazyItem.classList.add('loaded');
10739                lazyItem.removeAttribute('data-nectar-img-src');
10740
10741                // Recalculate layout for image gallery portfolio grid as images progress.
10742                if (typeof SalientPortfolio !== 'undefined' && lazyItem.classList.contains('image-gallery-portfolio-item')) {
10743                    $(window).trigger('salient-portfolio-recalculate');
10744                }
10745
10746                // Fix waypoints.
10747                if (!nectarDOMInfo.usingMobileBrowser) {
10748                    Waypoint.refreshAll();
10749                }
10750
10751                lazyItemObserver.unobserve(lazyItem);
10752            });
10753            lazyItem.src = imgSrc;
10754            var srcset = lazyItem.getAttribute('data-nectar-img-srcset');
10755            if (srcset) {
10756                lazyItem.setAttribute('srcset', srcset);
10757                lazyItem.removeAttribute('data-nectar-img-srcset');
10758            }
10759
10760            lazyItem.parentNode.classList.add('img-loaded');
10761
10762        }
10763        // BGs.
10764        else {
10765            lazyItem.style.backgroundImage = "url('" + imgSrc + "')";
10766            lazyItem.classList.add('loaded');
10767            lazyItem.removeAttribute('data-nectar-img-src');
10768            lazyItemObserver.unobserve(lazyItem);
10769        }
10770
10771
10772    }
10773
10774    $(window).on('salient-lazyloading-image-reinit', nectarLazyImageLoading);
10775    $(window).on('salient-lazyloading-image-reinit', nectarLazyImageSizing);
10776
10777    /**
10778     * Nectar Lazy Loading
10779     *
10780     * @since 11.0
10781     */
10782
10783    function nectarLazyVideoCallback(video, lazyVideoObserver) {
10784
10785        if (video.isIntersecting) {
10786
10787            // Already triggered
10788            if (video.target.classList.contains('loaded')) {
10789                lazyVideoObserver.unobserve(video.target);
10790                return;
10791            }
10792
10793            for (var source in video.target.children) {
10794                var videoSource = video.target.children[source];
10795                if (typeof videoSource.tagName === "string" && videoSource.tagName === "SOURCE") {
10796                    videoSource.src = videoSource.dataset.nectarVideoSrc;
10797                }
10798            }
10799
10800            video.target.load();
10801            video.target.classList.remove("lazy")
10802            video.target.classList.add('loaded');
10803            lazyVideoObserver.unobserve(video.target);
10804        }
10805    }
10806
10807    function nectarLazyImageLoading() {
10808
10809        var lazyItems = [].slice.call(document.querySelectorAll('[data-nectar-img-src]'));
10810        var lazyVideoItems = [].slice.call(document.querySelectorAll('.nectar-lazy-video'));
10811        var lazyMenuVideoItems = [].slice.call(document.querySelectorAll('#header-outer .nectar-lazy-video'));
10812
10813        if ('IntersectionObserver' in window) {
10814
10815            var options = {
10816                rootMargin: '450px',
10817            }
10818
10819            $window.off('resize.nectarLazySizing', nectarLazyImageSizing);
10820            $window.on('resize.nectarLazySizing', nectarLazyImageSizing);
10821
10822            // Images.
10823            lazyItemObserver = new IntersectionObserver(function (entries) {
10824
10825                entries.forEach(function (entry) {
10826                    if (entry.isIntersecting) {
10827                        var lazyItem = entry.target;
10828
10829                        var imgSrc = lazyItem.getAttribute('data-nectar-img-src');
10830
10831                        if (imgSrc) {
10832                            nectarLazyImageLoad(lazyItem, imgSrc, lazyItemObserver)
10833                        }
10834
10835                    }
10836
10837                });
10838
10839            }, options);
10840
10841            lazyItems.forEach(function (lazyItem) {
10842                lazyItemObserver.observe(lazyItem);
10843            });
10844
10845            // Videos.
10846            var lazyVideoObserver = new IntersectionObserver(function (entries, observer) {
10847                entries.forEach(function (video) {
10848                    nectarLazyVideoCallback(video, lazyVideoObserver);
10849                });
10850            }, {
10851                root: (isSafari()) ? null : document,
10852                rootMargin: '125px'
10853            });
10854
10855            var lazyVideoObserverNoRoot = new IntersectionObserver(function (entries, observer) {
10856                entries.forEach(function (video) {
10857                    nectarLazyVideoCallback(video, lazyVideoObserverNoRoot);
10858                });
10859            }, {
10860                rootMargin: '125px'
10861            });
10862
10863            lazyMenuVideoItems.forEach(function (lazyVideo) {
10864                lazyVideoObserverNoRoot.observe(lazyVideo);
10865            });
10866
10867            lazyVideoItems.forEach(function (lazyVideo) {
10868                lazyVideoObserver.observe(lazyVideo);
10869            });
10870
10871
10872        } else {
10873            // load all the images when intersection observer is not supported.
10874            lazyItems.forEach(function (lazyItem) {
10875
10876                // img tags.
10877                if (lazyItem.classList.contains('nectar-lazy')) {
10878
10879                    if (!lazyItem.classList.contains('keep-calculated-size')) {
10880                        lazyItem.style.height = "";
10881                        lazyItem.style.width = "";
10882                    }
10883
10884                    lazyItem.src = lazyItem.getAttribute('data-nectar-img-src');
10885                    var srcset = lazyItem.getAttribute('data-nectar-img-srcset');
10886                    if (srcset) {
10887                        lazyItem.setAttribute('srcset', srcset);
10888                        lazyItem.removeAttribute('data-nectar-img-srcset');
10889                    }
10890
10891                    lazyItem.parentNode.classList.add('img-loaded');
10892                    lazyItem.classList.add('loaded');
10893                    lazyItem.removeAttribute('data-nectar-img-src');
10894                }
10895                // BGs.
10896                else {
10897                    lazyItem.style.backgroundImage = "url('" + lazyItem.getAttribute('data-nectar-img-src') + "')";
10898                    lazyItem.classList.add('loaded');
10899                    lazyItem.removeAttribute('data-nectar-img-src');
10900                }
10901
10902            });
10903
10904            // Videos
10905            lazyVideoItems.forEach(function (video) {
10906                for (var source in video.children) {
10907                    var videoSource = video.children[source];
10908                    if (typeof videoSource.tagName === "string" && videoSource.tagName === "SOURCE") {
10909                        videoSource.src = videoSource.dataset.nectarVideoSrc;
10910                    }
10911                }
10912
10913                video.load();
10914                video.classList.remove("lazy")
10915                video.classList.add('loaded');
10916
10917            });
10918
10919        }
10920
10921
10922    }
10923
10924
10925    /**
10926     * Nectar lazy img size helper.
10927     *
10928     * @since 11.0
10929     */
10930
10931    function nectarLazyImageSizing() {
10932
10933        $('img.nectar-lazy:not(.loaded):not(.image-gallery-portfolio-item)').each(function () {
10934
10935            // items to skip.
10936            if ($(this).hasClass('attachment-shop_thumbnail') ||
10937                $(this).hasClass('attachment-woocommerce_thumbnail') ||
10938                $(this).parents('.nectar-post-grid-item').length > 0) {
10939                return true;
10940            }
10941
10942            $(this).css({
10943                'height': '',
10944                'width': ''
10945            });
10946
10947
10948            var heightAttr = parseInt($(this).attr('height'));
10949            var widthAttr = parseInt($(this).attr('width'));
10950
10951            var width = ($(this).parents('.nectar_cascading_images').length > 0) ? $(this).parents('.bg-layer').width() : $(this).width();
10952
10953            if ($(this).parents('.img-with-aniamtion-wrap.custom-size').length > 0) {
10954                if (width > widthAttr) {
10955                    width = widthAttr;
10956                }
10957            }
10958
10959            // Shadow img.
10960            if ($(this).parents('.img-with-aniamtion-wrap[data-shadow*="depth"]').length > 0) {
10961                width = $(this).parents('.img-with-aniamtion-wrap').width();
10962            }
10963
10964            // Post grid.
10965            if ($(this).parents('.nectar-post-grid-item-bg-wrap-inner').length > 0 && !$(this).hasClass('nectar-post-grid-item__overlaid-img')) {
10966                width = $(this).parents('.nectar-post-grid-item-bg-wrap-inner').width();
10967            }
10968
10969            var dimensions = calculateAspectRatio(widthAttr, heightAttr, width, 2000);
10970
10971            $(this).css({
10972                'height': dimensions.height + 'px',
10973                'width': dimensions.width + 'px'
10974            });
10975
10976        });
10977
10978    }
10979
10980
10981    /**
10982     * Nectar Post Grid Mouse Follow Init
10983     *
10984     * @since 11.0
10985     */
10986    function nectarPostGridMouse() {
10987
10988        viewIndicatorArr = [];
10989        postGridImgMouseFollowArr = [];
10990
10991        if (!nectarDOMInfo.usingMobileBrowser) {
10992
10993            $('.nectar-post-grid[data-indicator="yes"]').each(function (i) {
10994                viewIndicatorArr[i] = new NectarIconMouseFollow($(this), 'view-indicator');
10995            });
10996
10997            $('.nectar-post-grid-wrap[data-style="mouse_follow_image"] .nectar-post-grid').each(function (i) {
10998                postGridImgMouseFollowArr[i] = new NectarIconMouseFollow($(this), 'post-grid-images');
10999            });
11000
11001            $('.nectar-category-grid[data-style="mouse_follow_image"]').each(function (i) {
11002                postGridImgMouseFollowArr[i] = new NectarIconMouseFollow($(this), 'post-grid-images');
11003            });
11004
11005        }
11006
11007    }
11008
11009
11010    /**
11011     * Nectar Post Grid
11012     *
11013     * @since 11.0
11014     */
11015    function nectarPostGridInit() {
11016
11017        $nectarPostGridArr = [];
11018
11019        // Mouse follow.
11020        nectarPostGridMouse();
11021
11022        // Create grid instances.
11023        $('.nectar-post-grid-wrap').each(function (i) {
11024            $nectarPostGridArr[i] = new NectarPostGrid($(this));
11025        });
11026
11027
11028    }
11029
11030
11031    function NectarPostGrid(el) {
11032
11033        this.el = el;
11034        this.currentPage = 0;
11035        this.activeFilter = 1;
11036        this.activeCatTotal = 0;
11037        this.settingsData = JSON.parse(this.el.attr('data-el-settings'));
11038        this.queryData = JSON.parse(this.el.attr('data-query'));
11039        this.sortable = this.el.find('.nectar-post-grid-filters').attr('data-sortable');
11040        this.gridStyle = this.el.attr('data-style');
11041
11042        this.initialMarkup();
11043        this.clickEvents();
11044        this.deepLinking();
11045        this.lightboxGroups();
11046        this.externalProjectLinks();
11047    }
11048
11049    NectarPostGrid.prototype.initialMarkup = function () {
11050
11051        // Start Filter Active.
11052        if (this.el.find('.nectar-post-grid-filters a.active').length == 0) {
11053            this.el.find('.nectar-post-grid-filters a:first-child').addClass('active');
11054        }
11055
11056        // Load More Markup.
11057        if (this.settingsData.pagination === 'load-more' && this.el.find('.load-more-wrap').length == 0) {
11058
11059            if (this.el.find('.nectar-post-grid-filters .active').length > 0) {
11060                this.activeFilter = this.el.find('.nectar-post-grid-filters .active').index() + 1;
11061            }
11062
11063            var isUsingSortable = (this.sortable === 'yes') ? true : false;
11064            // add up total counts for all selected taxonomies when all and sortable are not in use.
11065            if (!isUsingSortable && this.el.find('.active.all-filter').length === 0) {
11066                var total = 0;
11067                this.el.find('.nectar-post-grid-filters a').each(function () {
11068                    total += parseInt($(this).attr('data-total-count'));
11069                });
11070                this.activeCatTotal = total;
11071            } else {
11072                // total count must be from all items or start with the active category.
11073                this.activeCatTotal = parseInt(this.el.find('.nectar-post-grid-filters a:nth-child(' + this.activeFilter + ')').attr('data-total-count'));
11074            }
11075
11076            // Start hidden?
11077            if (this.el.find('.nectar-post-grid-item').length >= this.activeCatTotal) {
11078                this.el.addClass('all-loaded');
11079                this.el.append('<div class="load-more-wrap inactive"><a href="#" role="button" class="load-more">' + this.el.attr('data-load-more-text') + '</a></div>');
11080            } else {
11081                this.el.removeClass('all-loaded');
11082                this.el.append('<div class="load-more-wrap"><a href="#" role="button" class="load-more">' + this.el.attr('data-load-more-text') + '</a></div>');
11083            }
11084
11085        }
11086
11087    };
11088
11089    NectarPostGrid.prototype.lightboxGroups = function () {
11090
11091        var unique_id = uniqueIdGenerate();
11092        var usingLightbox = (this.el.find('.nectar-post-grid-link.pretty_photo').length > 0) ? true : false;
11093
11094        if ($('body[data-ls="magnific"]').length > 0) {
11095            this.el.find('.nectar-post-grid-link.pretty_photo')
11096                .addClass('magnific')
11097                .addClass('gallery')
11098                .removeClass('pretty_photo');
11099        } else if ($('body[data-ls="fancybox"]').length > 0) {
11100            // New.
11101            this.el.find('.nectar-post-grid-link.pretty_photo')
11102                .attr('data-fancybox', 'group_' + unique_id)
11103                .removeClass('pretty_photo');
11104            // Existing.
11105            this.el.find('.nectar-post-grid-link[data-fancybox]')
11106                .attr('data-fancybox', 'group_' + unique_id);
11107        }
11108
11109        if (usingLightbox) {
11110            lightBoxInit();
11111        }
11112
11113    }
11114
11115    NectarPostGrid.prototype.externalProjectLinks = function () {
11116        if (this.el.hasClass('target-blank-external-urls')) {
11117            this.el.find(".nectar-post-grid-item a[href*='http://']:not([href*='" + window.location.hostname + "'])").attr("target", "_blank").attr('rel', 'nofollow');
11118            this.el.find(".nectar-post-grid-item a[href*='https://']:not([href*='" + window.location.hostname + "'])").attr("target", "_blank").attr('rel', 'nofollow');
11119        }
11120        if (this.el.hasClass('target-blank-all-urls')) {
11121            this.el.find(".nectar-post-grid-item a[href*='http://']").attr("target", "_blank");
11122            this.el.find(".nectar-post-grid-item a[href*='https://']").attr("target", "_blank");
11123        }
11124    }
11125
11126    NectarPostGrid.prototype.clickEvents = function () {
11127
11128        // Sortable Mobile Toggle.
11129        this.el.find('.nectar-post-grid-filters h4').on('click', function () {
11130            $(this).parent().find('div').toggleClass('visible');
11131            $(this).toggleClass('visible');
11132        });
11133
11134        // Content under featured image linkbox.
11135        if (this.gridStyle == 'content_under_image' && this.el.find('.nectar-post-grid-link.pretty_photo').length > 0) {
11136            this.el.on('click', '.bg-wrap-link', function () {
11137
11138                if ($(this).parents('.nectar-post-grid-item').find('.nectar-post-grid-link').length > 0) {
11139                    $(this).parents('.nectar-post-grid-item').find('.nectar-post-grid-link')[0].click();
11140                    return false;
11141                }
11142
11143            });
11144        }
11145
11146        // Sortable/Pagination.
11147        var settingsData = this.settingsData;
11148        var queryData = this.queryData;
11149        var instance = this;
11150
11151        this.el.find('.nectar-post-grid-filters a, .load-more-wrap .load-more').on('click', function (e) {
11152
11153            var $that = $(this);
11154
11155            // Filter active.
11156            if ($that.parents('.nectar-post-grid-wrap.loading').length > 0 || $(this).hasClass('active') || $(this).hasClass('inactive')) {
11157                return false;
11158            }
11159
11160            if ($(this).parents('.nectar-post-grid-filters').length > 0) {
11161                // Filter specific.
11162                $that.parent().find('a').removeClass('active');
11163                $that.addClass('active');
11164                instance.currentPage = 0;
11165                instance.activeFilter = $that.index() + 1;
11166            } else {
11167                // Load More specific.
11168                instance.currentPage++;
11169            }
11170
11171            var $gridEl = $that.parents('.nectar-post-grid-wrap').find('.nectar-post-grid')
11172            var $pagination = settingsData.pagination;
11173            var $action = ($that.hasClass('load-more') && $pagination === 'load-more') ? 'load-more' : 'filter';
11174            var $category = '';
11175            var $custom_query = '';
11176
11177            // Determine what category to load from.
11178            if (instance.sortable === 'yes') {
11179                $category = $that.parents('.nectar-post-grid-wrap').find('.nectar-post-grid-filters a.active').attr('data-filter');
11180                $custom_query = $that.parents('.nectar-post-grid-wrap').find('.nectar-post-grid-filters a.active').attr('data-filter');
11181            } else {
11182
11183                var skipAll = ($that.parents('.nectar-post-grid-wrap').find('.nectar-post-grid-filters a').length > 1) ? ':not(.all-filter)' : '';
11184
11185                $that.parents('.nectar-post-grid-wrap').find('.nectar-post-grid-filters a' + skipAll).each(function () {
11186                    $category += $(this).attr('data-filter') + ', ';
11187                    $custom_query += $(this).attr('data-filter') + ', ';
11188                });
11189
11190                $category = $category.substring(0, $category.length - 2);
11191                $custom_query = $custom_query.substring(0, $custom_query.length - 2);
11192
11193            }
11194
11195            var $dataToPass = {
11196                action: 'nectar_get_post_grid_segment',
11197                post_type: queryData.post_type,
11198                cpt_name: queryData.cpt_name,
11199                custom_query_tax: $custom_query,
11200                category: $category,
11201                posts_per_page: queryData.posts_per_page,
11202                current_page: instance.currentPage,
11203                offset: queryData.offset,
11204                order: queryData.order,
11205                orderby: queryData.orderby,
11206                load_action: $action,
11207                ignore_sticky_posts: queryData.ignore_sticky_posts,
11208                settings: {
11209                    pagination: $pagination,
11210                    animation: settingsData.animation,
11211                    post_type: settingsData.post_type,
11212                    image_size: settingsData.image_size,
11213                    parallax_scrolling: settingsData.parallax_scrolling,
11214                    aspect_ratio_image_size: settingsData.aspect_ratio_image_size,
11215                    card_bg_color: settingsData.card_bg_color,
11216                    category_position: settingsData.category_position,
11217                    category_display: settingsData.category_display,
11218                    display_categories: settingsData.display_categories,
11219                    display_estimated_reading_time: settingsData.display_estimated_reading_time,
11220                    display_excerpt: settingsData.display_excerpt,
11221                    excerpt_length: settingsData.excerpt_length,
11222                    display_date: settingsData.display_date,
11223                    display_author: settingsData.display_author,
11224                    author_functionality: settingsData.author_functionality,
11225                    author_position: settingsData.author_position,
11226                    color_overlay: settingsData.color_overlay,
11227                    color_overlay_opacity: settingsData.color_overlay_opacity,
11228                    color_overlay_hover_opacity: settingsData.color_overlay_hover_opacity,
11229                    grid_style: settingsData.grid_style,
11230                    hover_effect: settingsData.hover_effect,
11231                    heading_tag: settingsData.heading_tag,
11232                    heading_tag_render: settingsData.heading_tag_render,
11233                    post_title_overlay: settingsData.post_title_overlay,
11234                    category_style: settingsData.category_style,
11235                    enable_gallery_lightbox: settingsData.enable_gallery_lightbox,
11236                    overlay_secondary_project_image: settingsData.overlay_secondary_project_image,
11237                    vertical_list_hover_effect: settingsData.vertical_list_hover_effect,
11238                    vertical_list_read_more: settingsData.vertical_list_read_more,
11239                    read_more_button: settingsData.read_more_button,
11240                    custom_fields: settingsData.custom_fields,
11241                    custom_fields_location: settingsData.custom_fields_location,
11242                    display_type: settingsData.display_type,
11243                    text_content_layout: settingsData.text_content_layout
11244                }
11245            };
11246
11247
11248            // for random ordering, pass the posts already displayed to prevent duplicates.
11249            if (queryData.orderby == 'rand' && $action == 'load-more') {
11250                $dataToPass.posts_shown = '';
11251                $gridEl.find('.nectar-post-grid-item[data-post-id]').each(function () {
11252                    $dataToPass.posts_shown += $(this).attr('data-post-id') + ', ';
11253                });
11254                $dataToPass.posts_shown = $dataToPass.posts_shown.substring(0, $dataToPass.posts_shown.length - 2);
11255            }
11256
11257            $that.parents('.nectar-post-grid-wrap').addClass('loading');
11258
11259            $.post(window.nectarLove.ajaxurl, $dataToPass, function (data) {
11260
11261                // Update markup.
11262                if ($action === 'load-more') {
11263                    $gridEl.append(data);
11264                } else {
11265                    $gridEl.html(data);
11266
11267                    // Scroll to top of el when needed.
11268                    if ($gridEl.parent().hasClass('nectar-post-grid-wrap--fl-sidebar_left') ||
11269                        $gridEl.parent().hasClass('nectar-post-grid-wrap--fl-sidebar_right')) {
11270
11271                        var postGridTop = $gridEl.parent().offset().top;
11272                        var headerHeight = 0;
11273
11274                        if ($('.page-template-template-no-header-footer').length == 0 &&
11275                            $('.page-template-template-no-header').length == 0 &&
11276                            $('body[data-header-format="left-header"]').length == 0) {
11277                            headerHeight = $('#header-outer').height();
11278                        }
11279
11280                        if (nectarDOMInfo.winW > 999 && nectarDOMInfo.scrollTop > postGridTop + 200) {
11281                            window.scrollTo(0, postGridTop - headerHeight);
11282                        }
11283
11284
11285                    }
11286                }
11287
11288                buttonInit();
11289
11290                // Load in animation.
11291                if ($gridEl.is('[data-animation]') && !$gridEl.is('[data-animation="none"]')) {
11292
11293                    $that.parents('.nectar-post-grid-wrap').removeClass('finished-animating');
11294
11295                    $gridEl.find('.nectar-post-grid-item:not(.animated-in)').each(function (i) {
11296
11297                        // handle split line heaidngs.
11298                        if ($(this).find('.nectar-split-heading').length > 0) {
11299                            letterRevealMarkup($(this).find('.nectar-split-heading'));
11300                        }
11301
11302
11303                        var $storedEl = $(this);
11304                        setTimeout(function () {
11305                            $storedEl.addClass('animated-in');
11306
11307                            if (settingsData.animation === 'zoom-out-reveal') {
11308                                splitLineHeadingTrigger($storedEl, function () {
11309                                    splitLineHeadingRemoveMarkup($storedEl);
11310                                });
11311                            }
11312
11313                        }, i * 90);
11314
11315                    });
11316
11317                    setTimeout(function () {
11318                        $that.parents('.nectar-post-grid-wrap').addClass('finished-animating');
11319                    }, 950);
11320                }
11321
11322                if ($pagination === 'load-more') {
11323
11324                    instance.activeCatTotal = parseInt(instance.el.find('.nectar-post-grid-filters a:nth-child(' + instance.activeFilter + ')').attr('data-total-count'));
11325
11326                    // Remove load more if all loaded, or if no data was returned (no more posts).
11327                    // The latter will currently happen when doing a custom query and the last page is loaded
11328                    // when not specifying any taxonomy data.
11329                    if ($gridEl.find('.nectar-post-grid-item').length >= instance.activeCatTotal || !data) {
11330                        instance.el.find('.load-more-wrap').addClass('inactive');
11331                        instance.el.addClass('all-loaded');
11332                    } else {
11333                        instance.el.find('.load-more-wrap').removeClass('inactive');
11334                        instance.el.removeClass('all-loaded');
11335                    }
11336
11337                }
11338
11339                // Lightbox items.
11340                instance.lightboxGroups();
11341
11342                // Ext. links.
11343                instance.externalProjectLinks();
11344
11345                $that.parents('.nectar-post-grid-wrap').removeClass('loading');
11346
11347                // Resize.
11348                $window.trigger('resize');
11349
11350                $(window).trigger('nectar-post-grid-updated');
11351
11352                // Mouse follow.
11353                nectarPostGridMouse();
11354
11355            }); // end POST
11356
11357            e.preventDefault();
11358
11359        });
11360
11361    };
11362
11363    NectarPostGrid.prototype.deepLinking = function () {
11364
11365        if (typeof nectarGetQueryParam['grid-filter'] != 'undefined') {
11366
11367            this.el.find('.nectar-post-grid-filters a').each(function () {
11368
11369                var $currentText = $(this).clone(),
11370                    $getText = nectarGetQueryParam['grid-filter'],
11371                    $that = $(this);
11372
11373                $currentText = $currentText.text();
11374                $currentText = $currentText.replace(/\s+/g, '-').toLowerCase();
11375                $currentText = $currentText.replace(/&/g, '');
11376
11377                if ($currentText.length > 0 && $currentText.substring(0, 1) === '-') {
11378                    $currentText = $currentText.substring(1);
11379                }
11380
11381                $getText = $getText.replace(/\s+/g, '-').replace(/</g, '&lt;').replace(/"/g, '&quot;').toLowerCase();
11382                // Switch to filter
11383                if ($currentText == $getText) {
11384                    $(this).trigger('click');
11385                }
11386
11387            });
11388
11389        }
11390
11391    };
11392
11393
11394    function NectarPostGridWaypoint() {
11395
11396        var postGridOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : '75%';
11397
11398        $($fullscreenSelector + '.nectar-post-grid-wrap').each(function () {
11399
11400            if (delayJS && $(this).hasClass('delay-js-loaded') && $nectarFullPage.$usingFullScreenRows == false) {
11401                return;
11402            }
11403
11404            var $that = $(this),
11405                waypoint = new Waypoint({
11406                    element: $that[0],
11407                    handler: function () {
11408
11409                        if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) {
11410                            waypoint.destroy();
11411                            return;
11412                        }
11413
11414                        var animationTiming = $that.find('.nectar-post-grid[data-animation-stagger]') ? parseInt($that.find('.nectar-post-grid').attr('data-animation-stagger')) : 90;
11415                        var animation = $that.find('.nectar-post-grid[data-animation]') ? $that.find('.nectar-post-grid').attr('data-animation') : 'none';
11416                        var gridStyle = $that.attr('data-style');
11417
11418                        // Give each post an animated class.
11419                        if ($that.find('.nectar-post-grid__reveal-image__inner').length > 0) {
11420                            $that.find('.nectar-post-grid__reveal-image__inner').css({
11421                                opacity: 0
11422                            });
11423                        }
11424
11425
11426                        $that.find('.nectar-post-grid-filters').addClass('animated-in');
11427                        $that.find('.nectar-post-grid-item').each(function (i) {
11428
11429                            var $item = $(this);
11430
11431                            setTimeout(function () {
11432
11433                                $item.addClass('animated-in');
11434
11435                                if (animation === 'zoom-out-reveal') {
11436
11437                                    splitLineHeadingTrigger($item, function () {
11438                                        splitLineHeadingRemoveMarkup($item);
11439                                    });
11440
11441                                }
11442
11443                            }, i * animationTiming);
11444
11445                        });
11446
11447                        setTimeout(function () {
11448                            $that.addClass('finished-animating');
11449                        }, 950);
11450
11451
11452                        waypoint.destroy();
11453
11454                    },
11455                    offset: postGridOffsetPos
11456                });
11457
11458        });
11459
11460    }
11461
11462
11463    /**
11464     * Animated title element initialization.
11465     *
11466     * @since 7.0
11467     * @see waypoints
11468     */
11469    function animatedTitles() {
11470
11471        var $animatedTitlesOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : 'bottom-in-view';
11472
11473        $($fullscreenSelector + '.nectar-animated-title').each(function () {
11474
11475            var $that = $(this),
11476                waypoint = new Waypoint({
11477              
11477      element: $that[0],
11478                    handler: function () {
11479
11480                        if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) {
11481                            waypoint.destroy();
11482                            return;
11483                        }
11484
11485                        $that.addClass('completed');
11486
11487                        waypoint.destroy();
11488
11489                    },
11490                    offset: $animatedTitlesOffsetPos
11491                });
11492
11493        });
11494    }
11495
11496
11497    /**
11498     * Highlighted Text element initialization.
11499     *
11500     * @since 9.0
11501     * @see waypoints
11502     */
11503    function highlightedText() {
11504
11505        var $highlightedTextOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : 'bottom-in-view';
11506
11507        if (nectarDOMInfo.usingMobileBrowser && $highlightedTextOffsetPos == 'bottom-in-view') {
11508            $highlightedTextOffsetPos = '85%';
11509        }
11510
11511        $($fullscreenSelector + '.nectar-highlighted-text').each(function (i) {
11512
11513            var $animationDelay = 0;
11514
11515            // convert italics to em.
11516            $(this).find('i').each(function () {
11517                $(this).replaceWith(function () {
11518                    return $('<em />').append($(this).html());
11519                });
11520            });
11521
11522            // add ids
11523            if ($(this).is('[data-id]')) {
11524                var $that = $(this);
11525                $(this).find('em').each(function (i) {
11526                    if (i > 0) {
11527                        $(this).attr('id', $that.attr('data-id') + '-' + i);
11528                    } else {
11529                        $(this).attr('id', $that.attr('data-id'));
11530                    }
11531                });
11532            }
11533
11534            if ($(this).is('[data-animation-delay]') &&
11535                $(this).attr('data-animation-delay').length > 0 &&
11536                $(this).attr('data-animation') != 'false') {
11537                $animationDelay = $(this).attr('data-animation-delay');
11538            }
11539
11540            $(this).find('em:has(a)').addClass('has-link');
11541
11542            if (bypassAnimations) {
11543                $(this).find('em').addClass('animated');
11544            }
11545
11546            // Waypoint
11547            if ($(this).is('[data-style="none"]')) {
11548                return true;
11549            }
11550
11551            var $that = $(this);
11552            var waypoint = new Waypoint({
11553                element: $that[0],
11554                handler: function () {
11555
11556                    if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated')) {
11557                        waypoint.destroy();
11558                        return;
11559                    }
11560
11561                    setTimeout(function () {
11562
11563                        $that.find('em').each(function (i) {
11564                            var $highlighted_em = $(this);
11565                            setTimeout(function () {
11566                                $highlighted_em.addClass('animated');
11567                            }, i * 300);
11568
11569                        });
11570
11571                    }, $animationDelay);
11572
11573                    waypoint.destroy();
11574
11575                },
11576                offset: $highlightedTextOffsetPos
11577            });
11578
11579        });
11580
11581    }
11582
11583
11584    /**
11585     * WooCommerce product carousel.
11586     *
11587     * @since 13.0
11588     * @see waypoints
11589     */
11590    function wooProductCarouselAnimations() {
11591
11592        var $wooProductOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : '75%';
11593
11594        $($fullscreenSelector + '.nectar-woo-flickity[data-animation*="fade-in"]').each(function () {
11595
11596            var $that = $(this),
11597                waypoint = new Waypoint({
11598                    element: $that[0],
11599                    handler: function () {
11600
11601                        if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) {
11602                            waypoint.destroy();
11603                            return;
11604                        }
11605
11606                        $that.addClass('animated-in');
11607
11608
11609                        $that.find('.flickity-cell').each(function (i) {
11610                            var $el = $(this);
11611
11612                            setTimeout(function () {
11613                                $el.find('> .product').css({
11614                                    'transform': 'translate3d(0,
116140,0)',
11615                                    'opacity': '1'
11616                                });
11617                            }, i * 100);
11618                        });
11619
11620
11621                        waypoint.destroy();
11622
11623                    },
11624                    offset: $wooProductOffsetPos
11625                });
11626
11627        });
11628    }
11629
11630
11631    /**
11632     * Pricing table element height calculations.
11633     *
11634     * @since 2.0
11635     */
11636    function pricingTableHeight() {
11637
11638        var $tallestCol;
11639
11640        $('.pricing-table[data-style="default"]').each(function () {
11641            $tallestCol = 0;
11642
11643            $(this).find('> div ul').each(function () {
11644
11645                if ($(this).height() > $tallestCol) {
11646                    $tallestCol = $(this).height();
11647                }
11648
11649            });
11650
11651            //safety net incase pricing tables height couldn't be determined
11652            if ($tallestCol == 0) {
11653                $tallestCol = 'auto';
11654            }
11655
11656            //set even height
11657            $(this).find('> div ul').css('height', $tallestCol);
11658
11659        });
11660    }
11661
11662
11663    /**
11664     * Testimonial slider element initialization.
11665     *
11666     * @since 10.5
11667     */
11668    function nectarTestimonialSliders() {
11669
11670        $testimonialSliders = [];
11671
11672        if (typeof NectarTestimonialSlider !== 'undefined') {
11673
11674            $('.testimonial_slider').each(function (i) {
11675
11676                var $that_el = $(this),
11677                    $type = ($(this).is('[data-style]')) ? $(this).attr('data-style') : 'none';
11678
11679                $testimonialSliders[i] = new NectarTestimonialSlider($that_el, $type, resizeVideoToCover, fullWidthContentColumns);
11680
11681
11682                if ($(this).is('.disable-height-animation:not([data-style*="multiple_visible"])')) {
11683                    $testimonialSliders[i].testimonialSliderHeight();
11684                    setTimeout($testimonialSliders[i].testimonialSliderHeight.bind($testimonialSliders[i]), 700);
11685                }
11686
11687                if ($(this).is('.testimonial_slider[data-style="multiple_visible_minimal"]')) {
11688                    $testimonialSliders[i].testimonialSliderHeightMinimalMult();
11689
11690                }
11691
11692            });
11693        } else {
11694            nectarScriptLoadedCallback('#nectar-testimonial-sliders-js', 0, nectarTestimonialSliders);
11695        }
11696
11697
11698    }
11699
11700
11701    /**
11702     * Testimonial slider element resize binding.
11703     *
11704     * @since 10.5
11705     */
11706    function nectarTestimonialSlidersEvents() {
11707
11708        $window.off('smartresize.nectarTestimonials');
11709        $window.off('resize.nectarTestimonialsMin');
11710
11711        if ($testimonialSliders.length > 0) {
11712            $window.on('smartresize.nectarTestimonials', nectarTestimonialMainResize);
11713        }
11714
11715        if ($('.testimonial_slider[data-style="multiple_visible_minimal"]').length > 0) {
11716            $window.on('resize.nectarTestimonialsMin', nectarTestimonialMiniamlResize);
11717        }
11718
11719    }
11720
11721    function nectarTestimonialMainResize() {
11722        for (var i = 0; i < $testimonialSliders.length; i++) {
11723            $testimonialSliders[i].testimonialSliderHeight();
11724            $testimonialSliders[i].testimonialHeightResize();
11725        }
11726    }
11727
11728    function nectarTestimonialMiniamlResize() {
11729        for (var i = 0; i < $testimonialSliders.length; i++) {
11730            $testimonialSliders[i].testimonialSliderHeightMinimalMult();
11731        }
11732    }
11733
11734
11735    /**
11736     * Icon list element initialization.
11737     *
11738     * @since 6.0
11739     * @see waypoints
11740     */
11741    function iconList() {
11742
11743        var $iconListOffsetPos = ($fullscreenMarkupBool == true) ? '250%' : '75%';
11744
11745        $($fullscreenSelector + '.nectar-icon-list[data-animate="true"]').each(function () {
11746
11747            var $that = $(this),
11748                waypoint = new Waypoint({
11749                    element: $that[0],
11750                    handler: function () {
11751
11752                        if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) {
11753                            waypoint.destroy();
11754                            return;
11755                        }
11756
11757                        $that.each(function () {
11758
11759                            var $listItemAnimationDelay = ($that.is('[data-direction="horizontal"]')) ? 100 : 300;
11760
11761                            $(this).find('.nectar-icon-list-item').each(function (i) {
11762                                var $thatt = $(this);
11763                                setTimeout(function () {
11764                                    $thatt.addClass('animated');
11765                                }, i * $listItemAnimationDelay);
11766                            });
11767
11768                        });
11769
11770                        $that.addClass('completed');
11771
11772                        waypoint.destroy();
11773
11774                    },
11775                    offset: $iconListOffsetPos
11776                });
11777
11778        });
11779    }
11780
11781
11782    /**
11783     * Get the BG color of parent column/row.
11784     *
11785     * @since 6.0
11786     */
11787    function narrowParentBGC(element) {
11788
11789        var narrowedBGC;
11790
11791        if (element.parents('.wpb_column[data-bg-color*="#"]').length > 0 && element.parents('.wpb_column[data-bg-opacity="1"]').length > 0) {
11792            narrowedBGC = element.parents('.wpb_column').attr('data-bg-color');
11793        } else if (element.parents('.wpb_row').length > 0 && element.parents('.wpb_row').find('.row-bg.using-bg-color').length > 0 ||
11794            element.parents('.wpb_row').length > 0 && element.parents('.wpb_row').find('.row-bg.using-bg-color-excluded').length > 0) {
11795            narrowedBGC = element.parents('.wpb_row').find('.row-bg').css('background-color');
11796        } else {
11797            if ($('#nectar_fullscreen_rows').length > 0) {
11798                narrowedBGC = $('#nectar_fullscreen_rows > .wpb_row .full-page-inner-wrap').css('background-color');
11799            } else {
11800                narrowedBGC = $('.container-wrap').css('background-color');
11801            }
11802        }
11803
11804        return narrowedBGC;
11805
11806    }
11807
11808
11809    /**
11810     * Icon BG matching row BG
11811     *
11812     * @since 6.0
11813     */
11814    function nectarIconMatchColoring() {
11815
11816        var nectarMatchingBGCss = '';
11817
11818        // Icon list
11819        $('.nectar-icon-list[data-icon-style="border"], .nectar_icon_wrap[data-style="border-animation"][data-color*="extra-color-gradient-"]').each(function (i) {
11820
11821            var $bgColorToSet = narrowParentBGC($(this));
11822
11823            if ($(this).hasClass('nectar-icon-list')) {
11824                $(this).find('.list-icon-holder').css('background-color', $bgColorToSet);
11825            } else {
11826
11827                $(this).removeClass(function (index, className) {
11828                    return (className.match(/(^|\s)instance-\S+/g) || []).join(' ');
11829                });
11830
11831                $(this).addClass('instance-' + i);
11832                nectarMatchingBGCss += '.nectar_icon_wrap.instance-' + i + ' .nectar_icon:before { background-color: ' + $bgColorToSet + '!important; }';
11833            }
11834
11835        });
11836
11837        // Material gradient btns
11838        $('body.material .nectar-button.see-through[class*="m-extra-color-gradient"]').each(function (i) {
11839
11840            var $bgColorToSet = narrowParentBGC($(this));
11841
11842            $(this).removeClass(function (index, className) {
11843                return (className.match(/(^|\s)instance-\S+/g) || []).join(' ');
11844            });
11845
11846            $(this).addClass('instance-' + i);
11847            nectarMatchingBGCss += '.nectar-button.see-through.instance-' + i + ':after { background-color: ' + $bgColorToSet + '!important; }';
11848
11849        });
11850
11851        // Style
11852        nectarCreateStyle(nectarMatchingBGCss, 'nectaricon-color-match');
11853
11854    }
11855
11856
11857    /**
11858     * One fourth column classes.
11859     *
11860     * @since 2.0
11861     */
11862    function oneFourthClasses() {
11863
11864        $('.col.span_3, .vc_span3, .vc_col-sm-3').each(function () {
11865            if (!$(this).is('[data-t-w-inherits="small_desktop"]')) {
11866
11867                var $currentDiv = $(this);
11868                var $nextDiv = $(this).next('div');
11869
11870                if ($nextDiv.hasClass('span_3') && !$currentDiv.hasClass('one-fourths') ||
11871                    $nextDiv.hasClass('vc_span3') && !$currentDiv.hasClass('one-fourths') ||
11872                    $nextDiv.hasClass('vc_col-sm-3') && !$currentDiv.hasClass('one-fourths')) {
11873                    $currentDiv.addClass('one-fourths clear-both');
11874                    $nextDiv.addClass('one-fourths right-edge');
11875                }
11876            }
11877        });
11878
11879        // Make empty second 1/2 half columns display right on iPad
11880        $('.span_12 .col.span_6').each(function () {
11881            if ($(this).next('div').hasClass('span_6') && $.trim($(this).next('div').html()).length == 0) {
11882                $(this).addClass('empty-second');
11883            }
11884        });
11885
11886    }
11887
11888
11889    /**
11890     * Responsive video iframes initialization.
11891     *
11892     * @since 3.0
11893     */
11894    function responsiveVideoIframesInit() {
11895
11896        $('iframe').each(function () {
11897
11898            // Make sure the iframe has a src
11899            if (typeof $(this).attr('src') != 'undefined' &&
11900                !$(this).hasClass('skip-nectar-video-size') &&
11901                !$(this).hasClass('iframe-embed') &&
11902                !$(this).hasClass('elementor-video-iframe') &&
11903                $(this).parents('.gform_fields').length == 0 &&
11904                $(this).parents('.ult_modal').length == 0 &&
11905                $(this).parents('.ls-slide').length == 0 &&
11906                $(this).parents('.woo-variation-product-gallery').length == 0 &&
11907                $(this).parents('.esg-entry-media').length == 0 &&
11908                $(this).parents('.wpb_video_widget.wpb_content_element').length == 0) {
11909
11910                if ($(this).parents('.woocommerce-product-gallery').length > 0) {
11911                    if (!$(this).is('[width="100%"]') || !$(this).is('[height="100%"]')) {
11912                        return true;
11913                    }
11914                }
11915
11916                var embedSrcLower = $(this).attr('src').toLowerCase();
11917
11918                if (embedSrcLower.indexOf("youtube") >= 0 ||
11919                    embedSrcLower.indexOf("vimeo") >= 0 ||
11920                    embedSrcLower.indexOf("twitch.tv") >= 0 ||
11921                    embedSrcLower.indexOf("kickstarter") >= 0 ||
11922                    embedSrcLower.indexOf("embed-ssl.ted") >= 0 ||
11923                    embedSrcLower.indexOf("dailymotion") >= 0) {
11924
11925                    $(this).addClass('iframe-embed');
11926
11927                    if ($(this).width() < $(this).parent().width()) {
11928                        $(this)
11929                            .attr('data-aspectRatio', $(this).height() / $(this).width())
11930                            .removeAttr('height')
11931                            .removeAttr('width');
11932                    } else {
11933                        $(this)
11934                            .attr('data-aspectRatio', '0.56')
11935                            .removeAttr('height')
11936                            .removeAttr('width');
11937                    }
11938
11939                    if ($(this).parents('.post-area.masonry.classic').length > 0) {
11940                        $(this)
11941                            .attr('data-aspectRatio', '0.56')
11942                            .removeAttr('height')
11943                            .removeAttr('width');
11944                    }
11945
11946                }
11947
11948            }
11949
11950        });
11951
11952    }
11953
11954
11955    /**
11956     * Responsive video iframes.
11957     *
11958     * @since 3.0
11959     */
11960    function responsiveVideoIframes() {
11961
11962        $('iframe[data-aspectRatio]').each(function () {
11963
11964            var $el = $(this),
11965                newWidth = $el.parent().width();
11966
11967            // In nectar slider
11968            if ($(this).parents('.swiper-slide').length > 0) {
11969                if ($(this).is(':visible')) {
11970                    $el
11971                        .width(newWidth)
11972                        .height(newWidth * $el.attr('data-aspectRatio'));
11973                }
11974            }
11975            // All others
11976            else {
11977                $el
11978                    .width(newWidth)
11979                    .height(newWidth * $el.attr('data-aspectRatio'));
11980            }
11981
11982        });
11983
11984    }
11985
11986
11987    /**
11988     * Reveal the audio/video elements after the size has been calculated.
11989     *
11990     * @since 10.5
11991     */
11992    function audioVideoVis() {
11993
11994        //unwrap post and portfolio videos
11995        $('.video-wrap iframe').unwrap();
11996        $('#sidebar iframe[src]').unwrap();
11997
11998        $('audio')
11999            .attr('width', '100%')
12000            .attr('height', '100%')
12001            .css('visibility', 'visible');
12002
12003        $('video').css('visibility', 'visible');
12004
12005        $('.wp-video').each(function () {
12006            var video = $(this).find('video').get(0);
12007            video.addEventListener('loadeddata', function () {
12008                $window.trigger('resize');
12009            }, false);
12010        });
12011
12012        //webkit video back button fix
12013        $('.main-content iframe[src]').each(function () {
12014            $(this).css({
12015                'opacity': '1',
12016                'visibility': 'visible'
12017            });
12018        });
12019
12020    }
12021
12022
12023    /**
12024     * Nectar video background size calculations
12025     *
12026     * @since 5.0
12027     */
12028    function resizeVideoToCover() {
12029
12030
12031        $('.nectar-video-wrap').each(function () {
12032
12033            // Add loaded class
12034            $(this).addClass('position-loaded');
12035        });
12036
12037    }
12038
12039
12040    /**
12041     * Nectar video background initialization.
12042     *
12043     * @since 5.0
12044     */
12045    function videoBGInit() {
12046
12047        if ($('.nectar-video-wrap').length == 0 && $('.nectar-youtube-bg').length == 0) {
12048            return;
12049        }
12050
12051        setTimeout(function () {
12052
12053            $('.video-color-overlay').each(function () {
12054                $(this).css('background-color', $(this).attr('data-color'));
12055            });
12056
12057            $('.nectar-video-wrap').each(function () {
12058
12059                if ($(this).find('video').length == 0) {
12060                    return;
12061                }
12062
12063                var $headerVideo = ($(this).parents('#page-header-bg').length > 0) ? true : false;
12064                var $that = $(this);
12065
12066                if ($(this).find('video.nectar-lazy-video').length === 0) {
12067                    var videoReady = setInterval(function () {
12068
12069                        if ($that.find('video').get(0).readyState > 3) {
12070
12071                            if (!nectarDOMInfo.usingMobileBrowser) {
12072                                $that.transition({
12073                                    'opacity': '1'
12074                                }, 400);
12075                                $that.find('video').transition({
12076                                    'opacity': '1'
12077                                }, 400);
12078                                $that.parent().find('.video-color-overlay').transition({
12079                                    'opacity': '0.7'
12080                                }, 400);
12081                                if ($headerVideo == true) {
12082                                    pageHeaderTextEffect();
12083                                }
12084                            }
12085
12086                            // Remove page loading screen
12087                            $loadingScreenEl.addClass('loaded');
12088                            setTimeout(function () {
12089                                $loadingScreenEl.addClass('hidden');
12090                            }, 1000);
12091
12092
12093                            clearInterval(videoReady);
12094                        }
12095
12096                    }, 60);
12097                } else {
12098                    if ($headerVideo == true) {
12099                        pageHeaderTextEffect();
12100                    }
12101                }
12102
12103                if (nectarDOMInfo.usingMobileBrowser) {
12104
12105                    if ($that.parents('.full-width-section').length > 0 &&
12106                        $that.parents('#nectar_fullscreen_rows').length == 0 &&
12107                        !$that.hasClass('column-video')) {
12108
12109                        $that.css('left', '50%');
12110                    } else {
12111                        $that.css('left', '0px');
12112                    }
12113
12114                    if ($headerVideo == true) {
12115                        pageHeaderTextEffect();
12116                    }
12117
12118                    $that.find('video')[0].onplay = function () {
12119                        $that.transition({
12120                            'opacity': '1'
12121                        }, 400);
12122                        $that.find('video').transition({
12123                            'opacity': '1'
12124                        }, 400);
12125                        $that.parent().find('.video-color-overlay').transition({
12126                            'opacity': '0.7'
12127                        }, 400);
12128                    };
12129
12130                } // end mobile only
12131
12132            });
12133        }, 300);
12134
12135
12136        if (nectarDOMInfo.usingMobileBrowser) {
12137
12138            $('.nectar-video-wrap').each(function () {
12139
12140                if (!$(this).find('video').is('[muted]')) {
12141
12142                    // Autoplay not supported unless muted
12143                    $(this).parent().find('.mobile-video-image').show();
12144                    $(this).remove();
12145                }
12146
12147            });
12148
12149        }
12150
12151
12152        $('.wpb_row:has(".nectar-video-wrap"):not(.fp-section)').each(function (i) {
12153            $(this).css('z-index', 100 + i);
12154        });
12155
12156
12157        $(".vc_row").each(function () {
12158            var youtubeUrl, youtubeId, $row = jQuery(this);
12159            $row.find('.nectar-youtube-bg').length > 0 ? (youtubeUrl = $row.find('.nectar-youtube-bg span').text(), youtubeId = nectarExtractYoutubeId(youtubeUrl), youtubeId && ($row.find(".vc_video-bg--nectar").remove(), nectarInsertYoutubeVideoAsBackground($row.find('.nectar-youtube-bg'), youtubeId))) : $row.find(".nectar-youtube-bg").remove();
12160
12161            // Remove yt url
12162            $row.find('.nectar-youtube-bg span').remove();
12163
12164            if (!nectarDOMInfo.usingMobileBrowser) {
12165                $row.find('.nectar-video-wrap, .nectar-youtube-bg').css({
12166                    'opacity': '1',
12167                    'width': '100%',
12168                    'height': '100%'
12169                });
12170            }
12171            $row.find('.video-color-overlay').transition({
12172                'opacity': '0.7'
12173            }, 400);
12174        });
12175
12176
12177        function nectarInsertYoutubeVideoAsBackground($element, youtubeId, counter) {
12178            if ("undefined" == typeof YT || void 0 === YT.Player) return 100 < (counter = void 0 === counter ? 0 : counter) ? void console.warn("Too many attempts to load YouTube api") : void setTimeout(function () {
12179                nectarInsertYoutubeVideoAsBackground($element, youtubeId, counter++)
12180            }, 100);
12181            var $container = $element.prepend('<div class="vc_video-bg--nectar"><div class="inner"></div></div>').find(".inner");
12182            var ytPlayer;
12183            ytPlayer = new YT.Player($container[0], {
12184                width: "100%",
12185                height: "100%",
12186                videoId: youtubeId,
12187                playerVars: {
12188                    playlist: youtubeId,
12189                    iv_load_policy: 3,
12190                    enablejsapi: 1,
12191                    disablekb: 1,
12192                    autoplay: 1,
12193                    controls: 0,
12194                    showinfo: 0,
12195                    rel: 0,
12196                    loop: 1
12197                },
12198                events: {
12199                    onStateChange: function (e) {
12200                        if (e.data === -1) {
12201                            ytPlayer.mute();
12202                            ytPlayer.playVideo();
12203                        }
12204                    },
12205                    onReady: function (event) {
12206                        ytPlayer.mute();
12207                        ytPlayer.playVideo();
12208                        nectarResizeVideoBackground($element);
12209                    }
12210                }
12211            }), nectarResizeVideoBackground($element), jQuery(window).on("resize", function () {
12212                nectarResizeVideoBackground($element);
12213            });
12214
12215            setTimeout(function () {
12216                nectarResizeVideoBackground($element);
12217            }, 100);
12218        }
12219
12220        function nectarResizeVideoBackground($element) {
12221            var iframeW, iframeH, marginLeft, marginTop, containerW = $element.innerWidth(),
12222                containerH = $element.innerHeight(),
12223                ratio1 = 16,
12224                ratio2 = 9;
12225            ratio1 / ratio2 > containerW / containerH ? (iframeW = containerH * (ratio1 / ratio2),
12226                iframeH = containerH, marginLeft = -Math.round((iframeW - containerW) / 2) + "px", marginTop = -Math.round((iframeH - containerH) / 2) + "px", iframeW += "px", iframeH += "px") : (iframeW = containerW, iframeH = containerW * (ratio2 / ratio1), marginTop = -Math.round((iframeH - containerH) / 2) + "px",
12227                marginLeft = -Math.round((iframeW - containerW) / 2) + "px", iframeW += "px", iframeH += "px"),
12228                $element.find(".vc_video-bg--nectar iframe").css({
12229                    maxWidth: "1000%",
12230                    marginLeft: marginLeft,
12231                    marginTop: marginTop,
12232                    width: iframeW,
12233                    height: iframeH
12234                });
12235        }
12236
12237        function nectarExtractYoutubeId(url) {
12238
12239            if ("undefined" == typeof url) {
12240                return !1;
12241            }
12242
12243            var id = url.match(/(?:https?:\/{2})?(?:w{3}\.)?youtu(?:be)?\.(?:com|be)(?:\/watch\?v=|\/)([^\s&]+)/);
12244            return null !== id ? id[1] : !1
12245        }
12246
12247
12248    }
12249
12250
12251    /**
12252     * Single Blog Posts
12253     *
12254     * @since 11.0
12255     */
12256    function blogSingle() {
12257
12258        // Remove first gallery on post when using the gallery slider option.
12259        if ($body.hasClass('single-post') && $('.content-inner[data-has-gallery]').length > 0) {
12260
12261
12262            if ($('.wp-block-gallery').length > 0) {
12263                // Gutenberg.
12264                $('.content-inner').find('.wp-block-gallery').each(function (i) {
12265                    if (i !== 0) {
12266                        $(this).css('display', 'flex');
12267                    }
12268                });
12269
12270            } else {
12271                // Classic Editor.
12272                $('.content-inner').find('.gallery').each(function (i) {
12273                    if (i !== 0) {
12274                        $(this).css('display', 'block');
12275                    }
12276                });
12277
12278            }
12279
12280        } // If using gallery slider on single conditional end.
12281
12282        // Social sharing waypoint
12283        if ($body.hasClass('single-post') && $('.nectar-social.vertical').length > 0) {
12284
12285            var $el = $('.nectar-social.vertical');
12286            var waypoint = new Waypoint({
12287                element: $('.post-area')[0],
12288                handler: function (direction) {
12289
12290                    if (nectarState.materialOffCanvasOpen) {
12291                        return;
12292                    }
12293
12294                    if (direction === 'down') {
12295                        $el.addClass('visible');
12296                    } else {
12297                        $el.removeClass('visible');
12298                    }
12299
12300
12301                },
12302                offset: '70%'
12303
12304            });
12305        }
12306
12307    }
12308
12309
12310    /*-------------------------------------------------------------------------*/
12311
12312    /*	Header + Search
12313				/*-------------------------------------------------------------------------*/
12314
12315    /**
12316     * Correct megamenus in mobile navigation.
12317     *
12318     * @since 8.0
12319     */
12320    function mobileNavMegamenuCorrect() {
12321
12322        ////mobile megamenus without titles / nested groupings
12323        var $mobileNavSelector = ($('#top #mobile-menu').length > 0) ? '#top #mobile-menu ' : '.off-canvas-menu-container.mobile-only ';
12324
12325        $($mobileNavSelector + '.menu-item > ul > li > a').each(function () {
12326
12327            if ($(this).text() == '-' || $(this).text() == '–' || $(this).parent().hasClass('hide-title') || $(this).find('> .remove-menu-item-title').length > 0) {
12328
12329                var $navLIs = $(this).parent().find('> ul > li:not(.back)').clone();
12330                // column has widget
12331                if ($(this).parent().find('> .widget-area-active').length > 0) {
12332                    $(this).parent().find('> a').remove();
12333                } else {
12334
12335                    $(this).parent().find('ul').remove();
12336                    $(this).parent().parent().append($navLIs);
12337                    $(this).parent().remove();
12338                }
12339
12340            }
12341        });
12342
12343    }
12344
12345
12346    /**
12347     * Material theme skin off canvas menu initialization.
12348     *
12349     * @since 10.5
12350     */
12351    function materialSkinOCM_Init() {
12352
12353        if ($('body.material[data-slide-out-widget-area-style="slide-out-from-right"]').length > 0) {
12354            OCM_materialWidth();
12355
12356            if ($wpAdminBar.length > 0) {
12357                var $topToolBar = $wpAdminBar.detach();
12358                $('.ocm-effect-wrap-inner').append($topToolBar);
12359            }
12360
12361
12362        }
12363
12364        OCM_materialIconMarkup();
12365        materialSkinTransition();
12366
12367        $window.on('resize', OCM_materialSize);
12368
12369    }
12370
12371
12372    /**
12373     * Material theme skin transition helper
12374     *
12375     * @since 10.5
12376     */
12377    function materialSkinTransition() {
12378
12379        if ($('body.material[data-header-search="true"]').length > 0 ||
12380            $('body.material .ocm-effect-wrap').length > 0) {
12381
12382            var materialTransTO,
12383                allowMaterialResizeCalc = false,
12384                orientTrack = 0,
12385                $winDOMWidth = nectarDOMInfo.winW,
12386                $winDOMHeight = nectarDOMInfo.winH;
12387
12388            // For mobile make sure the orientation has changed.
12389            window.addEventListener("orientationchange", function () {
12390                orientTrack = 1;
12391            });
12392
12393            // Resize.
12394            $window.on('resize', function () {
12395
12396                if (nectarDOMInfo.usingMobileBrowser) {
12397                    // Mobile.
12398                    if (($window.width() != $winDOMWidth && $window.height != $winDOMHeight) || orientTrack === 1) {
12399
12400                        // Store the current window dimensions.
12401                        $winDOMWidth = nectarDOMInfo.winW;
12402                        $winDOMHeight = nectarDOMInfo.winH;
12403
12404                        // Reset orientation change tracker.
12405                        orientTrack = 0;
12406
12407                        // Set to allow.
12408                        allowMaterialResizeCalc = true;
12409
12410                    }
12411                } else {
12412                    // Desktop always allows.
12413                    allowMaterialResizeCalc = true;
12414                }
12415
12416                if (allowMaterialResizeCalc) {
12417
12418                    clearTimeout(materialTransTO);
12419
12420                    $('body[data-slide-out-widget-area-style="slide-out-from-right"] > .slide_out_area_close__wrap .slide_out_area_close, .material #header-outer, .ocm-effect-wrap, .ocm-effect-wrap-shadow')
12421                        .addClass('no-material-transition');
12422
12423                    materialTransTO = setTimeout(function () {
12424                        $('body[data-slide-out-widget-area-style="slide-out-from-right"] > .slide_out_area_close__wrap .slide_out_area_close, .material #header-outer, .ocm-effect-wrap, .ocm-effect-wrap-shadow')
12425                            .removeClass('no-material-transition');
12426                    }, 250);
12427
12428                    OCM_materialWidth();
12429
12430                    // Reset allow.
12431                    allowMaterialResizeCalc = false;
12432
12433                } // endif for allow.
12434
12435            }); // end resize.
12436
12437        }
12438
12439    }
12440
12441
12442    /**
12443     * Calculate off canvas menu slide out from right on hover
12444     *
12445     * @since 8.0
12446     */
12447    function calculateHoverNavMinHeight() {
12448
12449        var $widgetHeights = 0;
12450        $('#slide-out-widget-area > .widget').each(function () {
12451            $widgetHeights += $(this).height();
12452        });
12453
12454        var $menuHeight;
12455
12456        if (($offCanvasEl.height() - 25 - $('.bottom-meta-wrap').outerHeight(true) - $widgetHeights) > $('#slide-out-widget-area .off-canvas-menu-container:last-child').height()) {
12457            $menuHeight = $offCanvasEl.height() - 25 - $('.bottom-meta-wrap').outerHeight(true) - $widgetHeights;
12458        } else {
12459            $menuHeight = $('#slide-out-widget-area .off-canvas-menu-container:last-child').height();
12460        }
12461
12462        $('#slide-out-widget-area .inner').first().css({
12463            'height': 'auto',
12464            'min-height': $menuHeight
12465        });
12466
12467
12468    }
12469
12470
12471    /**
12472     * Material theme skin off canvas menu width.
12473     *
12474     * @since 8.0
12475     */
12476    function OCM_materialWidth() {
12477
12478        $('#slide-out-widget-area.slide-out-from-right').css({
12479            'padding-top': $window.height() * 0.1,
12480            'padding-bottom': $window.height() * 0.1
12481        });
12482
12483        OCM_overflowState();
12484    }
12485
12486
12487    /**
12488     * Material theme skin off canvas menu icon markup
12489     *
12490     * @since 8.0
12491     */
12492    function OCM_materialIconMarkup() {
12493
12494        if ($('body.material').length >
12494 0 && $('body[data-slide-out-widget-area-style="slide-out-from-right-hover"]').length == 0 ||
12495            $('body.material').length > 0 && bodyBorderVignette === true) {
12496
12497            if ($('#mobile-menu').length == 0) {
12498                var $menuIconClone = $('header#top ul .slide-out-widget-area-toggle:first a > span > i').clone();
12499                $menuIconClone.addClass('hover-effect');
12500                $('header#top ul .slide-out-widget-area-toggle a > span').append($menuIconClone);
12501
12502                var $menuIconClone2 = $('header#top .slide-out-widget-area-toggle.mobile-icon a > span > i').clone();
12503                $menuIconClone2.addClass('hover-effect');
12504                $('header#top .slide-out-widget-area-toggle.mobile-icon a > span').append($menuIconClone2);
12505            }
12506
12507            $('body:not([data-slide-out-widget-area-style="slide-out-from-right"]) header#top .slide-out-widget-area-toggle a > span')
12508                .append($('<span class="close-wrap"> <span class="close-line close-line1"></span> <span class="close-line close-line2"></span> </span>'));
12509
12510            setTimeout(function () {
12511                $('header#top .slide-out-widget-area-toggle a > span .close-wrap').addClass('loaded');
12512            }, 200);
12513
12514        }
12515
12516        if ($('body.material #boxed').length > 0 && $('body[data-slide-out-widget-area-style="slide-out-from-right-hover"]').length > 0 && $('.ocm-effect-wrap').length > 0) {
12517            $('#ajax-content-wrap > .slide-out-widget-area-toggle.slide-out-hover-icon-effect').insertAfter('.ocm-effect-wrap');
12518        }
12519
12520        //move material skin default ocm
12521        if ($('body.material').length > 0 &&
12522            $('body[data-slide-out-widget-area-style*="fullscreen"]').length == 0 &&
12523            $('.ocm-effect-wrap').length > 0) {
12524            $('body.material #slide-out-widget-area.slide-out-from-right .slide_out_area_close').insertAfter('.ocm-effect-wrap');
12525            if ($('body > .slide_out_area_close').length > 0) {
12526                $('body > .slide_out_area_close').wrap('<div class="slide_out_area_close__wrap" role="complementary" aria-label="' + window.nectar_front_i18n.close + '"></div>');
12527            }
12528            $('#slide-out-widget-area-bg').insertAfter('.ocm-effect-wrap');
12529            $offCanvasEl.insertAfter('.ocm-effect-wrap');
12530
12531        }
12532
12533    }
12534
12535
12536    /**
12537     * Material theme skin off canvas menu height
12538     *
12539     * @since 8.0
12540     */
12541    function OCM_materialSize() {
12542        if ($('.ocm-effect-wrap.material-ocm-open').length > 0) {
12543
12544            $('.ocm-effect-wrap').css({
12545                'height': $window.height()
12546            });
12547
12548            $('.ocm-effect-wrap-inner').css({
12549                'padding-top': nectarDOMInfo.adminBarHeight
12550            });
12551
12552        }
12553    }
12554
12555
12556    /**
12557     * Off canvas menu dropdown markup
12558     *
12559     * @since 8.0
12560     */
12561    function OCM_dropdownMarkup() {
12562        var $nectar_ocm_dropdown_func = ($('#slide-out-widget-area[data-dropdown-func]').length > 0) ? $offCanvasEl.attr('data-dropdown-func') : 'default';
12563        if ($nectar_ocm_dropdown_func == 'separate-dropdown-parent-link') {
12564            $('#slide-out-widget-area .off-canvas-menu-container li.menu-item-has-children').append('<span class="ocm-dropdown-arrow"><i class="fa fa-angle-down"></i></span>');
12565        }
12566    }
12567
12568
12569    /**
12570     * Off canvas menu dropdown icon position.
12571     *
12572     * @since 8.0
12573     */
12574    function OCM_dropdownIconPos() {
12575
12576        $('#slide-out-widget-area[class*="slide-out-from-right"] .off-canvas-menu-container li.menu-item-has-children').each(function () {
12577            $(this).find('.ocm-dropdown-arrow').css({
12578                'top': $(this).find('a').height() / 2
12579            });
12580        });
12581        $('#slide-out-widget-area.fullscreen-split .off-canvas-menu-container li.menu-item-has-children').each(function () {
12582            $(this).find('.ocm-dropdown-arrow').css({
12583                'top': $(this).find('a').height() / 2
12584            });
12585        });
12586
12587    }
12588
12589
12590    function OCM_convertExtItems() {
12591
12592        // OCM Remove Ext menu items option.
12593        if (window.nectarOptions &&
12594            window.nectarOptions.ocm_remove_ext_menu_items &&
12595            window.nectarOptions.ocm_remove_ext_menu_items == 'remove_images' &&
12596            nectarState.ocmInit === false) {
12597
12598            $('.off-canvas-menu-container .title[class*="inherit-h"], #mobile-menu .title[class*="inherit-h"]').removeClass(function (index, className) {
12599                return (className.match(/(^|\s)inherit-h\S+/g) || []).join(' ');
12600            });
12601            $('.off-canvas-menu-container .nectar-ext-menu-item .image-layer-outer, #mobile-menu .nectar-ext-menu-item .image-layer-outer').remove();
12602            $('.off-canvas-menu-container .nectar-ext-menu-item .menu-item-desc').removeClass('menu-item-desc').addClass('item_desc');
12603            $('.off-canvas-menu-container .nectar-ext-menu-item .inner-content > .title').each(function () {
12604                if ($(this).find('.menu-title-text').length == 0) {
12605                    $(this).removeClass('title').addClass('menu-title-text');
12606                }
12607            });
12608
12609            // Desc class for OCM for added submenu spacing
12610            $('.off-canvas-menu-container .item_desc').each(function () {
12611
12612                if ($(this).css('display') !== 'none') {
12613                    var $parent = $(this).parents('.menu-item');
12614                    $parent.addClass('nectar-extra-menu-item-spacing');
12615                }
12616
12617            });
12618
12619            // Dropdown icon position.
12620            OCM_dropdownIconPos();
12621
12622            nectarState.ocmInit = true;
12623
12624        }
12625
12626    }
12627
12628
12629    /**
12630     * Off canvas menu overflow scrolling.
12631     *
12632     * @since 8.0
12633     */
12634    function OCM_overflowState() {
12635
12636        //switch position of social media/extra info based on screen size
12637        if (nectarDOMInfo.winW < 1000 ||
12638            $('body > #boxed').length > 0 ||
12639            $('.ocm-effect-wrap-inner > #boxed').length > 0) {
12640
12641            $('#slide-out-widget-area.fullscreen .off-canvas-social-links, #slide-out-widget-area.fullscreen-alt .off-canvas-social-links').appendTo('#slide-out-widget-area .inner-wrap > .inner');
12642            $('#slide-out-widget-area.fullscreen .bottom-text, #slide-out-widget-area.fullscreen-alt .bottom-text').appendTo('#slide-out-widget-area .inner-wrap > .inner');
12643
12644        } else {
12645            $('#slide-out-widget-area.fullscreen .off-canvas-social-links,#slide-out-widget-area.fullscreen-alt .off-canvas-social-links').appendTo('#slide-out-widget-area .inner-wrap');
12646            $('#slide-out-widget-area.fullscreen .bottom-text, #slide-out-widget-area.fullscreen-alt .bottom-text').appendTo('#slide-out-widget-area .inner-wrap');
12647        }
12648
12649
12650        //close mobile only slide out widget area if switching back to desktop
12651        if ($('.slide-out-from-right.open .off-canvas-menu-container.mobile-only').length > 0 && $('body.mobile').length == 0) {
12652            $('#slide-out-widget-area .slide_out_area_close').trigger('click');
12653        }
12654
12655        //sizing for dropdown
12656        OCM_dropdownIconPos();
12657
12658    }
12659
12660
12661    /**
12662     * Off canvas menu: slide out from right hover open.
12663     *
12664     * @since 10.5
12665     */
12666    function OCM_slideOutRightHoverOpen() {
12667
12668        calculateHoverNavMinHeight();
12669
12670        if ((nectarDOMInfo.usingMobileBrowser || nectarDOMInfo.usingIOS || nectarDOMInfo.usingTouchDevice) && $('#slide-out-widget-area.open').length > 0 ||
12671            $('.slide-out-from-right-hover.ios-ocm-style').length > 0 && $('#slide-out-widget-area.open').length > 0) {
12672            OCM_mobileSlideOutRightHoverCloseCheck();
12673            return false;
12674        }
12675
12676        if ((nectarDOMInfo.usingMobileBrowser || nectarDOMInfo.usingIOS || nectarDOMInfo.usingTouchDevice) || $('.slide-out-from-right-hover.ios-ocm-style').length > 0) {
12677            $('.slide-out-widget-area-toggle a').attr('aria-expanded', 'true');
12678            $offCanvasBG.css({
12679                'height': '100%',
12680                'width': '100%'
12681            });
12682        }
12683
12684        $offCanvasEl.css({
12685            'transform': 'translate3d(0,0,0)'
12686        }).addClass('open');
12687
12688        OCM_convertExtItems();
12689
12690        if ($('.slide-out-from-right-hover.ios-ocm-style').length > 0) {
12691            $('#ajax-content-wrap').addClass('ios-ocm-style-open');
12692            setTimeout(function () {
12693                $('#slide-out-widget-area .slide_out_area_close').addClass('material-ocm-open');
12694                $('#slide-out-widget-area .slide_out_area_close').removeClass('hide_until_rendered');
12695            }, 350);
12696        }
12697
12698        var withinCustomBreakpoint = mobileBreakPointCheck();
12699        if (nectarDOMInfo.winW < 1000) {
12700            withinCustomBreakpoint = true;
12701        }
12702        var alignmentPosition = (window.nectarOptions && window.nectarOptions.mobile_header_format && window.nectarOptions.mobile_header_format === 'centered-menu' && withinCustomBreakpoint) ? 'left' : 'right';
12703
12704        // Icon effect
12705        // Set position
12706        if ($('header#top .container .span_9 > .slide-out-widget-area-toggle').length > 0) {
12707
12708            var $hIconEl = $('.slide-out-hover-icon-effect'),
12709                secondaryBarHeight = nectarDOMInfo.secondaryHeaderHeight;
12710
12711            var $nectarHamMenuPos;
12712            var $withinCustomBreakpoint = mobileBreakPointCheck();
12713            if ($('#header-outer[data-format="centered-menu-bottom-bar"]').length > 0) {
12714                $withinCustomBreakpoint = false;
12715            }
12716
12717            if ($('body.mobile').length > 0 || $withinCustomBreakpoint || headerOCMButtonPos === 'left') {
12718
12719                if ($('.left-aligned-ocm').length > 0 && $('.left-aligned-ocm').css('display') != 'none') {
12720
12721                    $hIconEl.css({
12722                        'top': $('header#top .left-aligned-ocm .slide-out-widget-area-toggle a').offset().top - nectarDOMInfo.scrollTop
12723                    });
12724                } else {
12725                    $hIconEl.css({
12726                        'top': $('header#top .span_9 > .slide-out-widget-area-toggle a').offset().top - nectarDOMInfo.scrollTop
12727                    });
12728                }
12729
12730                if (alignmentPosition === 'left' || headerOCMButtonPos === 'left') {
12731                    $hIconEl.css({
12732                        'left': parseInt($('#header-outer header > .container').css('padding-right')) + 1,
12733                        'right': ''
12734                    });
12735                } else {
12736                    $hIconEl.css({
12737                        'right': parseInt($('#header-outer header > .container').css('padding-right')) + 1,
12738                        'left': ''
12739                    });
12740                }
12741
12742            } else {
12743
12744                if ($bodyBorderHeaderColorMatch) {
12745
12746                    var $extraCushion = ($('#header-outer[data-has-menu="false"]').length > 0) ? 2 : 1;
12747                    $hIconEl.css({
12748                        'top': nectarDOMInfo.adminBarHeight + secondaryBarHeight + parseInt($('header#top nav >ul .slide-out-widget-area-toggle a').css('padding-top')),
12749                        'right': 29 + $extraCushion
12750                    });
12751
12752                } else {
12753
12754                    if ($('#header-outer[data-format="centered-menu-bottom-bar"]').length > 0) {
12755                        $nectarHamMenuPos = ($('header#top .span_9 > .slide-out-widget-area-toggle').css('display') == 'flex') ? $('header#top .span_9 > .slide-out-widget-area-toggle.mobile-icon a').offset() : $('header#top .span_3 .right-side .slide-out-widget-area-toggle > div').offset();
12756
12757                        if ($('#top .span_3 .slide-out-widget-area-toggle.mobile-icon').css('display') == 'flex') {
12758                            $nectarHamMenuPos = $('#top .span_3 .slide-out-widget-area-toggle.mobile-icon a').offset();
12759                        }
12760
12761                        $hIconEl.css({
12762                            'top': parseInt($nectarHamMenuPos.top) - nectarDOMInfo.scrollTop,
12763                            'right': parseInt($('#header-outer header >.container').css('padding-right')) + 2,
12764                            'left': ''
12765                        });
12766                    } else {
12767
12768                        if ($body.hasClass('ascend')) {
12769                            $nectarHamMenuPos = ($('header#top .span_9 > .slide-out-widget-area-toggle').css('display') == 'block') ? $('header#top .span_9 > .slide-out-widget-area-toggle.mobile-icon').position() : $('header#top nav .buttons .slide-out-widget-area-toggle > div a > span:not(.screen-reader-text)').position();
12770                        } else {
12771                            $nectarHamMenuPos = ($('header#top .span_9 > .slide-out-widget-area-toggle').css('display') == 'block') ? $('header#top .span_9 > .slide-out-widget-area-toggle.mobile-icon').position() : $('header#top nav .buttons .slide-out-widget-area-toggle > div').position();
12772                        }
12773
12774
12775                        if ($('#header-secondary-outer.hide-up').length > 0) {
12776                            secondaryBarHeight = 0;
12777                        }
12778
12779                        $hIconEl.css({
12780                            'top': nectarDOMInfo.adminBarHeight + secondaryBarHeight + parseInt($nectarHamMenuPos.top),
12781                            'right': parseInt($('#header-outer header >.container').css('padding-right')) + 2,
12782                            'left': ''
12783                        });
12784                    }
12785
12786                } // No body border color match.
12787
12788            } //Not on mobile.
12789
12790        }
12791
12792        ////Open
12793        $('.slide-out-hover-icon-effect .lines-button')
12794            .removeClass('no-delay')
12795            .addClass('unhidden-line');
12796
12797        if ($('#header-outer[data-permanent-transparent="1"]').length == 0 &&
12798            $('#nectar_fullscreen_rows').length == 0 &&
12799            !nectarDOMInfo.usingFrontEndEditor &&
12800            nectarDOMInfo.winW > 1000) {
12801
12802            if (!(nectarDOMInfo.scrollTop == 0 && $('#header-outer.transparent').length > 0)) {
12803
12804                if ($('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) {
12805
12806                    $headerOuterEl.attr('data-transparent', 'true').addClass('no-bg-color').addClass('slide-out-hover');
12807                    $('#header-outer header, #header-outer > .cart-outer').addClass('all-hidden');
12808                }
12809
12810            }
12811
12812            if ($('#header-outer[data-remove-fixed="1"]').length == 0 && $('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) {
12813
12814                if (headerResize == true) {
12815
12816                    $window.off('scroll', bigNav);
12817                    $window.off('scroll', smallNav);
12818
12819                } else {
12820                    $window.off('scroll', opaqueCheck);
12821                    $window.off('scroll', transparentCheck);
12822                }
12823            }
12824
12825        }
12826
12827        if (!nectarDOMInfo.usingMobileBrowser) {
12828            $window.on('mousemove.rightOffsetCheck', OCM_slideOutRightHoverCloseCheck);
12829        } else {
12830            return false;
12831        }
12832
12833    }
12834
12835
12836    /**
12837     * Off canvas menu: slide out from right hover close
12838     *
12839     * @since 10.5
12840     */
12841    function OCM_slideOutRightHoverCloseCheck(e) {
12842
12843        var $windowWidth = $window.width();
12844        var $ocmHoverWidth = $offCanvasEl.outerWidth();
12845        var withinCustomBreakpoint = mobileBreakPointCheck();
12846        if (nectarDOMInfo.winW < 1000) {
12847            withinCustomBreakpoint = true;
12848        }
12849        var alignmentPosition = (window.nectarOptions && window.nectarOptions.mobile_header_format && window.nectarOptions.mobile_header_format === 'centered-menu' && withinCustomBreakpoint) ? 'left' : 'right';
12850
12851        var conditionalShow = false;
12852        if (alignmentPosition !== 'left' && headerOCMButtonPos !== 'left') {
12853            conditionalShow = (e.clientX < $windowWidth - parseInt($ocmHoverWidth) - $bodyBorderWidth);
12854        } else {
12855            conditionalShow = (e.clientX > parseInt($ocmHoverWidth) + $bodyBorderWidth);
12856        }
12857
12858
12859        if (conditionalShow && $offCanvasEl.hasClass('mouse-accessed')) {
12860
12861            $offCanvasEl.removeClass('mouse-accessed');
12862            $window.off('mousemove.rightOffsetCheck', OCM_slideOutRightHoverCloseCheck);
12863
12864            $offCanvasEl.css({
12865                'transform': ''
12866            }).removeClass('open');
12867
12868            $headerOuterEl.removeClass('style-slide-out-from-right');
12869
12870            $('.slide-out-hover-icon-effect .lines-button')
12871                .removeClass('unhidden-line')
12872                .addClass('no-delay');
12873
12874            if ($('#header-outer[data-permanent-transparent="1"]').length == 0) {
12875
12876                if ($('#header-outer[data-remove-fixed="1"]').length == 0 && $('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) {
12877
12878                    if ($('body.mobile').length == 0) {
12879                        $headerOuterEl.removeClass('no-bg-color');
12880                        $('#header-outer header, #header-outer > .cart-outer').removeClass('all-hidden');
12881                    }
12882                }
12883
12884                if ($('#header-outer[data-remove-fixed="1"]').length == 0 && $('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) {
12885
12886                    if (headerResize == true) {
12887
12888                        $window.off('scroll.headerResizeEffect');
12889
12890                        if (nectarDOMInfo.scrollTop == 0) {
12891
12892                            $window.on('scroll.headerResizeEffect', smallNav);
12893
12894                            if ($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 &&
12895                                $bodyBorderTop.length > 0 &&
12896                                $bodyBorderHeaderColorMatch == true &&
12897                                $('#header-outer.pseudo-data-transparent').length > 0) {
12898
12899                                $('#header-outer[data-full-width="true"] header > .container').stop(true, true).animate({
12900                                    'padding': '0'
12901                                }, {
12902                                    queue: false,
12903                                    duration: 250,
12904                                    easing: 'easeOutCubic'
12905                                });
12906
12907                            }
12908                        } else {
12909                            $window.on('scroll.headerResizeEffect', bigNav);
12910                        }
12911
12912                    } else {
12913
12914                        $window.off('scroll.headerResizeEffectOpaque');
12915                        $window.on('scroll.headerResizeEffectOpaque', opaqueCheck);
12916                    }
12917                }
12918            }
12919        }
12920
12921    }
12922
12923
12924    /**
12925     * Off canvas menu: mobile slide out from right hover close.
12926     *
12927     * @since 10.5
12928     */
12929    function OCM_mobileSlideOutRightHoverCloseCheck() {
12930
12931        if (nectarDOMInfo.usingMobileBrowser || nectarDOMInfo.usingIOS || nectarDOMInfo.usingTouchDevice || $('.slide-out-from-right-hover.ios-ocm-style').length > 0) {
12932            $('.slide-out-widget-area-toggle a').attr('aria-expanded', 'false');
12933            $offCanvasBG.css({
12934                'height': '1px',
12935                'width': '1px'
12936            });
12937        }
12938
12939        if ($('.slide-out-from-right-hover.ios-ocm-style').length > 0) {
12940            $('#ajax-content-wrap').removeClass('ios-ocm-style-open');
12941            $('#slide-out-widget-area .slide_out_area_close').removeClass('material-ocm-open');
12942        }
12943
12944        $offCanvasEl.css({
12945            'transform': ''
12946        }).removeClass('open');
12947
12948        $headerOuterEl.removeClass('style-slide-out-from-right');
12949
12950        $('.slide-out-hover-icon-effect .lines-button')
12951            .removeClass('unhidden-line')
12952            .addClass('no-delay');
12953
12954        if ($('#header-outer[data-permanent-transparent="1"]').length == 0) {
12955
12956            $headerOuterEl.removeClass('no-bg-color');
12957            $('#header-outer header').removeClass('all-hidden');
12958
12959        }
12960
12961
12962        if ($('#header-outer[data-remove-fixed="1"]').length == 0 && $('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) {
12963
12964            if (headerResize == true) {
12965
12966                $window.off('scroll.headerResizeEffect');
12967
12968                if (nectarDOMInfo.scrollTop == 0) {
12969
12970                    $window.on('scroll.headerResizeEffect', smallNav);
12971
12972                    if ($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 &&
12973                        $bodyBorderTop.length > 0 &&
12974                        $bodyBorderHeaderColorMatch == true &&
12975                        $('#header-outer.pseudo-data-transparent').length > 0) {
12976
12977                        $('#header-outer[data-full-width="true"] header > .container').stop(true, true).animate({
12978                            'padding': '0'
12979                        }, {
12980                            queue: false,
12981                            duration: 250,
12982                            easing: 'easeOutCubic'
12983                        });
12984
12985                    }
12986                } else {
12987                    $window.on('scroll.headerResizeEffect', bigNav);
12988                }
12989
12990            } else {
12991
12992                $window.off('scroll.headerResizeEffectOpaque');
12993                $window.on('scroll.headerResizeEffectOpaque', opaqueCheck);
12994
12995            }
12996
12997        }
12998
12999    }
13000
13001
13002    /**
13003     * Off canvas menu: slide out from right hover initialization.
13004     *
13005     * @since 10.5
13006     */
13007    function OCM_slideOutRightHoverInit() {
13008
13009        var clickEventEnabled = true;
13010
13011        if ($('#ajax-content-wrap > .slide-out-widget-area-toggle').length == 0) {
13012
13013            //icon effect html creation
13014            var $iconInsertLocation = ($('.slide-out-widget-area-toggle[data-custom-color="true"]').length > 0) ? '#slide-out-widget-area > div' : '#slide-out-widget-area';
13015
13016            if ($('.ios-ocm-style').length === 0) {
13017                $('<div class="slide-out-widget-area-toggle slide-out-hover-icon-effect" data-icon-animation="simple-transform"><div> <a href="#slide-out-widget-area" role="button" class="closed"> <span> <span class="screen-reader-text">' + nectar_front_i18n.menu + '</span> <i class="lines-button x2" role="none"> <i class="lines"></i> </i> </span> </a> </div> </div>').insertAfter($iconInsertLocation);
13018            }
13019
13020            if ($('#header-outer[data-has-menu="true"]').length > 0 ||
13021                $('body[data-header-search="true"]').length > 0 ||
13022                $('.slide-out-widget-area-toggle a.using-label').length > 0 ||
13023                $('.slide-out-widget-area-toggle[data-custom-color="true"]').length > 0) {
13024                $('.slide-out-widget-area-toggle').addClass('small');
13025            }
13026        }
13027
13028
13029        //hover triggered
13030        if (!nectarDOMInfo.usingMobileBrowser && !nectarDOMInfo.usingIOS && !nectarDOMInfo.usingTouchDevice && $('.ios-ocm-style').length == 0) {
13031            $body.on('mouseenter', '#header-outer .slide-out-widget-area-toggle:not(.std-menu) a', OCM_slideOutRightHoverOpen);
13032            $offCanvasEl.on('mouseenter', function () {
13033                $(this).addClass('mouse-accessed');
13034            });
13035
13036        } else {
13037            function slideOutFromRightHoverClickTrigger() {
13038
13039                // Prevent double click event.
13040                if (clickEventEnabled) {
13041                    OCM_slideOutRightHoverOpen();
13042                    clickEventEnabled = false;
13043                    setTimeout(function () {
13044                        clickEventEnabled = true;
13045                    }, 350);
13046                }
13047
13048                return false;
13049            };
13050
13051            $body.on('click touchend', '.slide-out-widget-area-toggle:not(.std-menu) a', slideOutFromRightHoverClickTrigger);
13052            if (window.nectarOcmOpen) {
13053
13054                setTimeout(() => {
13055                    slideOutFromRightHoverClickTrigger();
13056                }, 40);
13057
13058            }
13059
13060            $body.on('click', '#slide-out-widget-area-bg', OCM_slideOutRightMobileClose);
13061            $body.on('click', '.ios-ocm-style .slide_out_area_close', function (e) {
13062                OCM_slideOutRightMobileClose();
13063                e.preventDefault();
13064            });
13065
13066        }
13067
13068        $window.on('smartresize', calculateHoverNavMinHeight);
13069
13070
13071    }
13072
13073
13074    /**
13075     * Off canvas menu: slide out from right close from body click on mobile.
13076     *
13077     * @since 12.2
13078     */
13079    function OCM_slideOutRightMobileClose() {
13080
13081        if ($('.slide-out-from-right-hover.open').length > 0) {
13082            $('.slide-out-widget-area-toggle:not(.std-menu) a').first().addClass('non-human-allowed').trigger('click');
13083            setTimeout(function () {
13084                $('.slide-out-widget-area-toggle:not(.std-menu) a').removeClass('non-human-allowed');
13085            }, 100);
13086        }
13087
13088    }
13089
13090
13091    /**
13092     * Off canvas menu: slide out from right open.
13093     *
13094     * @since 10.5
13095     */
13096    function OCM_slideOutRightOpen() {
13097
13098        var $slideOutAmount = ($bodyBorderTop.length > 0 && $('body.mobile').length == 0) ? $bodyBorderTop.height() : 0;
13099
13100        var withinCustomBreakpoint = mobileBreakPointCheck();
13101        if (nectarDOMInfo.winW < 1000) {
13102            withinCustomBreakpoint = true;
13103        }
13104        var alignmentPosition = (window.nectarOptions && window.nectarOptions.mobile_header_format && window.nectarOptions.mobile_header_format === 'centered-menu' && withinCustomBreakpoint) ? 'left' : 'right';
13105
13106        if ($('body.material').length == 0) {
13107
13108            // Calc height if used bottom meta.
13109            $('#slide-out-widget-area .inner').css({
13110                'height': 'auto',
13111                'min-height': $offCanvasEl.height() - 25 - $('.bottom-meta-wrap').height()
13112            });
13113
13114            // First item dropdown?
13115            if ($('#slide-out-widget-area[data-dropdown-func="separate-dropdown-parent-link"] .inner > div:first-of-type > .menu > li:first-child').length > 0 &&
13116                $('#slide-out-widget-area .inner > div:first-of-type > .menu > li:first-child').hasClass('menu-item-has-children')) {
13117                $('#slide-out-widget-area .inner > div:first-of-type').css({'margin-top': '50px'});
13118            }
13119
13120            if ($('#boxed').length == 0) {
13121
13122                $('.container-wrap, .home-wrap, #footer-outer:not(#nectar_fullscreen_rows #footer-outer), .nectar-box-roll, #page-header-wrap .page-header-bg-image, #page-header-wrap .nectar-video-wrap, #page-header-wrap .mobile-video-image, #page-header-wrap #page-header-bg > .container, .page-header-no-bg, div:not(.container) > .project-title').stop(true).transition({
13123                    x: (alignmentPosition === 'left' || headerOCMButtonPos === 'left') ? '300px' : '-300px'
13124                }, 700, 'easeInOutCubic');
13125
13126                var $withinCustomBreakpoint = mobileBreakPointCheck();
13127
13128                if ($('#header-outer[data-format="centered-logo-between-menu"]').length == 0 || $withinCustomBreakpoint) {
13129
13130                    if ($('#header-outer[data-transparency-option="1"]').length == 0 ||
13131                        ($('#header-outer[data-transparency-option="1"]').length > 0 && $('#header-outer[data-full-width="true"]').length == 0) ||
13132                        $('body.mobile').length > 0) {
13133
13134                        $headerOuterEl.stop(true).css('transform', 'translateY(0)').transition({
13135                            x: (alignmentPosition === 'left' || headerOCMButtonPos === 'left') ? (300 + $slideOutAmount) + 'px' : '-' + (300 + $slideOutAmount) + 'px'
13136                        }, 700, 'easeInOutCubic');
13137
13138                    } else {
13139
13140                        $headerOuterEl.stop(true).css('transform', 'translateY(0)').transition({
13141                            x: (alignmentPosition === 'left' || headerOCMButtonPos === 'left') ? (300 + $slideOutAmount) + 'px' : '-' + (300 + $slideOutAmount) + 'px',
13142                            'background-color': 'transparent',
13143                            'border-bottom': '1px solid rgba(255,255,255,0.22)'
13144                        }, 700, 'easeInOutCubic');
13145
13146                    }
13147                } else {
13148                    $('#header-outer header#top nav > ul.buttons, body:not(.material) #header-outer:not([data-format="centered-logo-between-menu"]) .cart-outer .cart-menu-wrap').transition({
13149                        x: (alignmentPosition === 'left' || headerOCMButtonPos === 'left') ? '300px' : '-300px'
13150                    }, 700, 'easeInOutCubic');
13151                }
13152
13153            }
13154
13155
13156            $offCanvasEl.stop(true).transition({
13157                x: (alignmentPosition === 'left' || headerOCMButtonPos === 'left') ? $slideOutAmount + 'px' : '-' + $slideOutAmount + 'px'
13158            }, 700, 'easeInOutCubic').addClass('open');
13159
13160
13161            if ($('#boxed').length == 0) {
13162
13163                // Full width menu adjustments
13164                if ($('#header-outer[data-full-width="true"]').length > 0 && !$body.hasClass('mobile')) {
13165                    $headerOuterEl.addClass('highzI');
13166                    $('#ascrail2000').addClass('z-index-adj');
13167
13168                    if ($('#header-outer[data-format="centered-logo-between-menu"]').length == 0) {
13169
13170                        if ($bodyBorderWidth == 0) {
13171
13172                            if (headerOCMButtonPos === 'left') {
13173
13174                            } else {
13175                                $('header#top #logo').stop(true).transition({
13176                                    x: (300 + $slideOutAmount) + 'px'
13177                                }, 700, 'easeInOutCubic');
13178                            }
13179
13180                        }
13181
13182                    }
13183
13184                    $('header#top .slide-out-widget-area-toggle .lines-button:not(.legacy-double)').addClass('close');
13185
13186                    $('body #header-outer nav > ul > li > a').css({
13187                        'margin-bottom': '0'
13188                    });
13189
13190                }
13191
13192            }
13193
13194            $headerOuterEl.addClass('style-slide-out-from-right');
13195
13196            // Fade In BG Overlay
13197            $offCanvasBG.css({
13198                'height': '100%',
13199                'width': '100%'
13200            }).stop(true).transition({
13201                'opacity': 1
13202            }, 700, 'easeInOutCubic', function () {
13203                $('.slide-out-widget-area-toggle:not(.std-menu) > div > a').removeClass('animating');
13204            });
13205
13206            // Hide menu if no space
13207            if ($('#header-outer[data-format="centered-logo-between-menu"]').length == 0) {
13208
13209                var $logoWidth = ($('#logo img:visible').length > 0) ? $('#logo img:visible').width() : $('#logo').width();
13210
13211                if ($('header#top nav > .sf-menu').offset().left - $logoWidth - 300 < 20) {
13212                    $headerOuterEl.addClass('hidden-menu');
13213                }
13214
13215            } else {
13216                $headerOuterEl.addClass('hidden-menu-items');
13217            }
13218
13219
13220            if ($('#header-outer[data-remove-fixed="1"]').length == 0 && nectarDOMInfo.winW > 1000) {
13221
13222                if ($bodyBorderHeaderColorMatch == true && headerResize == true && $headerOuterEl.attr('data-transparent-header') == 'true') {
13223
13224                    $headerOuterEl.stop(true).transition({
13225                        y: '0'
13226                    }, 0).addClass('transparent').css('transition', 'transform');
13227
13228
13229                    $window.off('scroll', bigNav);
13230                    $window.off('scroll', smallNav);
13231
13232                } else if ($bodyBorderHeaderColorMatch == true && $headerOuterEl.attr('data-transparent-header') == 'true') {
13233
13234                    $headerOuterEl.addClass('transparent');
13235                    $window.off('scroll', opaqueCheck);
13236                    $window.off('scroll', transparentCheck);
13237
13238                }
13239            }
13240
13241        } else if ($('body.material').length > 0) {
13242
13243            // Material theme skin slide out from right
13244
13245            //move ajax loading outside
13246            if ($loadingScreenEl.length > 0 && $('.ocm-effect-wrap #ajax-loading-screen').length > 0) {
13247                $loadingScreenEl.insertBefore('.ocm-effect-wrap');
13248            }
13249
13250            // Hide secondary header when not at top with hhun
13251            if (nectarDOMInfo.scrollTop > 40) {
13252                $('body[data-hhun="1"] #header-secondary-outer').addClass('hidden');
13253            }
13254
13255            setTimeout(function () {
13256                $('.slide-out-widget-area-toggle:not(.std-menu) > div > a').removeClass('animating');
13257            }, 300);
13258
13259            $('#slide-out-widget-area, #slide-out-widget-area-bg, #header-outer .slide-out-widget-area-toggle').addClass('material-open');
13260
13261
13262            // Handle bottom bar nav
13263            if ($('body:not(.mobile) #header-outer[data-format="centered-menu-bottom-bar"][data-condense="true"]').length > 0 &&
13264                $('#header-outer[data-format="centered-menu-bottom-bar"] .span_9').css('display') != 'none') {
13265
13266                $('#header-outer:not(.fixed-menu)').css('top', nectarDOMInfo.adminBarHeight - nectarDOMInfo.scrollTop + 'px');
13267
13268                if ($headerSecondaryEl.length > 0 && $('#header-outer.fixed-menu').length > 0) {
13269                    $headerSecondaryEl.css('visibility', 'hidden');
13270                }
13271
13272            }
13273
13274            $('#ajax-content-wrap').css({
13275                'position': 'relative',
13276                'top': '-' + nectarDOMInfo.scrollTop + 'px'
13277            });
13278
13279            $('.ocm-effect-wrap-inner').css({
13280                'padding-top': nectarDOMInfo.adminBarHeight
13281            });
13282
13283            $('#fp-nav').addClass('material-ocm-open');
13284
13285            nectarState.materialOffCanvasOpen = true;
13286            $body.addClass('material-ocm-open');
13287            $body.addClass('nectar-no-flex-height');
13288
13289            $('.ocm-effect-wrap').css({
13290                'height': nectarDOMInfo.winH
13291            });
13292
13293            setTimeout(function () {
13294                $('.ocm-effect-wrap').addClass('material-ocm-open');
13295            }, 40);
13296
13297
13298            $('body > .slide_out_area_close__wrap .slide_out_area_close').addClass('follow-body');
13299
13300            //icon effect
13301            $('#header-outer:not([data-format="left-header"]) header#top .slide-out-widget-area-toggle a').addClass('effect-shown');
13302
13303            //handle hhun when at top
13304            $('body[data-hhun="1"]:not(.no-scroll):not(.mobile) #header-outer[data-permanent-transparent="false"]:not(.detached):not(.parallax-contained):not(.at-top-before-box)').css({
13305                'transition': 'none',
13306                'transform': 'translateY(' + nectarDOMInfo.adminBarHeight + 'px)'
13307            });
13308
13309
13310            setTimeout(function () {
13311                $('body > .slide_out_area_close__wrap .slide_out_area_close').addClass('material-ocm-open');
13312                $('body > .slide_out_area_close__wrap .slide_out_area_close').removeClass('hide_until_rendered');
13313            }, 350);
13314
13315
13316        }
13317
13318        $(window).trigger('nectar-material-ocm-open');
13319
13320    }
13321
13322
13323    /**
13324     * Off canvas menu: slide out from right close.
13325     *
13326     * @since 10.5
13327     */
13328    function OCM_slideOutRightClose() {
13329
13330        if ($('body.material').length == 0) {
13331
13332            var withinCustomBreakpoint = mobileBreakPointCheck();
13333            if (nectarDOMInfo.winW < 1000) {
13334                withinCustomBreakpoint = true;
13335            }
13336            var alignmentPosition = (window.nectarOptions && window.nectarOptions.mobile_header_format && window.nectarOptions.mobile_header_format === 'centered-menu' && withinCustomBreakpoint) ? 'left' : 'right';
13337
13338            $('.container-wrap, .home-wrap, #footer-outer:not(#nectar_fullscreen_rows #footer-outer), .nectar-box-roll, #page-header-wrap .page-header-bg-image,  #page-header-wrap .nectar-video-wrap, #page-header-wrap .mobile-video-image, #page-header-wrap #page-header-bg > .container, .page-header-no-bg, div:not(.container) > .project-title').stop(true).transition({
13339                x: '0px'
13340            }, 700, 'easeInOutCubic');
13341
13342            if ($('#header-outer[data-transparency-option="1"]').length > 0 && $('#boxed').length == 0) {
13343                var $currentRowBG = ($('#header-outer[data-current-row-bg-color]').length > 0) ? $headerOuterEl.attr('data-current-row-bg-color') : $headerOuterEl.attr('data-user-set-bg');
13344                $headerOuterEl.stop(true).transition({
13345                    x: '0px',
13346                    'background-color': $currentRowBG
13347                }, 700, 'easeInOutCubic');
13348            } else {
13349                $headerOuterEl.stop(true).transition({
13350                    x: '0px'
13351                }, 700, 'easeInOutCubic');
13352            }
13353
13354            $offCanvasEl.stop(true).transition({
13355                x: (alignmentPosition === 'left' || headerOCMButtonPos === 'left') ? '-301px' : '301px'
13356            }, 700, 'easeInOutCubic').removeClass('open');
13357
13358
13359            if ($('#boxed').length == 0) {
13360                if ($('#header-outer[data-full-width="true"]').length > 0) {
13361                    $headerOuterEl.removeClass('highzI');
13362                    $('header#top #logo').stop(true).transition({
13363                        x: '0px'
13364                    }, 700, 'easeInOutCubic');
13365                    $('.lines-button').removeClass('close');
13366
13367                }
13368            }
13369
13370            if ($('#header-outer[data-format="centered-logo-between-menu"]').length > 0) {
13371                $('#header-outer header#top nav > ul.buttons, #header-outer .cart-outer .cart-menu-wrap').stop(true).transition({
13372                    x: '0px'
13373                }, 700, 'easeInOutCubic');
13374            }
13375
13376            //fade out overlay
13377            $offCanvasBG.stop(true).transition({
13378                'opacity': 0
13379            }, 700, 'easeInOutCubic', function () {
13380
13381                $('.slide-out-widget-area-toggle a').removeClass('animating');
13382
13383                $(this).css({
13384                    'height': '1px',
13385                    'width': '1px'
13386                });
13387
13388                if ($('#header-outer[data-remove-fixed="1"]').length == 0) {
13389
13390                    //hide menu if transparent, user has scrolled down and hhun is on
13391                    if ($headerOuterEl.hasClass('parallax-contained') &&
13392                        nectarDOMInfo.scrollTop > 0 &&
13393                        $('#header-outer[data-permanent-transparent="1"]').length == 0) {
13394                        $headerOuterEl.removeClass('parallax-contained').addClass('detached').removeClass('transparent');
13395                    } else if (nectarDOMInfo.scrollTop == 0 && $('body[data-hhun="1"]').length >
13395 0 && $('#page-header-bg[data-parallax="1"]').length > 0 ||
13396                        nectarDOMInfo.scrollTop == 0 && $('body[data-hhun="1"]').length > 0 && $('.parallax_slider_outer').length > 0) {
13397
13398                        if ($('#header-outer[data-transparency-option="1"]').length > 0) {
13399                            $headerOuterEl.addClass('transparent');
13400                        }
13401
13402                    }
13403
13404                }
13405
13406                //fix for fixed subpage menu
13407                $('.container-wrap').css('transform', 'none');
13408
13409            });
13410
13411
13412            $headerOuterEl.removeClass('style-slide-out-from-right');
13413
13414
13415            if ($('#header-outer[data-remove-fixed="1"]').length == 0) {
13416
13417                if ($bodyBorderHeaderColorMatch == true &&
13418                    headerResize == true &&
13419                    nectarDOMInfo.winW > 1000) {
13420
13421                    $window.off('scroll.headerResizeEffect');
13422                    if (nectarDOMInfo.scrollTop == 0) {
13423
13424                        $window.on('scroll.headerResizeEffect', smallNav);
13425
13426                        if ($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 &&
13427                            $bodyBorderTop.length > 0 &&
13428                            $bodyBorderHeaderColorMatch == true &&
13429                            $('#header-outer.pseudo-data-transparent').length > 0) {
13430
13431                            $('#header-outer[data-full-width="true"] header > .container').stop(true, true).animate({
13432                                'padding': '0'
13433                            }, {
13434                                queue: false,
13435                                duration: 250,
13436                                easing: 'easeOutCubic'
13437                            });
13438
13439                        }
13440                    } else {
13441                        $window.on('scroll.headerResizeEffect', bigNav);
13442                    }
13443
13444                    if ($headerOuterEl.hasClass('pseudo-data-transparent')) {
13445
13446                        $headerOuterEl.attr('data-transparent-header', 'false')
13447                            .removeClass('pseudo-data-transparent')
13448                            .removeClass('transparent');
13449                    }
13450
13451                    $headerOuterEl.css('transition', 'transform');
13452
13453                } else if ($bodyBorderHeaderColorMatch == true && nectarDOMInfo.winW > 1000) {
13454
13455                    $window.off('scroll.headerResizeEffectOpaque');
13456                    $window.on('scroll.headerResizeEffectOpaque', opaqueCheck);
13457
13458                    $headerOuterEl.css('transition', 'transform');
13459
13460                    if ($headerOuterEl.hasClass('pseudo-data-transparent')) {
13461                        $headerOuterEl.attr('data-transparent-header', 'false')
13462                            .removeClass('pseudo-data-transparent')
13463                            .removeClass('transparent');
13464                    }
13465                }
13466            }
13467        } else if ($('body.material').length > 0) {
13468
13469            //material
13470            $offCanvasEl.removeClass('open');
13471
13472
13473            $('#slide-out-widget-area, #slide-out-widget-area-bg, #header-outer .slide-out-widget-area-toggle').removeClass('material-open');
13474            $('.ocm-effect-wrap, .ocm-effect-wrap-shadow, body > .slide_out_area_close__wrap .slide_out_area_close, #fp-nav').removeClass('material-ocm-open');
13475
13476            $('body > .slide_out_area_close__wrap .slide_out_area_close').removeClass('follow-body');
13477
13478            setTimeout(function () {
13479                $('.slide-out-widget-area-toggle a').removeClass('animating');
13480
13481                $body.removeClass('material-ocm-open');
13482                $body.removeClass('nectar-no-flex-height');
13483
13484                $('.ocm-effect-wrap').css({
13485                    'height': '100%'
13486                });
13487
13488                $('.ocm-effect-wrap-inner').css({
13489                    'padding-top': '0'
13490                });
13491
13492                $window.scrollTop(Math.abs(parseInt($('#ajax-content-wrap').css('top'))));
13493
13494                $('#ajax-content-wrap').css({
13495                    'position': '',
13496                    'top': ''
13497                });
13498
13499
13500                //handle bottom bar nav
13501                if ($('#header-outer[data-format="centered-menu-bottom-bar"]').length > 0 &&
13502                    $('#header-outer[data-format="centered-menu-bottom-bar"] .span_9').css('display') != 'none' &&
13503                    $('body.mobile').length == 0) {
13504
13505                    $('#header-outer:not(.fixed-menu)').css('top', '');
13506                    $headerSecondaryEl.css('visibility', '');
13507
13508                }
13509
13510                //handle hhun when at top
13511                $('body[data-hhun="1"]:not(.no-scroll) #header-outer[data-permanent-transparent="false"]:not(.detached):not(.parallax-contained):not(.at-top-before-box)').css({
13512                    'transform': ''
13513                });
13514                setTimeout(function () {
13515                    $('body[data-hhun="1"]:not(.no-scroll) #header-outer[data-permanent-transparent="false"]:not(.detached):not(.parallax-contained):not(.at-top-before-box)').css({
13516                        'transition': ''
13517                    });
13518                }, 30);
13519
13520
13521                $('body[data-hhun="1"] #header-secondary-outer.hidden').removeClass('hidden');
13522
13523
13524                nectarState.materialOffCanvasOpen = false;
13525
13526                $(window).trigger('nectar-material-ocm-close');
13527
13528            }, 900);
13529
13530            setTimeout(function () {
13531
13532                //icon effect
13533                $('#header-outer:not([data-format="left-header"]) header#top .slide-out-widget-area-toggle a')
13534                    .addClass('no-trans')
13535                    .removeClass('effect-shown');
13536
13537            }, 200);
13538
13539            setTimeout(function () {
13540                //icon
13541                $('#header-outer:not([data-format="left-header"]) header#top .slide-out-widget-area-toggle a').removeClass('no-trans');
13542            }, 500);
13543
13544        }
13545
13546
13547    }
13548
13549
13550    /**
13551     * Off canvas menu: fullscreen open.
13552     *
13553     * @since 10.5
13554     */
13555    function OCM_fullscreenOpen() {
13556
13557        if ($('body.material').length > 0) {
13558            $('header#top .slide-out-widget-area-toggle a').addClass('menu-push-out');
13559        }
13560
13561        // Scroll away from fixed reveal footer if shown (firefox bug with bluring over it)
13562        var $scrollDelay = 0;
13563        var $scrollDelay2 = 0;
13564
13565        if (nectarDOMInfo.scrollTop + $window.height() > $('.blurred-wrap').height() && $('#nectar_fullscreen_rows').length == 0) {
13566            $('body,html').stop().animate({
13567                scrollTop: $('.blurred-wrap').height() - $window.height()
13568            }, 600, 'easeInOutCubic');
13569            $scrollDelay = 550;
13570            $scrollDelay2 = 200;
13571        }
13572
13573        $('header#top .slide-out-widget-area-toggle:not(.std-menu) .lines-button:not(.legacy-double)').addClass('close');
13574        setTimeout(function () {
13575            $('.blurred-wrap').addClass('blurred');
13576        }, $scrollDelay);
13577        $('#slide-out-widget-area.fullscreen').show().addClass('open');
13578
13579        if ($('.nectar-social.fixed').length == 0) {
13580            hideToTop();
13581        }
13582
13583        // Remove box shadow incase at the top of the page with nectar box roll above
13584        $('.container-wrap').addClass('no-shadow');
13585        $headerOuterEl.stop(true).css('transform', 'translateY(0)');
13586
13587        setTimeout(function () {
13588
13589            $('.off-canvas-menu-container .menu > li').each(function (i) {
13590                $(this).delay(i * 50).transition({
13591                    y: 0,
13592                    'opacity': 1
13593                }, 800, 'easeOutExpo');
13594            });
13595
13596            $('#slide-out-widget-area.fullscreen .widget').each(function (i) {
13597                $(this).delay(i * 100).transition({
13598                    y: 0,
13599                    'opacity': 1
13600                }, 800, 'easeOutExpo');
13601            });
13602        }, 370 + $scrollDelay2);
13603
13604        setTimeout(function () {
13605            $('#slide-out-widget-area .off-canvas-social-links').addClass('line-shown');
13606
13607            $('#slide-out-widget-area .off-canvas-social-links li').each(function (i) {
13608                $(this).delay(i * 50).transition({
13609                    'scale': 1
13610                }, 400, 'easeOutCubic');
13611            });
13612
13613            $('#slide-out-widget-area .bottom-text').transition({
13614                'opacity': 0.7
13615            }, 400, 'easeOutCubic');
13616        }, 750 + $scrollDelay2);
13617
13618        // Fade In BG Overlay
13619        setTimeout(function () {
13620            var $easing = ($('body.mobile').length > 0) ? 'easeOutCubic' : 'easeInOutQuint';
13621            $offCanvasBG.css({
13622                'height': '100%',
13623                'width': '100%'
13624            }).show().stop(true).transition({
13625                'y': '0%'
13626            }, 920, $easing, function () {
13627                $('.slide-out-widget-area-toggle > div > a').removeClass('animating');
13628            });
13629        }, 50 + $scrollDelay2);
13630
13631        // Overflow state
13632        OCM_overflowState();
13633
13634        if ($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && $('.container-wrap').hasClass('no-scroll')) {
13635            $('#ajax-content-wrap').addClass('at-content');
13636        }
13637
13638        var headerOffset = $headerOuterEl.offset().top - nectarDOMInfo.scrollTop + nectarDOMInfo.secondaryHeaderHeight;
13639
13640        $('#slide-out-widget-area.fullscreen > .inner-wrap').css('padding-top', ($headerOuterEl.outerHeight() + headerOffset));
13641
13642
13643    }
13644
13645
13646    /**
13647     * Off canvas menu: fullscreen close.
13648     *
13649     * @since 10.5
13650     */
13651    function OCM_fullscreenClose() {
13652
13653        if ($('body.material').length > 0) {
13654            setTimeout(function () {
13655                $('header#top .slide-out-widget-area-toggle a').removeClass('menu-push-out');
13656            }, 350);
13657        }
13658
13659        $('.slide-out-widget-area-toggle:not(.std-menu) .lines-button:not(.legacy-double)').removeClass('close');
13660        $('.blurred-wrap').removeClass('blurred');
13661        $('#slide-out-widget-area.fullscreen').transition({
13662            'opacity': 0
13663        }, 700, 'easeOutQuad', function () {
13664            $('#slide-out-widget-area.fullscreen').hide().css('opacity', '1');
13665        }).removeClass('open');
13666        $('#slide-out-widget-area.fullscreen .widget').transition({
13667            'opacity': 0
13668        }, 700, 'easeOutQuad', function () {
13669            $(this).transition({
13670                y: '110px'
13671            }, 0);
13672        });
13673
13674        setTimeout(function () {
13675            $('.off-canvas-menu-container .menu > li').transition({
13676                y: '80px',
13677                'opacity': 0
13678            }, 0);
13679            $('#slide-out-widget-area .off-canvas-social-links li').transition({
13680                'scale': 0
13681            }, 0);
13682            $('#slide-out-widget-area .off-canvas-social-links').removeClass('line-shown');
13683            $('#slide-out-widget-area .bottom-text').transition({
13684                'opacity': 0
13685            }, 0);
13686
13687            // Close submenu items
13688            $('#slide-out-widget-area .menuwrapper .menu').removeClass('subview');
13689            $('#slide-out-widget-area .menuwrapper .menu li').removeClass('subview subviewopen');
13690            $('#slide-out-widget-area.fullscreen .inner .menu-wrap').css('height', 'auto');
13691        }, 800);
13692
13693        setTimeout(function () {
13694            if ($('.nectar-social.fixed').length == 0) {
13695                showToTop();
13696            }
13697            $('.container-wrap').removeClass('no-shadow');
13698        }, 500);
13699
13700        // Fade out overlay
13701        $offCanvasBG.stop(true).transition({
13702            'opacity': 0
13703        }, 900, 'easeOutQuad', function () {
13704
13705            if ($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && $('.container-wrap').hasClass('no-scroll')) {
13706                $('#ajax-content-wrap').removeClass('at-content');
13707            }
13708            if ($('.mobile #header-outer[data-permanent-transparent="false"]').length == 0) {
13709                $('#slide-out-widget-area.fullscreen > .inner-wrap').css('padding-top', '0');
13710            }
13711
13712            $('.slide-out-widget-area-toggle a').removeClass('animating');
13713
13714            var $opacity = 0.4;
13715
13716            if ($offCanvasBG.hasClass('solid')) {
13717                $opacity = 1;
13718            }
13719            if ($offCanvasBG.hasClass('dark')) {
13720                $opacity = 0.93;
13721            }
13722            if ($offCanvasBG.hasClass('medium')) {
13723                $opacity = 0.6;
13724            }
13725            if ($offCanvasBG.hasClass('light')) {
13726                $opacity = 0.4;
13727            }
13728            $(this).css({
13729                'height': '1px',
13730                'width': '1px',
13731                'opacity': $opacity
13732            }).transition({
13733                y: '-100%'
13734            }, 0);
13735        });
13736
13737    }
13738
13739
13740    /**
13741     * Off canvas menu: fullscreen alt open.
13742     *
13743     * @since 10.5
13744     */
13745    function OCM_fullscreenInlineImagesOpen() {
13746
13747        var $ocm_fullscreen_class = '.fullscreen-inline-images';
13748
13749        var portraitView = (nectarDOMInfo.winW < nectarDOMInfo.winH) ? true : false;
13750
13751        if ($('body[data-contained-header="true"]').length === 0) {
13752            $headerOuterEl.css({
13753                'z-index': '9990',
13754                'transition': 'transform 0.3s ease'
13755            });
13756        }
13757
13758
13759        if ($('.nectar-social.fixed').length == 0) {
13760            hideToTop();
13761        }
13762
13763        if ($('body.material').length > 0) {
13764            $('header#top .slide-out-widget-area-toggle a').addClass('menu-push-out');
13765        }
13766
13767        $('header#top .slide-out-widget-area-toggle:not(.std-menu) .lines-button:not(.legacy-double)').addClass('close');
13768        $('#slide-out-widget-area' + $ocm_fullscreen_class).addClass('open').removeClass('hidden');
13769        $offCanvasBG.addClass('open').removeClass('hidden');
13770        $('body > div[class*="body-border"]').css('z-index', '9995');
13771
13772
13773        // Handle transparent header
13774        var transparentTimeout = (portraitView) ? 350 : 425;
13775
13776        setTimeout(function () {
13777
13778            $headerOuterEl
13779                .removeClass('side-widget-closed')
13780                .addClass('side-widget-open');
13781
13782            if (!headerTransparent) {
13783                $headerOuterEl.attr('data-transparent-header', 'true');
13784                // If starting logo is not supplied.
13785                if ($('#logo .starting-logo:not(.dark-version)').length === 0) {
13786                    $headerOuterEl.addClass('lighten-logo');
13787                }
13788            }
13789
13790            if (!nectarDOMInfo.usingFrontEndEditor) {
13791                $headerOuterEl.stop(true).css('transform', 'translateY(0)').addClass('transparent');
13792            }
13793
13794            // Dark slide transparent nav
13795            if ($('#header-outer.dark-slide.transparent').length > 0 && $('#boxed').length == 0) {
13796                $headerOuterEl
13797                    .removeClass('dark-slide')
13798                    .addClass('temp-removed-dark-slide');
13799            }
13800
13801            // Switch header state
13802            if ($('body[data-contained-header="true"]').length === 0) {
13803                setTimeout(function () {
13804
13805                    anime({
13806                        targets: '#header-outer #top > .container',
13807                        opacity: [0, 1],
13808                        duration: 900,
13809                        easing: 'easeOutQuad'
13810                    });
13811
13812                    $headerOuterEl.css({
13813                        'z-index': '',
13814                        'transition': ''
13815                    });
13816
13817
13818                }, 50);
13819            }
13820
13821        }, transparentTimeout);
13822
13823
13824        $('.off-canvas-menu-container .clip-wrap').css('transition-duration', '0s');
13825
13826
13827        $offCanvasBG.removeClass('no-transition');
13828
13829        setTimeout(function () {
13830            $('.slide-out-widget-area-toggle > div > a').removeClass('animating');
13831        }, 600);
13832
13833
13834        if ($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 &&
13835            $('.container-wrap').hasClass('no-scroll')) {
13836            $('#ajax-content-wrap').addClass('at-content');
13837        }
13838
13839        var fullScreenTopPadding = $headerOuterEl.outerHeight();
13840        if ($('body[data-contained-header="true"]').length > 0) {
13841            fullScreenTopPadding = $headerOuterEl.outerHeight() * 2;
13842        }
13843        $('#slide-out-widget-area' + $ocm_fullscreen_class + ' > .inner-wrap').css('padding-top', fullScreenTopPadding);
13844
13845    }
13846
13847
13848    /**
13849     * Off canvas menu: fullscreen alt open.
13850     *
13851     * @since 10.5
13852     */
13853    function OCM_fullscreenAltOpen() {
13854
13855        var $ocm_fullscreen_class = '.fullscreen-alt';
13856
13857        if ($offCanvasEl.hasClass('fullscreen-split')) {
13858            $ocm_fullscreen_class = '.fullscreen-split';
13859        }
13860
13861        if ($('body.material').length > 0) {
13862            $('header#top .slide-out-widget-area-toggle a').addClass('menu-push-out');
13863        }
13864
13865        $('header#top .slide-out-widget-area-toggle:not(.std-menu) .lines-button:not(.legacy-double)').addClass('close');
13866
13867        if ($ocm_fullscreen_class === '.fullscreen-alt') {
13868            $('#slide-out-widget-area' + $ocm_fullscreen_class).show().addClass('open');
13869        } else {
13870            $('#slide-out-widget-area' + $ocm_fullscreen_class).addClass('open').removeClass('hidden');
13871        }
13872
13873        $offCanvasBG.addClass('open').removeClass('hidden');
13874
13875        $('body > div[class*="body-border"]').css('z-index', '9995');
13876
13877        if ($ocm_fullscreen_class === '.fullscreen-alt') {
13878            $('.off-canvas-menu-container .menu').transition({
13879                y: '0px',
13880                'opacity': 1
13881            }, 0);
13882        }
13883
13884        if ($('.nectar-social.fixed').length == 0) {
13885            hideToTop();
13886        }
13887
13888        if ($('#header-outer.transparent').length > 0) {
13889
13890            if ($bodyBorderTop.length > 0) {
13891                $('.admin-bar #slide-out-widget-area-bg' + $ocm_fullscreen_class).css({
13892                    'padding-top': ($bodyBorderTop.outerHeight(true) + 32) + 'px'
13893                });
13894                $('body:not(.admin-bar) #slide-out-widget-area-bg' + $ocm_fullscreen_class).css({
13895                    'padding-top': ($bodyBorderTop.outerHeight(true)) + 'px'
13896                });
13897            }
13898        }
13899
13900        // Set translateY to 0 in all cases
13901        $headerOuterEl.stop(true).css('transform', 'translateY(0)');
13902
13903        if ($window.width() > 1000 &&
13904            $('#header-outer[data-format="centered-menu-bottom-bar"].fixed-menu').length == 0 &&
13905            $('body.material #header-outer[data-condense="true"]').length == 0 &&
13906            $headerOuterEl.attr('data-transparent-header') == 'true' &&
13907            !nectarDOMInfo.usingFrontEndEditor) {
13908
13909            if ($('#logo .starting-logo').length > 0 || $('#logo.no-image').length > 0) {
13910
13911                $headerOuterEl.stop(true).css('transform', 'translateY(0)').addClass('transparent');
13912
13913            }
13914
13915        }
13916
13917        $('.off-canvas-menu-container .clip-wrap').css('transition-duration', '0s');
13918
13919        if ($ocm_fullscreen_class === '.fullscreen-alt') {
13920
13921            setTimeout(function () {
13922
13923                $('.off-canvas-menu-container .menu > li').each(function (i) {
13924                    $(this).delay(i * 50).transition({
13925                        y: 0,
13926                        'opacity': 1
13927                    }, 750, 'easeOutCubic').addClass('no-pointer-events');
13928                });
13929
13930                setTimeout(function () {
13931                    $('.off-canvas-menu-container .menu > li').removeClass('no-pointer-events');
13932                    $('.off-canvas-menu-container .clip-wrap').css('transition-duration', '.45s');
13933                }, 500);
13934
13935                $('#slide-out-widget-area.fullscreen-alt .widget').each(function (i) {
13936                    $(this).delay(i * 100).transition({
13937                        y: 0,
13938                        'opacity': 1
13939                    }, 650, 'easeOutCubic');
13940                });
13941
13942            }, 200);
13943
13944            setTimeout(function () {
13945                $('#slide-out-widget-area .off-canvas-social-links').addClass('line-shown');
13946
13947                $('#slide-out-widget-area .off-canvas-social-links li').css('opacity', '1').each(function (i) {
13948                    $(this).delay(i * 50).transition({
13949                        'scale': 1
13950                    }, 400, 'easeOutCubic');
13951                });
13952                $('#slide-out-widget-area .bottom-text').transition({
13953                    'opacity': 1
13954                }, 600, 'easeOutCubic');
13955            }, 200);
13956
13957        }
13958
13959        // Fade In BG Overlay
13960        var $opacity = 0.4;
13961
13962        if ($offCanvasBG.hasClass('solid')) {
13963            $opacity = 1;
13964        }
13965        if ($offCanvasBG.hasClass('dark')) {
13966            $opacity = 0.97;
13967        }
13968        if ($offCanvasBG.hasClass('medium')) {
13969            $opacity = 0.6;
13970        }
13971        if ($offCanvasBG.hasClass('light')) {
13972            $opacity = 0.4;
13973        }
13974        $offCanvasBG.removeClass('no-transition');
13975
13976
13977        if ($ocm_fullscreen_class === '.fullscreen-alt') {
13978
13979            $offCanvasBG.addClass('padding-removed').css({
13980                'height': '100%',
13981                'width': '100%',
13982                'left': '0',
13983                'opacity': $opacity
13984            });
13985
13986            // Overflow state
13987            OCM_overflowState();
13988
13989        }
13990
13991        setTimeout(function () {
13992            $('.slide-out-widget-area-toggle > div > a').removeClass('animating');
13993        }, 600);
13994
13995
13996        if ($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 &&
13997            $('.container-wrap').hasClass('no-scroll')) {
13998            $('#ajax-content-wrap').addClass('at-content');
13999        }
14000
14001        var fullScreenTopPadding = $headerOuterEl.outerHeight();
14002        if ($('body[data-contained-header="true"]').length > 0) {
14003            fullScreenTopPadding = $headerOuterEl.outerHeight() * 1.5;
14004        }
14005
14006        if ($ocm_fullscreen_class === '.fullscreen-alt') {
14007
14008            var headerOffset = $headerOuterEl.offset().top - nectarDOMInfo.scrollTop + nectarDOMInfo.secondaryHeaderHeight;
14009
14010            $('#slide-out-widget-area' + $ocm_fullscreen_class + ' > .inner-wrap').css('padding-top', ($headerOuterEl.outerHeight() + headerOffset));
14011
14012        } else {
14013            $('#slide-out-widget-area' + $ocm_fullscreen_class + ' > .inner-wrap').css('padding-top', fullScreenTopPadding);
14014        }
14015
14016    }
14017
14018
14019    /**
14020     * Off canvas menu: fullscreen alt close.
14021     *
14022     * @since 10.5
14023     */
14024    function OCM_fullscreenAltClose() {
14025
14026        var $ocm_fullscreen_class = '.fullscreen-alt';
14027
14028        if ($offCanvasEl.hasClass('fullscreen-inline-images')) {
14029            $ocm_fullscreen_class = '.fullscreen-inline-images';
14030
14031            $headerOuterEl.css({
14032                'z-index': '9990',
14033                'transition': 'transform 0.3s ease'
14034            });
14035            setTimeout(function () {
14036                $headerOuterEl.css({
14037                    'z-index': '',
14038                    'transition': ''
14039                });
14040            }, 450);
14041
14042
14043            if (!headerTransparent) {
14044                $headerOuterEl.removeClass('lighten-logo');
14045                $headerOuterEl.attr('data-transparent-header', '').removeClass('transparent');
14046            }
14047
14048            setTimeout(function () {
14049
14050                // Close submenu items
14051                $('#slide-out-widget-area .menuwrapper .menu').removeClass('subview');
14052                $('#slide-out-widget-area .menuwrapper .menu li').removeClass('subview subviewopen');
14053                $('#slide-out-widget-area.fullscreen-alt .inner .menu-wrap').css('height', 'auto');
14054
14055            }, 550);
14056
14057        } else if ($offCanvasEl.hasClass('fullscreen-split')) {
14058            $ocm_fullscreen_class = '.fullscreen-split';
14059        }
14060
14061        if ($('body.material').length > 0) {
14062            setTimeout(function () {
14063                $('header#top .slide-out-widget-area-toggle a').removeClass('menu-push-out');
14064            }, 350);
14065        }
14066
14067        $('.slide-out-widget-area-toggle:not(.std-menu) .lines-button:not(.legacy-double)').removeClass('close');
14068
14069
14070        $offCanvasBG.removeClass('open');
14071
14072        if ($ocm_fullscreen_class === '.fullscreen-split' ||
14073            $ocm_fullscreen_class === '.fullscreen-inline-images') {
14074            setTimeout(function () {
14075                $offCanvasBG.addClass('hidden');
14076                $('#slide-out-widget-area' + $ocm_fullscreen_class).addClass('hidden');
14077            }, 550);
14078        }
14079
14080        if ($ocm_fullscreen_class === '.fullscreen-alt') {
14081
14082            $('.blurred-wrap').removeClass('blurred');
14083
14084            $('#slide-out-widget-area.fullscreen-alt .widget').transition({
14085                'opacity': 0
14086            }, 500, 'easeOutQuad', function () {
14087                $(this).transition({
14088                    y: '40px'
14089                }, 0);
14090            });
14091            $('#slide-out-widget-area .bottom-text, #slide-out-widget-area .off-canvas-social-links li').transition({
14092                'opacity': 0
14093            }, 250, 'easeOutQuad');
14094            $('#slide-out-widget-area .off-canvas-social-links').removeClass('line-shown');
14095
14096            $('.off-canvas-menu-container .menu').transition({
14097                y: '-13px',
14098                'opacity': 0
14099            }, 400);
14100
14101        }
14102
14103
14104        setTimeout(function () {
14105
14106            if ($ocm_fullscreen_class === '.fullscreen-alt') {
14107
14108                $('.off-canvas-menu-container .menu > li').stop(true, true).transition({
14109                    y: '40px',
14110                    'opacity': 0
14111                }, 0);
14112                $('#slide-out-widget-area .off-canvas-social-links li').transition({
14113                    'scale': 0
14114                }, 0);
14115                $('#slide-out-widget-area .off-canvas-social-links').removeClass('line-shown');
14116
14117                // Close submenu items
14118                $('#slide-out-widget-area .menuwrapper .menu').removeClass('subview');
14119                $('#slide-out-widget-area .menuwrapper .menu li').removeClass('subview subviewopen');
14120                $('#slide-out-widget-area.fullscreen-alt .inner .menu-wrap').css('height', 'auto');
14121
14122                $offCanvasBG.css({
14123                    'height': '1px',
14124                    'width': '1px',
14125                    'left': '-100%'
14126                });
14127
14128            }
14129
14130            if ($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && $('.container-wrap').hasClass('no-scroll')) {
14131                $('#ajax-content-wrap').removeClass('at-content');
14132            }
14133
14134            if ($('.mobile #header-outer[data-permanent-transparent="false"]').length == 0) {
14135                $('#slide-out-widget-area' + $ocm_fullscreen_class + ' .inner-wrap').css('padding-top', '0');
14136            }
14137
14138            $('.slide-out-widget-area-toggle a').removeClass('animating');
14139
14140            if ($ocm_fullscreen_class === '.fullscreen-alt') {
14141                $('#slide-out-widget-area' + $ocm_fullscreen_class).hide().removeClass('open');
14142            }
14143
14144        }, 550);
14145
14146        if ($ocm_fullscreen_class === '.fullscreen-split' ||
14147            $ocm_fullscreen_class === '.fullscreen-inline-images') {
14148            $('#slide-out-widget-area' + $ocm_fullscreen_class).removeClass('open');
14149        }
14150
14151        setTimeout(function () {
14152            if ($('.nectar-social.fixed').length == 0) {
14153                showToTop();
14154            }
14155        }, 600);
14156
14157        // Fade out overlay
14158        setTimeout(function () {
14159            $offCanvasBG.removeClass('padding-removed');
14160        }, 50);
14161
14162
14163        var borderDelay = ($bodyBorderHeaderColorMatch == true) ? 150 : 50;
14164
14165        setTimeout(function () {
14166
14167            if ($ocm_fullscreen_class === '.fullscreen-alt') {
14168                $offCanvasBG.stop(true).css({
14169                    'opacity': 0
14170                });
14171            }
14172            if ($('#header-outer[data-transparent-header="true"]').length > 0) {
14173                $('body > div[class*="body-border"]').css('z-index', '10000');
14174            }
14175        }, borderDelay);
14176
14177        var rmTransparentTimeout = ($ocm_fullscreen_class == '.fullscreen-inline-images') ? 0 : 100;
14178        setTimeout(function () {
14179            $('#header-outer:not([data-permanent-transparent="1"]).transparent.small-nav, body[data-hhun="1"] #header-outer:not([data-permanent-transparent="1"]).transparent.scrolling, #header-outer:not([data-permanent-transparent="1"]).transparent.scrolled-down').removeClass('transparent');
14180
14181            if ($headerOuterEl.hasClass('pseudo-data-transparent')) {
14182
14183                $headerOuterEl.attr('data-transparent-header', 'false')
14184                    .removeClass('pseudo-data-transparent')
14185                    .removeClass('transparent');
14186            }
14187
14188        }, rmTransparentTimeout);
14189
14190    }
14191
14192
14193    /**
14194     * Off canvas menu: simple dropdown open.
14195     *
14196     * @since 10.5
14197     */
14198    function OCM_simpleDropdownOpen(classname) {
14199
14200        $('#mobile-menu').show();
14201
14202        $('header#top').find('.' + classname + ':not(.std-menu) .lines-button').addClass('close');
14203
14204        $('#header-outer').addClass('simple-ocm-open');
14205
14206        if ($('body.material').length > 0) {
14207            $('header#top').find('.' + classname + ' a').addClass('menu-push-out');
14208        }
14209
14210        setTimeout(function () {
14211            $('header#top').find('.' + classname + ' > div > a').removeClass('animating');
14212        }, 100);
14213
14214    }
14215
14216    /**
14217     * Off canvas menu: simple dropdown close.
14218     *
14219     * @since 10.5
14220     */
14221    function OCM_simpleDropdownClose(classname) {
14222
14223        $('#mobile-menu').hide();
14224
14225        $('body').find('.' + classname + ':not(.std-menu) .lines-button').removeClass('close');
14226
14227        $('#header-outer').removeClass('simple-ocm-open');
14228
14229        setTimeout(function () {
14230            if ($('body.material').length > 0) {
14231                $('header#top .' + classname + ' a').removeClass('menu-push-out');
14232            }
14233            $('body').find('.' + classname + ' a').removeClass('animating');
14234        }, 350);
14235    }
14236
14237
14238    /**
14239     * Off canvas menu: simple dropdown click events.
14240     *
14241     * @since 10.5
14242     */
14243    function OCM_simpleStyleInit() {
14244
14245        if ($('#header-outer #mobile-menu').length == 0) {
14246            return;
14247        }
14248
14249        $('#header-outer #mobile-menu li.megamenu').removeClass('megamenu');
14250
14251        // Add icons/markup.
14252        $('#header-outer #mobile-menu ul li a').each(function () {
14253            if (!$(this).hasClass('nectar-widget-link') && $(this).find('.nectar-ext-menu-item').length == 0) {
14254                $(this).wrapInner('<span></span>');
14255            }
14256        });
14257
14258        $('#header-outer #mobile-menu ul li').each(function () {
14259
14260            if ($(this).find('> ul').length > 0 || $(this).find('> .nectar-global-section-megamenu').length > 0) {
14261                $(this).find('> a').append('<span class="sf-sub-indicator"><i class="fa fa-angle-down"></i></span>');
14262            }
14263
14264        });
14265
14266        // Click event.
14267        $('#header-outer #mobile-menu').on('click', '.sf-sub-indicator', function () {
14268
14269            var $parentLI = $(this).parent().parent();
14270
14271            $parentLI.toggleClass('current-open-item');
14272
14273            // Open.
14274            if ($parentLI.hasClass('current-open-item')) {
14275                $parentLI.find('> ul, > .nectar-global-section-megamenu').show();
14276                setTimeout(function () {
14277                    $parentLI.addClass('visible');
14278                }, 30);
14279            } else {
14280                // Close.
14281                $parentLI.find('ul, .nectar-global-section-megamenu').hide();
14282                // Ensure open children also close.
14283                $parentLI.find('li').removeClass('visible').removeClass('current-open-item');
14284                $parentLI.removeClass('visible');
14285            }
14286
14287            return false;
14288
14289        });
14290
14291        // Resize event.
14292        $window.on('smartresize', function () {
14293
14294            if (nectarDOMInfo.winW > 1000 && $('.slide-out-widget-area-toggle.mobile-icon a.open').length > 0 ||
14295                nectarDOMInfo.winW > 1000 && $('.nectar-ocm-trigger-open.simple-mobile-menu a.open').length > 0) {
14296
14297                $('.slide-out-widget-area-toggle.mobile-icon a, .nectar-ocm-trigger-open.simple-mobile-menu a').addClass('non-human-allowed');
14298
14299
14300                $('.slide-out-widget-area-toggle.mobile-icon a.open, .nectar-ocm-trigger-open.simple-mobile-menu a.open').trigger('click');
14301
14302                setTimeout(function () {
14303                    $('.slide-out-widget-area-toggle.mobile-icon a, .nectar-ocm-trigger-open.simple-mobile-menu a').removeClass('non-human-allowed');
14304                }, 100);
14305
14306            }
14307
14308        });
14309
14310    }
14311
14312
14313    /**
14314     * Off canvas menu click triggered styles initialization
14315     *
14316     * @since 10.5
14317     */
14318    function OCM_clickTriggeredStylesInit() {
14319
14320        // trigger OCM open when clicked from delay JS
14321        if (window.nectarOcmOpen) {
14322            nectarOcmOpenCallback();
14323        }
14324
14325        // Click triggered open bind.
14326        $body.on('click', '.slide-out-widget-area-toggle:not(.std-menu) a.closed.animating', function () {
14327            return false;
14328        });
14329
14330        $body.on('click touchend', '.slide-out-widget-area-toggle:not(.std-menu) a.closed:not(.animating), .nectar-ocm-trigger-open', nectarOcmOpenCallback);
14331
14332        function nectarOcmOpenCallback() {
14333
14334            if (nectarState.ocmAnimating ||
14335                nectarBoxRoll.animating == 'true' ||
14336                $('.slide-out-from-right-hover').length > 0) {
14337                return false;
14338            }
14339
14340
14341            var ocmAnimationTimeout = 700;
14342
14343            nectarState.ocmOpen = true;
14344
14345            OCM_convertExtItems();
14346
14347            $headerOuterEl.removeClass('no-transition');
14348
14349            // Classic Mobile Direct Custom Link.
14350            if ($(this).hasClass('simple-mobile-menu')) {
14351                OCM_simpleDropdownOpen('simple-mobile-menu');
14352                $(this).find('a').addClass('open');
14353                return false;
14354            }
14355
14356            // Slide out from right.
14357            if ($offCanvasEl.hasClass('slide-out-from-right')) {
14358                OCM_slideOutRightOpen();
14359            }
14360            // Fullscreen.
14361            else if ($offCanvasEl.hasClass('fullscreen')) {
14362                OCM_fullscreenOpen();
14363            }
14364            // Fullscreen Alt.
14365            else if ($offCanvasEl.hasClass('fullscreen-alt') ||
14366                $offCanvasEl.hasClass('fullscreen-split')) {
14367                OCM_fullscreenAltOpen();
14368            } else if ($offCanvasEl.hasClass('fullscreen-inline-images')) {
14369                OCM_fullscreenInlineImagesOpen();
14370                ocmAnimationTimeout = 1100;
14371            }
14372            // Simple dropdown.
14373            else if ($('#header-outer #mobile-menu').length > 0) {
14374                ocmAnimationTimeout = 150;
14375                OCM_simpleDropdownOpen('slide-out-widget-area-toggle');
14376            }
14377
14378            nectarState.ocmAnimating = true;
14379            setTimeout(function () {
14380                nectarState.ocmAnimating = false;
14381            }, ocmAnimationTimeout);
14382
14383            // Add open class
14384            if ($('#header-outer #mobile-menu').length == 0 && !$offCanvasEl.hasClass('fullscreen-inline-images')) {
14385
14386                $headerOuterEl
14387                    .removeClass('side-widget-closed')
14388                    .addClass('side-widget-open');
14389
14390
14391                // Give header transparent state
14392                if ($('#header-outer[data-transparency-option="1"]').length > 0 &&
14393                    $('#boxed').length == 0 &&
14394                    $('#header-outer[data-full-width="true"]').length > 0 &&
14395                    !nectarDOMInfo.usingFrontEndEditor) {
14396
14397                    if ($('body.material[data-slide-out-widget-area-style="slide-out-from-right"]').length == 0 &&
14398                        $('body.material #header-outer[data-condense="true"]').length == 0) {
14399
14400                        $headerOuterEl.addClass('transparent');
14401
14402                    }
14403
14404                }
14405
14406                // Dark slide transparent nav
14407                if ($('#header-outer.dark-slide.transparent').length > 0 &&
14408                    $('#boxed').length == 0 &&
14409                    $('body.material-ocm-open').length == 0) {
14410                    $headerOuterEl
14411                        .removeClass('dark-slide')
14412                        .addClass('temp-removed-dark-slide');
14413                }
14414
14415
14416            } // Not using incompatible OCM.
14417
14418
14419            $('.slide-out-widget-area-toggle:not(.simple-mobile-menu) > div > a')
14420                .removeClass('closed')
14421                .addClass('open')
14422                .attr('aria-expanded', 'true');
14423
14424            $('.slide-out-widget-area-toggle:not(.simple-mobile-menu) > div > a').addClass('animating');
14425
14426            $(window).trigger('nectar-ocm-open');
14427
14428            return false;
14429
14430        }
14431
14432
14433        // Close event bind.
14434        $body.on('click', '.slide-out-widget-area-toggle:not(.std-menu) a.open.animating', function () {
14435            return false;
14436        });
14437
14438        $body.on('click', '.slide-out-widget-area-toggle:not(.std-menu) a.open:not(.animating), .nectar-ocm-trigger-open a.open, #slide-out-widget-area .slide_out_area_close, > .slide_out_area_close__wrap .slide_out_area_close, #slide-out-widget-area-bg.slide-out-from-right, .material-ocm-open #ajax-content-wrap, #ajax-content-wrap.ios-ocm-style-open', function (e) {
14439
14440
14441            if (e.originalEvent == undefined &&
14442                $('.slide_out_area_close.non-human-allowed').length == 0 &&
14443                $('.slide-out-widget-area-toggle.mobile-icon a.non-human-allowed').length == 0) {
14444                return;
14445            }
14446
14447            if (nectarState.ocmAnimating || $('.slide-out-widget-area-toggle:not(.std-menu) a.animating').length > 0) {
14448                return false;
14449            }
14450
14451            nectarState.ocmOpen = false;
14452
14453            $headerOuterEl.removeClass('no-transition');
14454
14455            // Classic Mobile Direct Custom Link.
14456            if ($(this).parents('.simple-mobile-menu').length > 0) {
14457                OCM_simpleDropdownClose('simple-mobile-menu');
14458                $(this).removeClass('open');
14459                return false;
14460            }
14461
14462            $('.slide-out-widget-area-toggle:not(.std-menu):not(.simple-mobile-menu) a')
14463                .removeClass('open')
14464                .addClass('closed')
14465                .attr('aria-expanded', 'false');
14466
14467            $('.slide-out-widget-area-toggle:not(.simple-mobile-menu):not(.std-menu) a')
14468                .addClass('animating');
14469
14470            // Slide out from right.
14471            if ($offCanvasEl.hasClass('slide-out-from-right')) {
14472                OCM_slideOutRightClose();
14473            }
14474
14475            // Fullscreen.
14476            else if ($offCanvasEl.hasClass('fullscreen')) {
14477                OCM_fullscreenClose();
14478            }
14479            // Fullscreen alt.
14480            else if ($offCanvasEl.hasClass('fullscreen-alt') ||
14481                $offCanvasEl.hasClass('fullscreen-split') ||
14482                $offCanvasEl.hasClass('fullscreen-inline-images')) {
14483                OCM_fullscreenAltClose();
14484            }
14485            // Simple dropdown.
14486            else if ($('#header-outer #mobile-menu').length > 0) {
14487                OCM_simpleDropdownClose('slide-out-widget-area-toggle');
14488            }
14489
14490            if ($('#header-outer #mobile-menu').length == 0) {
14491
14492                // Dark slide transparent nav
14493                if ($('#header-outer.temp-removed-dark-slide.transparent').length > 0 && $('#boxed').length == 0) {
14494                    $headerOuterEl
14495                        .removeClass('temp-removed-dark-slide')
14496                        .addClass('dark-slide');
14497                }
14498
14499                // Remove header transparent state
14500                if ($('#header-outer[data-permanent-transparent="1"]').length == 0 && $('#slide-out-widget-area.fullscreen-alt').length == 0) {
14501
14502                    if ($('.nectar-box-roll').length == 0) {
14503                        if ($('#header-outer.small-nav').length > 0 ||
14504                            $('#header-outer.scrolled-down').length > 0) {
14505                            $headerOuterEl.removeClass('transparent');
14506                        }
14507                    } else {
14508                        if ($('#header-outer.small-nav').length > 0 ||
14509                            $('#header-outer.scrolled-down').length > 0 ||
14510                            $('.container-wrap.auto-height').length > 0) {
14511                            $headerOuterEl.removeClass('transparent');
14512                        }
14513                    }
14514
14515                }
14516
14517                // Remove hidden menu
14518                $headerOuterEl.removeClass('hidden-menu');
14519
14520                $headerOuterEl
14521                    .removeClass('side-widget-open')
14522                    .addClass('side-widget-closed');
14523
14524            } // Not using simple OCM.
14525
14526            $(window).trigger('nectar-ocm-close');
14527
14528            return false;
14529
14530        });
14531
14532        /** ocm inline images */
14533        if ($offCanvasEl.hasClass('fullscreen-inline-images')) {
14534
14535            // Current page item.
14536            var currentItemClasses = '';
14537            if ($('#slide-out-widget-area .off-canvas-menu-container .menu > li[class*="current"]').length > 0) {
14538                currentItemClasses = $('#slide-out-widget-area .off-canvas-menu-container .menu > li[class*="current"]').attr('class');
14539            }
14540
14541            var currentID = extractMenuIdClassname(currentItemClasses);
14542
14543            if ($('.nectar-ocm-image.' + currentID).length > 0) {
14544                $('.nectar-ocm-image.default').remove();
14545                $('.nectar-ocm-image.' + currentID).addClass('current');
14546            }
14547
14548            // Mouse event.
14549            $('.off-canvas-menu-container .menu > .menu-item-has-children > a').on('click', function (e) {
14550                var classes = $(this).parent().attr('class');
14551                var id = extractMenuIdClassname(classes);
14552                if ($('.nectar-ocm-image.' + id).length > 0) {
14553                    $('.nectar-ocm-image.' + id).addClass('active-hold');
14554                    $('.nectar-ocm-image.current:not(.active-hold)').addClass('hidden');
14555                }
14556            });
14557            $('body').on('mousedown', '.off-canvas-menu-container .menu > .menu-item-has-children > ul > .back', function (e) {
14558                setTimeout(function () {
14559                    $('.nectar-ocm-image').removeClass('active-hold');
14560                }, 400);
14561            });
14562
14563            $('#slide-out-widget-area .off-canvas-menu-container li[class]').on('mouseenter', function () {
14564                var classes = $(this).attr('class');
14565                var id = extractMenuIdClassname(classes);
14566
14567                if ($('.nectar-ocm-image.active-hold').length === 0) {
14568                    $('.nectar-ocm-image.' + id).addClass('active');
14569                    if ($('.nectar-ocm-image.' + id).length > 0) {
14570                        $('.nectar-ocm-image.current:not(.active)').addClass('hidden');
14571                    }
14572                }
14573            });
14574            $('#slide-out-widget-area .off-canvas-menu-container li').on('mouseleave', function () {
14575                // don't remove when a sub menu is opened.
14576                if ($('.nectar-ocm-image.active-hold').length === 0) {
14577                    $('.nectar-ocm-image.active').removeClass('active');
14578                    $('.nectar-ocm-image.current').removeClass('hidden');
14579                }
14580            });
14581        }
14582
14583    }
14584
14585    function extractMenuIdClassname(classAttr) {
14586
14587        var currentItemClassesArr = classAttr.split(' ');
14588        var currentID = currentItemClassesArr.filter(function (classname) {
14589
14590            if (/[0-9]+$/.test(classname) && classname.indexOf('menu-item') !== -1) {
14591                return true;
14592            }
14593
14594            return false;
14595        });
14596
14597        if (currentID.length !== 1) {
14598            return 'not-found';
14599        }
14600
14601        return currentID.join('');
14602    }
14603
14604
14605    /**
14606     * Off canvas menu main initialization.
14607     *
14608     * @since 10.5
14609     */
14610    function OCM_init() {
14611
14612        // simplify ocm on mobile.
14613        if (bodyBorderVignette && $body.hasClass('material') && $offCanvasEl.hasClass('slide-out-from-right') ||
14614            window.nectarOptions &&
14615            window.nectarOptions.simplify_ocm_mobile === '1' &&
14616            nectarDOMInfo.usingMobileBrowser &&
14617            $offCanvasEl.hasClass('slide-out-from-right') && $('body.material').length > 0) {
14618
14619            $('body').attr('data-slide-out-widget-area-style', 'slide-out-from-right-hover');
14620
14621            $offCanvasEl.removeClass('slide-out-from-right');
14622            $offCanvasEl.addClass('slide-out-from-right-hover').addClass('ios-ocm-style');
14623
14624            if (bodyBorderVignette) {
14625                $('body').on('click', '#ajax-content-wrap.ios-ocm-style-open', function () {
14626                    $('.slide-out-widget-area-toggle a').trigger('click');
14627                });
14628            }
14629
14630            $('#slide-out-widget-area .inner > .widget').wrapAll('<div class="bottom-meta-wrap"></div>');
14631
14632        }
14633
14634
14635        if ($('#slide-out-widget-area.slide-out-from-right-hover').length > 0) {
14636            OCM_slideOutRightHoverInit();
14637        } else {
14638            OCM_clickTriggeredStylesInit();
14639            OCM_simpleStyleInit();
14640        }
14641
14642        if ($('#slide-out-widget-area').hasClass('fullscreen-inline-images')) {
14643            if ($('.off-canvas-menu-container .menu > li > a span.wrap').length == 0) {
14644                $('.off-canvas-menu-container .menu > li a').wrapInner('<span class="wrap"></span>');
14645            }
14646        }
14647
14648        if ($('#slide-out-widget-area.fullscreen-split').length == 0 &&
14649            $('body.material[data-slide-out-widget-area-style*="slide-out-from-right"]').length == 0 &&
14650            $('#slide-out-widget-area[data-dropdown-func="separate-dropdown-parent-link"]').length == 0) {
14651
14652            fullscreenMenuInit();
14653
14654        } else if ($('body.using-mobile-browser[data-slide-out-widget-area-style="slide-out-from-right-hover"]').length > 0) {
14655
14656            // Close OCM on mobile when clicking anchor on same page
14657            $('body #slide-out-widget-area .inner .off-canvas-menu-container li a[href*="#"]').on('click', function () {
14658                if ($(this).attr('href') != '#') {
14659                    OCM_close($(this).parent());
14660                }
14661            });
14662
14663        }
14664
14665        // Page fullscreen row close OCM fullscreen/classic slide out from right
14666        if ($('#nectar_fullscreen_rows').length > 0 && ($('body[data-slide-out-widget-area-style*="fullscreen"]').length > 0 || $('body[data-slide-out-widget-area-style="slide-out-from-right"]:not(.material)').length > 0)) {
14667
14668            $('body #slide-out-widget-area .inner .off-canvas-menu-container li a[href]').on('click', function () {
14669
14670                var $link_href = ($(this).is('[href*="#"]')) ? $(this).attr('href') : '';
14671                if ($link_href != '#' && $('div[data-fullscreen-anchor-id="' + $link_href.substr($link_href.indexOf("#") + 1) + '"]').length > 0) {
14672
14673                    setTimeout(function () {
14674
14675                        $('#slide-out-widget-area .slide_out_area_close')
14676                            .addClass('non-human-allowed')
14677                            .trigger('click');
14678
14679                    }, 100);
14680
14681                    setTimeout(function () {
14682                        $('#slide-out-widget-area .slide_out_area_close').removeClass('non-human-allowed');
14683                    }, 150);
14684
14685                }
14686
14687            });
14688        }
14689
14690
14691        // Submenu link hover fix
14692        $body.on('mouseover', '#slide-out-widget-area .off-canvas-menu-container .menuwrapper > .sub-menu li > a', function () {
14693            var $currentTxt = $(this).text();
14694            $('.off-canvas-menu-container .menuwrapper .menu li > a').removeClass('hovered');
14695            $('.off-canvas-menu-container .menuwrapper .menu li > a:contains(' + $currentTxt + ')').addClass('hovered');
14696        });
14697
14698        $body.on('mouseover', '.off-canvas-menu-container .menuwrapper .menu li > a', function () {
14699            $('.off-canvas-menu-container .menuwrapper .menu li > a').removeClass('hovered');
14700        });
14701
14702
14703    }
14704
14705
14706    /**
14707     * Off canvas menu close.
14708     *
14709     * @since 10.5
14710     */
14711    function OCM_close(item) {
14712
14713        if ($('#slide-out-widget-area.open').length > 0) {
14714
14715            var $windowCurrentLocation = window.location.href.split("#")[0];
14716            var $windowClickedLocation = item.find('> a').attr('href').split("#")[0];
14717
14718            if ($windowCurrentLocation == $windowClickedLocation || item.find('a[href^="#"]').length > 0) {
14719                if (item.parents('.slide-out-from-right-hover').length > 0) {
14720                    $('.slide-out-widget-area-toggle.slide-out-hover-icon-effect a').trigger('click');
14721                } else {
14722                    $('.slide-out-widget-area-toggle a').addClass('non-human-allowed').trigger('click');
14723                    setTimeout(function () {
14724                        $('.slide-out-widget-area-toggle a').removeClass('non-human-allowed');
14725                    }, 100);
14726                }
14727
14728            }
14729        }
14730
14731    }
14732
14733
14734    /**
14735     * Click based submenus.
14736     *
14737     * Used by left header layout and off canvas menu.
14738     *
14739     * @since 10.5
14740     */
14741    function clickToggleSubmenus() {
14742
14743        if (!$('#header-outer[data-format="left-header"]').length > 0 &&
14744            !$('body.material[data-slide-out-widget-area-style*="slide-out-from-right"]').length > 0 &&
14745            !$('#slide-out-widget-area.fullscreen-split').length > 0 &&
14746            !$('#slide-out-widget-area[data-dropdown-func="separate-dropdown-parent-link"]').length > 0) {
14747            return;
14748        }
14749
14750        // Remove megamenu class.
14751        $('#header-outer[data-format="left-header"] nav li.megamenu').removeClass('nectar-megamenu-menu-item').removeClass('megamenu');
14752
14753        var $ocm_link_selector;
14754
14755        if ($('#slide-out-widget-area[data-dropdown-func="separate-dropdown-parent-link"]').length > 0) {
14756            $ocm_link_selector = '#slide-out-widget-area .off-canvas-menu-container li.menu-item-has-children > .ocm-dropdown-arrow';
14757        } else {
14758            $ocm_link_selector = 'body.material #slide-out-widget-area[class*="slide-out-from-right"] .off-canvas-menu-container li.menu-item-has-children > a, #slide-out-widget-area.fullscreen-split .off-canvas-menu-container li.menu-item-has-children > a';
14759        }
14760
14761        var left_header_selector = '#header-outer[data-format="left-header"] nav li.menu-item-has-children > a';
14762        var lh_dropdown_func = (window.nectarOptions && window.nectarOptions.left_header_dropdown_func) ? window.nectarOptions.left_header_dropdown_func : 'default';
14763        if (lh_dropdown_func === 'separate-dropdown-parent-link') {
14764            left_header_selector = '#header-outer[data-format="left-header"] nav li.menu-item-has-children > a .sf-sub-indicator';
14765        }
14766
14767        // Click event.
14768        $(left_header_selector + ', ' + $ocm_link_selector).on('click', function () {
14769
14770            var $parentSelector = $(this).parent();
14771            if (lh_dropdown_func === 'separate-dropdown-parent-link') {
14772                $parentSelector = $(this).closest('.menu-item');
14773            }
14774
14775            if ($parentSelector.hasClass('open-submenu')) {
14776                $parentSelector.find('.sub-menu').css({
14777                    'max-height': '0'
14778                });
14779                $parentSelector.removeClass('open-submenu');
14780            } else {
14781
14782                // Get max height.
14783                var $that = $(this);
14784                var $maxSubMenuHeight;
14785
14786                $parentSelector
14787                    .find('> .sub-menu')
14788                    .addClass('no-trans');
14789
14790                setTimeout(function () {
14791
14792                    $parentSelector.find('> .sub-menu').css({
14793                        'max-height': 'none',
14794                        'position': 'absolute',
14795                        'visibility': 'hidden'
14796                    });
14797
14798                    $maxSubMenuHeight = $parentSelector.find('> .sub-menu').height();
14799
14800                    $parentSelector
14801                        .find('> .sub-menu')
14802                        .removeClass('no-trans');
14803
14804                    $parentSelector.find('> .sub-menu').css({
14805                        'max-height': '0',
14806                        'position': 'relative',
14807                        'visibility': 'visible'
14808                    });
14809
14810                }, 25);
14811
14812                setTimeout(function () {
14813
14814                    // Reset Max Height.
14815                    $that.closest('ul')
14816                        .find('li.menu-item-has-children')
14817                        .removeClass('open-submenu');
14818
14819                    $that.closest('ul').find('li.menu-item-has-children > .sub-menu').css({
14820                        'max-height': '0'
14821                    });
14822
14823                    $parentSelector.addClass('open-submenu');
14824
14825                    $parentSelector
14826                        .find('> .sub-menu')
14827                        .css('max-height', $maxSubMenuHeight);
14828
14829                    // Add height to open parents.
14830                    if ($that.parents('ul').length > 0) {
14831
14832                        $that.parents('ul:not(.sf-menu)').each(function () {
14833                            $(this).css('max-height');
14834                            $(this).css('max-height', parseInt($(this).height() + parseInt($(this).css('padding-top')) * 2 + $maxSubMenuHeight) + 'px');
14835                        });
14836                    }
14837
14838
14839                }, 50);
14840            }
14841
14842            return false;
14843
14844        });
14845
14846        // Start open for current page items.
14847        var $topLevelAncestor = $('#header-outer[data-format="left-header"] nav .sf-menu > .current-menu-ancestor.menu-item-has-children');
14848
14849        if ($topLevelAncestor.length > 0 && $topLevelAncestor.find('.current-menu-item').length > 0) {
14850
14851            $topLevelAncestor.find('ul').css('transition', 'none');
14852
14853            var $activeAncestors = $topLevelAncestor.find('.current-menu-item').parents('.current-menu-ancestor.menu-item-has-children');
14854            $activeAncestors = Array.from($activeAncestors);
14855
14856
14857            if (lh_dropdown_func === 'separate-dropdown-parent-link') {
14858                $activeAncestors.reverse().forEach(function (el) {
14859                    $(el).find('> a .sf-sub-indicator').trigger('click');
14860                });
14861            } else {
14862                $activeAncestors.reverse().forEach(function (el) {
14863                    $(el).find('> a').trigger('click');
14864                });
14865            }
14866
14867            setTimeout(function () {
14868                $topLevelAncestor.find('ul').css('transition', '');
14869            }, 100);
14870
14871        }
14872
14873
14874    }
14875
14876
14877    /**
14878     * DLMenu - plugin used for submenus in off canvas menu.
14879     *
14880     * @since 6.0
14881     */
14882    $.DLMenu = function (options, element) {
14883        this.$el = $(element);
14884        this._init(options);
14885    };
14886
14887    // the options
14888    $.DLMenu.defaults = {
14889        // classes for the animation effects
14890        animationClasses: {
14891            classin: 'dl-animate-in-1',
14892            classout: 'dl-animate-out-1'
14893        },
14894        onLevelClick: function () {
14895            return false;
14896        },
14897        onLinkClick: function () {
14898            return false;
14899        }
14900    };
14901
14902    $.DLMenu.prototype = {
14903        _init: function (options) {
14904
14905            // options
14906            this.options = $.extend(true, {}, $.DLMenu.defaults, options);
14907            this._config();
14908
14909            var animEndEventNames = {
14910                    'WebkitAnimation': 'webkitAnimationEnd',
14911                    'OAnimation': 'oAnimationEnd',
14912                    'msAnimation': 'MSAnimationEnd',
14913                    'animation': 'animationend'
14914                },
14915                transEndEventNames = {
14916                    'WebkitTransition': 'webkitTransitionEnd',
14917                    'MozTransition': 'transitionend',
14918                    'OTransition': 'oTransitionEnd',
14919                    'msTransition': 'MSTransitionEnd',
14920                    'transition': 'transitionend'
14921                };
14922            // animation end event name
14923            this.animEndEventName = animEndEventNames['animation'] + '.menu';
14924            // transition end event name
14925            this.transEndEventName = transEndEventNames['transition'] + '.menu',
14926                // support for css animations and css transitions
14927                this.supportAnimations = true,
14928                this.supportTransitions = true;
14929            this._initEvents();
14930
14931        },
14932        _config: function () {
14933            this.open = false;
14934            this.$trigger = this.$el.children('.trigger');
14935            this.$menu = this.$el.children('ul.menu');
14936            this.$menuitems = this.$menu.find('li:not(.back) > a');
14937
14938            this.$el.find('.sub-menu')
14939                .prepend('<li class="back"><a href="#"> ' + $offCanvasEl.attr('data-back-txt') + ' </a></li>');
14940
14941            this.$back = this.$menu.find('li.back');
14942        },
14943        _initEvents: function () {
14944
14945            var self = this;
14946
14947            this.$trigger.on('click.menu', function () {
14948
14949                if (self.open) {
14950                    self._closeMenu();
14951                } else {
14952                    self._openMenu();
14953                }
14954                return false;
14955
14956            });
14957
14958            this.$menuitems.on('click.menu', function (event) {
14959
14960
14961                var $item = $(this).parent('li'),
14962                    $submenu = $item.children('.sub-menu');
14963
14964                $('.fullscreen-alt .off-canvas-menu-container .clip-wrap, .fullscreen-alt .off-canvas-menu-container .clip-wrap span').css('transition-duration', '0s');
14965
14966                if ($submenu.length > 0) {
14967
14968                    var $flyin = $submenu.clone().css('opacity', 0).insertAfter(self.$menu),
14969                        onAnimationEndFn = function () {
14970                            self.$menu.off(self.animEndEventName).removeClass(self.options.animationClasses.classout).addClass('subview');
14971                            $item.addClass('subviewopen').parents('.subviewopen:first').removeClass('subviewopen').addClass('subview');
14972                            $flyin.remove();
14973                            setTimeout(function () {
14974                                $('.off-canvas-menu-container .menu > li').removeClass('no-pointer-events');
14975                                $('.off-canvas-menu-container .clip-wrap, .off-canvas-menu-container .clip-wrap span').css('transition-duration', '.45s');
14976                            }, 300);
14977
14978                        };
14979
14980                    setTimeout(function () {
14981                        $flyin.addClass(self.options.animationClasses.classin);
14982                        self.$menu.addClass(self.options.animationClasses.classout);
14983                        if (self.supportAnimations) {
14984                            self.$menu.on(self.animEndEventName, onAnimationEndFn);
14985                        } else {
14986                            onAnimationEndFn.call();
14987                        }
14988
14989                        self.options.onLevelClick($item, $item.children('a:first').text());
14990                    });
14991
14992
14993                    $item.parents('.menu-wrap').css('height', $item.parents('.off-canvas-menu-container').find('.menuwrapper .menu').height()).transition({
14994                        'height': $flyin.height()
14995                    }, 500, 'easeInOutQuad');
14996
14997                    setTimeout(OCM_overflowState, 600);
14998
14999                    return false;
15000
15001                } else {
15002
15003                    self.options.onLinkClick($item.find('> a'), event);
15004                }
15005
15006                OCM_close($item);
15007
15008            });
15009
15010
15011            this.$back.on('click.menu', function () {
15012
15013                var $this = $(this),
15014                    $submenu = $this.parents('.sub-menu:first'),
15015                    $item = $submenu.parent(),
15016                    $flyin = $submenu.clone().insertAfter(self.$menu);
15017
15018                var onAnimationEndFn = function () {
15019                    self.$menu.off(self.animEndEventName).removeClass(self.options.animationClasses.classin);
15020                    $flyin.remove();
15021                };
15022
15023                setTimeout(function () {
15024                    $flyin.addClass(self.options.animationClasses.classout);
15025                    self.$menu.addClass(self.options.animationClasses.classin);
15026                    if (self.supportAnimations) {
15027                        self.$menu.on(self.animEndEventName, onAnimationEndFn);
15028                    } else {
15029                        onAnimationEndFn.call();
15030                    }
15031
15032                    $item.removeClass('subviewopen');
15033
15034                    var $subview = $this.parents('.subview:first');
15035                    if ($subview.is('li')) {
15036                        $subview.addClass('subviewopen');
15037                    }
15038                    $subview.removeClass('subview');
15039                });
15040
15041
15042                setTimeout(function () {
15043                    $item.parents('.menu-wrap').transition({
15044                        'height': $item.parent().height()
15045                    }, 500, 'easeInOutQuad');
15046                    setTimeout(OCM_overflowState, 600);
15047                }, 50);
15048
15049
15050                return false;
15051
15052            });
15053
15054        },
15055        closeMenu: function () {
15056            if (this.open) {
15057                this._closeMenu();
15058            }
15059        },
15060        _closeMenu: function () {
15061            var self = this,
15062                onTransitionEndFn = function () {
15063                    self.$menu.off(self.transEndEventName);
15064                    self._resetMenu();
15065                };
15066
15067            this.$menu.removeClass('menuopen');
15068            this.$menu.addClass('menu-toggle');
15069            this.$trigger.removeClass('active');
15070
15071            if (this.supportTransitions) {
15072                this.$menu.on(this.transEndEventName, onTransitionEndFn);
15073            } else {
15074                onTransitionEndFn.call();
15075            }
15076
15077            this.open = false;
15078        },
15079        openMenu: function () {
15080            if (!this.open) {
15081                this._openMenu();
15082            }
15083        },
15084        _openMenu: function () {
15085            var self = this;
15086            $body.off('click').on('click.menu', function () {
15087                self._closeMenu();
15088            });
15089            this.$menu.addClass('menuopen menu-toggle').on(this.transEndEventName, function () {
15090                $(this).removeClass('menu-toggle');
15091            });
15092            this.$trigger.addClass('active');
15093            this.open = true;
15094        },
15095        _resetMenu: function () {
15096
15097            this.$menu.removeClass('subview');
15098            this.$menuitems.removeClass('subview subviewopen');
15099
15100        }
15101    };
15102
15103    var logError = function (message) {
15104        if (window.console) {
15105            window.console.error(message);
15106        }
15107    };
15108
15109    $.fn.dlmenu = function (options) {
15110        if (typeof options === 'string') {
15111            var args = Array.prototype.slice.call(arguments, 1);
15112            this.each(function () {
15113                var instance = $.data(this, 'menu');
15114                if (!instance) {
15115                    logError("cannot call methods on menu prior to initialization; " +
15116                        "attempted to call method '" + options + "'");
15117                    return;
15118                }
15119                // TODO: isFunction is dep - also in hoverIntent
15120                if (!$.isFunction(instance[options]) || options.charAt(0) === "_") {
15121                    logError("no such method '" + options + "' for menu instance");
15122                    return;
15123                }
15124                instance[options].apply(instance, args);
15125            });
15126        } else {
15127            this.each(function () {
15128                var instance = $.data(this, 'menu');
15129                if (instance) {
15130                    instance._init();
15131                } else {
15132                    instance = $.data(this, 'menu', new $.DLMenu(options, this));
15133                }
15134            });
15135        }
15136        return this;
15137    };
15138
15139
15140    /**
15141     * Initialize DL menu.
15142     *
15143     * @since 6.0
15144     */
15145    function fullscreenMenuInit() {
15146
15147        $('#slide-out-widget-area .off-canvas-menu-container .menu').wrap('<div class="menu-wrap menuwrapper" />');
15148        $('#slide-out-widget-area .off-canvas-menu-container .menu').addClass('menuopen');
15149
15150        var $ocmAnimationClassNum = ($('#slide-out-widget-area.fullscreen-alt').length > 0 || $('#slide-out-widget-area.fullscreen-inline-images').length > 0) ? '4' : '5';
15151        $('#slide-out-widget-area .off-canvas-menu-container .menu-wrap').dlmenu({
15152            animationClasses: {
15153                classin: 'dl-animate-in-' + $ocmAnimationClassNum,
15154                classout: 'dl-animate-out-' + $ocmAnimationClassNum
15155            }
15156        });
15157
15158    }
15159
15160
15161    /**
15162     * Set the page header height when using "slide down" theme option effect.
15163     *
15164     * @since 2.0
15165     */
15166    function pageHeaderSlideInHeight() {
15167
15168        var pageHeaderHeight = parseInt($pageHeaderBG.outerHeight());
15169        $('body[data-aie="slide-down"] #page-header-wrap:not(.fullscreen-header):not([data-responsive="true"])').css('height', pageHeaderHeight + 'px');
15170
15171    }
15172
15173
15174    /**
15175     * Fired after page header image has loaded.
15176     *
15177     * @since 2.0
15178     */
15179    function pageHeaderAfterLoad() {
15180
15181        //fade in header
15182        if ($('#ajax-content-wrap').length == 0 || !$body.hasClass('ajax-loaded')) {
15183            $('#page-header-bg[data-parallax="1"]').animate({
15184                'opacity': 1
15185            }, 350, 'easeInCubic');
15186        } else if ($('#ajax-content-wrap').length == 1) {
15187            $('#page-header-bg[data-parallax="1"]').css({
15188                'opacity': 1
15189            });
15190        }
15191
15192        $('#page-header-bg[data-parallax="1"] .nectar-particles').append('<div class="fade-out" />');
15193
15194    }
15195
15196
15197    /**
15198     * Page header unload event.
15199     *
15200     * @since 2.0
15201     */
15202    function pageHeaderUnload() {
15203
15204        if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1 || navigator.userAgent.match(/(iPod|iPhone|iPad)/)) {
15205            window.onunload = function () {
15206
15207                pageHeaderInit();
15208
15209                $('#page-header-bg[data-parallax="1"] .span_6').css({
15210                    'opacity': 1
15211                });
15212
15213            };
15214        }
15215
15216    }
15217
15218
15219    /**
15220     * Page header initialization.
15221     *
15222     * @since 2.0
15223     */
15224    function pageHeaderInit() {
15225
15226        var pageHeaderState = {
15227            inView: true
15228        }
15229
15230        var $pageHeaderInnerEl = $('#page-header-bg .span_6 .inner-wrap');
15231        var $pageHeaderCanvasEl = $('#page-header-bg #canvas');
15232
15233        if ($('#page-header-bg[data-parallax="1"]').length > 0) {
15234
15235            // Fade in
15236            var img = new Image(),
15237                pageHeaderHeight = parseInt($pageHeaderBG.height()),
15238                headerSpaceHeight = $('#header-space').height(),
15239                globalTopSectionHeight = ($('.nectar-global-section.after-nav').length > 0) ? $('.nectar-global-section.after-nav').height() : 0,
15240                $initialImgCheck = extractUrl($('#page-header-bg[data-parallax="1"]').css('background-image'));
15241
15242            if ($initialImgCheck && $initialImgCheck.indexOf('.') !== -1) {
15243                img.onload = function () {
15244                    pageHeaderAfterLoad();
15245                };
15246
15247                img.src = extractUrl($('#page-header-bg[data-parallax="1"]').css('background-image'));
15248
15249            } else {
15250                pageHeaderAfterLoad();
15251            }
15252
15253
15254            // Calculate on scroll.
15255            if (nectarDOMInfo.winW > 1000) {
15256                parallaxPageHeaderCalc();
15257            }
15258            window.addEventListener('scroll', function () {
15259                if (nectarDOMInfo.winW > 1000) {
15260                    window.requestAnimationFrame(parallaxPageHeaderCalc);
15261                }
15262            }, false);
15263
15264        }
15265
15266        var $pt_timeout = ($('body[data-ajax-transitions="true"]').length > 0 && $('#page-header-bg[data-animate-in-effect="slide-down"]').length > 0) ? 350 : 0;
15267
15268        if ($pageHeaderBG.length > 0) {
15269
15270            // Slide in height effect.
15271            setTimeout(function () {
15272                pageHeaderSlideInHeight();
15273            }, $pt_timeout);
15274
15275            $('#page-header-bg[data-animate-in-effect="fade-in"]').addClass('loaded');
15276
15277            // Using bg classname.
15278            var $initialImgCheckAscend = extractUrl($pageHeaderBG.css('background-image'));
15279            if ($initialImgCheckAscend && $initialImgCheckAscend.indexOf('.') !== -1) {
15280                $pageHeaderBG.addClass('has-bg');
15281            }
15282
15283            // Resize slide in height.
15284            $window.on('smartresize', pageHeaderSlideInHeight);
15285
15286        }
15287
15288
15289        function parallaxPageHeaderCalc() {
15290
15291            var $multiplier = 0.15;
15292
15293            if (nectarDOMInfo.winW >= 1000 &&
15294                navigator.userAgent.match(/iPad/i) == null &&
15295                nectarState.materialOffCanvasOpen != true) {
15296
15297                // Calc parallax.
15298                if (pageHeaderState.inView == true) {
15299
15300                    $pageHeaderInnerEl.css({
15301                        'transform': 'translateY(' + nectarDOMInfo.scrollTop * $multiplier + 'px)',
15302                        'opacity': 1 - (nectarDOMInfo.scrollTop / ((globalTopSectionHeight + pageHeaderHeight) * .7))
15303                    });
15304
15305                    if ($pageHeaderCanvasEl) {
15306                        $pageHeaderCanvasEl.css({
15307                            'transform': 'translateY(' + nectarDOMInfo.scrollTop * $multiplier * 2 + 'px)'
15308                        });
15309                    }
15310
15311                }
15312
15313                // Hide elements to allow other parallax sections to work in webkit browsers.
15314                if ((nectarDOMInfo.scrollTop / (pageHeaderHeight + headerSpaceHeight + nectarDOMInfo.adminBarHeight)) > 1) {
15315                    pageHeaderState.inView = false;
15316                    $('.nectar-particles, #page-header-bg .fade-out').css('visibility', 'hidden').addClass('out-of-sight');
15317                    $('#page-header-bg').addClass('out-of-sight');
15318                } else {
15319                    pageHeaderState.inView = true;
15320                    $('#page-header-bg, .nectar-particles, #page-header-bg .fade-out').css('visibility', 'visible').removeClass('out-of-sight');
15321                }
15322
15323            }
15324
15325        }
15326
15327        if ($pageHeaderBG.length > 0) {
15328
15329            // Bind unload event
15330            pageHeaderUnload();
15331
15332            // Initialize text effects.
15333            if ($('.nectar-box-roll').length == 0) {
15334                pageHeaderTextEffectInit();
15335            }
15336
15337        }
15338
15339    }
15340
15341
15342    /**
15343     * Page header text effect markup creation.
15344     *
15345     * @since 6.0
15346     */
15347    function pageHeaderTextEffectMarkup() {
15348
15349        $pageHeaderBG.each(function () {
15350
15351            if ($(this).attr('data-text-effect') == 'rotate_in') {
15352
15353                var $topHeading = 'none';
15354
15355                if ($(this).find('.span_6 h1').length > 0) {
15356                    $topHeading = 'h1';
15357                }
15358
15359                if ($topHeading != 'none') {
15360
15361                    var $selector = ($(this).find('.nectar-particles').length > 0) ? '.inner-wrap.shape-1' : '.span_6';
15362
15363                    $(this).find($selector).find($topHeading).addClass('top-heading').contents().filter(function () {
15364                        return this.nodeType === 3 && typeof this.data != 'undefined' && this.data.replace(/\s+/, "");
15365                    }).wrap('<span class="wraped"></span>');
15366
15367                    $(this).find($selector).find('.wraped').each(function () {
15368
15369                        var textNode = $(this),
15370                            text = textNode.text().split(' '),
15371                            replace = '';
15372
15373                        $.each(text, function (index, value) {
15374                            if (value.replace(/\s+/, "")) {
15375                                replace += '<span class="wraped"><span>' + value + '</span></span> ';
15376                            }
15377                        });
15378
15379                        textNode.replaceWith($(replace));
15380
15381                    });
15382
15383                }
15384
15385            }
15386
15387        });
15388
15389    }
15390
15391
15392    /**
15393     * Page header text effect animation.
15394     *
15395     * @since 6.0
15396     */
15397    function pageHeaderTextEffect() {
15398
15399        if ($('#page-header-bg .nectar-particles').length == 0 && $('#page-header-bg[data-text-effect="none"]').length == 0 ||
15400            $('.nectar-box-roll').length > 0 && $('#page-header-bg .nectar-particles').length == 0) {
15401
15402            var $selector = ($('.nectar-box-roll').length == 0) ? '#page-header-bg .span_6' : '.nectar-box-roll .overlaid-content .span_6';
15403
15404            $($selector).find('.wraped').each(function (i) {
15405                $(this).find('span').delay(i * 370).transition({
15406                    rotateX: '0',
15407                    'opacity': 1,
15408                    y: 0
15409                }, 400, 'easeOutQuad');
15410            });
15411
15412            setTimeout(function () {
15413
15414                $($selector).find('.inner-wrap > *:not(.top-heading)').each(function (i) {
15415                    $(this).delay(i * 370).transition({
15416                        rotateX: '0',
15417                        'opacity': 1,
15418                        y: 0
15419                    }, 650, 'easeOutQuad');
15420                });
15421
15422                $('.scroll-down-wrap, .scroll-down-wrap .section-down-arrow').removeClass('hidden');
15423
15424            }, $($selector).find('.wraped').length * 370);
15425        }
15426
15427    }
15428
15429
15430    /**
15431     * Page header text effect initialization.
15432     *
15433     * @since 6.0
15434     */
15435    function pageHeaderTextEffectInit() {
15436
15437        pageHeaderTextEffectMarkup();
15438
15439        var $effectTimeout = ($loadingScreenEl.length > 0) ? 800 : 0;
15440
15441        if ($('#page-header-bg .nectar-video-wrap video').length == 0) {
15442            setTimeout(pageHeaderTextEffect, $effectTimeout);
15443        }
15444
15445    }
15446
15447
15448    /**
15449     * Permanent transparent header effect.
15450     *
15451     * @since 6.0
15452     */
15453    function midnightInit() {
15454
15455        if ($('#header-outer[data-permanent-transparent="1"]').length > 0 &&
15456            $('body[data-bg-header="true"]').length > 0) {
15457
15458
15459            // Pages that set no midnight coloring.
15460            if ($('.container-wrap div[data-midnight]').length == 0) {
15461                $('.container-wrap').attr('data-midnight', 'dark');
15462            }
15463
15464            //// Cache midnight compat divs.
15465            var $midnightCompatArr = [];
15466            $('div[data-midnight]:not(.has-global-section)').each(function () {
15467
15468                if ($(this).attr('data-midnight') == 'light' && $(this).parents('.pum-content').length == 0 ||
15469                    $(this).attr('data-midnight') == 'dark' && $(this).parents('.pum-content').length == 0) {
15470
15471                    if (($(this).is('#page-header-bg') && $(this).parents('#page-header-wrap[data-midnight]').length > 0) ||
15472                        $(this).parents('#slide-out-widget-area').length > 0) {
15473                        // skip.
15474                    } else {
15475                        $midnightCompatArr.push($(this));
15476                    }
15477
15478                }
15479
15480            });
15481
15482
15483            if ($midnightCompatArr.length > 0) {
15484
15485                $.each($midnightCompatArr, function (k, v) {
15486
15487                    if (v.attr('data-midnight') == 'light' || v.attr('data-midnight') == 'dark') {
15488
15489                        var $that = v;
15490                        var waypoint = new Waypoint({
15491                            element: $that[0],
15492                            handler: function (direction) {
15493
15494
15495                                if ($('body.material-ocm-open').length > 0 ||
15496                                    $('#slide-out-widget-area.open').length > 0 ||
15497                                    $that.css('display') == 'none') {
15498                                    return;
15499                                }
15500
15501
15502                                var $textColor;
15503
15504                                if (direction == 'down') {
15505                                    $textColor = ($that.attr('data-midnight') == 'light') ? '' : 'dark-slide';
15506                                    $headerOuterEl.removeClass('dark-slide').addClass($textColor);
15507
15508                                } else {
15509
15510                                    var $prevMidItem;
15511
15512                                    if (k - 1 >= 0) {
15513                                        $prevMidItem = k - 1;
15514                                    } else {
15515                                        $prevMidItem = k;
15516                                    }
15517
15518                                    $textColor = ($midnightCompatArr[$prevMidItem].attr('data-midnight') == 'light') ? '' : 'dark-slide';
15519                                    $headerOuterEl.removeClass('dark-slide').addClass($textColor);
15520
15521                                }
15522
15523                            },
15524                            offset: $headerOuterEl.height()
15525
15526                        });
15527
15528                    }
15529
15530                });
15531
15532            }
15533
15534        }
15535
15536
15537    }
15538
15539
15540    /**
15541     * Box roll header effect initialization.
15542     *
15543     * @since 6.0
15544     */
15545    function nectarBoxRollInit() {
15546
15547        if (window.nectarOptions &&
15548            window.nectarOptions.disable_box_roll_mobile &&
15549            window.nectarOptions.disable_box_roll_mobile == 'on' &&
15550            nectarDOMInfo.usingMobileBrowser
15551        ) {
15552            $('.nectar-box-roll').contents().unwrap();
15553            $('.overlaid-content > .container').contents().unwrap();
15554            $('.overlaid-content').contents().unwrap();
15555            $('#page-header-bg').wrap('<div id="page-header-wrap" class="fullscreen-header" />');
15556            return;
15557        }
15558
15559        if ($('.nectar-box-roll').length > 0 && typeof NectarBoxRoll !== 'undefined') {
15560
15561            pageHeaderTextEffectInit();
15562
15563            // listen for emits.
15564            $(window).on('nectar-box-roll-scroll-disabled', function () {
15565                nectarState.preventScroll = true;
15566            });
15567            $(window).on('nectar-box-roll-scroll-enabled', function () {
15568                nectarState.preventScroll = false;
15569            });
15570
15571            nectarBoxRoll = new NectarBoxRoll(nectarDOMInfo, waypoints, midnightInit, pageLoadHash, resizeVideoToCover);
15572            nectarBoxRoll.inUse = true;
15573        }
15574    }
15575
15576
15577    /**
15578     * Create all waypoints.
15579     *
15580     * @since 6.0
15581     */
15582    function waypoints() {
15583
15584        rowBGAnimations();
15585        columnBGAnimations();
15586        colAndImgAnimations();
15587        progressBars();
15588        dividers();
15589        iconList();
15590        animatedTitles();
15591        highlightedText();
15592        imageWithHotspots();
15593        clientsFadeIn();
15594        splitLineHeadings();
15595        if (typeof Vivus !== 'undefined') {
15596            svgAnimations();
15597        } else {
15598            nectarScriptLoadedCallback('#vivus-js', 100, function () {
15599                svgAnimations();
15600            });
15601        }
15602        milestoneInit();
15603        nectarFancyUlInit();
15604        owl_carousel_animate();
15605        headerRowColorInheritInit();
15606        morphingOutlines();
15607        animatedColBorders();
15608        foodMenuItems();
15609        vcWaypoints();
15610        NectarPostGridWaypoint();
15611        nectarRotatingWordsInit();
15612        generalWaypoints();
15613    }
15614
15615
15616    /**
15617     * Salient page builder elements initialization.
15618     *
15619     * @since 10.5
15620     */
15621    function salientPageBuilderElInit() {
15622        flexsliderInit();
15623        flickityLazyInit();
15624        setTimeout(flickityInit, 100);
15625        twentytwentyInit();
15626        standardCarouselInit();
15627        productCarouselInit();
15628        clientsCarouselInit();
15629        carouselfGrabbingClass();
15630        accordionInit();
15631        accordionClickEvents();
15632        largeIconHover();
15633        nectarIconMatchColoring();
15634        buttonInit();
15635        ctaLinkBG();
15636        teamMemberFullscreen();
15637        flipBoxInit();
15638        owlCarouselInit();
15639        mouseParallaxInit();
15640        ulCheckmarks();
15641        nectarFancyUlIcons();
15642        nectarFancyBoxHover();
15643        nectarVideoLightbox();
15644        nectarKeyframeAssist();
15645        morphingOutlinesInit();
15646        nectarLinkIndicators();
15647        nectarPostGridInit();
15648        cascadingImageInit();
15649        imageWithHotspotEvents();
15650        pricingTableHeight();
15651        pageSubmenuInit();
15652        nectarLiquidBGs();
15653        nectarTestimonialSliders();
15654        recentPostsTitleOnlyEqualHeight();
15655        recentPostsInit();
15656        parallaxItemHoverEffect();
15657        fsProjectSliderInit();
15658        postMouseEvents();
15659        masonryPortfolioInit();
15660        masonryBlogInit();
15661        portfolioCustomColoring();
15662        searchResultMasonryInit();
15663        portfolioSidebarFollow();
15664        splitLineHeadingInit();
15665        scrollingText();
15666        tabbedInit();
15667    }
15668
15669
15670    /***************** WooCommerce *****************/
15671
15672    /**
15673     * Woo filter toggle
15674     *
15675     * @since 13.0
15676     */
15677    function NectarWooCommerceFilters() {
15678
15679        this.$toggleBtn = $('.nectar-shop-filters .nectar-shop-filter-trigger');
15680        this.$sidebar = $('#sidebar');
15681        this.sidebarPos = (this.$sidebar.hasClass('col_last')) ? 'right' : 'left';
15682
15683        this.state = {
15684            open: (this.getLS()) ? this.getLS() : 'true'
15685        };
15686
15687        this.setup();
15688        this.events();
15689    }
15690
15691    NectarWooCommerceFilters.prototype.events = function () {
15692
15693        this.$toggleBtn.on('click', this.toggle.bind(this));
15694        this.$sidebar.find('.nectar-close-btn-wrap').on('click', this.mobileToggle.bind(this));
15695        $(window).on('smartresize', this.mobileToggleResize.bind(this));
15696
15697    };
15698
15699    NectarWooCommerceFilters.prototype.mobileToggleResize = function () {
15700
15701        if (this.$sidebar.hasClass('open') && nectarDOMInfo.winW > 999) {
15702            this.$sidebar.removeClass('open');
15703            this.$sidebar.find('.nectar-close-btn-wrap').removeClass('open');
15704            $('.container-wrap').css('z-index', '11');
15705        }
15706
15707    };
15708
15709    NectarWooCommerceFilters.prototype.mobileToggle = function () {
15710
15711        if (this.$sidebar.hasClass('open')) {
15712            this.$sidebar.removeClass('open');
15713            this.$sidebar.find('.nectar-close-btn-wrap').removeClass('open');
15714            $('.container-wrap').css('z-index', '11');
15715        } else {
15716            $('.container-wrap').css('z-index', '10000');
15717            this.$sidebar.addClass('open');
15718            this.$sidebar.find('.nectar-close-btn-wrap').addClass('open');
15719        }
15720
15721        return false;
15722
15723    };
15724
15725    NectarWooCommerceFilters.prototype.toggle = function () {
15726
15727        // Mobile.
15728        if (nectarDOMInfo.winW < 1000) {
15729            this.mobileToggle();
15730            return false;
15731        }
15732
15733        var visibility = '';
15734
15735        // Close.
15736        if (this.state.open == 'true') {
15737
15738            // Handle state.
15739            this.state.open = 'false';
15740            visibility = 'false';
15741
15742            // Layout change.
15743            this.$toggleBtn.find('.hide').hide();
15744            this.$toggleBtn.find('.show').show();
15745
15746            this.$toggleBtn.find('.top-line, .bottom-line').css({
15747                'transform': 'translateX(0)'
15748            });
15749
15750            if (this.sidebarPos == 'left') {
15751                this.$sidebar.css({
15752                    'margin-right': '-25%',
15753                    'opacity': '0'
15754                });
15755            } else {
15756                this.$sidebar.css({
15757                    'margin-left': '-25%',
15758                    'opacity': '0'
15759                });
15760            }
15761
15762            this.$sidebar.find('> .inner').css({
15763                'transform': (this.sidebarPos == 'left') ? 'translateX(-100%)' : 'translateX(100%)',
15764            });
15765
15766        }
15767        // Open.
15768        else {
15769
15770            // Handle state.
15771            this.state.open = 'true';
15772            visibility = 'true';
15773
15774            // Layout change.
15775            this.$toggleBtn.find('.show').hide();
15776            this.$toggleBtn.find('.hide').show();
15777
15778            this.$toggleBtn.find('.top-line').css({
15779                'transform': 'translateX(10px)'
15780            });
15781            this.$toggleBtn.find('.bottom-line').css({
15782                'transform': 'translateX(-10px)'
15783            });
15784
15785            if (this.sidebarPos == 'left') {
15786                this.$sidebar.css({
15787                    'margin-right': '0',
15788                    'opacity': '1'
15789                });
15790            } else {
15791                this.$sidebar.css({
15792                    'margin-left': '0',
15793                    'opacity': '1'
15794                });
15795            }
15796
15797            this.$sidebar.find('> .inner').css({
15798                'transform': 'translateX(0)'
15799            });
15800
15801        }
15802
15803        // Trigger event.
15804        setTimeout(function () {
15805            $(window).trigger('nectar-product-filters-layout');
15806        }, 425);
15807
15808
15809        // Store in LS.
15810        if (typeof (Storage) !== "undefined") {
15811            localStorage.setItem("nectar_product_filters_vis", visibility);
15812        }
15813
15814        return false;
15815
15816    };
15817
15818    NectarWooCommerceFilters.prototype.setup = function () {
15819
15820        // Start filters expanded on mobile.
15821        this.$sidebar.find('.widget.woocommerce')
15822            .addClass('open-filter')
15823            .find('ul')
15824            .css({
15825                'display': 'block'
15826            });
15827
15828        // tag cloud
15829        this.$sidebar.find('.widget.woocommerce.widget_product_tag_cloud')
15830            .find('div.tagcloud').css({
15831            'display': 'block'
15832        });
15833
15834        // layered nav
15835        if (this.$sidebar.find('.widget.woocommerce.widget_layered_nav > .woocommerce-widget-layered-nav-dropdown').length > 0) {
15836            this.$sidebar.find('.widget.woocommerce.widget_layered_nav > .woocommerce-widget-layered-nav-dropdown').css({
15837                'display': 'block'
15838            });
15839        }
15840
15841        // Mobile active filters.
15842        if ($('.nectar-active-product-filters').length > 0) {
15843            var $filtersHTML = $('.nectar-active-product-filters').clone();
15844            this.$sidebar.find('> .inner').prepend($filtersHTML);
15845        }
15846
15847    };
15848
15849    NectarWooCommerceFilters.prototype.getLS = function () {
15850
15851        if (typeof (Storage) !== "undefined") {
15852            return localStorage.getItem("nectar_product_filters_vis");
15853        }
15854
15855        return null;
15856
15857    };
15858
15859
15860    /**
15861     * Handle Woo quantity button functionality
15862     *
15863     * @since 13.0
15864     */
15865    function wooQauntityBtns() {
15866        var quantityButtons = new NectarWooCommerceQuantity();
15867    }
15868
15869    function NectarWooCommerceQuantity() {
15870
15871        this.$qty = '';
15872        this.step = 1;
15873        this.ajaxTimeout = '';
15874        this.ajaxTimeoutDur = 500;
15875
15876        this.state = {
15877            max: 100000,
15878            min: 0,
15879            currentVal: 1,
15880            key: 0,
15881            removeFlag: false
15882        };
15883
15884        this.events();
15885
15886    }
15887
15888
15889    NectarWooCommerceQuantity.prototype.updateState = function (el) {
15890
15891        // Get key.
15892        var key = 0;
15893
15894        if (true === this.checkMiniCart(this.$qty)) {
15895            var matches = this.$qty.attr('name').match(/cart\[(\w+)\]/);
15896            key = matches[1];
15897        }
15898
15899        // Store current.
15900        var currentVal = parseFloat(this.$qty.val());
15901
15902        if (!currentVal || currentVal === '' || currentVal === 'NaN') {
15903            currentVal = 0;
15904        }
15905
15906        // Max/Min vals.
15907        var max = parseFloat(this.$qty.attr('max'));
15908        var min = parseFloat(this.$qty.attr('min'));
15909
15910        if (max === '' || max === 'NaN' || isNaN(max)) {
15911            max = '';
15912        }
15913
15914        if (min === '' || min === 'NaN' || isNaN(min)) {
15915            min = 0;
15916        }
15917
15918        // Push to state.
15919        this.state = {
15920            currentVal: currentVal,
15921            max: max,
15922            min: min,
15923            key: key
15924        };
15925
15926    };
15927
15928    NectarWooCommerceQuantity.prototype.events = function () {
15929
15930        var that = this;
15931
15932        $('body').on('click', '.quantity .plus', function () {
15933            if ($(this).parents('.auction_form').length == 0) {
15934
15935                that.$qty = $(this).closest('.quantity').find('.qty');
15936                that.setStep();
15937                that.updateState();
15938                that.increment($(this));
15939            }
15940        });
15941
15942        $('body').on('click', '.quantity .minus', function () {
15943
15944            if ($(this).parents('.auction_form').length == 0) {
15945                that.$qty = $(this).closest('.quantity').find('.qty');
15946                that.setStep();
15947                that.updateState();
15948                that.decrement($(this));
15949            }
15950        });
15951
15952        $('body').on('keyup', '.woocommerce-mini-cart .quantity .qty', function (e) {
15953            that.$qty = $(this);
15954
15955            that.updateState();
15956
15957            // Max value.
15958            if (that.state.max && that.$qty.val() > that.state.max) {
15959                that.$qty.val(that.state.max);
15960            }
15961
15962            // Check if item should be removed.
15963            if (that.state.min && (that.state.min == that.state.currentVal || that.state.currentVal < that.state.min)) {
15964                that.state.removeFlag = true;
15965            }
15966
15967            $(this).trigger('change');
15968
15969        });
15970
15971        $('body').on('change', '.woocommerce-mini-cart .quantity .qty', function (e) {
15972
15973            if (!e.originalEvent && true === that.checkMiniCart(that.$qty)) {
15974                that.updateCart(that.$qty.val());
15975            }
15976
15977        });
15978
15979    };
15980
15981    NectarWooCommerceQuantity.prototype.setStep = function () {
15982        if (this.$qty.is('[step]')) {
15983            var step = parseInt(this.$qty.attr('step'));
15984
15985            if (!isNaN(step) && step != '' && step != 0) {
15986                this.step = step;
15987            }
15988
15989        }
15990    }
15991
15992    NectarWooCommerceQuantity.prototype.increment = function () {
15993
15994        if (this.state.max && (this.state.max == this.state.currentVal || this.state.currentVal > this.state.max)) {
15995            this.$qty.val(this.state.max);
15996        } else {
15997            this.$qty.val(this.state.currentVal + parseFloat(this.step));
15998        }
15999
16000        this.$qty.trigger('change');
16001
16002    };
16003
16004    NectarWooCommerceQuantity.prototype.decrement = function () {
16005
16006        if (this.state.min && (this.state.min == this.state.currentVal || this.state.currentVal < this.state.min)) {
16007            this.$qty.val(this.state.min);
16008            this.state.removeFlag = true;
16009
16010        } else if (this.state.currentVal > 0) {
16011            this.$qty.val(this.state.currentVal - parseFloat(this.step));
16012        }
16013
16014        this.$qty.trigger('change');
16015
16016    };
16017
16018    NectarWooCommerceQuantity.prototype.checkMiniCart = function (el) {
16019        return (el.parents('.woocommerce-mini-cart').length > 0) ? true : false;
16020    };
16021
16022    NectarWooCommerceQuantity.prototype.updateQuantityCallback = function (response, that) {
16023        $(window).trigger('nectar_woo_mini_cart_updated');
16024
16025
16026        that.$qty.closest('.widget_shopping_cart_content').removeClass('loading');
16027        that.$qty.closest('.woocommerce-mini-cart-item').removeClass('blockUI').removeClass('blockOverlay');
16028
16029
16030        // Update subtotal.
16031        var $subtotal = that.$qty.closest('.widget_shopping_cart_content').find('.woocommerce-mini-cart__total');
16032        $subtotal.find('.woocommerce-Price-amount, .tax_label').remove();
16033        $subtotal.append(response.subtotal);
16034
16035        // Update price for compatibility with Woo plugins which change price based on quantity.
16036        if (window.nectarOptions && window.nectarOptions.woo_using_cart_addons && window.nectarOptions.woo_using_cart_addons === 'true') {
16037            if (response.item_price && response.item_price.length > 0) {
16038
16039                var $responsePrice = $(response.item_price);
16040                var $price = that.$qty.closest('.woocommerce-mini-cart-item').find('.product-price');
16041
16042                if ($responsePrice.text() !== $price.find('.woocommerce-Price-amossunt').text()) {
16043                    $price.find('.woocommerce-Price-amount, > del, > ins').remove();
16044                    $price.prepend(response.item_price);
16045                }
16046            }
16047        }
16048
16049        // Does the item need to be removed?
16050        if (that.state.removeFlag === true) {
16051            that.$qty.closest('.woocommerce-mini-cart-item').remove();
16052            that.state.removeFlag = false;
16053            $(document.body).trigger('updated_wc_div');
16054        }
16055
16056        // Update cart count.
16057        if ($('#header-outer a.cart-contents .cart-wrap span').length > 0) {
16058            $('#header-outer a.cart-contents .cart-wrap span').text(response.item_count);
16059        }
16060        if ($('#header-outer #mobile-cart-link .cart-wrap span').length > 0) {
16061            $('#header-outer #mobile-cart-link .cart-wrap span').text(response.item_count);
16062        }
16063
16064    }
16065
16066    NectarWooCommerceQuantity.prototype.updateCart = function (val) {
16067
16068        var that = this;
16069
16070        // Debounce a little to prevent too many requests when clicking a lot
16071        clearTimeout(this.ajaxTimeout);
16072
16073        this.ajaxTimeout = setTimeout(function () {
16074
16075            that.$qty.closest('.widget_shopping_cart_content').addClass('loading');
16076            that.$qty.closest('.woocommerce-mini-cart-item').addClass('blockUI').addClass('blockOverlay');
16077
16078            var ajaxData = {
16079                type: 'POST',
16080                url: window.nectarLove.ajaxurl,
16081                data: {
16082                    action: "nectar_minicart_update_quantity",
16083                    quantity: val,
16084                    item_key: that.state.key
16085                },
16086                cache: false,
16087                success: function (response) {
16088                    if (response) {
16089                        that.updateQuantityCallback(response, that);
16090                    }
16091                }
16092            };
16093
16094            $.ajax(ajaxData);
16095            if (window.nectarOptions && window.nectarOptions.woo_using_cart_addons && window.nectarOptions.woo_using_cart_addons === 'true') {
16096                // Workaround for quantity / subtotal not updating until after the next ajax request.
16097                setTimeout(function () {
16098                    $.ajax(ajaxData);
16099                }, 1000);
16100            }
16101
16102        }, this.ajaxTimeoutDur);
16103
16104    };
16105
16106
16107    /**
16108     * WooCommerce Single Product AJAX Add to Cart.
16109     *
16110     * @since 13.0
16111     */
16112    function NectarWooCommerceCartAJAX() {
16113
16114        this.state = {
16115            processing: false,
16116            productID: false,
16117            type: 'regular'
16118        };
16119
16120        this.events();
16121    }
16122
16123    NectarWooCommerceCartAJAX.prototype.events = function () {
16124        //$('body:not(.woocommerce-account)').on('submit', 'form.cart', this.addToCartAJAX.bind(this));
16125        $('body').on('click', 'form.cart .single_add_to_cart_button', this.addToCartAJAX.bind(this));
16126    };
16127
16128    NectarWooCommerceCartAJAX.prototype.addNotices = function (notices) {
16129
16130        var that = this;
16131
16132        var $noticeParent = $('.nectar-slide-in-cart.style_slide_in_click .widget_shopping_cart_content')
16133
16134        $.each(notices, function (k, item) {
16135            $noticeParent.prepend('<div class="nectar-notice">' + item.notice + '</div>');
16136        });
16137
16138        // Remove.
16139        setTimeout(function () {
16140            $noticeParent.find('.nectar-notice').slideUp(function () {
16141                $(this).remove();
16142            });
16143        }, 6000);
16144
16145    };
16146
16147    NectarWooCommerceCartAJAX.prototype.addToCartAJAX = function (e) {
16148
16149        var that = this;
16150
16151        var $wooForm = $(e.currentTarget).parents('form.cart');
16152
16153        // External or redirect active.
16154        if ($wooForm.closest('.product').hasClass('product-type-external') || (wc_add_to_cart_params && wc_add_to_cart_params.cart_redirect_after_add === 'yes')) {
16155            return;
16156        }
16157
16158        e.preventDefault();
16159
16160        // If already submitted
16161        if (that.state.processing == true) {
16162            return;
16163        }
16164
16165        that.state.processing = true;
16166        that.state.productID = false;
16167
16168        // Store type
16169        that.state.type = 'regular';
16170        if ($wooForm.parents('.nectar-quick-view-box').length > 0) {
16171            that.state.type = 'quickview';
16172        }
16173
16174        // Gather info to pass.
16175        var $parentProduct = $wooForm.closest('.product');
16176        var $addToCartBtn = $wooForm.find('button.single_add_to_cart_button');
16177        var $formData = $wooForm.serializeArray();
16178        var regID = 0;
16179
16180        // Try and get ID from parent.
16181        if ($parentProduct.is('[id*="product-"]')) {
16182            regID = $parentProduct.attr('id').match(/\d+/);
16183
16184            if (regID && regID[0]) {
16185                that.state.productID = regID[0];
16186            }
16187        }
16188        // Fallback to ID from submit.
16189        if (that.state.productID === false && $addToCartBtn.length > 0) {
16190            regID = $addToCartBtn.val().match(/\d+/);
16191
16192            if (regID && regID[0]) {
16193                that.state.productID = regID[0];
16194            }
16195        }
16196
16197        // No ID found, bail out.
16198        if (that.state.productID === false) {
16199            console.log('Error: no product ID found.');
16200            return;
16201        }
16202
16203        // Add Loading.
16204        if (that.state.type === 'quickview') {
16205            $addToCartBtn = $('.single_add_to_cart_button_wrap .single_add_to_cart_button');
16206        }
16207
16208        $addToCartBtn.prepend('<div class="loading-wrap"><div class="loading" /></div></div>');
16209        setTimeout(function () {
16210            $addToCartBtn.addClass('processing');
16211        }, 50);
16212
16213        // Must be formatted like this to use add-to-cart key for WooCommerce to trigger AJAX.
16214        $formData.push({
16215            name: 'action',
16216            value: 'nectar_ajax_add_to_cart'
16217        }, {
16218            name: 'add-to-cart',
16219            value: that.state.productID
16220        });
16221
16222        $.ajax({
16223            type: 'POST',
16224            url: window.nectarLove.ajaxurl,
16225            data: $formData,
16226            cache: false,
16227            success: function (response) {
16228
16229                setTimeout(function () {
16230                    that.state.processing = false;
16231                    $addToCartBtn.removeClass('processing');
16232                    $addToCartBtn.find('.loading-wrap').remove();
16233                }, 300);
16234
16235                if (response && response.fragments) {
16236
16237                    // Update content.
16238                    $('body').trigger('added_to_cart', [response.fragments, response.cart_hash]);
16239
16240                    // Check for/Output errors.
16241                    if (response.notices && response.notices.length > 0) {
16242                        setTimeout(function () {
16243                            that.addNotices(response.notices);
16244                        }, 100);
16245                    }
16246
16247                    // Close quickview.
16248                    if (that.state.type === 'quickview') {
16249                        $('.nectar-quick-view-box .close').trigger('click');
16250                    }
16251
16252                }
16253
16254            } // end success.
16255
16256        }); // end ajax.
16257
16258    };
16259
16260
16261    /**
16262     * WooCommerce events.
16263     *
16264     * @since 10.5
16265     */
16266    function wooCommerceEvents() {
16267
16268        var wooCartTimeout;
16269
16270        // Notification.
16271        $body.on('click', '.product .add_to_cart_button', function () {
16272
16273            var $productHeading = ($(this).parents('li').find('h2').length > 0) ? 'h2' : 'h3',
16274                productToAdd = $(this).parents('li').find($productHeading).text();
16275
16276            $('#header-outer .cart-notification span.item-name').html(productToAdd);
16277
16278        });
16279
16280        // Notification hover.
16281        $body.on('mouseenter', '#header-outer .cart-notification', function () {
16282
16283            $(this).hide();
16284
16285            $('#header-outer .widget_shopping_cart')
16286                .addClass('open')
16287                .stop(true, true)
16288                .show();
16289
16290            $('#header-outer .cart_list')
16291                .stop(true, true)
16292                .show();
16293
16294            clearTimeout(wooCartTimeout);
16295
16296        });
16297
16298
16299        // Cart dropdown.
16300        var $headerCartSelector = '#header-outer .nectar-woo-cart';
16301
16302        if ($($headerCartSelector).length > 0) {
16303
16304            $($headerCartSelector).hoverIntent(function () {
16305
16306                $('#header-outer .widget_shopping_cart')
16307                    .addClass('open')
16308                    .stop(true, true)
16309                    .show();
16310
16311                $('#header-outer .cart_list')
16312                    .stop(true, true)
16313                    .show();
16314
16315                clearTimeout(wooCartTimeout);
16316
16317                $('#header-outer .cart-notification').hide();
16318
16319            });
16320        }
16321
16322
16323        $body.on('mouseleave', $headerCartSelector, function () {
16324            var $that = $(this);
16325            setTimeout(function () {
16326                if (!$that.is(':hover')) {
16327                    $('#header-outer .widget_shopping_cart')
16328                        .removeClass('open')
16329                        .stop(true, true)
16330                        .fadeOut(300);
16331
16332                    $('#header-outer .cart_list')
16333                        .stop(true, true)
16334                        .fadeOut(300);
16335                }
16336            }, 200);
16337        });
16338
16339        if ($('#header-outer[data-cart="false"]').length == 0) {
16340
16341            $body.on('added_to_cart', function (e) {
16342                setTimeout(function () {
16343                    shopping_cart_dropdown_show(e);
16344                    shopping_cart_dropdown();
16345                }, 150);
16346            });
16347        }
16348
16349        function shopping_cart_dropdown() {
16350
16351            if (!$('.widget_shopping_cart .widget_shopping_cart_content .cart_list .empty').length &&
16352                $('.widget_shopping_cart .widget_shopping_cart_content .cart_list').length > 0) {
16353
16354                $('.cart-menu-wrap').addClass('has_products');
16355                $('header#top nav > ul, #search-outer #search #close a, header#top .span_9 >.slide-out-widget-area-toggle').addClass('product_added');
16356
16357                if (!$('.cart-menu-wrap').hasClass('static')) {
16358                    $('.cart-menu-wrap, #mobile-cart-link').addClass('first-load');
16359                }
16360
16361
16362            }
16363
16364        }
16365
16366
16367        function shopping_cart_dropdown_show(e) {
16368
16369            clearTimeout(wooCartTimeout);
16370
16371            if (!$('.widget_shopping_cart .widget_shopping_cart_content .cart_list .empty').length &&
16372                $('.widget_shopping_cart .widget_shopping_cart_content .cart_list').length > 0 &&
16373                typeof e.type != 'undefined') {
16374
16375                // Standalone woocommerce add to cart buttons.
16376                if ($('#header-outer .cart-notification .item-name').length > 0 &&
16377                    $('#header-outer .cart-notification .item-name').text().length == 0) {
16378                    return;
16379                }
16380
16381                // Before cart has slide in.
16382                if (!$('#header-outer .cart-menu-wrap').hasClass('has_products')) {
16383
16384                    setTimeout(function () {
16385                        $('#header-outer .cart-notification').fadeIn(400);
16386                    }, 400);
16387
16388                } else if (!$('#header-outer .cart-notification').is(':visible')) {
16389                    $('#header-outer .cart-notification').fadeIn(400);
16390                } else {
16391                    $('#header-outer .cart-notification').show();
16392                }
16393
16394                $('body #header-outer [data-cart-style="slide_in_click"] .cart-menu-wrap').trigger('click');
16395
16396
16397                wooCartTimeout = setTimeout(hideCart, 2700);
16398
16399            }
16400        }
16401
16402        function hideCart() {
16403            $('#header-outer .cart-notification').stop(true, true).fadeOut();
16404        }
16405
16406        function checkForWooItems() {
16407
16408            var checkForCartItems = setInterval(shopping_cart_dropdown, 250);
16409            setTimeout(function () {
16410                clearInterval(checkForCartItems);
16411            }, 4500);
16412
16413        }
16414
16415
16416        if ($('#header-outer[data-cart="false"]').length == 0) {
16417            checkForWooItems();
16418        }
16419
16420        function nectarAccountPageTabs() {
16421
16422            // Not on account page.
16423            if ($('body.woocommerce-account #customer_login').length == 0) {
16424                return;
16425            }
16426
16427            // Create HTML.
16428            if ($('#customer_login .nectar-form-controls').length === 0) {
16429                $('.woocommerce-account .woocommerce > #customer_login').prepend('<div class="nectar-form-controls" />');
16430
16431                $('.woocommerce-account .woocommerce > #customer_login > div:not(.nectar-form-controls)').each(function () {
16432                    var $title = $(this).find('> h2').text();
16433                    $('#customer_login .nectar-form-controls').append('<div class="control">' + $title + '</div>');
16434                });
16435            }
16436
16437            // Click event.
16438            $('.woocommerce-account .woocommerce > #customer_login .nectar-form-controls .control').on('click', function () {
16439
16440                $('.woocommerce-account .woocommerce > #customer_login .nectar-form-controls .control').removeClass('active');
16441                $(this).addClass('active');
16442
16443                var formIndex = $(this).index() + 1;
16444                $('#customer_login div[class*="u-column"]').hide();
16445                $('#customer_login div[class*="u-column"].col-' + formIndex).show();
16446
16447                setTimeout(function () {
16448                    $('#customer_login div[class*="u-column"]').removeClass('visible');
16449                    $('#customer_login div[class*="u-column"].col-' + formIndex).addClass('visible');
16450                }, 30);
16451
16452            });
16453
16454            //Starting.
16455            var tabChild = '1';
16456            if (typeof nectarGetQueryParam['tab'] != 'undefined' && nectarGetQueryParam['tab'] === '2') {
16457                tabChild = '2';
16458                if (window.history && window.history.replaceState && typeof URL === "function") {
16459                    var url = new URL(location);
16460                    url.searchParams.delete('tab');
16461                    history.replaceState(null, null, url);
16462                }
16463            }
16464
16465            $('.woocommerce-account .woocommerce > #customer_login .nectar-form-controls .control:nth-child(' + tabChild + ')').trigger('click');
16466
16467
16468        }
16469
16470        nectarAccountPageTabs();
16471
16472        var bindTextOnHoverMobile = ($('.products[data-rm-m-hover="1"]').length > 0 && nectarDOMInfo.usingMobileBrowser) ? false : true;
16473
16474        // Text on hover effect.
16475        if (bindTextOnHoverMobile) {
16476            $body.on('mouseover', '.text_on_hover .product-wrap, .text_on_hover > a:first-child', function () {
16477                $(this).parent().addClass('hovered');
16478            });
16479
16480            $body.on('mouseout', '.text_on_hover .product-wrap, .text_on_hover > a:first-child', function () {
16481                $(this).parent().removeClass('hovered');
16482            });
16483        }
16484
16485
16486        // Material/fancy parallax hover effect zindex.
16487        if ($('.material.product').length > 0 ||
16488            $('.minimal.product').length > 0 ||
16489            $('.nectar-fancy-box[data-style="parallax_hover"]').length > 0 ||
16490            $('.nectar-category-grid[data-shadow-hover="yes"]').length > 0 ||
16491            $('.nectar-post-grid[data-shadow-hover="yes"]').length > 0) {
16492
16493            var $productZindex = 101;
16494
16495            $body.on('mouseenter', '.material.product, .nectar-fancy-box[data-style="parallax_hover"], .nectar-post-grid[data-shadow-hover="yes"] .nectar-post-grid-item, .nectar-category-grid[data-shadow-hover="yes"] .nectar-category-grid-item', function () {
16496                $productZindex++;
16497                $(this).css('z-index', $productZindex + 1);
16498            });
16499
16500            $body.on('mouseleave', '.material.product, .nectar-fancy-box[data-style="parallax_hover"], .nectar-post-grid[data-shadow-hover="yes"] .nectar-post-grid-item, .nectar-category-grid[data-shadow-hover="yes"] .nectar-category-grid-item', function () {
16501
16502                var $that = $(this);
16503                setTimeout(function () {
16504                    if (!$that.is(':hover')) {
16505                        $that.css('z-index', 100);
16506                    }
16507                }, 350);
16508            });
16509
16510            if (window.nectarOptions && window.nectarOptions.woo_minimal_product_effect && window.nectarOptions.woo_minimal_product_effect === 'default') {
16511                $body.on('mouseenter', '.minimal.product', function () {
16512                    $productZindex++;
16513                    $(this).css('z-index', $productZindex + 1);
16514                });
16515
16516                $body.on('mouseleave', '.minimal.product', function () {
16517
16518                    var $that = $(this);
16519                    setTimeout(function () {
16520                        if (!$that.is(':hover')) {
16521                            $that.css('z-index', 100);
16522                        }
16523                    }, 350);
16524                });
16525            }
16526
16527            // Reset to stop zindex from getting too high.
16528            setInterval(function () {
16529                if ($('.nectar-fancy-box[data-style="parallax_hover"]:hover').length > 0 ||
16530                    $('.minimal.product:hover').length > 0) {
16531                    return;
16532                }
16533
16534                $('.material.product:not(:hover), .minimal.product:not(:hover), .nectar-fancy-box[data-style="parallax_hover"]:not(:hover), .nectar-post-grid[data-shadow-hover="yes"] .nectar-post-grid-item:not(:hover), .nectar-category-grid[data-shadow-hover="yes"] .nectar-category-grid-item:not(:hover)').css('z-index', 100);
16535                $productZindex = 101;
16536            }, 10000);
16537
16538        }
16539
16540        function minimalProductHover() {
16541
16542            // Add icons.
16543            $('.products .classic .product-wrap .add_to_cart_button').wrapInner('<span />');
16544            $('.products .classic .product-wrap .add_to_cart_button').prepend('<i class="normal icon-salient-cart"></i>');
16545
16546            // Bind hover.
16547            var bindMobileHover = ($('.products[data-rm-m-hover="1"]').length > 0 && nectarDOMInfo.usingMobileBrowser) ? false : true;
16548
16549            if (bindMobileHover && window.nectarOptions && window.nectarOptions.woo_minimal_product_effect && window.nectarOptions.woo_minimal_product_effect === 'default') {
16550
16551                $body.on('mouseover', '.products .minimal.product', function () {
16552                    minimalProductCalc($(this));
16553                });
16554
16555                $body.on('mouseleave', '.products .minimal.product', function () {
16556                    $(this).find('.background-color-expand').css({
16557                        'transform': 'scale(1, 1) translateY(0) translateZ(0px)'
16558                    });
16559                });
16560
16561            }
16562
16563            // Starting trigger mouse over.
16564            $('.products .minimal.product').each(function () {
16565                if ($(this).is(':hover')) {
16566                    $(this).trigger('mouseover');
16567                }
16568            });
16569
16570        }
16571
16572
16573        function minimalProductCalc(el) {
16574
16575            var expansionAmtX = 40,
16576                expansionAmtY = expansionAmtX,
16577                translateYAmt = 0;
16578
16579            var $item = el,
16580                $itemWidth = $item.width(),
16581                $itemHeight = $item.height(),
16582                $wChange = (parseInt($itemWidth) + expansionAmtX) / parseInt($itemWidth),
16583                $hChange = (parseInt($itemHeight) + expansionAmtY) / parseInt($itemHeight);
16584
16585            $item.addClass('hover-bound');
16586
16587            $item.find('.background-color-expand').css({
16588                'transform': 'scale(' + $wChange + ',' + $hChange + ') translateY(' + translateYAmt + 'px) translateZ(0px)'
16589            });
16590
16591        }
16592
16593        minimalProductHover();
16594
16595
16596        // Mobile widget filters.
16597        $('.woocommerce #sidebar .widget.woocommerce').each(function () {
16598
16599            // Skip widgets without any titles.
16600            if ($(this).find('> h4').length == 0) {
16601                $(this).addClass('no-widget-title');
16602            }
16603
16604        });
16605
16606        $body.on('click', '#sidebar .widget.woocommerce:not(.widget_price_filter) h4', function () {
16607
16608            if (window.nectarOptions && window.nectarOptions.woo_sidebar_toggles !== 'false') {
16609
16610                if ($window.width() < 1000) {
16611
16612                    if ($(this).parent().is('.widget_product_tag_cloud')) {
16613                        $(this).parent().find('> div').slideToggle();
16614                    }
16615                    if ($(this).parent().is('.woocommerce-widget-layered-nav') && $(this).parent().find('> .woocommerce-widget-layered-nav-dropdown').length > 0) {
16616                        $(this).parent().find('> .woocommerce-widget-layered-nav-dropdown').slideToggle();
16617                    }
16618
16619                    $(this).parent().find('> ul').slideToggle();
16620
16621                    $(this).parent().toggleClass('open-filter');
16622                }
16623
16624            }
16625
16626        });
16627
16628
16629        // Slide in cart event.
16630        $body.on('mouseenter', '#header-outer [data-cart-style="slide_in"] .cart-menu-wrap', openRightCartHover);
16631
16632        $body.on('mouseenter', '.nectar-slide-in-cart', function () {
16633            $(this).addClass('mouse-accessed');
16634        });
16635
16636
16637        function openRightCartHover() {
16638
16639            if ($('.nectar-slide-in-cart ul.cart_list li:not(.empty)').length > 0) {
16640
16641                $('.nectar-slide-in-cart').addClass('open');
16642                $window.on('mousemove.rightCartOffsetCheck', closeCartCheck);
16643
16644            }
16645        }
16646
16647        function closeCartCheck(e) {
16648
16649            var $windowWidth = $window.width();
16650            if (e.clientX < $windowWidth - 370 - $bodyBorderWidth && $('.nectar-slide-in-cart').hasClass('mouse-accessed')) {
16651
16652                $window.off('mousemove.rightCartOffsetCheck', closeCartCheck);
16653
16654                $('.nectar-slide-in-cart').removeClass('open').removeClass('mouse-accessed');
16655
16656            }
16657
16658        }
16659
16660        // Slide in click cart.
16661        $body.on('click', '#header-outer [data-cart-style="slide_in_click"] .cart-menu-wrap, #mobile-cart-link[data-cart-style="slide_in_click"]', openRightCart);
16662
16663        function openRightCart() {
16664            if ($body.is('.woocommerce-checkout') || $body.is('.woocommerce-cart')) {
16665                return true;
16666            }
16667
16668            $('.nectar-slide-in-cart, .nectar-slide-in-cart-bg').addClass('open');
16669            $('.nectar-slide-in-cart-bg').addClass('revealed');
16670            clearTimeout(wooBgOverlayTimeout);
16671
16672            // YITH ajax filters compat.
16673            $('.style_slide_in_click div.quantity').each(function () {
16674                if ($(this).find('.minus').length > 1) {
16675                    $(this).find('.minus').first().remove();
16676                }
16677                if ($(this).find('.plus').length > 1) {
16678                    $(this).find('.plus').first().remove();
16679                }
16680            });
16681
16682            return false;
16683        }
16684
16685        $body.on('click', '.nectar-slide-in-cart.style_slide_in_click .close-cart, .nectar-slide-in-cart-bg', closeRightCart);
16686
16687
16688        // Add quantity functionality.
16689        wooQauntityBtns();
16690
16691        // AJAX add to cart.
16692        if (window.nectarOptions && window.nectarOptions.ajax_add_to_cart === '1') {
16693            var ajaxAddToCart = new NectarWooCommerceCartAJAX();
16694        }
16695
16696        if (window.nectarOptions && window.nectarOptions.woo_product_filter_toggle === '1' && $body.is('.archive.woocommerce')) {
16697            var nectarProductFilters = new NectarWooCommerceFilters();
16698        }
16699
16700        // Third party.
16701        // YITH Ajax filters.
16702        $(document).on('yith-wcan-ajax-filtered', nectarLazyImageLoading);
16703
16704
16705    }
16706
16707    var wooBgOverlayTimeout;
16708
16709    function closeRightCart() {
16710
16711        $('.nectar-slide-in-cart, .nectar-slide-in-cart-bg').removeClass('open');
16712
16713        wooBgOverlayTimeout = setTimeout(function () {
16714            $('.nectar-slide-in-cart-bg').removeClass('revealed');
16715        }, 400);
16716
16717        return false;
16718    }
16719
16720
16721    /**
16722     * Modern quick search.
16723     *
16724     * @since 13.0
16725     */
16726    function NectarQuickSearch() {
16727
16728        this.$el = $('#search-outer #search .container #s');
16729        this.$container = '';
16730        this.$parent = '';
16731        this.$searchEl = $('#search-outer');
16732        this.request = '';
16733        this.timeout = '';
16734        this.setup();
16735        this.events();
16736
16737        this.state = {
16738            requesting: false,
16739            open: false,
16740            prevResults: ''
16741        }
16742
16743        this.minChars = 2;
16744
16745    }
16746
16747
16748    NectarQuickSearch.prototype.setup = function () {
16749
16750        this.$container = $('<div class="inner"></div>');
16751        $('#search-outer').append($('<div class="nectar-ajax-search-results"><div class="container"></div></div>'));
16752        this.$parent = $('#search-outer .nectar-ajax-search-results');
16753        $('#search-outer .nectar-ajax-search-results .container').append(this.$container);
16754
16755    };
16756
16757    NectarQuickSearch.prototype.events = function () {
16758
16759        var that = this;
16760
16761        this.throttled = throttle(this.getResults.bind(this), 350);
16762        this.$el.on('keyup', this.keyHandle.bind(this));
16763
16764        $(window).on('resize', this.resize.bind(this));
16765        $(window).on('nectar-search-close', function () {
16766            that.resetHeight();
16767            that.requestCheck();
16768        });
16769
16770    };
16771
16772    NectarQuickSearch.prototype.keyHandle = function (e) {
16773
16774        // Verify Key.
16775        var keysToSkip = [16, 91, 32, 37, 39, 17];
16776
16777        if (keysToSkip.indexOf(e.keyCode) != -1) {
16778            return;
16779        }
16780
16781        this.throttled();
16782        this.debouncedSearch();
16783
16784    };
16785
16786    NectarQuickSearch.prototype.debouncedSearch = function () {
16787
16788        var that = this;
16789
16790        clearTimeout(this.timeout);
16791        this.timeout = setTimeout(function () {
16792            if (that.state.requesting) {
16793                return;
16794            }
16795            that.getResults();
16796        }, 400);
16797
16798    };
16799
16800
16801    NectarQuickSearch.prototype.resize = function () {
16802
16803        this.$parent.css({
16804            'max-height': ''
16805        });
16806
16807        if (this.state.open === true) {
16808            this.$parent.css({
16809                'max-height': parseInt(this.$container.outerHeight()) + 'px'
16810            });
16811        }
16812
16813    };
16814
16815    NectarQuickSearch.prototype.resetHeight = function () {
16816
16817        var that = this;
16818
16819        this.$parent.css({
16820            'max-height': ''
16821        });
16822
16823        setTimeout(function () {
16824            $headerOuterEl.removeClass('results-shown');
16825        }, 400);
16826
16827        this.state.prevResults = '';
16828        this.state.open = false;
16829    };
16830
16831
16832    NectarQuickSearch.prototype.requestCheck = function () {
16833
16834        if (this.state.requesting === true) {
16835            this.request.abort();
16836            this.state.requesting = false;
16837        }
16838
16839    };
16840
16841    NectarQuickSearch.prototype.getResults = function () {
16842
16843        var that = this;
16844        var val = this.$el.val();
16845
16846        // Deleted all chars / too few chars.
16847        if (val.length == 0 || val.length < this.minChars) {
16848            $headerOuterEl.removeClass('results-shown');
16849            this.requestCheck();
16850            this.resetHeight();
16851            return;
16852        }
16853
16854        this.request = $.ajax({
16855            type: 'POST',
16856            url: window.nectarLove.ajaxurl,
16857            data: {
16858                action: "nectar_ajax_ext_search_results",
16859                search: val
16860            },
16861            cache: false,
16862            success: function (response) {
16863
16864                that.state.requesting = false;
16865
16866                // No results.
16867                if (!response) {
16868                    that.resetHeight();
16869                }
16870
16871                if (response && response.content && response.content !== that.state.prevResults && that.$searchEl.hasClass('material-open')) {
16872
16873                    that.$container.html(response.content);
16874
16875                    that.$parent.css({
16876                        'max-height': parseInt(that.$container.outerHeight()) + 'px'
16877                    });
16878
16879                    setTimeout(function () {
16880                        $headerOuterEl.addClass('results-shown');
16881                    }, 200);
16882
16883                    // Desktop animation
16884                    if (nectarDOMInfo.winW >= 1000 && !$headerOuterEl.hasClass('results-shown')) {
16885
16886                        that.$container.find('.product, .search-post-item').css({
16887                            'opacity': '0',
16888                            'transform': 'translateY(25px)',
16889                            'transition': 'none'
16890                        });
16891
16892                        setTimeout(function () {
16893                            that.$container.find('.product, .search-post-item').css({
16894                                'transition': 'box-shadow 0.25s ease, opacity 0.55s cubic-bezier(0.2, 0.6, 0.4, 1), transform 0.55s cubic-bezier(0.2, 0.6, 0.4, 1)'
16895                            });
16896                        }, 50);
16897
16898
16899                        that.$container.find('.product, .search-post-item').each(function (i) {
16900                            var $that = $(this);
16901                            setTimeout(function () {
16902                                $that.css({
16903                                    'opacity': '1',
16904                                    'transform': 'translateY(0)'
16905                                })
16906                            }, 50 + (i * 60));
16907                        });
16908
16909                    }
16910
16911                    that.state.open = true;
16912                    that.state.prevResults = response.content;
16913
16914                }
16915
16916            }
16917
16918        });
16919
16920        this.state.requesting = true;
16921
16922    };
16923
16924
16925    /**
16926     * Search in navigation functionality.
16927     *
16928     * @since 10.5
16929     */
16930
16931    function navigationSearchInit() {
16932
16933        // Init quick search.
16934        var quickSearch = false;
16935        if (window.nectarOptions && window.nectarOptions.quick_search && window.nectarOptions.quick_search === 'true') {
16936            quickSearch = new NectarQuickSearch();
16937        }
16938
16939        var $placeholder = ($('#search-outer #search input[type=text][data-placeholder]').length > 0) ? $('#search-outer #search input[type=text]').attr('data-placeholder') : '';
16940
16941        // Material skin add search BG markup.
16942        if ($body.hasClass('material') && $('#header-outer .bg-color-stripe').length == 0) {
16943            $headerOuterEl.append('<div class="bg-color-stripe" />');
16944        }
16945
16946        // Prevent jumping on click.
16947        $body.on('click', '#search-btn a', function () {
16948            return false;
16949        });
16950
16951        // Open search on mouseup.
16952        $body.on('click', '#search-btn a:not(.inactive), #header-outer .mobile-search, .nectar-search-open-trigger', function () {
16953
16954            if ($(this).hasClass('open-search')) {
16955                return false;
16956            }
16957
16958            // Close menu on original skin.
16959            if ($body.hasClass('original') && $('.slide-out-widget-area-toggle.mobile-icon a.open').length > 0) {
16960                $('.slide-out-widget-area-toggle.mobile-icon a')
16961                    .addClass('non-human-allowed')
16962                    .trigger('click');
16963
16964                setTimeout(function () {
16965                    $('.slide-out-widget-area-toggle.mobile-icon a').removeClass('non-human-allowed');
16966                }, 100);
16967            }
16968
16969            if ($body.hasClass('ascend') ||
16970                $('body[data-header-format="left-header"]').length > 0 && $('body.material').length == 0) {
16971
16972                // Ascend theme skin.
16973                $('#search-outer > #search form, #search-outer #search .span_12 span, #search-outer #search #close').css('opacity', 0);
16974
16975                $('#search-outer > #search form').css('transform', 'translateY(-30px)');
16976                $('#search-outer #search .span_12 span').css('transform', 'translateY(20px)');
16977
16978                $('#search-outer').show();
16979                $('#search-outer').stop().transition({
16980                    scale: '1,0',
16981                    'opacity': 1
16982                }, 0).transition({
16983                    scale: '1,1'
16984                }, 700, 'cubic-bezier(0.2, 1, 0.3, 1)');
16985
16986                $('#search-outer > #search form').delay(350).transition({
16987                    'opacity': 1,
16988                    'transform': 'translateY(0)'
16989                }, 700, 'cubic-bezier(0.2, 1, 0.3, 1)');
16990
16991                $('#search-outer #search #close').delay(500).transition({
16992                    'opacity': 1
16993                }, 700, 'cubic-bezier(0.2, 1, 0.3, 1)');
16994
16995
16996                $('#search-outer #search .span_12 span').delay(450).transition({
16997                    'opacity': 1,
16998                    'transform': 'translateY(0)'
16999                }, 700, 'cubic-bezier(0.2, 1, 0.3, 1)');
17000
17001            } else if (!$body.hasClass('material')) {
17002                // Original theme skin.
17003                $('#search-outer').stop(true).fadeIn(600, 'easeOutExpo');
17004            } else {
17005
17006                // Material theme skin.
17007                $('#header-outer[data-transparent-header="true"] .bg-color-stripe').css('transition', '');
17008                $('#search-outer, #ajax-content-wrap').addClass('material-open');
17009                nectarState.materialSearchOpen = true;
17010                $headerOuterEl.addClass('material-search-open');
17011                $('#fp-nav').addClass('material-ocm-open');
17012
17013                $(window).trigger('nectar-search-open');
17014
17015            }
17016
17017
17018            setTimeout(function () {
17019
17020                $('#search input[type=text]').trigger('focus');
17021
17022                if ($('#search input[type=text]').val() == $placeholder) {
17023                    $('#search input[type=text]').setCursorPosition(0);
17024                }
17025
17026            }, 300);
17027
17028
17029            if (!$(this).hasClass('nectar-search-open-trigger')) {
17030                $(this).toggleClass('open-search');
17031            }
17032
17033
17034            // Close slide out widget area.
17035            $('.slide-out-widget-area-toggle a:not(#toggle-nav).open:not(.animating)').trigger('click');
17036
17037            return false;
17038
17039        });
17040
17041        // Handle the placeholder value.
17042        $('body:not(.material)').on('keydown', '#search input[type=text]', function () {
17043            if ($(this).val() == $placeholder) {
17044                $(this).val('');
17045            }
17046        });
17047
17048        $('body:not(.material)').on('keyup', '#search input[type=text]', function () {
17049            if ($(this).val().length == 0) {
17050                $(this).val($placeholder);
17051                $(this).setCursorPosition(0);
17052            }
17053        });
17054
17055
17056        // Close search btn event.
17057        $body.on('click', '#close', function () {
17058            closeSearch();
17059            $searchButtonEl.removeClass('open-search');
17060            $('#header-outer .mobile-search').removeClass('open-search');
17061            return false;
17062        });
17063
17064        // Original and Ascend skin close search when clicking off.
17065        $('body:not(.material)').on('blur', '#search-box input[type=text]', function () {
17066            closeSearch();
17067            $searchButtonEl.removeClass('open-search');
17068            $('#header-outer .mobile-search').removeClass('open-search');
17069        });
17070
17071
17072        // Material skin close when clicking off the search.
17073        $('body.material').on('click', '#ajax-content-wrap', function (e) {
17074            if (e.originalEvent !== undefined) {
17075                closeSearch();
17076                $searchButtonEl.removeClass('open-search');
17077                $('#header-outer .mobile-search').removeClass('open-search');
17078
17079            }
17080        });
17081
17082        // Material skin close on esc button event.
17083        if ($('body.material').length > 0) {
17084            $(document).on('keyup', function (e) {
17085
17086                if (e.keyCode == 27) {
17087                    closeSearch();
17088                    $searchButtonEl.removeClass('open-search');
17089
17090                    // Close ocm material
17091                    if ($('.ocm-effect-wrap.material-ocm-open').length > 0) {
17092                        $('.slide-out-widget-area-toggle.material-open a').trigger('click');
17093                    }
17094                }
17095
17096            });
17097        }
17098
17099
17100        // Called to hide the search bar.
17101        function closeSearch() {
17102
17103            if ($body.hasClass('ascend') || $('body[data-header-format="left-header"]').length > 0 && $('body.material').length == 0) {
17104                $('#search-outer').stop().transition({
17105                    'opacity': 0
17106                }, 300, 'cubic-bezier(0.2, 1, 0.3, 1)');
17107                $searchButtonEl.addClass('inactive');
17108                setTimeout(function () {
17109                    $('#search-outer').hide();
17110                    $searchButtonEl.removeClass('inactive');
17111                }, 300);
17112            } else if ($('body.material').length == 0) {
17113                $('#search-outer').stop(true).fadeOut(450, 'easeOutExpo');
17114            }
17115
17116            if ($body.hasClass('material')) {
17117
17118                $(window).trigger('nectar-search-close');
17119
17120                var closeTimeoutDur = ($headerOuterEl.hasClass('results-shown')) ? 800 : 400;
17121                setTimeout(function () {
17122                    $('#search-outer #s').val('');
17123                }, closeTimeoutDur);
17124
17125                $('#ajax-content-wrap').removeClass('material-open');
17126                nectarState.materialSearchOpen = false;
17127                $headerOuterEl.removeClass('material-search-open');
17128                $('#search-outer').removeClass('material-open');
17129                $('#fp-nav').removeClass('material-ocm-open');
17130
17131            }
17132        }
17133
17134    }
17135
17136
17137    /**
17138     * Header layout "Centered header bottom bar" functionality.
17139     *
17140     * @since 9.0
17141     */
17142    function centeredNavBottomBarReposition() {
17143
17144        var $headerOuter = $headerOuterEl,
17145            $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'),
17146            $headerSpan3 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_3'),
17147            $secondaryHeader = $headerSecondaryEl,
17148            $headerBtns = $headerSpan3.find('nav >ul.buttons'),
17149            $navLogoMargin = parseInt($('body.material #header-outer').attr('data-padding')),
17150            $navLogoHeight = parseInt($('body.material #header-outer').attr('data-logo-height')),
17151            $separatorExtra = parseInt($headerSpan3.css('margin-bottom')),
17152            $triggerCondition = $navLogoMargin + $separatorExtra + $navLogoHeight + parseInt(nectarDOMInfo.secondaryHeaderHeight);
17153
17154        if ($secondaryHeader.length > 0) {
17155
17156            if ($('#header-outer[data-remove-fixed="1"]').length == 0 && $('#header-outer[data-condense="true"]').length > 0) {
17157
17158                setTimeout(function () {
17159                    if ($headerSecondaryEl.css('display') != 'none') {
17160                        nectarDOMInfo.secondaryHeaderHeight = $headerSecondaryEl.outerHeight();
17161                    }
17162
17163                }, 50);
17164            }
17165
17166        }
17167
17168        // Helper to determine if custom mobile breakpoint is active.
17169        function condenseCustomBreakPointHelper() {
17170
17171            var $withinCustomBreakpoint = mobileBreakPointCheck();
17172
17173            // Adding class to prevent logo from hiding when opening OCM
17174            if ($withinCustomBreakpoint) {
17175                $headerOuterEl.addClass('within-custom-breakpoint');
17176            } else {
17177                $headerOuterEl.removeClass('within-custom-breakpoint');
17178            }
17179        }
17180
17181
17182        // Bind events if "Condense Header On Scroll" effect is enabled.
17183        if ($('#header-outer[data-condense="true"]').length > 0) {
17184
17185            $window.on('scroll.centeredNavCondense', centeredNavBottomFixed_Scroll);
17186            $window.trigger('scroll');
17187
17188            $window.on('resize', function () {
17189                if (nectarDOMInfo.winW < 1000 || mobileBreakPointCheck()) {
17190                    $headerOuter.addClass('force-condense-remove');
17191                    $window.off('scroll.centeredNavCondense');
17192                }
17193            });
17194
17195            $window.on('smartresize', function () {
17196
17197                condenseCustomBreakPointHelper();
17198
17199                if (nectarDOMInfo.winW >= 1000 && false == mobileBreakPointCheck()) {
17200
17201                    // Coming from mobile.
17202                    if ($headerOuter.hasClass('force-condense-remove')) {
17203
17204                        // Remove condense effect.
17205                        centeredNavBottomFixed_Scroll();
17206                        $headerOuter.removeClass('force-condense-remove');
17207
17208                        // See if the condense effect needs to be reapplied.
17209                        setTimeout(function () {
17210
17211                            if (nectarDOMInfo.scrollTop >= $triggerCondition) {
17212                                $headerOuter.addClass('force-condense');
17213                                centeredNavBottomFixed_Scroll();
17214                                $headerOuter.removeClass('force-condense');
17215                            }
17216                            // Bind scroll event.
17217                            $window.on('scroll.centeredNavCondense', centeredNavBottomFixed_Scroll);
17218                        }, 200);
17219
17220                    }
17221                }
17222
17223            });
17224
17225            condenseCustomBreakPointHelper();
17226
17227        }
17228
17229
17230        function centeredNavBottomFixed_Scroll() {
17231
17232            // Bypass calculating.
17233            if (nectarDOMInfo.winW < 1000 ||
17234                $('body.page-template-template-no-header').length > 0 ||
17235                $('body.page-template-template-no-header-footer').length > 0 ||
17236                $('body.material-ocm-open').length > 0 ||
17237                $('#header-outer[data-has-menu="true"][data-format="centered-menu-bottom-bar"] .span_9').css('display') == 'none' ||
17238                $('#header-outer[data-has-menu="true"][data-format="centered-menu-bottom-bar"] .span_9 > nav').css('display') == 'none') {
17239                return;
17240            }
17241
17242            $bodyBorderTop = ($bodyBorderTop.length > 0 && nectarDOMInfo.secondaryHeaderHeight > 0) ? $bodyBorderTop.height() : 0;
17243
17244
17245            // Add condense effect.
17246            if ($headerOuter.hasClass('force-condense') || !$headerOuter.hasClass('fixed-menu') && nectarDOMInfo.scrollTop >= $triggerCondition) {
17247
17248                var amountToMove = (parseInt($headerSpan9.position().top) - $navLogoMargin - parseInt(nectarDOMInfo.adminBarHeight)) + parseInt(nectarDOMInfo.secondaryHeaderHeight) - $bodyBorderTop;
17249
17250                // Megamenu removes transparency option
17251                if ($('#header-outer[data-megamenu-rt="1"]').length > 0 && $('#header-outer .megamenu').length > 0 && $('#header-outer[data-transparent-header="true"]').length > 0) {
17252                    $headerOuterEl.removeClass('no-transition');
17253                }
17254
17255                $headerOuter.addClass('fixed-menu').removeClass('transparent').css({
17256                    'top': '-' + amountToMove + 'px',
17257                    'position': 'fixed'
17258                });
17259
17260                if (!$headerOuter.is('[data-menu-bottom-bar-align="left"]')) {
17261
17262                    var $headerNavBarOffset = ($('header#top .span_9 nav > ul .menu-title-text').length > 0) ? $('header#top .span_9 nav > ul .menu-title-text').offset().top : 0;
17263                    var $headerButtonsOffset = ($headerBtns.find('li:first-child > *').length > 0) ? $headerBtns.find('li:first-child > *').offset().top : 0;
17264                    var $headerButtonsHeight = ($headerSpan9.find('nav .sf-menu > li > a .menu-title-text').length > 0) ? (20 - parseInt($headerSpan9.find('nav .sf-menu > li > a .menu-title-text').height())) / 2 : 2;
17265
17266                    $headerBtns.css('transform', 'translateY(' + Math.ceil(parseInt($headerNavBarOffset) - parseInt($headerButtonsOffset) - $headerButtonsHeight) + 'px)');
17267                    $headerBtns.find('.nectar-woo-cart').css({
17268                        'height': 'auto'
17269                    });
17270
17271                }
17272
17273            }
17274
17275            // Remove condense effect.
17276            else if ($headerOuter.hasClass('force-condense-remove') || $headerOuter.hasClass('fixed-menu') && nectarDOMInfo.scrollTop < $triggerCondition) {
17277
17278                $headerOuter.removeClass('fixed-menu').css({
17279                    'top': '0',
17280                    'position': 'absolute'
17281                });
17282
17283                $headerBtns.css('transform', 'translateY(0px)');
17284                $headerBtns.find('.nectar-woo-cart').css({
17285                    'height': '',
17286                    'position': 'relative'
17287                });
17288
17289                if ($('#header-outer.transparent').length == 0) {
17290
17291                    if ($('#header-outer[data-megamenu-rt="1"]').length > 0 &&
17292                        $('#header-outer .megamenu').length > 0) {
17293                        $headerOuterEl.removeClass('no-transition');
17294                    }
17295
17296                    if ($('#header-outer[data-megamenu-rt="1"]').length > 0 &&
17297                        $('#header-outer[data-transparent-header="true"]').length > 0 &&
17298                        $('#header-outer .megamenu').length > 0) {
17299
17300                        if ($headerOuterEl.attr('data-transparent-header') == 'true' &&
17301                            $('.nectar-box-roll').length == 0 &&
17302                            $('.megamenu.sfHover:not(.width-75):not(.width-50)').length == 0) {
17303
17304                            $headerOuterEl.addClass('transparent');
17305                            $headerOuterEl.removeClass('no-transition');
17306
17307                        } else if ($headerOuterEl.attr('data-transparent-header') == 'true' &&
17308                            $('.nectar-box-roll').length == 0 &&
17309                            $('.megamenu.sfHover').length > 0) {
17310
17311                            $headerOuterEl.addClass('no-transition');
17312                        }
17313
17314                    } else {
17315                        if ($headerOuterEl.attr('data-transparent-header') == 'true' && $('.nectar-box-roll').length == 0) {
17316                            $headerOuterEl.addClass('transparent');
17317                        }
17318                    }
17319
17320                } // endif transparent header conditional.
17321
17322
17323            }
17323 // End Remove condense effect.
17324
17325        } // End centeredNavBottomFixed_Scroll.
17326
17327
17328    }
17329
17330
17331    /**
17332     * Header layout "Centered header bottom bar" initialization.
17333     *
17334     * @since 10.5
17335     */
17336    function centeredNavBottomBarInit() {
17337
17338        if ($('#header-outer[data-format="centered-menu-bottom-bar"]').length > 0) {
17339            centeredNavBottomBarReposition();
17340        }
17341
17342    }
17343
17344
17345    /**
17346     * Header layout "Centered logo between menu".
17347     *
17348     * Splits the main navigation menu into two sections placed on each side of logo.
17349     *
17350     * @since 8.0
17351     */
17352    function centeredLogoMargins() {
17353
17354        if (nectarDOMInfo.winW > 1000) {
17355
17356            var $navItemLength = $('#header-outer[data-format="centered-logo-between-menu"] #top nav > .sf-menu:not(.buttons) > li').length;
17357
17358            if ($('#header-outer #social-in-menu').length > 0) {
17359                $navItemLength--;
17360            }
17361
17362            var $centerLogoWidth,
17363                $extraMenuSpace;
17364
17365            if ($('#header-outer #top .row .col.span_3 #logo img:visible').length == 0) {
17366                $centerLogoWidth = parseInt($('#header-outer #top .row .col.span_3').width());
17367            } else {
17368                $centerLogoWidth = parseInt($('#header-outer #top .row .col.span_3 img:visible').width());
17369            }
17370
17371            if ($('#header-outer[data-lhe="animated_underline"]').length > 0) {
17372                $extraMenuSpace = parseInt($('header#top nav > ul > li:first-child > a').css('margin-right'));
17373            } else {
17374                $extraMenuSpace = parseInt($('header#top nav > ul > li:first-child > a').css('padding-right'));
17375            }
17376
17377            if ($extraMenuSpace > 30) {
17378                $extraMenuSpace += 45;
17379            } else if ($extraMenuSpace > 20) {
17380                $extraMenuSpace += 40;
17381            } else {
17382                $extraMenuSpace += 30;
17383            }
17384
17385            if (!$body.hasClass('rtl')) {
17386                $('#header-outer[data-format="centered-logo-between-menu"] #top nav > .sf-menu:not(.buttons) > li:nth-child(' + Math.floor($navItemLength / 2) + ')').css({
17387                    'margin-right': ($centerLogoWidth + $extraMenuSpace) + 'px'
17388                }).addClass('menu-item-with-margin');
17389            } else {
17390                $('#header-outer[data-format="centered-logo-between-menu"] #top nav > .sf-menu:not(.buttons) > li:nth-child(' + Math.floor($navItemLength / 2) + ')').css({
17391                    'margin-left': ($centerLogoWidth + $extraMenuSpace) + 'px'
17392                }).addClass('menu-item-with-margin');
17393            }
17394
17395            var $leftMenuWidth = 0;
17396            var $rightMenuWidth = 0;
17397
17398            $('#header-outer[data-format="centered-logo-between-menu"] #top nav > .sf-menu:not(.buttons) > li:not(#social-in-menu)').each(function (i) {
17399                if (i + 1 <= Math.floor($navItemLength / 2)) {
17400                    $leftMenuWidth += $(this).width();
17401                } else {
17402                    $rightMenuWidth += $(this).width();
17403                }
17404
17405            });
17406
17407            var $menuDiff = Math.abs($rightMenuWidth - $leftMenuWidth);
17408
17409            if ($leftMenuWidth > $rightMenuWidth || ($body.hasClass('rtl') && $leftMenuWidth < $rightMenuWidth)) {
17410                $('#header-outer #top .row > .col.span_9').css('padding-right', $menuDiff);
17411            } else {
17412                $('#header-outer #top .row > .col.span_9').css('padding-left', $menuDiff);
17413            }
17414
17415            $('#header-outer[data-format="centered-logo-between-menu"] nav').css('visibility', 'visible');
17416
17417        } else if ($('#header-outer[data-format="centered-logo-between-menu"]').length > 0 && nectarDOMInfo.winW < 1000) {
17418            $('#header-outer .row > .col.span_9').css({
17419                'padding-right': '0',
17420                'padding-left': '0'
17421            });
17422        }
17423
17424    }
17425
17426
17427    /**
17428     * Header layout "Centered logo between menu" initialization.
17429     *
17430     * @since 10.5
17431     */
17432    function centeredLogoHeaderInit() {
17433
17434        if ($('#header-outer[data-format="centered-logo-between-menu"]').length > 0) {
17435
17436            if (!usingLogoImage) {
17437                centeredLogoMargins();
17438            } else if (usingLogoImage && $('#header-outer[data-format="centered-logo-between-menu"]').length > 0 && $('header#top #logo img:first[src]').length > 0) {
17439
17440                //fadein img on load
17441                var tempLogoImg = new Image();
17442                tempLogoImg.src = $('header#top #logo img:first').attr('src');
17443
17444                tempLogoImg.onload = function () {
17445                    centeredLogoMargins();
17446                };
17447
17448            }
17449
17450            // Resize event.
17451            $window.on('smartresize', centeredLogoMargins);
17452
17453        }
17454
17455    }
17456
17457
17458    /**
17459     * Handle basic items before initializing effects.
17460     *
17461     * @since 10.5
17462     */
17463    function headerNavPreInit() {
17464
17465        // Page fullscreen rows does not need permanent transparent.
17466        if ($('#nectar_fullscreen_rows').length > 0 && $fullscreenMarkupBool == true) {
17467            ($headerOuterEl.attr('data-permanent-transparent', 'false'));
17468        }
17469
17470        // Set mobile header height.
17471        if (nectarDOMInfo.usingMobileBrowser && $('#header-outer[data-mobile-fixed="1"]').length > 0 &&
17472            $('#header-outer[data-transparent-header="true"]').length == 0) {
17473            $('#header-space').css('height', $headerOuterEl.outerHeight()).addClass('calculated');
17474        }
17475
17476        // Header nav entrance animation.
17477        if (window.nectarOptions && window.nectarOptions.header_entrance && window.nectarOptions.header_entrance == 'true') {
17478            if (nectarDOMInfo.scrollTop == 0) {
17479                $('#header-outer').addClass('entrance-animation');
17480            } else {
17481                $('#header-outer').css('opacity', '1');
17482            }
17483        }
17484
17485
17486        // Permanent transparent header.
17487        if ($('#nectar_fullscreen_rows').length == 0 && $('.nectar-box-roll').length == 0) {
17488            midnightInit();
17489        } else if ($('#nectar_fullscreen_rows').length > 0 && $fullscreenMarkupBool == false) {
17490            midnightInit();
17491        }
17492
17493    }
17494
17495
17496    /**
17497     * Hide header until needed.
17498     *
17499     * Used when "Header Hide Until Needed" is active.
17500     *
17501     * @since 10.5
17502     */
17503    var hhunState = {
17504        timeoutQueued: false,
17505        visible: true,
17506        init: false,
17507        raf: '',
17508        bodyOffsetHeight: 10000
17509    }
17510
17511    function hhunHeaderEffect() {
17512
17513        var previousScroll = 0, // previous scroll position
17514            menuOffset = (headerTransparent == false && $('#page-header-bg[data-
17514parallax="1"]').length > 0) ? 200 : 60, // height of menu (once scroll passed it, menu is hidden)
17515            hideShowOffset = 2, // scrolling value after which triggers hide/show menu
17516            stickyPageSubmenu = ($('.page-submenu[data-sticky="true"]').length > 0) ? true : false;
17517
17518        hhunState.bodyOffsetHeight = document.body.offsetHeight;
17519
17520        function getBodyHeight() {
17521            if (nectarState.materialOffCanvasOpen != true) {
17522                hhunState.bodyOffsetHeight = document.body.offsetHeight;
17523            }
17524        }
17525
17526        // Periodically update the body height.
17527        if (hhunState.init == false) {
17528            setInterval(getBodyHeight, 1500);
17529        }
17530
17531        // Called in RAF loop to calculate the header visibility.
17532        function hhunCalcs() {
17533
17534            $headerOuterEl[0].classList.add('detached');
17535
17536
17537            var currentScroll = nectarDOMInfo.scrollTop, // Gets current scroll position
17538                scrollDifference = Math.abs(currentScroll - previousScroll); // Calculates how fast user is scrolling
17539
17540            // Stop scrolling while animated anchors / box roll
17541            if (nectarState.animatedScrolling == true ||
17542                nectarState.preventScroll == true ||
17543                nectarState.ocmOpen == true) {
17544
17545
17546                if (currentScroll > menuOffset) {
17547
17548                    // Remove transparent when clicking anchor from the top
17549                    if (nectarState.animatedScrolling == true && headerTransparent == true && nectarState.permanentTransHeader == false) {
17550                        $headerOuterEl.removeClass('transparent').addClass('scrolling');
17551                    }
17552
17553                    // Still keep scroll tracking to continue hiding menu.
17554                    previousScroll = nectarDOMInfo.scrollTop;
17555                    currentScroll = nectarDOMInfo.scrollTop;
17556
17557                }
17558
17559                hhunState.raf = requestAnimationFrame(hhunCalcs);
17560                return;
17561
17562            }
17563
17564            // Stop when material ocm or material search is open
17565            if (nectarState.materialOffCanvasOpen == true || nectarState.materialSearchOpen == true) {
17566
17567                // Still handle transparency when scrolling with material search open.
17568                if (nectarState.materialSearchOpen == true && headerTransparent == true) {
17569
17570                    if (nectarState.permanentTransHeader == false && currentScroll > menuOffset) {
17571                        $headerOuterEl.removeClass('transparent').addClass('scrolling');
17572                    } else {
17573                        $headerOuterEl.addClass('transparent').removeClass('scrolling');
17574                    }
17575
17576                }
17577
17578                hhunState.raf = requestAnimationFrame(hhunCalcs);
17579                return;
17580
17581            }
17582
17583
17584            if (!$headerOuterEl.hasClass('side-widget-open') && !$('#header-outer .slide-out-widget-area-toggle a').hasClass('animating')) {
17585
17586                var heightToAdjust;
17587
17588
17589                // Handle secondary header
17590                if ($headerSecondaryEl.length > 0) {
17591                    if (currentScroll > menuOffset) {
17592                        $headerSecondaryEl.addClass('hide-up');
17593                        $headerOuterEl.css('transform', 'translateY(-' + nectarDOMInfo.secondaryHeaderHeight + 'px)');
17594                    } else {
17595                        $headerSecondaryEl.removeClass('hide-up');
17596                        $headerOuterEl.css('transform', '0px)');
17597                    }
17598                }
17599
17600
17601                // Scrolled past menu
17602                if (currentScroll > menuOffset) {
17603
17604                    // Handle transparency
17605                    if (nectarState.permanentTransHeader == false) {
17606
17607                        if (hhunState.timeoutQueued == false) {
17608                            setTimeout(function () {
17609
17610                                if (false == nectarState.ocmOpen) {
17611                                    $headerOuterEl.removeClass('transparent');
17612                                    $headerOuterEl.addClass('scrolling');
17613                                }
17614                                hhunState.timeoutQueued = false;
17615
17616                            }, 400);
17617                        }
17618                        hhunState.timeoutQueued = true;
17619
17620                    }
17621
17622                    $headerOuterEl.removeClass('no-transition');
17623
17624
17625                    // Scrolling faster than hideShowOffset hide/show menu
17626                    if (scrollDifference >= hideShowOffset) {
17627
17628
17629                        if (currentScroll > previousScroll) {
17630
17631                            // Hide menu
17632                            if (!$headerOuterEl.hasClass('invisible')) {
17633
17634                                $headerOuterEl
17635                                    .addClass('invisible')
17636                                    .removeClass('at-top');
17637
17638                                // Close submenus
17639                                if (nectarDOMInfo.winW > 1000 && $(".sf-menu").length > 0 && $().superfish) {
17640                                    $(".sf-menu").superfish('hide');
17641                                    $('header#top nav > ul.sf-menu > li.menu-item-over').removeClass('menu-item-over');
17642                                }
17643
17644                            }
17645
17646                            if (stickyPageSubmenu == true) {
17647                                $('.page-submenu.stuck')
17648                                    .css('transform', 'translateY(0px)')
17649                                    .addClass('header-not-visible');
17650                            }
17651
17652
17653                        } else {
17654
17655                            // Show menu
17656                            if ($headerOuterEl.hasClass('invisible')) {
17657                                $headerOuterEl.removeClass('invisible');
17658                            }
17659
17660                            // Page submenu adjust
17661                            if (stickyPageSubmenu == true) {
17662
17663                                heightToAdjust = $headerOuterEl.outerHeight();
17664
17665                                if ($headerSecondaryEl.length > 0) {
17666                                    heightToAdjust -= nectarDOMInfo.secondaryHeaderHeight;
17667                                }
17668
17669                                if ($bodyBorderTop.length > 0 && nectarDOMInfo.winW > 999) {
17670
17671                                    $bodyBorderSizeToRemove = ($bodyBorderHeaderColorMatch) ? $bodyBorderTop.height() : 0;
17672
17673                                    $('.page-submenu.stuck')
17674                                        .css('transform', 'translateY(' + (heightToAdjust - $bodyBorderSizeToRemove) + 'px)')
17675                                        .removeClass('header-not-visible');
17676
17677                                } else {
17678                                    $('.page-submenu.stuck')
17679                                        .css('transform', 'translateY(' + heightToAdjust + 'px)')
17680                                        .removeClass('header-not-visible');
17681                                }
17682
17683                            } // End sticky page sub conditional.
17684
17685                        }
17686
17687                    }
17688
17689                } else {
17690                    // At top of document.
17691                    var $topDetachNum = ($headerSecondaryEl.length > 0) ? 32 : 0;
17692                    if (usingSmoothScroll) {
17693                        $topDetachNum += 10;
17694                    }
17695                    if ($bodyBorderTop.length > 0) {
17696                        $topDetachNum = ($headerSecondaryEl.length > 0) ? 32 + $bodyBorderTop.height() : $bodyBorderTop.height();
17697                    }
17698
17699                    if (currentScroll <= $topDetachNum) {
17700
17701                        $headerOuterEl
17702                            .addClass('at-top')
17703                            .removeClass('invisible')
17704                            .removeClass('scrolling');
17705
17706                        // Megamenu removes transparent.
17707                        if (nectarDOMInfo.winW > 999 &&
17708                            $('#header-outer[data-megamenu-rt="1"]').length > 0 &&
17709                            headerTransparent == true &&
17710                            $('#header-outer .megamenu').length > 0) {
17711
17712                            if ($('.nectar-box-roll').length == 0 &&
17713                                $('.megamenu.sfHover:not(.width-75):not(.width-50)').length == 0) {
17714
17715                                $headerOuterEl
17716                                    .addClass('transparent')
17717                                    .css('transform', 'translateY(0)')
17718                                    .removeClass('no-transition');
17719
17720                            } else if ($('.nectar-box-roll').length > 0) {
17721
17722                                $headerOuterEl
17723                                    .css('transform', 'translateY(0)')
17724                                    .addClass('at-top-before-box');
17725                            }
17726
17727                        } else {
17728
17729                            if (headerTransparent == true && nectarBoxRoll.inUse == false) {
17730
17731                                $headerOuterEl
17732                                    .addClass('transparent')
17733                                    .css('transform', 'translateY(0)');
17734
17735                            } else if (nectarBoxRoll.inUse == true) {
17736
17737                                $headerOuterEl
17738                                    .css('transform', 'translateY(0)')
17739                                    .addClass('at-top-before-box');
17740                            }
17741                        }
17742
17743
17744                    }
17745
17746                }
17747
17748
17749                // At the bottom of document - show menu
17750                if ((nectarDOMInfo.winH + nectarDOMInfo.scrollTop + 30) >= hhunState.bodyOffsetHeight) {
17751
17752                    $headerOuterEl.removeClass('invisible');
17753
17754                    // Page submenu adjust
17755                    if (stickyPageSubmenu == true) {
17756
17757                        heightToAdjust = $headerOuterEl.outerHeight();
17758                        if ($headerSecondaryEl.length > 0) {
17759                            heightToAdjust -= nectarDOMInfo.secondaryHeaderHeight;
17760                        }
17761
17762                        if ($bodyBorderTop.length > 0 && nectarDOMInfo.winW > 999) {
17763
17764                            $bodyBorderSizeToRemove = ($bodyBorderHeaderColorMatch) ? $bodyBorderTop.height() : 0;
17765                            $('.page-submenu.stuck')
17766                                .css('transform', 'translateY(' + (heightToAdjust - $bodyBorderSizeToRemove) + 'px)')
17767                                .removeClass('header-not-visible');
17768                        } else {
17769
17770                            $('.page-submenu.stuck')
17771                                .css('transform', 'translateY(' + heightToAdjust + 'px)')
17772                                .removeClass('header-not-visible');
17773                        }
17774
17775                    }
17775 // End sticky page submenu conditional.
17776
17777                }
17778
17779            }
17780
17781            // Keep track of current scroll position
17782            previousScroll = currentScroll;
17783
17784            hhunState.raf = requestAnimationFrame(hhunCalcs);
17785
17786
17787        }
17788
17789        // Start the animation loop.
17790        hhunState.raf = requestAnimationFrame(hhunCalcs);
17791
17792        if (hhunState.init == false) {
17793            hhunState.init = true;
17794        }
17795
17796    }
17797
17798
17799    /**
17800     * Shrink the header navigation size.
17801     *
17802     * Used when "Header Resize On Scroll" is active.
17803     *
17804     * @since 1.0
17805     */
17806    function smallNav() {
17807
17808        var $offset = nectarDOMInfo.scrollTop,
17809            $windowWidth = nectarDOMInfo.winW,
17810            $scrollTriggerOffset = 30;
17811
17812        if (headerTransparent == true && !nectarDOMInfo.usingMobileBrowser) {
17813            $scrollTriggerOffset = usingSmoothScroll ? 30 : 0;
17814        }
17815
17816        /* Intesys - Start 1 */
17817        if ($offset >= 300 && $offset < 800) {
17818            $('#header-outer').addClass('translated-up');
17819        } else {
17820            $('#header-outer').removeClass('translated-up');
17821        }
17822
17823        if ($offset < 500) {
17824            $('#header-outer').css('position', 'absolute');
17825        } else {
17826            $('#header-outer').css('position', 'fixed');
17827        }
17828
17829        $scrollTriggerOffset = 800;
17830        /* Intesys - End 1 */
17831
17832        if ($offset > $scrollTriggerOffset && $windowWidth >= 1000 && $('body.material-ocm-open').length == 0) {
17833
17834
17835            // Going to small when material search is closing, it must be closed immediately
17836            if ($body.is('.material')) {
17837
17838                if ($('#search-outer.material-open').length == 0) {
17839                    $('#header-outer[data-transparent-header="true"] .bg-color-stripe').css('transition', 'none');
17840                }
17841
17842                // Secondary header
17843                if ($headerSecondaryEl.length > 0) {
17844                    $headerSecondaryEl.addClass('hide-up');
17845                    $headerOuterEl.css('transform', 'translateY(-' + nectarDOMInfo.secondaryHeaderHeight + 'px)');
17846                }
17847
17848            }
17849
17850            if ($('#header-outer[data-megamenu-rt="1"]').length > 0 &&
17851                $('#header-outer[data-transparent-header="true"]').length > 0 &&
17852                $('#header-outer .megamenu').length > 0) {
17853
17854                if ($headerOuterEl.attr('data-transparent-header') == 'true' &&
17855                    $('#header-outer.side-widget-open').length == 0 &&
17856                    $('#header-outer[data-permanent-transparent="1"]').length == 0 &&
17857                    $('.megamenu.sfHover:not(.width-75):not(.width-50)').length == 0) {
17858                    $headerOuterEl.removeClass('transparent');
17859                    $headerOuterEl.removeClass('no-transition');
17860                }
17861
17862            } else {
17863
17864                if ($headerOuterEl.attr('data-transparent-header') == 'true' &&
17865                    $('#header-outer.side-widget-open').length == 0 &&
17866                    $('#header-outer[data-permanent-transparent="1"]').length == 0) {
17867                    $headerOuterEl.removeClass('transparent');
17868                }
17869
17870            }
17871
17872            // Centered logo between menu.
17873            $('#header-outer:not(.small-nav) header#top nav > ul > li.menu-item-with-margin').stop(true, true).animate({
17874                'margin-right': (parseInt($('header#top nav > ul > li.menu-item-with-margin').css('margin-right')) - parseInt(logoShrinkNum) * 3) + 'px'
17875            }, {
17876                queue: false,
17877                duration: 250,
17878                easing: 'easeOutCubic'
17879            });
17880
17881            // Add small nav class.
17882            $('#header-outer, #search-outer').addClass('small-nav');
17883
17884            // Body border full width side padding
17885            if ($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 &&
17886                $bodyBorderTop.length > 0 &&
17887                $bodyBorderHeaderColorMatch == true) {
17888
17889                $('#header-outer[data-full-width="true"] header > .container').stop(true, true).animate({
17890                    'padding': '0'
17891                }, {
17892                    queue: false,
17893                    duration: 250,
17894                    easing: 'easeOutCubic'
17895                });
17896
17897            }
17898
17899            /* Intesys - Start 2 */
17900            $('#header-outer').removeClass('translated-up');
17901            /* Intesys - End 2 */
17902
17903            // Box roll effect
17904            if ($('.nectar-box-roll').length > 0 && $('#header-outer[data-permanent-transparent="1"]').length == 0) {
17905                $('#ajax-content-wrap').animate({
17906                    'margin-top': (Math.floor(($logoHeight - logoShrinkNum) + (headerPadding * 2) / 1.8 + nectarDOMInfo.adminBarHeight + nectarDOMInfo.secondaryHeaderHeight))
17907                }, {
17908                    queue: false,
17909                    duration: 250,
17910                    easing: 'easeOutCubic'
17911                });
17912            }
17913
17914            $window.off('scroll.headerResizeEffect', smallNav);
17915            $window.on('scroll.headerResizeEffect', bigNav);
17916
17917            // Dark slider coloring border
17918            $('#header-outer[data-transparent-header="true"]').css('transition', 'transform 0.3s ease, background-color 0.30s ease, opacity 0.3s ease, box-shadow 0.30s ease, margin 0.25s ease-out, backdrop-filter 0.25s ease');
17919            $('#header-outer[data-transparent-header="true"] .cart-menu').css('transition', 'none');
17920            setTimeout(function () {
17921                $('#header-outer[data-transparent-header="true"]').css('transition', 'transform 0.3s ease, background-color 0.30s ease, opacity 0.3s ease, box-shadow 0.30s ease, border-color 0.30s ease, margin 0.25s ease-out, backdrop-filter 0.25s ease');
17922                $('#header-outer[data-transparent-header="true"] .cart-menu').css('transition', 'border-color 0.30s ease');
17923            }, 300);
17924
17925        }
17926
17927    }
17928
17929
17930    /**
17931     * Return header navigation size to full.
17932     *
17933     * Used when "Header Resize On Scroll" is active.
17934     *
17935     * @since 1.0
17936     */
17937    function bigNav() {
17938
17939        var $offset = nectarDOMInfo.scrollTop,
17940            $windowWidth = nectarDOMInfo.winW,
17941            $scrollTriggerOffset = 30;
17942
17943        if ($body.is('.material-ocm-open')) {
17944            return false;
17945        }
17946
17947        if (headerTransparent == true && !nectarDOMInfo.usingMobileBrowser) {
17948            $scrollTriggerOffset = usingSmoothScroll ? 30 : 0;
17949        }
17950
17951        /* Intesys - Start 3 */
17952        if ($offset >= 300 && $offset < 800) {
17953            $('#header-outer').addClass('translated-up');
17954        } else {
17955            $('#header-outer').removeClass('translated-up');
17956        }
17957
17958        if ($offset < 500) {
17959            $('#header-outer').css('position', 'absolute');
17960        } else {
17961            $('#header-outer').css('position', 'fixed');
17962        }
17963
17964        $scrollTriggerOffset = 800;
17965        /* Intesys - End 3 */
17966
17967        if ($offset <= $scrollTriggerOffset && $windowWidth >= 1000 || $('.small-nav').length > 0 && $('#ajax-content-wrap.no-scroll').length > 0) {
17968
17969            $('#header-outer, #search-outer').removeClass('small-nav');
17970
17971            if ($('#header-outer[data-megamenu-rt="1"]').length > 0 &&
17972                $('#header-outer[data-transparent-header="true"]').length > 0 &&
17973                $('#header-outer .megamenu').length > 0) {
17974
17975                if ($headerOuterEl.attr('data-transparent-header') == 'true' &&
17976                    $('.nectar-box-roll').length == 0 &&
17977                    $('.megamenu.sfHover:not(.width-75):not(.width-50)').length == 0) {
17978
17979                    $headerOuterEl.addClass('transparent');
17980                    $headerOuterEl.removeClass('no-transition');
17981                }
17982
17983            } else {
17984
17985                if ($headerOuterEl.attr('data-transparent-header') == 'true' && $('.nectar-box-roll').length == 0) {
17986                    $headerOuterEl.addClass('transparent');
17987                }
17988
17989            }
17990
17991            // Body border full width side padding
17992            if ($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 &&
17993                $bodyBorderTop.length > 0 &&
17994                $bodyBorderHeaderColorMatch == true) {
17995
17996                $('#header-outer[data-full-width="true"] header > .container').stop(true, true).animate({
17997                    'padding': '0 28px'
17998                }, {
17999                    queue: false,
18000                    duration: 250,
18001                    easing: 'easeOutCubic'
18002                });
18003
18004            }
18005
18006            // centered logo between menu.
18007            $('header#top nav > ul > li.menu-item-with-margin').stop(true, true).animate({
18008                'margin-right': (parseInt($('header#top nav > ul > li.menu-item-with-margin').css('margin-right')) + parseInt(logoShrinkNum) * 3) + 'px'
18009            }, {
18010                queue: false,
18011                duration: 150,
18012                easing: 'easeOutCubic'
18013            });
18014
18015
18016            // Secondary header
18017            if ($headerSecondaryEl.length > 0) {
18018
18019                $headerSecondaryEl.removeClass('hide-up');
18020                $headerOuterEl
18021                    .removeClass('hide-up')
18022                    .css('transform', 'translateY(0%)');
18023
18024            }
18025
18026            // Box roll
18027            if ($('.nectar-box-roll').length > 0 && $('#header-outer[data-permanent-transparent="1"]').length == 0) {
18028                $('#ajax-content-wrap').animate({
18029                    'margin-top': (Math.floor(($logoHeight) + (headerPadding * 2) + nectarDOMInfo.adminBarHeight + nectarDOMInfo.secondaryHeaderHeight))
18030                }, {
18031                    queue: false,
18032                    duration: 250,
18033                    easing: 'easeOutCubic'
18034                });
18035            }
18036
18037            $window.off('scroll.headerResizeEffect', bigNav);
18038            $window.on('scroll.headerResizeEffect', smallNav);
18039
18040            // Dark slider coloring border
18041            $('#header-outer[data-transparent-header="true"]').css('transition', 'transform 0.3s ease, background-color 0.30s ease, opacity 0.3s ease, box-shadow 0.30s ease, margin 0.25s ease-out, backdrop-filter 0.25s ease');
18042            $('#header-outer[data-transparent-header="true"] .cart-menu').css('transition', 'none');
18043            setTimeout(function () {
18044                $('#header-outer[data-transparent-header="true"]').css('transition', 'transform 0.3s ease, background-color 0.30s ease, opacity 0.3s ease, box-shadow 0.30s ease, border-color 0.30s ease, margin 0.25s ease-out, backdrop-filter 0.25s ease');
18045                $('#header-outer[data-transparent-header="true"] .cart-menu').css('transition', 'border-color 0.30s ease');
18046            }, 300);
18047        }
18048
18049    }
18050
18051
18052    /**
18053     * Default scroll event to handle transparency/secondary header when no header effects are enabled.
18054     *
18055     * @since 4.0
18056     */
18057    function opaqueCheck() {
18058
18059        // The condense header effect will bypass this unless in the custom mobile breakpoint (which is defined in theme options).
18060        if ($('#header-outer[data-format="centered-menu-bottom-bar"][data-condense="true"]').length > 0 && !$headerOuterEl.hasClass('within-custom-breakpoint')) {
18061            return;
18062        }
18063
18064        if (nectarDOMInfo.scrollTop >= 1) {
18065
18066            if ($('body.material').length > 0) {
18067                $headerOuterEl.addClass('scrolled-down');
18068
18069                // Secondary header
18070                if ($headerSecondaryEl.length > 0 && nectarDOMInfo.winW > 1000) {
18071                    $headerSecondaryEl.addClass('hide-up');
18072                    $headerOuterEl.css('transform', 'translateY(-' + nectarDOMInfo.secondaryHeaderHeight + 'px)');
18073                }
18074            }
18075
18076            if ($headerOuterEl.attr('data-transparent-header') == 'true' && $('#header-outer[data-permanent-transparent="1"]').length == 0) {
18077                $headerOuterEl.removeClass('transparent').addClass('scrolled-down');
18078            }
18079
18080            // Switch event to watch.
18081            $window.off('scroll.headerResizeEffectOpaque', opaqueCheck);
18082            $window.on('scroll.headerResizeEffectOpaque', transparentCheck);
18083        }
18084    }
18085
18086
18087    /**
18088     * Default scroll event to handle transparency/secondary header when no header effects are enabled.
18089     *
18090     * @since 4.0
18091     */
18092    function transparentCheck() {
18093
18094        // The condense header effect will bypass this unless in the custom mobile breakpoint (which is defined in theme options).
18095        if ($('#header-outer[data-format="centered-menu-bottom-bar"][data-condense="true"]').length > 0 && !$headerOuterEl.hasClass('within-custom-breakpoint')) {
18096            return;
18097        }
18098
18099        if (nectarDOMInfo.scrollTop < 1 && $('body.material-ocm-open').length == 0) {
18100
18101            if ($('#header-outer[data-megamenu-rt="1"]').length > 0 &&
18102                $('#header-outer[data-transparent-header="true"]').length > 0 &&
18103                $('#header-outer .megamenu').length > 0) {
18104
18105                if ($headerOuterEl.attr('data-transparent-header') == 'true' && $('.megamenu.sfHover:not(.width-75):not(.width-50)').length == 0) {
18106
18107                    $headerOuterEl
18108                        .addClass('transparent')
18109                        .removeClass('scrolled-down');
18110
18111                    $headerOuterEl.removeClass('no-transition');
18112
18113                } else if ($headerOuterEl.attr('data-transparent-header') == 'true') {
18114
18115                    $headerOuterEl.removeClass('scrolled-down');
18116                }
18117
18118            } else {
18119
18120                if ($headerOuterEl.attr('data-transparent-header') == 'true') {
18121                    $headerOuterEl
18122                        .addClass('transparent')
18123                        .removeClass('scrolled-down');
18124                }
18125
18126            }
18127
18128            if ($('body.material').length > 0) {
18129                $headerOuterEl.removeClass('scrolled-down');
18130
18131                // Secondary header
18132                if ($headerSecondaryEl.length > 0 && nectarDOMInfo.winW > 1000) {
18133
18134                    $headerSecondaryEl.removeClass('hide-up');
18135                    $headerOuterEl
18136                        .removeClass('hide-up')
18137                        .css('transform', 'translateY(0%)');
18138                }
18139            }
18140
18141            // Switch event to watch.
18142            $window.off('scroll.headerResizeEffectOpaque', transparentCheck);
18143            $window.on('scroll.headerResizeEffectOpaque', opaqueCheck);
18144        }
18145
18146    }
18147
18148
18149    /**
18150     * Mobile header event for handling transparency/secondary header.
18151     *
18152     * @since 10.5
18153     * @see bindScrollEffectsMobile
18154     */
18155    function mobileHeaderRAF() {
18156
18157        if (nectarState.materialOffCanvasOpen == true) {
18158            requestAnimationFrame(mobileHeaderRAF);
18159            return;
18160        }
18161        // Scrolled down.
18162        if (nectarDOMInfo.scrollTop > 5) {
18163
18164            if (nectarState.mobileHeader != 'scrolled') {
18165
18166                if (nectarState.permanentTransHeader == false) {
18167                    $headerOuterEl.removeClass('transparent');
18168                }
18169
18170                if (nectarDOMInfo.secondaryHeaderHeight > 0) {
18171                    $headerSecondaryEl.addClass('hide-up');
18172                    $headerOuterEl.css('transform', 'translateY(-' + nectarDOMInfo.secondaryHeaderHeight + 'px)').addClass('hidden-secondary');
18173                } else {
18174                    $headerOuterEl.removeClass('hidden-secondary');
18175                }
18176
18177                $headerOuterEl.addClass('scrolled-down');
18178
18179                // Update state.
18180                nectarState.mobileHeader = 'scrolled';
18181            }
18182
18183        }
18184        // At top.
18185        else {
18186
18187            if (nectarState.mobileHeader != 'at-top') {
18188
18189                if ($headerOuterEl.attr('data-transparent-header') == 'true') {
18190                    $headerOuterEl.addClass('transparent');
18191                }
18192
18193                if (nectarDOMInfo.secondaryHeaderHeight > 0) {
18194                    $headerSecondaryEl.removeClass('hide-up');
18195                    $headerOuterEl.css('transform', 'translateY(0px)');
18196                }
18197                $headerOuterEl.removeClass('hidden-secondary').removeClass('scrolled-down');
18198
18199                // Update state.
18200                nectarState.mobileHeader = 'at-top';
18201            }
18202
18203        }
18204
18205        if (nectarDOMInfo.winW < 1000) {
18206            requestAnimationFrame(mobileHeaderRAF);
18207        }
18208    }
18209
18210
18211    /**
18212     * Bind mobile header scroll effects.
18213     *
18214     * @since 10.5
18215     * @see headerNavScrollInit
18216     */
18217    function bindScrollEffectsMobile() {
18218
18219        if (nectarDOMInfo.winW > 999) {
18220            return;
18221        }
18222
18223        // Reset state.
18224        nectarState.mobileHeader = '';
18225
18226        // Unbind desktop effects.
18227        $window.off('scroll.headerResizeEffect');
18228        $window.off('scroll.headerResizeEffectOpaque');
18229
18230
18231        // Handle mobile transparent class.
18232        if (headerHideUntilNeeded == '1' && $('#header-outer[data-mobile-fixed="1"]').length > 0) {
18233
18234            if ($('.nectar-box-roll').length > 0) {
18235                $headerOuterEl.addClass('at-top-before-box');
18236            }
18237
18238            cancelAnimationFrame(hhunState.raf);
18239            hhunState.timeoutQueued = false;
18240            hhunHeaderEffect();
18241
18242        } else if ($('#header-outer[data-mobile-fixed="1"]').length > 0) {
18243            requestAnimationFrame(mobileHeaderRAF);
18244
18245            // Remove HHUN classes.
18246            cancelAnimationFrame(hhunState.raf);
18247
18248            $headerOuterEl
18249                .removeClass('scrolled-down')
18250                .removeClass('detached')
18251                .removeClass('invisible')
18252                .removeClass('at-top')
18253                .css('transform', 'none');
18254        } else if ($headerOuterEl.attr('data-transparent-header') == 'true') {
18255            $headerOuterEl.addClass('transparent');
18256        }
18257
18258        $window.off('smartresize.nectarNavScrollEffects');
18259        $window.on('smartresize.nectarNavScrollEffects', bindScrollEffectsDesktop);
18260
18261    }
18262
18263    /**
18264     * Bind deaktop header scroll effects.
18265     *
18266     * @since 10.5
18267     * @see headerNavScrollInit
18268     */
18269    function bindScrollEffectsDesktop() {
18270
18271        if (nectarDOMInfo.winW < 1000) {
18272            return;
18273        }
18274
18275        if (headerResize == true && headerHideUntilNeeded != '1') {
18276
18277            $window.off('scroll.headerResizeEffect');
18278
18279            if ($('#nectar_fullscreen_rows').length == 0) {
18280                $window.on('scroll.headerResizeEffect', smallNav);
18281            } else if ($('#nectar_fullscreen_rows[data-mobile-disable="on"]').length > 0 && nectarDOMInfo.usingMobileBrowser) {
18282                $window.on('scroll.headerResizeEffect', smallNav);
18283            }
18284
18285        } else if (headerHideUntilNeeded != '1') {
18286
18287            $window.off('scroll.headerResizeEffectOpaque');
18288            $window.on('scroll.headerResizeEffectOpaque', opaqueCheck);
18289
18290        } else if (headerHideUntilNeeded == '1') {
18291
18292
18293            if ($('.nectar-box-roll').length > 0) {
18294                $headerOuterEl.addClass('at-top-before-box');
18295            }
18296
18297            // Don't trigger for header remove stickiness.
18298            if ($('#header-outer[data-remove-fixed="1"]').length == 0) {
18299                cancelAnimationFrame(hhunState.raf);
18300                hhunHeaderEffect();
18301            } else {
18302                // Remove HHUN classes.
18303                cancelAnimationFrame(hhunState.raf);
18304                hhunState.timeoutQueued = true;
18305
18306                // maybe transparent.
18307                if ($headerOuterEl.attr('data-transparent-header') == 'true' &&
18308                    $('body.material #header-outer[data-condense="true"]').length == 0 &&
18309                    $headerOuterEl.hasClass('detached')) {
18310                    // only if coming from hhun active.
18311                    $headerOuterEl.addClass('transparent');
18312                }
18313
18314                $headerOuterEl
18315                    .removeClass('scrolled-down')
18316                    .removeClass('detached')
18317                    .removeClass('invisible')
18318                    .removeClass('at-top')
18319                    .css('transform', 'none');
18320
18321            }
18322
18323
18324        } //end if hhun
18325
18326        // Condense header effect coming from mobile.
18327        if ($('#header-outer[data-format="centered-menu-bottom-bar"][data-condense="true"]').length > 0) {
18328
18329            if ($headerSecondaryEl.length > 0) {
18330                // Remove transform.
18331                $headerOuterEl.css('transform', '');
18332            }
18333
18334            if (nectarDOMInfo.scrollTop > 200 && !$headerOuterEl.hasClass('fixed-menu')) {
18335                $headerOuterEl.addClass('fixed-menu');
18336            }
18337
18338        }
18339
18340        // Only bind mobile if applicable.
18341
18342        $window.off('smartresize.nectarNavScrollEffects');
18343        $window.on('smartresize.nectarNavScrollEffects', bindScrollEffectsMobile);
18344
18345    }
18346
18347
18348    /**
18349     * Header Navigation scroll events initialization.
18350     *
18351     * @since 10.5
18352     */
18353
18354    function headerNavScrollInit() {
18355
18356        // Remove transparent class if page loaded further down.
18357        if ($('#header-outer[data-remove-fixed="1"]').length == 0 && nectarDOMInfo.winW > 1000) {
18358            if ($(window).scrollTop() != 0 && $('#header-outer.transparent[data-permanent-transparent="false"]').length == 1) {
18359                $headerOuterEl.removeClass('transparent');
18360            }
18361        }
18362
18363
18364        // Determine which events to bind at start.
18365        if (nectarDOMInfo.winW < 1000) {
18366
18367            if ($('.nectar-box-roll').length == 0 ||
18368                headerHideUntilNeeded == '1' &&
18369                $('#header-outer[data-remove-fixed="1"]').length == 0) {
18370
18371                bindScrollEffectsMobile();
18372                $window.on('smartresize.nectarNavScrollEffects', bindScrollEffectsMobile);
18373            }
18374
18375        } else {
18376            bindScrollEffectsDesktop();
18377            $window.on('smartresize.nectarNavScrollEffects', bindScrollEffectsDesktop);
18378        }
18379
18380    }
18381
18382
18383    /**
18384     * Set the header space div height.
18385     *
18386     * @since 10.5
18387     */
18388    function headerSpace() {
18389
18390        if ($('.mobile').length > 0) {
18391
18392            if (nectarDOMInfo.winH < nectarDOMInfo.winW && nectarDOMInfo.winW > 1000) {
18393                if ($('#header-outer.small-nav').length == 0) {
18394                    $('#header-space').css('height', $headerOuterEl.outerHeight()).addClass('calculated');
18395                }
18396            } else {
18397                $('#header-space').css('height', $headerOuterEl.outerHeight()).addClass('calculated');
18398            }
18399
18400        } else {
18401
18402            if ($('.nectar-parallax-scene.first-section').length == 0) {
18403
18404                var headerPadding2 = headerPadding - headerPadding / 1.8;
18405                var $headerHeight = ($('#header-outer[data-header-resize="1"]').length > 0 && $('.small-nav').length > 0) ? $headerOuterEl.outerHeight() + (parseInt(logoShrinkNum) + headerPadding2 * 2) : $headerOuterEl.outerHeight();
18406
18407                // Is the calculation greater than the margin of error?
18408                if (Math.abs($headerHeight - $('#header-space').height()) > 7) {
18409                    $('#header-space').css('height', $headerHeight).addClass('calculated');
18410                }
18411
18412
18413            }
18414
18415        }
18416
18417    }
18418
18419
18420    /**
18421     * Handle header nav distance away from top to account for admin bar.
18422     *
18423     * @since 10.5
18424     */
18425
18426    function headerNavOffsetInit() {
18427
18428        var lastPosition = -1;
18429        var lastPosition2 = -1;
18430        var $headerScrollTop = nectarDOMInfo.scrollTop;
18431
18432        // Verify scroll pos has changed before calculating.
18433        function headerOffsetAdjust() {
18434
18435            if ($body.hasClass('compose-mode')) {
18436                return;
18437            }
18438
18439            $headerScrollTop = nectarDOMInfo.scrollTop;
18440
18441            if (lastPosition == $headerScrollTop) {
18442                requestAnimationFrame(headerOffsetAdjust);
18443                return false;
18444            } else {
18445                lastPosition = $headerScrollTop;
18446            }
18447
18448            headerOffsetAdjustCalc();
18449            requestAnimationFrame(headerOffsetAdjust);
18450
18451        }
18452
18453        // Called when scrolling occurs.
18454        function headerOffsetAdjustCalc() {
18455
18456            var $eleHeight = 0;
18457
18458            // Mobile.
18459            if (nectarDOMInfo.winW < 1000 ||
18460                (condenseHeaderLayout == true && $('#header-outer .span_9').css('display') == 'none') ||
18461                (condenseHeaderLayout == true && $('#header-outer .span_9 > nav').css('display') == 'none')) {
18462
18463                $eleHeight = 0;
18464                var $endOffset = ($wpAdminBar.css('position') == 'fixed') ? $wpAdminBar.height() : 0;
18465
18466                $eleHeight += nectarDOMInfo.adminBarHeight;
18467
18468                if ($eleHeight - $headerScrollTop > $endOffset) {
18469                    $headerOuterEl.css('top', $eleHeight - $headerScrollTop + 'px');
18470                } else {
18471                    $headerOuterEl.css('top', $endOffset);
18472                }
18473
18474            }
18475            // Desktop
18476            else {
18477                if (condenseHeaderLayout == false) {
18478
18479                    $eleHeight = 0;
18480
18481                    if (!$headerOuterEl.is('[data-remove-fixed="1"]')) {
18482                        $eleHeight += nectarDOMInfo.adminBarHeight;
18483                    }
18484                    $headerOuterEl.css('top', $eleHeight + 'px');
18485                }
18486            }
18487
18488        }
18489
18490        // Bind event and begin if needed.
18491        if ($('#header-outer[data-mobile-fixed="1"]').length > 0 && $wpAdminBar.length > 0) {
18492
18493            if ($('#nectar_fullscreen_rows').length == 0) {
18494                requestAnimationFrame(headerOffsetAdjust);
18495            } else if ($('#nectar_fullscreen_rows').length > 0 && nectarDOMInfo.usingMobileBrowser) {
18496                requestAnimationFrame(headerOffsetAdjust);
18497            }
18498
18499            $window.on('smartresize', headerOffsetAdjustCalc);
18500
18501        }
18502
18503
18504        // Vigentte body border
18505        if (bodyBorderVignette) {
18506            if ($('#nectar_fullscreen_rows').length == 0) {
18507                requestAnimationFrame(headerBorderAdjust);
18508            }
18509
18510            $window.on('smartresize', headerBorderAdjustCalc);
18511
18512        }
18513
18514        // Verify scroll pos has changed before calculating.
18515        function headerBorderAdjust() {
18516
18517            if ($body.hasClass('compose-mode')) {
18518                return;
18519            }
18520            if (bodyBorderMobile == false && nectarDOMInfo.winW < 1000) {
18521                requestAnimationFrame(headerBorderAdjust);
18522                $headerOuterEl.css('margin-top', '0');
18523                return false;
18524            }
18525
18526            $headerScrollTop = nectarDOMInfo.scrollTop;
18527
18528            if (lastPosition2 == $headerScrollTop) {
18529                requestAnimationFrame(headerBorderAdjust);
18530                return false;
18531            } else {
18532                lastPosition2 = $headerScrollTop;
18533            }
18534
18535            headerBorderAdjustCalc();
18536            requestAnimationFrame(headerBorderAdjust);
18537
18538        }
18539
18540        function headerBorderAdjustCalc() {
18541
18542            var $eleHeight = 0;
18543            var $endOffset = 0;
18544
18545            //bodyBorderMobile
18546            $eleHeight += bodyBorderHeight;
18547
18548            if ($eleHeight - $headerScrollTop > $endOffset) {
18549                $headerOuterEl[0].style.marginTop = $eleHeight - $headerScrollTop + 'px';
18550            } else {
18551                $headerOuterEl[0].style.marginTop = $endOffset + 'px';
18552            }
18553
18554        }
18555
18556
18557    }
18558
18559
18560    /**
18561     * Calculate the minimum body height when using the footer reveal effect or material OCM
18562     *
18563     * @since 7.0
18564     */
18565    function footerRevealCalcs() {
18566
18567        var $headerNavSpace = 0;
18568        var pageHeaderHeight = 0;
18569
18570        if ($headerOuterEl.is('[data-logo-height]') && $headerOuterEl.is('[data-padding]')) {
18571
18572            if (!$headerOuterEl.hasClass('transparent')) {
18573
18574                if ($headerOuterEl.attr('data-format') == 'centered-menu-bottom-bar' && nectarDOMInfo.winW > 1000) {
18575                    $headerNavSpace = $headerOuterEl.outerHeight();
18576                } else {
18577                    if ($headerOuterEl.find('#logo.no-image').length > 0) {
18578                        $headerNavSpace = (headerLayoutFormat == 'left-header' && nectarDOMInfo.winW > 1000) ? 0 : parseInt($headerOuterEl.find('#logo.no-image').height()) + (parseInt($headerOuterEl.attr('data-padding') * 2));
18579                    } else {
18580                        $headerNavSpace = (headerLayoutFormat == 'left-header' && nectarDOMInfo.winW > 1000) ? 0 : parseInt($headerOuterEl.attr('data-logo-height')) + (parseInt($headerOuterEl.attr('data-padding') * 2));
18581                    }
18582                }
18583
18584            }
18585
18586        } else {
18587            $headerNavSpace = (headerLayoutFormat == 'left-header' && nectarDOMInfo.winW > 1000) ? 0 : $headerOuterEl.outerHeight();
18588        }
18589
18590        if ($pageHeaderBG.length > 0) {
18591            pageHeaderHeight += $pageHeaderBG.height();
18592        }
18593        if ($('.page-header-no-bg').length > 0) {
18594            pageHeaderHeight += $('.page-header-no-bg').height();
18595        }
18596
18597        if (nectarDOMInfo.winH - nectarDOMInfo.adminBarHeight - $headerNavSpace - nectarDOMInfo.footerOuterHeight - 1 - pageHeaderHeight > 0) {
18598
18599            var $resizeExtra = ($('body:not(.material) #header-outer[data-header-resize="1"]').length > 0) ? 55 : 0;
18600
18601            $('body[data-footer-reveal="1"]:not(.nectar_using_pfsr) .container-wrap').css({
18602                'margin-bottom': nectarDOMInfo.footerOuterHeight
18603            });
18604
18605            $('.container-wrap').css({
18606                'min-height': nectarDOMInfo.winH - nectarDOMInfo.adminBarHeight - $headerNavSpace - nectarDOMInfo.footerOuterHeight - pageHeaderHeight + $resizeExtra
18607            });
18608
18609        } else {
18610            $('body[data-footer-reveal="1"]:not(.nectar_using_pfsr) .container-wrap').css({
18611                'margin-bottom': nectarDOMInfo.footerOuterHeight
18612            });
18613        }
18614
18615        if (nectarDOMInfo.winW < 1000) {
18616            $footerOuterEl.attr('data-midnight', 'light');
18617        } else {
18618            $footerOuterEl.removeAttr('data-midnight');
18619        }
18620    }
18621
18622
18623    /**
18624     * Initialize footer reveal and bind event
18625     *
18626     * @since 10.5
18627     */
18628    function footerRevealInit() {
18629
18630        if ($('body[data-footer-reveal="1"]').length > 0 || $('body.material[data-slide-out-widget-area-style="slide-out-from-right"]').length > 0) {
18631
18632            setTimeout(footerRevealCalcs, 60);
18633            footerRevealCalcs();
18634
18635            $window.on('resize', footerRevealCalcs);
18636
18637            if ($('body[data-footer-reveal="1"][data-footer-reveal-shadow="large_2"]').length > 0) {
18638                $('.container-wrap').css({
18639                    boxShadow: '0 70px 110px -30px ' + $footerOuterEl.css('backgroundColor')
18640                });
18641            }
18642
18643        }
18644
18645    }
18646
18647
18648    /**
18649     * Switch header navigation BG color to match row BG color that is passes.
18650     *
18651     * Only called when using "Header Inherit Row Color" option.
18652     *
18653     * @since 5.0
18654     */
18655    function headerRowColorInheritInit() {
18656
18657        if ($('body[data-header-inherit-rc="true"]').length > 0 && $('.mobile').length == 0 && $('#header-outer[data-transparent-header="true"]').length > 0) {
18658
18659            var headerOffset = $logoHeight / 2 + headerPadding + nectarDOMInfo.adminBarHeight;
18660
18661            if ($('#header-outer[data-permanent-transparent="1"]').length == 0) {
18662                headerOffset = ($logoHeight - logoShrinkNum) + Math.
18662ceil((headerPadding * 2) / 1.8) + nectarDOMInfo.adminBarHeight;
18663            }
18664
18665            $('.main-content > .row > .wpb_row, #full_width_portfolio #portfolio-extra > .wpb_row').each(function () {
18666
18667                var $that = $(this);
18668                var $textColor;
18669
18670                var waypoint = new Waypoint({
18671                    element: $that[0],
18672                    handler: function (direction) {
18673
18674                        //User is scrolling down.
18675                        if (direction == 'down') {
18676
18677                            if ($that.find('.row-bg.using-bg-color').length > 0) {
18678
18679                                $textColor = ($that.find('> .col.span_12.light').length > 0) ? 'light-text' : 'dark-text';
18680
18681                                $headerOuterEl
18682                                    .css('background-color', $that.find('.row-bg').css('background-color'))
18683                                    .removeClass('light-text')
18684                                    .removeClass('dark-text')
18685                                    .addClass($textColor);
18686
18687                                $headerOuterEl.attr('data-current-row-bg-color', $that.find('.row-bg').css('background-color'));
18688                                $('body.material #header-outer .bg-color-stripe').css('background-color', $that.find('.row-bg').css('background-color'));
18689
18690                            } else {
18691
18692                                $headerOuterEl
18693                                    .css('background-color', $headerOuterEl.attr('data-user-set-bg'))
18694                                    .removeClass('light-text')
18695                                    .removeClass('dark-text');
18696
18697                                $headerOuterEl.attr('data-current-row-bg-color', $headerOuterEl.attr('data-user-set-bg'));
18698                                $('body.material #header-outer .bg-color-stripe').css('background-color', '');
18699
18700                            }
18701
18702                        }
18703
18704                        //User is scrolling up.
18705                        else {
18706
18707                            if ($that.prev('div.wpb_row').find('.row-bg.using-bg-color').length > 0) {
18708
18709                                $textColor = ($that.prev('div.wpb_row').find('> .col.span_12.light').length > 0) ? 'light-text' : 'dark-text';
18710
18711                                $headerOuterEl
18712                                    .css('background-color', $that.prev('div.wpb_row').find('.row-bg').css('background-color'))
18713                                    .removeClass('light-text')
18714                                    .removeClass('dark-text')
18715                                    .addClass($textColor);
18716
18717                                $headerOuterEl.attr('data-current-row-bg-color', $that.prev('div.wpb_row').find('.row-bg').css('background-color'));
18718                                $('body.material #header-outer .bg-color-stripe').css('background-color', $that.prev('div.wpb_row').find('.row-bg').css('background-color'));
18719
18720                            } else {
18721
18722                                $headerOuterEl
18723                                    .css('background-color', $headerOuterEl.attr('data-user-set-bg'))
18724                                    .removeClass('light-text')
18725                                    .removeClass('dark-text');
18726
18727                                $headerOuterEl.attr('data-current-row-bg-color', $headerOuterEl.attr('data-user-set-bg'));
18728                                $('body.material #header-outer .bg-color-stripe').css('background-color', '');
18729
18730                            }
18731
18732                        }
18733
18734                    },
18735                    offset: headerOffset
18736
18737                }); // End of waypoint bind.
18738
18739            }); // End of loop through rows.
18740
18741        }
18742
18743    }
18744
18745
18746    /**
18747     * Page submenu sticky functionality
18748     *
18749     * @since 10.5.2
18750     */
18751
18752    function stickyPageSubmenuInit() {
18753
18754        var $ = window.jQuery,
18755            Waypoint = window.Waypoint,
18756            $offsetHeight = calcHeaderNavHeight(),
18757            $headerHeight = calcHeaderNavHeight();
18758
18759        /* Intesys - Start 4 */
18760        var $tempOffsetHeight = 0;
18761        /* Intesys - End 4 */
18762
18763        $window.on('smartresize', function () {
18764
18765            $offsetHeight = calcHeaderNavHeight();
18766
18767            if ($wpAdminBar.length > 0 &&
18768                $wpAdminBar.css('position') == 'fixed') {
18769                $offsetHeight += $wpAdminBar.height();
18770            }
18771
18772            if ($bodyBorderTop.length > 0 &&
18773                $window.width() > 1000 &&
18774                $('body[data-hhun="1"]').length > 0 ||
18775
18776                $bodyBorderTop.length > 0 &&
18777                $('body[data-hhun="1"]').length > 0 &&
18778                bodyBorderMobile) {
18779                if (!bodyBorderVignette) {
18780                    $offsetHeight += $bodyBorderTop.height();
18781                }
18782            }
18783
18784            // Recalc for resizing (same as stuck/unstuck logic below)
18785            if ($('.page-submenu.stuck').length > 0) {
18786
18787                $('.page-submenu.stuck')
18788                    .addClass('no-trans')
18789                    .css('top', $offsetHeight)
18790                    .css('transform', 'translateY(0)').addClass('stuck');
18791
18792                setTimeout(function () {
18793                    $('.page-submenu.stuck').removeClass('no-trans');
18794                }, 50);
18795
18796                $('.page-submenu.stuck')
18797                    .parents('.wpb_row')
18798                    .css('z-index', 10000);
18799
18800                // Boxed layout
18801                if ($('#boxed').length > 0) {
18802
18803                    var $negMargin = ($window.width() > 1000) ? $('.container-wrap').width() * 0.04 : 39;
18804
18805                    $('.page-submenu.stuck').css({
18806                        'margin-left': '-' + $negMargin + 'px',
18807                        'width': $('.container-wrap').width()
18808                    });
18809
18810                }
18811
18812            } else {
18813
18814                $('.page-submenu.stuck')
18815                    .css('top', '0')
18816                    .removeClass('stuck');
18817
18818                $('.page-submenu.stuck')
18819                    .parents('.wpb_row')
18820                    .css('z-index', 'auto');
18821
18822                if ($('#boxed').length > 0) {
18823                    $('.page-submenu.stuck').css({
18824                        'margin-left': '0px',
18825                        'width': '100%'
18826                    });
18827                }
18828
18829            }
18830
18831        });
18832
18833        /* http://imakewebthings.com/waypoints/shortcuts/sticky-elements */
18834        function Sticky(options) {
18835            this.options = $.extend({}, Waypoint.defaults, Sticky.defaults, options);
18836            this.element = this.options.element;
18837            this.$element = $(this.element);
18838            this.createWrapper();
18839            this.topLevel = ($(this.element).parents('.top-level').length > 0) ? true : false;
18840            this.createWaypoint();
18841        }
18842
18843        /* Private */
18844        Sticky.prototype.createWaypoint = function () {
18845
18846            var originalHandler = this.options.handler;
18847
18848            $offsetHeight = calcHeaderNavHeight();
18849
18850            // top level hhun
18851            if (this.topLevel && $('body[data-hhun="1"] #header-outer.detached:not(.invisible)').length > 0) {
18852                $offsetHeight += 1;
18853                this.$element.css({
18854                    'margin-top': '-1px',
18855                });
18856            }
18857
18858            if ($wpAdminBar.length > 0 && $wpAdminBar.css('position') == 'fixed') {
18859                $offsetHeight += $wpAdminBar.height();
18860            }
18861
18862            if ($bodyBorderTop.length > 0 && $window.width() > 1000 && $('body[data-hhun="1"]').length > 0 ||
18863                $bodyBorderTop.length > 0 && bodyBorderMobile && $('body[data-hhun="1"]').length > 0) {
18864
18865                if (!bodyBorderVignette) {
18866                    $offsetHeight += $bodyBorderTop.height();
18867                }
18868            }
18869
18870            /* Intesys - Start 5 */
18871            if (window.currentSiteId === 11) {
18872                $tempOffsetHeight = $offsetHeight;
18873                $offsetHeight = 0;
18874            }
18875            /* Intesys - End 5 */
18876
18877            this.waypoint = new Waypoint($.extend({}, this.options, {
18878                element: this.wrapper,
18879                handler: $.proxy(function (direction) {
18880                    var shouldBeStuck = this.options.direction.indexOf(direction) > -1;
18881                    var wrapperHeight = shouldBeStuck ? this.$element.outerHeight(true) : '';
18882
18883                    this.$wrapper.height(wrapperHeight);
18884                    if (shouldBeStuck) {
18885
18886                        // top level hhun
18887                        var transformAmt = 0;
18888                        if (this.topLevel && $('body[data-hhun="1"] #header-outer.detached:not(.invisible)').length > 0) {
18889
18890                            // Page submenu adjust
18891                            var heightToAdjust = $headerOuterEl.outerHeight();
18892                            var $bodyBorderSizeToRemove = 0;
18893
18894                            if ($headerSecondaryEl.length > 0) {
18895                                heightToAdjust -= nectarDOMInfo.secondaryHeaderHeight;
18896                            }
18897
18898                            if ($bodyBorderTop.length > 0 && $('body.mobile').length == 0) {
18899                                $bodyBorderSizeToRemove = ($bodyBorderHeaderColorMatch) ? $bodyBorderTop.height() : 0;
18900                            }
18901
18902                            transformAmt = heightToAdjust - $bodyBorderSizeToRemove;
18903
18904                        }
18905
18906                        this.$element
18907                            .addClass('no-trans')
18908                            .css('top', $offsetHeight)
18909                            .css('transform', 'translateY(' + transformAmt + 'px)')
18910                            .addClass('stuck');
18911
18912                        var $that = this;
18913
18914                        setTimeout(function () {
18915                            $that.$element.removeClass('no-trans');
18916                        }, 50);
18917
18918                        this.$element.parents('.wpb_row').css('z-index', 10000);
18919
18920                        //boxed
18921                        if ($('#boxed').length > 0) {
18922                            var $negMargin = ($window.width() > 1000) ? $('.container-wrap').width() * 0.04 : 39;
18923                            this.$element.css({
18924                                'margin-left': '-' + $negMargin + 'px',
18925                                'width': $('.container-wrap').width()
18926                            });
18927                        }
18928
18929                    } else {
18930                        this.$element.css('top', '0').removeClass('stuck');
18931
18932                        if ($('#boxed').length > 0) this.$element.css({
18933                            'margin-left': '0px',
18934                            'width': '100%'
18935                        });
18936                    }
18937
18938                    if (originalHandler) {
18939                        originalHandler.call(this, direction);
18940                    }
18941                }, this),
18942                offset: $offsetHeight
18943            }));
18944
18945            var $that = this;
18946
18947
18948            setInterval(function () {
18949
18950                /* Intesys - Start 6 */
18951                if (window.currentSiteId === 11) {
18952                    var $offset = $(window).scrollTop();
18953                    var $windowWidth = $(window).width();
18954
18955                    if ($offset > 800 && $windowWidth > 800) {
18956                        $offsetHeight = $tempOffsetHeight;
18957                        $that.$element.css('top', $offsetHeight + 'px');
18958                    } else {
18959                        $that.$element.css('top', '0');
18960                        $offsetHeight = 0;
18961                    }
18962                }
18963                /* Intesys - End 6 */
18964
18965                if ($('body[data-hhun="1"] #header-outer.detached:not(.invisible)').length > 0) {
18966
18967                    var heightToAdjust = $headerOuterEl.outerHeight();
18968
18969                    if ($headerSecondaryEl.length > 0) {
18970                        heightToAdjust -= nectarDOMInfo.secondaryHeaderHeight;
18971                    }
18972
18973                    $that.waypoint.options.offset = $offsetHeight + heightToAdjust;
18974                } else {
18975                    $that.waypoint.options.offset = $offsetHeight;
18976                }
18977
18978                Waypoint.refreshAll();
18979
18980            }, 100);
18981
18982
18983        };
18984
18985        /* Private */
18986        Sticky.prototype.createWrapper = function () {
18987            if (this.options.wrapper) {
18988                this.$element.wrap(this.options.wrapper);
18989            }
18990            this.$wrapper = this.$element.parent();
18991            this.wrapper = this.$wrapper[0];
18992        };
18993
18994        /* Public */
18995        Sticky.prototype.destroy = function () {
18996
18997            if (this.$element.parent()[0] === this.wrapper) {
18998                this.waypoint.destroy();
18999                this.$element.removeClass(this.options.stuckClass);
19000                if (this.options.wrapper) {
19001                    this.$element.unwrap();
19002                }
19003            }
19004
19005        };
19006
19007        Sticky.defaults = {
19008            wrapper: '<div class="sticky-wrapper" />',
19009            stuckClass: 'stuck',
19010            direction: 'down right'
19011        };
19012
19013        Waypoint.Sticky = Sticky;
19014
19015    }
19016
19017
19018    /**
19019     * Page submenu page builder element.
19020     *
19021     * @since 10.5
19022     */
19023
19024    function pageSubmenuInit() {
19025
19026        if ($('.page-submenu[data-sticky="true"]').length > 0 && $('#nectar_fullscreen_rows').length == 0) {
19027
19028            stickyPageSubmenuInit();
19029
19030            // Remove outside of column setups
19031            $('.page-submenu[data-sticky="true"]').each(function () {
19032
19033                var waypointEl = $(this)[0];
19034
19035                if ($(this).parents('.span_12').find('> .wpb_column').length > 1) {
19036
19037                    var pageMenu = $(this).clone(),
19038                        pageMenuParentRow = $(this).parents('.wpb_row');
19039
19040                    if ($(this).parents('.wpb_row.has-global-section').length > 0) {
19041                        pageMenuParentRow = $(this).parents('.wpb_row.has-global-section');
19042                    }
19043
19044                    $(this).remove();
19045                    pageMenuParentRow.before(pageMenu);
19046
19047                    waypointEl = pageMenu[0];
19048
19049                }
19050
19051                var sticky = new Waypoint.Sticky({
19052                    element: waypointEl
19053                });
19054
19055            });
19056
19057        }
19058
19059        // Adjust to be higher.
19060        if ($('#nectar_fullscreen_rows').length == 0) {
19061
19062            $('.page-submenu')
19063                .parents('.wpb_row')
19064                .css('z-index', 10000);
19065        }
19066
19067        // Bind events.
19068        $('.page-submenu .mobile-menu-link').on('click', function () {
19069
19070            $(this).parents('.page-submenu')
19071                .find('ul')
19072                .stop(true)
19073                .slideToggle(350);
19074
19075            return false;
19076
19077        });
19078
19079        $('.page-submenu ul li a').on('click', function () {
19080
19081            if ($('body.mobile').length > 0) {
19082                $(this).parents('.page-submenu')
19083                    .find('ul')
19084                    .stop(true)
19085                    .slideToggle(350);
19086            }
19087
19088        });
19089
19090    }
19091
19092
19093    /**
19094     * Page builder full height row option.
19095     *
19096     * @since 14.0
19097     */
19098
19099    function nectarFullHeightRow(el) {
19100
19101        this.$el = el;
19102
19103        this.offsetTop = 0;
19104        this.fullHeight = 100;
19105        this.storedWinH = nectarDOMInfo.winH;
19106
19107        this.events();
19108        this.calculate();
19109
19110    }
19111
19112    nectarFullHeightRow.prototype.events = function () {
19113
19114        var that = this;
19115
19116        $(window).on('smartresize', this.resize.bind(this));
19117
19118        window.addEventListener("orientationchange", function () {
19119            this.setTimeout(function () {
19120                that.orientationChange();
19121            }, 100);
19122        });
19123
19124    };
19125
19126    nectarFullHeightRow.prototype.resize = function () {
19127
19128        if (!nectarDOMInfo.usingMobileBrowser) {
19129            this.storedWinH = nectarDOMInfo.winH;
19130            this.calculate();
19131        }
19132
19133    };
19134
19135    nectarFullHeightRow.prototype.calculate = function () {
19136
19137        if (nectarState.materialOffCanvasOpen == true) {
19138            return true;
19139        }
19140
19141        this.offsetTop = this.$el.offset().top;
19142
19143        if (this.offsetTop < this.storedWinH &&
19144            this.$el.hasClass('top-level') &&
19145            !nectarDOMInfo.usingFrontEndEditor) {
19146
19147            // Removed to allow CSS to take full control over top level sizing.
19148
19149        } else {
19150
19151            this.$el.css("min-height", this.storedWinH);
19152            this.$el.find('> .col.span_12').css("min-height", this.storedWinH);
19153
19154        }
19155
19156    };
19157
19158    nectarFullHeightRow.prototype.orientationChange = function () {
19159
19160        if (nectarDOMInfo.usingMobileBrowser) {
19161            this.storedWinH = nectarDOMInfo.winH;
19162            this.calculate();
19163        }
19164
19165    };
19166
19167
19168    /**
19169     * Page builder full height row init.
19170     *
19171     * @since 10.5
19172     */
19173
19174    function nectarFullHeightRowInit() {
19175
19176        fullHeightRows = [];
19177
19178        $('.vc_row-o-full-height').each(function (i) {
19179            fullHeightRows[i] = new nectarFullHeightRow($(this));
19180        });
19181
19182    }
19183
19184
19185    /**
19186     * Page builder equal height row IE helper.
19187     *
19188     * @since 8.0
19189     */
19190    function fixIeFlexbox() {
19191        var ua = window.navigator.userAgent,
19192            msie = ua.indexOf("MSIE ");
19193        (msie > 0 || navigator.userAgent.match(/Trident.*rv\:11\./)) && $(".vc_row-o-full-height").each(function () {
19194            "flex" === $(this).find('> .span_12').css("display") && $(this).wrap('<div class="vc_ie-flexbox-fixer"></div>')
19195        });
19196
19197        if (msie > 0 || navigator.userAgent.match(/Trident.*rv\:11\./)) {
19198            fixIE11Images();
19199            $(window).on('resize', fixIE11Images);
19200        }
19201
19202    }
19203
19204    /**
19205     * Fix the IE11 bug with max-width 100% on imgs
19206     *
19207     * @since 11.0
19208     */
19209    function fixIE11Images() {
19210
19211        $('.img-with-aniamtion-wrap img.img-with-animation').each(function () {
19212
19213            if ($(this).parents('.tabbed').length == 0 && $(this).parents('.toggle').length == 0) {
19214
19215                var $parentWrap = $(this).parents('.img-with-aniamtion-wrap');
19216                $parentWrap.css({
19217                    'height': ''
19218                });
19219                var height = $(this).height();
19220
19221                $parentWrap.css({
19222                    'height': height
19223                });
19224
19225            }
19226
19227        });
19228
19229    }
19230
19231
19232    /**
19233     * Recent post height
19234     *
19235     * @since 10.5
19236     */
19237    function recentPostsTitleOnlyEqualHeight() {
19238
19239        function recentPostHeight() {
19240
19241            $('.blog-recent[data-style="title_only"]').each(function () {
19242
19243                if ($(this).find('> .col').length > 1) {
19244                    return false;
19245                }
19246                var $parentsSeletor = $(this).parent().parent().parent();
19247
19248                if ($parentsSeletor.hasClass('vc_col-sm-3') ||
19249                    $parentsSeletor.hasClass('vc_col-sm-4') ||
19250                    $parentsSeletor.hasClass('vc_col-sm-6') ||
19251                    $parentsSeletor.hasClass('vc_col-sm-8') ||
19252                    $parentsSeletor.hasClass('vc_col-sm-9')) {
19253
19254                    if ($('body.mobile').length == 0 && $(this).next('div').length == 0) {
19255                        var tallestColumn = 0;
19256
19257                        $(this).find('> .col').css('padding', '50px 20px');
19258
19259                        $(this).parents('.span_12').find(' > .wpb_column').each(function () {
19260
19261                            if (Math.floor($(this).height()) > tallestColumn) {
19262                                tallestColumn = Math.floor($(this).height());
19263                            }
19264
19265                        });
19266
19267                        if (Math.floor($(this).find('> .col').outerHeight(true)) < Math.floor($(this).parents('.wpb_row').height()) - 1) {
19268                            $(this).find('> .col').css('padding-top', (tallestColumn - $(this).find('> .col').height()) / 2 + 'px');
19269                            $(this).find('> .col').css('padding-bottom', (tallestColumn - $(this).find('> .col').height()) / 2 + 'px');
19270                        }
19271
19272                    } else {
19273                        $(this).find('> .col').css('padding', '50px 20px');
19274                    }
19275                }
19276            });
19277
19278        }
19279
19280        // Set heights.
19281        if ($('.blog-recent[data-style="title_only"]').length > 0) {
19282            recentPostHeight();
19283            $window.on('smartresize', recentPostHeight);
19284        }
19285
19286    }
19287
19288
19289    /**
19290     * Helper to calculate recent post slider height
19291     *
19292     * @since 7.0
19293     */
19294    function recentPostSliderHeight() {
19295
19296        $('.nectar-recent-posts-slider').each(function () {
19297
19298            var $minHeight = 250,
19299                $definedHeight = parseInt($(this).attr('data-height')),
19300                dif = ($('body[data-ext-responsive="true"]').length > 0) ? $window.width() / 1400 : $window.width() / 1100,
19301                $sliderSelectors = $(this).find('.nectar-recent-post-slide, .flickity-viewport');
19302
19303            if (nectarDOMInfo.winW > 1000 && $('#boxed').length == 0) {
19304
19305                if ($(this).parents('.full-width-content').length == 0) {
19306
19307                    if ($('body[data-ext-responsive="true"]').length > 0 && nectarDOMInfo.winW >= 1400) {
19308                        $sliderSelectors.css('height', Math.ceil($definedHeight));
19309                    } else if ($('body[data-ext-responsive="true"]').length == 0 && nectarDOMInfo.winW >= 1100) {
19310                        $sliderSelectors.css('height', Math.ceil($definedHeight));
19311                    } else {
19312                        $sliderSelectors.css('height', Math.ceil($definedHeight * dif));
19313                    }
19314
19315                } else {
19316                    $sliderSelectors.css('height', Math.ceil($definedHeight * dif));
19317                }
19318
19319            } else {
19320
19321                // Column sliders
19322                var $parentCol = ($(this).parents('.wpb_column').length > 0) ? $(this).parents('.wpb_column') : $(this).parents('.col');
19323
19324                if ($parentCol.length == 0) {
19325                    $parentCol = $('.main-content');
19326                }
19327
19328                if (!$parentCol.hasClass('vc_span12') &&
19329                    !$parentCol.hasClass('main-content') &&
19330                    !$parentCol.hasClass('span_12') &&
19331                    !$parentCol.hasClass('vc_col-sm-12')) {
19332
19333                    var $parentColWidth = sliderColumnDesktopWidth($parentCol),
19334                        $aspectRatio = $definedHeight / $parentColWidth;
19335
19336                    // Min height
19337                    if ($aspectRatio * $parentCol.width() <= $minHeight) {
19338                        $sliderSelectors.css('height', $minHeight);
19339                    } else {
19340                        $sliderSelectors.css('height', $aspectRatio * $parentCol.width());
19341                    }
19342
19343                }
19344
19345                // Regular
19346                else {
19347
19348                    // Min height
19349                    if ($definedHeight * dif <= $minHeight) {
19350                        $sliderSelectors.css('height', $minHeight);
19351                    } else {
19352                        $sliderSelectors.css('height', Math.ceil($definedHeight * dif));
19353                    }
19354
19355                }
19356
19357            }
19358
19359        });
19360
19361    }
19362
19363
19364    function sliderColumnDesktopWidth(parentCol) {
19365
19366        var $parentColWidth = 1100,
19367            $columnNumberParsed = $(parentCol).attr('class').match(/\d+/);
19368
19369        if ($columnNumberParsed == '2') {
19370            $parentColWidth = 170
19371        } else if ($columnNumberParsed == '3') {
19372            $parentColWidth = 260
19373        } else if ($columnNumberParsed == '4') {
19374            $parentColWidth = 340
19375        } else if ($columnNumberParsed == '6') {
19376            $parentColWidth = 530
19377        } else if ($columnNumberParsed == '8') {
19378            $parentColWidth = 700
19379        } else if ($columnNumberParsed == '9') {
19380            $parentColWidth = 805
19381        } else if ($columnNumberParsed == '10') {
19382            $parentColWidth = 916.3
19383        } else if ($columnNumberParsed == '12') {
19384            $parentColWidth = 1100
19385        }
19386
19387        return $parentColWidth;
19388    }
19389
19390
19391    function scrollingText() {
19392
19393        // browser rendering issue workaround
19394        $('.nectar-scrolling-text').each(function () {
19395            if ($(this).offset().top > nectarDOMInfo.winH) {
19396                $(this).addClass('prevent-animation');
19397
19398                var that = $(this);
19399
19400                setTimeout(function () {
19401                    that.removeClass('prevent-animation');
19402                }, 100);
19403            }
19404        });
19405
19406    }
19407
19408    /**
19409     * Spit text into separate lines to animate in
19410     *
19411     * @since 7.0
19412     */
19413
19414    function splitLineText() {
19415        $('.nectar-recent-posts-single_featured.multiple_featured').each(function () {
19416
19417            var $slideClass = ($(this).find('.project-slides').length > 0) ? '.project-slide' : '.nectar-recent-post-slide',
19418                $slideInfoClass = ($(this).find('.project-slides').length > 0) ? '.project-info h1' : '.inner-wrap .large-featured-post-title a';
19419
19420            $(this).find($slideClass).each(function () {
19421
19422                $(this).find($slideInfoClass).each(function () {
19423
19424                    var textArr = $(this).text();
19425                    textArr = textArr.trim();
19426                    textArr = textArr.split(' ');
19427
19428                    $(this)[0].innerHTML = '';
19429
19430                    for (var i = 0; i < textArr.length; i++) {
19431                        $(this)[0].innerHTML += '<span>' + textArr[i] + '</span> ';
19432                    }
19433
19434                });
19435
19436                $(this).find($slideInfoClass + ' > span').wrapInner('<span class="inner" />');
19437
19438            });
19439
19440        });
19441
19442    }
19443
19444    function splitLineHeadingTrigger($item, callback) {
19445        $item.find('.nectar-split-heading > * > span').each(function (i) {
19446            var spanEl = $(this);
19447            var $innerEl = spanEl.find('> .inner');
19448            setTimeout(function () {
19449                $innerEl[0].style.transform = 'translateY(0em)';
19450                $innerEl[0].style.opacity = '1';
19451            }, i * 40);
19452        });
19453
19454        var totalTime = $item.find('.nectar-split-heading > * > span').length * 40;
19455        setTimeout(function () {
19456            callback();
19457        }, totalTime + 1400);
19458    }
19459
19460    function splitLineHeadingRemoveMarkup($item) {
19461        $item.find('.nectar-split-heading').each(function (i) {
19462            var text = $(this).text();
19463            $(this).addClass('effect-removed');
19464            $(this)[0].innerHTML = text;
19465        });
19466    }
19467
19468
19469    /**
19470     * Spit text into separate lines to animate in
19471     *
19472     * @since 7.0
19473     */
19474
19475    function letterRevealMarkup($el) {
19476
19477        var animatedClass = ($el.hasClass('animated-in')) ? ' animated' : '';
19478
19479        $el.find('> *').each(function () {
19480
19481            var textArr = $(this).text();
19482            textArr = textArr.trim();
19483            textArr = textArr.split(' ');
19484
19485
19486            $(this)[0].innerHTML = '';
19487
19488            for (var i = 0; i < textArr.length; i++) {
19489                $(this)[0].innerHTML += '<span><span class="inner' + animatedClass + '">' + textArr[i] + '</span></span> ';
19490            }
19491
19492            $(this).attr('aria-label', $(this).text());
19493
19494        });
19495
19496        $el.addClass('markup-generated');
19497
19498    }
19499
19500    function splitLineHeadingMarkup() {
19501
19502        $('.nectar-split-heading[data-animation-type="line-reveal-by-space"]:not([data-text-effect="none"])').each(function () {
19503            letterRevealMarkup($(this));
19504        });
19505
19506        $('.nectar-split-heading[data-animation-type="line-reveal-by-space"][data-text-effect*="letter-reveal"]').each(function () {
19507
19508            /* Skip markup generation when effect is removed on mobile */
19509            if ($(this).is('[data-m-rm-animation="true"]') && nectarDOMInfo.winW < 1000) {
19510                return true;
19511            }
19512
19513            var animatedStyle = ($(this).hasClass('animated-in')) ? ' style="transform: none;"' : '';
19514
19515            $(this).find('> *').each(function () {
19516
19517                var textArr = $(this).text();
19518                textArr = textArr.trim();
19519                textArr = textArr.split(' ');
19520
19521                $(this)[0].innerHTML = '';
19522
19523                for (var i = 0; i < textArr.length; i++) {
19524                    $(this)[0].innerHTML += '<span>' + textArr[i] + '</span> ';
19525                }
19526
19527                $(this).attr('aria-label', $(this).text());
19528
19529            });
19530
19531
19532            $(this).find('span').each(function () {
19533
19534                var $this = $(this);
19535                var textArr = $(this).text().split('');
19536
19537                $this.empty();
19538
19539                $.each(textArr, function (i, el) {
19540                    $this.append('<span class="inner"' + animatedStyle + '>' + el + '</span>');
19541                });
19542
19543            });
19544
19545            $(this).addClass('markup-generated');
19546
19547
19548        });
19549
19550    }
19551
19552    function splitLineHeadingInit() {
19553
19554        if ($('.nectar-split-heading[data-animation-type="line-reveal-by-space"]').length > 0 ||
19555            $('.nectar-split-heading[data-animation-type="letter-fade-reveal"]').length > 0) {
19556            // Generate markup.
19557            splitLineHeadingMarkup();
19558        }
19559
19560    }
19561
19562
19563    /**
19564     * Create recent post sliders
19565     *
19566     * @since 7.0
19567     */
19568    function recentPostsFlickityInit() {
19569
19570
19571        if ($('.nectar-recent-posts-slider-inner').length > 0) {
19572
19573            var $rpFGroupCells = ($('.nectar-recent-posts-slider_multiple_visible').length > 0) ? '90%' : false;
19574
19575            var $rpF = $('.nectar-recent-posts-slider-inner').flickity({
19576                contain: true,
19577                groupCells: $rpFGroupCells,
19578                draggable: true,
19579                lazyLoad: false,
19580                imagesLoaded: true,
19581                percentPosition: true,
19582                prevNextButtons: false,
19583                pageDots: true,
19584                resize: true,
19585                setGallerySize: true,
19586                wrapAround: true,
19587                dragThreshold: nectarDOMInfo.usingMobileBrowser ? 25 : 3,
19588                accessibility: false
19589            });
19590
19591            setTimeout(function () {
19592                $('.nectar-recent-posts-slider-inner').addClass('loaded');
19593            }, 1150);
19594            var flkty = $rpF.data('flickity');
19595
19596            $rpF.on('dragStart.flickity', function () {
19597                $('.flickity-viewport').addClass('is-moving');
19598            });
19599
19600            $rpF.on('dragEnd.flickity', function () {
19601                $('.flickity-viewport').removeClass('is-moving');
19602            });
19603
19604            var $dragTimeout;
19605
19606            $rpF.on('select.flickity', function () {
19607
19608                $('.flickity-viewport').addClass('no-hover');
19609                clearTimeout($dragTimeout);
19610                $dragTimeout = setTimeout(function () {
19611                    $('.flickity-viewport').removeClass('no-hover');
19612                }, 400);
19613
19614            });
19615
19616            recentPostSliderHeight();
19617            $window.on('resize', recentPostSliderHeight);
19618
19619            if (!nectarDOMInfo.usingMobileBrowser && !nectarDOMInfo.usingFrontEndEditor) {
19620                $window.on('resize', recentPostSliderParallaxMargins);
19621            }
19622
19623
19624        }
19625
19626
19627        // Multiple featured controls
19628        function multipleLargeFeaturedInit() {
19629            $('.nectar-recent-posts-single_featured.multiple_featured').each(function (sliderIndex) {
19630
19631                if ($(this).find('> .normal-container').length > 0) {
19632                    $(this).find('> .normal-container').remove();
19633                }
19634
19635                $(this).append('<div class="normal-container container"> <ul class="controls" data-color="' + $(this).attr('data-button-color') + '" data-num="' + $(this).find('.nectar-recent-post-slide').length + '"></ul> </div>');
19636                var $that = $(this);
19637                var tallestFeaturedSlide = 0;
19638                var $slideClickTimeout;
19639
19640                // Store instance
19641                $nectarCustomSliderRotate[sliderIndex] = {
19642                    autorotate: ''
19643                };
19644
19645                $(this).find('.nectar-recent-post-slide').each(function (i) {
19646
19647                    if ($(this).find('.recent-post-container').height() > tallestFeaturedSlide) {
19648                        $(this).siblings().removeClass('tallest');
19649                        $(this).addClass('tallest');
19650                        tallestFeaturedSlide = $(this).find('.recent-post-container').height();
19651                    }
19652
19653                    var $activeClass = (i == 0 && $(this).parents('.nectar-recent-posts-single_featured.multiple_featured[data-autorotate="none"]').length > 0) ? 'class="active"' : '';
19654                    $that.find('.controls').append('<li ' + $activeClass + '><span class="title">' + $(this).find('.large-featured-post-title').text() + '</span></li>');
19655                });
19656
19657                $(this).addClass('js-loaded');
19658
19659
19660                // Click event
19661                $(this).find('.controls li').on('click', function (e) {
19662
19663                    if ($(this).hasClass('active')) {
19664                        return;
19665                    }
19666
19667                    if (e.originalEvent !== undefined) {
19668                        $(this).parent().find('.active').addClass('trans-out');
19669                    }
19670
19671                    var $index = $(this).index(),
19672                        $oldIndex = $(this).parent().find('.active').index(),
19673                        $that = $(this);
19674
19675                    clearTimeout($slideClickTimeout);
19676
19677                    $(this).siblings().removeClass('active');
19678                    $(this).addClass('active');
19679
19680                    $slideClickTimeout = setTimeout(function () {
19681
19682                        $that.parents('.multiple_featured')
19683                            .find('.nectar-recent-post-slide:not(:eq(' + $index + '))')
19684                            .css('opacity', '0')
19685                            .removeClass('active');
19686
19687                        $that.parent()
19688                            .find('.trans-out')
19689                            .removeClass('trans-out');
19690
19691                    }, 300);
19692
19693                    $that.parents('.multiple_featured')
19694                        .find('.nectar-recent-post-slide:not(:eq(' + $index + '))')
19695                        .css('z-index', '10');
19696
19697                    $that.parents('.multiple_featured')
19698                        .find('.nectar-recent-post-slide:eq(' + $oldIndex + ')')
19699                        .css('z-index', '15');
19700
19701                    $(this).parents('.multiple_featured').find('.nectar-recent-post-slide').eq($index).css({
19702                        'opacity': '1',
19703                        'z-index': '20'
19704                    }).addClass('active');
19705
19706                    if ($(this).parents('.multiple_featured').attr('data-autorotate') != 'none') {
19707                        nectarCustomSliderResetRotate($that.parents('.nectar-recent-posts-single_featured.multiple_featured'), sliderIndex);
19708                    }
19709                });
19710
19711
19712                // Autorotate
19713                $that = $(this);
19714
19715                if ($(this).attr('data-autorotate').length > 0 &&
19716                    $(this).attr('data-autorotate') != 'none' &&
19717                    $('body.vc_editor').length == 0) {
19718
19719                    setTimeout(function () {
19720                        var slide_interval = (parseInt($that.attr('data-autorotate')) < 100) ? 4000 : parseInt($that.attr('data-autorotate'));
19721
19722                        $nectarCustomSliderRotate[sliderIndex].autorotate = setInterval(function () {
19723                            nectarCustomSliderRotate($that)
19724                        }, slide_interval);
19725
19726                        // Set first active class
19727                        $that
19728                            .find('.controls > li:first-child')
19729                            .addClass('active');
19730
19731                    }, 30);
19732
19733                }
19734
19735            });
19736
19737            splitLineText();
19738            $window.on('resize', splitLineText);
19739
19740        }
19741
19742        multipleLargeFeaturedInit();
19743
19744    }
19745
19746
19747    /**
19748     * Default recent post slider parallax RAF loop.
19749     *
19750     * @since 7.0
19751     */
19752    function recentPostSliderParallax() {
19753
19754        $('.nectar-recent-posts-slider').each(function () {
19755
19756            var $offset = parseInt($(this).find('.flickity-slider').position().left),
19757                $slides = $(this).find('.nectar-recent-post-slide'),
19758                $slideLength = $slides.length,
19759                $slideWidth = $slides.width(),
19760                $lastChildIndex = $(this).find('.nectar-recent-post-slide:last-child').index(),
19761                $slideFirstChildBG = $(this).find('.nectar-recent-post-slide:first-child .nectar-recent-post-bg'),
19762                $slideLastChildBG = $(this).find('.nectar-recent-post-slide:last-child .nectar-recent-post-bg');
19763
19764            // First going to last
19765            if ($offset >= -3) {
19766                $slideLastChildBG.css('margin-left', parseInt(Math.ceil($slideWidth / 3.5)) + 'px');
19767            } else {
19768                $slideLastChildBG.css('margin-left', '-' + parseInt(Math.ceil($slideWidth / 3.5 * $lastChildIndex)) + 'px');
19769            }
19770
19771            // Last going to first
19772            if (Math.abs($offset) >= ($slideLength - 1) * $slideWidth) {
19773                $slideFirstChildBG.css('margin-left', '-' + parseInt(Math.ceil(($slideWidth / 3.5) * $slideLength)) + 'px');
19774            } else {
19775                $slideFirstChildBG.css('margin-left', '0px');
19776            }
19777
19778            $(this)
19779                .find('.nectar-recent-post-bg')
19780                .css('transform', 'translateX(' + Math.ceil($(this).find('.flickity-slider').position().left / -3.5) + 'px)');
19781
19782        });
19783
19784        requestAnimationFrame(recentPostSliderParallax);
19785
19786    }
19787
19788    /**
19789     * Default recent post slider margin calculations.
19790     *
19791     * @since 7.0
19792     */
19793    function recentPostSliderParallaxMargins() {
19794
19795        $('.nectar-recent-posts-slider').each(function () {
19796
19797            var $slideWidth = $(this).find('.nectar-recent-post-slide').width();
19798
19799            $(this).find('.nectar-recent-post-slide').each(function (i) {
19800                $(this).find('.nectar-recent-post-bg').css('margin-left', '-' + parseInt(Math.ceil($slideWidth / 3.5) * i) + 'px');
19801            });
19802
19803        });
19804
19805    }
19806
19807
19808    /**
19809     * Initialize all recent post elements.
19810     *
19811     * @since 7.0
19812     */
19813    function recentPostsInit() {
19814
19815        // Start flickity based sliders.
19816        if ($().flickity) {
19817            recentPostsFlickityInit();
19818        } else {
19819            setTimeout(function () {
19820                recentPostsFlickityInit();
19821            }, 200);
19822        }
19823
19824
19825        // Classic enhanced specific
19826        $('.blog-recent[data-style="classic_enhanced_alt"] .inner-wrap').each(function () {
19827            $(this).find('.post-featured-img').each(function () {
19828                var $src = $(this).find('img').attr('src');
19829                $(this).css('background-image', 'url(' + $src + ')');
19830            });
19831        });
19832
19833        $('.blog-recent[data-style="classic_enhanced"]').each(function () {
19834            if ($(this).find('.inner-wrap.has-post-thumbnail').length == 0) {
19835                $(this).addClass('no-thumbs');
19836            }
19837        });
19838
19839        // Regular recent posts slider.
19840        if (!nectarDOMInfo.usingMobileBrowser) {
19841            if ($('.nectar-recent-posts-slider').length > 0 && !nectarDOMInfo.usingFrontEndEditor) {
19842                window.requestAnimationFrame(recentPostSliderParallax);
19843            }
19844        }
19845
19846        if (!nectarDOMInfo.usingMobileBrowser && !nectarDOMInfo.usingFrontEndEditor) {
19847            recentPostSliderParallaxMargins();
19848        }
19849
19850    }
19851
19852
19853    /**
19854     * Parallax on mousemove effect
19855     *
19856     * @since 10.5
19857     */
19858    function parallaxItemHoverEffect() {
19859
19860        //change sizer pos
19861        $('.style-5').each(function () {
19862            $(this)
19863                .find('.sizer')
19864                .insertBefore($(this).find('.parallaxImg'));
19865        });
19866
19867        // Set parent zindex
19868        $('.style-5')
19869            .parents('.wpb_row')
19870            .css('z-index', '100');
19871
19872        var d = document,
19873            bd = d.getElementsByTagName('body')[0],
19874            win = window,
19875            imgs = d.querySelectorAll('.parallaxImg'),
19876            totalImgs = imgs.length,
19877            supportsTouch = 'ontouchstart' in win || navigator.msMaxTouchPoints,
19878            lazyLoadedItems = false;
19879
19880        if (totalImgs <= 0) {
19881            return;
19882        }
19883
19884        // Build HTML
19885        for (var l = 0; l < totalImgs; l++) {
19886
19887            var thisImg = imgs[l],
19888                layerElems = thisImg.querySelectorAll('.parallaxImg-layer'),
19889                totalLayerElems = layerElems.length;
19890
19891            if (totalLayerElems <= 0) {
19892                continue;
19893            }
19894
19895            while (thisImg.firstChild) {
19896                thisImg.removeChild(thisImg.firstChild);
19897            }
19898
19899            var lastMove = 0;
19900
19901            //throttle performance old browsers
19902            var eventThrottle = 80;
19903            if (navigator.userAgent.indexOf("Chrome") > -1 && navigator.userAgent.indexOf("Edge/") < 1) {
19904                eventThrottle = 1;
19905                $('html').addClass('cssreflections');
19906            } else {
19907                $body.addClass('cssreflections');
19908            }
19909
19910            var containerHTML = d.createElement('div'),
19911                shineHTML = d.createElement('div'),
19912                shadowHTML = d.createElement('div'),
19913                layersHTML = d.createElement('div'),
19914                layers = [];
19915
19916            thisImg.id = 'parallaxImg__' + l;
19917            containerHTML.className = 'parallaxImg-container';
19918            shadowHTML.className = 'parallaxImg-shadow';
19919            layersHTML.className = 'parallaxImg-layers';
19920
19921            for (var i = 0; i < totalLayerElems; i++) {
19922
19923                var layer = d.createElement('div'),
19924                    layerInner = d.createElement('div'),
19925                    imgSrc = layerElems[i].getAttribute('data-img');
19926
19927                $(layer).html($(layerElems[i]).html());
19928                layer.className = 'parallaxImg-rendered-layer';
19929                layer.setAttribute('data-layer', i);
19930
19931                if (i == 0 && $(thisImg).parents('.wpb_gallery').length == 0) {
19932                    layerInner.className = 'bg-img';
19933
19934                    if ($(thisImg).parents('.nectar-fancy-box').length > 0) {
19935                        layerInner.setAttribute('data-nectar-img-src', imgSrc);
19936                        lazyLoadedItems = true;
19937                    } else {
19938                        layerInner.style.backgroundImage = 'url(' + imgSrc + ')';
19939                    }
19940                    layer.appendChild(layerInner);
19941                }
19942                layersHTML.appendChild(layer);
19943
19944                layers.push(layer);
19945            }
19946
19947
19948            containerHTML.appendChild(layersHTML);
19949            thisImg.appendChild(containerHTML);
19950            $(thisImg).wrap('<div class="parallaxImg-wrap" />');
19951            if (!(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1)) {
19952                $(thisImg).parent().append(shadowHTML);
19953            }
19954
19955            if (supportsTouch && $('body.using-mobile-browser').length > 0) {
19956                // Stop processing.
19957            } else {
19958                (function (_thisImg, _layers, _totalLayers, _shine) {
19959                    $(thisImg).parents('.style-5').on('mousemove', function (e) {
19960
19961                        var parentEl = $(this);
19962                        var parallaxContainer = parentEl.find('.parallaxImg-container');
19963                        var parallaxShad = parentEl.find('.parallaxImg-shadow');
19964
19965                        var now = Date.now();
19966
19967                        var usingGallery = ($(_thisImg).parents('.wpb_gallery').length > 0) ? true : false;
19968
19969                        if (now > lastMove + eventThrottle) {
19970                            lastMove = now;
19971                            window.requestAnimationFrame(function () {
19972                                processMovement(e, false, _thisImg, _layers, _totalLayers, _shine, parentEl, parallaxContainer, parallaxShad, usingGallery);
19973                            });
19974                        }
19975
19976
19977                    });
19978                    $(thisImg).parents('.style-5').on('mouseenter', function (e) {
19979                        processEnter(e, _thisImg, _layers, _totalLayers, _shine);
19980                    });
19981                    $(thisImg).parents('.style-5').on('mouseleave', function (e) {
19982                        processExit(e, _thisImg, _layers, _totalLayers, _shine);
19983                    });
19984                })(thisImg, layers, totalLayerElems, shineHTML);
19985            }
19986
19987            // Set the depths
19988            (function (_thisImg, _layers, _totalLayers, _shine) {
19989                depths(false, _thisImg, _layers, _totalLayers, _shine);
19990                window.addEventListener('resize', function () {
19991                    depths(false, _thisImg, _layers, _totalLayers, _shine);
19992                });
19993            })(thisImg, layers, totalLayerElems, shineHTML);
19994        }
19995
19996        if (lazyLoadedItems) {
19997            nectarLazyImageLoading();
19998        }
19999
20000        function processMovement(e, touchEnabled, elem, layers, totalLayers, shine, parentEl, parallaxContainer, parallaxShad, usingGal) {
20001
20002            // Stop raf if exit already called
20003            if (!$(elem.firstChild).hasClass('over')) {
20004                processExit(e, elem, layers, totalLayers, shine);
20005                return false
20006            }
20007
20008            // Set up multipliers
20009            var yMult = 0.03;
20010            var xMult = 0.063;
20011
20012            var scaleAmount = '1.03';
20013            var offsetAmount = '-10';
20014            var usingMasonrySize = false;
20015
20016            if ($(elem).parents('.col.wide').length > 0) {
20017                yMult = 0.03;
20018                xMult = 0.063;
20019                usingMasonrySize = true;
20020            } else if ($(elem).parents('.col.regular').length > 0 || $(elem).parents('.wpb_gallery').length > 0) {
20021                yMult = 0.045;
20022                xMult = 0.045;
20023            } else if ($(elem).parents('.col.tall').length > 0) {
20024                yMult = 0.05;
20025                xMult = 0.015;
20026                usingMasonrySize = true;
20027            } else if ($(elem).parents('.col.wide_tall').length > 0) {
20028                yMult = 0.04;
20029                xMult = 0.04;
20030                usingMasonrySize = true;
20031            } else if (parentEl.hasClass('nectar-fancy-box')) {
20032                yMult = 0.045;
20033                xMult = 0.022;
20034                scaleAmount = '1.06';
20035                offsetAmount = '-2';
20036            } else {
20037                yMult = 0.045;
20038                xMult = 0.075;
20039            }
20040
20041            var bdst = nectarDOMInfo.scrollTop,
20042                bdsl = 0,
20043                pageX = (touchEnabled) ? e.touches[0].pageX : e.pageX,
20044                pageY = (touchEnabled) ? e.touches[0].pageY : e.pageY,
20045                offsets = elem.getBoundingClientRect(),
20046                w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth,
20047                h = elem.clientHeight || elem.offsetHeight || elem.scrollHeight,
20048                wMultiple = 320 / w,
20049                offsetX = 0.52 - (pageX - offsets.left - bdsl) / w,
20050                offsetY = 0.52 - (pageY - offsets.top - bdst) / h,
20051                dy = (pageY - offsets.top - bdst) - h / 2,
20052                dx = (pageX - offsets.left - bdsl) - w / 2,
20053                yRotate = (offsetX - dx) * (yMult * wMultiple),
20054                xRotate = (dy - offsetY) * (xMult * wMultiple);
20055
20056            var imgCSS;
20057
20058            if (usingGal == true) {
20059                imgCSS = ' perspective(' + w * 3 + 'px) rotateX(' + -xRotate * 1.9 + 'deg) rotateY(' + -yRotate * 1.3 + 'deg)';
20060            } else {
20061
20062                if (usingMasonrySize == false) {
20063                    imgCSS = ' perspective(' + w * 3 + 'px) rotateX(' + xRotate + 'deg) rotateY(' + yRotate + 'deg)  translateY(' + offsetY * offsetAmount + 'px) translateX(' + offsetX * offsetAmount + 'px) scale(' + scaleAmount + ')';
20064                } else {
20065                    imgCSS = ' perspective(' + w * 3 + 'px) rotateX(' + xRotate 
20065+ 'deg) rotateY(' + yRotate + 'deg)  translateY(' + offsetY * -10 + 'px) translateX(' + offsetX * -10 + 'px) scale(1.013)';
20066                }
20067
20068            }
20069
20070
20071            // Container transform
20072            parallaxContainer.css('transform', imgCSS);
20073
20074            if (!(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1)) {
20075                parallaxShad.css('transform', imgCSS);
20076            }
20077
20078
20079        }
20080
20081
20082        function processEnter(e, elem) {
20083
20084            elem.firstChild.className += ' over';
20085            elem.className += ' over';
20086
20087            $(elem).addClass('transition');
20088
20089            if ($(elem).parents('.wpb_gallery').length > 0) {
20090                setTimeout(function () {
20091                    $(elem).removeClass('transition');
20092                }, 450);
20093            } else {
20094                setTimeout(function () {
20095                    $(elem).removeClass('transition');
20096                }, 200);
20097            }
20098
20099        }
20100
20101
20102        function processExit(e, elem) {
20103
20104            var w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth;
20105            var container = elem.firstChild;
20106
20107            container.className = container.className.replace(' over', '');
20108            elem.className = elem.className.replace(' over', '');
20109            $(container).css('transform', 'perspective(' + w * 3 + 'px) rotateX(0deg) rotateY(0deg) translateZ(0)');
20110            $(elem).parents('.parallaxImg-wrap').find('.parallaxImg-shadow').css('transform', 'perspective(' + w * 3 + 'px) rotateX(0deg) rotateY(0deg) translateZ(0)');
20111
20112            $(elem).addClass('transition');
20113            setTimeout(function () {
20114                $(elem).removeClass('transition');
20115            }, 200);
20116
20117        }
20118
20119
20120        function depths(touchEnabled, elem, layers, totalLayers) {
20121
20122            var w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth;
20123            var container = elem.firstChild;
20124
20125            // Set z
20126            for (var ly = 0; ly < totalLayers; ly++) {
20127                if (ly == 0) {
20128                    $(layers[ly]).css('transform', 'translateZ(0px)');
20129                } else {
20130                    $(layers[ly]).css('transform', 'translateZ(' + (w * 3) / 27 * (ly * 1.1) + 'px) ');
20131                }
20132
20133            }
20134
20135            totalLayers = totalLayers + 3;
20136
20137            // Set perspective from beginning
20138            $(container).css('transform', 'perspective(' + w * 3 + 'px)');
20139
20140        }
20141
20142    }
20143
20144
20145    /**
20146     * Fancy Box
20147     *
20148     * @since 11.0
20149     */
20150    function nectarFancyBoxHover() {
20151
20152        if ($('.nectar-fancy-box[data-style="hover_desc"]').length == 0) {
20153            return false;
20154        }
20155
20156        var $hoverContentHeight = 0;
20157
20158        $('body').on('mouseenter touchstart', '.nectar-fancy-box[data-style="hover_desc"]', function () {
20159            $hoverContentHeight = parseInt($(this).find('.hover-content').outerHeight(true));
20160            $(this).addClass('hovered');
20161            $(this).find('.heading-wrap').css('transform', 'translateY(-' + $hoverContentHeight + 'px)');
20162        });
20163
20164        $('body').on('mouseleave touchend', '.nectar-fancy-box[data-style="hover_desc"]', function () {
20165            $(this).removeClass('hovered');
20166            $(this).find('.heading-wrap').css('transform', 'translateY(0)');
20167        });
20168
20169    }
20170
20171
20172    /**
20173     * Nectar Link Indicators
20174     *
20175     * @since 14.0
20176     */
20177    function nectarLinkIndicators() {
20178
20179        linkIndicatorArr = [];
20180        if (!nectarDOMInfo.usingMobileBrowser) {
20181            $('[data-nectar-link-indicator]').each(function (i) {
20182                if ($(this).is('[data-indicator-text]')) {
20183                    linkIndicatorArr[i] = new NectarIconMouseFollow($(this), 'view-indicator');
20184                } else {
20185                    linkIndicatorArr[i] = new NectarIconMouseFollow($(this), 'link-indicator');
20186                }
20187
20188            });
20189        }
20190    }
20191
20192    /**
20193     * Mouse Follow Icon
20194     *
20195     * @since 11.0
20196     */
20197    function NectarMouseFollowIcon(el, iconSelector) {
20198
20199        this.$el = el;
20200        this.$iconEl = this.$el.find(iconSelector);
20201        this.$innerIconEl = this.$el.find('.inner');
20202
20203        this.initialX = this.$el.width() / 2;
20204        this.initialY = this.$el.height() / 2;
20205
20206        this.elX = 0;
20207        this.elY = 0;
20208
20209        this.lastScroll = 0;
20210        this.scrollAdjust = 0;
20211
20212        this.lastX = this.initialX;
20213        this.lastY = this.initialY;
20214        this.lastY2 = this.initialY;
20215
20216        this.innerLastX = 0;
20217        this.innerLastY = 0;
20218        this.activeFollow = false;
20219        this.hoverOnly = false;
20220
20221        this.percentage = 0.03;
20222        this.percentageInterval;
20223        this.exitTimeout;
20224
20225        this.$iconEl.css({
20226            'top': '0',
20227            'left': '0'
20228        });
20229
20230        $window.on('resize', this.resizeEvent.bind(this));
20231        this.mouseEvents();
20232        this.rafLoop();
20233
20234    }
20235
20236
20237    NectarMouseFollowIcon.prototype.resizeEvent = function () {
20238        this.initialX = this.$el.width() / 2;
20239        this.initialY = this.$el.height() / 2;
20240    };
20241
20242    NectarMouseFollowIcon.prototype.mouseEvents = function () {
20243
20244        var that = this;
20245
20246        // hover only style
20247        if (that.$el.hasClass('play_button_hover')) {
20248            that.hoverOnly = true;
20249        }
20250
20251        that.$el.on('mouseenter', function (e) {
20252
20253            that.activeFollow = true;
20254
20255            that.elX = e.offsetX;
20256            that.elY = e.offsetY;
20257
20258            that.lastScroll = 0;
20259
20260            if (that.hoverOnly) {
20261                that.percentage = 1;
20262                clearTimeout(that.exitTimeout);
20263                setTimeout(function () {
20264                    that.percentage = 0.16;
20265                }, 60);
20266            } else {
20267                clearInterval(that.percentageInterval);
20268
20269                that.percentageInterval = setInterval(function () {
20270                    if (that.percentage < 0.16) {
20271                        that.percentage += 0.008;
20272                    } else {
20273                        clearInterval(that.percentageInterval);
20274                    }
20275
20276                }, 30);
20277            }
20278
20279
20280        });
20281
20282        that.$el.on('mouseleave', function () {
20283
20284            if (that.hoverOnly) {
20285                that.exitTimeout = setTimeout(function () {
20286                    that.activeFollow = false;
20287                    that.lastScroll = 0;
20288                    clearInterval(that.percentageInterval);
20289                    that.percentage = 0.03;
20290                }, 400);
20291            } else {
20292                that.activeFollow = false;
20293                that.lastScroll = 0;
20294                clearInterval(that.percentageInterval);
20295                that.percentage = 0.03;
20296            }
20297
20298        });
20299
20300        that.$el.on('mousemove', function (e) {
20301            that.elX = e.offsetX;
20302            that.elY = e.offsetY;
20303            that.lastScroll = 0;
20304        });
20305
20306        $(window).on('scroll', function () {
20307            if (that.activeFollow == true && that.lastScroll == 0) {
20308                that.lastScroll = nectarDOMInfo.scrollTop;
20309            }
20310        });
20311
20312    };
20313
20314
20315    NectarMouseFollowIcon.prototype.rafLoop = function () {
20316
20317        if (this.activeFollow == true) {
20318
20319            this.scrollAdjust = 0;
20320            this.alteredY = this.elY;
20321            if (this.lastScroll > 0) {
20322                this.scrollAdjust = nectarDOMInfo.scrollTop - this.lastScroll;
20323                this.alteredY += this.scrollAdjust;
20324            }
20325
20326            this.lastY = linearInterpolate(this.lastY, this.alteredY, this.percentage);
20327            this.lastX = linearInterpolate(this.lastX, this.elX, this.percentage);
20328
20329            // Need to track y without scroll adjust for inner parallax
20330            this.lastY2 = linearInterpolate(this.lastY2, this.alteredY, this.percentage);
20331
20332            this.innerLastX = linearInterpolate(this.innerLastX, parseInt(this.elX) - parseInt(this.lastX), this.percentage) / 1.7;
20333            this.innerLastY = linearInterpolate(this.innerLastY, parseInt(this.alteredY) - parseInt(this.lastY2), this.percentage) / 1.7;
20334
20335        } else {
20336            this.lastY = linearInterpolate(this.lastY, this.initialY, 0.055);
20337            this.lastX = linearInterpolate(this.lastX, this.initialX, 0.055);
20338
20339            this.innerLastX = 0;
20340            this.innerLastY = 0;
20341        }
20342
20343        this.$iconEl[0].style.transform = 'translateX(' + this.lastX + 'px) translateY(' + this.lastY + 'px)';
20344
20345        if (this.$innerIconEl.length > 0) {
20346            this.$innerIconEl[0].style.transform = 'translateX(' + clamp(this.innerLastX, 14, -14) + 'px) translateY(' + clamp(this.innerLastY, 14, -14) + 'px)';
20347        }
20348
20349        requestAnimationFrame(this.rafLoop.bind(this));
20350
20351    };
20352
20353
20354    /**
20355     * Video Lightbox
20356     *
20357     * @since 11.0
20358     */
20359    function nectarVideoLightbox() {
20360
20361        iconMouseFollowArr = [];
20362
20363        // Parent hover relationship.
20364        $body.on('mouseenter', '.nectar_video_lightbox[data-parent-hover="1"]', function () {
20365            var $parentRow = $(this).parents('.wpb_row');
20366            $parentRow.find('> .row-bg-wrap .row-bg, > .nectar-video-wrap .nectar-video-inner').addClass('transition');
20367            $parentRow.find('> .row-bg-wrap .row-bg, > .nectar-video-wrap .nectar-video-inner').css({
20368                'transform': 'scale(1.08)'
20369            });
20370        });
20371
20372        $body.on('mouseleave', '.nectar_video_lightbox[data-parent-hover="1"]', function () {
20373            var $parentRow = $(this).parents('.wpb_row');
20374            $parentRow.find('> .row-bg-wrap .row-bg, > .nectar-video-wrap .nectar-video-inner').css({
20375                'transform': 'scale(1)'
20376            });
20377        });
20378
20379        // Mouse Indicator.
20380        $('.nectar_video_player_self_hosted').each(function (i) {
20381            if (!nectarDOMInfo.usingMobileBrowser && $(this).find('.play_button.follow_mouse').length > 0) {
20382                iconMouseFollowArr[i] = new NectarMouseFollowIcon($(this), '.play_button.follow_mouse .play');
20383            }
20384        });
20385
20386        // Scrolled triggered play.
20387        if ('IntersectionObserver' in window) {
20388
20389            var selfHostedVideoObserver = new IntersectionObserver(function (entries) {
20390                entries.forEach(function (entry) {
20391                    if (entry.isIntersecting) {
20392
20393                        var video = entry.target;
20394
20395                        var timeout = 200;
20396                        if (video.readyState > 1) {
20397                            timeout = 20;
20398                        }
20399                        setTimeout(function () {
20400                            video.pause();
20401                            video.currentTime = 0;
20402                            video.play();
20403                        }, timeout);
20404
20405                        selfHostedVideoObserver.unobserve(entry.target);
20406                    }
20407                });
20408            }, {
20409                root: (isSafari()) ? null : document,
20410                rootMargin: '-10% 0% -10% 0%',
20411                threshold: 0
20412            });
20413
20414            $('video.scroll-triggered-play').each(function () {
20415                selfHostedVideoObserver.observe($(this)[0]);
20416            });
20417
20418        }
20419
20420        $('.nectar-video-box').each(function (i) {
20421
20422            if ($(this).find('.play_button_mouse_follow').length > 0) {
20423
20424                var $that = $(this);
20425
20426                $(this).imagesLoaded(function () {
20427
20428                    // Follow mouse.
20429                    if (!nectarDOMInfo.usingMobileBrowser) {
20430                        iconMouseFollowArr[i] = new NectarMouseFollowIcon($that, '.play_button_mouse_follow');
20431                    }
20432
20433                    // Initial setup.
20434                    var $playColor = ($that.is('[data-mouse-icon-color]') && $that.attr('data-mouse-icon-color').length > 0) ? $that.attr('data-mouse-icon-color') : '#000';
20435
20436                    if ($that.is('[data-mouse-style="solid_color"]')) {
20437
20438                        $that.find('.play_button_mouse_follow').css({
20439                            'background-color': $playColor
20440                        });
20441                    }
20442
20443                    $that.find('.play_button_mouse_follow').addClass('visible');
20444
20445                });
20446
20447            }
20448
20449        });
20450
20451    }
20452
20453
20454    /**
20455     * Salient slider rotation
20456     *
20457     * @since 10.5
20458     */
20459    function nectarCustomSliderRotate(slider) {
20460
20461        if ($('body.vc_editor').length > 0) {
20462            return;
20463        }
20464
20465        var $controlSelector = (slider.find('.project-slides').length > 0) ? '.dot-nav > span' : '.controls > li',
20466            $controlSelectorInd = (slider.find('.project-slides').length > 0) ? 'span' : ' li',
20467            $slideLength = slider.find($controlSelector).length,
20468            $currentSlide = slider.find($controlSelector + '.active').index();
20469
20470        if ($currentSlide + 1 == $slideLength) {
20471            slider.find($controlSelector + ':first-child').trigger('click');
20472        } else {
20473            slider.find($controlSelector + '.active').next($controlSelectorInd).trigger('click');
20474        }
20475    }
20476
20477
20478    /**
20479     * Salient slider rotation reset
20480     *
20481     * @since 10.5
20482     */
20483    function nectarCustomSliderResetRotate(slider, index) {
20484        clearInterval($nectarCustomSliderRotate[index].autorotate);
20485
20486        // Reinit autorotate
20487        if (slider.attr('data-autorotate').length > 0) {
20488            var slide_interval = (parseInt(slider.attr('data-autorotate')) < 100) ? 4000 : parseInt(slider.attr('data-autorotate'));
20489            $nectarCustomSliderRotate[index].autorotate = setInterval(function () {
20490                nectarCustomSliderRotate(slider)
20491            }, slide_interval);
20492        }
20493    }
20494
20495
20496    /**
20497     * Fullscreen recent project slider
20498     *
20499     * @since 10.5
20500     */
20501    function fsProjectSliderInit() {
20502
20503        $fsProjectSliderArr = [];
20504
20505        if (typeof SalientRecentProjectsFullScreen === 'undefined') {
20506            return;
20507        }
20508
20509        $('.nectar_fullscreen_zoom_recent_projects').each(function (i) {
20510            $fsProjectSliderArr[i] = new SalientRecentProjectsFullScreen($(this));
20511        });
20512
20513    }
20514
20515
20516    /**
20517     * Portfolio single template sticky sidebar
20518     *
20519     * @since 6.0
20520     */
20521    function portfolioSidebarFollow() {
20522
20523        var sidebarFollow = $('.single-portfolio #sidebar').attr('data-follow-on-scroll');
20524
20525        if ($('body.single-portfolio').length == 0 || $('#sidebar[data-follow-on-scroll]').length == 0) {
20526            return;
20527        }
20528
20529        sidebarFollow = $('.single-portfolio #sidebar').attr('data-follow-on-scroll');
20530
20531        if (sidebarFollow == 1 &&
20532            !$body.hasClass('mobile') &&
20533            parseInt($('#sidebar').height()) + 50 <= parseInt($('.post-area').height())) {
20534
20535            //padding from top of screen
20536            var $ssExtraTopSpace = stickyElPositionOffset();
20537
20538            $('.single-portfolio #sidebar').theiaStickySidebar({
20539                additionalMarginTop: $ssExtraTopSpace,
20540                updateSidebarHeight: false
20541            });
20542
20543
20544        }
20545
20546    }
20547
20548
20549    /**
20550     * Infinite scroll pagination
20551     *
20552     * @since 6.0
20553     */
20554    function infiniteScrollInit() {
20555
20556        if ($('.infinite_scroll').length > 0) {
20557
20558            // Portfolio
20559            $('.portfolio-items.infinite_scroll').infinitescroll({
20560                navSelector: "#pagination",
20561                nextSelector: "#pagination a:first",
20562                itemSelector: ".portfolio-items.infinite_scroll .element",
20563                finishedMsg: "<em>Congratulations, you've reached the end of the internet.</em>",
20564                msgText: " ",
20565            }, function (newElements) {
20566
20567
20568                var $container = $('.portfolio-items.infinite_scroll:not(.carousel)'),
20569                    $newElems = $(newElements).css('opacity', 0);
20570
20571                // Ensure that images load before adding to masonry layout
20572                $newElems.imagesLoaded(function () {
20573
20574                    $(newElements).css('opacity', 1);
20575
20576                    $container.isotope('appended', $(newElements));
20577
20578                    $(newElements).find('.work-item').addClass('ajax-loaded');
20579                    $(newElements).addClass('ajax-loaded');
20580
20581                    // Show elems now they're ready
20582                    $(newElements).find('.work-meta, .nectar-love-wrap').css({
20583                        'opacity': 1
20584                    });
20585
20586                    // Keep current filtering
20587                    if ($('.portfolio-filters-inline').length > 0 || $('.portfolio-filters').length > 0) {
20588
20589                        var selector;
20590
20591                        if ($('.portfolio-filters-inline').length > 0) {
20592                            selector = $('.portfolio-filters-inline a.active').attr('data-filter');
20593                        } else {
20594                            selector = $('.portfolio-filters a.active').attr('data-filter');
20595                        }
20596
20597                        $('.portfolio-filters-inline a.active').attr('data-filter');
20598                        $container.isotope({
20599                            filter: selector
20600                        });
20601                    }
20602
20603                    // Set width
20604                    for (var i = 0; i < $portfolio_containers.length; i++) {
20605                        $portfolio_containers[i].reLayout();
20606                    }
20607
20608                    if ($(newElements).find('.work-item.style-5').length > 0) {
20609                        parallaxItemHoverEffect();
20610                    }
20611
20612                    if ($(newElements).find('.inner-wrap').attr('data-animation') == 'none') {
20613                        $('.portfolio-items .col .inner-wrap').removeClass('animated');
20614                    } else {
20615
20616                        for (var i = 0; i < $portfolio_containers.length; i++) {
20617                            $portfolio_containers[i].masonryZindex();
20618                            $portfolio_containers[i].portfolioAccentColor();
20619                        }
20620
20621                        $(newElements).each(function () {
20622
20623                            var $portfolioOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '90%';
20624
20625                            // Not already visible
20626                            var $that = $(this);
20627                            var waypoint = new Waypoint({
20628                                element: $that[0],
20629                                handler: function () {
20630
20631                                    var $portfolioAnimationDelay = ($that.is('[data-masonry-type="photography"].masonry-items')) ? 85 : 115;
20632
20633                                    setTimeout(function () {
20634                                        $that.addClass("animated-in");
20635                                    }, $portfolioAnimationDelay * $that.attr('data-delay-amount'));
20636
20637
20638                                    waypoint.destroy();
20639                                },
20640                                offset: $portfolioOffsetPos
20641
20642                            });
20643
20644
20645                        });
20646                    }
20647
20648
20649                    // Lightbox reinit.
20650                    $('.portfolio-items').each(function () {
20651                        var $unique_id = uniqueIdGenerate();
20652                        $(this).find('a[rel^="prettyPhoto"], a.pretty_photo').attr('rel', 'prettyPhoto[' + $unique_id + '_gal]').removeClass('pretty_photo');
20653                    });
20654
20655
20656                    $('.portfolio-items').each(function () {
20657                        var $unique_id = uniqueIdGenerate();
20658                        $(this).find('a[data-fancybox^="group_"]').attr('data-fancybox', 'group_' + $unique_id);
20659                    });
20660
20661                    lightBoxInit();
20662
20663                    setTimeout(function () {
20664
20665                        for (var i = 0; i < $portfolio_containers.length; i++) {
20666                            $portfolio_containers[i].masonryZindex();
20667                            $portfolio_containers[i].reLayout();
20668                            $portfolio_containers[i].isotopeCatSelection();
20669                        }
20670                        $(newElements).removeClass('ajax-loaded');
20671                    }, 700);
20672
20673                    parallaxRowsBGCals();
20674
20675                });
20676
20677
20678            });
20679
20680            // Blog
20681            var blogPostItemSelector = '.post-area.infinite_scroll .posts-container .post';
20682            if ($('body').find(blogPostItemSelector).length == 0) {
20683                // switch to generic selector for CTPs
20684                blogPostItemSelector = '.post-area.infinite_scroll .posts-container > article';
20685            }
20686            $('.post-area.infinite_scroll .posts-container').infinitescroll({
20687                navSelector: "#pagination",
20688                nextSelector: "#pagination a:first",
20689                itemSelector: blogPostItemSelector,
20690                finishedMsg: "<em>Congratulations, you've reached the end of the internet.</em>",
20691                msgText: " "
20692            }, function (newElements) {
20693
20694                if ($(newElements).find('[data-nectar-img-src]').length > 0) {
20695                    nectarLazyImageLoading();
20696                }
20697
20698                // Only trigger recalc of waypoints and elements if needed.
20699                if ($('.masonry.classic').length > 0 ||
20700                    $('.post-area:not(.masonry):not(.featured_img_left)').length > 0 ||
20701                    $('.post-area.standard-minimal').length > 0) {
20702
20703                    // Gallery.
20704                    flexsliderInit();
20705
20706                    // Media players.
20707                    if ($().mediaelementplayer) {
20708                        $(newElements).find('.wp-audio-shortcode, .wp-video-shortcode').mediaelementplayer();
20709                    }
20710
20711                    // Lightbox.
20712                    lightBoxInit();
20713
20714                    // Carousels.
20715                    if ($('.carousel').length > 0) {
20716                        standardCarouselInit();
20717                        clientsCarouselInit();
20718                    }
20719
20720                    // Waypoints.
20721                    waypoints();
20722
20723                    // Testimonial slider.
20724                    $('.testimonial_slider').animate({
20725                        'opacity': '1'
20726                    }, 800);
20727                    nectarTestimonialSliders();
20728                    nectarTestimonialSlidersEvents();
20729
20730                    setTimeout(function () {
20731                        responsiveVideoIframesInit();
20732                        responsiveVideoIframes();
20733                        $window.trigger('resize');
20734                    }, 500);
20735
20736
20737                    parallaxRowsBGCals();
20738
20739                    $window.trigger('resize');
20740
20741                } // Non meta overlaid style.
20742                else {
20743                    parallaxRowsBGCals();
20744
20745                    $window.trigger('resize');
20746                }
20747
20748                // Trigger Masonry as a callback.
20749                var $container = $('.infinite_scroll .posts-container');
20750                if ($container.parent().hasClass('masonry')) {
20751
20752                    $(newElements).addClass('masonry-blog-item');
20753
20754
20755                } //if masonry.
20756
20757
20758                // Loading effect.
20759
20760                //// hide new items while they are loading.
20761                var $newElems = $(newElements);
20762                //// ensure that images load before adding to masonry layout.
20763
20764                if ($newElems.find('img').length == 0) {
20765                    $newElems = $('body');
20766                } else if (isSafari()) {
20767
20768                    // Safari specific bug that causes object-fit to fail on AJAX loaded items.
20769                    // Forcing a reload of the image src corrects issue.
20770                    var newImages = Array.from($newElems.find('img[srcset]'));
20771
20772                    newImages.forEach(function (img) {
20773                        var srcset = img.getAttribute('srcset');
20774                        img.setAttribute('srcset', '');
20775                        img.setAttribute('srcset', srcset);
20776                    });
20777                }
20778
20779
20780                $newElems.imagesLoaded(function () {
20781
20782                    if ($container.parent().hasClass('masonry') &&
20783                        !$container.parent().hasClass('auto_meta_overlaid_spaced')) {
20784                        $container.isotope('appended', $(newElements));
20785                    }
20786
20787                    for (var i = 0; i < $nectarMasonryBlogs.length; i++) {
20788                        $nectarMasonryBlogs[i].flickityBlogInit();
20789                    }
20790
20791                    $(newElements).addClass('ajax-loaded');
20792                    // Show elems now they're ready.
20793
20794                    // Classic enhanced specific
20795                    if ($container.parent().hasClass('classic_enhanced')) {
20796                        $container.find('.large_featured.has-post-thumbnail.ajax-loaded .post-featured-img, .wide_tall.has-post-thumbnail.ajax-loaded .post-featured-img').each(function () {
20797                            var $src = $(this).find('img').attr('src');
20798                            $(this).css('background-image', 'url(' + $src + ')');
20799                        });
20800
20801                        $container.find('.large_featured.ajax-loaded .nectar-flickity, .wide_tall.ajax-loaded .nectar-flickity').each(function () {
20802
20803                            $(this).find('.cell').each(function () {
20804                                var $src = $(this).find('img').attr('src');
20805                                $(this).css('background-image', 'url(' + $src + ')');
20806                            });
20807
20808                        });
20809                    }
20810
20811
20812                    if ($(newElements).parents('.posts-container').attr('data-animation') == 'none') {
20813                        $(newElements).find('.inner-wrap').removeClass('animated');
20814                    } else {
20815
20816                        for (var i = 0; i < $nectarMasonryBlogs.length; i++) {
20817                            $nectarMasonryBlogs[i].blogMasonryZindex();
20818                        }
20819
20820                        $(newElements).each(function () {
20821
20822                            var $that = $(this);
20823                            var waypoint = new Waypoint({
20824
20825                                element: $that[0],
20826                                handler: function () {
20827
20828                                    setTimeout(function () {
20829                                        $that.addClass("animated-in");
20830                                    }, 80 * $that.attr('data-delay-amount'));
20831
20832                                    waypoint.destroy();
20833                                },
20834                                offset: '90%'
20835
20836                            });
20837
20838
20839                        });
20840                    }
20841
20842                    setTimeout(function () {
20843                        $(newElements).removeClass('ajax-loaded');
20844                    }, 700);
20845
20846
20847                });
20848
20849
20850            });
20851
20852        }
20853
20854    }
20855
20856
20857    /**
20858     * Scroll to top scroll bind.
20859     *
20860     * @since 2.0
20861     */
20862    function toTopBind() {
20863
20864        if ($('#to-top').length > 0 && nectarDOMInfo.winW > 1020 ||
20865            $('#to-top').length > 0 && $('#to-top.mobile-enabled').length > 0) {
20866
20867            if (nectarDOMInfo.scrollTop > 350) {
20868                $window.on('scroll', hideToTop);
20869            } else {
20870                $window.on('scroll', showToTop);
20871            }
20872        }
20873
20874    }
20875
20876    /**
20877     * Scroll to top show.
20878     *
20879     * @since 2.0
20880     */
20881    function showToTop() {
20882
20883        if (nectarDOMInfo.scrollTop > 350 && !$offCanvasEl.is('.fullscreen.open')) {
20884
20885            $('#to-top').stop().transition({
20886                'transform': 'translateY(-50%)'
20887            }, 350, 'easeInOutCubic');
20888
20889            $window.off('scroll', showToTop);
20890            $window.on('scroll', hideToTop);
20891        }
20892
20893    }
20894
20895
20896    /**
20897     * Scroll to top hide.
20898     *
20899     * @since 2.0
20900     */
20901    function hideToTop() {
20902
20903        if (nectarDOMInfo.scrollTop < 350 || $offCanvasEl.is('.fullscreen.open')) {
20904
20905            var $animationTiming = ($('#slide-out-widget-area.fullscreen.open').length > 0) ? 1150 : 350;
20906
20907            $('#to-top').stop().transition({
20908                'transform': 'translateY(105%)'
20909            }, $animationTiming, 'easeInOutQuint');
20910
20911            $window.off('scroll', hideToTop);
20912            $window.on('scroll', showToTop);
20913
20914        }
20915    }
20916
20917
20918    /**
20919     * Scroll to top initialization.
20920     *
20921     * @since 10.5
20922     */
20923    function scrollToTopInit() {
20924
20925        // Show/hide based on scroll pos
20926        if ($('.nectar-social.fixed').length == 0) {
20927            toTopBind();
20928        }
20929
20930
20931        // Rounded style
20932        if ($('body[data-button-style*="rounded"]').length > 0) {
20933            var $clone = $('#to-top .fa-angle-up').clone();
20934            $clone.addClass('top-icon');
20935            $('#to-top').prepend($clone);
20936        }
20937
20938        // Scroll up click event
20939        $body.on('click', '#to-top, a[href="#top"]', function () {
20940            $('body,html').stop().animate({
20941                scrollTop: 0
20942            }, 800, 'easeOutQuad', function () {
20943                if ($('.nectar-box-roll').length > 0) {
20944                    $body.trigger('mousewheel', [1, 0, 0]);
20945                }
20946            });
20947            return false;
20948        });
20949
20950    }
20951
20952
20953    /**
20954     * Scrollspy plugin initialization.
20955     *
20956     * @since 5.0
20957     */
20958    function scrollSpyInit() {
20959
20960        var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $window.width() > 1000) ? 0 : $headerOuterEl.outerHeight();
20961
20962        if ($('.page-template-template-no-header-footer').length > 0 || $('.page-template-template-no-header').length > 0) {
20963            $headerNavSpace = 0;
20964        }
20965
20966        // Track whether scrollspy is really needed.
20967        var hashLinksFound = false;
20968
20969        //prevent jump to top on empty items
20970        $('header#top .sf-menu li a[href="#"]').on('click', function (e) {
20971            e.preventDefault();
20972        });
20973
20974        if ($('#nectar_fullscreen_rows').length == 0 || $nectarFullPage.$usingFullScreenRows == false) {
20975
20976            $('a.nectar-next-section').each(function () {
20977
20978                if ($(this).parents('.wpb_row:not(.inner_row)').length > 0) {
20979
20980                    var $parentRow = $(this).parents('.wpb_row:not(.inner_row)');
20981
20982                    if ($parentRow.next('.wpb_row[id]:not(.inner_row)').length > 0) {
20983
20984                        var $nextRowID = $parentRow.next('.wpb_row[id]:not(.inner_row)').attr('id');
20985                        $(this).attr('href', '#' + $nextRowID);
20986                        hashLinksFound = true;
20987                    }
20988
20989                }
20990
20991            });
20992        } else if ($().fullpage) {
20993            $('a.nectar-next-section').on('click', function () {
20994                $.fn.fullpage.moveSectionDown();
20995                return false;
20996            });
20997        }
20998
20999
21000        // Links in off canvas menu.
21001        if ($('#slide-out-widget-area .off-canvas-menu-container').length > 0) {
21002            $('#slide-out-widget-area .off-canvas-menu-container').find("a[href*='" + location.pathname + "']").each(function () {
21003
21004                var $href = $(this).attr('href');
21005                var hashSegment = $href.substr($href.indexOf("#"));
21006
21007                // Regular animated anchors.
21008                if ($href != '#' &&
21009                    $href.indexOf("#") != -1 &&
21010                    $href.substr($href.indexOf("#")) !== '#' &&
21011                    hashSegment.indexOf('#/') == -1 &&
21012                    $('div' + $href.substr($href.indexOf("#"))).length > 0) {
21013
21014                    $(this).attr('href', $href.substr($href.indexOf("#")));
21015
21016                    $(this).parent()
21017                        .removeClass('current_page_item')
21018                        .removeClass('current-menu-item');
21019
21020                }
21021
21022                // Fullpage is a little different.
21023                if ($('div[data-fullscreen-anchor-id="' + $href.substr($href.indexOf("#") + 1) + '"]').length > 0) {
21024
21025                    $(this).parent()
21026                        .removeClass('current_page_item')
21027                        .removeClass('current-menu-item');
21028
21029                }
21030
21031            });
21032        }
21033
21034        // Links in header navigation.
21035        $("#header-outer").find("a[href*='" + location.pathname + "']").each(function () {
21036
21037            var $href = $(this).attr('href');
21038            var hashSegment = $href.substr($href.indexOf("#"));
21039
21040            // Regular animated anchors
21041            if ($href.indexOf("#") != -1 &&
21042                $href.substr($href.indexOf("#")) !== '#' &&
21043                hashSegment.indexOf('#/') == -1 &&
21044                $('div' + $href.substr($href.indexOf("#"))).length > 0) {
21045
21046                $(this).attr('href', $href.substr($href.indexOf("#")));
21047                $(this).parent()
21048                    .removeClass('current_page_item')
21049                    .removeClass('current-menu-item');
21050
21051            }
21052
21053            // Fullpage is a little different
21054            if ($('div[data-fullscreen-anchor-id="' + $href.substr($href.indexOf("#") + 1) + '"]').length > 0) {
21055
21056                $(this).parent()
21057                    .removeClass('current_page_item')
21058                    .removeClass('current-menu-item');
21059
21060            }
21061
21062        });
21063
21064
21065        // Hash links in menu?
21066        if ($("#header-outer").length > 0) {
21067            $("#header-outer").find("a[href*='#']:not([href='#'])").each(function () {
21068                if ($(this).attr('href') !== '#' &&
21069                    $(this).attr('href') !== '#searchbox' &&
21070                    $(this).attr('href') !== '#slide-out-widget-area') {
21071                    hashLinksFound = true;
21072                }
21073            });
21074        }
21075
21076        if ($("#slide-out-widget-area .off-canvas-menu-container").length > 0) {
21077            $("#slide-out-widget-area .off-canvas-menu-container").find("a[href*='#']:not([href='#'])").each(function () {
21078                if ($(this).attr('href') !== '#') {
21079                    hashLinksFound = true;
21080                }
21081            });
21082        }
21083
21084        // Init scrollspy.
21085        var targetList = [];
21086        if (hashLinksFound == true) {
21087            targetList.push('#header-outer nav');
21088        }
21089        if ($('.page-submenu[data-sticky="true"] a[href*="#"]').length > 0) {
21090            targetList.push('.page-submenu[data-sticky="true"]');
21091        }
21092
21093        if (targetList.length > 0) {
21094            targetList.forEach(function (tar, i) {
21095                var $el = (i == 0) ? $body : $(window);
21096                $el.scrollspy({
21097                    target: tar,
21098                    offset: $headerNavSpace + nectarDOMInfo.adminBarHeight + 40
21099                });
21100            });
21101        }
21102
21103    }
21104
21105
21106    /**
21107     * Called to scroll to hash link on page load
21108     *
21109     * @since 5.0
21110     */
21111    function pageLoadHash() {
21112
21113        var $hash = window.location.hash;
21114
21115        if ($hash && $hash.length > 0) {
21116            $hash = $hash.replace(/<|>/g, '');
21117        }
21118
21119        var $hashSubstrng = ($hash && $hash.length > 0) ? $hash.substring(1, $hash.length) : 0,
21120            headerPadding2 = headerPadding - headerPadding / 1.8,
21121            $hasSlashLength = 0;
21122
21123
21124        // If the hash has slashes
21125        if ($hashSubstrng) {
21126            $hasSlashLength = $hashSubstrng.split("/");
21127            $hasSlashLength = $hasSlashLength.length;
21128        }
21129
21130        if ($hashSubstrng && $hasSlashLength > 1) {
21131            $hashSubstrng = $hashSubstrng.replace(/\//g, "");
21132            $hash = $hash.replace(/\//g, "");
21133        }
21134
21135        if ($hash && $('.main-content').find($hash).length > 0 ||
21136            $hash && $('.main-content').find('[data-fullscreen-anchor-id="' + $hashSubstrng + '"]').length > 0) {
21137
21138            var $hashObj = ($('.main-content').find($hash).length > 0) ? $('.main-content').find($hash) : $('.main-content').find('[data-fullscreen-anchor-id="' + $hashSubstrng + '"]'),
21139                $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $window.width() > 1000) ? 0 : $('#header-space').outerHeight();
21140
21141            if ($('.page-template-template-no-header-footer').length > 0 || $('.page-template-template-no-header').length > 0) {
21142                $headerNavSpace = 0;
21143            }
21144
21145            var $timeoutVar = 100;
21146
21147            // Box roll.
21148            if ($('.nectar-box-roll').length > 0 && $('.container-wrap.bottomBoxOut').length > 0) {
21149                nectarBoxRoll.boxRoll(null, -1);
21150                $timeoutVar = 2050;
21151            }
21152
21153            // Lazy images.
21154            if ($('img[data-nectar-img-src]').length > 0) {
21155                nectarLoadAllImages();
21156                $timeoutVar = 200;
21157            }
21158
21159            setTimeout(function () {
21160
21161                var $scrollTopDistance;
21162
21163                if (headerIsContained === true) {
21164                    var containedHeaderHeight = $('#header-outer').outerHeight() + (parseInt($('#header-outer').css('margin-top')) * 2);
21165                    $scrollTopDistance = $($hash).offset().top - containedHeaderHeight - nectarDOMInfo.adminBarHeight;
21166                } else if ($('body[data-permanent-transparent="1"]').length == 0) {
21167
21168                    if (!$body.hasClass('mobile')) {
21169                        var $resize = ($('#header-outer[data-header-resize="0"]').length > 0) ? 0 : parseInt(logoShrinkNum) + headerPadding2 * 2;
21170                        if ($('#header-outer[data-remove-fixed="1"]').length > 0) {
21171                            $headerNavSpace = 0;
21172                        }
21173                        $scrollTopDistance = $hashObj.offset().top - parseInt($headerNavSpace) + $resize + 3 - nectarDOMInfo.adminBarHeight;
21174
21175
21176                        // Condense
21177                        if ($('body.mobile').length == 0 &&
21178                            $('#header-outer[data-condense="true"]').length > 0 &&
21179                            $('body.page-template-template-no-header').length === 0 &&
21180                            $('body.page-template-template-no-header-footer').length === 0) {
21181
21182                            var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'),
21183                                $headerHeightStored = $headerOuterEl.height(),
21184                                $headerHeightCondensed = $headerHeightStored - (parseInt($headerSpan9.height()) + parseInt($('#header-outer #logo').css('margin-top')));
21185
21186                            $scrollTopDistance = $hashObj.offset().top - parseInt($headerNavSpace) + $headerHeightCondensed - nectarDOMInfo.adminBarHeight;
21187                        }
21188
21189                    } else {
21190                        $scrollTopDistance = ($('#header-outer[data-mobile-fixed="1"]').length > 0) ? $hashObj.offset().top + 2 - $headerNavSpace + nectarDOMInfo.adminBarHeight : $hashObj.offset().top - nectarDOMInfo.adminBarHeight + 1;
21191                    }
21192
21193                } else {
21194                    $scrollTopDistance = $hashObj.offset().top - nectarDOMInfo.adminBarHeight + 1;
21195                }
21196
21197                if ($('body[data-hhun="1"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length == 0) {
21198
21199                    // Alter offset
21200                    if ($('#header-outer.detached').length == 0) {
21201                        $scrollTopDistance = $scrollTopDistance + $headerNavSpace;
21202                    }
21203                }
21204
21205                var $pageSubMenu = ($('.page-submenu[data-sticky="true"]').length > 0) ? $('.page-submenu').height() : 0;
21206                var $headerSecondary;
21207
21208                if ($('body.material').length > 0 &&
21209                    $headerSecondaryEl.length > 0 &&
21210                    $('body[data-hhun="1"]').length == 0 &&
21211                    $('#header-outer[data-remove-fixed="1"]').length == 0 &&
21212                    !$body.hasClass('mobile')) {
21213
21214                    $headerSecondary = $headerSecondaryEl.height();
21215
21216                } else {
21217                    $headerSecondary = 0;
21218                }
21219
21220                nectar_scrollToY($scrollTopDistance - $pageSubMenu + $headerSecondary, 700, 'easeInOutQuint');
21221
21222                nectarState.animatedScrolling = true;
21223                setTimeout(function () {
21224                    nectarState.animatedScrolling = false;
21225                }, 1100);
21226
21227            }, $timeoutVar);
21228        }
21229    }
21230
21231
21232    /**
21233     * Initialize page load hash functionality
21234     *
21235     * @since 10.5
21236     */
21237    function pageLoadHashInit() {
21238
21239        if ($('body[data-animated-anchors="true"]').length > 0) {
21240            if ($('.nectar-box-roll').length == 0 && $('#nectar_fullscreen_rows').length == 0) {
21241
21242                // Inside tabs
21243                if (typeof nectarGetQueryParam['tab'] != 'undefined') {
21244                    setTimeout(function () {
21245                        pageLoadHash();
21246                    }, 800);
21247                }
21248                // Regular
21249                else {
21250                    pageLoadHash();
21251                }
21252
21253            }
21254
21255            if ($('#nectar_fullscreen_rows[data-mobile-disable="on"]').length > 0 && $('.nectar-box-roll').length == 0 &&
21256                nectarDOMInfo.usingMobileBrowser) {
21257                pageLoadHash();
21258            }
21259
21260        }
21261
21262    }
21263
21264
21265    /**
21266     * Animated anchor link theme option.
21267     *
21268     * @since 10.5
21269     */
21270    function animatedAnchorLinks() {
21271
21272
21273        if ($animatedAnchorLinks) {
21274
21275            $body.on('click', '#header-outer nav .sf-menu li:not(.slide-out-widget-area-toggle) a[href*="#"]', function () {
21276                if (nectarState.ocmOpen && $(this).attr('href') != '#') {
21277                    OCM_close($(this).parent());
21278                }
21279            });
21280        }
21281
21282        if ($('body[data-animated-anchors="true"]').length > 0 ||
21283            $('.single-product [data-gallery-style="left_thumb_sticky"]').length > 0) {
21284
21285            var headerPadding2 = headerPadding - headerPadding / 1.8;
21286
21287            setTimeout(scrollSpyInit, 100);
21288
21289            var $animatedScrollingTimeout;
21290
21291            /* Intesys - Start 7 */
21292            // Added #navbarSection a,
21293            $body.on('click', '#navbarSection a, #header-outer nav .sf-menu a:not([href="#slide-out-widget-area"]), #header-outer .mobile-header .sf-menu a, #footer-outer .nectar-button, #footer-outer .widget_nav_menu a, #footer-widgets .textwidget a, #mobile-menu li a, .nectar-scrolling-tabs:not(.navigation_func_active_link_only) .scrolling-tab-nav a, .container-wrap a:not(.wpb_tabs_nav a):not(.navigation_func_active_link_only .scrolling-tab-nav a):not(.comment-wrap .navigation a):not(.woocommerce-checkout a):not(.um-woo-view-order):not(.magnific):not([data-fancybox]):not(.woocommerce-tabs .tabs a):not(.slider-prev):not(.slider-next):not(.testimonial-next-prev a):not(.page-numbers), .swiper-slide .button a, #slide-out-widget-area a, #slide-out-widget-area .inner div a', function (e) {
21294                /* Intesys - End 7 */
21295                var triggerAnimatedScroll = true;
21296                var $hash = $(this).prop("hash");
21297
21298                if ($hash &&
21299                    !$(this).hasClass('nectar-next-section') &&
21300                    $(this).parents('.slide-out-widget-area-toggle').length == 0) {
21301                    $body.addClass('animated-scrolling');
21302                    nectarState.animatedScrolling = true;
21303                }
21304
21305                clearTimeout($animatedScrollingTimeout);
21306
21307                $animatedScrollingTimeout = setTimeout(function () {
21308                    $body.removeClass('animated-scrolling');
21309                    nectarState.animatedScrolling = false;
21310                }, 1100);
21311
21312                var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $window.width() > 1000) ? 0 : $('#header-space').outerHeight();
21313
21314                if ($('.page-template-template-no-header-footer').length > 0 ||
21315                    $('.page-template-template-no-header').length > 0 ||
21316                    $('#header-space').length == 0) {
21317                    $headerNavSpace = 0;
21318                }
21319
21320                // Delay full page anchors until material right OCM closes
21321                if ($nectarFullPage.$usingFullScreenRows != false &&
21322                    $('#nectar_fullscreen_rows[data-anchors="on"]').length > 0 &&
21323                    $hash && $hash != '' && $hash != '#top' &&
21324                    $('body.material[data-slide-out-widget-area-style="slide-out-from-right"].material-ocm-open').length > 0) {
21325
21326                    e.preventDefault();
21327
21328                    if (!$(this).hasClass('skip-hash')) {
21329                        if (history.pushState) {
21330                            history.pushState(null, null, $hash);
21331                        } else {
21332                            location.hash = $hash;
21333                        }
21334
21335                    }
21336
21337                    setTimeout(function () {
21338                        $(window).trigger('hashchange');
21339                    }, 800);
21340
21341                }
21342
21343
21344                if ($hash && $body.find($hash).length > 0 && $hash != '#top' && $hash != '' && $(this).attr('href').indexOf(window.location.href.split("#")[0]) !== -1 ||
21345                    $(this).is('[href^="#"]') && $hash != '' && $body.find($hash).length > 0 && $hash != '#top') {
21346
21347
21348                    //update hash
21349                    if (!$(this).hasClass('skip-hash')) {
21350                        if (history.pushState) {
21351                            history.pushState(null, null, $hash);
21352                        } else {
21353                            location.hash = $hash;
21354                        }
21355                    }
21356
21357                    if ($(this).parents('ul').length > 0) {
21358
21359                        $(this)
21360                            .parents('ul')
21361                            .find('li')
21362                            .removeClass('current-menu-item');
21363                    }
21364
21365                    // Side widget area click
21366                    if ($(this).parents('#slide-out-widget-area').length > 0) {
21367
21368                        if ($('body.material[data-slide-out-widget-area-style="slide-out-from-right"].material-ocm-open').length > 0) {
21369
21370                            $('body > .slide_out_area_close__wrap .slide_out_area_close')
21371                                .addClass('non-human-allowed')
21372                                .trigger('click');
21373
21374                            // Scroll
21375                            var $clickedLinkStore = $(this);
21376
21377                            triggerAnimatedScroll = false;
21378
21379                            setTimeout(function () {
21380                                $clickedLinkStore.trigger('click');
21381                            }, 1000);
21382
21383                        } else {
21384                            $('#slide-out-widget-area .slide_out_area_close')
21385                                .addClass('non-human-allowed')
21386                                .trigger('click');
21387                        }
21388
21389                        setTimeout(function () {
21390                            if ($('body.material[data-slide-out-widget-area-style="slide-out-from-right"]').length > 0) {
21391                                $('body > .slide_out_area_close__wrap .slide_out_area_close').removeClass('non-human-allowed');
21392
21393                            } else {
21394                                $('#slide-out-widget-area .slide_out_area_close').removeClass('non-human-allowed');
21395                            }
21396                        }, 100);
21397                    }
21398
21399                    // Mobile menu click
21400                    if ($(this).parents('#mobile-menu').length > 0) {
21401                        $('.slide-out-widget-area-toggle.mobile-icon a')
21402                            .addClass('non-human-allowed')
21403                            .trigger('click');
21404
21405                        setTimeout(function () {
21406                            $('.slide-out-widget-area-toggle.mobile-icon a').removeClass('non-human-allowed');
21407                        }, 100);
21408                    }
21409
21410                    var $timeoutVar = 1;
21411                    var $that = $(this);
21412
21413                    // Box roll.
21414                    if ($('.nectar-box-roll').length > 0 && $('.container-wrap.bottomBoxOut').length > 0) {
21415                        nectarBoxRoll.boxRoll(null, -1);
21416                        $timeoutVar = 2050;
21417                    }
21418
21419                    // Load all images to calc offset correctly.
21420                    if ($('img[data-nectar-img-src]').length > 0) {
21421                        nectarLoadAllImages();
21422                        $timeoutVar = 200;
21423                    }
21424
21425
21426                    setTimeout(function () {
21427
21428                        var $scrollTopDistance;
21429
21430                        // Scrolling
21431                        if (headerIsContained === true) {
21432                            var containedHeaderHeight = $('#header-outer').outerHeight() + (parseInt($('#header-outer').css('margin-top')) * 2);
21433                            $scrollTopDistance = $($hash).offset().top - containedHeaderHeight - nectarDOMInfo.adminBarHeight;
21434                        } else if ($('body[data-permanent-transparent="1"]').length == 0) {
21435
21436                            if (!$body.hasClass('mobile')) {
21437                                var $resize = ($('#header-outer[data-header-resize="0"]').length > 0) ? 0 : parseInt(logoShrinkNum) + headerPadding2 * 2;
21438                                if ($('#header-outer[data-remove-fixed="1"]').length > 0) {
21439                                    $headerNavSpace = 0;
21440                                }
21441
21442                                $scrollTopDistance = $($hash).offset().top - parseInt($headerNavSpace) + $resize + 3 - nectarDOMInfo.adminBarHeight;
21443
21444                                // Condense
21445                                if ($('body.mobile').length == 0 &&
21446                                    $('body.page-template-template-no-header').length === 0 &&
21447                                    $('body.page-template-template-no-header-footer').length === 0 &&
21448                                    $('#header-outer[data-condense="true"]').length > 0) {
21449
21450                                    var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'),
21451                                        $headerHeightStored = $headerOuterEl.height(),
21452                                        $headerHeightCondensed = $headerHeightStored - (parseInt($headerSpan9.height()) + parseInt($('#header-outer #logo').css('margin-top')));
21453                                    $scrollTopDistance = $($hash).offset().top - parseInt($headerNavSpace) + $headerHeightCondensed - nectarDOMInfo.adminBarHeight;
21454
21455
21456                                }
21457
21458
21459                            } else {
21460                                $scrollTopDistance = ($('#header-outer[data-mobile-fixed="1"]').length > 0) ? $($hash).offset().top + 2 - $headerNavSpace + nectarDOMInfo.adminBarHeight : $($hash).offset().top - nectarDOMInfo.adminBarHeight + 1;
21461                            }
21462
21463                        } else {
21464                            $scrollTopDistance = $($hash).offset().top - nectarDOMInfo.adminBarHeight + 1;
21465                        }
21466
21467                        if ($('body[data-hhun="1"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length == 0) {
21468
21469                            // Alter offset
21470                            if ($('#header-outer.detached').length == 0 || $that.parents('.page-submenu[data-sticky="true"]').length > 0) {
21471                                $scrollTopDistance = $scrollTopDistance + $headerNavSpace;
21472                            }
21473
21474                            // Hide top header
21475                            if ($that.parents('.page-submenu[data-sticky="true"]').length > 0) {
21476
21477                                $('#header-outer.detached').addClass('invisible');
21478                                $('.page-submenu')
21479                                    .addClass('header-not-visible')
21480                                    .css('transform', 'translateY(0px)');
21481
21482                            }
21483                        }
21484
21485                        var $pageSubMenu = ($that.parents('.page-submenu[data-sticky="true"]').length > 0) ? $that.parents('.page-submenu').height() : 0;
21486                        var $headerSecondary;
21487
21488                        if ($('body.material').length > 0 &&
21489                            $headerSecondaryEl.length > 0 &&
21490                            $('body[data-hhun="1"]').length == 0 &&
21491                            $('#header-outer[data-remove-fixed="1"]').length == 0 &&
21492                            !$body.hasClass('mobile')) {
21493
21494                            $headerSecondary = $headerSecondaryEl.height();
21495
21496                        } else {
21497
21498                            if ($('body[data-hhun="1"]').length > 0 &&
21499                                $headerSecondaryEl.length > 0 &&
21500                                !$body.hasClass('mobile') &&
21501                                $('#header-outer[data-remove-fixed="1"]').length == 0) {
21502                                $headerSecondary = $headerSecondaryEl.height();
21503                            } else {
21504                                $headerSecondary = 0;
21505                            }
21506
21507                        }
21508
21509
21510                        if (triggerAnimatedScroll) {
21511                            nectar_scrollToY($scrollTopDistance - $pageSubMenu + $headerSecondary, 700, 'easeInOutQuint');
21512                        }
21513
21514
21515                    }, $timeoutVar);
21516
21517                    e.preventDefault();
21518
21519                }
21520
21521                if ($hash == '#top') {
21522                    // Side widget area click
21523                    if ($(this).parents('#slide-out-widget-area').length > 0) {
21524                        $('#slide-out-widget-area .slide_out_area_close').trigger('click');
21525                    }
21526                }
21527
21528            });
21529
21530
21531        }
21532
21533    }
21534
21535
21536    /**
21537     * Search results masonry layout.
21538     *
21539     * @since 10.0
21540     */
21541    function searchResultMasonry() {
21542
21543        var $searchContainer = $('#search-results'),
21544            $dividerNum = ($searchContainer.is('[data-layout="masonry-no-sidebar"]')) ? 4 : 3;
21545
21546        $searchContainer.imagesLoaded(function () {
21547
21548            $searchContainer.isotope({
21549                itemSelector: '.result',
21550                layoutMode: 'packery',
21551                packery: {
21552                    gutter: 0
21553                }
21554            });
21555
21556            $searchContainer
21557                .find('article')
21558                .css('opacity', '1');
21559
21560        });
21561
21562        $window.on('resize', function () {
21563
21564            $searchContainer.isotope({
21565                layoutMode: 'packery',
21566                packery: {
21567                    gutter: 0
21568                }
21569            });
21570        });
21571
21572    }
21573
21574
21575    /**
21576     * Search results masonry layout initialization.
21577     *
21578     * @since 10.5
21579     */
21580    function searchResultMasonryInit() {
21581        if ($('body.search-results').length > 0 &&
21582            $('#search-results article').length > 0 &&
21583            $('#search-results[data-layout="list-no-sidebar"]').length == 0 &&
21584            $('#search-results[data-layout="list-with-sidebar"]').length == 0) {
21585            searchResultMasonry();
21586        }
21587    }
21588
21589
21590    /**
21591     * Custom colors for portfolio grid elements.
21592     *
21593     * @since 10.5
21594     */
21595    function portfolioCustomColoring() {
21596
21597        if ($('.portfolio-items .col').length == 0) {
21598            return;
21599        }
21600
21601        //portfolio colors
21602        if ($('.portfolio-items .col .style-3-alt').length > 0 ||
21603            $('.portfolio-items .col .style-3').length > 0 ||
21604            $('.portfolio-items .col .style-2').length > 0 ||
21605            $('.portfolio-items .col .style-5').length > 0) {
21606
21607            var portfolioColorCss = '';
21608
21609            $('.portfolio-items .col').each(function () {
21610
21611                var $titleColor = $(this).attr('data-title-color'),
21612                    $subTitleColor = $(this).attr('data-subtitle-color');
21613
21614                if ($titleColor.length > 0) {
21615                    portfolioColorCss += '.col[data-title-color="' + $titleColor + '"] .vert-center h3, .portfolio-items[data-ps="6"] .col[data-title-color="' + $titleColor + '"] .work-meta h4 { color: ' + $titleColor + '!important; } ';
21616                    portfolioColorCss += ' .portfolio-items[data-ps="8"] .col[data-title-color="' + $titleColor + '"] .line { background-color: ' + $titleColor + '; }';
21617                    portfolioColorCss += '.portfolio-items[data-ps="8"] .col[data-title-color="' + $titleColor + '"] .next-arrow line { stroke: ' + $titleColor + '; } ';
21618                }
21619                if ($subTitleColor.length > 0) {
21620                    portfolioColorCss += '.col[data-subtitle-color="' + $subTitleColor + '"] .vert-center p, .portfolio-items[data-ps="6"] .col[data-title-color="' + $titleColor + '"] .work-meta p { color: ' + $subTitleColor + '!important; } ';
21621                }
21622
21623            });
21624
21625            //style
21626            nectarCreateStyle(portfolioColorCss, 'nectar-portfolio-colors');
21627
21628        }
21629
21630    }
21631
21632
21633    /**
21634     * Single post pagination/recent post mouse events
21635     *
21636     * @since 10.5
21637     */
21638    function postMouseEvents() {
21639
21640
21641        $body.on('mouseover', '.post-area.featured_img_left .grav-wrap .text a, .masonry.material .masonry-blog-item .grav-wrap .text a, .blog-recent[data-style="material"] .grav-wrap .text a', function () {
21642            $(this).parents('.grav-wrap')
21643                .find('img')
21644                .addClass('hovered');
21645        });
21646
21647        $body.on('mouseleave', '.post-area.featured_img_left .grav-wrap .text a, .masonry.material .masonry-blog-item .grav-wrap .text a, .blog-recent[data-style="material"] .grav-wrap .text a', function () {
21648            $(this).parents('.grav-wrap')
21649                .find('img')
21650                .removeClass('hovered');
21651        });
21652
21653        $body.on('mouseleave', '.container-wrap[data-nav-pos="after_project_2"] #portfolio-nav ul li, .blog_next_prev_buttons[data-style="fullwidth_next_prev"] ul li', function () {
21654            $(this).addClass('mouse-leaving');
21655        });
21656
21657    }
21658
21659
21660    /**
21661     * Masonry portfolio initialization.
21662     *
21663     * @since 10.5
21664     */
21665    function masonryPortfolioInit() {
21666
21667        $portfolio_containers = [];
21668
21669        var portfolioElCount = 0;
21670
21671        $('.portfolio-items:not(.carousel)').each(function (i) {
21672
21673            $(this).attr('instance', i);
21674            $(this).parent().parent().find('div[class^=portfolio-filters]').attr('instance', i);
21675
21676            if (typeof SalientPortfolio !== 'undefined') {
21677                $portfolio_containers[portfolioElCount] = new SalientPortfolio($(this), fullWidthContentColumns, $fullscreenSelector, fullWidthSections);
21678                portfolioElCount++;
21679            } else {
21680                var $that = $(this);
21681                nectarScriptLoadedCallback('#salient-portfolio-js-js', 100, function () {
21682                    $portfolio_containers[portfolioElCount] = new SalientPortfolio($that, fullWidthContentColumns, $fullscreenSelector, fullWidthSections);
21683                    portfolioElCount++;
21684                });
21685            }
21686
21687        });
21688
21689    }
21690
21691
21692    /**
21693     * Perspective load in styling.
21694     *
21695     * @since 8.0
21696     */
21697    function updatePerspectiveOrigin() {
21698
21699        if (nectarDOMInfo.winW > 690) {
21700            $('.posts-container[data-load-animation="perspective"]').css('perspective-origin', '50% ' + (nectarDOMInfo.scrollTop + nectarDOMInfo.winH) + 'px');
21701        }
21702        requestAnimationFrame(updatePerspectiveOrigin);
21703
21704    }
21705
21706
21707    /**
21708     * Perspective load in styling.
21709     *
21710     * @since 8.0
21711     */
21712    function updatePerspectiveOriginInit() {
21713
21714        if ($('.posts-container[data-load-animation="perspective"]').length > 0) {
21715            requestAnimationFrame(updatePerspectiveOrigin);
21716        }
21717
21718    }
21719
21720
21721    /**
21722     * Blog load in animation.
21723     *
21724     * @since 3.0
21725     */
21726    function blogLoadIn(post_container) {
21727
21728        if (post_container.attr('data-load-animation') == 'none') {
21729
21730            post_container
21731                .find('.inner-wrap')
21732                .removeClass('animated');
21733
21734        } else {
21735
21736            post_container.find('article').each(function (i) {
21737
21738                // Loaded visible
21739                if ($(this).visible(true)) {
21740
21741                    $(this).delay(110 * i).queue(function (next) {
21742                        $(this).addClass("animated-in");
21743                        next();
21744                    });
21745
21746
21747                } else {
21748
21749                    // Not already visible
21750                    var $that = $(this);
21751                    var waypoint = new Waypoint({
21752
21753                        element: $that[0],
21754                        handler: function () {
21755
21756                            setTimeout(function () {
21757                                $that.addClass("animated-in");
21758                            }, 80 * $that.attr('data-delay-amount'));
21759
21760                            waypoint.destroy();
21761                        },
21762                        offset: '90%'
21763
21764                    });
21765                }
21766
21767            });
21768
21769        }
21770
21771    }
21772
21773
21774    /**
21775     * Masonry blog initialization.
21776     *
21777     * @since 10.5
21778     */
21779    function masonryBlogInit() {
21780
21781        $nectarMasonryBlogs = [];
21782
21783        $('.posts-container').each(function (i) {
21784
21785            if ($(this).parent().hasClass('masonry') && !$(this).parent().hasClass('auto_meta_overlaid_spaced')) {
21786
21787                if (typeof NectarMasonryBlog == 'undefined') {
21788
21789                    var $that = $(this);
21790                    nectarScriptLoadedCallback('#nectar-masonry-blog-js', 0, function () {
21791                        $nectarMasonryBlogs[i] = new NectarMasonryBlog($that, fullWidthSections, blogLoadIn);
21792                    });
21793
21794                    return;
21795                }
21796
21797                $nectarMasonryBlogs[i] = new NectarMasonryBlog($(this), fullWidthSections, blogLoadIn);
21798
21799            } else {
21800
21801                blogLoadIn($(this));
21802
21803            }
21804
21805        });
21806    }
21807
21808
21809    /**
21810     * Sticky element offset calc.
21811     *
21812     * @since 14.0
21813     */
21814    function stickyElPositionOffset() {
21815
21816        var $ssExtraTopSpace = 50;
21817
21818        if ($('#header-outer[data-remove-fixed="0"]').length > 0 &&
21819            $('#header-outer[data-format="left-header"]').length == 0) {
21820
21821            $ssExtraTopSpace += $headerOuterEl.outerHeight();
21822
21823            // Contained
21824            if ($('body[data-contained-header="true"]').length > 0) {
21825                $ssExtraTopSpace += parseInt($headerOuterEl.css('margin-top'));
21826            }
21827
21828            // Resize effect
21829            if ($('#header-outer[data-shrink-num][data-header-resize="1"]').length > 0) {
21830                var headerPadding2 = parseInt($headerOuterEl.attr('data-padding')) - parseInt($headerOuterEl.attr('data-padding')) / 1.8;
21831                $ssExtraTopSpace -= logoShrinkNum;
21832                $ssExtraTopSpace -= headerPadding2 * 2;
21833            }
21834
21835            // Condense
21836            if ($('body.mobile').length == 0 && $('#header-outer[data-condense="true"]').length > 0) {
21837
21838                var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9');
21839                $ssExtraTopSpace = 50;
21840                $ssExtraTopSpace += $headerOuterEl.height() - (parseInt($headerSpan9.position().top) - parseInt($('#header-outer #logo').css('margin-top'))) - parseInt(nectarDOMInfo.secondaryHeaderHeight);
21841            }
21842
21843        }
21844
21845        if ($wpAdminBar.length > 0) {
21846            $ssExtraTopSpace += $wpAdminBar.outerHeight();
21847        }
21848
21849        return $ssExtraTopSpace;
21850
21851    }
21852
21853    /**
21854     * Sticky Sidebar initialization.
21855     *
21856     * @since 10.5
21857     */
21858    function stickySidebarInit() {
21859
21860        // CSS powered.
21861        var stickyOffset = stickyElPositionOffset();
21862
21863        if (!(nectarDOMInfo.winW < 690 && nectarDOMInfo.usingMobileBrowser)) {
21864            const mainContent = document.querySelector('.container.main-content');
21865            if (mainContent) {
21866                mainContent.style.setProperty('--nectar-sticky-top-distance', stickyOffset + "px");
21867            }
21868
21869        }
21870
21871        $('.nectar-sticky-column-css').each(function () {
21872
21873            // Handle markup / vert center
21874            if (!$(this).hasClass('n-sticky-initialized')) {
21875
21876                // legacy users who have not updated salient core need this created by js.
21877                if ($(this).find('.n-sticky').length == 0) {
21878                    $(this).wrapInner('<div class="n-sticky" />');
21879                }
21880
21881                $(this).addClass('n-sticky-initialized');
21882
21883                if ($(this).hasClass('nectar-sticky-column-css--middle')) {
21884                    new NectarStickyEl($(this));
21885                }
21886
21887            }
21888
21889        });
21890
21891        // Javascript powered.
21892        if (!$().theiaStickySidebar || nectarDOMInfo.usingMobileBrowser && nectarDOMInfo.winW < 1000) {
21893            return;
21894        }
21895
21896        if ($nectarFullPage.$usingFullScreenRows != false && nectarDOMInfo.winW > 1000) {
21897            return;
21898        }
21899
21900        var stickySelectors = '#sidebar[data-nectar-ss="true"], #sidebar[data-nectar-ss="1"], .nectar-scrolling-tabs:not(.navigation_func_active_link_only) .scrolling-tab-nav, .nectar-sticky-column';
21901        if (window.nectarOptions && window.nectarOptions.woo_sticky_sidebar && window.nectarOptions.woo_sticky_sidebar === '1') {
21902            stickySelectors += ', .woocommerce.archive #sidebar';
21903        }
21904
21905        $(stickySelectors).each(function () {
21906
21907            if ($(this).parents('#slide-out-widget-area').length > 0) {
21908                return true;
21909            }
21910
21911            // Padding from top of screen
21912            var $ssExtraTopSpace = stickyOffset;
21913
21914            if ($(this).parents('.wpb_widgetised_column').length > 0) {
21915
21916                if ($('body.vc_editor').length > 0) {
21917                    // Skip processing.
21918                } else {
21919                    $(this).parents('.wpb_column').theiaStickySidebar({
21920                        additionalMarginTop: $ssExtraTopSpace,
21921                        updateSidebarHeight: false
21922                    });
21923                }
21924
21925            } else {
21926                $(this).theiaStickySidebar({
21927                    additionalMarginTop: $ssExtraTopSpace,
21928                    updateSidebarHeight: false
21929                });
21930            }
21931
21932        });
21933
21934
21935    }
21936
21937
21938    /**
21939     * Section down arrow animated link
21940     *
21941     * @since 10.5
21942     */
21943    function sectionDownArrowEvent() {
21944
21945        var headerPadding2 = headerPadding - headerPadding / 1.8;
21946
21947        $body.on('click', '.section-down-arrow, .scroll-down-wrap > .minimal-arrow', function () {
21948
21949            if ($(this).parents('.nectar-box-roll').length > 0) {
21950                return false;
21951            }
21952
21953            var $currentSection = $(this).parents('#page-header-bg'),
21954                $topDistance = $currentSection.height(),
21955                $offset = ($currentSection.parents('.first-section').length == 0 || $('body[data-transparent-header="false"]').length > 0) ? $currentSection.offset().top : 0,
21956                $bodyBorderSize = ($bodyBorderTop.length > 0 && $window.width() > 1000) ? $bodyBorderTop.height() : 0,
21957                $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0) ? 0 : $('#header-space').height(),
21958                $materialSecondary = 0;
21959
21960            if ($('body.material').length > 0 && $headerSecondaryEl.length > 0) {
21961                $materialSecondary = $headerSecondaryEl.height();
21962            }
21963
21964            if ($('body[data-permanent-transparent="1"]').length == 0) {
21965
21966                // Regular
21967                if (!$body.hasClass('mobile')) {
21968
21969                    if ($('body[data-hhun="1"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length == 0) {
21970
21971                        nectar_scrollToY(parseInt($topDistance) + $offset + 2 - $bodyBorderSize * 2, 700, 'easeInOutQuint');
21972
21973                    } else {
21974
21975                        var $resize = ($('#header-outer[data-header-resize="0"]').length > 0) ? 0 : parseInt(logoShrinkNum) + headerPadding2 * 2;
21976                        if ($('#header-outer[data-remove-fixed="1"]').length > 0) {
21977                            $headerNavSpace = 0;
21978                            $offset = 0;
21979                        }
21980
21981                        // Condense
21982                        if ($('body.mobile').length == 0 && $('#header-outer[data-condense="true"]').length > 0) {
21983                            var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9');
21984                            $headerNavSpace = $headerOuterEl.height() - (parseInt($headerSpan9.position().top) - parseInt($('#header-outer #logo').css('margin-top'))) - parseInt(nectarDOMInfo.secondaryHeaderHeight);
21985                        }
21986
21987                        nectar_scrollToY(parseInt($topDistance - $headerNavSpace) + $resize + 3 + $offset + $materialSecondary, 700, 'easeInOutQuint');
21988
21989                    }
21990
21991                } else {
21992
21993                    var $scrollPos;
21994
21995                    if ($('#header-outer[data-mobile-fixed="1"]').length > 0) {
21996                        $scrollPos = parseInt($topDistance) - $headerNavSpace + parseInt($currentSection.offset().top) + 2;
21997                    } else {
21998                        $scrollPos = parseInt($topDistance) + parseInt($currentSection.offset().top) + 2;
21999                    }
22000
22001                    nectar_scrollToY($scrollPos - $bodyBorderSize * 2, 700, 'easeInOutQuint');
22002
22003                }
22004
22005            } else {
22006                // Permanent transparent
22007                nectar_scrollToY(parseInt($topDistance) + parseInt($currentSection.offset().top) + 2 - $bodyBorderSize * 2, 700, 'easeInOutQuint');
22008
22009            }
22010            return false;
22011        });
22012
22013    }
22014
22015
22016    /**
22017     * Displace filter column/row BG effect - fullpage
22018     *
22019     * @since 10.5
22020     */
22021    function nectarLiquidBGFP() {
22022
22023        $('.nectar-liquid-bg').removeClass('animated-in');
22024
22025        for (var k = 0; k < $liquidBG_EL.length; k++) {
22026
22027            if ($liquidBG_EL[k].animationType == 'displace-filter-fade' && $($liquidBG_EL[k].canvasContainer).parents('.fp-section.active').length > 0) {
22028
22029                //add bg to container
22030                if ($($liquidBG_EL[k].canvasContainer).find('.image-added-to-stage').length == 0) {
22031                    $liquidBG_EL[k].imgContainer.addChild($liquidBG_EL[k].bg);
22032                }
22033
22034                $($liquidBG_EL[k].canvasContainer)
22035                    .find('.nectar-liquid-bg')
22036                    .addClass('image-added-to-stage');
22037
22038                $liquidBG_EL[k].animateProps($liquidBG_EL[k]);
22039
22040            }
22041        }
22042    }
22043
22044
22045    /**
22046     * Page Full Screen Rows
22047     *
22048     * @since 10.5
22049     */
22050    function nectarFullPageInit() {
22051
22052        if ($('#nectar_fullscreen_rows').length > 0 && $().fullpage) {
22053
22054            $fullscreenSelector = (window.vc_iframe) ? '.vc_element.vc_vc_row.active ' : '.wpb_row.active ';
22055
22056            var $disableFPonMobile = ($('#nectar_fullscreen_rows[data-mobile-disable]').length > 0) ? $('#nectar_fullscreen_rows').attr('data-mobile-disable') : 'off';
22057            if (!nectarDOMInfo.usingMobileBrowser) {
22058                $disableFPonMobile = 'off';
22059            }
22060            // Support for mobile animation theme option.
22061            if ($disableFPonMobile != 'on') {
22062                $fullscreenMarkupBool = true;
22063            } else {
22064                $fullscreenSelector = '';
22065            }
22066
22067            if (typeof NectarFullScreenRows !== 'undefined') {
22068                $nectarFullPage = new NectarFullScreenRows(waypoints, $mouseParallaxScenes, nectarLiquidBGFP, nectarDOMInfo, responsiveTooltips, $standAnimatedColTimeout, $svgIcons, animeAnimations);
22069            }
22070
22071        } else {
22072            nectarScriptLoadedCallback('#nectar-fullpage-js', 100, nectarFullPageInit);
22073        }
22074
22075    }
22076
22077
22078    /**
22079     * Cross browser adjustments.
22080     *
22081     * @since 1.0
22082     */
22083    function crossBrowserAdjust() {
22084
22085        // backdrop filter needs alternative flexbox arrangement to allow for animations to work
22086        $('.wpb_column').each(function () {
22087            if ($(this).hasClass('backdrop_filter_blur')) {
22088                var $parentRow = $(this).closest('.wpb_row');
22089                $parentRow.addClass('row-col-gap');
22090                var customColumnGap = ($(this).closest('.wpb_row[data-column-margin]').length > 0) ? $(this).closest('.wpb_row[data-column-margin]').attr('data-column-margin') : 'default';
22091                if (customColumnGap != 'default') {
22092                    $parentRow.find('.span_12').first().css({
22093                        'column-gap': customColumnGap
22094                    });
22095                }
22096            }
22097        });
22098
22099        // Add specific class if on device for better tablet tracking.
22100        if (nectarDOMInfo.usingMobileBrowser) {
22101            $body.addClass('using-mobile-browser');
22102        }
22103
22104        if (nectarDOMInfo.usingTouchDevice) {
22105            $body.addClass('using-touch-device');
22106        }
22107        // Add class for old IE.
22108        var ua = window.navigator.userAgent;
22109        var msie = ua.indexOf("Edge/");
22110        if (msie > 0) {
22111            $body.addClass('msie');
22112        }
22113
22114        // For users updating to 8 with a custom, old header template file
22115        if ($('html.js').length == 0) {
22116            $('html').removeClass('no-js').addClass('js');
22117        }
22118
22119        //remove br's from code tag
22120        $('code').find('br').remove();
22121
22122        // Contact form 7.
22123        $('.wpcf7-form p:has(input[type=submit])').css('padding-bottom', '0px');
22124
22125        $('.full-width-content .wpcf7-submit').on('click', function () {
22126            setTimeout(function () {
22127                fullWidthContentColumns();
22128            }, 1000);
22129            setTimeout(function () {
22130                fullWidthContentColumns();
22131            }, 2000);
22132        });
22133
22134        // Gravity form inside fw content row
22135        $('.gform_body').on('click', function () {
22136            setTimeout(function () {
22137                fullWidthContentColumns();
22138            }, 200);
22139        });
22140
22141        // Popup Maker.
22142        $('.pum.pum-theme-salient-page-builder-optimized button.pum-close').wrapInner('<span />');
22143        $(window).on('pumBeforeOpen', function () {
22144            window.dispatchEvent(new Event('resize'));
22145        });
22146
22147        // pum inside fspr
22148        if ($('#nectar_fullscreen_rows').length > 0 &&
22149            $('.pum-container .pum-content > .wpb_row .full-page-inner > .container > .span_12').length > 0) {
22150            $('.pum-container .pum-content > .wpb_row .full-page-inner > .container > .span_12').unwrap();
22151        }
22152
22153        // Blog bottom padding
22154        if ($('.single .blog_next_prev_buttons').length > 0) {
22155            $('.container-wrap').css('padding-bottom', 0);
22156        }
22157
22158        // Remove margin on last cols inside of full width sections
22159        $('.full-width-section').each(function () {
22160            $(this).find('> .span_12 > div.col_last').last().css('margin-bottom', '0');
22161        });
22162
22163        // Remove boxed style from full width content
22164        $('.full-width-content .col.boxed').removeClass('boxed');
22165
22166        // Neg marg z-index adjust
22167        $('.wpb_column.neg-marg').parents('.wpb_row:not(.inner_row):not(.zindex-set)').css('z-index', '110');
22168
22169        // Using full width section shortcode with WPBakery columns.
22170        $('.wpb_row.legacy').each(function () {
22171            if ($(this).find('.wpb_column').length > 0) {
22172                $(this).removeClass('legacy');
22173            }
22174        });
22175
22176    }
22177
22178
22179    //vc col mobile fixes
22180    function vcMobileColumns() {
22181
22182        $('.wpb_row').each(function () {
22183            if (typeof $(this).find('.span_12').offset() != 'undefined') {
22184
22185                $(this).find('[class*="vc_col-"]').each(function () {
22186
22187                    var $firstChildOffset = $(this).parents('.span_12').offset().left;
22188
22189                    $(this).removeClass('no-left-margin');
22190
22191                    if ($(this).offset().left < $firstChildOffset + 27) {
22192                        $(this).addClass('no-left-margin');
22193                    } else {
22194                        $(this).removeClass('no-left-margin');
22195                    }
22196                });
22197            }
22198        });
22199    }
22200
22201    function vcMobileColumnsInit() {
22202
22203        var $winDOMWidth = nectarDOMInfo.winW,
22204            $winDOMHeight = nectarDOMInfo.winH,
22205            $orientChangeTrack = 0;
22206
22207        // Only needed in legacy column setups.
22208        if ($body.is('[data-flex-cols="true"]')) {
22209            return;
22210        }
22211
22212        if ($('[class*="vc_col-xs-"], [class*="vc_col-md-"], [class*="vc_col-lg-"]').length > 0) {
22213
22214            // Trigger immediately.
22215            vcMobileColumns();
22216
22217            // Resize.
22218            if (!nectarDOMInfo.usingMobileBrowser) {
22219                // Bind normally for desktop.
22220                $window.on('resize', vcMobileColumns);
22221            } else {
22222
22223                // For mobile make sure the orientation has changed.
22224                window.addEventListener("orientationchange", function () {
22225                    $orientChangeTrack = 1;
22226                });
22227
22228                $window.on('resize', function () {
22229
22230                    if (($window.width() != $winDOMWidth && $window.height != $winDOMHeight) || $orientChangeTrack === 1) {
22231
22232                        vcMobileColumns();
22233
22234                        // Store the current window dimensions.
22235                        $winDOMWidth = nectarDOMInfo.winW;
22236                        $winDOMHeight = nectarDOMInfo.winH;
22237
22238                        // Reset orientation change tracker.
22239                        $orientChangeTrack = 0;
22240                    }
22241
22242                });
22243
22244
22245            } // end mobile only.
22246
22247        } // endif vc offset cols found.
22248
22249
22250    }
22251
22252
22253    /**
22254     * Select2 plugin initialization.
22255     *
22256     * @since 5.0
22257     */
22258    function select2Init() {
22259
22260        $('select:not(.state_select):not(.country_select):not(.comment-form-rating #rating):not(#tribe-bar-form select):not(.woocommerce-currency-switcher):not(.wc-blocks-components-select__container select):not(.nectar-custom-product-attr select):not(.flatpickr-calendar select)').each(function () {
22261
22262            // Prevent search from triggering on small devices.
22263            var $minimumToSearch = (nectarDOMInfo.winW > 690) ? 7 : 200;
22264
22265            // Skip search class
22266            if ($(this).hasClass('skip-select2-search') || $(this).parents('.skip-select2-search').length > 0) {
22267                $minimumToSearch = 1000;
22268            }
22269
22270            if ($(this).parents('#buddypress').length == 0) {
22271
22272                var woo_product_dropdown_style = (window.nectarOptions && window.nectarOptions.woo_product_variable_select) ? window.nectarOptions.woo_product_variable_select : 'default';
22273
22274                // Default.
22275                var select2OptionsObj = {
22276                    minimumResultsForSearch: $minimumToSearch,
22277                    width: '100%'
22278                };
22279
22280                // Inline scenario els
22281                if (woo_product_dropdown_style == 'underline' ||
22282                    $(this).parents('.woocommerce-ordering').length > 0) {
22283
22284                    select2OptionsObj = {
22285                        minimumResultsForSearch: $minimumToSearch,
22286                        dropdownParent: $(this).parent(),
22287                        dropdownAutoWidth: true
22288                    };
22289
22290                }
22291
22292                if (typeof $().select2 != 'undefined') {
22293                    $(this).select2(select2OptionsObj);
22294                }
22295
22296
22297            }
22298
22299        });
22300    }
22301
22302
22303    /**
22304     * Fancy select styling theme option.
22305     *
22306     * @since 10.5
22307     */
22308    function fancySelectStyling() {
22309
22310        if ($('body[data-fancy-form-rcs="1"]').length > 0 &&
22311            $('#wcfm-main-content').length == 0) {
22312
22313            $('select:not(.comment-form-rating #rating)').each(function () {
22314
22315                var $selector;
22316
22317                //cf7
22318                if ($(this).parents('.wpcf7-form-control-wrap').length > 0) {
22319
22320                    //select 2 already initialized
22321                    if ($(this).parents('.wpcf7-form-control-wrap').find('.select2-container').length > 0) {
22322                        $selector = $($(this).prev('.select2-container'));
22323                    } else {
22324                        $selector = $(this);
22325                    }
22326
22327                    //if label is found
22328                    if ($selector.parents('.wpcf7-form-control-wrap').parent().find('label').length == 1) {
22329                        $selector.parents('.wpcf7-form-control-wrap').parent().wrapInner('<div class="fancy-select-wrap" />');
22330                    } else {
22331                        //default wrap
22332                        $selector.wrap('<div class="fancy-select-wrap" />');
22333                    }
22334                }
22335                //default
22336                else {
22337
22338                    //select 2 already initialized
22339                    if ($(this).prev('.select2-container').length > 0) {
22340                        $selector = $(this).prev('.select2-container');
22341                    } else {
22342                        $selector = $(this);
22343                    }
22344
22345                    if ($(this).parents('#buddypress').length == 0 &&
22346                        $(this).parents('.widget_categories').length == 0 &&
22347                        $(this).parents('.wc-blocks-components-select__container').length == 0) {
22348                        //if label is found
22349
22350                        if ($selector.prev('label').length == 1) {
22351                            $selector.prev('label').addBack().wrapAll('<div class="fancy-select-wrap" />');
22352                        } else if ($selector.next('label').length == 1) {
22353                            $selector.next('label').addBack().wrapAll('<div class="fancy-select-wrap" />');
22354                        } else {
22355                            //default wrap
22356                            $selector.wrap('<div class="fancy-select-wrap" />');
22357                        }
22358                    }
22359
22360                }
22361            });
22362
22363            select2Init();
22364
22365        }
22366
22367    }
22368
22369
22370    /**
22371     * Back/Forward Safari cache assist.
22372     *
22373     * @since 10.5
22374     */
22375    function bfCacheAssist() {
22376
22377        //Back/forward cache OCM close
22378        if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1 ||
22379            navigator.userAgent.match(/(iPod|iPhone|iPad)/)) {
22380
22381            window.onpageshow = function (event) {
22382
22383                if (event.persisted) {
22384
22385                    // Play video BGs
22386                    $('.nectar-video-wrap, .nectar-slider-wrap .swiper-slide .video-wrap').each(function () {
22387
22388                        if ($(this).find('video').length > 0) {
22389                            $(this).find('video')[0].play();
22390                        }
22391
22392                    });
22393
22394
22395                    // Close mobile nav
22396
22397                    //// Material Skin.
22398                    if ($('body.material-ocm-open').length > 0) {
22399                        $('body > .slide_out_area_close__wrap .slide_out_area_close').addClass('non-human-allowed').trigger('click');
22400
22401                        setTimeout(function () {
22402                            $('body > .slide_out_area_close__wrap .slide_out_area_close').removeClass('non-human-allowed');
22403                        }, 100);
22404
22405                    } else if ($('#slide-out-widget-area.slide-out-from-right-hover.open').length > 0 && navigator.userAgent.match(/(iPod|iPhone|iPad)/)) {
22406                        OCM_mobileSlideOutRightHoverCloseCheck();
22407                    }
22408                    // Others
22409                    else if ($('#slide-out-widget-area.fullscreen.open').length > 0 ||
22410                        $('#slide-out-widget-area.fullscreen-alt.open').length > 0 ||
22411                        $('#slide-out-widget-area.slide-out-from-right.open').length > 0) {
22412
22413                        $('#slide-out-widget-area .slide_out_area_close').addClass('non-human-allowed');
22414                        $('.slide-out-widget-area-toggle:not(.std-menu) a.open')
22415                            .addClass('non-human-allowed')
22416                            .trigger('click');
22417
22418                        setTimeout(function () {
22419                            $('#slide-out-widget-area .slide_out_area_close').removeClass('non-human-allowed');
22420                        }, 100);
22421
22422                    }
22423
22424                }
22424 // Loaded from bf cache
22425
22426            }; // onpage show
22427
22428        }
22429
22430    }
22431
22432
22433    /*-------------------------------------------------------------------------*/
22434
22435    /*	WPBakery Frontend Editor
22436				/*-------------------------------------------------------------------------*/
22437
22438    /**
22439     * Control adjustments
22440     *
22441     * @since 10.0
22442     */
22443    function addRowCtrls() {
22444
22445        //remove padding for rows with only fullwidth ns
22446        $('.wpb_row').removeClass('only-ns');
22447
22448        $('.nectar-slider-wrap[data-full-width="true"], .page-submenu, .portfolio-items[data-col-num="elastic"]:not(.fullwidth-constrained), .blog-fullwidth-wrap')
22449            .parents('.wpb_row')
22450            .addClass('only-ns');
22451
22452        //padding when column contains item that could get lost under column controls
22453        $('body.vc_editor.compose-mode .wpb_row .vc_vc_column > .wpb_column > .vc_column-inner').each(function () {
22454
22455            if ($(this).find('> .vc_element-container > div').length > 0) {
22456
22457                var firstColumn = $(this).find('> .vc_element-container');
22458                var firstColumnElement = firstColumn.find('> div:first-child');
22459
22460                if (firstColumnElement.is('.vc_vc_row_inner')) {
22461                    firstColumnElement.addClass('first-inner-row-el');
22462                } else {
22463                    firstColumn.find('> div').removeClass('first-inner-row-el');
22464                }
22465
22466            }
22467
22468        });
22469
22470
22471        // Absolute positioning.
22472        $('body.vc_editor.compose-mode .vc_row.inner_row').each(function () {
22473            if ($(this).hasClass('row_position_absolute')) {
22474                $(this).parent().css({
22475                    'position': 'static',
22476                    'min-height': '0'
22477                });
22478            } else {
22479                $(this).parent().css({
22480                    'position': '',
22481                    'min-height': ''
22482                });
22483            }
22484
22485        });
22486
22487        $('.img-with-aniamtion-wrap, .nectar_icon_wrap, .nectar-lottie-wrap, .nectar-cta').each(function () {
22488            if ($(this).hasClass('position_desktop_absolute') ||
22489                $(this).hasClass('position_tablet_absolute') ||
22490                $(this).hasClass('position_phone_absolute')) {
22491                $(this).parent().addClass('absolute-parent');
22492            }
22493        });
22494
22495    } //addRowCtrl end
22496
22497
22498    /**
22499     * Convert front end padding
22500     *
22501     * Needed when the flexbox grid is not active due to
22502     * different markup in front end page builder view.
22503     *
22504     * @since 10.0
22505     */
22506    function convertFrontEndPadding() {
22507
22508        $('.vc_element > .wpb_column[class*="padding-"][class*="-percent"]').each(function () {
22509
22510            var $elPaddingPercent = 4;
22511
22512            var elclassName = this.className.match(/padding-\d+/);
22513            if (elclassName) {
22514                $elPaddingPercent = elclassName[0].match(/\d+/);
22515                if ($elPaddingPercent) {
22516                    $elPaddingPercent = $elPaddingPercent[0] / 100;
22517                } else {
22518                    $elPaddingPercent = 0;
22519                }
22520            }
22521
22522            if ($elPaddingPercent) {
22523                var $parentRowWidth = $(this).parents('.span_12').width();
22524
22525                if ($(this).is('[data-padding-pos="all"]')) {
22526                    $(this).css('padding', $parentRowWidth * $elPaddingPercent);
22527                } else if ($(this).is('[data-padding-pos="top"]')) {
22528                    $(this).css('padding-top', $parentRowWidth * $elPaddingPercent);
22529                } else if ($(this).is('[data-padding-pos="bottom"]')) {
22530                    $(this).css('padding-bottom', $parentRowWidth * $elPaddingPercent);
22531                } else if ($(this).is('[data-padding-pos="left"]')) {
22532                    $(this).css('padding-left', $parentRowWidth * $elPaddingPercent);
22533                } else if ($(this).is('[data-padding-pos="right"]')) {
22534                    $(this).css('padding-right', $parentRowWidth * $elPaddingPercent);
22535                } else if ($(this).is('[data-padding-pos="top-bottom"]')) {
22536                    $(this).css({
22537                        'padding-top': $parentRowWidth * $elPaddingPercent,
22538                        'padding-bottom': $parentRowWidth * $elPaddingPercent,
22539                    });
22540                } else if ($(this).is('[data-padding-pos="top-right"]')) {
22541                    $(this).css({
22542                        'padding-top': $parentRowWidth * $elPaddingPercent,
22543                        'padding-right': $parentRowWidth * $elPaddingPercent,
22544                    });
22545                } else if ($(this).is('[data-padding-pos="bottom-right"]')) {
22546                    $(this).css({
22547                        'padding-right': $parentRowWidth * $elPaddingPercent,
22548                        'padding-bottom': $parentRowWidth * $elPaddingPercent,
22549                    });
22550                } else if ($(this).is('[data-padding-pos="bottom-left"]')) {
22551                    $(this).css({
22552                        'padding-left': $parentRowWidth * $elPaddingPercent,
22553                        'padding-bottom': $parentRowWidth * $elPaddingPercent,
22554                    });
22555                } else if ($(this).is('[data-padding-pos="left-right"]')) {
22556                    $(this).css({
22557                        'padding-left': $parentRowWidth * $elPaddingPercent,
22558                        'padding-right': $parentRowWidth * $elPaddingPercent,
22559                    });
22560                }
22561            }
22562
22563        });
22564
22565
22566        $('.wpb_row[class*="vc_custom_"]').each(function () {
22567            $(this).parent().addClass('no-bottom-margin');
22568        });
22569
22570    }
22571
22572
22573    /**
22574     * WPBakery Front end editor integration
22575     *
22576     * @since 10.0
22577     */
22578    function wpBakeryFrontendInit() {
22579
22580        // Set up controls/column padding.
22581        setTimeout(function () {
22582
22583            if ($('body.compose-mode').length > 0) {
22584                $('.container-wrap').addClass('visible-editor-control
22584s');
22585            }
22586
22587            if (nectarDOMInfo.usingFrontEndEditor) {
22588
22589                addRowCtrls();
22590
22591                if (!$body.is('[data-flex-cols="true"]')) {
22592                    convertFrontEndPadding();
22593                    $window.on('smartresize', convertFrontEndPadding);
22594                }
22595
22596            }
22597
22598        }, 200);
22599
22600        // Bind reload event
22601        $window.on('vc_reload', function () {
22602
22603            addRowCtrls();
22604            columnBGColors();
22605            buttonInit();
22606            twentytwentyInit();
22607            parallaxRowsBGCals();
22608            flexsliderInit();
22609            accordionInit();
22610            ulCheckmarks();
22611            nectarFancyUlIcons();
22612            nectarFancyBoxHover();
22613            oneFourthClasses();
22614            carouselfGrabbingClass();
22615            nectarPostGridInit();
22616            splitLineHeadingInit();
22617            nectarVideoLightbox();
22618            nectarKeyframeAssist();
22619            nectarLazyImageLoading();
22620
22621            if ($('.carousel').length > 0) {
22622                standardCarouselInit();
22623                clientsCarouselInit();
22624                carouselHeightCalcs();
22625            }
22626
22627            if ($('.owl-carousel').length > 0) {
22628                $('.owl-carousel').each(function () {
22629                    $(this).trigger('destroy.owl.carousel').removeClass('owl-loaded');
22630                    $(this).find('.owl-stage-outer .owl-stage > *').unwrap();
22631                    $(this).find('.owl-stage-outer > *').unwrap();
22632                    $(this).find('.owl-item > *').unwrap();
22633                    $(this).find('.owl-dots').remove();
22634                    $(this).find('.owl-nav').remove();
22635                });
22636                owlCarouselInit();
22637            }
22638
22639            if ($('.nectar_cascading_images').length > 0) {
22640                imagesLoaded($('.nectar_cascading_images'), function () {
22641                    cascadingImageBGSizing();
22642                });
22643            }
22644
22645            fullWidthSections();
22646            fwsClasses();
22647            recentPostsInit();
22648
22649
22650            // reset split line heading timeline animations.
22651            if ($('.wpb_row.nectar-split-heading-merged').length > 0) {
22652                $('.wpb_row.nectar-split-heading-merged').removeClass('nectar-split-heading-merged');
22653            }
22654
22655            /*flickity carousels*/
22656            if ($flickitySliders.length > 0) {
22657                for (var i = 0; i < $flickitySliders.length; i++) {
22658
22659                    $flickitySliders[i].instance.reloadCells();
22660                    $flickitySliders[i].instance.off('scroll.flickity');
22661                    $flickitySliders[i].instance.off('dragStart.flickity');
22662                    $flickitySliders[i].instance.off('dragEnd.flickity');
22663
22664                }
22665            }
22666
22667            flickityLazyInit();
22668
22669            setTimeout(function () {
22670
22671                flickityInit();
22672                if ($flickitySliders.length > 0) {
22673                    for (var i = 0; i < $flickitySliders.length; i++) {
22674                        $flickitySliders[i].instance.reloadCells();
22675                        $flickitySliders[i].instance.resize();
22676                    }
22677                }
22678
22679            }, 100);
22680
22681            /*flickity product carousels*/
22682            if ($wooFlickityCarousels.length > 0) {
22683                for (var i = 0; i < $wooFlickityCarousels.length; i++) {
22684
22685                    $wooFlickityCarousels[i].instance.flickity('reloadCells');
22686                    $wooFlickityCarousels[i].instance.off('scroll.flickity');
22687                    $wooFlickityCarousels[i].instance.off('dragStart.flickity');
22688                    $wooFlickityCarousels[i].instance.off('dragEnd.flickity');
22689
22690                }
22691            }
22692
22693            setTimeout(function () {
22694
22695                if ($('.nectar-woo-flickity').length > 0) {
22696                    productCarouselInit();
22697                }
22698                if ($wooFlickityCarousels.length > 0) {
22699                    for (var i = 0; i < $wooFlickityCarousels.length; i++) {
22700                        $wooFlickityCarousels[i].instance.flickity('reloadCells');
22701                        $wooFlickityCarousels[i].instance.flickity('resize');
22702                    }
22703                }
22704
22705            }, 100);
22706
22707            nectarTestimonialSliders();
22708
22709            for (var i = 0; i < $testimonialSliders.length; i++) {
22710
22711                if ($testimonialSliders[i].type == 'multiple_visible' ||
22712                    $testimonialSliders[i].type == 'multiple_visible_minimal') {
22713
22714                    $testimonialSliders[i].flickityEl.flickity('reloadCells');
22715                    $testimonialSliders[i].flickityEl.off('select.flickity');
22716                    nectarTestimonialSliders();
22717                    $testimonialSliders[i].flickityEl.resize();
22718                }
22719
22720                $testimonialSliders[i].testimonialSliderHeight();
22721            }
22722            nectarTestimonialSlidersEvents();
22723
22724            pricingTableHeight();
22725            nectarIconMatchColoring();
22726            lightBoxInit();
22727            imageWithHotspotEvents();
22728            largeIconHover();
22729            midnightInit();
22730            responsiveVideoIframesInit();
22731            responsiveVideoIframes();
22732            fullWidthContentColumns();
22733            setTimeout(fullWidthContentColumns, 1000);
22734            videoBGInit();
22735            nectarFullHeightRowInit();
22736            $window.off('scroll.parallaxSections').off('resize.parallaxSections');
22737            parallaxScrollInit();
22738            nectarAnimateInit();
22739            masonryBlogInit();
22740            masonryPortfolioInit();
22741
22742            if ($portfolio_containers.length > 0) {
22743                for (var i = 0; i < $portfolio_containers.length; i++) {
22744                    $portfolio_containers[i].portfolioAccentColor();
22745                }
22746            }
22747
22748            parallaxItemHoverEffect();
22749            fsProjectSliderInit();
22750
22751            setTimeout(function () {
22752                if ($('.nectar_fullscreen_zoom_recent_projects').length > 0) {
22753
22754                    if ($fsProjectSliderArr.length > 0) {
22755                        for (var i = 0; i < $fsProjectSliderArr.length; i++) {
22756                            $fsProjectSliderArr[i].sliderCalcs();
22757                        }
22758                    }
22759
22760                }
22761            }, 300);
22762
22763            $window.unbind('.infscr');
22764            infiniteScrollInit();
22765            mouseParallaxInit();
22766
22767            //play video BGs
22768            $('.nectar-video-wrap').each(function () {
22769                if ($(this).find('video').length > 0) {
22770                    $(this).find('video').css('visibility', 'visible');
22771                }
22772            });
22773
22774            //tablet inherits small desktop
22775            $('.wpb_column[data-t-w-inherits]').each(function () {
22776                if ($(this).is('[data-t-w-inherits="small_desktop"]')) {
22777                    $(this).parent().addClass('inherits-s-desktop-col');
22778                } else {
22779                    $(this).parent().removeClass('inherits-s-desktop-col');
22780                }
22781            });
22782
22783            //full screen page rows
22784            if ($('#nectar_fullscreen_rows').length > 0) {
22785
22786                if ($('#nectar_fullscreen_rows > .vc_element').length == 0) {
22787                    $('#nectar_fullscreen_rows').prepend('<div class="vc_element empty_placeholder" />');
22788                }
22789
22790
22791                if ($('#nectar_fullscreen_rows > .vc_element:not(.empty_placeholder)').length > 0) {
22792                    $('#nectar_fullscreen_rows >.vc_element.empty_placeholder').remove();
22793                }
22794
22795
22796                var prevActiveIndex = $('#nectar_fullscreen_rows > div.vc_element.active').index();
22797
22798                $.fn.fullpage.destroy('all');
22799                nectarFullPageInit();
22800
22801                //keep tooltip active status
22802                var nectarFPOffsets = [{
22803                    el: '',
22804                    offset: 0
22805                }];
22806
22807
22808                ////create list of offsets
22809                $('#nectar_fullscreen_rows > div.vc_element').each(function (i) {
22810                    nectarFPOffsets[i] = {
22811                        el: $(this),
22812                        offset: $(this).offset().top
22813                    };
22814                });
22815
22816
22817                ////start active on that index
22818                if (prevActiveIndex > -1) {
22819                    $.fn.fullpage.silentMoveTo((prevActiveIndex + 1), 0);
22820                }
22821
22822
22823                //move back to first section when all have been deleted but one
22824                if ($('#nectar_fullscreen_rows > div.vc_element').length === 1) {
22825                    $('#nectar_fullscreen_rows').css({
22826                        'transform': 'translate3d(0,0,0)'
22827                    });
22828                }
22829
22830                $body.scrollTo(0, 0);
22831
22832
22833            } else {
22834
22835                //remove container wrap padding/margin when needded
22836                if ($('body .main-content > .row > .vc_element:first > .wpb_row[class*="full-width-"]').length > 0 ||
22837                    $('body .main-content > .row > .vc_element:first .nectar-slider-wrap[data-full-width="true"]').length > 0) {
22838
22839                    $('.container-wrap').css({
22840                        'padding-top': '0',
22841                        'margin-top': '0'
22842                    });
22843                } else {
22844                    $('.container-wrap').css({
22845                        'padding-top': '40px'
22846                    });
22847                }
22848
22849            }
22850
22851            //reset svg icon arr
22852            $svgIcons = [];
22853            $('.svg-icon-holder')
22854                .removeClass('animated-in')
22855                .removeClass('bound');
22856
22857
22858            //gmap
22859            if ($('.vc_nectar_gmap').length > 0) {
22860
22861                setTimeout(function () {
22862
22863                    if (typeof google === 'object' && typeof google.maps === 'object') {
22864                        window.mapAPI_Loaded();
22865                    } else {
22866
22867                        if (window.nectarLove.mapApiKey.length > 0) {
22868                            $.getScript('https://maps.google.com/maps/api/js?sensor=false&key=' + window.nectarLove.mapApiKey + '&callback=mapAPI_Loaded');
22869                        }
22870                    }
22871
22872                }, 100);
22873            }
22874
22875
22876            stickySidebarInit();
22877
22878
22879            if (typeof window.Waypoint != 'undefined') {
22880                Waypoint.destroyAll();
22881                waypoints();
22882            }
22883
22884        });
22885
22886    }
22887
22888
22889    /**
22890     * Page transitions and waypoint triggering
22891     *
22892     * @since 10.5
22893     */
22894    function pageTransitionInit() {
22895
22896        var mobileDisabledCondition = false;
22897
22898        if ($('body[data-ajax-transitions="true"]').length > 0 &&
22899            $('#ajax-loading-screen[data-disable-mobile="1"]').length > 0 &&
22900            nectarDOMInfo.winW < 1000) {
22901
22902            mobileDisabledCondition = true;
22903
22904        }
22905
22906        if ($('body[data-ajax-transitions="true"]').length > 0 &&
22907            $('#ajax-loading-screen[data-method="standard"]').length > 0 &&
22908            mobileDisabledCondition == false) {
22909
22910            $('html').addClass('page-trans-loaded');
22911
22912            // Fade loading animation
22913            if ($('#ajax-loading-screen[data-effect="standard"]').length > 0) {
22914
22915                if ($('.nectar-particles').length == 0) {
22916
22917                    $loadingScreenEl.transition({
22918                        'opacity': 0
22919                    }, 500, function () {
22920                        $(this).css({
22921                            'display': 'none'
22922                        });
22923                    });
22924                    $('#ajax-loading-screen .loading-icon').transition({
22925                        'opacity': 0
22926                    }, 500);
22927
22928                }
22929
22930                // Bind waypoints after loading screen has left
22931                if ($('.nectar-box-roll').length == 0) {
22932                    setTimeout(function () {
22933                        waypoints();
22934                    }, 550);
22935                }
22936
22937            }
22938
22939            // Swipe loading animation
22940            else {
22941
22942                if ($('#ajax-loading-screen[data-effect*="horizontal_swipe"]').length > 0) {
22943                    setTimeout(function () {
22944                        $loadingScreenEl.addClass('loaded');
22945                    }, 60);
22946                }
22947
22948                if ($('#page-header-wrap #page-header-bg[data-animate-in-effect="zoom-out"] .nectar-video-wrap').length == 0) {
22949                    setTimeout(function () {
22950                        $('#ajax-loading-screen:not(.loaded)').addClass('loaded');
22951                        setTimeout(function () {
22952                            $loadingScreenEl.addClass('hidden');
22953                        }, 1000);
22954                    }, 150);
22955                }
22956
22957
22958                // Bind waypoints after loading screen has left
22959                if ($('.nectar-box-roll').length == 0 && $('#ajax-loading-screen[data-effect*="horizontal_swipe"]').length > 0) {
22960                    setTimeout(function () {
22961                        waypoints();
22962                    }, 750);
22963                } else if ($('.nectar-box-roll').length == 0) setTimeout(function () {
22964                    waypoints();
22965                }, 350);
22966
22967            }
22968
22969
22970            // BF Cache assist
22971            window.onpageshow = function (event) {
22972
22973                if (event.persisted) {
22974
22975                    $('#ajax-loading-screen').stop().transition({
22976                        'opacity': 0
22977                    }, 200, function () {
22978                        $(this).css({
22979                            'display': 'none'
22980                        });
22981                    });
22982                    $('#ajax-loading-screen .loading-icon').transition({
22983                        'opacity': 0
22984                    }, 100);
22985
22986                }
22987
22988            };
22989
22990
22991            // Remove excess loading images if using page transitions.
22992            $('.portfolio-loading, .nectar-slider-loading .loading-icon').remove();
22993
22994            /* Intesys - Start 8 */
22995            /*
22996            if ($('#ajax-loading-screen[data-disable-fade-on-click="1"]').length == 0) {
22997
22998                if ($('body.using-mobile-browser #ajax-loading-screen[data-method="standard"][data-disable-mobile="1"]').length == 0) {
22999
23000                    var ignore_onbeforeunload = false;
23001                    $('a[href^="mailto"], a[href^="tel"], .woocommerce-order-downloads a[class*="downloads-file"], .wpdm-cta.download-l
23001ink a[data-downloadurl], .nectar-ignore-beforeunload a').on('click', function () {
23002                        ignore_onbeforeunload = true;
23003                    });
23004                    window.addEventListener('beforeunload', function () {
23005
23006                        if (!ignore_onbeforeunload) {
23007                            $loadingScreenEl.addClass('set-to-fade');
23008                            transitionPage();
23009                        }
23010                        ignore_onbeforeunload = false;
23011                    });
23012                }
23013
23014            }
23015            */
23016            /* Intesys - End 8 */
23017        }
23018
23019        // No page transitions
23020        else {
23021
23022            // Mobile disabled.
23023            if (mobileDisabledCondition == true) {
23024                $loadingScreenEl.css({
23025                    'opacity': '0',
23026                    'display': 'none'
23027                }).addClass('loaded').addClass('hidden');
23028            }
23029
23030            if ($('.nectar-box-roll').length == 0 && !nectarDOMInfo.usingFrontEndEditor) {
23031
23032                // Waypoints.
23033                waypoints();
23034
23035
23036            }
23037
23038        }
23039
23040
23041        function transitionPage() {
23042
23043            if ($('#ajax-loading-screen[data-effect*="horizontal_swipe"]').length > 0) {
23044                $loadingScreenEl.removeClass('loaded');
23045                $loadingScreenEl.addClass('in-from-right');
23046
23047                setTimeout(function () {
23048                    $loadingScreenEl.addClass('loaded');
23049                }, 30);
23050
23051            } else {
23052                if ($('#ajax-loading-screen[data-effect="center_mask_reveal"]').length > 0) {
23053                    $loadingScreenEl.css('opacity', '0').css('display', 'block').transition({
23054                        'opacity': '1'
23055                    }, 450);
23056                } else {
23057                    $loadingScreenEl.show().transition({
23058                        'opacity': '1'
23059                    }, 450);
23060                }
23061            }
23062
23063        }
23064
23065    }
23066
23067
23068    function salientNonCritical(e) {
23069
23070        // Track scroll position
23071        if (nectarDOMInfo.usingMobileBrowser) {
23072            nectarDOMInfo.scrollPosRAF();
23073        }
23074
23075        nectarLazyImageSizing();
23076
23077        // Header navigation.
23078        initSF();
23079        navigationSearchInit();
23080        headerNavScrollInit();
23081
23082        // Page builder elements.
23083        stickySidebarInit();
23084        nectarTestimonialSlidersEvents();
23085
23086        // Column related.
23087        columnBGColors();
23088
23089        // Off canvas menu
23090        mobileNavMegamenuCorrect();
23091        OCM_init();
23092        materialSkinOCM_Init();
23093        OCM_dropdownMarkup();
23094        clickToggleSubmenus();
23095
23096        // Row related.
23097        fwCarouselLinkFix();
23098        nectarAnimateInit();
23099
23100        // Media.
23101        lightBoxInit();
23102
23103
23104        // Scrolling
23105        infiniteScrollInit();
23106        scrollToTopInit();
23107        sectionDownArrowEvent();
23108        animatedAnchorLinks();
23109
23110    }
23111
23112
23113    // Called in the domready event.
23114    function nectarOnWindowLoad() {
23115
23116        // Set header space.
23117        if ($(window).scrollTop() == 0) {
23118            headerSpace();
23119        }
23120
23121        $('video').css('visibility', 'visible');
23122
23123        // Scroll to anchor
23124        pageLoadHashInit();
23125
23126        // Row/Column related.
23127        fullWidthContentColumns();
23128
23129        if (!nectarDOMInfo.usingMobileBrowser) {
23130            parallaxRowsBGCals();
23131        }
23132
23133    }
23134
23135    // Document ready event - starting everything up.
23136    jQuery(document).ready(function ($) {
23137
23138        nectarDOMInfo.usingFrontEndEditor = (typeof window.vc_iframe === 'undefined') ? false : true;
23139
23140        // Priority calls
23141        nectarBoxRollInit();
23142        nectarFullPageInit();
23143        nectarLazyImageLoading();
23144
23145        centeredNavBottomBarInit();
23146        centeredLogoHeaderInit();
23147        headerNavPreInit();
23148        headerNavOffsetInit();
23149
23150        // Page builder elements.
23151        salientPageBuilderElInit();
23152
23153        // Column related.
23154        vcMobileColumnsInit();
23155
23156        // Row related.
23157        fullWidthSections();
23158        fwsClasses();
23159        fullWidthSectionsPreInit();
23160        firstFWSection();
23161
23162        fullWidthContentColumns();
23163        oneFourthClasses();
23164        fixIeFlexbox();
23165        nectarFullHeightRowInit();
23166
23167        parallaxScrollInit();
23168        parallaxRowsBGCals();
23169
23170        // Media.
23171        audioVideoVis();
23172        responsiveVideoIframesInit();
23173        responsiveVideoIframes();
23174        videoBGInit();
23175        blogSingle();
23176
23177        // Page header
23178        pageHeaderInit();
23179
23180        // Footer.
23181        footerRevealInit();
23182
23183        // Third party.
23184        wooCommerceEvents();
23185        fancySelectStyling();
23186
23187        // Scrolling
23188        updatePerspectiveOriginInit();
23189
23190
23191        // Non critical
23192        salientNonCritical();
23193
23194
23195        // Cross browser assist.
23196        new NectarAccessibility();
23197        crossBrowserAdjust();
23198        bfCacheAssist();
23199
23200        // Front end editing.
23201        wpBakeryFrontendInit();
23202
23203        // Page transitions and waypoint activation.
23204        pageTransitionInit();
23205
23206        // Main Debounced Resize Event.
23207        $window.off('smartresize.srInit');
23208        $window.on('smartresize.srInit', smartResizeInit);
23209
23210        // Main Resize Event.
23211        $window.off('resize.srInit');
23212        $window.on('resize.srInit', resizeInit);
23213
23214        // Orientation change.
23215        window.addEventListener("orientationchange", orientationChangeInit);
23216
23217        // If window load has already triggered prior to the below bind.
23218        if (document.readyState === 'complete') {
23219            nectarOnWindowLoad();
23220        }
23221
23222        // Window Load Event.
23223        $window.on('load', nectarOnWindowLoad);
23224
23225
23226    });
23227
23228
23229}(window.jQuery, window, document));

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.