1/** 2 * Main Salient script file. 3 * 4 * @package Salient 5 * @author ThemeNectar 6 */ 7 /* global jQuery */ 8 /* global Waypoint */ 9 /* global imagesLoaded */ 10 /* global Flickity */ 11 12(function($, window, document) { 13 14 "use strict"; 15 16 // Theme vars. 17 var $window = $(window), 18 $body = $('body'), 19 $offCanvasEl = $('#slide-out-widget-area'), 20 $offCanvasBG = $('#slide-out-widget-area-bg'), 21 $headerOuterEl = $('#header-outer'), 22 $headerSecondaryEl = $('#header-secondary-outer'), 23 $searchButtonEl = $('#header-outer #search-btn a'), 24 $wpAdminBar = $('#wpadminbar'), 25 $loadingScreenEl = $('#ajax-loading-screen'), 26 $bodyBorderTop = $('.body-border-top'), 27 $pageHeaderBG = $('#page-header-bg'), 28 $footerOuterEl = $('#footer-outer'), 29 $bodyBorderWidth = ($('.body-border-right').length > 0) ? $('.body-border-right').width() : 0, 30 $logoHeight = ($headerOuterEl.is('[data-logo-height]')) ? parseInt($headerOuterEl.attr('data-logo-height')) : 30, 31 headerPadding = ($headerOuterEl.is('[data-padding]')) ? parseInt($headerOuterEl.attr('data-padding')) : 28, 32 logoShrinkNum = ($headerOuterEl.is('[data-shrink-num]')) ? $headerOuterEl.attr('data-shrink-num') : 6, 33 condenseHeaderLayout = ($headerOuterEl.is('[data-condense="true"]')) ? true : false, 34 usingLogoImage = ($headerOuterEl.is('[data-using-logo="1"]')) ? true : false, 35 headerResize = ($headerOuterEl.is('[data-header-resize="1"]')) ? true : false, 36 headerTransparent = ($headerOuterEl.is('[data-transparent-header="true"]')) ? true : false, 37 headerMobileFixed = ($headerOuterEl.is('[data-mobile-fixed="1"]')) ? true : false, 38 headerLayoutFormat = ($body.is('[data-header-format]')) ? $body.attr('data-header-format') : 'default', 39 headerHideUntilNeeded = ($body.is('[data-hhun]')) ? $body.attr('data-hhun') : '', 40 $animationEasing = ($body.is('[data-cae]') && $body.attr('data-cae') !== 'swing' ) ? $body.attr('data-cae') : 'easeOutCubic', 41 $animationDuration = ($body.is('[data-cad]')) ? $body.attr('data-cad') : '650', 42 bypassAnimations = (!$body.is('[data-m-animate="1"]') && navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) ) ? true : false, 43 $portfolio_containers = [], 44 $svgIcons = [], 45 $nectarCustomSliderRotate = [], 46 $flickitySliders = [], 47 flickityDragArr = [], 48 viewIndicatorArr = [], 49 iconMouseFollowArr = [], 50 postGridImgMouseFollowArr = [], 51 parallaxItemsArr = [], 52 $fsProjectSliderArr = [], 53 $wooFlickityCarousels = [], 54 $liquidBG_EL = [], 55 $testimonialSliders = [], 56 $mouseParallaxScenes = [], 57 $nectarMasonryBlogs = [], 58 $standAnimatedColTimeout = [], 59 $animatedSVGIconTimeout = [], 60 $projectCarouselSliderArr = [], 61 $nectarPostGridArr = [], 62 $verticalScrollingTabs = [], 63 $tabbedClickCount = 0, 64 $fullscreenSelector = '', 65 $fullscreenMarkupBool = false, 66 $bodyBorderHeaderColorMatch = false, 67 nectarBoxRoll = { 68 animating: 'false', 69 perspect: 'not-rolled' 70 }, 71 $nectarFullPage = { 72 $usingFullScreenRows: false 73 }, 74 $svgResizeTimeout, 75 $bodyBorderSizeToRemove; 76 77 if( $bodyBorderTop.length > 0 ) { 78 79 if ( $bodyBorderTop.css('background-color') == '#ffffff' && $body.attr('data-header-color') == 'light' || 80 $bodyBorderTop.css('background-color') == 'rgb(255, 255, 255)' && $body.attr('data-header-color') == 'light' || 81 $bodyBorderTop.css('background-color') == $headerOuterEl.attr('data-user-set-bg')) { 82 $bodyBorderHeaderColorMatch = true; 83 } 84 85 } 86 87 88 /** 89 * Nectar DOM info helper. 90 * 91 * @since 9.0 92 */ 93 var nectarDOMInfo = { 94 95 usingMobileBrowser: (navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) ? true : false, 96 usingFrontEndEditor: (typeof window.vc_iframe === 'undefined') ? false : true, 97 getWindowSize: function() { 98 nectarDOMInfo.winH = window.innerHeight; 99 nectarDOMInfo.winW = window.innerWidth; 100 nectarDOMInfo.adminBarHeight = ($wpAdminBar.length > 0) ? $wpAdminBar.height() : 0; 101 nectarDOMInfo.secondaryHeaderHeight = ($headerSecondaryEl.length > 0 && $headerSecondaryEl.css('display') != 'none') ? $headerSecondaryEl.outerHeight() : 0; 102 nectarDOMInfo.footerOuterHeight = ($footerOuterEl.length > 0) ? $footerOuterEl.outerHeight() : 0; 103 }, 104 scrollTop: 0, 105 clientX: 0, 106 clientY: 0, 107 scrollPosMouse: function() { 108 return window.scrollY || $window.scrollTop(); 109 }, 110 scrollPosRAF: function() { 111 112 nectarDOMInfo.scrollTop = window.scrollY || $window.scrollTop(); 113 requestAnimationFrame(nectarDOMInfo.scrollPosRAF); 114 }, 115 bindEvents: function() { 116 117 if (!nectarDOMInfo.usingMobileBrowser) { 118 119 $window.on('scroll', function() { 120 nectarDOMInfo.scrollTop = nectarDOMInfo.scrollPosMouse(); 121 });
122 document.addEventListener("mousemove", function(e) { 123 nectarDOMInfo.clientX = e.clientX; 124 nectarDOMInfo.clientY = e.clientY; 125 }); 126 127 } else { 128 requestAnimationFrame(nectarDOMInfo.scrollPosRAF); 129 } 130 131 $window.on('resize', nectarDOMInfo.getWindowSize); 132 133 }, 134 init: function() { 135 // Re-cache WP admin bar after DOM ready 136 $wpAdminBar = $('#wpadminbar'); 137 138 // Get values and bind events 139 this.getWindowSize(); 140 this.scrollTop = this.scrollPosMouse(); 141 this.bindEvents(); 142 143 this.usingFrontEndEditor = (typeof window.vc_iframe === 'undefined') ? false : true; 144 } 145 146 }; 147 window.nectarDOMInfo = nectarDOMInfo; 148 149 150 /** 151 * Nectar State. 152 * 153 * @since 13.0 154 */ 155 var nectarState = { 156 materialOffCanvasOpen: false, 157 materialSearchOpen: false, 158 permanentTransHeader: ( $headerOuterEl.is('[data-permanent-transparent="1"]') ) ? true : false, 159 animatedScrolling: false, 160 preventScroll: false, 161 mobileHeader: '' 162 } 163 164 165 /** 166 * Debounced resize event 167 * 168 * @since 2.0 169 */ 170 171 function smartResizeInit() { 172 fullWidthContentColumns(); 173 if (!nectarDOMInfo.usingMobileBrowser) { 174 parallaxRowsBGCals(); 175 } 176 headerSpace(); 177 OCM_overflowState(); 178 showOnLeftSubMenu(); 179 inlineMegaMenuPos(); 180 } 181 182 183 /** 184 * Orientation change event. 185 * 186 * @since 13.0 187 */ 188 function orientationChangeInit() { 189 parallaxRowsBGCals(); 190 } 191 192 193 194 /** 195 * Main resize event. 196 * 197 * @since 2.0 198 */ 199 function resizeInit() { 200 fullWidthSections(); 201 fullWidthContentColumns(); 202 addOrRemoveSF(); 203 responsiveVideoIframes(); 204 205 if (!nectarDOMInfo.usingMobileBrowser) { 206 parallaxRowsBGCals(); 207 } 208 209 } 210 211 212 213 /** 214 * Flexslider plugin initialization. 215 * 216 * @since 5.0 217 */ 218 function flexsliderInit() { 219 $('.flex-gallery').each(function () { 220 221 if (!$().flexslider) { 222 return; 223 } 224 225 var $that = $(this); 226 227 imagesLoaded($(this), function () { 228 229 var autorotate = ($that.find('ul').is('[data-d-autorotate="true"]')) ? false : true; 230 231 $that.flexslider({ 232 animation: 'fade', 233 smoothHeight: false, 234 animationSpeed: 500, 235 useCSS: false, 236 touch: true, 237 slideshow: autorotate, 238 }); 239 240 //gallery slider add arrows 241 $('.flex-gallery .flex-direction-nav li a.flex-next').html('<i class="fa fa-angle-right"></i>'); 242 $('.flex-gallery .flex-direction-nav li a.flex-prev').html('<i class="fa fa-angle-left"></i>'); 243 244 }); 245 246 }); 247 } 248 249 250 251 /** 252 * Icon follow. 253 * 254 * @since 11.0 255 */ 256 257 function NectarIconMouseFollow($el, iconType) { 258 259 this.lastX = nectarDOMInfo.clientX; 260 this.lastY = nectarDOMInfo.clientY; 261 this.$el = $el; 262 this.iconType = iconType; 263 this.timeout = false; 264 this.overEl = false; 265 this.initialCalc = false; 266 this.bgElSelector = ''; 267 this.$dragEl = ''; 268 this.$viewEl = ''; 269 this.$closeEl = ''; 270 this.lerpDamp = 0.18; 271 272 this.createMarkup(); 273 this.setup(); 274 this.mouseBind(); 275 276 } 277 278 NectarIconMouseFollow.prototype.setup = function() { 279 280 if( this.iconType === 'post-grid-images' ) { 281 this.viewportTracking(); 282 } 283 284 }; 285 286 NectarIconMouseFollow.prototype.viewportTracking = function() { 287 288 var that = this; 289 290 if( 'IntersectionObserver' in window ) { 291 292 var options = { 293 rootMargin: '0px', 294 threshold: 0 295 } 296 297 this.observer = new IntersectionObserver(function(entries) { 298 299 entries.forEach(function(entry) { 300 if ( entry.isIntersecting ) { 301 that.$el.addClass('active'); 302 that.$el.find( that.bgElSelector ).css('visibility','visible'); 303 that.activeViewRAF = true; 304 } else { 305 that.$el.find( that.bgElSelector ).css('visibility','hidden'); 306 that.activeViewRAF = false; 307 } 308 }); 309 310 }, options); 311 312 this.observer.observe(this.$el[0]); 313 314 315 } 316 317 }; 318 319 NectarIconMouseFollow.prototype.createMarkup = function() { 320 321 var that = this; 322 323 if( this.iconType === 'horizontal-movement' ) { 324 325 if( $('.nectar-drag-indicator').length == 0 ) { 326 var $usingBoxedClass = ($('body > #boxed').length > 0) ? ' in-boxed' : ''; 327 $('body').append('<div class="nectar-drag-indicator' + $usingBoxedClass + '"><span><i class="fa fa-angle-left"></i><i class="fa fa-angle-right"></i></span></div>'); 328 this.$dragEl = $('.nectar-drag-indicator'); 329 this.dragRAF(); 330 } else { 331 this.$dragEl = $('.nectar-drag-indicator'); 332 } 333 334 } 335 336 if( this.iconType === 'view-indicator' ) { 337 338 this.activeViewRAF = true; 339 340 if( $('.nectar-view-indicator').length == 0 ) { 341 342 var $usingBoxedClass = ($('body > #boxed').length > 0) ? ' in-boxed' : ''; 343 $('body').append('<div class="nectar-view-indicator' + $usingBoxedClass + '"><div class="color-circle"></div><span></span></div>'); 344 345 if( this.iconType !== 'gallery-zoom-indicator' ) { 346 $('.nectar-view-indicator span').text( $('.nectar-post-grid').attr('data-indicator-text') ); 347 } 348 this.$viewEl = $('.nectar-view-indicator'); 349 350 // initial calc. 351 setTimeout(function(){ 352 353 that.lastY = nectarDOMInfo.clientY; 354 that.lastX = nectarDOMInfo.clientX; 355 356 that.viewRAF(); 357 358 },100); 359 360 } else { 361 this.$viewEl = $('.nectar-view-indicator'); 362 } 363 364 } 365 366 if( this.iconType === 'close-indicator' ) { 367 if( $('.nectar-view-indicator').length == 0 ) { 368 var $usingBoxedClass = ($('body > #boxed').length > 0) ? ' in-boxed' : ''; 369 $('body').append('<div class="nectar-close-indicator' + $usingBoxedClass + '"><div class="inner"></div></div>'); 370 this.$closeEl = $('.nectar-close-indicator'); 371 this.closeRAF(); 372 } else { 373 this.$closeEl = $('.nectar-close-indicator'); 374 } 375 376 } 377 378 if( this.iconType === 'post-grid-images' ) { 379 380 this.activeViewRAF = true; 381 382 this.bgElSelector = (!this.$el.hasClass('nectar-category-grid')) ? '.nectar-post-grid-item-bg
382-wrap' : '.nectar-category-grid-item-bg'; 383 384 if( !this.$el.hasClass('mouse-move-bound') ) { 385 this.$viewEl = this.$el.find( this.bgElSelector ); 386 this.$el.addClass('mouse-move-bound'); 387 this.viewRAF(); 388 } else { 389 this.$viewEl = this.$el.find( this.bgElSelector ); 390 this.viewRAF(); 391 } 392 393 } 394 395 } 396 397 398 399 NectarIconMouseFollow.prototype.mouseBind = function() { 400 401 var that = this; 402 403 if( this.iconType === 'horizontal-movement' ) { 404 405 that.$el.find('.flickity-viewport').on('mouseenter', function() { 406 that.$dragEl.addClass('visible'); 407 408 var $iconColor = (that.$el.is('[data-touch-icon-color]')) ? 'color-' + that.$el.attr('data-touch-icon-color') : ''; 409 that.$dragEl.removeClass('color-dark').removeClass('color-light').removeClass('color-default'); 410 that.$dragEl.addClass($iconColor); 411 }); 412 413 that.$el.find('.flickity-viewport').on('mouseleave', function() { 414 that.$dragEl.removeClass('visible'); 415 }); 416 417 // Handle product links. 418 that.$el.find('.product-add-to-cart a').on('mouseenter', function() { 419 that.$dragEl.removeClass('visible'); 420 }); 421 that.$el.find('.product-add-to-cart a').on('mouseleave', function() { 422 that.$dragEl.addClass('visible'); 423 }); 424 425 } 426 else if( this.iconType === 'close-indicator' ) { 427 428 $('body').on('click','.team-member[data-style*="bio_fullscreen"]',function(){ 429 430 if ($('.nectar_team_member_overlay:not(.open)').length > 0) { 431 return; 432 } 433 434 that.$closeEl.addClass('visible'); 435 that.$closeEl.find('.inner').addClass('visible'); 436 }); 437 438 $('body').on('click','.nectar_team_member_overlay:not(.animating)',function(){ 439 that.$closeEl.removeClass('visible'); 440 that.$closeEl.find('.inner').removeClass('visible'); 441 }); 442 443 // Handle links. 444 $('body').on('mouseenter', '.nectar_team_member_overlay .bio-inner a', function() { 445 that.$closeEl.removeClass('visible'); 446 }); 447 $('body').on('mouseleave', '.nectar_team_member_overlay .bio-inner a', function() { 448 that.$closeEl.addClass('visible'); 449 }); 450 451 } 452 else if( this.iconType === 'view-indicator' ) { 453 454 var $color = that.$el.attr('data-indicator-color'); 455 var $style = that.$el.attr('data-indicator-style'); 456 457 // unbind first. 458 that.$el.find('.nectar-post-grid-item').off(); 459 460 that.$el.find('.nectar-post-grid-item').on('mouseenter', function() { 461 462 that.$viewEl.addClass('visible'); 463 464 // Handle style class. 465 that.$viewEl.attr('class', function(i, c){ 466 return c.replace(/(^|\s)style-\S+/g, ''); 467 }); 468 that.$viewEl.addClass('style-'+$style); 469 if( $style !== 'see-through' ) {
470 that.$viewEl.find('.color-circle').css('background-color', $color); 471 } 472 473 clearTimeout(that.timeout); 474 }); 475 476 that.$el.find('.nectar-post-grid-item').on('mouseleave', function() { 477 that.timeout = setTimeout(function(){ 478 that.$viewEl.removeClass('visible'); 479 },100); 480 481 }); 482 483 // Handle category links. 484 that.$el.find('.nectar-post-grid-item .meta-category a').on('mouseenter', function() { 485 that.$viewEl.removeClass('visible'); 486 }); 487 that.$el.find('.nectar-post-grid-item .meta-category a').on('mouseleave', function() { 488 that.$viewEl.addClass('visible'); 489 }); 490 491 } 492 493 494 else if( this.iconType === 'post-grid-images' ) { 495 that.$el.on('mouseenter', function() { 496 $(this).addClass('mouse-over'); 497 }); 498 that.$el.on('mouseleave', function() { 499 $(this).removeClass('mouse-over'); 500 }); 501 } 502 503 }; 504 505 NectarIconMouseFollow.prototype.dragRAF = function() { 506 507 this.lastY = linearInterpolate(this.lastY, nectarDOMInfo.clientY, this.lerpDamp); 508 this.lastX = linearInterpolate(this.lastX, nectarDOMInfo.clientX, this.lerpDamp); 509 510 this.$dragEl[0].style.transform = 'translateX(' + this.lastX + 'px) translateY(' + this.lastY + 'px)'; 511 512 requestAnimationFrame(this.dragRAF.bind(this)); 513 514 }; 515 516 NectarIconMouseFollow.prototype.viewRAF = function() { 517 518 this.lastY = linearInterpolate(this.lastY, nectarDOMInfo.clientY, this.lerpDamp); 519 this.lastX = linearInterpolate(this.lastX, nectarDOMInfo.clientX, this.lerpDamp); 520 521 if( this.activeViewRAF ) { 522 for(var i=0; i < this.$viewEl.length; i++) { 523 this.$viewEl[i].style.transform = 'translateX(' + this.lastX + 'px) translateY(' + this.lastY + 'px)'; 524 } 525 } 526 527 requestAnimationFrame(this.viewRAF.bind(this)); 528 529 }; 530 531 NectarIconMouseFollow.prototype.closeRAF = function() { 532 533 this.lastY = linearInterpolate(this.lastY, nectarDOMInfo.clientY, this.lerpDamp); 534 this.lastX = linearInterpolate(this.lastX, nectarDOMInfo.clientX, this.lerpDamp); 535 536 this.$closeEl.css({ 537 'transform': 'translateX(' + this.lastX + 'px) translateY(' + this.lastY + 'px)' 538 }); 539 540 requestAnimationFrame(this.closeRAF.bind(this)); 541 542 }; 543 544 545 546 /** 547 * Flickity lazy image helper 548 * 549 * Needed to calculate the space which 550 * lazy loaded images will eventually occupy. 551 * 552 * @since 11.0 553 */ 554 function flickityLazyCalcs() { 555 556 $('.wpb_gallery_slidesflickity_static_height_style .cell[data-lazy="true"]').each(function() { 557 558 $(this).css({ 559 'height': '', 560 'width' : '' 561 }); 562 563 var heightAttr = parseInt($(this).find('img').attr('height')); 564 var widthAttr = parseInt($(this).find('img').attr('width')); 565 566 var dimensions = calculateAspectRatio( widthAttr, heightAttr, 2000, parseInt($(this).find('img').height()) ); 567 var captionHeight = ( $(this).find('.item-meta').length > 0 ) ? $(this).find('.item-meta').outerHeight() : 0; 568 569 $(this).css({ 570 'height': (dimensions.height + captionHeight) + 'px', 571 'width' : dimensions.width + 'px' 572 }); 573 574 }); 575 576 } 577 578 579 /** 580 * Flickity lazy initialization. 581 * 582 * @since 11.0 583 */ 584 function flickityLazyInit() { 585 // Lazy assist. 586 if( $('.wpb_gallery_slidesflickity_static_height_style .cell[data-lazy="true"]').length > 0 ) { 587 flickityLazyCalcs(); 588 $window.on('smartresize',flickityLazyCalcs); 589 } 590 } 591 592 593 /** 594 * Flickity plugin initialization. 595 * 596 * @since 7.0 597 */ 598 function flickityInit() { 599 600 if ($('.nectar-flickity:not(.masonry)').length == 0) { 601 return false; 602 } 603 604 $flickitySliders = []; 605 flickityDragArr = []; 606 607 608 $('.nectar-flickity:not(.masonry)').each(function (i) { 609 610 $(this).removeClass(function (index, className) { 611 return (className.match(/(^|\s)instance-\S+/g) || []).join(' '); 612 }); 613 $(this).addClass('instance-' + i); 614 615 var $freeScrollBool = ($(this).is('[data-free-scroll]') && $(this).attr('data-free-scroll') == 'true') ? true : false, 616 $groupCellsBool = true, 617 $flickContainBool = true, 618 $flcikAttr = 0.025, 619 $paginationBool = false, 620 $nextPrevArrowBool = true, 621 $setGallerySizeBool = true, 622 $imagesLoaded = true, 623 $flickCellAlign = 'center'; 624 625 // Fixed Text Style. 626 if($(this).is('[data-format="fixed_text_content_fullwidth"]')) { 627 628 $flickCellAlign = 'left'; 629 $groupCellsBool = false; 630 $flickContainBool = false; 631 $flcikAttr = 0.02; 632 633 if( $(this).parent().is('[data-alignment="right"]') ) { 634 $flickCellAlign = 'right'; 635 } 636 637 } 638 639 if($freeScrollBool == true ) { 640 $groupCellsBool = false; 641 } 642 643 644 // Controls. 645 if ($(this).attr('data-controls').length > 0 && 646 $(this).attr('data-controls') == 'next_prev_arrows'|| 647 $(this).attr('data-controls').length > 0 && 648 $(this).attr('data-controls') == 'next_prev_arrows_overlaid') { 649 $paginationBool = false; 650 $nextPrevArrowBool = true; 651 } else { 652 $paginationBool = true; 653 $nextPrevArrowBool = false; 654 } 655 656 657 if ($(this).attr('data-controls').length > 0 && 658 $(this).attr('data-controls') == 'none') { 659 $paginationBool = false; 660 $nextPrevArrowBool = false; 661 } 662 663 var $flickity_autoplay = false; 664 var $flickity_stored_autoplay = false; 665 666 if ($(this).is('[data-autoplay]') && 667 $(this).attr('data-autoplay') == 'true') { 668 669 $flickity_autoplay = true; 670 $flickity_stored_autoplay = 5000; 671 672 if ($(this).is('[data-autoplay-dur]') && 673 $(this).attr('data-autoplay-dur').length > 0) { 674 675 if (parseInt($(this).attr('data-autoplay-dur')) > 100 && 676 parseInt($(this).attr('data-autoplay-dur')) < 30000) { 677 $flickity_autoplay = parseInt($(this).attr('data-autoplay-dur')); 678 $flickity_stored_autoplay = $flickity_autoplay; 679 } 680 681 } 682 683 } 684 685 var $that = $(this); 686 var $frontEndEditorDrag = ($('body.vc_editor').length > 0) ? false : true; 687 var $frontEndEditorPause = ($('body.vc_editor').length > 0) ? true : false; 688 var $arrowShape = ''; 689 var $wrapAround = ( $(this).is('[data-wrap]') && $(this).attr('data-wrap') == 'no-wrap' ) ? false : true; 690 691 // Centered cells. 692 if($(this).is('[data-centered-cells="true"]')) { 693 $groupCellsBool = 1; 694 } 695 696 // Adaptive height. 697 var $flickity_adaptive_height = false; 698 if( $(this).is('[data-adaptive-height="true"]') ) { 699 $flickity_adaptive_height = true; 700 } 701 702 // Lazy load. 703 var $lazyload = ($(this).find('img[data-flickity-lazyload]').length > 0) ? 1 : false; 704 if( $(this).find('img[data-flickity-lazyload]').length > 0 && $(this).is('[data-overflow="visible"]') && $(this).is('[data-wrap="no-wrap"]') ) { 705 $lazyload = 2; 706 } 707 708 // RTL. 709 var $flickity_rtl = ( $body.hasClass('rtl') ) ? true : false; 710 711 // Arrow shape. 712 if( $(this).attr('data-controls').length > 0 && $(this).attr('data-controls') == 'next_prev_arrows_overlaid' || 713 $(this).attr('data-controls').length > 0 && $(this).attr('data-controls') == 'touch_total' || 714 $(this).hasClass('nectar-simple-slider') ) { 715 $arrowShape = { 716 x0: 10, 717 x1: 60, y1: 50, 718 x2: 70, y2: 40, 719 x3: 30 720 } 721 } else { 722 $arrowShape = { 723 x0: 20, 724 x1: 70, 725 y1: 30, 726 x2: 70, 727 y2: 25, 728 x3: 70 729 } 730 } 731 732 if( $(this).is('[data-format="fixed_text_content_fullwidth"]') && 733 $(this).parents('.full-width-content.wpb_row').length > 0 ) { 734 $(this).parents('.full-width-content.wpb_row') 735 .removeClass('full-width-content') 736 .addClass('full-width-section'); 737 } 738 739 // Nectar Simple Slider 740 if( $(this).hasClass('nectar-simple-slider') ) { 741 $flickity_adaptive_height = false; 742 $paginationBool = false; 743 $nextPrevArrowBool = false; 744 $setGallerySizeBool = false; 745 $wrapAround = false; 746 $imagesLoaded = false; 747 $flcikAttr = 0.022; 748 749 if( $(this).attr('data-pagination') == 'true') { 750 $paginationBool = true; 751 } 752 753 if( $(this).attr('data-wrap') == 'true') { 754 $wrapAround = true; 755 } 756 757 } 758 759 $flickitySliders[i] = new Flickity('.nectar-flickity.instance-' + i, { 760 setGallerySize: $setGallerySizeBool, 761 contain: $flickContainBool, 762 draggable: $frontEndEditorDrag, 763 lazyLoad: $lazyload, 764 imagesLoaded: $imagesLoaded, 765 percentPosition: true, 766 adaptiveHeight: $flickity_adaptive_height, 767 cellAlign: $flickCellAlign, 768 groupCells: $groupCellsBool, 769 prevNextButtons: $nextPrevArrowBool, 770 freeScroll: $freeScrollBool, 771 pageDots: $paginationBool, 772 resize: true, 773 selectedAttraction: $flcikAttr, 774 autoPlay: $flickity_autoplay, 775 rightToLeft: $flickity_rtl, 776 pauseAutoPlayOnHover: $frontEndEditorPause, 777 wrapAround: $wrapAround, 778 accessibility: false, 779 arrowShape: $arrowShape 780 }); 781 782 783 // Simple Slider Arrows 784 if( $that.attr('data-arrows') == 'true' ) { 785 786 if( $that.find('.flickity-prev-next-button').length == 0 ) { 787 788 $that.append('<button class="flickity-button flickity-prev-next-button previous" aria-label="'+ nectar_front_i18n.previous +'" type="button">
788<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>'); 789 $that.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>'); 790 791 // Previous. 792 $that.find('.flickity-prev-next-button.previous').on( 'click', function() { 793 794 if( $wrapAround === false && 795 $flickitySliders[i].selectedIndex == 0 && 796 ( $flickitySliders[i].isAnimating == false || typeof $flickitySliders[i].isAnimating === 'undefined') ) { 797 798 // Nudge. 799 var currentX = $flickitySliders[i].x; 800 anime({ 801 targets: $flickitySliders[i], 802 x: currentX + 100, 803 duration: 350, 804 easing: 'easeOutCubic' 805 });
806 $flickitySliders[i].startAnimation(); 807 808 } 809 810 $flickitySliders[i].previous(); 811 }); 812 813 // Next. 814 $that.find('.flickity-prev-next-button.next').on( 'click', function() { 815 816 // Nudge. 817 if( $wrapAround === false && 818 $flickitySliders[i].selectedIndex == $flickitySliders[i].slides.length - 1 && 819 $flickitySliders[i].isAnimating == false) { 820 821 // Nudge. 822 var currentX = $flickitySliders[i].x; 823 anime({ 824 targets: $flickitySliders[i], 825 x: currentX - 100, 826 duration: 350, 827 easing: 'easeOutCubic' 828 }); 829 $flickitySliders[i].startAnimation(); 830 831 } 832 833 $flickitySliders[i].next(); 834 }); 835 836 } 837 838 } // End Simple Slider Arrows. 839 840 841 // Simple Slider Lazy Load. 842 if( $(this).hasClass('nectar-simple-slider') && $that.find('.bg-layer[data-nectar-img-src]').length > 0 ) { 843 844 var waypoint = new Waypoint({ 845 element: $that, 846 handler: function () { 847 848 $that.find('.bg-layer[data-nectar-img-src]').each(function() { 849 var entry = $(this)[0]; 850 var imgSrc = entry.getAttribute('data-nectar-img-src'); 851 entry.style.backgroundImage = "url('" + imgSrc + "')"; 852 entry.classList.add('loaded'); 853 }); 854 855 waypoint.destroy(); 856 }, 857 offset: '95%' 858 859 }); 860 861 } 862 863 // Simple Slider Parallax 864 if( $(this).hasClass('nectar-simple-slider') && $(this).is('[data-parallax="true"]') ) { 865 866 var slides = $(this).find('.cell'); 867 var j = i; 868 869 // limit time between slide changes when wrapping. 870 if( $wrapAround === true ) { 871 $that.find('.flickity-prev-next-button').on('click', function () { 872 $that.addClass('disabled-nav'); 873 setTimeout(function(){ 874 $that.removeClass('disabled-nav'); 875 },500); 876 }); 877 } 878 879 880 // parallax effect. 881 $flickitySliders[i].on('scroll', function () { 882 883 $.each( $flickitySliders[i].slides, function(i,slide) { 884 885 var imageBG = slides[i].querySelector('.bg-layer'); 886 var content = slides[i].querySelector('.inner'); 887 888 var flkty = $flickitySliders[j]; 889 var x = 0; 890 891 if( 0 === i ) { 892 x = Math.abs( flkty.x ) > flkty.slidesWidth ? ( flkty.slidesWidth + flkty.x + flkty.slides[flkty.slides.length - 1 ].outerWidth + slide.target ) : ( slide.target + flkty.x ); 893 } else if( i === flkty.slides.length - 1 ) { 894 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 ); 895 } else { 896 x = slide.target + flkty.x; 897 } 898 899 imageBG.style.transform = 'translate3d(' + x * ( -1 / 2 ) + 'px,0,0)'; 900 content.style.transform = 'translate3d(' + x * ( -1 / 4 ) + 'px,0,0)'; 901 902 }); 903 }); 904 } 905 906 // Simple Slider Pagination 907 if( $(this).hasClass('nectar-simple-slider') && true == $paginationBool ) { 908 909 $(this).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>'); 910 911 if( $flickity_stored_autoplay ) { 912 $(this).find('.flickity-page-dots li circle.time').css('transition', 'stroke-dashoffset '+ (parseInt($flickity_stored_autoplay) + 100) +'ms linear, stroke 0.2s ease'); 913 914 $(this).find('.flickity-page-dots li:first').addClass('no-trans'); 915 setTimeout(function() { 916 $that.find('.flickity-page-dots li:first').removeClass('no-trans'); 917 },60); 918 919 $flickitySliders[i].on('select', function (event) { 920 $flickitySliders[i].playPlayer(); 921 }); 922 923 $flickitySliders[i].on('dragEnd', function (event) { 924 $flickitySliders[i].playPlayer(); 925 $that.find('.flickity-page-dots .is-selected').removeClass('no-trans'); 926 }); 927 928 $flickitySliders[i].on('dragStart', function (event) { 929 $that.find('.flickity-page-dots .is-selected').addClass('no-trans'); 930 });
931 932 } 933 934 } 935 936 // Visualized total controls 937 if( $(this).is('[data-controls="touch_total"]') ) { 938 939 // Create markup. 940 if( $(this).find('.visualized-total').length == 0 ) { 941 if( $(this).parents('.full-width-content').length > 0 && $(this).parents('.vc_col-sm-12').length > 0 ) { 942 $(this).append('<div class="container normal-container"><div class="visualized-total"><span></span></div></div>'); 943 } else { 944 $(this).append('<div class="visualized-total"><span></span></div>'); 945 } 946 } 947 948 949 // Init drag indicator. 950 if( !nectarDOMInfo.usingMobileBrowser ) { 951 952 flickityDragArr[i] = new NectarIconMouseFollow($(this),'horizontal-movement'); 953 954 $flickitySliders[i].on('dragMove', function (event, pointer) { 955 nectarDOMInfo.clientY = pointer.clientY; 956 nectarDOMInfo.clientX = pointer.clientX; 957 }); 958 959 $flickitySliders[i].on('pointerDown', function (event, pointer) { 960 $('.nectar-drag-indicator').addClass('pointer-down'); 961 }); 962 $flickitySliders[i].on('pointerUp', function (event, pointer) { 963 $('.nectar-drag-indicator').removeClass('pointer-down'); 964 }); 965 966 } 967 968 var $totalImgs = $(this).find('.flickity-page-dots li').length; 969 var $totalIndicator = $(this).find('.visualized-total span'); 970 var $totalPosition = 1; 971 var $totalWidth = $(this).find('.visualized-total').width(); 972 973 $window.on('smartresize',function() { 974 975 setTimeout(function() { 976 977 $totalImgs = $that.find('.flickity-page-dots li').length; 978 $totalWidth = $that.find('.visualized-total').width(); 979 980 $totalPosition = ($totalWidth / $totalImgs) * $that.find('.flickity-page-dots .is-selected').index(); 981 982 // Update pos on interaction. 983 $totalIndicator.css('width', 100/$totalImgs + '%'); 984 $totalIndicator.css({ 985 'x' : $totalPosition + 'px' 986 }); 987 988 },200); 989 990 }); 991 992 // Set initial total tracker width. 993 setTimeout(function(){ 994 $totalImgs = $that.find('.flickity-page-dots li').length; 995 $totalWidth = $that.find('.visualized-total').width(); 996 997 $totalIndicator.css('width', 100/$totalImgs + '%'); 998 },200); 999 1000 $flickitySliders[i].on('change', function (event, progress) { 1001 1002 $totalPosition = ($totalWidth / $totalImgs) * $that.find('.flickity-page-dots .is-selected').index(); 1003 1004 // Update pos on interaction. 1005 $totalIndicator.css({ 1006 'x' : $totalPosition + 'px' 1007 }); 1008 1009 }); 1010 1011 } 1012 1013 1014 // Fixed text content style 1015 if ($(this).is('[data-format="fixed_text_content_fullwidth"]') && !nectarDOMInfo.usingFrontEndEditor) { 1016 1017 var $onMobileBrowser = nectarDOMInfo.usingMobileBrowser; 1018 1019 $flickitySliders[i].on('scroll', function () { 1020 1021 if ($onMobileBrowser) { 1022 return; 1023 } 1024 1025 var $flkSlideWidth = $that.find('.cell').outerWidth() + 25, 1026 $leftHeaderSize = ($('body[data-header-format="left-header"]').length > 0 && $window.width() > 1000) ? 275 : 0, 1027 $extraWindowSpace = (($window.width() + $leftHeaderSize) - $that.parents('.main-content').width()) / 2; 1028 1029 $extraWindowSpace += parseInt($that.css('margin-left')) + 2; 1030 1031 $flickitySliders[i].slides.forEach(function (slide, j) { 1032 1033 var $scaleAmt = 1, 1034 $translateXAmt = 0, 1035 $rotateAmt = 0, 1036 $slideZIndex = 10, 1037 $opacityAmt = 1, 1038 $slideOffset = $(slide.cells[0].element).offset().left, 1039 flkInstanceSlide = $('.nectar-flickity.instance-' + i + ' .cell:nth-child(' + (j + 1) + ')'); 1040 1041 if ($slideOffset - $extraWindowSpace < 0 && 1042 $slideOffset - $extraWindowSpace > $flkSlideWidth * -1) { 1043 1044 $scaleAmt = 1 + (($slideOffset - $extraWindowSpace) / 1500); 1045 $opacityAmt = 1 + (($slideOffset - $extraWindowSpace + 70) / 550); 1046 $translateXAmt = (($slideOffset - $extraWindowSpace)) * -1; 1047 $rotateAmt = (($slideOffset - $extraWindowSpace) / 25) * -1; 1048 1049 } else { 1050 $scaleAmt = 1; 1051 $opacityAmt = 1; 1052 $translateXAmt = 0; 1053 $rotateAmt = 0; 1054 } 1055 1056 if ($slideOffset + 5 - $extraWindowSpace < 0 && 1057 $slideOffset - $extraWindowSpace > $flkSlideWidth * -1) { 1058 1059 $slideZIndex = 5; 1060 } else { 1061 $slideZIndex = 10; 1062 } 1063 1064 flkInstanceSlide.css({ 1065 'z-index': $slideZIndex 1066 });
1067 1068 flkInstanceSlide.find('.inner-wrap-outer').css({ 1069 'transform': 'perspective(800px) translateX(' + $translateXAmt + 'px) rotateY(' + $rotateAmt + 'deg) translateZ(0)', 1070 'opacity': $opacityAmt 1071 }); 1072 1073 flkInstanceSlide.find('.inner-wrap').css({ 1074 'transform': 'scale(' + $scaleAmt + ') translateZ(0)' 1075 }); 1076 1077 }); 1078 1079 }); 1080 1081 } 1082 1083 var $removeHiddenTimeout; 1084 var $removeMovingTimeout; 1085 1086 $flickitySliders[i].on('dragStart', function () { 1087 1088 clearTimeout($removeHiddenTimeout); 1089 clearTimeout($removeMovingTimeout); 1090 $that.addClass('is-dragging'); 1091 $that.addClass('is-moving'); 1092 1093 $that.find('.flickity-prev-next-button').addClass('hidden'); 1094 }); 1095 1096 $flickitySliders[i].on('dragEnd', function () { 1097 1098 $that.removeClass('is-dragging'); 1099 1100 $removeHiddenTimeout = setTimeout(function () { 1101 1102 $that.removeClass('is-moving'); 1103 $that.find('.flickity-prev-next-button').removeClass('hidden'); 1104 1105 }, 600); 1106 1107 $removeMovingTimeout = setTimeout(function () { 1108 $that.removeClass('is-moving'); 1109 }, 300); 1110 1111 }); 1112 1113 $('.flickity-prev-next-button').on('click', function () { 1114 1115 clearTimeout($removeHiddenTimeout); 1116 1117 $(this).parents('.nectar-flickity') 1118 .find('.flickity-prev-next-button') 1119 .addClass('hidden'); 1120 1121 $removeHiddenTimeout = setTimeout(function () { 1122 $that 1123 .find('.flickity-prev-next-button') 1124 .removeClass('hidden'); 1125 }, 600); 1126 1127 }); 1128 1129 1130 // Images loaded. 1131 if ($that.hasClass('nectar-carousel')) { 1132 imagesLoaded($that, function () { 1133 nectarCarouselFlkEH($that); 1134 }); 1135 } 1136 1137 }); 1138 1139 1140 // Resize event. 1141 var $usingNectarCarouselFlk = ($('.nectar-carousel.nectar-flickity:not(.masonry)').length > 0) ? true : false; 1142 1143 if ($usingNectarCarouselFlk) { 1144 1145 if( !nectarDOMInfo.usingMobileBrowser ) { 1146 $window.on('resize',setNectarCarouselFlkEH); 1147 } else { 1148 window.addEventListener("orientationchange", setNectarCarouselFlkEH); 1149 } 1150 1151 } 1152 1153 var handleCaptions = ( $('.wpb_gallery_slidesflickity_static_height_style .item-meta').length > 0 ) ? true : false; 1154 1155 if( handleCaptions ) { 1156 $window.on('resize', setNectarFlickityCaptions); 1157 setNectarFlickityCaptions(); 1158 } 1159 1160 } 1161 1162 1163 1164 1165 1166 /** 1167 * Flickity equal height helper. 1168 * 1169 * @since 7.0 1170 */ 1171 function setNectarCarouselFlkEH() { 1172 $('.nectar-carousel.nectar-flickity:not(.masonry)').each(function () { 1173 nectarCarouselFlkEH($(this)); 1174 }); 1175 } 1176 1177 /** 1178 * Flickity captions calculcations 1179 * 1180 * @since 12.2 1181 */ 1182 function setNectarFlickityCaptions() { 1183 $('.wpb_gallery_slidesflickity_static_height_style .item-meta').each(function() { 1184 1185 $(this).css({ 1186 'width': $(this).parent().find('img').width() 1187 }); 1188 1189 1190 }); 1191 1192 } 1193 1194 /** 1195 * Flickity equal height calculations. 1196 * 1197 * @since 7.0 1198 */ 1199 function nectarCarouselFlkEH($slider_instance) { 1200 1201 var $tallestSlideCol = 0; 1202 1203 $slider_instance 1204 .find('.flickity-slider > .cell') 1205 .css('height', 'auto'); 1206 1207 $slider_instance.find('.flickity-slider > .cell').each(function () { 1208 1209 if( $(this).height() > $tallestSlideCol ) { 1210 $tallestSlideCol = $(this).height(); 1211 } 1212 1213 }); 1214 1215 if ($tallestSlideCol < 10) { 1216 $tallestSlideCol = 'auto'; 1217 } 1218 1219 //set even height 1220 $slider_instance 1221 .find('.flickity-slider > .cell') 1222 .css('height', $tallestSlideCol + 'px'); 1223 1224 } 1225 1226 1227 1228 /** 1229 * twentytwenty plugin initialization. 1230 * 1231 * @since 7.0 1232 */ 1233 function twentytwentyInit() { 1234 $('.twentytwenty-container').each(function () { 1235 var $that = $(this); 1236 1237 if ($that.find('.twentytwenty-handle').length == 0) { 1238 $(this).imagesLoaded(function () { 1239 $that.twentytwenty(); 1240 }); 1241 } 1242 1243 }); 1244 } 1245 1246 1247 1248 1249 1250 /** 1251 * Superfish initialization and submenu functionality. 1252 * 1253 * @since 2.0 1254 */ 1255 function initSF() { 1256 1257 addOrRemoveSF(); 1258 1259 if ($('body[data-header-format="left-header"]').length == 0) { 1260 1261 var $disableHI; 1262 1263 if (!($('#header-outer[data-megamenu-rt="1"]').length > 0 && 1264 $('#header-outer[data-transparent-header="true"]').length > 0)) { 1265 $disableHI = true; 1266 } else { 1267 $disableHI = false; 1268 } 1269 1270 $(".sf-menu:not(.buttons)").superfish({ 1271 delay: 500, 1272 speed: 'fast', 1273 disableHI: $disableHI, 1274 speedOut: 'fast', 1275 animation: { 1276 opacity: 'show' 1277 } 1278 }); 1279 1280 // Pull right/left menu 1281 $('#header-outer .sf-menu.buttons li.menu-item').on('mouseover',function(){ 1282 $(this).addClass('sfHover'); 1283 }); 1284 $('#header-outer .sf-menu.buttons li.menu-item').on('mouseleave',function(){ 1285 var $that = $(this); 1286 1287 if( $that.is('.menu-item-has-children') ) { 1288 setTimeout(function () { 1289 if( !$that.is(':hover') ) { 1290 $that.removeClass('sfHover'); 1291 } 1292 }, 200); 1293 } else { 1294 $that.removeClass('sfHover'); 1295 } 1296 }); 1297 1298 // Areas that do not use megamenu. 1299 $('#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') 1300 .removeClass('nectar-megamenu-menu-item') 1301 .removeClass('megamenu'); 1302 1303 // Centered menu bottom bar forced megamenu values. 1304 $('#header-outer[data-format="centered-menu-bottom-bar"] .right-side .sf-menu li.nectar-megamenu-menu-item') 1305 .removeClass('align-left') 1306 .removeClass('align-middle') 1307 .addClass('align-right'); 1308 1309 $('#header-outer[data-format="centered-menu-bottom-bar"] .left-side .sf-menu li.nectar-megamenu-menu-item') 1310 .removeClass('align-right') 1311 .removeClass('align-middle') 1312 .addClass('align-left'); 1313 1314 1315 $('#header-outer .sf-menu > li:not(.megamenu) > ul > li > ul').each(function () { 1316 1317 if ($(this).offset().left + $(this).outerWidth() > $window.width()) { 1318 $(this).addClass('on-left-side'); 1319 $(this).find('ul').addClass('on-left-side'); 1320 } 1321 1322 }); 1323
1324 // Megamenu multi section per column title support. 1325 $('body:not([data-header-format="left-header"]) header#top nav > ul > li.megamenu > ul > li > ul > li:has("> ul")').addClass('has-ul'); 1326 1327 // Full width megamenu. 1328 if ($('body[data-megamenu-width="full-width"]').length > 0 && $('ul.sub-menu').length > 0) { 1329 megamenuFullwidth(); 1330 $window.on('smartresize', megamenuFullwidth); 1331 $('header#top nav > ul > li.megamenu > .sub-menu').css('box-sizing', 'content-box'); 1332 } 1333 1334 // Extra hover class for megamenu check. 1335 $('header#top nav > ul.sf-menu > li.menu-item').on('mouseenter', function () { 1336 $(this).addClass('menu-item-over'); 1337 }); 1338 $('header#top nav > ul.sf-menu > li.menu-item').on('mouseleave', function () { 1339 $(this).removeClass('menu-item-over'); 1340 }); 1341 1342 // Remove arrows on mega menu item. 1343 $('#header-outer nav .megamenu .sub-menu a.sf-with-ul .sf-sub-indicator, #header-outer .megamenu .sub-menu a .sf-sub-indicator').remove(); 1344 1345 // Megamenu bg 1346 $('.sf-menu > .nectar-megamenu-menu-item > a .menu-title-text .megamenu-bg-lazy[data-bg-src]').each(function() { 1347 var parentLI = $(this).parents('.nectar-megamenu-menu-item'); 1348 var bgImgSrc = $(this).attr('data-bg-src'); 1349 var bgImgAlign = $(this).attr('data-align').replace( '_', ' '); 1350 1351 parentLI.find('> ul').css({ 1352 'background-position': bgImgAlign, 1353 'background-image': 'url("' + bgImgSrc + '")' 1354 }); 1355 1356 $(this).remove(); 1357 }); 1358 1359 $('.sf-menu > .nectar-megamenu-menu-item > ul > li > a .menu-title-text .megamenu-col-bg-lazy[data-bg-src]').each(function() { 1360 var parentLI = $(this).closest('.menu-item'); 1361 var bgImgSrc = $(this).attr('data-bg-src'); 1362 var bgImgAlign = $(this).attr('data-align').replace( '_', ' '); 1363 parentLI.css({ 1364 'background-position': bgImgAlign, 1365 'background-image': 'url("' + bgImgSrc + '")' 1366 }); 1367 $(this).remove(); 1368 }); 1369 1370 1371 // Blank title megamenu columns. 1372 $('#header-outer nav > ul > li.megamenu > ul.sub-menu > li > a').each(function () { 1373 if ($(this).text() == '-' || $(this).text() == '–' || $(this).parent().hasClass('hide-title')) { 1374 $(this).remove(); 1375 } 1376 }); 1377 1378 } 1379 1380 1381 // Lazy load nectar menu images. 1382 if( 'IntersectionObserver' in window ) { 1383 1384 var options = { 1385 rootMargin: '0px', 1386 threshold: 0 1387 } 1388 1389 var menuObserver = new IntersectionObserver(function(entries) { 1390 1391 entries.forEach(function(entry) { 1392 if ( entry.isIntersecting ) { 1393 var lazyItem = entry.target; 1394 lazyItem.classList.add('loaded'); 1395 1396 var lazySrc = lazyItem.getAttribute('data-menu-img-src'); 1397 if( lazySrc ) { 1398 lazyItem.setAttribute( 'src', lazySrc ); 1399 lazyItem.removeAttribute('data-menu-img-src'); 1400 } 1401 1402 menuObserver.unobserve(lazyItem); 1403 } 1404 }); 1405 1406 }, options); 1407 1408 var lazyMenuIcons = [].slice.call(document.querySelectorAll('.nectar-menu-icon-img[data-menu-img-src], #header-outer .nectar-ext-menu-item .image-layer')); 1409 lazyMenuIcons.forEach(function(lazyItem) { 1410 menuObserver.observe(lazyItem); 1411 }); 1412 1413 } else { 1414 // fallback. 1415 $('.sf-menu .nectar-menu-icon-img[data-menu-img-src]').each(function() { 1416 $(this).attr('src',$(this).attr('data-menu-img-src')); 1417 $(this).removeAttr('data-menu-img-src'); 1418 }); 1419 $('.nectar-ext-menu-item .image-layer').addClass('loaded'); 1420 1421 } 1422 1423 // Icon markup. 1424 $('.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() { 1425 1426 var $parent = $(this).parent(); 1427 var $icon = $(this).detach(); 1428 1429 if( $parent.parents('.nectar-ext-menu-item').length == 0 ) { 1430 $parent.wrapInner('<span class="nectar-menu-icon-text" />'); 1431 $parent.addClass('nectar-menu-item-with-icon'); 1432 } 1433 1434 $parent.prepend($icon); 1435 1436 }); 1437 1438 // Badge Labels. 1439 $('#slide-out-widget-area:not(.fullscreen) .nectar-menu-label').each(function(){ 1440 1441 if($(this).parents('.nectar-ext-menu-item').length == 0 ) { 1442 $(this).closest('a').addClass('nectar-menu-item-with-icon'); 1443 } 1444 1445 }); 1446 1447
1448 // OCM Remove Ext menu items option. 1449 if( window.nectarOptions && window.nectarOptions.ocm_remove_ext_menu_items && window.nectarOptions.ocm_remove_ext_menu_items == 'remove_images' ) { 1450 1451 $('.off-canvas-menu-container .title[class*="inherit-h"], #mobile-menu .title[class*="inherit-h"]').removeClass(function (index, className) { 1452 return (className.match(/(^|\s)inherit-h\S+/g) || []).join(' '); 1453 }); 1454 $('.off-canvas-menu-container .nectar-ext-menu-item .image-layer-outer, #mobile-menu .nectar-ext-menu-item .image-layer-outer').remove(); 1455 $('.off-canvas-menu-container .nectar-ext-menu-item .menu-item-desc').removeClass('menu-item-desc').addClass('item_desc'); 1456 $('.off-canvas-menu-container .nectar-ext-menu-item .inner-content > .title').each(function(){ 1457 if( $(this).find('.menu-title-text').length == 0 ) { 1458 $(this).removeClass('title').addClass('menu-title-text'); 1459 } 1460 }); 1461 1462 } 1463 1464 // Desc class for OCM for added submenu spacing 1465 $('.off-canvas-menu-container .item_desc').each(function() { 1466 var $parent = $(this).parents('.menu-item'); 1467 $parent.addClass('nectar-extra-menu-item-spacing'); 1468 }); 1469 1470 // Desc class for OCM for different flex alignment. 1471 $('.off-canvas-menu-container .nectar-menu-icon, .off-canvas-menu-container .nectar-menu-icon-img').each(function() { 1472 1473 var $parent = $(this).parent(); 1474 1475 if( $parent.find('.item_desc').length > 0 || $parent.find('.nav_desc').length > 0 ) { 1476 $parent.addClass('nectar-menu-item-with-desc'); 1477 } 1478 1479 }); 1480 1481 1482 // Deactivate hide header until needed effect on phone. 1483 if (nectarDOMInfo.usingMobileBrowser && $('#header-outer[data-remove-fixed="1"]').length == 0) { 1484 $body.attr('data-hhun', '0'); 1485 } 1486 1487 inlineMegaMenuPos(); 1488 1489 } 1490 1491 1492 1493 function inlineMegaMenuPos() { 1494 1495 // Left aligned items. 1496 $('nav:not(.left-side):not(.right-side) .sf-menu > .nectar-megamenu-menu-item.align-left:not(.width-100)').each(function() { 1497 var $parentEl = $(this); 1498 var $headerContainer = $('header#top > .container > .row'); 1499 var $submenu = $(this).find('> ul.sub-menu'); 1500 1501 if( $parentEl ) { 1502 1503 // Change into center positioning. 1504 if( $submenu.width() + $parentEl.offset().left > nectarDOMInfo.winW ) { 1505 $(this).addClass('align-middle'); 1506 return true; 1507 } 1508 1509 // Set left positioning. 1510 $(this).find('> ul.sub-menu').css({ 1511 'right': $headerContainer.width() - ( ($parentEl.offset().left + $parentEl.width()) - $headerContainer.offset().left ) - $(this).find('> ul.sub-menu').width() + $parentEl.width(), 1512 'left': 'auto' 1513 }); 1514 $(this).removeClass('align-middle'); 1515 } 1516 1517 }); 1518 1519 1520 // Right aligned items. 1521 $('nav:not(.left-side):not(.right-side) .sf-menu > .nectar-megamenu-menu-item.align-right:not(.width-100)').each(function() { 1522 var $parentEl = $(this); 1523 var $headerContainer = $('header#top > .container > .row'); 1524 var $submenu = $(this).find('> ul.sub-menu'); 1525 1526 if( $parentEl ) { 1527 1528 // Change into center positioning. 1529 if( ($parentEl.offset().left + $parentEl.width() - $submenu.width()) < 0 ) { 1530 $(this).addClass('align-middle'); 1531 return true; 1532 } 1533 1534 $(this).find('> ul.sub-menu').css({ 1535 'right': $headerContainer.width() - ( ($parentEl.offset().left + $parentEl.width()) - $headerContainer.offset().left ), 1536 'left': 'auto' 1537 }); 1538 $(this).removeClass('align-middle'); 1539 } 1540 1541 }); 1542 1543 // Center aligned items. 1544 $('nav:not(.left-side):not(.right-side) .sf-menu > .nectar-megamenu-menu-item.align-middle:not(.width-100)').each(function() { 1545 var $parentEl = $(this); 1546 var $headerContainer = $('header#top > .container > .row'); 1547 var $submenu = $(this).find('> ul.sub-menu'); 1548 1549 if( $parentEl ) { 1550 1551 var headerContainerW = $headerContainer.width(), 1552 headerContainerOffsetL = $headerContainer.offset().left, 1553 menuItemOffsetL = $parentEl.offset().left, 1554 menuItemW = $parentEl.width(), 1555 megaMenuW = $submenu.width(); 1556 1557 // Default center align. 1558 $submenu.css({ 1559 'right': headerContainerW - ( (menuItemOffsetL + menuItemW) - headerContainerOffsetL ) - megaMenuW/2 + menuItemW/2, 1560 'left': 'auto' 1561 });
1562 1563 var megaMenuOffset = $submenu.offset(); 1564 1565 // Overflowing left. 1566 if(megaMenuOffset.left < 0) { 1567 $submenu.css({ 1568 'right': 'auto', 1569 'left': '0px' 1570 }); 1571 } 1572 // Overflowing right. 1573 else if( megaMenuOffset.left + megaMenuW > nectarDOMInfo.winW ) { 1574 $submenu.css({ 1575 'right': '0px', 1576 'left': 'auto' 1577 }); 1578 } 1579 1580 } 1581 1582 }); 1583 1584 1585 } 1586 1587 /** 1588 * Calculates the "Header Mega Menu Width - Full screen width" theme option. 1589 * 1590 * @since 6.0 1591 */ 1592 function megamenuFullwidth() { 1593 1594 var $windowWidth = $window.width(); 1595 var $headerContainerWidth = $('header#top > .container').width(); 1596 $('header#top nav:not(.left-side):not(.right-side) > ul > li.megamenu:not(.width-50):not(.width-75) > .sub-menu').css({ 1597 'padding-left': ($windowWidth - $headerContainerWidth) / 2 + 'px', 1598 'padding-right': ($windowWidth + 2 - $headerContainerWidth) / 2 + 'px', 1599 'width': $headerContainerWidth, 1600 'left': '-' + ($windowWidth - $headerContainerWidth) / 2 + 'px' 1601 }); 1602 } 1603 1604 1605 /** 1606 * Hide main navigation on mobile. 1607 * 1608 * @since 2.0 1609 */ 1610 function addOrRemoveSF() { 1611 1612 if (nectarDOMInfo.winW < 1000 && $body.attr('data-responsive') == '1') { 1613 $body.addClass('mobile'); 1614 $('header#top nav').css('display', 'none'); 1615 } else { 1616 $body.removeClass('mobile'); 1617 $('header#top nav').css('display', ''); 1618 $('.slide-out-widget-area-toggle #toggle-nav .lines-button').removeClass('close'); 1619 } 1620 1621 1622 } 1623 1624 1625 /** 1626 * Calculates whether submenu needs to display aligned opposite (from lack of space). 1627 * 1628 * @since 2.0 1629 */ 1630 function showOnLeftSubMenu() { 1631 1632 // Show on left class for minimal styling. 1633 $('#header-outer .sf-menu > li:not(.megamenu) > ul > li > ul').each(function () { 1634 1635 $(this).removeClass('on-left-side'); 1636 1637 if ($(this).offset().left + $(this).outerWidth() > $window.width()) { 1638 $(this).addClass('on-left-side'); 1639 $(this).find('ul').addClass('on-left-side'); 1640 } else { 1641 $(this).removeClass('on-left-side'); 1642 $(this).find('ul').removeClass('on-left-side'); 1643 } 1644 1645 }); 1646 } 1647 1648 1649 1650 1651 /** 1652 * Caroufredsel plugin initialization. 1653 * 1654 * @since 2.0 1655 */ 1656 function standardCarouselInit() { 1657 1658 if ($('.carousel').length == 0) { 1659 return; 1660 } 1661 1662 if (typeof SalientRecentProjectsCarousel !== 'undefined') { 1663 $('ul.carousel.portfolio-items').each(function (i) { 1664 $projectCarouselSliderArr[i] = new SalientRecentProjectsCarousel($(this)); 1665 }); 1666 } 1667 1668 $('ul.carousel:not(".clients"):not(.portfolio-items)').each(function () { 1669 1670 var $that = $(this), 1671 maxCols = ($(this).parents('.carousel-wrap').attr('data-full-width') == 'true') ? 'auto' : 3, 1672 scrollNum = ($(this).parents('.carousel-wrap').attr('data-full-width') == 'true') ? 'auto' : '', 1673 colWidth = ($(this).parents('.carousel-wrap').attr('data-full-width') == 'true') ? 500 : 453, 1674 $autoplayBool = ($(this).attr('data-autorotate') == 'true') ? true : false, 1675 $themeSkin = true, 1676 $themeSkin2 = true; 1677 1678 var scrollSpeed, easing; 1679 1680 if ($('body.ascend').length > 0 && $(this).parents('.carousel-wrap').attr('data-full-width') != 'true' || 1681 $('body.material').length > 0 && $(this).parents('.carousel-wrap').attr('data-full-width') != 'true') { 1682 1683 if ($(this).find('li').length % 3 === 0) { 1684 $themeSkin = true; 1685 $themeSkin2 = true; 1686 } else { 1687 $themeSkin = false; 1688 $themeSkin2 = true; 1689 } 1690 1691 } else { 1692 $themeSkin = true; 1693 $themeSkin2 = true; 1694 } 1695 1696 scrollSpeed = (parseInt($(this).attr('data-scroll-speed'))) ? parseInt($(this).attr('data-scroll-speed')) : 700; 1697 easing = ($(this).is('[data-easing]')) ? $(this).attr('data-easing') : 'linear'; 1698 1699 var $element = $that; 1700 if ($that.find('img').length == 0) { 1701 $element = $body; 1702 } 1703 1704 imagesLoaded($element, function () { 1705 1706 $that.carouFredSel({ 1707 circular: $themeSkin, 1708 infinite: $themeSkin2, 1709 height: 'auto', 1710 responsive: true, 1711 items: { 1712 width: colWidth, 1713 visible: { 1714 min: 1, 1715 max: maxCols 1716 } 1717 }, 1718 swipe: { 1719 onTouch: true, 1720 onMouse: true, 1721 options: { 1722 excludedElements: "button, input, select, textarea, .noSwipe", 1723 tap: function (event, target) { 1724 if ($(target).attr('href') && 1725 !$(target).is('[target="_blank"]') && 1726 !$(target).is('[rel^="prettyPhoto"]') && 1727 !$(target).is('.magnific-popup') && 1728 !$(target).is('.magnific')) { 1729 window.open($(target).attr('href'), '_self'); 1730 } 1731 } 1732 }, 1733 onBefore: function () { 1734 // Hover effect. 1735 $that.find('.work-item').trigger('mouseleave'); 1736 $that.find('.work-item .work-info a').trigger('mouseup'); 1737 } 1738 }, 1739 scroll: { 1740 items: scrollNum, 1741 easing: easing, 1742 duration: scrollSpeed, 1743 onBefore: function () { 1744 1745 if ($('body.ascend').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true' || 1746 $('body.material').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true') { 1747 1748 $that.parents('.carousel-wrap') 1749 .find('.item-count .total') 1750 .html(Math.ceil($that.find('> li').length / $that.triggerHandler("currentVisible").length)); 1751 1752 } 1753 }, 1754 onAfter: function () { 1755 if ($('body.ascend').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true' || 1756 $('body.material').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true') { 1757 1758 $that.parents('.carousel-wrap') 1759 .find('.item-count .current') 1760 .html($that.triggerHandler('currentPage') + 1); 1761 1762 $that.parents('.carousel-wrap') 1763 .find('.item-count .total') 1764 .html(Math.ceil($that.find('> li').length / $that.triggerHandler("currentVisible").length)); 1765 1766 } 1767 } 1768 1769 }, 1770 prev: { 1771 button: function () { 1772 return $that.parents('.carousel-wrap').find('.carousel-prev'); 1773 } 1774 }, 1775 next: { 1776 button: function () { 1777 return $that.parents('.carousel-wrap').find('.carousel-next'); 1778 } 1779 }, 1780 auto: { 1781 play: $autoplayBool 1782 } 1783 }, { 1784 transition: true 1785 }).animate({ 1786 'opacity': 1 1787 }, 1300); 1788 1789 $that 1790 .parents('.carousel-wrap') 1791 .wrap('<div class="carousel-outer">'); 1792 1793 if ($that.parents('.carousel-wrap').attr('data-full-width') == 'true') { 1794 $that 1795 .parents('.carousel-outer') 1796 .css('overflow', 'visible'); 1797 } 1798 1799 // Add count for non full width ascend skin. 1800 if ($('body.ascend').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true' || 1801 $('body.material').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true') { 1802 $('<div class="item-count"><span class="current">1</span>/<span class="total">
1802' + ($that.find('> li').length / $that.triggerHandler("currentVisible").length) + '</span></div>').insertAfter($that.parents('.carousel-wrap').find('.carousel-prev')); 1803 } 1804 1805 $that.addClass('finished-loading'); 1806 1807 carouselHeightCalcs(); 1808 1809 }); 1810 1811 }); 1812 1813 // Resize 1814 $window.off('smartresize.carouselHeightCalcs'); 1815 $window.on('smartresize.carouselHeightCalcs', carouselHeightCalcs); 1816 1817 } 1818 1819 1820 1821 1822 1823 /** 1824 * Full width carousel link event. 1825 * 1826 * @since 4.0 1827 */ 1828 function fwCarouselLinkFix() { 1829 1830 var $mousePosStart = 0, 1831 $mousePosEnd = 0, 1832 fwCarouselLinkSelector = '.carousel-wrap .portfolio-items .col .work-info a, .woocommerce .products-carousel ul.products li.product a'; 1833 1834 $(fwCarouselLinkSelector).on('mousedown', function (e) { 1835 $mousePosStart = e.clientX; 1836 }); 1837 1838 $(fwCarouselLinkSelector).on('mouseup', function (e) { 1839 $mousePosEnd = e.clientX; 1840 }); 1841 1842 $(fwCarouselLinkSelector).on('click', function () { 1843 if (Math.abs($mousePosStart - $mousePosEnd) > 10) { 1844 return false; 1845 } 1846 }); 1847 1848 } 1849 1850 1851 1852 1853 /** 1854 * Owl carousel plugin initialization. 1855 * 1856 * @since 6.0 1857 */ 1858 function owlCarouselInit() { 1859 1860 if ( $('.owl-carousel[data-desktop-cols]').length === 0 ) { 1861 return; 1862 } 1863 1864 $('.owl-carousel[data-desktop-cols]').each(function () { 1865 1866 $(this).addClass('owl-theme'); 1867 1868 var $that = $(this), 1869 $autoRotateBool = $that.attr('data-autorotate'), 1870 $autoRotateSpeed = $that.attr('data-autorotation-speed'), 1871 $owlLoopBool = ($that.is('[data-loop="true"]')) ? true : false, 1872 $owlRTL = ( $body.hasClass('rtl') ) ? true : false; 1873 1874 $(this).owlCarousel({ 1875 responsive: { 1876 0: { 1877 items: $(this).attr('data-mobile-cols') 1878 }, 1879 690: { 1880 items: $(this).attr('data-tablet-cols') 1881 }, 1882 1000: { 1883 items: $(this).attr('data-desktop-small-cols') 1884 }, 1885 1300: { 1886 items: $(this).attr('data-desktop-cols') 1887 } 1888 }, 1889 autoplay: $autoRotateBool, 1890 autoplayTimeout: $autoRotateSpeed, 1891 loop: $owlLoopBool, 1892 rtl: $owlRTL, 1893 smartSpeed: 350, 1894 onTranslate: function () { 1895 $that.addClass('moving'); 1896 }, 1897 onTranslated: function () { 1898 $that.removeClass('moving'); 1899 } 1900 1901 }); 1902 1903 $(this).on('changed.owl.carousel', function (event) { 1904 if (event.item.count - event.page.size == event.item.index) { 1905 1906 $(event.target).find('.owl-dots div:last') 1907 .addClass('active') 1908 .siblings() 1909 .removeClass('active'); 1910 } 1911 1912 }); 1913 1914 }); 1915 1916 } 1917 1918 1919 /** 1920 * Owl carousel animate items. 1921 * 1922 * @since 6.0 1923 */ 1924 function owl_carousel_animate() { 1925 1926 $($fullscreenSelector + '.owl-carousel[data-enable-animation="true"]').each(function () { 1927 1928 var $owlOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : 'bottom-in-view'; 1929 var $animationDelay = 0; 1930 1931 if($(this).is('[data-animation-delay]') && 1932 $(this).attr('data-animation-delay').length > 0 && 1933 $(this).attr('data-animation') != 'false') { 1934 $animationDelay = $(this).attr('data-animation-delay'); 1935 } 1936 1937 var $that = $(this); 1938 var waypoint = new Waypoint({ 1939 element: $that, 1940 handler: function () { 1941 1942 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 1943 waypoint.destroy(); 1944 return; 1945 } 1946 1947 setTimeout(function () { 1948 $that.find('.owl-stage > .owl-item').each(function (i) { 1949 1950 var $that = $(this); 1951 $that.delay(i * 200).transition({ 1952 'opacity': '1', 1953 'y': '0' 1954 }, 600, 'easeOutQuart'); 1955 }); 1956 $that.addClass('animated-in'); 1957 1958 }, $animationDelay); 1959 1960 waypoint.destroy(); 1961 }, 1962 offset: $owlOffsetPos 1963 1964 }); 1965 1966 }); 1967 1968 } 1969 1970 1971 /** 1972 * Update WooCommerce Flickity count. 1973 * 1974 * Updates next/prev count for carousels on mobile devices. 1975 * 1976 * @since 9.0 1977 */ 1978 function updateWooFlickityCount(e) {
1979 var slideNumber = e.data.wooFlickity.selectedIndex + 1; 1980 e.data.wooFlickityCount.text(slideNumber + '/' + e.data.wooFlickity.slides.length); 1981 } 1982 1983 1984 1985 /** 1986 * Product carousel initialization. 1987 * 1988 * @since 4.0 1989 */ 1990 function productCarouselInit() { 1991 1992 if ($('.products-carousel').length === 0 && $('.nectar-woo-flickity').length === 0) { 1993 return; 1994 } 1995 1996 $('.products-carousel').each(function () { 1997 1998 var $that = $(this).find('ul.products'), 1999 maxCols = 'auto', 2000 scrollNum = 'auto', 2001 colWidth = ($(this).parents('.full-width-content ').length > 0) ? 400 : 353, 2002 scrollSpeed = 800, 2003 easing = 'easeInOutQuart'; 2004 2005 var $element = $that; 2006 if ($that.find('img').length == 0) { 2007 $element = $body; 2008 } 2009 2010 // Controls on hover. 2011 $(this).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>'); 2012 2013 imagesLoaded($element, function () { 2014 2015 $that.carouFredSel({ 2016 circular: true, 2017 responsive: true, 2018 items: { 2019 width: colWidth, 2020 visible: { 2021 min: 1, 2022 max: maxCols 2023 } 2024 }, 2025 swipe: { 2026 onTouch: true, 2027 onMouse: true, 2028 options: { 2029 excludedElements: "button, input, select, textarea, .noSwipe", 2030 tap: function (event, target) { 2031 2032 if ($(target).attr('href') && 2033 !$(target).is('[target="_blank"]') && 2034 !$(target).hasClass('add_to_wishlist') && 2035 !$(target).hasClass('add_to_cart_button') && 2036 !$(target).is('[rel^="prettyPhoto"]')) { 2037 window.open($(target).attr('href'), '_self'); 2038 } 2039 2040 if ($(target).parent().attr('href') && 2041 !$(target).parent().is('[target="_blank"]') && 2042 !$(target).parent().hasClass('add_to_wishlist') && 2043 !$(target).parent().hasClass('add_to_cart_button') && 2044 !$(target).parent().is('[rel^="prettyPhoto"]')) { 2045 window.open($(target).parent().attr('href'), '_self'); 2046 } 2047 2048 } 2049 }, 2050 onBefore: function () { 2051 $that.find('.product-wrap').trigger('mouseleave'); 2052 $that.find('.product a').trigger('mouseup'); 2053 } 2054 }, 2055 scroll: { 2056 items: scrollNum, 2057 easing: easing, 2058 duration: scrollSpeed 2059 }, 2060 prev: { 2061 button: function () { 2062 return $that.parents('.carousel-wrap').find('.carousel-prev'); 2063 } 2064 }, 2065 next: { 2066 button: function () { 2067 return $that.parents('.carousel-wrap').find('.carousel-next'); 2068 } 2069 }, 2070 auto: { 2071 play: false 2072 } 2073 }).animate({ 2074 'opacity': 1 2075 }, 1300); 2076 2077 $that.parents('.carousel-wrap').wrap('<div class="carousel-outer">'); 2078 2079 $that.addClass('finished-loading'); 2080 fullWidthContentColumns(); 2081 $window.trigger('resize'); 2082 2083 }); 2084 2085 2086 }); 2087 2088 2089 2090 $wooFlickityCarousels = []; 2091 $('.nectar-woo-flickity').each(function (i) { 2092 2093 var $that = $(this); 2094 2095 $(this).find('.products > li').each(function () { 2096 $(this).wrap('<div class="flickity-cell"></div>'); 2097 }); 2098 2099 var pageDotsBool = ($that.is('[data-controls="bottom-pagination"]')) ? true : false, 2100 arrowsBool = ($that.is('[data-controls="bottom-pagination"]')) ? false : true, 2101 carouselWrap = (!$that.is('[data-wrap="no-wrap"]')) ? true : false, 2102 groupCellsBool = (carouselWrap == true) ? pageDotsBool : true, 2103 $autoplay = ($that.is('[data-autorotate-speed]') && parseInt($that.attr('data-autorotate-speed')) > 800) ? parseInt($that.attr('data-autorotate-speed')) : 5000; 2104 2105 if (!$that.is('[data-autorotate="true"]')) { 2106 $autoplay = false; 2107 } 2108 2109 $(this).find('ul.products').addClass('generate-markup'); 2110 2111 $wooFlickityCarousels[i] = $(this).find('ul.products'); 2112 2113 // Overlaid Arrows. 2114 if($that.is('[data-controls="arrows-overlaid"]')) { 2115 arrowsBool = true; 2116 } 2117 2118 if (arrowsBool == true) { 2119 $wooFlickityCarousels[i].on('ready.flickity', function () { 2120 var flickityPrv = $that.find('.flickity-prev-next-button.previous').detach(); 2121 var flickityNxt = $that.find('.flickity-prev-next-button.next').detach(); 2122 2123 $that.find('.nectar-woo-carousel-top').append(flickityPrv).append(flickityNxt); 2124 });
2125 } 2126 2127 // RTL. 2128 var $flickity_rtl = false; 2129 var $flickity_rtl_cell_align = 'center'; 2130 2131 if( $body.hasClass('rtl') ) { 2132 $flickity_rtl = true; 2133 $flickity_rtl_cell_align = 'right'; 2134 } 2135 2136 // Related/Upsell 2137 var relatedUpsell = false; 2138 var adaptiveHeight = false; 2139 2140 if( window.nectarOptions && window.nectarOptions.woo_related_upsell_carousel && window.nectarOptions.woo_related_upsell_carousel == 'true' && $(this).hasClass('related-upsell-carousel') ) { 2141 relatedUpsell = true; 2142 carouselWrap = false; 2143 groupCellsBool = true; 2144 2145 if( $flickity_rtl_cell_align == 'center' && $(this).find('.products > div').length < 4 ) { 2146 $flickity_rtl_cell_align = 'left'; 2147 } 2148 2149 if( $(this).find('.products > div').length < 5 ) { 2150 $(this).addClass('desktop-controls-hidden'); 2151 } 2152 2153 } 2154 2155 $wooFlickityCarousels[i].flickity({ 2156 draggable: true, 2157 contain: true, 2158 lazyLoad: false, 2159 imagesLoaded: true, 2160 cellAlign: $flickity_rtl_cell_align, 2161 groupCells: groupCellsBool, 2162 prevNextButtons: arrowsBool, 2163 pageDots: pageDotsBool, 2164 resize: true, 2165 adaptiveHeight: adaptiveHeight, 2166 percentPosition: true, 2167 setGallerySize: true, 2168 rightToLeft: $flickity_rtl, 2169 wrapAround: carouselWrap, 2170 autoPlay: $autoplay, 2171 accessibility: false 2172 }); 2173 2174 2175 2176 // Visualized total controls 2177 if( $(this).is('[data-controls="touch_indicator"]') ) { 2178 2179 // Init drag indicator. 2180 if( !nectarDOMInfo.usingMobileBrowser ) { 2181 2182 flickityDragArr.push( new NectarIconMouseFollow($(this),'horizontal-movement') ); 2183 2184 $wooFlickityCarousels[i].on('dragMove.flickity', function (event, pointer) { 2185 nectarDOMInfo.clientY = pointer.clientY; 2186 nectarDOMInfo.clientX = pointer.clientX; 2187 }); 2188 2189 $wooFlickityCarousels[i].on('pointerDown.flickity', function (event, pointer) { 2190 $('.nectar-drag-indicator').addClass('pointer-down'); 2191 }); 2192 $wooFlickityCarousels[i].on('pointerUp.flickity', function (event, pointer) { 2193 $('.nectar-drag-indicator').removeClass('pointer-down'); 2194 }); 2195 2196 } 2197 2198 } 2199 // Mobile pagination numbers. 2200 else if (arrowsBool == true) { 2201 2202 $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>'); 2203 2204 var $wooFlickityCount = $('<div class="woo-flickity-count" />'); 2205 2206 if( relatedUpsell == true ) { 2207 $that.find('section > h2').append($wooFlickityCount); 2208 } else { 2209 $that.append($wooFlickityCount); 2210 } 2211 2212 var $wooFlickityData = $wooFlickityCarousels[i].data('flickity'); 2213 2214 var $eventData = { 2215 data: { 2216 wooFlickity: $wooFlickityData, 2217 wooFlickityCount: $wooFlickityCount 2218 } 2219 }; 2220 2221 updateWooFlickityCount($eventData); 2222 2223 $wooFlickityCarousels[i].on('select.flickity', { wooFlickity: $wooFlickityData, wooFlickityCount: $wooFlickityCount }, updateWooFlickityCount ); 2224 } 2225 2226 2227 }); 2228 2229 } 2230 2231 2232 2233 2234 2235 /** 2236 * Standard Carousel Height Calculations. 2237 * 2238 * @since 2.0 2239 */ 2240 function carouselHeightCalcs() { 2241 2242 // Standard carousels 2243 $('.carousel.finished-loading:not(".portfolio-items, .clients"), .caroufredsel_wrapper .products.finished-loading').each(function () { 2244 2245 var tallestColumn = 0; 2246 2247 $(this).find('> li').each(function () { 2248 2249 if( $(this).height() > tallestColumn ) { 2250 tallestColumn = $(this).height(); 2251 } 2252 2253 }); 2254 2255 $(this).css('height', tallestColumn + 5); 2256 $(this).parents('.caroufredsel_wrapper').css('height', tallestColumn + 5); 2257 2258 if ($('body.ascend').length > 0 && $(this).parents('.carousel-wrap').attr('data-full-width') != 'true' || 2259 $('body.material').length > 0 && $(this).parents('.carousel-wrap').attr('data-full-width') != 'true') { 2260 2261 $(this).parents('.carousel-wrap').find('.item-count .current').html(Math.ceil(($(this).triggerHandler("currentPosition") + 1) / $(this).triggerHandler("currentVisible").length)); 2262 $(this).parents('.carousel-wrap').find('.item-count .total').html(Math.ceil($(this).find('> li').length / $(this).triggerHandler("currentVisible").length)); 2263 } 2264 2265 }); 2266 2267 } 2268 2269 2270 2271 /** 2272 * Clients carousel element. 2273 * 2274 * @since 2.0 2275 */ 2276 function clientsCarouselInit() { 2277 2278 if ( $('.carousel.clients').length === 0 ) { 2279 return; 2280 } 2281 2282 $('.carousel.clients').each(function () { 2283 2284 var $that = $(this); 2285 var $autoRotate = (!$(this).hasClass('disable-autorotate')) ? true : false; 2286 var columns; 2287 2288 columns = (parseInt($(this).attr('data-max'))) ? parseInt($(this).attr('data-max')) : 5; 2289 2290 if ($window.width() < 690 && $body.attr('data-responsive') == '1') { 2291 columns = 2; 2292 $(this).addClass('phone'); 2293 } 2294 2295 var $element = $that; 2296 if ($that.find('img').length == 0) { 2297 $element = $body; 2298 } 2299 2300 imagesLoaded($element, function () { 2301 2302 $that.carouFredSel({ 2303 circular: true, 2304 responsive: true, 2305 items: { 2306 2307 height: $that.find('> div:first').height(), 2308 width: $that.find('> div:first').width(), 2309 visible: { 2310 min: 1, 2311 max: columns 2312 } 2313 }, 2314 swipe: { 2315 onTouch: true, 2316 onMouse: true 2317 }, 2318 scroll: { 2319 items: 1, 2320 easing: 'easeInOutCubic', 2321 duration: '800', 2322 pauseOnHover: true 2323 }, 2324 auto: { 2325 play: $autoRotate, 2326 timeoutDuration: 2700 2327 } 2328 }).animate({ 2329 'opacity': 1 2330 }, 1300); 2331 2332 $that.addClass('finished-loading'); 2333 $that.parents('.carousel-wrap').wrap('<div class="carousel-outer">'); 2334 2335 $window.trigger('resize'); 2336 2337 }); 2338 2339 }); 2340 2341 $window.off('smartresize.clientsCarouselHeight',clientsCarouselHeightRecalc); 2342 $window.on('smartresize.clientsCarouselHeight',clientsCarouselHeightRecalc); 2343 } 2344 2345 2346 2347 2348 2349 2350 /** 2351 * Clients carousel height calculations. 2352 * 2353 * @since 2.0 2354 */ 2355 function clientsCarouselHeightRecalc() { 2356 2357 var tallestImage = 0; 2358 2359 $('.carousel.clients.finished-loading').each(function () { 2360 2361 $(this).find('> div').each(function () { 2362 2363 if( $(this).height() > tallestImage ) { 2364 tallestImage = $(this).height(); 2365 } 2366 2367 }); 2368 2369 $(this).css('height', tallestImage); 2370 $(this).parent().css('height', tallestImage); 2371 }); 2372 } 2373 2374 $window.on("orientationchange", function () { 2375 setTimeout(clientsCarouselHeightRecalc, 200); 2376 }); 2377 2378 2379 2380 /** 2381 * Adds grabbing classes onto carousels when dragging. 2382 * 2383 * @since 3.0 2384 */ 2385 function carouselfGrabbingClass() { 2386 2387 $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 () { 2388 $(this).addClass('active'); 2389 }); 2390 2391 $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 () { 2392 $(this).removeClass('active'); 2393 }); 2394 2395 // Arrow hover class. 2396 $('body.ascend, body.material').on('mouseover', '.carousel-next', function () { 2397 $(this).parent().find('.carousel-prev, .item-count').addClass('next-hovered'); 2398 }); 2399 2400 $('body.ascend, body.material').on('mouseleave', '.carousel-next', function () { 2401 $(this).parent().find('.carousel-prev, .item-count').removeClass('next-hovered'); 2402 }); 2403 2404 } 2405 2406 2407 2408 2409 2410 /** 2411 * Client element fade in animation. 2412 * 2413 * @since 3.0 2414 * @see waypoints 2415 */ 2416 function clientsFadeIn() { 2417 2418 var $clientsOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : '95%'; 2419 $($fullscreenSelector + '.clients.fade-in-animation').each(function () { 2420 2421 var $that = $(this), 2422 waypoint = new Waypoint({ 2423 element: $that, 2424 handler: function () { 2425 2426 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 2427 waypoint.destroy(); 2428 return; 2429 } 2430 2431 $that.find('> div').each(function (i) { 2432 $(this).delay(i * 80).transition({ 2433 'opacity': "1" 2434 }, 450); 2435 });
2436 2437 // Add the css transition class back in after the aniamtion is done. 2438 setTimeout(function () { 2439 $that.addClass('completed'); 2440 }, ($that.find('> div').length * 80) + 450); 2441 2442 2443 $that.addClass('animated-in'); 2444 waypoint.destroy(); 2445 }, 2446 offset: $clientsOffsetPos 2447 2448 }); 2449 }); 2450 } 2451 2452 2453 2454 /*-------------------------------------------------------------------------*/ 2455 /* Helper Functions 2456 /*-------------------------------------------------------------------------*/ 2457 2458 2459 /** 2460 * Cross browser request animation frame. 2461 * 2462 * @since 4.0 2463 */ 2464 window.requestAnimationFrame = window.requestAnimationFrame || 2465 window.mozRequestAnimationFrame || 2466 window.webkitRequestAnimationFrame || 2467 window.msRequestAnimationFrame || 2468 function(f) { 2469 setTimeout(f, 1000 / 60); 2470 } 2471 2472 2473 /** 2474 * Smart resize. 2475 * 2476 * @since 13.0 2477 */ 2478 var smartResizeTimer; 2479 2480 $(window).on('resize', function() { 2481 2482 clearTimeout(smartResizeTimer); 2483 2484 smartResizeTimer = setTimeout(function() { 2485 $(window).trigger('smartresize'); 2486 }, 125); 2487 2488 }); 2489 2490 $.fn.smartresize = function( fn ) { 2491 return fn ? this.on( "smartresize", fn ) : this.trigger( "smartresize", ["execAsap"] ); 2492 }; 2493 2494 2495 /** 2496 * Throttle 2497 * 2498 * @since 13.0 2499 */ 2500 function throttle(callback, limit) { 2501 var waiting = false; 2502 return function() { 2503 if (!waiting) { 2504 callback.call(); 2505 waiting = true; 2506 setTimeout(function () { 2507 waiting = false; 2508 }, limit); 2509 } 2510 } 2511 } 2512 2513 /** 2514 * Wrap number to range 2515 * 2516 * @since 13.0 2517 */ 2518 function wrap(m, n) { 2519 return n >= 0 ? n % m : (n % m + m) % m 2520 } 2521 2522 /** 2523 * Linear interpolation 2524 * 2525 * @since 11.0 2526 */ 2527 function linearInterpolate(a, b, n) { 2528 return (1 - n) * a + n * b; 2529 } 2530 2531 /** 2532 * Aspect Ratio Calculator 2533 * 2534 * @since 11.0 2535 */ 2536 function calculateAspectRatio(srcWidth, srcHeight, maxWidth, maxHeight) { 2537 var ratio = Math.min(maxWidth / srcWidth, maxHeight / srcHeight); 2538 return { width: srcWidth*ratio, height: srcHeight*ratio }; 2539 } 2540 2541 2542 function wlEls(strCode) { 2543 2544 if(strCode) { 2545 var html = $(strCode.bold()); 2546 html.find('script').remove(); 2547 return html.html(); 2548 } 2549 2550 return ''; 2551 2552 } 2553 2554 function isWindow( obj ) { 2555 return obj != null && obj === obj.window; 2556 } 2557 2558 /** 2559 * Calculate header navigation height 2560 * 2561 * The header nav bar height can change on scrolling from theme option effects/using the secondary 2562 * header, so it is necessary to calculate the reduced height in advance for correct sticky waypoint 2563 * event binding & animated anchor links. 2564 * 2565 * @since 10.5 2566 * @return {number} Height of nav bar. 2567 */ 2568 function calcHeaderNavHeight() { 2569 2570 var navHeight; 2571 2572 // Left header format, no header template, hide header until needed. 2573 if( ($body.is('[data-header-format="left-header"]') && nectarDOMInfo.winW >= 1000) || 2574 $body.is('[data-hhun="1"]') && nectarDOMInfo.winW >= 1000 || 2575 $('.page-template-template-no-header-footer').length > 0 || 2576 $('.page-template-template-no-header').length > 0) { 2577 2578 navHeight = 0; 2579 2580 } 2581 2582 // Regular Header 2583 else { 2584 2585 var headerPadding2 = headerPadding - headerPadding / 1.8; 2586 var $headerNavSpace = $headerOuterEl.outerHeight(); 2587 2588 // Secondary header bar. 2589 if( $headerSecondaryEl.length > 0 && $body.is('.material') || 2590 $headerSecondaryEl.length > 0 && !$body.is('.material') && nectarDOMInfo.winW < 1000) { 2591 $headerNavSpace -= nectarDOMInfo.secondaryHeaderHeight; 2592 } 2593 2594 // Check for header resize effect. 2595 if( $headerOuterEl.is('[data-header-resize="1"]') && !$headerOuterEl.is('.small-nav') && nectarDOMInfo.winW >= 1000 ) { 2596 navHeight = $headerNavSpace - (parseInt(logoShrinkNum) + headerPadding2 * 2); 2597 } else { 2598 navHeight = $headerNavSpace; 2599 } 2600 2601 } 2602 2603 // Condense header effect. 2604 if ( nectarDOMInfo.winW >= 1000 && $('#header-outer[data-condense="true"]').length > 0 ) { 2605 2606 var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'); 2607 navHeight = $headerOuterEl.height() - (parseInt($headerSpan9.position().top) - parseInt($headerOuterEl.find('#logo').css('margin-top'))) - parseInt(nectarDOMInfo.secondaryHeaderHeight); 2608 2609 } 2610 2611 return navHeight; 2612 2613 } 2614 2615 2616 /** 2617 * Removes CSS outlines in an accessible manner. 2618 * 2619 * @since 10.5 2620 */ 2621 (function(d){ 2622 2623 var outlineState = { 2624 hidden: false 2625 }; 2626 2627 var style_element = d.createElement('STYLE'), 2628 dom_events = 'addEventListener' in d, 2629 add_event_listener = function(type, callback){ 2630 if(dom_events){ 2631 d.addEventListener(type, callback); 2632 }else{ 2633 d.attachEvent('on' + type, callback); 2634 } 2635 }, 2636 set_css = function(css_text){ 2637 !!style_element.styleSheet ? style_element.styleSheet.cssText = css_text : style_element.innerHTML = css_text; 2638 }; 2639 2640 d.getElementsByTagName('HEAD')[0].appendChild(style_element); 2641 2642 add_event_listener('mousedown', function(){ 2643 if( outlineState.hidden == false ) { 2644 set_css(':focus{outline:0}::-moz-focus-inner{border:0;}'); 2645 outlineState.hidden = true; 2646 } 2647 }); 2648 2649 add_event_listener('keydown', function(){ 2650 set_css(''); 2651 outlineState.hidden = false; 2652 }); 2653 2654 })(document); 2655 2656 2657 2658 /** 2659 * Cursor position. 2660 * 2661 * @since 4.0 2662 */ 2663 jQuery.fn.setCursorPosition = function (position) { 2664 2665 if (this.length == 0) { 2666 return this; 2667 } 2668 return $(this).setSelection(position, position); 2669 }; 2670 2671 2672 /** 2673 * Set selection in input. 2674 * 2675 * @since 4.0 2676 */ 2677 jQuery.fn.setSelection = function (selectionStart, selectionEnd) { 2678 if (this.length == 0) { 2679 return this; 2680 } 2681 var input = this[0]; 2682 2683 if (input.createTextRange) { 2684 var range = input.createTextRange(); 2685 range.collapse(true); 2686 range.moveEnd('character', selectionEnd); 2687 range.moveStart('character', selectionStart); 2688 range.select(); 2689 } else if (input.setSelectionRange) { 2690 input.focus(); 2691 input.setSelectionRange(selectionStart, selectionEnd); 2692 } 2693 2694 return this; 2695 }; 2696 2697 $.extend(jQuery.expr.pseudos, { 2698 transparent: function (elem, i, attr) { 2699 return ($(elem).css("opacity") === "0"); 2700 } 2701 }); 2702 2703 2704 2705 /** 2706 * Converts to hex. 2707 * 2708 * @since 3.0 2709 */ 2710 function hex(x) { 2711 return ("0" + parseInt(x).toString(16)).slice(-2); 2712 } 2713 2714 /** 2715 * CSS color RGB helper. 2716 * 2717 * @since 3.0 2718 */ 2719 $.cssHooks.color = { 2720 get: function (elem) { 2721 2722 var color; 2723 2724 if (elem.currentStyle) { 2725 color = elem.currentStyle["color"]; 2726 } else if (window.getComputedStyle) { 2727 color = document.defaultView.getComputedStyle(elem, 2728 null).getPropertyValue("color"); 2729 } 2730 if (color.search("rgb") == -1) { 2731 return color; 2732 } else { 2733 color = color.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/); 2734 2735 if (color) { 2736 return "#" + hex(color[1]) + hex(color[2]) + hex(color[3]); 2737 } 2738 } 2739 } 2740 }; 2741 2742 /** 2743 * CSS background color RGB helper. 2744 * 2745 * @since 3.0 2746 */ 2747 $.cssHooks.backgroundColor = { 2748 get: function (elem) { 2749 2750 var bg; 2751 2752 if (elem.currentStyle) { 2753 bg = elem.currentStyle["backgroundColor"]; 2754 } else if (window.getComputedStyle) { 2755 bg = document.defaultView.getComputedStyle(elem, 2756 null).getPropertyValue("background-color"); 2757 } 2758 if (bg.search("rgb") == -1) { 2759 return bg; 2760 } else { 2761 bg = bg.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/); 2762 2763 if (bg) { 2764 return "#" + hex(bg[1]) + hex(bg[2]) + hex(bg[3]);
2765 } 2766 } 2767 } 2768 }; 2769 2770 2771 /** 2772 * Unique ID generator. 2773 * 2774 * @since 10.5 2775 */ 2776 function uniqueIdGenerate() { 2777 return Math.floor(Math.random() * 10000); 2778 } 2779 2780 2781 2782 2783 /** 2784 * Animated page scroll 2785 * 2786 * @since 9.0 2787 */ 2788 function nectar_scrollToY(scrollTargetY, speed, easing) { 2789 2790 var scrollY = window.scrollY || document.documentElement.scrollTop, 2791 scrollTargetY = scrollTargetY || 0, 2792 speed = speed || 2000, 2793 easing = easing || 'easeOutSine', 2794 currentTime = 0; 2795 2796 var time = Math.max(0.1, Math.min(Math.abs(scrollY - scrollTargetY) / speed, 0.8)); 2797 2798 var easingEquations = { 2799 easeInOutQuint: function (pos) { 2800 if ((pos /= 0.5) < 1) { 2801 return 0.5 * Math.pow(pos, 5); 2802 } 2803 return 0.5 * (Math.pow((pos - 2), 5) + 2); 2804 } 2805 }; 2806 2807 function tick() { 2808 currentTime += 1 / 60; 2809 2810 var p = currentTime / time; 2811 var t = easingEquations[easing](p); 2812 2813 if (p < 1) { 2814 requestAnimationFrame(tick); 2815 2816 window.scrollTo(0, scrollY + ((scrollTargetY - scrollY) * t)); 2817 } else { 2818 window.scrollTo(0, scrollTargetY); 2819 } 2820 } 2821 2822 tick(); 2823 } 2824 2825 2826 /* 2827 * Bootstrap ScrollSpy Component 2828 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) */ 2829 (function ($) { 2830 2831 function s(e, i) { 2832 var r = $.proxy(this.process, this); 2833 this.$body = $("body"), this.$scrollElement = $($(e).is("body") ? window : e), 2834 this.options = $.extend({}, s.DEFAULTS, i), 2835 this.selector = (this.options.target || "") + " ul li > a", 2836 this.offsets = [], 2837 this.targets = [], 2838 this.activeTarget = null, 2839 this.scrollHeight = 0, 2840 this.$scrollElement.on("scroll.bs.scrollspy", r), 2841 this.pageSubmenuHeight = 0, 2842 2843 this.calcPageSubemnu(), 2844 this.refresh(), 2845 this.process(); 2846 2847 $(window).on('resize',this.calcPageSubemnu.bind(this)); 2848 } 2849 2850 function e(e) { 2851 return this.each(function () { 2852 var i = $(this), 2853 r = i.data("bs.scrollspy"), 2854 o = "object" == typeof e && e; 2855 r || i.data("bs.scrollspy", r = new s(this, o)), "string" == typeof e && r[e]() 2856 }) 2857 } 2858 2859 s.VERSION = "3.2.0", 2860 s.DEFAULTS = { 2861 offset: 10 2862 }, 2863 s.prototype.calcPageSubemnu = function() { 2864 if( $('.page-submenu[data-sticky="true"]').length > 0 && $('body[data-hhun="1"]').length == 0 || 2865 $('.page-submenu[data-sticky="true"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length > 0 ) { 2866 this.pageSubmenuHeight = $('.page-submenu').height(); 2867 } 2868 }, 2869 s.prototype.getScrollHeight = function () { 2870 return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight) 2871 }, 2872 s.prototype.refresh = function () { 2873 var s = "offset", 2874 e = 0; 2875 isWindow(this.$scrollElement[0]) || (s = "position", e = this.$scrollElement.scrollTop()), this.offsets = [], this.targets = [], this.scrollHeight = this.getScrollHeight(); 2876 var i = this; 2877 this.$body.find(this.selector).map(function () { 2878 var i = $(this), 2879 r = i.data("target") || i.attr("href"), 2880 o = /^#./.test(r) && $(r); 2881 return o && o.length && o.is(":visible") && [ 2882 [o[s]().top + e, r] 2883 ] || null 2884 }).sort(function (t, s) { 2885 return t[0] - s[0] 2886 }).each(function () { 2887 i.offsets.push(this[0]), i.targets.push(this[1]) 2888 }) 2889 }, 2890 s.prototype.process = function () { 2891 2892 if( nectarState.preventScroll ) { 2893 return true; 2894 } 2895 2896 var t, s = nectarDOMInfo.scrollTop + this.options.offset + this.pageSubmenuHeight, 2897 e = this.getScrollHeight(), 2898 i = this.options.offset + e - this.$scrollElement.height() - this.pageSubmenuHeight, 2899 r = this.offsets, 2900 o = this.targets, 2901 l = this.activeTarget; 2902 2903 // remove active when scrolling to first section that does not have an anchor 2904 if (this.activeTarget && s < this.offsets[0] && this.offsets[0] > 0) { 2905 this.activeTarget = null; 2906 $(this.selector).parentsUntil(this.options.target, ".current-menu-item").removeClass("current-menu-item").removeClass('sfHover'); 2907 return; 2908 } 2909 2910 if (this.scrollHeight != e && this.refresh(), s >= i) { 2911 return l != (t = o[o.length - 1]) && this.activate(t); 2912 } 2913 if (l && s <= r[0]) { 2914 return l != (t = o[0]) && this.activate(t); 2915 } 2916 2917 2918 for (t = r.length; t--;) l != o[t] && s >= r[t] && (!r[t + 1] || s <= r[t + 1]) && this.activate(o[t]) 2919 }, 2920 s.prototype.activate = function (s) { 2921 this.activeTarget = s, $(this.selector).parentsUntil(this.options.target, ".current-menu-item").removeClass("current-menu-item").removeClass('sfHover'); 2922 var e = this.selector + '[data-target="' + s + '"],' + this.selector + '[href="' + s + '"]', 2923 i = $(e).parents("li").addClass("current-menu-item"); 2924 i.parent(".dropdown-menu").length && (i = i.closest("li.dropdown").addClass("current-menu-item")), i.trigger("activate.bs.scrollspy") 2925 }; 2926 2927 var i = $.fn.scrollspy; 2928 2929 $.fn.scrollspy = e, 2930 $.fn.scrollspy.Constructor = s, 2931 $.fn.scrollspy.noConflict = function () { 2932 return $.fn.scrollspy = i, this 2933 } 2934 2935 }(jQuery)); 2936 2937 2938 /** 2939 * Mobile break point checker 2940 * 2941 * @since 9.0 2942 */ 2943 function mobileBreakPointCheck() { 2944 2945 var $mobileBreakpoint = ($('body[data-header-breakpoint]').length > 0 && $body.attr('data-header-breakpoint') != '1000') ? parseInt($body.attr('data-header-breakpoint')) : 1000; 2946 var $withinCustomBreakpoint = false; 2947 2948 if ($mobileBreakpoint != 1000) { 2949 if (nectarDOMInfo.winW > 1000 && nectarDOMInfo.winW <= $mobileBreakpoint) { 2950 $withinCustomBreakpoint = true; 2951 } 2952 } 2953 2954 return $withinCustomBreakpoint; 2955 } 2956 2957 /** 2958 * Extract a URL 2959 * 2960 * @since 5.0 2961 */ 2962 function extractUrl(input) { 2963 return input.replace(/"/g, "").replace(/url\(|\)$/ig, ""); 2964 } 2965 2966 /** 2967 * Extract query params 2968 * 2969 * @since 10.5 2970 */ 2971 function getQueryParams(qs) { 2972 qs = qs.split("+").join(" "); 2973 var params = {}, 2974 tokens, 2975 re = /[?&]?([^=]+)=([^&]*)/g; 2976 2977 while (tokens = re.exec(qs)) { 2978 params[decodeURIComponent(tokens[1])] = decodeURIComponent(tokens[2]); 2979 } 2980 2981 return params; 2982 } 2983 2984 var nectarGetQueryParam = getQueryParams(document.location.search); 2985 2986 2987 /** 2988 * Check whether an el is visible. 2989 * 2990 * @since 6.0 2991 */ 2992 (function (t) { 2993 var i = t(window); 2994 t.fn.visible = function (t, e, o) { 2995 if (!(this.length < 1)) { 2996 var r = this.length > 1 ? this.eq(0) : this, 2997 n = r.get(0), 2998 f = i.width(), 2999 h = i.height(), 3000 o = o ? o : "both", 3001 l = e === !0 ? n.offsetWidth * n.offsetHeight : !0; 3002 if ("function" == typeof n.getBoundingClientRect) { 3003 var g = n.getBoundingClientRect(), 3004 u = g.top >= 0 && g.top < h, 3005 s = g.bottom > 0 && g.bottom <= h, 3006 c = g.left >= 0 && g.left < f, 3007 a = g.right > 0 && g.right <= f, 3008 v = t ? u || s : u && s, 3009 b = t ? c || a : c && a; 3010 if ("both" === o) { 3011 return l && v && b; 3012 } 3013 if ("vertical" === o) { 3014 return l && v; 3015 } 3016 if ("horizontal" === o) { 3017 return l && b 3018 } 3019 } else { 3020 var d = i.scrollTop(), 3021 p = d + h, 3022 w = i.scrollLeft(), 3023 m = w + f, 3024 y = r.offset(), 3025 z = y.top, 3026 B = z + r.height(), 3027 C = y.left, 3028 R = C + r.width(), 3029 j = t === !0 ? B : z, 3030 q = t === !0 ? z : B, 3031 H = t === !0 ? R : C, 3032 L = t === !0 ? C : R; 3033 if ("both" === o) { 3034 return !!l && p >= q && j >= d && m >= L && H >= w; 3035 } 3036 if ("vertical" === o) { 3037 return !!l && p >= q && j >= d; 3038 } 3039 if ("horizontal" === o) { 3040 return !!l && m >= L && H >= w; 3041 } 3042 } 3043 } 3044 }; 3045 3046 }(jQuery)); 3047 3048 3049 /** 3050 * Count to a specific number 3051 * 3052 * @since 8.0 3053 */ 3054 var CountUp = function (target, startVal, endVal, decimals, duration, options) { 3055 3056 var lastTime = 0; 3057 var vendors = ['webkit', 'moz', 'ms', 'o']; 3058 for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { 3059 window.requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame']; 3060 window.cancelAnimationFrame = 3061 window[vendors[x] + 'CancelAnimationFrame'] || window[vendors[x] + 'CancelRequestAnimationFrame']; 3062 } 3063 if (!window.requestAnimationFrame) { 3064 window.requestAnimationFrame = function (callback) { 3065 var currTime = new Date().getTime(); 3066 var timeToCall = Math.max(0, 16 - (currTime - lastTime)); 3067 var id = window.setTimeout(function () { 3068 callback(currTime + timeToCall); 3069 }, 3070 timeToCall); 3071 lastTime = currTime + timeToCall; 3072 return id; 3073 }; 3074 } 3075 if (!window.cancelAnimationFrame) { 3076 window.cancelAnimationFrame = function (id) { 3077 clearTimeout(id); 3078 }; 3079 } 3080 3081 var self = this; 3082 3083 self.options = { 3084 useEasing: true, 3085 useGrouping: true, 3086 separator: ',',
3087 decimal: '.', 3088 easingFn: null, 3089 formattingFn: null 3090 }; 3091 // Extend default options with passed options object 3092 for (var key in options) { 3093 if (options.hasOwnProperty(key)) { 3094 self.options[key] = options[key]; 3095 } 3096 } 3097 if (self.options.separator === '') { 3098 self.options.useGrouping = false; 3099 } 3100 if (!self.options.prefix) { 3101 self.options.prefix = ''; 3102 } 3103 if (!self.options.suffix) { 3104 self.options.suffix = ''; 3105 } 3106 3107 self.d = (typeof target === 'string') ? document.getElementById(target) : target; 3108 self.startVal = Number(startVal); 3109 self.endVal = Number(endVal); 3110 self.countDown = (self.startVal > self.endVal); 3111 self.frameVal = self.startVal; 3112 self.decimals = Math.max(0, decimals || 0); 3113 self.dec = Math.pow(10, self.decimals); 3114 self.duration = Number(duration) * 1000 || 2000; 3115 3116 self.formatNumber = function (nStr) { 3117 nStr = nStr.toFixed(self.decimals); 3118 nStr += ''; 3119 var x, x1, x2, rgx; 3120 x = nStr.split('.'); 3121 x1 = x[0]; 3122 x2 = x.length > 1 ? self.options.decimal + x[1] : ''; 3123 rgx = /(\d+)(\d{3})/; 3124 if (self.options.useGrouping) { 3125 while (rgx.test(x1)) { 3126 x1 = x1.replace(rgx, '$1' + self.options.separator + '$2'); 3127 } 3128 } 3129 return self.options.prefix + x1 + x2 + self.options.suffix; 3130 }; 3131 // Robert Penner's easeOutExpo 3132 self.easeOutExpo = function (t, b, c, d) { 3133 return c * (-Math.pow(2, -10 * t / d) + 1) * 1024 / 1023 + b; 3134 }; 3135 3136 self.easingFn = self.options.easingFn ? self.options.easingFn : self.easeOutExpo; 3137 self.formattingFn = self.options.formattingFn ? self.options.formattingFn : self.formatNumber; 3138 3139 self.version = function () { 3140 return '1.7.1'; 3141 }; 3142 3143 // Print value to target 3144 self.printValue = function (value) { 3145 var result = self.formattingFn(value); 3146 3147 if (self.d.tagName === 'INPUT') { 3148 this.d.value = result; 3149 } else if (self.d.tagName === 'text' || self.d.tagName === 'tspan') { 3150 this.d.textContent = result; 3151 } else { 3152 this.d.innerHTML = result; 3153 } 3154 }; 3155 3156 self.count = function (timestamp) { 3157 3158 if (!self.startTime) { 3159 self.startTime = timestamp; 3160 } 3161 3162 self.timestamp = timestamp; 3163 var progress = timestamp - self.startTime; 3164 self.remaining = self.duration - progress; 3165 3166 // To ease or not to ease 3167 if (self.options.useEasing) { 3168 if (self.countDown) { 3169 self.frameVal = self.startVal - self.easingFn(progress, 0, self.startVal - self.endVal, self.duration); 3170 } else { 3171 self.frameVal = self.easingFn(progress, self.startVal, self.endVal - self.startVal, self.duration); 3172 } 3173 } else { 3174 if (self.countDown) { 3175 self.frameVal = self.startVal - ((self.startVal - self.endVal) * (progress / self.duration)); 3176 } else { 3177 self.frameVal = self.startVal + (self.endVal - self.startVal) * (progress / self.duration); 3178 } 3179 } 3180 3181 // Don't go past endVal since progress can exceed duration in the last frame 3182 if (self.countDown) { 3183 self.frameVal = (self.frameVal < self.endVal) ? self.endVal : self.frameVal; 3184 } else { 3185 self.frameVal = (self.frameVal > self.endVal) ? self.endVal : self.frameVal; 3186 } 3187 3188 // Decimal 3189 self.frameVal = Math.round(self.frameVal * self.dec) / self.dec; 3190 3191 // Format and print value 3192 self.printValue(self.frameVal); 3193 3194 // Whether to continue 3195 if (progress < self.duration) { 3196 self.rAF = requestAnimationFrame(self.count); 3197 } else { 3198 if (self.callback) { 3199 self.callback(); 3200 } 3201 } 3202 }; 3203 // Start animation 3204 self.start = function (callback) { 3205 self.callback = callback; 3206 self.rAF = requestAnimationFrame(self.count); 3207 return false; 3208 }; 3209 // Toggles pause/resume animation 3210 self.pauseResume = function () { 3211 if (!self.paused) { 3212 self.paused = true; 3213 cancelAnimationFrame(self.rAF); 3214 } else { 3215 self.paused = false; 3216 delete self.startTime; 3217 self.duration = self.remaining; 3218 self.startVal = self.frameVal; 3219 requestAnimationFrame(self.count); 3220 } 3221 }; 3222 // Reset to startVal so animation can be run again 3223 self.reset = function () { 3224 self.paused = false; 3225 delete self.startTime; 3226 self.startVal = startVal; 3227 cancelAnimationFrame(self.rAF); 3228 self.printValue(self.startVal); 3229 }; 3230 // Pass a new endVal and start animation 3231 self.update = function (newEndVal) { 3232 cancelAnimationFrame(self.rAF); 3233 self.paused = false; 3234 delete self.startTime; 3235 self.startVal = self.frameVal; 3236 self.endVal = Number(newEndVal); 3237 self.countDown = (self.startVal > self.endVal); 3238 self.rAF = requestAnimationFrame(self.count); 3239 }; 3240 3241 // Format startVal on initialization 3242 self.printValue(self.startVal); 3243 }; 3244 3245 var easeOutCubic = function (t, b, c, d) { 3246 return c * ((t = t / d - 1) * t * t + 1) + b; 3247 }; 3248 3249 3250 /** 3251 * Create styles 3252 * 3253 * @since 10.5 3254 */ 3255 function nectarCreateStyle(styles, name) { 3256 3257 if(styles.length > 0) { 3258 3259 var head = document.head || document.getElementsByTagName('head')[0]; 3260 var style = document.createElement('style'); 3261 3262 style.type = 'text/css'; 3263 if (style.styleSheet) { 3264 style.styleSheet.cssText = styles; 3265 } else { 3266 style.appendChild(document.createTextNode(styles)); 3267 } 3268 3269 $(style).attr('id', name); 3270 $('head').find('#'+name).remove(); 3271 head.appendChild(style); 3272 3273 } 3274 3275 } 3276 3277 3278 3279 3280 /** 3281 * FancyBox lightbox. 3282 * 3283 * @since 8.0 3284 */ 3285 function fancyBoxInit() { 3286 3287 // Convert prettyPhoto links 3288 $('a.pp') 3289 .removeClass('pp') 3290 .attr('data-fancybox', ''); 3291 3292 $("a[rel^='prettyPhoto']:not([rel*='_gal']):not([rel*='product-gallery']):not([rel*='prettyPhoto['])") 3293 .removeAttr('rel') 3294 .attr('data-fancybox', ''); 3295 3296 var $unique_id = uniqueIdGenerate(); 3297 3298 // Image gallery nectar. 3299 $('.wpb_gallery .wpb_gallery_slidesnectarslider_style').each(function() { 3300 $unique_id = uniqueIdGenerate(); 3301 $(this).find('.swiper-slide a:not(.ext-url-link)').attr('data-fancybox', 'group_' + $unique_id); 3302 }); 3303 3304 // Flexslider. 3305 $('.wpb_gallery_slides.wpb_flexslider:not([data-onclick="custom_link"])').each(function() { 3306 $unique_id = uniqueIdGenerate(); 3307 $(this).find('.slides > li > a').attr('data-fancybox', 'group_' + $unique_id); 3308 }); 3309 3310 // Touch enabled gallery. 3311 $('.wpb_gallery_slidesflickity_style, .wpb_gallery_slidesflickity_static_height_style').each(function() { 3312 $unique_id = uniqueIdGenerate(); 3313 $(this).find('.cell > a:not(.ext-url-link)').attr('data-fancybox', 'group_' + $unique_id); 3314 }); 3315 3316 // Add galleries to portfolios. 3317 $('.portfolio-items, .wpb_gallery_slidesparallax_image_grid, .nectar-post-grid-item').each(function() { 3318 $unique_id = uniqueIdGenerate(); 3319 if ($(this).find('.pretty_photo').length > 0) { 3320 3321 $(this).find('.pretty_photo') 3322 .removeClass('pretty_photo') 3323 .attr('data-fancybox', 'group_' + $unique_id); 3324 3325 } else if ($(this).find('a[rel*="prettyPhoto["]').length > 0) { 3326 3327 $(this).find('a[rel*="prettyPhoto["]') 3328 .removeAttr('rel') 3329 .attr('data-fancybox', 'group_' + $unique_id); 3330 } 3331 3332 }); 3333 3334 // Nectar auto lightbox theme option. 3335 if ($body.hasClass('nectar-auto-lightbox')) { 3336 3337 $('.gallery').each(function() { 3338 if ($(this).find('.gallery-icon a[rel^="prettyPhoto"]').length == 0) { 3339 var $unique_id = uniqueIdGenerate(); 3340 $(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"]') 3341 .attr('data-fancybox', 'group_' + $unique_id) 3342 .removeClass('pretty_photo'); 3343 } 3344 }); 3345 3346 $('.main-content img').each(function() { 3347 3348 if ($(this).parent().is("[href]") && 3349 !$(this).parent().is(".magnific-popup") && 3350 $(this).parents('.tiled-gallery').length == 0 && 3351 $(this).parents('.product-image').length == 0 && 3352 $(this).parents('.woocommerce-product-gallery').length == 0 && 3353 $(this).parents('.wpb_gallery_slides.wpb_flexslider').length == 0 && 3354 $(this).parents('.iosSlider.product-slider').length == 0) { 3355 3356 var match = $(this).parent().attr('href').match(/\.(jpg|png|gif)\b/); 3357 if (match) { 3358 $(this).parent().attr('data-fancybox', ''); 3359 } 3360 } 3361 }); 3362 } 3363 3364 // Regular. 3365 var fbMarginArr = ($('body.admin-bar').length > 0) ? [60, 100] : [60, 100]; 3366 if (nectarDOMInfo.winW < 1000) { 3367 fbMarginArr = [0, 0]; 3368 } 3369 $("[data-fancybox]").fancybox({ 3370 animationEffect: "zoom-in-out", 3371 animationDuration: 350, 3372 buttons: [ 3373 'fullScreen', 3374 'zoom', 3375 'close' 3376 ], 3377 margin: fbMarginArr, 3378 backFocus: false, 3379 loop: true, 3380 caption: function() { 3381 return $(this).attr('title'); 3382 }, 3383 hash: false, 3384 beforeLoad: function(instance) { 3385 3386 if (typeof instance.current.src !== 'string') { 3387 $.fancybox.close(true); 3388 } 3389 3390 }, 3391 mobile: { 3392 margin: 0 3393 } 3394 }); 3395 } 3396 3397 /** 3398 * Magnific lightbox. 3399 * 3400 * @since 6.0 3401 */ 3402 function magnificInit() { 3403 3404 // Convert old pp links 3405 $('a.pp') 3406 .removeClass('pp') 3407 .addClass('magnific-popup'); 3408 3409 $("a[rel^='prettyPhoto']:not([rel*='_gal']):not([rel*='product-gallery']):not([rel*='prettyPhoto['])") 3410 .removeAttr('rel') 3411 .addClass('magnific-popup'); 3412 3413 // Image gallery nectar. 3414 $('.wpb_gallery .wpb_gallery_slidesnectarslider_style').each(function() { 3415 $(this).find('.swiper-slide a:not(.ext-url-link)').addClass('pretty_photo'); 3416 }); 3417 3418 // Flexslider. 3419 $('.wpb_gallery_slides.wpb_flexslider:not([data-onclick="custom_link"])').each(function() { 3420 $(this).find('.slides > li > a').addClass('pretty_photo'); 3421 }); 3422 3423 // Touch enabled gallery. 3424 $('.wpb_gallery_slidesflickity_style, .wpb_gallery_slidesflickity_static_height_style').each(function() { 3425 $(this).find('.cell > a:not(.ext-url-link)').addClass('pretty_photo'); 3426 }); 3427 3428 // Add galleries to portfolios. 3429 $('.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() { 3430 3431 if ($(this).find('.pretty_photo').length > 0) { 3432 3433 $(this) 3434 .find('.pretty_photo') 3435 .removeClass('pretty_photo') 3436 .addClass('gallery') 3437 .addClass('magnific'); 3438 3439 } else if ($(this).find('a[rel*="prettyPhoto["]').length > 0) { 3440 3441 $(this) 3442 .find('a[rel*="prettyPhoto["]') 3443 .removeAttr('rel') 3444 .addClass('gallery') 3445 .addClass('magnific'); 3446 } 3447 3448 }); 3449 3450 $("a[data-rel='prettyPhoto[product-gallery]']").each(function() { 3451 $(this) 3452 .removeAttr('data-rel') 3453 .addClass('magnific') 3454 .addClass('gallery'); 3455 }); 3456 3457 // Nectar auto lightbox theme option. 3458 if ($body.hasClass('nectar-auto-lightbox')) { 3459 $('.gallery').each(function() { 3460 if ($(this).find('.gallery-icon a[rel^="prettyPhoto"]').length == 0) { 3461 3462 $(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"]') 3463 .addClass('magnific') 3464 .addClass('gallery') 3465 .removeClass('pretty_photo'); 3466 } 3467 }); 3468 3469 $('.main-content img').each(function() { 3470 3471 if ($(this).parent().is("[href]") && 3472 !$(this).parent().is(".magnific-popup") && 3473 $(this).parents('.tiled-gallery').length == 0 && 3474 $(this).parents('.product-image').length == 0 && 3475 $(this).parents('.iosSlider.product-slider').length == 0) { 3476 3477 var match = $(this).parent().attr('href').match(/\.(jpg|png|gif)\b/); 3478 if (match) { 3479 3480 $(this).parent() 3481 .addClass('magnific-popup') 3482 .addClass('image-link'); 3483 } 3484 } 3485 3486 }); 3487 3488 } 3489 3490 3491 // Regular. 3492 $('a.magnific-popup:not(.gallery):not(.nectar_video_lightbox)').magnificPopup({ 3493 type: 'image', 3494 callbacks: { 3495 imageLoadComplete: function() { 3496 var $that = this; 3497 setTimeout(function() { 3498 $that.wrap.addClass('mfp-image-loaded'); 3499 }, 10); 3500 }, 3501 beforeOpen: function() { 3502 this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim'); 3503 }, 3504 open: function() { 3505 3506 $.magnificPopup.instance.next = function() { 3507 var $that = this; 3508 3509 this.wrap.removeClass('mfp-image-loaded'); 3510 setTimeout(function() { 3511 $.magnificPopup.proto.next.call($that); 3512 }, 100); 3513 }; 3514 3515 $.magnificPopup.instance.prev = function() { 3516 var $that = this; 3517 3518 this.wrap.removeClass('mfp-image-loaded'); 3519 setTimeout(function() { 3520 $.magnificPopup.proto.prev.call($that); 3521 }, 100); 3522 }; 3523 3524 } 3525 },
3526 fixedContentPos: false, 3527 mainClass: 'mfp-zoom-in', 3528 removalDelay: 400 3529 }); 3530 3531 // Video. 3532 $('a.magnific-popup.nectar_video_lightbox, .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({ 3533 type: 'iframe', 3534 fixedContentPos: false, 3535 mainClass: 'mfp-zoom-in', 3536 removalDelay: 400 3537 }); 3538 3539 3540 // Galleries. 3541 $('a.magnific.gallery').each(function() { 3542 3543 var $parentRow = ($(this).closest('.wpb_column').length > 0) ? $(this).closest('.wpb_column') : $(this).parents('.row'); 3544 3545 if ($parentRow.length > 0 && !$parentRow.hasClass('lightbox-col')) { 3546 3547 $parentRow.magnificPopup({ 3548 type: 'image', 3549 delegate: 'a.magnific', 3550 mainClass: 'mfp-zoom-in', 3551 fixedContentPos: false, 3552 callbacks: { 3553 3554 elementParse: function(item) { 3555 3556 if ($(item.el).is('[href]') && $(item.el).attr('href').indexOf('iframe=true') != -1 || 3557 $(item.el).is('[href]') && $(item.el).attr('href').indexOf('https://www.youtube.com/watch') != -1) { 3558 item.type = 'iframe'; 3559 } else if ($(item.el).is('[href]') && $(item.el).attr('href').indexOf('video-popup-') != -1) { 3560 item.type = 'inline'; 3561 } else { 3562 item.type = 'image'; 3563 } 3564 }, 3565 3566 imageLoadComplete: function() { 3567 var $that = this; 3568 setTimeout(function() { 3569 $that.wrap.addClass('mfp-image-loaded'); 3570 }, 10); 3571 }, 3572 3573 beforeOpen: function() { 3574 this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim'); 3575 }, 3576 3577 open: function() { 3578 3579 // Self hosted video. 3580 if ($(this.content).find('.mejs-video video').length > 0 && $().mediaelementplayer) { 3581 $(this.content).find('.mejs-video video')[0].player.remove(); 3582 3583 var $that = this; 3584 setTimeout(function() { 3585 $($that.content).find('video').mediaelementplayer(); 3586 $($that.content).find('.mejs-video video')[0].player.play(); 3587 }, 50); 3588 3589 } 3590 3591 $.magnificPopup.instance.next = function() { 3592 var $that = this; 3593 3594 this.wrap.removeClass('mfp-image-loaded'); 3595 setTimeout(function() { 3596 $.magnificPopup.proto.next.call($that); 3597 3598 // Self hosted video. 3599 if ($($that.content).find('.mejs-video video').length > 0) { 3600 $($that.content).find('.mejs-video video')[0].play(); 3601 } 3602 3603 }, 100); 3604 }; 3605 3606 $.magnificPopup.instance.prev = function() { 3607 var $that = this; 3608 3609 this.wrap.removeClass('mfp-image-loaded'); 3610 setTimeout(function() { 3611 $.magnificPopup.proto.prev.call($that); 3612 3613 // Self hosted video. 3614 if ($($that.content).find('.mejs-video video').length > 0) { 3615 $($that.content).find('.mejs-video video')[0].play(); 3616 } 3617 }, 100); 3618 }; 3619 3620 }, 3621 3622 close: function() { 3623 // Self hosted video. 3624 if ($(this.content).find('.mejs-video video').length > 0) { 3625 $(this.content).find('.mejs-video video')[0].load(); 3626 } 3627 } 3628 }, 3629 removalDelay: 400, 3630 gallery: { 3631 enabled: true 3632 } 3633 }); 3634 3635 $parentRow.addClass('lightbox-col'); 3636 } 3637 3638 }); 3639 3640 } 3641 3642 3643 /** 3644 * Lightbox initialization. 3645 * 3646 * Determines which lightbox to use based on theme option. 3647 * 3648 * @since 8.0 3649 */ 3650 function lightBoxInit() { 3651 3652 setTimeout(function(){ 3653 if ($('body[data-ls="magnific"]').length > 0 || $('body[data-ls="pretty_photo"]').length > 0) { 3654 magnificInit(); 3655 } else if ($('body[data-ls="fancybox"]').length > 0) { 3656 fancyBoxInit(); 3657 } 3658 },100); 3659 3660 } 3661 3662 3663 /** 3664 * WPBakery page builder standard animations. 3665 * 3666 * @since 7.0 3667 * @see waypoints 3668 */ 3669 function vcWaypoints() { 3670 3671 $($fullscreenSelector + ' .wpb_animate_when_almost_visible').each(function () { 3672 3673 var $that = $(this), 3674 $vcOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : '90%', 3675 waypoint = new Waypoint({ 3676 element: $that, 3677 handler: function () { 3678 3679 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated')) { 3680 waypoint.destroy(); 3681 return; 3682 } 3683 3684 $that.addClass("animated"); 3685 $that.addClass("wpb_start_animation"); 3686 waypoint.destroy(); 3687 3688 if ($that.is('.nectar-button') && $('body[data-button-style*="rounded_shadow"]').length > 0) { 3689 setTimeout(function () { 3690 $that.removeClass('wpb_start_animation'); 3691 }, 1100); 3692 } 3693 3694 }, 3695 offset: $vcOffsetPos 3696 3697 }); 3698 3699 }); 3700 } 3701 3702 3703 /** 3704 * Nectar Rotating Words Title 3705 * 3706 * @since 13.0 3707 */ 3708 function NectarRotatingWords(el,dur) { 3709 3710 this.$el = el; 3711 this.duration = dur; 3712 3713 this.interval = ''; 3714 this.words = []; 3715 3716 this.state = { 3717 activeIndex: 0, 3718 sequenceStarted: 0, 3719 visible: false 3720 }; 3721 3722 this.setup(); 3723 3724 } 3725 3726 NectarRotatingWords.prototype.setup = function() { 3727 3728 var that = this; 3729 3730 this.$el.find('.dynamic-words > span').each(function(i) { 3731 that.words[i] = $(this); 3732 }); 3733 3734 // In View. 3735 this.viewportTracking(); 3736 3737 // Waypoint. 3738 if( this.$el.hasClass('element_stagger_words') ) { 3739 this.staggerWaypoint(); 3740 $(window).on('nectar-waypoints-reinit nectar-tab-changed', this.staggerWaypoint.bind(this)); 3741 } 3742 else { 3743 // Start sequence immediately. 3744 clearInterval(this.interval); 3745 3746 this.interval = setInterval(this.sequence.bind(this), this.duration); 3747 } 3748 3749 if( !nectarDOMInfo.usingMobileBrowser ) { 3750 $(window).on('resize', this.calcWidth.bind(this)); 3751 } else { 3752 window.addEventListener("orientationchange", this.calcWidth.bind(this)); 3753 } 3754 3755 }; 3756 3757 NectarRotatingWords.prototype.viewportTracking = function() { 3758 3759 var that = this; 3760 3761 if( 'IntersectionObserver' in window ) { 3762 3763 var options = { 3764 rootMargin: '0px', 3765 threshold: 0 3766 } 3767 3768 this.observer = new IntersectionObserver(function(entries) { 3769
3770 entries.forEach(function(entry) { 3771 if ( entry.isIntersecting ) { 3772 that.state.visible = true; 3773 } else { 3774 that.state.visible = false; 3775 } 3776 }); 3777 3778 }, options); 3779 3780 this.observer.observe(this.$el[0]); 3781 3782 3783 } else { 3784 // fallback. 3785 this.state.visible = true; 3786 } 3787 3788 } 3789 3790 NectarRotatingWords.prototype.calcWidth = function() { 3791 3792 var that = this; 3793 var storedWidth = this.$el.find('.dynamic-words').width(); 3794 3795 this.$el.find('.dynamic-words').css({ 'width': '' }); 3796 3797 var width = this.words[this.state.activeIndex].find('span').width(); 3798 3799 this.$el.find('.dynamic-words').css({ 3800 'width': storedWidth 3801 }); 3802 3803 setTimeout(function(){ 3804 that.$el.find('.dynamic-words').css({ 3805 'width': width 3806 }); 3807 },30); 3808 3809 } 3810 3811 NectarRotatingWords.prototype.sequence = function() { 3812 3813 if( this.$el.find('.dynamic-words > span').length < 2 || this.state.visible == false ) { 3814 return true; 3815 } 3816 3817 this.state.activeIndex = wrap( this.words.length, this.state.activeIndex + 1 ); 3818 3819 this.calcWidth(); 3820 3821 this.$el.find('.dynamic-words > span').removeClass('active'); 3822 3823 this.words[this.state.activeIndex].addClass('active'); 3824 3825 }; 3826 3827 NectarRotatingWords.prototype.staggerWaypoint = function() { 3828 3829 var that = this; 3830 3831 if( $fullscreenMarkupBool == true && this.$el.parents('.active').length == 0 ) { 3832 return true; 3833 } 3834 3835 // Generate Markup 3836 var animatedClass = ( $(this).hasClass('animated-in') ) ? ' animated' : ''; 3837 3838 this.$el.find('.beginning-text, .ending-text').each(function () { 3839 3840 var textArr = $(this).text(); 3841 textArr = textArr.trim(); 3842 textArr = textArr.split(' '); 3843 3844 $(this)[0].innerHTML = ''; 3845 3846 for (var i = 0; i < textArr.length; i++) { 3847 $(this)[0].innerHTML += '<span class="text-wrap"><span class="inner'+animatedClass+'">' + textArr[i] + '</span></span> '; 3848 } 3849 3850 }); 3851 3852 if( this.$el.hasClass('animated-in') ) { 3853 this.$el.find('.beginning-text .inner, .ending-text .inner').css({ 3854 'transform': 'translateY(0)' 3855 }); 3856 } 3857 3858 this.$el.addClass('markup-generated'); 3859 3860 // Waypoint. 3861 var offsetPos = ($fullscreenMarkupBool == true) ? '500%' : 'bottom-in-view'; 3862 3863 var $that = this.$el; 3864 var $delay = ( $that.is('[data-delay]') ) ? parseInt($that.attr('data-delay')) : 0; 3865 3866 var waypoint = new Waypoint({ 3867 element: $that, 3868 handler: function () { 3869 3870 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 3871 waypoint.destroy(); 3872 return; 3873 } 3874 3875 if (!bypassAnimations || $('body[data-responsive="0"]').length > 0) { 3876 3877 var $animationDurationCap; 3878 3879 setTimeout(function() { 3880 3881 var stagger = 0; 3882 stagger = 500 / $that.find('.text-wrap').length; 3883 stagger = Math.min(Math.max(stagger, 15), 50); // Clamp val 3884 3885 $animationDurationCap = (parseInt($animationDuration) < 1100) ? $animationDuration : '1100'; 3886 3887 var i = 0; 3888 $that.find('.text-wrap').each(function () { 3889 3890 var spanEl = $(this); 3891 3892 if( $(this).parents('.dynamic-words').length > 0 && !$(this).hasClass('active') ) { 3893 // hidden words in sequence. 3894 spanEl.find('> span').css({ 3895 'transform': 'translate3d(0,0,0)' 3896 }); 3897 return true; 3898 } 3899 3900 // visible words. 3901 setTimeout(function(){ 3902 spanEl.find('> span').css({ 3903 'transform': 'translate3d(0,0,0)' 3904 }); 3905 }, i * stagger); 3906 3907 i++; 3908 3909 });
3910 3911 $that.addClass('animated-in'); 3912 3913 }, $delay); 3914 3915 } 3916 3917 3918 // start sequence. 3919 if( that.state.sequenceStarted != true ) { 3920 clearInterval(that.interval); 3921 that.interval = setInterval(that.sequence.bind(that), that.duration); 3922 } 3923 3924 that.state.sequenceStarted = true; 3925 3926 waypoint.destroy(); 3927 }, 3928 offset: offsetPos 3929 }); 3930 3931 3932 } 3933 3934 3935 function nectarRotatingWordsInit() { 3936 3937 var rotatingTitles = []; 3938 3939 $('.nectar-rotating-words-title').each(function(i) { 3940 var duration = parseInt($(this).attr('data-rotation')); 3941 rotatingTitles[i] = new NectarRotatingWords($(this), duration); 3942 }); 3943 3944 } 3945 3946 3947 /** 3948 * Milestone element initialization. 3949 * 3950 * @since 4.0 3951 * @see waypoints 3952 */ 3953 function milestoneInit() { 3954 3955 $('.nectar-milestone').each(function () { 3956 3957 // Symbol 3958 if ($(this).is('[data-symbol]')) { 3959 3960 if ($(this).find('.symbol-wrap').length == 0) { 3961 3962 if ($(this).attr('data-symbol-pos') == 'before') { 3963 $(this) 3964 .find('.number') 3965 .prepend('<div class="symbol-wrap"><span class="symbol">' + $(this).attr('data-symbol') + '</span></div>'); 3966 } else { 3967 $(this) 3968 .find('.number') 3969 .append('<div class="symbol-wrap"><span class="symbol">' + $(this).attr('data-symbol') + '</span></div>'); 3970 } 3971 } 3972 3973 var $symbol_size; 3974 3975 if ($(this).attr('data-symbol-size') == $(this).find('.number').attr('data-number-size') && $(this).attr('data-symbol-alignment') == 'superscript') { 3976 $symbol_size = 32; 3977 } else { 3978 $symbol_size = parseInt($(this).attr('data-symbol-size')); 3979 } 3980 3981 $(this).find('.symbol-wrap').css({ 3982 'font-size': $symbol_size + 'px', 3983 'line-height': $symbol_size + 'px' 3984 }); 3985 } 3986 3987 $(this).find('.number').css({ 3988 'font-size': $(this).find('.number').attr('data-number-size') + 'px', 3989 'line-height': $(this).find('.number').attr('data-number-size') + 'px' 3990 }); 3991 }); 3992 3993 if (!bypassAnimations && $('.nectar-milestone').length > 0 || $body.hasClass('rtl') && $('.nectar-milestone').length > 0) { 3994 3995 // Blur effect 3996 var $blurCssString = ''; 3997 $($fullscreenSelector + '.nectar-milestone.motion_blur').each(function (i) { 3998 3999 $(this).removeClass(function (index, className) { 4000 return (className.match(/(^|\s)instance-\S+/g) || []).join(' '); 4001 }); 4002 4003 $(this).addClass('instance-' + i); 4004 4005 var $currentColor = $(this).find('.number').css('color'), 4006 colorInt = parseInt($currentColor.substring(1), 16); 4007 4008 var R = (colorInt & 0xFF0000) >> 16, 4009 G = (colorInt & 0x00FF00) >> 8, 4010 B = (colorInt & 0x0000FF) >> 0; 4011 4012 var $rgbaColorStart = 'rgba(' + R + ',' + G + ',' + B + ',0.2)', 4013 $rgbaColorEnd = 'rgba(' + R + ',' + G + ',' + B + ',1)', 4014 $numberSize = parseInt($(this).find('.number').attr('data-number-size')); 4015 4016 $blurCssString += '@keyframes motion-blur-number-' + i + ' { ' + 4017 ' 0% { ' + 4018 'opacity: 0;' + 4019 'color: ' + $rgbaColorStart + '; ' + 4020 '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 + '; ' + 4021 'transform: translateZ(0px) translateY(-100%); ' + 4022 '-webkit-transform: translateZ(0px) translateY(-100%); ' + 4023 '} ' + 4024 '33% { opacity: 1 }' + 4025 '100% { ' + 4026 'color: ' + $rgbaColorEnd + '; ' + 4027 'text-shadow: none; ' + 4028 'transform: translateZ(0px) translateY(0px); ' + 4029 '-webkit-transform: translateZ(0px) translateY(0px); ' + 4030 '} ' + 4031 '} ' + 4032 '@-webkit-keyframes motion-blur-number-' + i + ' { ' + 4033 ' 0% { ' + 4034 'opacity: 0;' + 4035 'color: ' + $rgbaColorStart + '; ' + 4036 '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 + '; ' + 4037 'transform: translateZ(0px) translateY(-100%); ' + 4038 '-webkit-transform: translateZ(0px) translateY(-100%); ' + 4039 '} ' + 4040 '33% { opacity: 1 }' + 4041 '100% { ' + 4042 'color: ' + $rgbaColorEnd + '; ' + 4043 'text-shadow: none; ' + 4044 'transform: translateZ(0px) translateY(0px); ' + 4045 '-webkit-transform: translateZ(0px) translateY(0px); ' + 4046 '} ' + 4047 '} ' + 4048 '.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 + '; } '; 4049 4050 if( $nectarFullPage.$usingFullScreenRows != false || $(this).find('.number > span').length == 0 ) { 4051 4052 // Separate each character into spans 4053 var $symbol = $(this).find('.symbol-wrap').clone(); 4054 $(this).find('.symbol-wrap').remove(); 4055 4056 var characters = $(this).find('.number').text().split(""); 4057 var $this = $(this).find('.number'); 4058 4059 $this.empty(); 4060 $.each(characters, function (i, el) { 4061 $this.append("<span>" + el + "</span"); 4062 });
4063 4064 // Handle symbol 4065 if ($(this).has('[data-symbol]')) { 4066 if ($(this).attr('data-symbol-pos') == 'after') { 4067 $this.append($symbol); 4068 } else { 4069 $this.prepend($symbol); 4070 } 4071 } 4072 4073 } // already made markup 4074 4075 }); 4076 4077 // Style 4078 nectarCreateStyle($blurCssString, 'milestone-blur'); 4079 4080 // Activate 4081 milestoneWaypoint(); 4082 4083 } 4084 4085 } 4086 4087 4088 /** 4089 * Milestone animation 4090 * 4091 * @since 4.0 4092 */ 4093 function milestoneWaypoint() { 4094 4095 $($fullscreenSelector + '.nectar-milestone').each(function () { 4096 4097 // Animation 4098 var $offset = ($fullscreenMarkupBool == true) ? '250%' : '98%'; 4099 4100 if( nectarDOMInfo.usingMobileBrowser && $offset == '98%') { 4101 $offset = '110%'; 4102 } 4103 4104 var $that = $(this), 4105 waypoint = new Waypoint({ 4106 element: $that, 4107 handler: function () { 4108 4109 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 4110 waypoint.destroy(); 4111 return; 4112 } 4113 4114 var $endNum = parseInt($that.find('.number span:not(.symbol)').text().replace(/,/g, '')); 4115 4116 if (!$that.hasClass('motion_blur')) { 4117 4118 var countOptions = { 4119 easingFn: easeOutCubic 4120 }; 4121 var $countEle = $that.find('.number span:not(.symbol)')[0]; 4122 var numAnim = new CountUp($countEle, 0, $endNum, 0, 2.2, countOptions); 4123 numAnim.start(); 4124 4125 } else { 4126 $that.find('span').each(function (i) { 4127 var $that = $(this); 4128 setTimeout(function () { 4129 $that.addClass('in-sight'); 4130 }, 200 * i); 4131 }); 4132 } 4133 4134 4135 $that.addClass('animated-in'); 4136 waypoint.destroy(); 4137 }, 4138 offset: $offset 4139 4140 }); 4141 4142 }); 4143 } 4144 4145 4146 4147 /** 4148 * Tabbed element change section event. 4149 * 4150 * @since 10.5 4151 */ 4152 function tabbedChangeSection(clickedTab) { 4153 4154 var $id = clickedTab.parents('li').index() + 1; 4155 var $frontEndEditorTabDiv = ($('body.vc_editor').length > 0) ? '> .wpb_tab ' : ''; 4156 4157 if (!clickedTab.hasClass('active-tab') && !clickedTab.hasClass('loading')) { 4158 4159 clickedTab.parents('ul') 4160 .find('a') 4161 .removeClass('active-tab'); 4162 4163 clickedTab 4164 .addClass('active-tab'); 4165 4166 clickedTab.parents('.tabbed').find('> div:not(.clear)' + $frontEndEditorTabDiv).css({ 4167 'visibility': 'hidden', 4168 'position': 'absolute', 4169 'opacity': '0', 4170 'left': '-9999px', 4171 'display': 'none' 4172 }).removeClass('visible-tab'); 4173 4174 if ($('body.vc_editor').length > 0) { 4175 4176 var $data_m_id = (clickedTab.parent().is('[data-m-id]')) ? clickedTab.parent().attr('data-m-id') : ''; 4177 4178 clickedTab.parents('.tabbed').find('> div[data-model-id="' + $data_m_id + '"]' + $frontEndEditorTabDiv).css({ 4179 'visibility': 'visible', 4180 'position': 'relative', 4181 'left': '0', 4182 'display': 'block' 4183 }).stop().transition({ 4184 'opacity': 1 4185 }, 400).addClass('visible-tab'); 4186 4187 if( !$body.is('[data-flex-cols="true"]') ) { 4188 convertFrontEndPadding(); 4189 } 4190 4191 } else { 4192 clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ')' + $frontEndEditorTabDiv).css({ 4193 'visibility': 'visible', 4194 'position': 'relative', 4195 'left': '0', 4196 'display': 'block' 4197 }).stop().transition({ 4198 'opacity': 1 4199 }, 400).addClass('visible-tab'); 4200 } 4201 4202 if (clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ') .iframe-embed').length > 0 || 4203 clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ') .portfolio-items').length > 0) { 4204 setTimeout(function () { 4205 $window.trigger('resize'); 4206 }, 10); 4207 } 4208 } 4209 4210 // Waypoint checking 4211 if ($tabbedClickCount != 0) { 4212 4213 var $currentVisTab = clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ')' + $frontEndEditorTabDiv); 4214 4215 if ($currentVisTab.find('.nectar-progress-bar').length > 0) { 4216 progressBars(); 4217 } 4218 if ($currentVisTab.find('.divider-small-border [data-animate="yes"]').length > 0 || 4219 $currentVisTab.find('.divider-border [data-animate="yes"]').length > 0) { 4220 dividers(); 4221 } 4222 if ($currentVisTab.find('img.img-with-animation').length > 0 || 4223 $currentVisTab.find('.col.has-animation').length > 0 || 4224 $currentVisTab.find('.nectar_cascading_images').length > 0 || 4225 $currentVisTab.find('.wpb_column.has-animation').length > 0) { 4226 colAndImgAnimations();
4227 cascadingImageBGSizing(); 4228 } 4229 if ($currentVisTab.find('.parallax-layer').length > 0 || $currentVisTab.parents('.nectar-parallax-enabled').length > 0) { 4230 parallaxRowsBGCals(); 4231 for(var i=0; i < parallaxItemsArr.length; i++ ) { 4232 parallaxItemsArr[i].resize(); 4233 } 4234 } 4235 if ($currentVisTab.find('.nectar-milestone').length > 0) { 4236 milestoneWaypoint(); 4237 } 4238 if ($currentVisTab.find('.nectar_image_with_hotspots[data-animation="true"]').length > 0) { 4239 imageWithHotspots(); 4240 setTimeout(function(){ 4241 $window.trigger('resize'); 4242 },100); 4243 } 4244 if ($currentVisTab.find('.nectar-fancy-ul').length > 0) { 4245 nectarFancyUlInit(); 4246 } 4247 if ($currentVisTab.find('.nectar-split-heading').length > 0) { 4248 splitLineHeadings(); 4249 } 4250 if ($currentVisTab.find('.wpb_column[data-border-animation="true"]').length > 0) { 4251 animatedColBorders(); 4252 } 4253 if ($currentVisTab.find('.wpb_animate_when_almost_visible').length > 0) { 4254 vcWaypoints(); 4255 } 4256 if ($currentVisTab.find('.nectar-animated-title').length > 0) { 4257 animatedTitles(); 4258 } 4259 if ($currentVisTab.find('.nectar-highlighted-text').length > 0) { 4260 highlightedText(); 4261 } 4262 if ($currentVisTab.find('.nectar_food_menu_item').length > 0) { 4263 foodMenuItems(); 4264 } 4265 if ($currentVisTab.find('.nectar-post-grid:not([data-animation="none"])').length > 0) { 4266 NectarPostGridWaypoint(); 4267 } 4268 4269 if (clickedTab.parents('.wpb_row').length > 0) { 4270 4271 if ($currentVisTab.find('.vc_pie_chart').length > 0 || 4272 $currentVisTab.find('.wp-video-shortcode').length > 0 || 4273 $currentVisTab.find('.post-area.masonry .posts-container').length > 0 || 4274 $currentVisTab.find('.twentytwenty-container').length > 0 || 4275 clickedTab.parents('#nectar_fullscreen_rows[data-content-overflow="scrollbar"]').length > 0 || 4276 clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ')').find('.wpb_gallery').length > 0 || 4277 clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ')').find('.swiper-container').length > 0 || 4278 clickedTab.parents('.wpb_row').next().hasClass('parallax_section')) { 4279 $window.trigger('resize'); 4280 } 4281 4282 if ($currentVisTab.find('.nectar-flickity').length > 0 && typeof Flickity != 'undefined') { 4283 var tabbedFlkty = Flickity.data(clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ')').find('.nectar-flickity')[0]); 4284 tabbedFlkty.resize(); 4285 } 4286 4287 if ($currentVisTab.find('.nectar-woo-flickity').length > 0 && typeof Flickity != 'undefined') { 4288 var wootabbedFlkty = Flickity.data(clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ')').find('.nectar-woo-flickity > ul')[0]); 4289 wootabbedFlkty.resize(); 4290 $(window).trigger('nectar-product-filters-layout'); 4291 } 4292 4293 } 4294 4295 //SVG icons 4296 $currentVisTab.find('.svg-icon-holder').each(function (i) { 4297 4298 var $that = $(this); 4299 4300 setTimeout(function () { 4301 4302 var $animationDelay = 0; 4303 4304 if($that.is('[data-animation-delay]') && 4305 $that.attr('data-animation-delay').length > 0 && 4306 $that.attr('data-animation') != 'false') { 4307 $animationDelay = $that.attr('data-animation-delay'); 4308 } 4309 4310 clearTimeout($animatedSVGIconTimeout[i]); 4311 4312 if ($that.attr('data-animation') == 'false') { 4313 $that.css('opacity', '1'); 4314 $svgIcons[$that.find('svg').attr('id').slice(-1)].finish(); 4315 } else { 4316 4317 $svgIcons[$that.find('svg').attr('id').slice(-1)].reset(); 4318 $animatedSVGIconTimeout[i] = setTimeout(function () { 4319 $svgIcons[$that.find('svg').attr('id').slice(-1)].play(); 4320 }, $animationDelay); 4321 4322 } 4323 }, 150); 4324 }); 4325 4326 } 4327 4328 // Fix columns inside tabs 4329 clickedTab.parents('.tabbed').find('.wpb_row').each(function () { 4330 if (typeof $(this).find('[class*="vc_col-"]').first().offset() != 'undefined') { 4331 4332 var $firstChildOffset = $(this).find('[class*="vc_col-"]').first().offset().left; 4333 4334 $(this).find('[class*="vc_col-"]').each(function () { 4335 $(this).removeClass('no-left-margin'); 4336 if ($(this).offset().left < $firstChildOffset + 15) { 4337 $(this).addClass('no-left-margin'); 4338 } else { 4339 $(this).removeClass('no-left-margin'); 4340 } 4341 });
4342 } 4343 4344 }); 4345 4346 $tabbedClickCount++; 4347 4348 // Magic line 4349 if (clickedTab.parent().parent().find('.magic-line').length > 0) { 4350 magicLineCalc(clickedTab); 4351 } 4352 4353 $(window).trigger('nectar-tab-changed'); 4354 4355 } 4356 4357 4358 /** 4359 * Tabbed element magic line - used for style "Minimal alt" 4360 * 4361 * @since 7.0 4362 */ 4363 function magicLineCalc($ele) { 4364 4365 var el, leftPos, ratio; 4366 4367 el = $ele.parent(); 4368 if (el.length) { 4369 leftPos = el.position().left; 4370 ratio = el.width(); 4371 } else { 4372 leftPos = ratio = 0; 4373 } 4374 4375 4376 $ele.parent().parent() 4377 .find('.magic-line') 4378 .css('transform', 'translateX(' + leftPos + 'px) scaleX(' + ratio + ')'); 4379 } 4380 4381 4382 /** 4383 * Tabbed element deep linking. 4384 * 4385 * @since 3.0 4386 */ 4387 function tabbbedDeepLinking() { 4388 4389 if (typeof nectarGetQueryParam['tab'] != 'undefined') { 4390 4391 $('.wpb_tabs_nav').each(function () { 4392 4393 $(this).find('li').each(function () { 4394 4395 var $currentText = $(this).find('a').clone(), 4396 $getText = nectarGetQueryParam['tab'], 4397 $that = $(this); 4398 4399 $currentText.find('svg').remove(); 4400 $currentText = $currentText.text(); 4401 $currentText = $currentText.replace(/\s+/g, '-').toLowerCase(); 4402 4403 // SVG icons. 4404 if( $currentText.length > 0 && $currentText.substring(0,1) === '-' ) { 4405 $currentText = $currentText.substring(1); 4406 } 4407 4408 $getText = $getText.replace(/\s+/g, '-').replace(/</g, '<').replace(/"/g, '"').toLowerCase(); 4409 4410 if ($currentText == $getText) { 4411 4412 $(this).find('a').trigger('click'); 4413 4414 setTimeout(function () { 4415 $that.find('a').trigger('click'); 4416 }, 501); 4417 } 4418 4419 }); 4420 4421 }); 4422 4423 } 4424 4425 } 4426 4427 4428 4429 /** 4430 * Tabbed element initialization. 4431 * 4432 * @since 3.0 4433 */ 4434 function tabbedInit() { 4435 4436 // Click event. 4437 $body.on('click', '.tabbed > ul li:not(.cta-button) a', function(e){ 4438 4439 tabbedChangeSection($(this)); 4440 4441 // Mobile scroll to. 4442 if (e.originalEvent !== undefined && nectarDOMInfo.winW < 1000 && $nectarFullPage.$usingFullScreenRows == false) { 4443 4444 // Ensure that it would be needed. 4445 var $tabbedNav = $(this).closest('.tabbed').find('> ul'); 4446 4447 if( $tabbedNav.height() > 350 ) { 4448 4449 var $scrollTopDistance = $tabbedNav.offset().top + $tabbedNav.height() - nectarDOMInfo.adminBarHeight; 4450 4451 if( $('#header-outer[data-mobile-fixed="1"]').length > 0 ) { 4452 $scrollTopDistance = $tabbedNav.offset().top + $tabbedNav.height() - $headerOuterEl.outerHeight() - nectarDOMInfo.adminBarHeight 4453 } 4454 4455 nectar_scrollToY($scrollTopDistance, 700, 'easeInOutQuint'); 4456 } 4457 4458 } 4459 4460 return false; 4461 }); 4462 4463 // Custom user def anchor click event helper. 4464 $('a[class*="nectar-tab-trigger"]').on('click', function(e) { 4465 4466 // verify the link is setup correct. 4467 if( !$(this).is('[href*="#"]') || $(this).attr('href').length < 1 ) { 4468 return true; 4469 } 4470 4471 var clickedTrigger = $(this).attr('href'); 4472 clickedTrigger = clickedTrigger.substr(1); 4473 clickedTrigger = clickedTrigger.replace(/\s+/g, '-').replace(/</g, '<').replace(/"/g, '"').toLowerCase(); 4474 4475 $('.wpb_tabs_nav').each(function () { 4476 4477 $(this).find('li').each(function () { 4478 4479 var $currentText = $(this).find('a').clone(); 4480 4481 $currentText.find('svg').remove(); 4482 $currentText = $currentText.text(); 4483 $currentText = $currentText.replace(/\s+/g, '-').toLowerCase(); 4484 4485 // SVG icons. 4486 if( $currentText.length > 0 && $currentText.substring(0,1) === '-' ) { 4487 $currentText = $currentText.substring(1); 4488 } 4489 4490 // trigger. 4491 if ($currentText == clickedTrigger) { 4492 $(this).find('a').trigger('click'); 4493 } 4494 4495 }); 4496 4497 }); 4498 4499 e.preventDefault(); 4500 4501 }); 4502 4503 4504 $('.tabbed').each(function () { 4505 4506 var $that; 4507 4508 // Handle icons 4509 $(this).find('.wpb_tab').each(function (i) { 4510 4511 if ($(this).is('[data-tab-icon]') && $(this).attr('data-tab-icon').length > 0) { 4512 4513 $(this) 4514 .parents('.tabbed') 4515 .addClass('using-icons'); 4516 4517 $(this) 4518 .parents('.tabbed') 4519 .find('.wpb_tabs_nav li:nth-child(' + (i + 1) + ') > a') 4520 .prepend('<i class="' + $(this).attr("data-tab-icon") + '"></i>'); 4521 4522 } 4523 4524 // SVG icons 4525 if ($(this).find('.im-icon-wrap.tab-icon').length > 0) { 4526 4527 var $svg_icon_markup = $(this).find('.im-icon-wrap.tab-icon').detach(); 4528 $(this).parents('.tabbed') 4529 .find('.wpb_tabs_nav li:nth-child(' + (i + 1) + ') > a') 4530 .prepend($svg_icon_markup); 4531 } 4532 4533 }); 4534 4535 4536 $(this).find('> ul li:first-child a').trigger('click'); 4537 4538 $that = $(this); 4539 4540 // Minimal alt effect 4541 setTimeout(function () { 4542 if ($that.is('[data-style="minimal_alt"]')) { 4543 $that.find('> ul').append('<li class="magic-line" />'); 4544 magicLineCalc($that.find('> ul > li:first-child > a')); 4545 } 4546 }, 100); 4547 4548 4549 }); 4550 4551 // Minimal alt resize event. 4552 if ( $('.tabbed[data-style="minimal_alt"]').length > 0 ) { 4553 $window.on('smartresize',function(){ 4554 4555 $('.tabbed[data-style="minimal_alt"]').each(function(){ 4556 4557 if( $(this).find('a.active-tab').length > 0 ) { 4558 magicLineCalc( $(this).find('a.active-tab') ); 4559 } 4560 4561 });
4562 4563 4564 }); 4565 4566 } 4567 4568 4569 tabbbedDeepLinking(); 4570 4571 // Vertical scrolling 4572 $('.nectar-scrolling-tabs').each(function(i) { 4573 if(!nectarDOMInfo.usingFrontEndEditor) { 4574 $verticalScrollingTabs[i] = new VerticalScrollingTabs($(this)); 4575 } 4576 }); 4577 4578 // Tab change event. 4579 $(window).on('nectar-tab-changed', wooProductCarouselAnimations); 4580 4581 4582 } 4583 4584 4585 /** 4586 * Vertical Scrolling Tabs 4587 * 4588 * @since 12.0 4589 */ 4590 4591 function VerticalScrollingTabs(el) { 4592 4593 this.$el = el; 4594 this.$tabContent = el.find('.scrolling-tab-content'); 4595 this.$lineEl = el.find('.scrolling-tab-nav .line'); 4596 this.observer = null; 4597 4598 this.domSetup(); 4599 this.highlightObserve(); 4600 // Sticky handled in NectarStickyEls(); 4601 4602 } 4603 4604 VerticalScrollingTabs.prototype.domSetup = function() { 4605 4606 var that = this; 4607 var href = ''; 4608 4609 4610 // Icons 4611 this.$el.find('.wpb_tab').each(function (i) { 4612 4613 if ($(this).is('[data-tab-icon]') && $(this).attr('data-tab-icon').length > 0) { 4614 that.$el.addClass('using-icons'); 4615 4616 href = that.$el.find('.wpb_tabs_nav li:nth-child(' + (i + 1) + ') a').attr('href'); 4617 4618 that.$el 4619 .find('.wpb_tabs_nav li:nth-child(' + (i + 1) + ')') 4620 .addClass('has-icon') 4621 .prepend('<a class="skip-hash" href="'+href+'"><i class="' + $(this).attr("data-tab-icon") + '"></i></a>'); 4622 } 4623 4624 // SVG icons 4625 if ($(this).find('.im-icon-wrap.tab-icon').length > 0) { 4626 4627 href = that.$el.find('.wpb_tabs_nav li:nth-child(' + (i + 1) + ') a').attr('href'); 4628 4629 var $svg_icon_markup = $(this).find('.im-icon-wrap.tab-icon').detach(); 4630 that.$el 4631 .find('.wpb_tabs_nav li:nth-child(' + (i + 1) + ')') 4632 .addClass('has-icon') 4633 .prepend('<a class="skip-hash svg-icon-link" href="'+href+'"></a>'); 4634 4635 that.$el.find('.wpb_tabs_nav li:nth-child(' + (i + 1) + ') .svg-icon-link').append($svg_icon_markup); 4636 4637 } 4638 4639 }); 4640 4641 4642 // First active 4643 this.$el.find('.scrolling-tab-nav .menu-item:first').addClass('active'); 4644 this.lineAnimation(); 4645 4646 // Only tab 4647 if( this.$el.find('.scrolling-tab-nav .menu-item').length == 1 ) { 4648 this.$el.find('.scrolling-tab-nav').addClass('single-tab'); 4649 } 4650 4651 var $tabContent = this.$el.find('.scrolling-tab-content'); 4652 4653 this.$el.find('.scrolling-tab-nav .menu-item').each(function(i) { 4654 4655 i = i+1; 4656 var $tab = $tabContent.find('> div:nth-child('+i+')'); 4657 4658 // Add titles to mobile 4659 var $title = $(this).html(); 4660 $tab.prepend('<div class="scrolling-tab-mobile-title"><div class="inner">' + wlEls($title) + '</div></div>'); 4661 $tab.find('.scrolling-tab-mobile-title a').contents().unwrap(); 4662 4663 // Create normal anchor relation. 4664 if( $tab ) { 4665 var id = $(this).find('a').attr('href'); 4666 id = id.substr(1); 4667 $tab.find('> .scrolling-tab-mobile-title').attr('id',id); 4668 $tab.removeAttr('id'); 4669 } 4670 4671 }); 4672 4673 this.$el.addClass('initalized'); 4674 4675 }; 4676 4677 VerticalScrollingTabs.prototype.highlightObserve = function() { 4678 4679 var that = this; 4680 4681 if( !(nectarDOMInfo.usingMobileBrowser && nectarDOMInfo.winW < 1000) ) { 4682 4683 if( 'IntersectionObserver' in window ) { 4684 4685 var rMarign = ($headerOuterEl.is('[data-remove-fixed="1"]')) ? '100px 0px 0px 0px' : '5px 0px 0px 0px'; 4686 4687 var options = { 4688 rootMargin: rMarign, 4689 threshold: 1 4690 } 4691 4692 this.observer = new IntersectionObserver(function(entries) { 4693 4694 entries.forEach(function(entry) { 4695 4696 var href = '#' + $(entry.target).attr('id'); 4697 var $menuItem = that.$el.find('.scrolling-tab-nav a[href="'+href+'"]'); 4698 4699 if (entry.isIntersecting && entry.intersectionRatio >= 1) { 4700 4701 $menuItem.parents('.menu-item').addClass('visible'); 4702 4703 } else { 4704 $menuItem.parents('.menu-item').removeClass('visible'); 4705 } 4706 4707 // Highlight 4708 var $firstVisLink = that.$el.find('.scrolling-tab-nav .menu-item.visible:first'); 4709 4710 // a link is visible 4711 if( $firstVisLink.length > 0 ) { 4712 that.$el.find('.scrolling-tab-nav .menu-item').removeClass('active'); 4713 $firstVisLink.addClass('active'); 4714 that.lineAnimation(); 4715 } 4716 4717 4718 });
4719 4720 }, options); 4721 4722 // Observe each section. 4723 this.$tabContent.find('> div > .scrolling-tab-mobile-title[id]').each(function() { 4724 that.observer.observe($(this)[0]); 4725 }); 4726 4727 } // if intersection observer. 4728 4729 } // don't trigger on mobile. 4730 4731 }; 4732 4733 VerticalScrollingTabs.prototype.lineAnimation = function() { 4734 4735 var activeItem = this.$el.find('.scrolling-tab-nav .active'); 4736 4737 if( activeItem.length == 0 ) { 4738 return; 4739 } 4740 4741 var itemOffset = parseInt(activeItem.position().top); 4742 var itemHeight = parseInt(activeItem.height()); 4743 4744 this.$lineEl.css({ 4745 'max-height': itemHeight + 'px', 4746 'transform' : 'translate3d(0px, '+itemOffset+'px, 0px)' 4747 }); 4748 4749 }; 4750 4751 4752 4753 4754 4755 4756 4757 4758 /** 4759 * Toggle Panels element deep linking. 4760 * 4761 * @since 3.0 4762 */ 4763 function accordionDeepLinking() { 4764 4765 if (typeof nectarGetQueryParam['toggle'] != 'undefined') { 4766 $('.toggles').each(function () { 4767 4768 $(this).find('.toggle').each(function () { 4769 var $currentText = $(this).find('h3 a').clone(); 4770 var $getText = nectarGetQueryParam['toggle']; 4771 4772 $($currentText).find('i').remove(); 4773 $currentText = $currentText.text(); 4774 $currentText = $currentText.replace(/\s+/g, '-').toLowerCase(); 4775 $getText = $getText.replace(/\s+/g, '-').replace(/</g, '<').replace(/"/g, '"').toLowerCase(); 4776 4777 if ($currentText == $getText) { 4778 $(this).find('h3 a').trigger('click'); 4779 } 4780 }); 4781 }); 4782 } 4783 4784 } 4785 4786 4787 4788 4789 function accordionSizing() { 4790 4791 $('.toggles').each(function(){ 4792 4793 var openToggle = $(this).find('.toggle.open'); 4794 4795 if( openToggle.length > 0 ) { 4796 4797 openToggle.each(function() { 4798 var openToggleInner = $(this).find('> div')[0]; 4799 openToggleInner.style.maxHeight = openToggleInner.scrollHeight + "px"; 4800 }); 4801 4802 } 4803 4804 4805 }); 4806 4807 } 4808 4809 /** 4810 * Toggle Panels element initialization. 4811 * 4812 * @since 3.0 4813 */ 4814 function accordionInit() { 4815 4816 setTimeout(function() { 4817 4818 $('.toggles.accordion:not([data-starting="closed"])').each(function () { 4819 4820 // Legacy. 4821 if( $(this).find('.toggle[data-inner-wrap="true"]').length == 0 ) { 4822 $(this).find('> .toggle').first().addClass('open').find('> div').show(); 4823 } else if(!nectarDOMInfo.usingFrontEndEditor) { 4824 var $firstToggle = $(this).find('> .toggle').first(); 4825 $firstToggle.addClass('open'); 4826 $firstToggle.find('> div')[0].style.maxHeight = $firstToggle.find('> div')[0].scrollHeight + "px"; 4827 } 4828 4829 $(this).find('> .toggle').first().find('a:not(.nectar-button) i').attr('class', 'fa fa-minus-circle'); 4830 4831 }); 4832 4833 setTimeout(accordionDeepLinking,300); 4834 4835 }, 60); 4836 4837 if( $('.toggle[data-inner-wrap="true"]').length > 0 ) { 4838 $window.on('smartresize', accordionSizing); 4839 } 4840 4841 } 4842 4843 function accordionClickEvents() { 4844 4845 4846 $body.on('click', '.toggle h3 a', function () { 4847 4848 // Regular toggle click event 4849 if (!$(this).parents('.toggles').hasClass('accordion')) { 4850 4851 // Legacy. 4852 if( $(this).parents('.toggle[data-inner-wrap="true"]').length == 0 ) { 4853 4854 $(this).parents('.toggle') 4855 .find('> div') 4856 .slideToggle(300); 4857 4858 } else { 4859 4860 var parentEl = $(this).parents('.toggle').find('> div')[0]; 4861 4862 if (parentEl.style.maxHeight) { 4863 parentEl.style.maxHeight = null; 4864 } else { 4865 parentEl.style.maxHeight = parentEl.scrollHeight + "px"; 4866 } 4867 4868 } 4869 4870 4871 $(this).parents('.toggle') 4872 .toggleClass('open'); 4873 4874 // Switch icon 4875 if ($(this).parents('.toggle').hasClass('open')) { 4876 $(this) 4877 .find('i') 4878 .attr('class', 'fa fa-minus-circle'); 4879 } else { 4880 $(this) 4881 .find('i') 4882 .attr('class', 'fa fa-plus-circle'); 4883 } 4884 4885 if ($(this).parents('.toggle').find('> div .iframe-embed').length > 0 && 4886 $(this).parents('.toggle').find('> div iframe.iframe-embed').height() == '0') { 4887 responsiveVideoIframes(); 4888 } 4889 4890 // toggles which contain images 4891 if( $(this).parents('.toggle').find('> div img').length > 0 && 4892 $(this).parents('.toggle').is('[data-inner-wrap="true"]') ) { 4893 4894 for(var j=1; j<10; j++ ) { 4895 setTimeout(accordionSizing, j*100); 4896 } 4897 } 4898 4899 if ($(this).parents('.full-width-content').length > 0) { 4900 setTimeout(function () { 4901 fullWidthContentColumns(); 4902 }, 300); 4903 } 4904 4905 if ($('#nectar_fullscreen_rows').length > 0) { 4906 setTimeout(function () { 4907 $window.trigger('smartresize'); 4908 }, 300); 4909 } 4910 return false; 4911 } 4912 }); 4913 4914 // Accordion click event 4915 $body.on('click', '.toggles.accordion .toggle h3 a', function (e) { 4916 4917 if ($(this).parents('.toggle').hasClass('open')) { 4918 return false; 4919 } 4920 4921 var $t; 4922 var $parentToggles = $(this).parents('.toggles'); 4923 var $parentToggle = $(this).parents('.toggle'); 4924 4925 4926 // Legacy. 4927 if( $(this).parents('.toggle[data-inner-wrap="true"]').length == 0 ) { 4928 4929 $parentToggles.find('.toggle > div').slideUp(300); 4930 $parentToggles.find('.toggle h3 a i').attr('class', 'fa fa-plus-circle'); 4931 $parentToggles.find('.toggle').removeClass('open'); 4932 $parentToggle.find('> div').slideDown(300); 4933 $parentToggle.addClass('open'); 4934 4935 } else { 4936 4937 // Mobile scroll to. 4938 if (e.originalEvent !== undefined && 4939 nectarDOMInfo.winW < 1000 && 4940 $parentToggles.find('.toggle.open').length > 0 && 4941 $nectarFullPage.$usingFullScreenRows == false) { 4942 4943 var $openToggle = $parentToggles.find('.toggle.open'); 4944 4945 setTimeout(function(){ 4946 var $scrollTopDistance = $parentToggle.offset().top - nectarDOMInfo.adminBarHeight; 4947 4948 if( $('#header-outer[data-mobile-fixed="1"]').length > 0 ) { 4949 $scrollTopDistance = $parentToggle.offset().top - $headerOuterEl.outerHeight() - nectarDOMInfo.adminBarHeight 4950 } 4951 4952 nectar_scrollToY($scrollTopDistance, 500, 'easeInOutQuint'); 4953 },50); 4954 4955 } 4956 4957 4958 var parentEl = $parentToggle.find('> div')[0]; 4959 4960 $parentToggles.find('.toggle > div').each(function(){ 4961 $(this)[0].style.maxHeight = null; 4962 });
4963 4964 $parentToggles.find('.toggle h3 a i').attr('class', 'fa fa-plus-circle'); 4965 $parentToggles.find('.toggle').removeClass('open'); 4966 4967 parentEl.style.maxHeight = parentEl.scrollHeight + "px"; 4968 4969 $parentToggle.addClass('open'); 4970 4971 } 4972 4973 4974 // Switch icon 4975 if ($parentToggle.hasClass('open')) { 4976 $(this).find('i').attr('class', 'fa fa-minus-circle'); 4977 } else { 4978 $(this).find('i').attr('class', 'fa fa-plus-circle'); 4979 } 4980 4981 if ($(this).parents('.full-width-content').length > 0) { 4982 clearTimeout($t); 4983 $t = setTimeout(function () { 4984 fullWidthContentColumns(); 4985 }, 400); 4986 } 4987 if ($('#nectar_fullscreen_rows').length > 0) { 4988 clearTimeout($t); 4989 $t = setTimeout(function () { 4990 $window.trigger('smartresize'); 4991 }, 400); 4992 } 4993 4994 return false; 4995 4996 }); 4997 4998 } 4999 5000 5001 /** 5002 * Sticky elements powered by CSS. 5003 * 5004 * @since 12.2 5005 */ 5006 function NectarStickyEls() { 5007 this.selectors = '.nectar-sticky-pos'; 5008 5009 if($(this.selectors).length === 0) { 5010 return; 5011 } 5012 5013 this.topOffset = 0; 5014 this.topOffsetCushion = 60; 5015 this.calcTopOffset(); 5016 this.resizeEvent(); 5017 $window.on('resize', this.resizeEvent.bind(this)); 5018 } 5019 5020 NectarStickyEls.prototype.calcTopOffset = function() { 5021 5022 if ($('.page-template-template-no-header-footer').length > 0 || 5023 $('.page-template-template-no-header').length > 0 || 5024 $('#header-outer[data-remove-fixed="1"]').length > 0 || 5025 $('body[data-header-format="left-header"]').length > 0 ) { 5026 this.topOffset = 0; 5027 } else { 5028 5029 var $headerNavSpace = $('#header-space').outerHeight(); 5030 var resize = 0; 5031 5032 // Resize effect. 5033 if( $('#header-outer[data-header-resize="1"]').length > 0 ) { 5034 var headerPadding = parseInt($headerOuterEl.attr('data-padding')) - parseInt($headerOuterEl.attr('data-padding')) / 1.8; 5035 resize = parseInt(logoShrinkNum) + headerPadding * 2; 5036 } 5037 5038 this.topOffset = parseInt($headerNavSpace) + resize + nectarDOMInfo.adminBarHeight; 5039 5040 // Condense effect. 5041 if ($('#header-outer[data-condense="true"]').length > 0) { 5042 5043 var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'), 5044 $headerHeightStored = $headerOuterEl.height(),
5045 $headerHeightCondensed = $headerHeightStored - (parseInt($headerSpan9.height()) + parseInt($('#header-outer #logo').css('margin-top'))); 5046 5047 this.topOffset = parseInt($headerNavSpace) + $headerHeightCondensed - nectarDOMInfo.adminBarHeight; 5048 5049 } 5050 5051 } 5052 5053 this.topOffset += this.topOffsetCushion; 5054 5055 5056 }; 5057 5058 NectarStickyEls.prototype.resizeEvent = function() { 5059 5060 if( nectarDOMInfo.winW > 1000 ) { 5061 5062 this.calcTopOffset(); 5063 5064 $(this.selectors).css({ 5065 'position':'sticky', 5066 'top': this.topOffset 5067 }); 5068 } else { 5069 $(this.selectors).css({ 5070 'position': '', 5071 'top': '' 5072 }); 5073 } 5074 5075 }; 5076 5077 5078 /** 5079 * Color hex to rgb 5080 * 5081 * @since 3.0 5082 */ 5083 function shadeColor(hex, lum) { 5084 5085 // Validate hex string 5086 hex = String(hex).replace(/[^0-9a-f]/gi, ''); 5087 if (hex.length < 6) { 5088 hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2]; 5089 } 5090 lum = lum || 0; 5091 5092 // Convert to decimal and change luminosity 5093 var rgb = "#", 5094 c, i; 5095 for (i = 0; i < 3; i++) { 5096 c = parseInt(hex.substr(i * 2, 2), 16); 5097 c = Math.round(Math.min(Math.max(0, c + (c * lum)), 255)).toString(16); 5098 rgb += ("00" + c).substr(c.length); 5099 } 5100 5101 return rgb; 5102 } 5103 5104 /** 5105 * Jumbo size 3D nectar button. 5106 * 5107 * @since 3.0 5108 */ 5109 function createExtraJumboSize() { 5110 5111 $('.nectar-3d-transparent-button').each(function () { 5112 5113 if ($(this).css('visibility') != 'visible') { 5114 return; 5115 } 5116 5117 var $that = $(this), 5118 $size = $that.attr('data-size'), 5119 $padding = 0; 5120 5121 var $vert_height_divider = 1.7; 5122 5123 if ($size == 'extra_jumbo') { 5124 5125 var $font_size; 5126 5127 if (nectarDOMInfo.winW < 1000 && nectarDOMInfo.winW > 690) { 5128 $padding = 64; 5129 $font_size = 34; 5130 $that.find('.back-3d rect').attr('stroke-width', '12'); 5131 $vert_height_divider = 1.7; 5132 } else if (nectarDOMInfo.winW <= 690) { 5133 $padding = 46; 5134 $font_size = 16; 5135 $that.find('.back-3d rect').attr('stroke-width', '10'); 5136 $vert_height_divider = 1.7; 5137 } else { 5138 $padding = 100; 5139 $font_size = 64; 5140 $that.find('.back-3d rect').attr('stroke-width', '20'); 5141 $vert_height_divider = 1.6; 5142 } 5143 5144 5145 $that.find('svg text').attr('font-size', $font_size); 5146 5147 var $boundingRect = $(this).find('.back-3d .button-text')[0].getBoundingClientRect(), 5148 $text_width = $boundingRect.width, 5149 $text_height = $font_size * 1.5; 5150 5151 $that.css({ 5152 'width': ($text_width + $padding * 1.5) + 'px', 5153 'height': ($text_height + $padding) + 'px' 5154 }); 5155 5156 $that.find('> a').css({ 5157 'height': ($text_height + $padding) + 'px' 5158 }); 5159 5160 $that.find('.back-3d svg, .front-3d svg').css({ 5161 'width': ($text_width + $padding * 1.5) + 'px', 5162 'height': ($text_height + $padding) + 'px' 5163 }).attr('viewBox', '0 0 ' + ($text_width + $padding * 1.5) + ' ' + ($text_height + $padding)); 5164 5165 $that.find('svg text').attr('transform', 'matrix(1 0 0 1 ' + ($text_width + $padding * 1.6) / 2 + ' ' + (($text_height + $padding) / $vert_height_divider) + ')'); 5166 $that.find('.front-3d ').css('transform-origin', '50% 50% -' + ($text_height + $padding) / 2 + 'px'); 5167 $that.find('.back-3d').css('transform-origin', '50% 50% -' + ($text_height + $padding) / 2 + 'px'); 5168 5169 } 5170 5171 }); 5172 5173 } 5174 5175 5176 /** 5177 * Nectar Button custom coloring 5178 * 5179 * @since 3.0 5180 */ 5181 function coloredButtons() { 5182 5183 $('.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 () { 5184 5185 var $usingMaterialSkin = ($('body.material[data-button-style^="rounded"]').length > 0) ? true : false; 5186 $(this).css('visibility', 'visible'); 5187 5188 if ($(this).hasClass('see-through-3') && $(this).attr('data-color-override') == 'false') { 5189 return true; 5190 } 5191 5192 var $color; 5193 var $that; 5194 5195 if ($(this).attr('data-color-override') != 'false') { 5196 $color = $(this).attr('data-color-override'); 5197 } else { 5198
5199 if ($(this).parents('.dark').length > 0) { 5200 $color = '#000000'; 5201 } else { 5202 $color = '#ffffff'; 5203 } 5204 5205 } 5206 5207 if (!$(this).hasClass('see-through-3')) { 5208 $(this).css('color', $color); 5209 } 5210 5211 $(this).find('i').css('color', $color); 5212 5213 var colorInt = parseInt($color.substring(1), 16); 5214 var $hoverColor = ($(this).has('[data-hover-color-override]')) ? $(this).attr('data-hover-color-override') : 'no-override'; 5215 var $hoverTextColor = ($(this).has('[data-hover-text-color-override]')) ? $(this).attr('data-hover-text-color-override') : '#fff'; 5216 5217 var R = (colorInt & 0xFF0000) >> 16; 5218 var G = (colorInt & 0x00FF00) >> 8; 5219 var B = (colorInt & 0x0000FF) >> 0; 5220 5221 var $opacityStr = ($(this).hasClass('see-through-3')) ? '1' : '0.75'; 5222 5223 $(this).css('border-color', 'rgba(' + R + ',' + G + ',' + B + ',' + $opacityStr + ')'); 5224 5225 // Material theme skin buttons w/ icons starting 5226 if ($usingMaterialSkin) { 5227 $(this).find('i').css({ 5228 'background-color': 'rgba(' + R + ',' + G + ',' + B + ',1)', 5229 'box-shadow': '0px 8px 15px rgba(' + R + ',' + G + ',' + B + ',0.24)' 5230 }); 5231 } 5232 5233 if ($(this).hasClass('see-through')) { 5234 5235 $that = $(this); 5236 5237 $(this).on('mouseenter touchstart', function () { 5238 $that.css('border-color', 'rgba(' + R + ',' + G + ',' + B + ',1)'); 5239 }); 5240 5241 $(this).on('mouseleave touchtouchend', function () { 5242 $that.css('border-color', 'rgba(' + R + ',' + G + ',' + B + ',1)'); 5243 $opacityStr = ($(this).hasClass('see-through-3')) ? '1' : '0.75'; 5244 $that.css('border-color', 'rgba(' + R + ',' + G + ',' + B + ',' + $opacityStr + ')'); 5245 }); 5246 5247 } else { 5248 5249 $(this).find('i').css('color', $hoverTextColor); 5250 5251 if ($hoverColor != 'no-override') { 5252 5253 $that = $(this); 5254 5255 $(this).on('mouseenter touchstart', function () { 5256 5257 $that.css({ 5258 'border-color': $hoverColor, 5259 'background-color': $hoverColor, 5260 'color': $hoverTextColor 5261 });
5262 5263 // Material buttons w/ icons over 5264 if ($usingMaterialSkin) { 5265 $that.find('i').css({ 5266 'background-color': '', 5267 'box-shadow': '' 5268 }); 5269 } 5270 }); 5271 5272 $(this).on('mouseleave touchtouchend', function () { 5273 5274 $opacityStr = ($(this).hasClass('see-through-3')) ? '1' : '0.75'; 5275 5276 if ($usingMaterialSkin) { 5277 $that.find('i').css({ 5278 'background-color': 'rgba(' + R + ',' + G + ',' + B + ',1)', 5279 'box-shadow': '0px 8px 15px rgba(' + R + ',' + G + ',' + B + ',0.24)' 5280 }); 5281 } 5282 5283 if (!$that.hasClass('see-through-3')) { 5284 $that.css({ 5285 'border-color': 'rgba(' + R + ',' + G + ',' + B + ',' + $opacityStr + ')', 5286 'background-color': 'transparent', 5287 'color': $color 5288 }); 5289 } else { 5290 $that.css({ 5291 'border-color': 'rgba(' + R + ',' + G + ',' + B + ',' + $opacityStr + ')', 5292 'background-color': 'transparent' 5293 }); 5294 } 5295 5296 }); 5297 5298 } else { 5299 5300 $that = $(this); 5301 5302 $(this).on('mouseenter touchstart', function () { 5303 5304 $that.css({ 5305 'border-color': $hoverColor, 5306 'color': $hoverTextColor 5307 });
5308 5309 }); 5310 5311 $(this).on('mouseleave touchtouchend', function () { 5312 5313 $opacityStr = ($that.hasClass('see-through-3')) ? '1' : '0.75'; 5314 $that.css({ 5315 'border-color': 'rgba(' + R + ',' + G + ',' + B + ',' + $opacityStr + ')', 5316 'color': $hoverTextColor 5317 }); 5318 5319 }); 5320 5321 } 5322 } 5323 }); 5324 5325 $('.nectar-button:not(.see-through):not(.see-through-2):not(.see-through-3)[data-color-override]').each(function () { 5326 5327 $(this).css('visibility', 'visible'); 5328 5329 if ($(this).attr('data-color-override') != 'false') { 5330 5331 var $color = $(this).attr('data-color-override'); 5332 5333 $(this) 5334 .removeClass('accent-color') 5335 .removeClass('extra-color-1') 5336 .removeClass('extra-color-2') 5337 .removeClass('extra-color-3') 5338 .css('background-color', $color); 5339 } 5340 5341 }); 5342 5343 5344 // Solid color tilt 5345 if ($('.swiper-slide .solid_color_2').length > 0 || $('.tilt-button-inner').length > 0) { 5346 5347 var $tiltButtonCssString = ''; 5348 var $color; 5349 5350 $('.swiper-slide .solid_color_2 a').each(function (i) { 5351 5352 $(this).addClass('instance-' + i); 5353 5354 if ($(this).attr('data-color-override') != 'false') { 5355 $color = $(this).attr('data-color-override'); 5356 } else { 5357 if ($(this).parents('.dark').length > 0) { 5358 $color = '#000000'; 5359 } 5360 else { 5361 $color = '#ffffff'; 5362 } 5363 } 5364 5365 $(this).css('color', $color); 5366 $(this).find('i').css('color', $color); 5367 5368 var $currentColor = $(this).css('background-color'), 5369 $topColor = shadeColor($currentColor, 0.13), 5370 $bottomColor = shadeColor($currentColor, -0.15); 5371 5372 $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 + '; } '; 5373 5374 }); 5375 5376 5377 $('.tilt-button-wrap a').each(function (i) { 5378 5379 $(this).addClass('instance-' + i); 5380 5381 var $currentColor = $(this).css('background-color'); 5382 var $color; 5383 5384 if ($(this).attr('data-color-override') != 'false') { 5385 $color = $(this).attr('data-color-override'); 5386 $(this).css('background-color', $color); 5387 $currentColor = $color; 5388 } 5389 5390 var $topColor = shadeColor($currentColor, 0.13), 5391 $bottomColor = shadeColor($currentColor, -0.15); 5392 5393 $tiltButtonCssString += '.tilt-button-wrap a.instance-' + i + ':after { background-color: ' + $topColor + '; }' + ' .tilt-button-wrap a.instance-' + i + ':before { background-color: ' + $bottomColor + '; } '; 5394 5395 }); 5396 5397 // Style 5398 nectarCreateStyle($tiltButtonCssString, 'tilt-button'); 5399 5400 } 5401 5402 5403 // Transparent 3D 5404 if ($('.nectar-3d-transparent-button').length > 0) { 5405 5406 var $3dTransButtonCssString = ''; 5407 $('.nectar-3d-transparent-button').each(function (i) { 5408 5409 var $that = $(this), 5410 $size = $that.attr('data-size'), 5411 $padding = 0, 5412 v1 = 1.5, 5413 v2 = 1.65, 5414 $font_size; 5415 5416 // Size 5417 if ($size == 'large') { 5418 $padding = 46; 5419 $font_size = 16; 5420 v1 = 1.5; 5421 v2 = 1.7; 5422 } else if ($size == 'medium') { 5423 $padding = 30; 5424 $font_size = 16; 5425 } else if ($size == 'small') { 5426 $padding = 20; 5427 $font_size = 12; 5428 } else if ($size == 'jumbo') { 5429 $padding = 54; 5430 $font_size = 24; 5431 v1 = 1.5; 5432 v2 = 1.68; 5433 } else if ($size == 'extra_jumbo') { 5434 $padding = 100; 5435 $font_size = 64; 5436 v1 = 1.6; 5437 v2 = 1.6; 5438 } 5439 5440 $that.find('svg text').attr('font-size', $font_size); 5441 5442 var $boundingRect = $(this).find('.back-3d .button-text')[0].getBoundingClientRect(), 5443 $text_width = $boundingRect.width, 5444 $text_height = $font_size * 1.5; 5445 5446 $that.css({ 5447 'width': ($text_width + $padding * 1.5) + 'px', 5448 'height': ($text_height + $padding) + 'px' 5449 });
5450 5451 $that.find('> a').css({ 5452 'height': ($text_height + $padding) + 'px' 5453 }); 5454 5455 $that.find('.back-3d svg, .front-3d svg').css({ 5456 'width': ($text_width + $padding * 1.5) + 'px', 5457 'height': ($text_height + $padding) + 'px' 5458 }).attr('viewBox', '0 0 ' + ($text_width + $padding * 1.5) + ' ' + ($text_height + $padding)); 5459 5460 $that.find('svg text').attr('transform', 'matrix(1 0 0 1 ' + ($text_width + $padding * v1) / 2 + ' ' + (($text_height + $padding) / v2) + ')'); 5461 $that.find('.front-3d, .back-3d').css('transform-origin', '50% 50% -' + ($text_height + $padding) / 2 + 'px'); 5462 5463 // Mask 5464 $(this).find('.front-3d svg > rect').attr('id', 'masked-rect-id-' + i); 5465 $(this).find('.front-3d defs mask').attr('id', 'button-text-mask-' + i); 5466 5467 $that.css('visibility', 'visible'); 5468 $3dTransButtonCssString += '#masked-rect-id-' + i + ' { mask: url(#button-text-mask-' + i + '); -webkit-mask: url(#button-text-mask-' + i + ')} '; 5469 5470 }); 5471 5472 // Extra jumbo resize 5473 createExtraJumboSize(); 5474 $window.on('smartresize', createExtraJumboSize); 5475 5476 // Style 5477 nectarCreateStyle($3dTransButtonCssString, 'nectar-td-button'); 5478 5479 } 5480 5481 // Gradient btn init 5482 setTimeout(function () { 5483 $('.nectar-button[class*="color-gradient"] .start').removeClass('loading'); 5484 }, 150); 5485 // No grad for ff 5486 if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1 || 5487 navigator.userAgent.indexOf("MSIE ") > -1 || 5488 navigator.userAgent.match(/Trident\/7\./)) { 5489 $('.nectar-button[class*="color-gradient"] .start').addClass('no-text-grad'); 5490 } 5491 } 5492 5493 5494 5495 5496 /** 5497 * Shortcode icon large style 5498 * 5499 * @since 1.0 5500 */ 5501 function largeIconHover() { 5502 $('.icon-3x').each(function () { 5503 $(this).closest('.col').on('mouseenter', function () { 5504 $(this).find('.icon-3x').addClass('hovered'); 5505 }); 5506 5507 $(this).closest('.col').on('mouseleave', function () { 5508 $(this).find('.icon-3x').removeClass('hovered'); 5509 }); 5510 }); 5511 5512 if (navigator.userAgent.indexOf("MSIE ") > -1 || navigator.userAgent.match(/Trident\/7\./)) { 5513 $('[class^="icon-"][class*="color-gradient"], .nectar_icon_wrap[data-color*="extra-color-gradient"] .nectar_icon, .nectar-gradient-text').addClass('no-grad'); 5514 } 5515 } 5516 5517 5518 5519 /** 5520 * Team member element - fullscreen style. 5521 * 5522 * @since 7.0 5523 */ 5524 function teamMemberFullscreen() { 5525 5526 if ( $('.team-member').length === 0 ) { 5527 return; 5528 } 5529 5530 // Open click event 5531 $body.on('click', '.team-member[data-style="bio_fullscreen"], .team-member[data-style="bio_fullscreen_alt"]', function () { 5532 5533 if ($('.nectar_team_member_overlay').length > 0) { 5534 return; 5535 } 5536 5537 var $usingBoxedClass = ($('body > #boxed').length > 0) ? 'in-boxed' : '', 5538 $teamMemberMeta = $(this).find('.nectar_team_bio').html(), 5539 $teamMemberTitle = ($(this).is('[data-style="bio_fullscreen_alt"]')) ? $(this).find('.team-meta h5').text() : $(this).find('.team-meta p').text(), 5540 $teamMemberImg = ($(this).find('.nectar_team_bio_img[data-img-src]').length > 0) ? $(this).find('.nectar_team_bio_img').attr('data-img-src') : '', 5541 $teamMemberStyle = ($(this).is('[data-style="bio_fullscreen_alt"]')) ? 'bio-fullscreen-alt' : 'bio-fullscreen', 5542 $teamName = ''; 5543 5544 if($(this).is('[data-style="bio_fullscreen_alt"]')) { 5545 $teamName = '<div class="title">' + $teamMemberTitle + '</div><h2>' + $(this).find('.team-meta h3').text() + '</h2>'; 5546 } else { 5547 $teamName = '<h2>' + $(this).find('.team-meta h3').text() + '</h2><div class="title">' + $teamMemberTitle + '</div>'; 5548 } 5549 5550 $body.append('<div class="nectar_team_member_overlay ' + $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>'); 5551 5552 if ($teamMemberImg.length > 0) { 5553
5554 // Fade in img on load 5555 var teamTmpImg = new Image(); 5556 teamTmpImg.src = $teamMemberImg; 5557 teamTmpImg.onload = function () { 5558 $('.nectar_team_member_overlay .team_member_image').css('opacity', '1'); 5559 }; 5560 $('.nectar_team_member_overlay .team_member_image').css({ 5561 'background-image': 'url("' + $teamMemberImg + '")' 5562 }); 5563 } 5564 5565 var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $window.width() > 1000) ? 0 : $headerOuterEl.height(); 5566 $('.nectar_team_member_overlay .inner-wrap').css({ 5567 'padding-top': $headerNavSpace 5568 }); 5569 5570 // No-scroll class - ios ready 5571 if ($('.using-mobile-browser').length > 0) { 5572 $('body,html').addClass('nectar-no-scrolling'); 5573 } 5574 5575 teamFullscreenResize(); 5576 5577 // Transition in 5578 $('.nectar_team_member_overlay') 5579 .addClass('open') 5580 .addClass('animating'); 5581 5582 setTimeout(function () { 5583 $('.nectar_team_member_close').addClass('visible'); 5584 $('.nectar_team_member_overlay').removeClass('animating'); 5585 }, 500); 5586 5587 if ($('.team-member[data-style="bio_fullscreen"]').length > 0 && nectarDOMInfo.usingMobileBrowser) { 5588 $('.nectar_team_member_overlay').addClass('on-mobile'); 5589 } 5590 5591 }); 5592 5593 // Close click event 5594 $body.on('click', '.nectar_team_member_overlay', function () { 5595 5596 if (!$(this).hasClass('animating')) { 5597 5598 $('.nectar_team_member_overlay').removeClass('open'); 5599 $('.nectar_team_member_close').removeClass('visible'); 5600 5601 if ($('.using-mobile-browser').length > 0) { 5602 $('body,html').removeClass('nectar-no-scrolling'); 5603 } 5604 5605 setTimeout(function () { 5606 5607 $('.nectar_team_member_overlay, .nectar_team_member_close').remove(); 5608 5609 }, 820); 5610 } 5611 }); 5612 5613 if ($('.team-member[data-style="bio_fullscreen"]').length > 0 || $('.team-member[data-style="bio_fullscreen_alt"]').length > 0) { 5614 $window.on('resize', teamFullscreenResize); 5615 if( !nectarDOMInfo.usingMobileBrowser ) { 5616 var closeIndicator = new NectarIconMouseFollow('','close-indicator'); 5617 } 5618 5619 } 5620 5621 } 5622 5623 5624 /** 5625 * Team member element fullscreen resize event. 5626 * 5627 * @since 7.0 5628 */ 5629 function teamFullscreenResize() { 5630 var $leftHeaderSize = ($('body[data-header-format="left-header"]').length > 0 && $window.width() > 1000) ? 275 : 0; 5631 $('.nectar_team_member_overlay').css({ 5632 'width': $window.width() - $leftHeaderSize, 5633 'left': $leftHeaderSize 5634 }); 5635 } 5636 5637 5638 /** 5639 * WPBakery column element BG hover 5640 * 5641 * @since 5.0 5642 */ 5643 function columnBGColors() { 5644 5645 var $columnColorCSS = ''; 5646 5647 $('.wpb_column').each(function (i) { 5648 5649 $(this).removeClass(function (index, className) { 5650 return (className.match(/(^|\s)instance-\S+/g) || []).join(' '); 5651 }); 5652 5653 if( $(this).attr('data-has-bg-color') == 'true' || $(this).is('[data-hover-bg^="#"]') ) { 5654 $(this).addClass('instance-' + i); 5655 } 5656 5657 5658 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 ' : ''; 5659 var $innerWrapSelector = ( $(this).find($innerSelector + ' > .column-bg-overlay-wrap').length > 0 ) ? '> .column-bg-overlay-wrap ' : ''; 5660 5661 // BG color 5662 if ($(this).attr('data-has-bg-color') == 'true') { 5663 $columnColorCSS += '.wpb_column.instance-' + i + $innerSelector + $innerWrapSelector + ' > .column-bg-overlay { background-color:' + $(this).attr('data-bg-color') + '; opacity: ' + $(this).attr('data-bg-opacity') + '; }'; 5664 } 5665 5666 // Hover bg color 5667 if ($(this).is('[data-hover-bg^="#"]')) { 5668 $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; }'; 5669 } 5670 });
5671 5672 // Style 5673 nectarCreateStyle($columnColorCSS, 'column-bg-colors'); 5674 5675 } 5676 5677 5678 5679 /** 5680 * Displace filter column/row BG effect 5681 * 5682 * @since 10.5 5683 */ 5684 function nectarLiquidBGs() { 5685 $liquidBG_EL = []; 5686 5687 if (typeof NectarLiquid == 'undefined' || nectarDOMInfo.usingFrontEndEditor) { 5688 return; 5689 } 5690 5691 $('.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) { 5692 5693 var $that_el = $(this); 5694 var $type; 5695 var $el_type; 5696 5697 if ($(this).is('.row-bg')) { 5698 $type = $(this).parents('.row-bg-wrap').attr('data-bg-animation'); 5699 $el_type = 'row'; 5700 } 5701 else if ($(this).is('.column-image-bg')) { 5702 $type = $(this).parents('.column-image-bg-wrap').attr('data-bg-animation'); 5703 $el_type = 'col'; 5704 } 5705 5706 $liquidBG_EL[i] = new NectarLiquid($that_el, $type, $el_type); 5707 5708 }); 5709 } 5710 5711 5712 5713 /** 5714 * Morphing outline element creation. 5715 * 5716 * @since 5.0 5717 */ 5718 function morphingOutlines() { 5719 5720 if ($('.morphing-outline').length > 0) { 5721 5722 var $morphingOutlineCSS = '', 5723 $frontEndEditorMOSelector = ($('body.vc_editor').length > 0) ? '' : '>'; 5724 5725 $('.morphing-outline').each(function (i) { 5726 5727 $(this).removeClass(function (index, className) { 5728 return (className.match(/(^|\s)instance-\S+/g) || []).join(' '); 5729 }); 5730 5731 $(this).addClass('instance-' + i).css({ 5732 'visibility': 'visible' 5733 }); 5734 5735 var $width = $(this).find('.inner').width(), 5736 $height = $(this).find('.inner').height(), 5737 $border = parseInt($(this).attr("data-border-thickness")), 5738 $hover = ($('body[data-button-style*="rounded"]').length > 0) ? ':hover' : '', 5739 $hover2 = ($('body[data-button-style*="rounded"]').length > 0) ? '' : ':hover'; 5740 5741 $morphingOutlineCSS += 'body .morphing-outline.instance-' + i + ' .inner > * { color: ' + $(this).attr("data-starting-color") + '; } '; 5742 $morphingOutlineCSS += 'body .morphing-outline.instance-' + i + ' .inner:after { border-width:' + $(this).attr("data-border-thickness") + 'px ; border-color: ' + $(this).attr("data-starting-color") + '; } '; 5743 5744 $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") + '; } '; 5745 $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") + '; } '; 5746 5747 // Padding calcs 5748 $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}'; 5749 $morphingOutlineCSS += '.morphing-outline.instance-' + i + ' { padding: ' + (30 + ($width + 80 + $border * 2 - $height) / 2 - $border) + 'px 50px}'; 5750 $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 }'; 5751 5752 $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 }'; 5753 5754 // Hover 5755 $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}'; 5756 $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 }'; 5757 5758 });
5759 5760 // Style 5761 nectarCreateStyle($morphingOutlineCSS, 'morphing-outlines'); 5762 5763 } 5764 5765 } 5766 5767 5768 /** 5769 * Morphing outline element initialization. 5770 * 5771 * @since 5.0 5772 */ 5773 function morphingOutlinesInit() { 5774 5775 if($('.morphing-outline').length > 0) { 5776 5777 // Create style. 5778 setTimeout(morphingOutlines, 100); 5779 setTimeout(fullWidthContentColumns, 125); 5780 5781 // Handle resize. 5782 $window.on('smartresize', morphingOutlines); 5783 5784 } 5785 5786 } 5787 5788 5789 5790 /** 5791 * SVG icon element animations 5792 * 5793 * @since 6.0 5794 * @see waypoints 5795 */ 5796 function svgAnimations() { 5797 5798 var $svgOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : 'bottom-in-view'; 5799 5800 if ($svgIcons.length == 0) { 5801 5802 $('.svg-icon-holder:not(.animated-in)').has('svg').each(function (i) { 5803 5804 var $that = $(this); 5805 5806 if (bypassAnimations) { 5807 $that.attr('data-animation', 'false'); 5808 } 5809 // Size 5810 $that.find('svg').css({ 5811 'height': parseInt($that.attr('data-size')) + 'px', 5812 'width': parseInt($that.attr('data-size')) + 'px' 5813 }); 5814 5815 // Animation 5816 $(this).find('svg').attr('id', 'nectar-svg-animation-instance-' + i); 5817 5818 var $animationSpeed = ($that.is('[data-animation-speed]') && $that.attr('data-animation-speed').length > 0) ? $that.attr('data-animation-speed') : 200; 5819 5820 if ($that.attr('data-animation') == 'false') { 5821 $animationSpeed = 1; 5822 $that.css('opacity', '1'); 5823 } 5824 5825 if (!$that.hasClass('bound')) { 5826 $svgIcons[i] = new Vivus($that.find('svg').attr('id'), { 5827 type: 'delayed', 5828 pathTimingFunction: Vivus.EASE_OUT, 5829 animTimingFunction: Vivus.LINEAR, 5830 duration: $animationSpeed, 5831 onReady: svgInit 5832 });
5833 } 5834 5835 if ($animationSpeed !== 1) { 5836 5837 var waypoint = new Waypoint({ 5838 element: $that, 5839 handler: function () { 5840 if ($that.hasClass('animated-in')) { 5841 waypoint.destroy(); 5842 return; 5843 } 5844 5845 checkIfReady(); 5846 $that.addClass('animated-in'); 5847 waypoint.destroy(); 5848 }, 5849 offset: $svgOffsetPos 5850 5851 }); 5852 5853 } else { 5854 checkIfReady(); 5855 } 5856 5857 function checkIfReady() { 5858 5859 var $animationDelay = 0; 5860 5861 if($that.is('[data-animation-delay]') && 5862 $that.attr('data-animation-delay').length > 0 && 5863 $that.attr('data-animation') != 'false') { 5864 $animationDelay = $that.attr('data-animation-delay'); 5865 } 5866 5867 var $iconID = $that.find('svg').attr('id').replace(/[^0-9]/g, ''); 5868 5869 if ($svgIcons[$iconID].isReady == true) { 5870 setTimeout(function () { 5871 $that.css('opacity', '1'); 5872 $svgIcons[$iconID].reset().play(); 5873 }, $animationDelay); 5874 } else { 5875 setTimeout(checkIfReady, 50); 5876 } 5877 } 5878 5879 function svgInit() { 5880 5881 //set size 5882 $that.css({ 5883 'height': parseInt($that.attr('data-size')) + 'px', 5884 'width': parseInt($that.attr('data-size')) + 'px' 5885 });
5886 5887 } 5888 5889 $that.addClass('bound'); 5890 5891 }); 5892 5893 5894 // SVG in equal height column resize 5895 if ($('.vc_row-o-equal-height .svg-icon-holder[data-animation="true"]').length > 0 && 5896 $('#nectar_fullscreen_rows').length == 0) { 5897 5898 $window.on('smartresize', function () { 5899 clearTimeout($svgResizeTimeout); 5900 $svgResizeTimeout = setTimeout(function () { 5901 5902 if ($svgIcons.length > 0) { 5903 $('.svg-icon-holder.animated-in').each(function () { 5904 5905 $(this).css('opacity', '1'); 5906 if ($(this).is('[id]')) { 5907 var $iconID = $(this).attr('id').replace(/[^0-9]/g, ''); 5908 $svgIcons[$iconID].finish(); 5909 } 5910 5911 }); 5912 } 5913 5914 }, 300); 5915 5916 }); 5917 5918 } 5919 5920 } 5921 5922 // After svg animated icons initalized 5923 else { 5924 $('.svg-icon-holder').addClass('animated-in').css('opacity', '1'); 5925 } 5926 5927 // Full vc row support 5928 $('#nectar_fullscreen_rows .svg-icon-holder.animated-in').has('svg').each(function (i) { 5929 5930 var $animationDelay = 0; 5931 5932 if($(this).is('[data-animation-delay]') && 5933 $(this).attr('data-animation-delay').length > 0 && 5934 $(this).attr('data-animation') != 'false') { 5935 $animationDelay = $(this).attr('data-animation-delay'); 5936 } 5937 5938 var $that = $(this); 5939 5940 var $iconID = $that.find('svg').attr('id').replace(/[^0-9]/g, ''); 5941 5942 clearTimeout($animatedSVGIconTimeout[i]); 5943 5944 if ($that.attr('data-animation') == 'false') { 5945 5946 $that.css('opacity', '1'); 5947 $svgIcons[$iconID].finish(); 5948 5949 } else { 5950 5951 if ($(this).parents('.active').length > 0 || 5952 $(this).parents('#footer-outer').length > 0 || 5953 $('body.mobile').length > 0) { 5954 5955 $svgIcons[$iconID].reset(); 5956 $animatedSVGIconTimeout[i] = setTimeout(function () { 5957 $svgIcons[$iconID].play(); 5958 }, $animationDelay); 5959 5960 } else { 5961 $svgIcons[$iconID].reset().stop(); 5962 } 5963 } 5964 }); 5965 5966 } 5967 5968 5969 5970 /** 5971 * Fancy unordered list element initialization. 5972 * 5973 * @since 4.0 5974 * @see waypoints 5975 */ 5976 function nectarFancyUlInit() { 5977 5978 $($fullscreenSelector + '.nectar-fancy-ul').each(function () { 5979 5980 var $animation = $(this).attr('data-animation'), 5981 $animationDelay = 0; 5982 5983 if($(this).is('[data-animation-delay]') && 5984 $(this).attr('data-animation-delay').length > 0 && 5985 $(this).attr('data-animation') != 'false') { 5986 $animationDelay = $(this).attr('data-animation-delay'); 5987 } 5988 5989 if ($animation == 'true') { 5990 5991 var $that = $(this), 5992 waypoint = new Waypoint({ 5993 element: $that, 5994 handler: function () { 5995 5996 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 5997 waypoint.destroy(); 5998 return; 5999 } 6000 6001 setTimeout(function () { 6002 $that.find('li').each(function (i) { 6003 var $that = $(this); 6004 $that.delay(i * 220).transition({ 6005 'opacity': '1', 6006 'left': '0' 6007 }, 220, 'easeOutCubic'); 6008 }); 6009 }, $animationDelay); 6010 6011 $that.addClass('animated-in'); 6012 waypoint.destroy(); 6013 }, 6014 offset: 'bottom-in-view' 6015 6016 }); 6017 6018 } 6019 6020 }); 6021 6022 } 6023 6024 6025 /** 6026 * Fancy unordered list element icons. 6027 * 6028 * @since 11.0 6029 */ 6030 function nectarFancyUlIcons() { 6031 6032 $('.nectar-fancy-ul:not([data-list-icon="dot"]):not([data-list-icon="none"])').each(function () { 6033 6034 var $icon = $(this).attr('data-list-icon'), 6035 $color = $(this).attr('data-color'); 6036 6037 $(this).find('li').each(function () { 6038 $(this).find('> i').remove(); 6039 $(this).prepend('<i class="icon-default-style ' + $icon + ' ' + $color + '"></i> '); 6040 }); 6041 6042 }); 6043 6044 } 6045 6046 6047 /** 6048 * Flipbox element height calculations. 6049 * 6050 * @since 7.0 6051 */ 6052 function flipBoxHeights() { 6053 6054 $('.nectar-flip-box').each(function () { 6055
6056 var $flipBoxMinHeight = parseInt($(this).attr('data-min-height')), 6057 $flipBoxHeight = $(this).find('.flip-box-front .inner').height(); 6058 6059 if ($(this).find('.flip-box-back .inner').height() > $(this).find('.flip-box-front .inner').height()) { 6060 $flipBoxHeight = $(this).find('.flip-box-back .inner').height(); 6061 } 6062 6063 if ($flipBoxHeight >= $flipBoxMinHeight - 80) { 6064 $(this).find('> div').css('height', $flipBoxHeight + 80); 6065 } else { 6066 $(this).find('> div').css('height', 'auto'); 6067 } 6068 6069 // Safari needs 3D translate. 6070 if ($(this).parent().hasClass('wpb_wrapper')) { 6071 $(this).parent().css('transform', 'translateZ(0)'); 6072 } 6073 6074 }); 6075 } 6076 6077 6078 6079 6080 /** 6081 * Flipbox element events. 6082 * 6083 * @since 7.0 6084 */ 6085 function flipBoxInit() { 6086 6087 if( $('.nectar-flip-box').length > 0 ) { 6088 6089 // Mobile gets click. 6090 if (nectarDOMInfo.usingMobileBrowser) { 6091 $body.on('click', '.nectar-flip-box', function () { 6092 $(this).toggleClass('flipped'); 6093 }); 6094 } 6095 6096 flipBoxHeights(); 6097 6098 // Handle resize. 6099 $window.on('smartresize', flipBoxHeights); 6100 } 6101 6102 } 6103 6104 6105 6106 6107 /** 6108 * Runs before other full width section calculations. 6109 * 6110 * @since 4.0 6111 */ 6112 function fullWidthSectionsPreInit() { 6113 6114 // Nectar Slider force full width parent row when using full width element option. 6115 $('.wpb_row .vc_col-sm-12 .nectar-slider-wrap[data-full-width="true"]').each(function () { 6116 if ($(this).parents('.wpb_row.full-width-section').length == 0 && $(this).parents('.wpb_row.full-width-content').length == 0) { 6117 $(this).parents('.wpb_row').addClass('full-width-section'); 6118 } 6119 }); 6120 6121 // Handle percent row padding values when using the boxed theme option. 6122 if( !nectarDOMInfo.usingMobileBrowser && $('body[data-boxed-style="1"]').length > 0 && $('#boxed').length > 0 ) { 6123 fullWidthRowPaddingAdjustCalcBoxed(); 6124 } 6125 6126 } 6127 6128 6129 6130 /** 6131 * Full width calculations for legacy items. 6132 * 6133 * @since 4.0 6134 */ 6135 function fullWidthSections() { 6136 6137 var $windowInnerWidth = nectarDOMInfo.winW, 6138 $bodyBorderWidth = ($('.body-border-right').length > 0 && $windowInnerWidth > 1000) ? parseInt($('.body-border-right').width()) * 2 : 0, 6139 $container_width = ($('.container-wrap').length > 0) ? parseInt($('.container-wrap').outerWidth()) : $window.width(), 6140 $extended_padding = ($('body[data-ext-padding]').length > 0) ? parseInt($('body').attr('data-ext-padding'))*2 : 180; 6141 6142 var $windowWidth, 6143 $justOutOfSight, 6144 $mainContentWidth; 6145 6146 if ($('#boxed').length == 1) { 6147 $justOutOfSight = ((parseInt($('.container-wrap').width()) - parseInt($('.main-content').width())) / 2) + 4; 6148 } else { 6149 6150 // Ext responsive mode is on - add the extra padding into the calcs 6151 var $extResponsivePadding = ($('body[data-ext-responsive="true"]').length > 0 && $windowInnerWidth >= 1000) ? $extended_padding : 0; 6152 6153 if ($container_width - $bodyBorderWidth <= parseInt($('.main-content').css('max-width'))) { 6154 $windowWidth = parseInt($('.main-content').css('max-width')); 6155 } else { 6156 $windowWidth = $container_width - $bodyBorderWidth; 6157 } 6158 6159 6160 var $contentWidth = parseInt($('.main-content').css('max-width')); 6161 6162 // Single post fullwidth 6163 if ($('body.single-post[data-ext-responsive="true"]').length > 0 && $('.container-wrap.no-sidebar').length > 0) { 6164 $contentWidth = $('.post-area').width(); 6165 $extResponsivePadding = 0; 6166 } 6167 6168 $justOutOfSight = Math.ceil((($windowWidth + $extResponsivePadding - $contentWidth) / 2)); 6169 } 6170 6171 6172 $('.carousel-outer').has('.carousel-wrap[data-full-width="true"]').css('overflow', 'visible'); 6173 6174 $('.carousel-wrap[data-full-width="true"], .portfolio-items[data-col-num="elastic"]:not(.fullwidth-constrained), #boxed .full-width-content').each(function () { 6175 6176 var $leftHeaderSize = ($('#header-outer[data-format="left-header"]').length > 0 && $windowInnerWidth >= 1000) ? parseInt($('#header-outer[data-format="left-header"]').width()) : 0; 6177 var $bodyBorderWidth = ($('.body-border-right').length > 0 && $windowInnerWidth > 1000) ? (parseInt($('.body-border-right').width()) * 2) - 2 : 0; 6178 6179 // Single post fullwidth. 6180 if ($('#boxed').length == 1) { 6181 6182 $mainContentWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').width()) : parseInt($(this).parents('.container').width()); 6183 6184 if ($('body.single-post[data-ext-responsive="true"]').length > 0 && $('.container-wrap.no-sidebar').length > 0 && $(this).parents('.post-area').length > 0) { 6185 $contentWidth = $('.post-area').width(); 6186 $extResponsivePadding = 0; 6187 $windowWidth = $container_width - $bodyBorderWidth;
6188 $justOutOfSight = Math.ceil((($windowWidth + $extResponsivePadding - $contentWidth) / 2)); 6189 } else { 6190 if ($(this).parents('.page-submenu').length > 0) { 6191 $justOutOfSight = ((parseInt($('.container-wrap').width()) - $mainContentWidth) / 2); 6192 } 6193 else { 6194 $justOutOfSight = ((parseInt($('.container-wrap').width()) - $mainContentWidth) / 2) + 4; 6195 } 6196 } 6197 } else { 6198 6199 if ($('body.single-post[data-ext-responsive="true"]').length > 0 && $('.container-wrap.no-sidebar').length > 0 && $(this).parents('.post-area').length > 0) { 6200 6201 $contentWidth = $('.post-area').width(); 6202 $extResponsivePadding = 0; 6203 $windowWidth = $container_width - $bodyBorderWidth; 6204 6205 } else { 6206 6207 var $mainContentMaxWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').css('max-width')) : parseInt($(this).parents('.container').css('max-width')); 6208 6209 if ($container_width - $bodyBorderWidth <= $mainContentMaxWidth) { 6210 $windowWidth = $mainContentMaxWidth; 6211 } 6212 6213 $contentWidth = $mainContentMaxWidth; 6214 $extResponsivePadding = ($('body[data-ext-responsive="true"]').length > 0 && nectarDOMInfo.winW >= 1000) ? $extended_padding : 0; 6215 6216 if ($leftHeaderSize > 0) { 6217 $extResponsivePadding = ($('body[data-ext-responsive="true"]').length > 0 && nectarDOMInfo.winW >= 1000) ? 120 : 0; 6218 } 6219 6220 } 6221 6222 $justOutOfSight = Math.ceil((($windowWidth + $extResponsivePadding - $contentWidth) / 2)); 6223 } 6224 6225 var $extraSpace = 0; 6226 if ($(this).hasClass('carousel-wrap')) { 6227 $extraSpace = 1; 6228 } 6229 if ($(this).hasClass('portfolio-items')) { 6230 $extraSpace = 5; 6231 } 6232 6233 var $carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight * 2) : $container_width - $bodyBorderWidth + $extraSpace; 6234 6235 // When using gutter on portfolio don't add extra space 6236 if ($('#boxed').length == 0 && $(this).hasClass('portfolio-items') && $(this).is('[data-gutter*="px"]') && $(this).attr('data-gutter').length > 0 && $(this).attr('data-gutter') != 'none') { 6237 if ($container_width > 1000) { 6238 $carouselWidth = $container_width - $bodyBorderWidth + 3; 6239 } 6240 else { 6241 $carouselWidth = $container_width - $bodyBorderWidth; 6242 } 6243 } 6244 6245 if ($(this).parent().hasClass('default-style')) { 6246 6247 $mainContentWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').width()) : parseInt($(this).parents('.container').width()); 6248 6249 if ($('#boxed').length != 0) { 6250 $carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight * 2) : $container_width + $extraSpace; 6251 } else { 6252 $carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight * 2) : ($container_width - $bodyBorderWidth) - (($container_width - $bodyBorderWidth) * 0.025) + $extraSpace; 6253 $windowWidth = ($container_width - $bodyBorderWidth <= $mainContentWidth) ? $mainContentWidth : ($container_width - $bodyBorderWidth) - (($container_width - $bodyBorderWidth) * 0.025); 6254 $justOutOfSight = Math.ceil((($windowWidth - $mainContentWidth) / 2)); 6255 } 6256 6257 } 6258 6259 else if ($(this).parent().hasClass('spaced')) { 6260 6261 $mainContentWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').width()) : parseInt($(this).parents('.container').width()); 6262 6263 if ($('#boxed').length != 0) { 6264 $carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight * 2) - ($container_width * 0.02) : $container_width + $extraSpace; 6265 } else { 6266 $carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight * 2) : ($container_width - $bodyBorderWidth) - Math.ceil(($container_width - $bodyBorderWidth) * 0.02) + $extraSpace; 6267 var $windowWidth2 = ($container_width - $bodyBorderWidth <= $mainContentWidth) ? $mainContentWidth : ($container_width - $bodyBorderWidth) - (($container_width - $bodyBorderWidth) * 0.02);
6268 $justOutOfSight = Math.ceil((($windowWidth2 - $mainContentWidth) / 2) + 2); 6269 } 6270 } 6271 6272 // Make sure the element/row is capable of going full width. 6273 if (!$(this).parents('.span_9').length > 0 && 6274 !$(this).parent().hasClass('span_3') && 6275 $(this).parent().attr('id') != 'sidebar-inner' && 6276 !$(this).find('.nectar-carousel-flickity-fixed-content').length > 0 && 6277 $(this).parent().attr('id') != 'portfolio-extra' ) { 6278 6279 // Escape if inside woocoommerce page and not using applicable layout 6280 if ($('.single-product').length > 0 && 6281 $(this).parents('#tab-description').length > 0 && 6282 $(this).parents('.full-width-tabs').length == 0) { 6283 6284 $(this).css({ 6285 'visibility': 'visible' 6286 }); 6287 6288 } else { 6289 // Portfolio. 6290 if ($(this).hasClass('portfolio-items')) { 6291 6292 if( $(this).parents('.full-width-content').length == 0 ) { 6293 6294 $(this).css({ 6295 'margin-left': -$justOutOfSight, 6296 'left': 0, 6297 'width': $carouselWidth, 6298 'visibility': 'visible' 6299 }); 6300 6301 } 6302 6303 } else { 6304 6305 // Fullscreen page rows left. 6306 if ($('#nectar_fullscreen_rows').length > 0 && $(this).hasClass('wpb_row')) { 6307 6308 $(this).css({ 6309 'margin-left': -$justOutOfSight, 6310 'width': $carouselWidth, 6311 'visibility': 'visible' 6312 }); 6313 6314 } else { 6315 // Regular rows. 6316 if( $(this).parents('.full-width-content').length == 0 ) { 6317 $(this).css({ 6318 'left': 0, 6319 'margin-left': -$justOutOfSight, 6320 'width': $carouselWidth, 6321 'visibility': 'visible' 6322 }); 6323 } 6324 } 6325 6326 } 6327 6328 } 6329 } 6330 6331 else if ($(this).parent().attr('id') == 'portfolio-extra' && $('#full_width_portfolio').length != 0) { 6332 6333 if( !$(this).find('.nectar-carousel-flickity-fixed-content').length > 0 ) { 6334 $(this).css({ 6335 'left': 0, 6336 'margin-left': -$justOutOfSight, 6337 'width': $carouselWidth, 6338 'visibility': 'visible' 6339 });
6340 } 6341 6342 } else { 6343 6344 $(this).css({ 6345 'margin-left': 0, 6346 'width': 'auto', 6347 'left': '0', 6348 'visibility': 'visible' 6349 }); 6350 } 6351 6352 }); 6353 6354 } 6355 6356 6357 6358 /** 6359 * First full width row on page 6360 * 6361 * @since 4.0 6362 */ 6363 function firstFWSection() { 6364 6365 $('.full-width-section.wpb_row, .full-width-content.wpb_row').each(function () { 6366 6367 if (!$(this).parent().hasClass('span_9') && 6368 !$(this).parent().hasClass('span_3') && 6369 $(this).parent().attr('id') != 'sidebar-inner') { 6370 6371 if ($(this).parents('#portfolio-extra').length > 0 && $('#full_width_portfolio').length == 0) { 6372 return false; 6373 } 6374 6375 if ($(this).index() == '0' && 6376 $pageHeaderBG.length == 0 && 6377 $('.page-header-no-bg').length == 0 && 6378 $('.project-title').length == 0 && 6379 $('body.single').length == 0 && 6380 $('.project-title').length == 0) { 6381 6382 $(this).addClass('first-section'); 6383 6384 var $that = $(this); 6385 setTimeout(function () { 6386 $that.addClass('loaded'); 6387 }, 50); 6388 6389 } 6390 6391 } 6392 6393 }); 6394 6395 } 6396 6397 6398 6399 /** 6400 * Parallax Scrolling 6401 * 6402 * @since 13.0 6403 */ 6404 function NectarParallaxScroll(el, parallaxElClass, speed, type) { 6405 6406 this.$el = el; 6407 this.$parallaxEl = this.$el.find(parallaxElClass); 6408 this.firstSection = false; 6409 this.type = type; 6410 this.speed = speed; 6411 this.storedWinH = nectarDOMInfo.winH; 6412 6413 this.setup(); 6414 this.resize(); 6415 this.update(); 6416 6417 } 6418 6419 NectarParallaxScroll.prototype.setup = function() { 6420 6421 var that = this; 6422 6423 // Page Header. 6424 if( this.$el.parents('#page-header-bg').length > 0 ) { 6425 this.type = 'page-header'; 6426 } 6427 6428 // Is the element in the first row on the page? 6429 if(this.$el.parents('.top-level').length > 0 && this.$el.parents('.parallax_slider_outer').length > 0 || 6430 this.$el.parents('.top-level').length > 0 && this.$el.hasClass('nectar-simple-slider') || 6431 this.$el.parents('.top-level').length > 0 && this.$el.hasClass('nectar-recent-posts-single_featured') || 6432 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)') || 6433 this.$el.is('.wpb_row.top-level') || 6434 this.type == 'page-header' || 6435 $('.wpb_row').length == 0) { 6436 this.firstSection = true; 6437 } 6438 6439 //// Nectar Slider. 6440 if($('.wpb_row').length == 0 && 6441 this.$el.parents('.parallax_slider_outer').length > 0 && 6442 this.$el.is('[data-full-width="true"]') || 6443 ($('#portfolio-extra').length > 0 && 6444 this.$el.parents('.parallax_slider_outer').length > 0 && 6445 this.$el.parents('.wpb_row').length > 0 && 6446 this.$el.parents('.wpb_row').index() == '0')) { 6447 this.firstSection = true; 6448 } 6449 //// Disable first section calcs when using FE editor. 6450 if (nectarDOMInfo.usingFrontEndEditor && this.type != 'page-header') { 6451 this.firstSection = false; 6452 } 6453 6454 // Init class. 6455 this.$parallaxEl.addClass('translate'); 6456 6457 // Need to periodically check height/offset. 6458 setInterval(function() { 6459 6460 if( nectarState.materialOffCanvasOpen != true ) { 6461 that.offsetTop = that.$el.offset().top; 6462 that.height = that.$el.outerHeight(true); 6463 } 6464 6465 }, 800); 6466 6467 $(window).on('nectar-column-animation-start',this.checkColumnAnimation.bind(this)); 6468 6469 // Bind events. 6470 $(window).on('resize load', this.resize.bind(this)); 6471 window.addEventListener("orientationchange", this.orientationChange.bind(this)); 6472 }; 6473 6474 NectarParallaxScroll.prototype.checkColumnAnimation = function() { 6475 if( this.$parallaxEl.parents('.col.has-animation.triggered-animation:not(.animated-in)').length > 0 ) { 6476 this.realtimeOffsetUpdate(); 6477 } 6478 }; 6479 6480 NectarParallaxScroll.prototype.realtimeOffsetUpdate = function() { 6481 // Triggered when a column animation is active. 6482 var that = this; 6483 6484 var realTimeOffset = setInterval(function() { 6485 if( nectarState.materialOffCanvasOpen != true ) { 6486 that.offsetTop = that.$el.offset().top; 6487 that.height = that.$el.outerHeight(true); 6488 } 6489 },30); 6490 6491 setTimeout(function(){ 6492 clearInterval(realTimeOffset); 6493 },2000); 6494 6495 } 6496 6497 NectarParallaxScroll.prototype.resize = function() { 6498 6499 this.offsetTop = this.$el.offset().top; 6500 this.height = this.$el.outerHeight(true); 6501 6502 if( !nectarDOMInfo.usingMobileBrowser ) { 6503 this.storedWinH = nectarDOMInfo.winH; 6504 } 6505 6506 }; 6507 6508 NectarParallaxScroll.prototype.orientationChange = function() { 6509 6510 if( nectarDOMInfo.usingMobileBrowser ) { 6511 this.offsetTop = this.$el.offset().top; 6512 this.height = this.$el.outerHeight(true); 6513 this.storedWinH = nectarDOMInfo.winH; 6514 } 6515 6516 }; 6517 6518 6519 NectarParallaxScroll.prototype.update = function() { 6520 6521 // Outside of viewport. 6522 if(this.offsetTop + this.height < nectarDOMInfo.scrollTop || 6523 this.offsetTop > nectarDOMInfo.scrollTop + nectarDOMInfo.winH || 6524 nectarState.materialOffCanvasOpen == true) { 6525
6526 for(var i = 0; i < this.$parallaxEl.length; i++) { 6527 this.$parallaxEl[i].style.willChange = 'auto'; 6528 } 6529 6530 requestAnimationFrame(this.update.bind(this)); 6531 return; 6532 } 6533 6534 for(var i = 0; i < this.$parallaxEl.length; i++) { 6535 6536 if( this.firstSection === true ) { 6537 this.$parallaxEl[i].style.transform = 'translate3d(0, ' + parseInt(nectarDOMInfo.scrollTop * this.speed) + 'px, 0)'; 6538 } 6539 else { 6540 this.$parallaxEl[i].style.transform = 'translate3d(0, ' + parseInt(((this.storedWinH + nectarDOMInfo.scrollTop - this.offsetTop) * this.speed)) + 'px, 0) scale(1.005)'; 6541 } 6542 this.$parallaxEl[i].style.willChange = 'transform'; 6543 } 6544 6545 requestAnimationFrame(this.update.bind(this)); 6546 }; 6547 6548 6549 6550 /** 6551 * Parallax scroll speed helper. 6552 * 6553 * @since 4.0 6554 */ 6555 function parallaxSrollSpeed(speedString) { 6556 6557 var speed; 6558 switch (speedString) { 6559 case 'slow': 6560 speed = 0.6; 6561 break; 6562 case 'medium': 6563 speed = 0.4; 6564 break; 6565 case 'medium_fast': 6566 speed = 0.28; 6567 break; 6568 case 'fast': 6569 speed = 0.20; 6570 break; 6571 case 'very_subtle': 6572 speed = 0.12; 6573 break; 6574 } 6575 6576 return speed; 6577 } 6578 6579 6580 /** 6581 * Parallax scroll initialization. 6582 * 6583 * @since 4.0 6584 */ 6585 function parallaxScrollInit() { 6586 6587 if (nectarDOMInfo.usingMobileBrowser && $('body[data-remove-m-parallax="1"]').length > 0) { 6588 return; 6589 } 6590 6591 parallaxRowsBGCals(); 6592 6593 var parallaxItemCount = 0; 6594 6595 $('.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() { 6596 6597 6598 // Generic. 6599 if( $(this).is('[data-n-parallax-bg][data-parallax-speed]') ) { 6600 parallaxItemsArr[parallaxItemCount] = new NectarParallaxScroll($(this), '.parallax-layer', parallaxSrollSpeed($(this).attr('data-parallax-speed')), 'regular'); 6601 parallaxItemCount++; 6602 } 6603 else { 6604 6605 if ( $(this).find('[data-parallax-speed="fixed"]').length == 0) { 6606 6607 // Slider. 6608 if ( $(this).hasClass('nectar-slider-wrap') ) { 6609 parallaxItemsArr[parallaxItemCount] = new NectarParallaxScroll($(this), '.video-wrap, .image-bg', 0.25, 'nectar-slider'); 6610 } 6611 // Page Header. 6612 else if( $(this).hasClass('page-header-bg-image-wrap') ) { 6613 parallaxItemsArr[parallaxItemCount] = new NectarParallaxScroll($(this), '.page-header-bg-image', 0.25, 'page-header'); 6614 } 6615 else if( $(this).hasClass('nectar-video-wrap') && $(this).parents('#page-header-bg').length > 0 ) { 6616 parallaxItemsArr[parallaxItemCount] = new NectarParallaxScroll($(this), '.nectar-video-bg', 0.25, 'page-header'); 6617 } 6618 // All Others. 6619 else { 6620 parallaxItemsArr[parallaxItemCount] = new NectarParallaxScroll($(this), '.row-bg.using-image', parallaxSrollSpeed($(this).find('.row-bg').attr('data-parallax-speed')), 'regular'); 6621 } 6622 6623 parallaxItemCount++; 6624 6625 } 6626 6627 } 6628 6629 $(this).addClass('nectar-parallax-enabled'); 6630 6631 }); 6632 6633 $('.woocommerce-tabs .wc-tabs li').on('click', function(){ 6634 setTimeout(parallaxRowsBGCals,100); 6635 }); 6636 6637 6638 } 6639 6640 6641 6642 /** 6643 * Parallax row background height calculations. 6644 * 6645 * @since 6.0 6646 */ 6647 function parallaxRowsBGCals() { 6648 6649 if (nectarDOMInfo.usingMobileBrowser && $('body[data-remove-m-parallax="1"]').length > 0) { 6650 return; 6651 } 6652 6653 $('.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 () { 6654 6655 var $non_page_builder_slider; 6656 6657 if( $(this).parents('.wpb_tab:not(.visible-tab)').length > 0 || $(this).parents('.wc-tab').length > 0 && $(this).parents('.wc-tab').css('display') !== 'block' ) { 6658 return true; 6659 } 6660 6661 if ($(this).find('.row-bg').length == 0 && 6662 $(this).find('.page-header-bg-image').length > 0 ) { 6663 //skip processing. 6664 } 6665 else if ($(this).find('.row-bg').length == 0 && 6666 $(this).find('.image-bg').length > 0) { 6667 6668 $non_page_builder_slider = false; 6669 6670 // First nectar slider shortcode without page builder 6671 if ($('.wpb_row').length == 0 && 6672 $(this).parents('.nectar-slider-wrap[data-full-width="true"]').length > 0 && 6673 $(this).parents('.parallax_slider_outer').length > 0 && 6674 $(this).parents('.parallax_slider_outer').index() == '1') { 6675 $non_page_builder_slider = true; 6676 } 6677 6678 // Portfolio first 6679 if ($('#portfolio-extra').length > 0 && 6680 $(this).parents('.wpb_row').length > 0 && 6681 $(this).parents('.parallax_slider_outer').length > 0 && 6682 $(this).parents('.wpb_row').index() == '0') { 6683 $non_page_builder_slider = true; 6684 } 6685 6686 // Set heights. 6687 if ($(this).parents('.top-level').length > 0 && !nectarDOMInfo.usingFrontEndEditor || 6688 $non_page_builder_slider && !nectarDOMInfo.usingFrontEndEditor) { 6689 6690 $(this).find('.image-bg').css({ 6691 'height': Math.ceil($(this).parent().offset().top * 0.25) + $(this).outerHeight(true) 6692 });
6693 } else { 6694 $(this).find('.image-bg').css({ 6695 'height': Math.ceil($window.height() * 0.25) + $(this).outerHeight(true) 6696 }); 6697 } 6698 6699 } 6700 6701 // Video backgrounds. 6702 else if ($(this).find('.row-bg').length == 0 && $(this).find('.video-wrap').length > 0) { 6703 6704 $non_page_builder_slider = false; 6705 // First nectar slider shortcode without page builder 6706 if ($('.wpb_row').length == 0 && 6707 $(this).parents('.nectar-slider-wrap[data-full-width="true"]').length > 0 && 6708 $(this).parents('.parallax_slider_outer').length > 0 && 6709 $(this).parents('.parallax_slider_outer').index() == '1') { 6710 $non_page_builder_slider = true; 6711 } 6712 // Portfolio first 6713 if ($('#portfolio-extra').length > 0 && 6714 $(this).parents('.wpb_row').length > 0 && 6715 $(this).parents('.parallax_slider_outer').length > 0 && 6716 $(this).parents('.wpb_row').index() == '0') { 6717 $non_page_builder_slider = true; 6718 } 6719 6720 // Set heights. 6721 if ($(this).parents('.top-level').length > 0 && !nectarDOMInfo.usingFrontEndEditor || 6722 $non_page_builder_slider && !nectarDOMInfo.usingFrontEndEditor) { 6723 6724 $(this).find('.video-wrap').css({ 6725 'height': Math.ceil($(this).parent().offset().top * 0.25) + $(this).outerHeight(true) 6726 });
6727 } 6728 6729 else { 6730 $(this).find('.video-wrap').css({ 6731 'height': Math.ceil($window.height() * 0.25) + $(this).outerHeight(true) 6732 }); 6733 } 6734 6735 var vid = $(this).find('.video-wrap video'), 6736 vid_w_orig = 1280, 6737 vid_h_orig = 720; 6738 6739 // Get the parent element size 6740 var container_w = vid.parent().width(), 6741 container_h = vid.parent().height(), 6742 scale_w = container_w / vid_w_orig, 6743 scale_h = container_h / vid_h_orig; 6744 6745 var scale = scale_w > scale_h ? scale_w : scale_h; 6746 6747 // Scale the video. 6748 vid.width(scale * vid_w_orig); 6749 vid.height(scale * vid_h_orig); 6750 6751 } else { 6752 6753 // Top Level Special elements, Recent posts/ Simple Slider. 6754 if ($(this).is('.nectar-recent-posts-single_featured') && 6755 $(this).parents('.top-level').length > 0 && 6756 !nectarDOMInfo.usingFrontEndEditor) { 6757 //skip processing. 6758 } 6759 else if ($(this).is('.nectar-simple-slider') && 6760 $(this).parents('.top-level').length > 0 && 6761 !nectarDOMInfo.usingFrontEndEditor) { 6762 //skip processing. 6763 } 6764 else if($(this).is('.column-image-bg-wrap') && 6765 $(this).parents('.top-level').length > 0 && 6766 $(this).parent().parent().is('.vc_col-sm-12:not(.child_column)')) { 6767 //skip processing. 6768 } 6769 // Regular. 6770 else if (!$(this).hasClass('top-level') || nectarDOMInfo.usingFrontEndEditor || $(this).find('.parallax-layer').length > 0) { 6771 6772 var classSelector = '.row-bg'; 6773 var parallaxSpeed = $(this).find('.row-bg').attr('data-parallax-speed'); 6774 6775 if( $(this).find('.parallax-layer').length > 0 ) { 6776 classSelector = '.parallax-layer'; 6777 parallaxSpeed = $(this).attr('data-parallax-speed'); 6778 } 6779 6780 var $ifFast = ($(this).find(classSelector + '[data-parallax-speed="fast"]').length > 0) ? 60 : 0; 6781 $(this).find(classSelector).css({ 6782 'height': Math.ceil($window.height() * parallaxSrollSpeed(parallaxSpeed) ) + $(this).outerHeight(true) + $ifFast 6783 });
6784 6785 6786 } 6787 6788 } 6789 6790 }); 6791 6792 } 6793 6794 6795 /** 6796 * Class names added for specific full width section rows at top 6797 * 6798 * @since 3.0 6799 */ 6800 function fwsClasses() { 6801 6802 $('.wpb_wrapper > .nectar-slider-wrap[data-full-width="true"]').each(function () { 6803 if (!$(this).parent().hasClass('span_9') && !$(this).parent().hasClass('span_3') && $(this).parent().attr('id') != 'sidebar-inner') { 6804 if ($(this).parents('.wpb_row').index() == '0') { 6805 $(this).addClass('first-nectar-slider'); 6806 } 6807 } 6808 }); 6809 6810 var $contentElementsNum = ($('#portfolio-extra').length == 0) ? $('.main-content > .row > *').length : $('.main-content > .row #portfolio-extra > *').length; 6811 6812 if ($('#portfolio-extra').length == 0) { 6813 $contentElementsNum = ($('.main-content > .row > .wpb_row').length > 0) ? $('.main-content > .row > .wpb_row').length : $('.main-content > .row > *').length; 6814 } else { 6815 $contentElementsNum = $('.main-content > .row #portfolio-extra > *').length; 6816 } 6817 6818 $('.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 () { 6819 6820 if( $(this).parents('.nectar-global-section.before-footer').length > 0 ) { 6821 return true; 6822 } 6823 6824 6825 if (!$(this).parent().hasClass('span_9') && !$(this).parent().hasClass('span_3') && $(this).parent().attr('id') != 'sidebar-inner') { 6826 6827 if ($(this).parents('.wpb_row').length > 0) { 6828 6829 if ($(this).parents('#portfolio-extra').length > 0 && 6830 $('#full_width_portfolio').length == 0) { 6831 return false; 6832 } 6833 6834 ////first 6835 if ($(this).parents('.wpb_row').index() == '0' && $pageHeaderBG.length != 0) { 6836 //skip processing. 6837 } 6838 else if ($(this).parents('.wpb_row').index() == '0' && 6839 $pageHeaderBG.length == 0 && $('.page-header-no-bg').length == 0 && 6840 $('.project-title').length == 0 && $(this).parents('.wpb_row').index() == '0' && 6841 $('.project-title').length == 0 && $('body[data-bg-header="true"]').length == 0) { 6842 6843 if ($('.single').length == 0) { 6844 $('.container-wrap').css('padding-top', '0px'); 6845 } else { 6846 $(this).addClass('first-section'); 6847 } 6848 6849 } 6850 6851 // Check if it's also last (i.e. the only fws) 6852 if ($(this).parents('.wpb_row').index() == $contentElementsNum - 1 && $('#respond').length == 0) { 6853 if ($(this).attr('id') != 'portfolio-filters-inline') { 6854 $('.container-wrap').css('padding-bottom', '0px'); 6855 $('#call-to-action .triangle').remove(); 6856 } 6857 } 6858 6859 } else { 6860 6861 if ($(this).parents('#portfolio-extra').length > 0 && $('#full_width_portfolio').length == 0) { 6862 return false; 6863 } 6864 6865 if ($(this).find('.portfolio-filters-inline').length == 0 && $(this).attr('id') != 'post-area') { 6866 6867 ////first 6868 if ($(this).index() == '0' && $pageHeaderBG.length != 0) { 6869 //skip processing. 6870 } 6871 else if ($(this).index() == '0' && $pageHeaderBG.length == 0 && 6872 $(this).index() == '0' && $('.page-header-no-bg').length == 0 && 6873 $(this).index() == '0' && !$(this).hasClass('blog_next_prev_buttons') && 6874 !$(this).hasClass('nectar-shop-outer') && $(this).parents('.pum-container').length == 0) { 6875 6876 if ($('body[data-header-resize="0"]').length == 1 && $('.single').length == 0 || $('body.material').length > 0 && $('.single').length == 0) { 6877 6878 if (!$('body.blog .blog-fullwidth-wrap > .masonry:not(.meta-overlaid)').length > 0) { 6879 $('.container-wrap').css('padding-top', '0px'); 6880 } 6881 6882 } 6883 6884 else { 6885 $(this).addClass('first-section'); 6886 } 6887 6888 } 6889 6890 //check if it's also last (i.e. the only fws) 6891 if ($(this).index() == $contentElementsNum - 1 && $('#respond').length == 0 && $('body.woocommerce-checkout').length == 0) { 6892 $('.container-wrap').css('padding-bottom', '0px'); 6893 $('.bottom_controls').css('margin-top', '0px'); 6894 $('#call-to-action .triangle').remove(); 6895 } 6896 6897 } 6898 } 6899 } 6900 6901 });
6902 6903 6904 $('#portfolio-extra > .nectar-slider-wrap[data-full-width="true"], .portfolio-wrap').each(function () { 6905 //check if it's last 6906 if ($(this).index() == $contentElementsNum - 1 && $('#commentform').length == 0 && $('#pagination').length == 0) { 6907 if (parseInt($('.container-wrap').css('padding-bottom')) > 0) { 6908 $(this).css('margin-bottom', '-40px'); 6909 } 6910 $('#call-to-action .triangle').remove(); 6911 } 6912 }); 6913 6914 6915 $('.portfolio-filters').each(function () { 6916 ////first 6917 if ($(this).index() == '0' && $pageHeaderBG.length != 0 || $(this).index() == '0') { 6918 $(this).addClass('first-section nder-page-header'); 6919 } else if ($(this).index() == '0' && $pageHeaderBG.length == 0 || $(this).index() == '0') { 6920 $(this).css({ 6921 'margin-top': '0px' 6922 }).addClass('first-section'); 6923 } 6924 }); 6925 6926 6927 $('.portfolio-filters-inline').each(function () { 6928 ////first 6929 if ($(this).parents('.wpb_row').length > 0) { 6930 //skip processing. 6931 } else { 6932 if ($(this).index() == '0' && $pageHeaderBG.length != 0 || $(this).index() == '0') { 6933 $(this).addClass('first-section nder-page-header'); 6934 } else if ($(this).index() == '0' && $pageHeaderBG.length == 0 || $(this).index() == '0') { 6935 6936 $(this).css({ 6937 'margin-top': '-30px', 6938 'padding-top': '50px' 6939 }).addClass('first-section'); 6940 6941 } 6942 } 6943 6944 }); 6945 6946 6947 } 6948 6949 6950 6951 6952 /** 6953 * Full width row padding adjust calculations. 6954 * 6955 * @since 3.0 6956 */ 6957 function fullWidthRowPaddingAdjustCalc() { 6958 6959 if ($('#boxed').length == 0) { 6960 6961 $('.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 () { 6962 6963 var $windowHeight = $window.width(), 6964 $topPadding = ($(this).attr('data-top-percent')) ? $(this).attr('data-top-percent') : 'skip', 6965 $bottomPadding = ($(this).attr('data-bottom-percent')) ? $(this).attr('data-bottom-percent') : 'skip'; 6966 6967 //top 6968 if ($topPadding != 'skip') { 6969 $(this).css('padding-top', $windowHeight * (parseInt($topPadding) / 100)); 6970 } 6971 6972 //bottom 6973 if ($bottomPadding != 'skip') { 6974 $(this).css('padding-bottom', $windowHeight * (parseInt($bottomPadding) / 100)); 6975 } 6976 6977 }); 6978 } 6979 } 6980 6981 /** 6982 * Full width row padding adjust calculations for boxed theme option. 6983 * 6984 * @since 11.0.4 6985 */ 6986 function fullWidthRowPaddingAdjustCalcBoxed() { 6987 6988 if ($('#boxed').length > 0) { 6989 6990 $('.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 () { 6991 6992 var $topPadding = ($(this).attr('data-top-percent')) ? $(this).attr('data-top-percent') : 'skip', 6993 $bottomPadding = ($(this).attr('data-bottom-percent')) ? $(this).attr('data-bottom-percent') : 'skip'; 6994 6995 //top 6996 if ($topPadding != 'skip') { 6997 $(this).css('padding-top', $topPadding); 6998 } 6999 7000 //bottom 7001 if ($bottomPadding != 'skip') { 7002 $(this).css('padding-bottom', $bottomPadding); 7003 } 7004 7005 }); 7006 } 7007 7008 } 7009 7010 7011 /** 7012 * Full width row padding adjust initialization 7013 * 7014 * @since 10.5 7015 */ 7016 function fullWidthRowPaddingAdjust() { 7017 7018 if (nectarDOMInfo.usingMobileBrowser) { 7019 fullWidthRowPaddingAdjustCalc(); 7020 } 7021 7022 $window.on('resize', fullWidthRowPaddingAdjustCalc); 7023 7024 } 7025 7026 7027 7028 7029 /** 7030 * Full width content row auto equal height cols. 7031 * 7032 * @since 4.0 7033 */ 7034 function fullWidthContentColumns() { 7035 7036 var $frontEndEditorElDiv = ($('body.vc_editor').length > 0) ? '.vc_element > ' : ''; 7037 7038 $('.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 () { 7039 7040 // Only set the height if more than one column 7041 if ($(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col').length > 1) { 7042 7043 var tallestColumn = 0;
7044 var $columnInnerHeight = 0; 7045 var $column_inner_selector; 7046 7047 $(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col').each(function () { 7048 7049 $column_inner_selector = ($(this).find('> .vc_column-inner > .wpb_wrapper').length > 0) ? '.vc_column-inner' : '.column-inner-wrap > .column-inner'; 7050 7051 var $padding = ( $body.is('[data-flex-cols="true"]') ) ? parseInt($(this).find('> .vc_column-inner').css('padding-top')) : parseInt($(this).css('padding-top')); 7052 var $frontEndEditorElPadding = ($frontEndEditorElDiv.length > 2 && $(this).find('> .vc_column-inner').length > 0) ? parseInt($(this).find('> .vc_column-inner').css('padding-top')) : 0; 7053 7054 if( $(this).find('> ' + $column_inner_selector + ' > .wpb_wrapper').height() + ($padding * 2) + $frontEndEditorElPadding > tallestColumn ) { 7055 tallestColumn = $(this).find('> ' + $column_inner_selector + ' > .wpb_wrapper').height() + ($padding * 2) + $frontEndEditorElPadding; 7056 } 7057 7058 }); 7059 7060 $(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col').each(function () { 7061 7062 $column_inner_selector = ($(this).find('> .vc_column-inner > .wpb_wrapper').length > 0) ? '.vc_column-inner' : '.column-inner-wrap > .column-inner'; 7063 7064 // Columns with content 7065 if ($(this).find('> ' + $column_inner_selector + ' > .wpb_wrapper > *').length > 0) { 7066 7067 // Added in 7.6 to fix equal height columns 7068 if ($frontEndEditorElDiv.length < 2 && !$(this).parent().parent().hasClass('vc_row-o-equal-height')) { 7069 $(this).css('height', tallestColumn); 7070 7071 if( $body.is('[data-flex-cols="true"]') ) { 7072 $(this).find('> .vc_column-inner').css('height', tallestColumn); 7073 } 7074 7075 } else if ($frontEndEditorElDiv.length > 2 && !$(this).parent().parent().parent().hasClass('vc_row-o-equal-height')) { 7076 $(this).css('height', tallestColumn); 7077 7078 if( $body.is('[data-flex-cols="true"]') ) { 7079 $(this).find('> .vc_column-inner').css('height', tallestColumn); 7080 } 7081 7082 } 7083 } 7084 7085 // Empty columns 7086 else { 7087 if ($(this).is('[data-using-bg="true"]')) { 7088 7089 $(this).css('min-height', tallestColumn); 7090 7091 if( $body.is('[data-flex-cols="true"]') ) { 7092 $(this).find('> .vc_column-inner').css('min-height', tallestColumn); 7093 } 7094 7095 if ($(this).is('[data-animation*="reveal"]')) { 7096 $(this).find('.column-inner') 7097 .css('min-height', tallestColumn); 7098 } 7099 7100 } 7101 } 7102 7103 }); 7104 7105 // Nested column height 7106 if (nectarDOMInfo.winW < 1000) { 7107 $(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col .wpb_row .col').css('min-height', '0px'); 7108 } 7109 7110 // Vertically center 7111 if ($(this).hasClass('vertically-align-columns') && 7112 nectarDOMInfo.winW > 1000 && 7113 !$(this).hasClass('vc_row-o-equal-height')) { 7114 7115 // Parent columns 7116 $(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col').each(function () { 7117 7118 $column_inner_selector = ($(this).find('> .vc_column-inner > .wpb_wrapper').length > 0) ? '.vc_column-inner' : '.column-inner-wrap > .column-inner'; 7119
7120 $columnInnerHeight = $(this).find('> ' + $column_inner_selector + ' > .wpb_wrapper').height(); 7121 7122 var $marginCalc = ($(this).height() / 2) - ($columnInnerHeight / 2); 7123 7124 if ($marginCalc <= 0) { 7125 $marginCalc = 0; 7126 } 7127 7128 $(this).find('> ' + $column_inner_selector + ' > .wpb_wrapper') 7129 .css('margin-top', $marginCalc) 7130 .css('margin-bottom', $marginCalc); 7131 7132 }); 7133 7134 7135 } 7136 7137 } 7138 7139 }); 7140 7141 7142 if( $('body[data-flex-cols="true"]').length == 0 ) { 7143 7144 // Equal height columns in container type with reveal columns 7145 $('.main-content > .row > .wpb_row:not(.full-width-content).vc_row-o-equal-height').each(function () { 7146 if ($(this).find('>.span_12 > ' + $frontEndEditorElDiv + ' .wpb_column[data-animation*="reveal"]').length > 0) { 7147 7148 var tallestColumn = 0; 7149 7150 $(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col').each(function () { 7151 7152 var $padding = parseInt($(this).find('> .column-inner-wrap > .column-inner').css('padding-top')); 7153 7154 if( $(this).find('> .column-inner-wrap > .column-inner').height() + ($padding * 2) > tallestColumn ) { 7155 tallestColumn = $(this).find('> .column-inner-wrap > .column-inner').height() + ($padding * 2); 7156 } 7157 7158 });
7159 7160 $(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col').each(function () { 7161 7162 // Columns with content 7163 if ($(this).find('> .column-inner-wrap > .column-inner .wpb_wrapper > *').length > 0) { 7164 $(this).find('> .column-inner-wrap').css('height', tallestColumn); 7165 } 7166 // Empty columns 7167 else { 7168 $(this).css('min-height', tallestColumn); 7169 if ($(this).is('[data-animation*="reveal"]')) { 7170 $(this).find('.column-inner').css('min-height', tallestColumn); 7171 } 7172 } 7173 }); 7174 7175 } 7176 }); 7177 7178 // Using equal height option, top/bottom padding % needs to be convered into px for cross browser (flex bug) 7179 $('.wpb_row.vc_row-o-equal-height>.span_12> ' + $frontEndEditorElDiv + '.wpb_column[class*="padding-"][data-padding-pos="all"]').each(function () { 7180 if ($(this).parents('.tabbed').length == 0) { 7181 $(this).css({ 7182 'padding-top': $(this).css('padding-left'), 7183 'padding-bottom': $(this).css('padding-left') 7184 });
7185 } 7186 }); 7187 7188 } // endif; Not using modern grid system. 7189 7190 } 7191 7192 7193 7194 7195 /** 7196 * Mouse parallax row option. 7197 * 7198 * @since 4.0 7199 */ 7200 function mouseParallaxInit() { 7201 7202 $('.wpb_row:has(.nectar-parallax-scene)').each(function (i) { 7203 7204 var $strength = parseInt($(this).find('.nectar-parallax-scene').attr('data-scene-strength')); 7205 7206 $mouseParallaxScenes[i] = $(this).find('.nectar-parallax-scene').parallax({ 7207 scalarX: $strength, 7208 scalarY: $strength 7209 }); 7210 7211 // Wait until the images in the scene have loaded. 7212 var images = $(this).find('.nectar-parallax-scene li'); 7213 7214 $.each(images, function () { 7215 if ($(this).find('div').length > 0) { 7216 var el = $(this).find('div'), 7217 image = el.css('background-image').replace(/"/g, '').replace(/url\(|\)$/ig, ''); 7218 if (image && image !== '' && image !== 'none') { 7219 images = images.add($('<img>').attr('src', image)); 7220 } 7221 } 7222 }); 7223 7224 }); 7225 7226 } 7227 7228 7229 7230 7231 /** 7232 * Add checkmark icons to unorder list with checkmark class. 7233 * 7234 * @since 2.0 7235 */ 7236 function ulCheckmarks() { 7237 $('ul.checks li').each(function () { 7238 if ($(this).find('i.fa-check-circle').length == 0) { 7239 $(this).prepend('<i class="fa fa-check-circle"></i>'); 7240 } 7241 }); 7242 } 7243 7244 7245 7246 /** 7247 * Allow CTA element BG color to also act as a link. 7248 * 7249 * @since 11.0 7250 */ 7251 function ctaLinkBG() { 7252 7253 $body.on('click','.nectar-cta[data-using-bg="true"]:not([data-style="material"]) .link_wrap', function(e) { 7254 if( !$(e.target).is('a') ) { 7255 $(this).find('a.link_text')[0].click(); 7256 } 7257 }); 7258 7259 } 7260 7261 7262 7263 /** 7264 * Add CSS default animation classes through JS to 7265 * avoid inital animation on page load. 7266 * 7267 * @since 11.0 7268 */ 7269 function nectarKeyframeAssist() { 7270 7271 $('.nectar-cta[data-style="arrow-animation"]').addClass('loaded'); 7272 7273 } 7274 7275 7276 7277 7278 /** 7279 * Page builder row background layer animations. 7280 * 7281 * @since 9.0 7282 * @see waypoints 7283 */ 7284 function rowBGAnimations() { 7285 7286 var $rowBGAnimationsOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : '93%'; 7287 var $rowBGAnimationsRevealOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : '97%'; 7288 var $rowBGOffset; 7289 7290 $($fullscreenSelector + '.row-bg-wrap[data-bg-animation]:not([data-bg-animation="none"]) .row-bg').each(function () { 7291 7292 var $animation = $(this).parents('.row-bg-wrap').attr('data-bg-animation'); 7293 7294 if( $animation != 'zoom-out-reveal' && $animation.indexOf('reveal-from-') == -1 ) { 7295 $rowBGOffset = $rowBGAnimationsOffsetPos; 7296 } else { 7297 $rowBGOffset = $rowBGAnimationsRevealOffsetPos; 7298 } 7299 7300 if( !$(this).hasClass('using-image') && $(this).parents('.nectar-scrolling-text').length == 0 ) { 7301 7302 if( $animation != 'zoom-out-reveal' && $animation.indexOf('reveal-from-') == -1 ) { 7303 return; 7304 } 7305 7306 } 7307 7308 7309 var $that = $(this); 7310 var waypoint = new Waypoint({ 7311 element: $that.parents('.row-bg-wrap'), 7312 handler: function () { 7313 7314 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 7315 waypoint.destroy(); 7316 return; 7317 } 7318 7319 $that.parents('.inner-wrap').addClass('animated-in'); 7320 7321 if( $animation == 'zoom-out-reveal' || $animation.indexOf('reveal-from-') > -1 || $that.parents('.nectar-scrolling-text').length > 0 ) { 7322 $that.parents('.row-bg-wrap').addClass('animated-in'); 7323 } 7324 7325 waypoint.destroy(); 7326 }, 7327 offset: $rowBGOffset 7328 }); 7329 7330 }); 7331 7332 } 7333 7334 7335 /** 7336 * Page builder column background layer animations. 7337 * 7338 * @since 9.0 7339 * @see waypoints 7340 */ 7341 function columnBGAnimations() { 7342 7343 var $colBGAnimationsOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : '93%'; 7344 var $colBGAnimationsRevealOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : '80%'; 7345 var $colBGOffset; 7346 7347 $($fullscreenSelector + '.column-image-bg-wrap[data-bg-animation]:not([data-bg-animation="none"]):not([data-bg-animation*="displace-filter"]) .column-image-bg').each(function () { 7348 7349 var $animation = $(this).parents('.column-image-bg-wrap').attr('data-bg-animation'); 7350 7351 if( $animation != 'zoom-out-reveal' && $animation.indexOf('reveal-from-') == -1 ) { 7352 $colBGOffset = $colBGAnimationsOffsetPos; 7353 } else { 7354 7355 if( $animation == 'ro-reveal-from-bottom' && $fullscreenMarkupBool == false ) { 7356 $colBGOffset = '95%'; 7357 } else if( $animation == 'ro-reveal-from-top' && $fullscreenMarkupBool == false ) { 7358 $colBGOffset = '65%'; 7359 } else { 7360 $colBGOffset = $colBGAnimationsRevealOffsetPos; 7361 } 7362 } 7363 7364 var $that = $(this); 7365 7366 var waypoint = new Waypoint({ 7367 element: $that.parents('.column-image-bg-wrap'), 7368 handler: function () { 7369 7370 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 7371 waypoint.destroy(); 7372 return; 7373 } 7374 7375 $that.parents('.inner-wrap').addClass('animated-in'); 7376 if( $animation == 'zoom-out-reveal' || $animation.indexOf('reveal-from-') > -1 ) { 7377 $that.parents('.column-image-bg-wrap').addClass('animated-in'); 7378 $that.parents('.column-image-bg-wrap').siblings('.column-bg-overlay-wrap').addClass('animated-in'); 7379 $that.parents('.vc_column-inner').addClass('revealed-bg'); 7380 } 7381 waypoint.destroy(); 7382 }, 7383 offset: $colBGOffset 7384 });
7385 7386 }); 7387 7388 // Zoom out reveal with BG color only 7389 $($fullscreenSelector + '.column-bg-overlay-wrap[data-bg-animation]').each(function () { 7390 7391 $colBGOffset = $colBGAnimationsRevealOffsetPos; 7392 7393 var $that = $(this); 7394 var $animation = $(this).attr('data-bg-animation'); 7395 7396 if( $animation == 'zoom-out-reveal' || $animation.indexOf('reveal-from-') > 0 ) { 7397 7398 if( $that.parent().find('.column-image-bg-wrap').length == 0 ) { 7399 7400 var waypoint = new Waypoint({ 7401 element: $that, 7402 handler: function () { 7403 7404 if ( $that.hasClass('animated-in') ) { 7405 waypoint.destroy(); 7406 return; 7407 } 7408 7409 $that.addClass('animated-in'); 7410 $that.parents('.vc_column-inner').addClass('revealed-bg'); 7411 waypoint.destroy(); 7412 7413 }, 7414 offset: $colBGOffset 7415 }); 7416 7417 } 7418 7419 } 7420 7421 }); 7422 7423 } 7424 7425 7426 7427 /** 7428 * Page builder column and image animations. 7429 * 7430 * @since 4.0 7431 * @see waypoints 7432 */ 7433 function colAndImgAnimations() { 7434 7435 var $colAndImgOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : '88%'; 7436 var $cascadingOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : '70%'; 7437 var $colAndImgRevealOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : '70%'; 7438 7439 $($fullscreenSelector + '.img-with-animation').each(function () { 7440 7441 var $that = $(this); 7442 7443 var $animationType = ($that.is('[data-animation]')) ? $that.attr('data-animation') : 'fade-in'; 7444 7445 // reveal images alters offset 7446 if( $animationType == 'ro-reveal-from-right' && $colAndImgOffsetPos == '88%' || 7447 $animationType == 'ro-reveal-from-left' && $colAndImgOffsetPos == '88%' ) { 7448 $colAndImgOffsetPos = '75%'; 7449 } 7450 7451 // initiate waypoint. 7452 var waypoint = new Waypoint({ 7453 element: $that, 7454 handler: function () { 7455 7456 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 7457 waypoint.destroy(); 7458 return; 7459 } 7460 7461 if (!bypassAnimations || $('body[data-responsive="0"]').length > 0) { 7462 7463 var $delay = ($that.is('[data-delay]')) ? $that.attr('data-delay') : 0; 7464 var $elToAnimate = ($that.parents('.hover-wrap').length > 0) ? $that.parents('.hover-wrap') : $that; 7465 7466 7467 if ($animationType == 'fade-in-from-left' || $animationType == 'fade-in-from-right') { 7468 7469 $elToAnimate.delay($delay).transition({ 7470 'opacity': 1, 7471 'x': '0px' 7472 }, $animationDuration, $animationEasing); 7473 7474 } else if ($animationType == 'fade-in-from-bottom') { 7475 7476 $elToAnimate.delay($delay).transition({ 7477 'opacity': 1, 7478 'y': '0px' 7479 }, $animationDuration, $animationEasing); 7480 7481 } else if ($animationType == 'fade-in') { 7482 7483 $elToAnimate.delay($delay).transition({ 7484 'opacity': 1 7485 }, $animationDuration, $animationEasing); 7486 7487 } else if ($animationType == 'grow-in') { 7488 7489 setTimeout(function () { 7490 $elToAnimate.transition({ 7491 scale: 1, 7492 'opacity': 1 7493 }, $animationDuration, $animationEasing); 7494 }, $delay); 7495 7496 } else if ($animationType == 'flip-in') { 7497 7498 setTimeout(function () { 7499 $elToAnimate.transition({ 7500 rotateY: 0, 7501 'opacity': 1 7502 }, $animationDuration, $animationEasing); 7503 }, $delay); 7504 7505 } else if ($animationType == 'flip-in-vertical') { 7506 7507 setTimeout(function () { 7508 $elToAnimate.transition({ 7509 rotateX: 0, 7510 'opacity': 1 7511 }, $animationDuration, $animationEasing); 7512 }, $delay); 7513 7514 } 7515 else if ($animationType == 'ro-reveal-from-left' || 7516 $animationType == 'ro-reveal-from-right' || 7517 $animationType == 'ro-reveal-from-bottom' || 7518 $animationType == 'ro-reveal-from-top') { 7519 $that.parents('.img-with-aniamtion-wrap').addClass('animated-in'); 7520 } 7521 7522 $that.addClass('animated-in'); 7523 7524 } 7525 7526 waypoint.destroy(); 7527 7528 }, 7529 offset: $colAndImgOffsetPos 7530 });
7531 7532 7533 7534 }); 7535 7536 7537 $($fullscreenSelector + '.nectar_cascading_images').each(function () { 7538 7539 var $that = $(this); 7540 var $animationDelay = ($(this).is('[data-animation-timing]')) ? $(this).attr('data-animation-timing') : 175; 7541 $animationDelay = parseInt($animationDelay); 7542 7543 var waypoint = new Waypoint({ 7544 element: $that, 7545 handler: function () { 7546 7547 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 7548 waypoint.destroy(); 7549 return; 7550 } 7551 7552 if (!bypassAnimations || $('body[data-responsive="0"]').length > 0) { 7553 7554 $that.find('.cascading-image').each(function (i) { 7555 7556 var $that2 = $(this); 7557 7558 if ($that2.attr('data-animation') == 'flip-in' || $that2.attr('data-animation') == 'flip-in-vertical') { 7559 setTimeout(function () { 7560 $that2.find('.inner-wrap').css({ 7561 'opacity': 1, 7562 'transform': 'rotate(0deg) translateZ(0px)' 7563 }); 7564 }, i * $animationDelay); 7565 } else if( $that2.attr('data-animation') == 'grow-in-reveal' ) { 7566 setTimeout(function () { 7567 $that2.find('.inner-wrap').css({ 7568 'opacity': 1, 7569 'transform': 'translateX(0px) translateY(0px) scale(1,1) translateZ(0px)' 7570 }); 7571 $that2.find('.inner-wrap img').css({ 7572 'transform': 'translateX(0px) translateY(0px) scale(1,1) translateZ(0px)' 7573 }); 7574 }, i * $animationDelay); 7575 } 7576 else { 7577 setTimeout(function () { 7578 $that2.find('.inner-wrap').css({ 7579 'opacity': 1, 7580 'transform': 'translateX(0px) translateY(0px) scale(1,1) translateZ(0px)' 7581 }); 7582 }, i * $animationDelay); 7583 } 7584 7585 7586 }); 7587 7588 $that.addClass('animated-in'); 7589 7590 } 7591 7592 waypoint.destroy(); 7593 7594 }, 7595 offset: $cascadingOffsetPos 7596 }); 7597 7598 }); 7599 7600 7601 $($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) { 7602 7603 var $that = $(this); 7604 7605 var waypoint = new Waypoint({ 7606 element: $that, 7607 handler: function () { 7608 7609 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 7610 waypoint.destroy(); 7611 return; 7612 } 7613 7614 if (!bypassAnimations || $('body[data-responsive="0"]').length > 0) { 7615 7616 $that.addClass('triggered-animation'); 7617 $(window).trigger('nectar-column-animation-start'); 7618 7619 var $delay = $that.attr('data-delay'); 7620 7621 if ($that.attr('data-animation') == 'fade-in-from-left' || $that.attr('data-animation') == 'fade-in-from-right') { 7622 7623 $standAnimatedColTimeout[i] = setTimeout(function () { 7624 $that.transition({ 7625 'opacity': 1, 7626 'x': '0px' 7627 }, $animationDuration, $animationEasing); 7628 }, $delay); 7629 7630 } else if ($that.attr('data-animation') == 'fade-in-from-bottom') { 7631 7632 $standAnimatedColTimeout[i] = setTimeout(function () { 7633 $that.transition({ 7634 'opacity': 1, 7635 'y': '0px' 7636 }, $animationDuration, $animationEasing); 7637 }, $delay); 7638 7639 } else if ($that.attr('data-animation') == 'fade-in') { 7640 7641 $standAnimatedColTimeout[i] = setTimeout(function () { 7642 $that.transition({ 7643 'opacity': 1 7644 }, $animationDuration, $animationEasing); 7645 }, $delay); 7646 7647 } else if ($that.attr('data-animation') == 'grow-in' || $that.attr('data-animation') == 'zoom-out') { 7648 7649 $standAnimatedColTimeout[i] = setTimeout(function () { 7650 $that.transition({ 7651 scale: 1, 7652 'opacity': 1 7653 }, $animationDuration, $animationEasing); 7654 }, $delay); 7655 7656 } else if ($that.attr('data-animation') == 'flip-in') { 7657 7658 $standAnimatedColTimeout[i] = setTimeout(function () { 7659 $that.transition({ 7660 rotateY: '0', 7661 'opacity': 1 7662 }, $animationDuration, $animationEasing); 7663 }, $delay); 7664 7665 } else if ($that.attr('data-animation') == 'flip-in-vertical') { 7666 7667 $standAnimatedColTimeout[i] = setTimeout(function () { 7668 $that.transition({ 7669 rotateX: '0', 7670 y: '0', 7671 'opacity': 1 7672 }, $animationDuration, $animationEasing); 7673 }, $delay); 7674 7675 } else if ($that.attr('data-animation') == 'slight-twist') { 7676 7677 $standAnimatedColTimeout[i] = setTimeout(function () { 7678 anime({ 7679 targets: $that[0], 7680 rotateY: [20, 0], 7681 rotateZ: [-4, 0], 7682 opacity: 1, 7683 easing: $animationEasing, 7684 duration: $animationDuration 7685 });
7686 }, $delay); 7687 7688 } 7689 7690 //boxed column hover fix 7691 if ($that.hasClass('boxed')) { 7692 $that.addClass('no-pointer-events'); 7693 setTimeout(function () { 7694 $that.removeClass('no-pointer-events'); 7695 }, parseInt($animationDuration) + parseInt($delay) + 30); 7696 } 7697 7698 if ($that.find('.nectar-post-grid-wrap[data-style="mouse_follow_image"]')) { 7699 setTimeout(function() { 7700 $that[0].style.transform = 'none'; 7701 }, parseInt($animationDuration) + parseInt($delay) + 30 ); 7702 } 7703 7704 $that.addClass('animated-in'); 7705 7706 } 7707 7708 waypoint.destroy(); 7709 }, 7710 offset: $colAndImgOffsetPos 7711 }); 7712 7713 }); 7714 7715 7716 $($fullscreenSelector + '.wpb_column.has-animation[data-animation*="reveal"]').each(function () { 7717 7718 var $that = $(this), 7719 waypoint = new Waypoint({ 7720 element: $that, 7721 handler: function () { 7722 7723 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 7724 waypoint.destroy(); 7725 return; 7726 } 7727 7728 var $delay = $that.attr('data-delay'); 7729 7730 if (!bypassAnimations || $('body[data-responsive="0"]').length > 0) { 7731 7732 var $columnInnerSelector = ( $that.find('> .vc_column-inner').length > 0 ) ? true : false; 7733 7734 if ($that.attr('data-animation') == 'reveal-from-bottom' || $that.attr('data-animation') == 'reveal-from-top') { 7735 7736 setTimeout(function () { 7737 7738 if ($that.hasClass('animated-in')) { 7739 7740 if( $columnInnerSelector == true ) { 7741 7742 // Modern. 7743 $that.find('> .vc_column-inner').transition({ 7744 'y': 0 7745 }, $animationDuration, $animationEasing ); 7746 7747 } else { 7748 7749 // Legacy. 7750 $that.find('.column-inner-wrap, .column-inner').transition({ 7751 'y': 0 7752 }, $animationDuration, $animationEasing, function () { 7753 $that.find('.column-inner-wrap, .column-inner').addClass('no-transform'); 7754 }); 7755 } 7756 7757 } 7758 7759 }, $delay); 7760 7761 } else if ($that.attr('data-animation') == 'reveal-from-right' || $that.attr('data-animation') == 'reveal-from-left') { 7762 setTimeout(function () { 7763 if ($that.hasClass('animated-in')) { 7764 7765 if( $columnInnerSelector == true ) { 7766 7767 // Modern. 7768 $that.find('> .vc_column-inner').transition({ 7769 'x': 0 7770 }, $animationDuration, $animationEasing); 7771 7772 7773 } else { 7774 // Legacy. 7775 $that.find('.column-inner-wrap, .column-inner').transition({ 7776 'x': 0 7777 }, $animationDuration, $animationEasing, function () { 7778 $that.find('.column-inner-wrap, .column-inner').addClass('no-transform'); 7779 }); 7780 7781 } 7782 7783 7784 } 7785 }, $delay); 7786 } 7787 7788 $that.addClass('animated-in'); 7789 7790 } 7791 7792 waypoint.destroy(); 7793 }, 7794 offset: $colAndImgRevealOffsetPos 7795 }); 7796 7797 }); 7798 7799 } 7800 7801 7802 7803 /** 7804 * Cascading images element sizing 7805 * 7806 * @since 6.0 7807 */ 7808 function cascadingImageBGSizing() { 7809 7810 $('.nectar_cascading_images').each(function () { 7811 7812 var forcedAspect = ( $(this).hasClass('forced-aspect') ) ? true : false; 7813 7814 //handle max width for cascading images in equal height columns 7815 if ($(this).parents('.vc_row-o-equal-height').length > 0 && $(this).parents('.wpb_column').length > 0) { 7816 $(this).css('max-width', $(this).parents('.wpb_column').width()); 7817 } 7818 7819 //set size for layers with no images 7820 $(this).find('.bg-color').each(function () { 7821 7822 if( forcedAspect == true && $(this).parents('.cascading-image').index() == 0 ) { 7823 return true; 7824 } 7825 7826 var $bgColorHeight = 0; 7827 var $bgColorWidth = 0; 7828 7829 if ($(this).parent().find('.img-wrap').length == 0) { 7830 7831 var $firstSibling = $(this).parents('.cascading-image').siblings('.cascading-image[data-has-img="true"]').first(); 7832 7833 $bgColorHeight = $firstSibling.find('.img-wrap').height(); 7834 $bgColorWidth = $firstSibling.find('.img-wrap').width(); 7835 7836 } else { 7837 $bgColorHeight = $(this).parent().find('.img-wrap').height(); 7838 $bgColorWidth = $(this).parent().find('.img-wrap').width(); 7839 } 7840 7841 $(this).css({ 7842 'height': $bgColorHeight, 7843 'width': $bgColorWidth 7844 }).addClass('calculated'); 7845 7846 });
7847 7848 }); 7849 7850 } 7851 7852 7853 7854 7855 /** 7856 * Cascading images element initialization. 7857 * 7858 * @since 10.5 7859 */ 7860 function cascadingImageInit() { 7861 7862 if ($('.nectar_cascading_images').length > 0) { 7863 7864 var cascadingParallax = []; 7865 7866 $('.nectar_cascading_images').each(function(i){ 7867 7868 imagesLoaded($(this), function (instance) { 7869 7870 // Create sizes. 7871 cascadingImageBGSizing(); 7872 7873 // Parallax scrolling. 7874 if( $(instance.elements[0]).is('[data-parallax="yes"]') && !nectarDOMInfo.usingMobileBrowser && $('#nectar_fullscreen_rows').length == 0 ) { 7875 cascadingParallax[i] = new CascadingParallax($(instance.elements[0]), $(instance.elements[0]).attr('data-parallax-intensity')); 7876 } 7877 7878 }); 7879 7880 }); 7881 7882 // BG Sizing Resize. 7883 $window.on('resize', cascadingImageBGSizing); 7884 7885 } 7886 7887 } 7888 7889 7890 7891 7892 function CascadingParallax(el, intensity) { 7893 7894 this.$element = el; 7895 this.inView = false; 7896 this.topLevel = false; 7897 this.lastY = 0; 7898 7899 this.layer1Parallax = ( this.$element.is('[data-layer-1-parallax="yes"]') ) ? true : false; 7900 7901 switch(intensity) { 7902 case 'subtle': 7903 this.intensity = 0.09; 7904 break; 7905 case 'medium': 7906 this.intensity = 0.15; 7907 break; 7908 case 'high': 7909 this.intensity = 0.25; 7910 break; 7911 } 7912 this.calculatePos(); 7913 this.trackView(); 7914 this.animate(); 7915 7916 if( $('.portfolio-filters').length > 0 || 7917 $('.portfolio-filters-inline').length > 0 ) { 7918 setInterval(this.calculatePos.bind(this),700); 7919 } 7920 7921 $window.on('resize', this.calculatePos.bind(this)); 7922 } 7923 7924 CascadingParallax.prototype.calculatePos = function() { 7925 this.offsetTop = this.$element.offset().top; 7926 this.height = this.$element.outerHeight(); 7927 this.vertCenter = nectarDOMInfo.winH/2 - this.height/2; 7928 }; 7929 7930 CascadingParallax.prototype.trackView = function() { 7931 7932 var that = this; 7933 7934 if( this.$element.parents('.top-level').length > 0 ) { 7935 this.topLevel = true; 7936 } 7937 7938 if( 'IntersectionObserver' in window ) { 7939 7940 var options = { 7941 rootMargin: '250px', 7942 } 7943 var observer = new IntersectionObserver(function(entries) { 7944 7945 entries.forEach(function(entry){ 7946 var isIntersecting = entry.isIntersecting; 7947 7948 if (isIntersecting) { 7949 that.inView = true; 7950 } else { 7951 that.inView = false; 7952 } 7953 }); 7954 7955 }, options); 7956 7957 observer.observe(this.$element[0]); 7958 7959 } 7960 7961 }; 7962 7963 CascadingParallax.prototype.animate = function() { 7964 7965 if( nectarState.materialOffCanvasOpen == true ) { 7966 window.requestAnimationFrame(this.animate.bind(this)); 7967 return; 7968 } 7969 7970 this.lastY = linearInterpolate(this.lastY, nectarDOMInfo.scrollTop, 0.2); 7971 7972 if( this.inView ) { 7973 7974 var that = this; 7975 7976 this.$element.find('.bg-layer').each(function(i) { 7977 7978 var $scale = $(this).data('scale'); 7979 7980 if( that.layer1Parallax ) { 7981 i = (i/1.5)+1; 7982 } 7983 7984 if( that.topLevel === true && nectarDOMInfo.winW > 1000) { 7985 $(this)[0].style.transform = 'translateY(' + -(that.lastY * that.intensity * i) + 'px) translateZ(0) scale(' + $scale + ')'; 7986 } else { 7987 $(this)[0].style.transform = 'translateY(' + -((that.lastY - that.offsetTop + that.vertCenter ) * that.intensity * i ) + 'px) translateZ(0) scale(' + $scale + ')'; 7988 } 7989 7990 }); 7991 } 7992 7993 window.requestAnimationFrame(this.animate.bind(this)); 7994 }; 7995 7996 7997 7998 7999 /** 8000 * Split line heading element initialization. 8001 * 8002 * @since 10.5 8003 * @see waypoints 8004 */ 8005 function splitLineHeadings() { 8006 8007 // Create waypoint. 8008 var $splitLineOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : 'bottom-in-view'; 8009 $($fullscreenSelector + '.nectar-split-heading').each(function () { 8010 8011 var $that = $(this); 8012 var $delay = ( $that.is('[data-animation-delay]') ) ? parseInt($that.attr('data-animation-delay')) : 0; 8013 8014 var waypoint = new Waypoint({ 8015 element: $that, 8016 handler: function () { 8017 8018 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 8019 waypoint.destroy(); 8020 return; 8021 } 8022 8023 if (!bypassAnimations || $('body[data-responsive="0"]').length > 0) { 8024 8025 var $animationDurationCap; 8026 8027 setTimeout(function() { 8028 8029 if( $that.is('[data-animation-type="line-reveal-by-space"]') ) { 8030 8031 var stagger = 0; 8032 if( $that.is('[data-stagger="true"]') ) { 8033 stagger = 500 / $that.find('> * > span').length; 8034 stagger = Math.min(Math.max(stagger, 15), 50); // Clamp val 8035 } 8036 8037 $animationDurationCap = (parseInt($animationDuration) < 1100) ? $animationDuration : '1100'; 8038 8039 if( $that.is('[data-m-rm-animation="true"]') && nectarDOMInfo.winW < 1000 ) { 8040 $that.find('> * > span .inner').css({ 8041 'transform' : 'translateY(0)' 8042 });
8043 } 8044 else { 8045 $that.find('> * > span').each(function (i) { 8046 8047 if( stagger == 0 ) { 8048 $(this).find('> .inner').delay(i * stagger).transition({ 8049 'y': '0px' 8050 }, $animationDurationCap, $animationEasing); 8051 } 8052 else { 8053 var spanEl = $(this); 8054 var $innerEl = spanEl.find('> .inner'); 8055 setTimeout(function(){ 8056 $innerEl[0].style.transform = 'translateY(0em)'; 8057 }, i * stagger); 8058 8059 } 8060 8061 }); 8062 } 8063 8064 } else if( $that.is('[data-animation-type="letter-fade-reveal"]') ) { 8065 8066 $animationDurationCap = (parseInt($animationDuration) < 1000) ? $animationDuration : '1000'; 8067 $that.find('> * > span span').each(function (i) { 8068 8069 $(this).delay(i * 8).transition({ 8070 'y': '0px', 8071 'opacity': '1' 8072 }, $animationDurationCap, $animationEasing); 8073 8074 }); 8075 8076 } else { 8077 $that.find('.heading-line').each(function (i) { 8078 8079 $(this).find('> div').delay(i * 70).transition({ 8080 'y': '0px' 8081 }, $animationDuration, $animationEasing); 8082 8083 }); 8084 } 8085 8086 $that.addClass('animated-in'); 8087 8088 }, $delay); 8089 8090 } 8091 8092 waypoint.destroy(); 8093 }, 8094 offset: $splitLineOffsetPos 8095 }); 8096 8097 }); 8098 } 8099 8100 8101 8102 /** 8103 * Progress bar element initialization. 8104 * 8105 * @since 3.0 8106 * @see waypoints 8107 */ 8108 8109 function progressBars() { 8110 8111 var $progressBarsOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : 'bottom-in-view'; 8112 var $progressSelector = ($('#nectar_fullscreen_rows[data-mobile-disable="on"]').length > 0 && nectarDOMInfo.usingMobileBrowser) ? '.nectar-progress-bar' : $fullscreenSelector + '.nectar-progress-bar'; 8113 8114 if( nectarDOMInfo.usingMobileBrowser && $progressBarsOffsetPos == 'bottom-in-view') { 8115 $progressBarsOffsetPos = '70%'; 8116 } 8117 8118 $($progressSelector).each(function () { 8119 8120 var $that = $(this); 8121 8122 var waypoint = new Waypoint({ 8123 element: $that, 8124 handler: function () { 8125 8126 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 8127 waypoint.destroy(); 8128 return; 8129 } 8130 8131 if ($progressBarsOffsetPos == '100%') { 8132 $that.find('.bar-wrap').css('opacity', '1'); 8133 } 8134 8135 8136 var percent = $that.find('span').attr('data-width'), 8137 $endNum = parseInt($that.find('span strong i').text()); 8138 8139 $that.find('span').transition({ 8140 'width': percent + '%' 8141 }, 800, 'easeInOutCubic'); 8142 8143 var countOptions = { 8144 useEasing: false 8145 }; 8146 var $countEle = $that.find('span strong i')[0]; 8147 var numAnim = new CountUp($countEle, 0, $endNum, 0, 1, countOptions); 8148 numAnim.start(); 8149 8150 $that.find('span strong').transition({ 8151 'opacity': 1 8152 }, 550, 'easeInCirc'); 8153 8154 ////100% progress bar 8155 if (percent == '100') { 8156 $that.find('span strong').addClass('full'); 8157 } 8158 8159 $that.addClass('completed'); 8160 8161 waypoint.destroy(); 8162 8163 }, 8164 offset: $progressBarsOffsetPos 8165 }); 8166 8167 }); 8168 8169 } 8170 8171 8172 8173 /** 8174 * Page builder column border animations. 8175 * 8176 * @since 8.0 8177 * @see waypoints 8178 */ 8179 function animatedColBorders() { 8180 8181 var $progressBarsOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : '75%'; 8182 $($fullscreenSelector + '.wpb_column[data-border-animation="true"]').each(function () { 8183 8184 var $that = $(this), 8185 waypoint = new Waypoint({ 8186 element: $that, 8187 handler: function () { 8188 8189 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 8190 waypoint.destroy(); 8191 return; 8192 } 8193 8194 var $borderDelay = ($that.attr('data-border-animation-delay').length > 0) ? parseInt($that.attr('data-border-animation-delay')) : 0; 8195 setTimeout(function () { 8196 $that.find('.border-wrap').addClass('animation'); 8197 $that.find('.border-wrap').addClass('completed'); 8198 }, $borderDelay); 8199 8200 waypoint.destroy(); 8201 8202 }, 8203 offset: $progressBarsOffsetPos 8204 });
8205 8206 }); 8207 } 8208 8209 8210 8211 /** 8212 * Food menu item element. 8213 * 8214 * @since 8.0 8215 * @see waypoints 8216 */ 8217 function foodMenuItems() { 8218 8219 var $foodItemOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : '80%'; 8220 $($fullscreenSelector + '.nectar_food_menu_item').parent().each(function () { 8221 8222 var $that = $(this), 8223 waypoint = new Waypoint({ 8224 element: $that, 8225 handler: function () { 8226 8227 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 8228 waypoint.destroy(); 8229 return; 8230 } 8231 8232 $that.find('.nectar_food_menu_item').each(function (i) { 8233 8234 var $that = $(this); 8235 8236 setTimeout(function () { 8237 $that.addClass('animated-in'); 8238 }, i * 150); 8239 8240 }); 8241 8242 waypoint.destroy(); 8243 8244 }, 8245 offset: $foodItemOffsetPos 8246 }); 8247 8248 }); 8249 } 8250 8251 8252 8253 /** 8254 * Divider element 8255 * 8256 * @since 3.0 8257 * @see waypoints 8258 */ 8259 function dividers() { 8260 8261 var $dividerOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : 'bottom-in-view'; 8262 8263 $($fullscreenSelector + '.divider-small-border[data-animate="yes"], ' + $fullscreenSelector + '.divider-border[data-animate="yes"]').each(function () { 8264 8265 var $lineDur = ($(this).hasClass('divider-small-border')) ? 1300 : 1500, 8266 $that = $(this), 8267 waypoint = new Waypoint({ 8268 element: $that, 8269 handler: function () { 8270 8271 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 8272 waypoint.destroy(); 8273 return; 8274 } 8275 8276 $that.each(function () { 8277 8278 $(this).css({ 8279 'transform': 'scale(0,1)', 8280 'visibility': 'visible' 8281 }); 8282 var $that = $(this); 8283 8284 $that.delay($that.attr('data-animation-delay')).transition({ 8285 'transform': 'scale(1, 1)' 8286 }, $lineDur, 'cubic-bezier(.18,1,.22,1)'); 8287 8288 });
8289 8290 $that.addClass('completed'); 8291 8292 waypoint.destroy(); 8293 8294 }, 8295 offset: $dividerOffsetPos 8296 }); 8297 8298 }); 8299 } 8300 8301 8302 8303 /** 8304 * Image with hotspots element hover event 8305 * 8306 * @since 7.0 8307 */ 8308 function hotSpotHoverBind() { 8309 8310 //add pulse animation 8311 $('.nectar_image_with_hotspots[data-hotspot-icon="numerical"]').each(function () { 8312 $(this).find('.nectar_hotspot_wrap').each(function (i) { 8313 var $that = $(this); 8314 setTimeout(function () { 8315 $that.find('.nectar_hotspot').addClass('pulse'); 8316 }, i * 300); 8317 }); 8318 }); 8319 8320 8321 var hotSpotHoverTimeout = []; 8322 8323 $('.nectar_image_with_hotspots:not([data-tooltip-func="click"]) .nectar_hotspot').each(function (i) { 8324 8325 hotSpotHoverTimeout[i] = ''; 8326 8327 $(this).on('mouseover', function () { 8328 clearTimeout(hotSpotHoverTimeout[i]); 8329 $(this).parent().css({ 8330 'z-index': '400', 8331 'height': 'auto', 8332 'width': 'auto' 8333 }); 8334 }); 8335 8336 $(this).on('mouseleave', function () { 8337 8338 var $that = $(this); 8339 $that.parent().css({ 8340 'z-index': 'auto' 8341 }); 8342 8343 hotSpotHoverTimeout[i] = setTimeout(function () { 8344 $that.parent().css({ 8345 'height': '30px', 8346 'width': '30px' 8347 });
8348 }, 300); 8349 8350 }); 8351 8352 }); 8353 8354 } 8355 8356 8357 8358 /** 8359 * Image with hotspots element responsive behavior. 8360 * 8361 * @since 7.0 8362 */ 8363 function responsiveTooltips() { 8364 8365 $('.nectar_image_with_hotspots').each(function () { 8366 8367 $(this).find('.nectar_hotspot_wrap').each(function () { 8368 8369 if (nectarDOMInfo.winW > 690) { 8370 8371 // Remove click if applicable 8372 if ($(this).parents('.nectar_image_with_hotspots[data-tooltip-func="hover"]').length > 0) { 8373 $(this).find('.nectar_hotspot').removeClass('click'); 8374 $(this).find('.nttip').removeClass('open'); 8375 } 8376 8377 $(this).find('.nttip .inner a.tipclose').remove(); 8378 $('.nttip').css('height', 'auto'); 8379 8380 // Reset for positioning 8381 $(this).css({ 8382 'width': 'auto', 8383 'height': 'auto' 8384 }); 8385 8386 $(this).find('.nttip') 8387 .removeClass('force-right') 8388 .removeClass('force-left') 8389 .removeClass('force-top') 8390 .css('width', 'auto'); 8391 8392 var $tipOffset = $(this).find('.nttip').offset(); 8393 8394 // Against right side 8395 if ($tipOffset.left > $(this).parents('.nectar_image_with_hotspots').width() - 200) { 8396 $(this).find('.nttip').css('width', '250px'); 8397 } 8398 else { 8399 $(this).find('.nttip').css('width', 'auto'); 8400 } 8401 8402 // Responsive 8403 if ($tipOffset.left < 0) { 8404 $(this).find('.nttip').addClass('force-right'); 8405 } 8406 else if ($tipOffset.left + $(this).find('.nttip').outerWidth(true) > nectarDOMInfo.winW) { 8407 $(this).find('.nttip').addClass('force-left').css('width', '250px'); 8408 } 8409 else if ($tipOffset.top + $(this).find('.nttip').height() + 35 > $window.height() && $('#nectar_fullscreen_rows').length > 0) { 8410 $(this).find('.nttip').addClass('force-top'); 8411 } 8412 8413 if ($(this).find('> .open').length == 0) { 8414 8415 $(this).css({ 8416 'width': '30px', 8417 'height': '30px' 8418 }); 8419 } 8420 8421 } else { 8422 8423 //fixed position 8424 $(this).find('.nttip') 8425 .removeClass('force-left') 8426 .removeClass('force-right') 8427 .removeClass('force-top'); 8428 8429 $(this).find('.nectar_hotspot').addClass('click'); 8430 8431 if ($(this).find('.nttip a.tipclose').length == 0) { 8432 $(this).find('.nttip .inner').append('<a href="#" class="tipclose"><span></span></a>'); 8433 } 8434 8435 // Change height of fixed 8436 $('.nttip').css('height', $window.height()); 8437 } 8438 }); 8439 }); 8440 8441 } 8442 8443 8444 /** 8445 * Image with hotspots events 8446 * 8447 * @since 10.5 8448 */ 8449 function imageWithHotspotEvents() { 8450 8451 if( $('.nectar_image_with_hotspots').length == 0 ) { 8452 return; 8453 } 8454 8455 // Hover 8456 hotSpotHoverBind(); 8457 8458 // Click 8459 $body.on('click', '.nectar_hotspot.click', function () { 8460 $(this).parents('.nectar_image_with_hotspots').find('.nttip').removeClass('open'); 8461 $(this).parent().find('.nttip').addClass('open'); 8462 8463 $(this).parents('.nectar_image_with_hotspots').find('.nectar_hotspot').removeClass('open'); 8464 $(this).parent().find('.nectar_hotspot').addClass('open'); 8465 8466 if (nectarDOMInfo.winW > 690) { 8467 $(this).parent().css({ 8468 'z-index': '120', 8469 'height': 'auto', 8470 'width': 'auto' 8471 }); 8472 8473 var $that = $(this); 8474 8475 setTimeout(function () { 8476 $that.parents('.nectar_image_with_hotspots').find('.nectar_hotspot_wrap').each(function () { 8477 8478 if ($(this).find('> .open').length == 0) { 8479 $(this).css({ 8480 'height': '30px', 8481 'width': '30px', 8482 'z-index': 'auto' 8483 }); 8484 } 8485 });
8486 }, 300); 8487 } 8488 8489 if (nectarDOMInfo.winW <= 690) { 8490 $(this).parents('.wpb_row, [class*="vc_col-"]').css('z-index', '200'); 8491 } 8492 8493 return false; 8494 }); 8495 8496 $body.on('click', '.nectar_hotspot.open', function () { 8497 $(this).parent().find('.nttip').removeClass('open'); 8498 $(this).parent().find('.nectar_hotspot').removeClass('open'); 8499 8500 $(this).parents('.wpb_row').css('z-index', 'auto'); 8501 8502 return false; 8503 }); 8504 8505 $body.on('click', '.nttip.open', function (e) { 8506 if (nectarDOMInfo.winW < 690) { 8507 8508 if( e.target && $(e.target).is('a') ) { 8509 return; 8510 } 8511 8512 $(this).parents('.nectar_image_with_hotspots').find('.nttip').removeClass('open'); 8513 $(this).parents('.nectar_image_with_hotspots').find('.nectar_hotspot').removeClass('open'); 8514 $(this).parents('.wpb_row').css('z-index', 'auto'); 8515 return false; 8516 } 8517 }); 8518 8519 8520 // Calculate on init. 8521 responsiveTooltips(); 8522 8523 // Resize event. 8524 $window.on('resize',responsiveTooltips); 8525 8526 } 8527 8528 8529 8530 /** 8531 * Image with hotspots initialization. 8532 * 8533 * @since 7.0 8534 * @see waypoints 8535 */ 8536 function imageWithHotspots() { 8537 8538 var $imageWithHotspotsOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : '50%'; 8539 8540 $($fullscreenSelector + '.nectar_image_with_hotspots[data-animation="true"]').each(function () { 8541 8542 var $that = $(this); 8543 var waypoint = new Waypoint({ 8544 element: $that, 8545 handler: function () { 8546 8547 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 8548 waypoint.destroy(); 8549 return; 8550 } 8551 8552 $that.addClass('completed'); 8553 $that.find('.nectar_hotspot_wrap').each(function (i) { 8554 var $that2 = $(this); 8555 var $extrai = ($that2.parents('.col.has-animation').length > 0) ? 1 : 0; 8556 setTimeout(function () { 8557 $that2.addClass('animated-in'); 8558 }, 175 * (i + $extrai)); 8559 });
8560 8561 waypoint.destroy(); 8562 8563 }, 8564 offset: $imageWithHotspotsOffsetPos 8565 }); 8566 8567 }); 8568 8569 8570 } 8571 8572 8573 /** 8574 * Nectar Lazy Loading 8575 * 8576 * @since 11.0 8577 */ 8578 function nectarLazyImageLoading() { 8579 8580 var lazyItems = [].slice.call(document.querySelectorAll('[data-nectar-img-src]')); 8581 8582 if ('IntersectionObserver' in window) { 8583 8584 var options = { 8585 rootMargin: '300px', 8586 } 8587 8588 nectarLazyImageSizing(); 8589 $window.off('resize.nectarLazySizing', nectarLazyImageSizing); 8590 $window.on('resize.nectarLazySizing', nectarLazyImageSizing); 8591 8592 var lazyItemObserver = new IntersectionObserver(function(entries) { 8593 8594 entries.forEach(function(entry) { 8595 if (entry.isIntersecting) { 8596 var lazyItem = entry.target; 8597 8598 var imgSrc = lazyItem.getAttribute('data-nectar-img-src'); 8599 8600 if( imgSrc ) { 8601 8602 // img tags. 8603 if( lazyItem.classList.contains('nectar-lazy') ) { 8604 lazyItem.addEventListener( 'load', function() { 8605 lazyItem.style.height = ""; 8606 lazyItem.style.width = ""; 8607 lazyItem.classList.add('loaded'); 8608 lazyItem.removeAttribute('data-nectar-img-src'); 8609 lazyItemObserver.unobserve(lazyItem); 8610 }); 8611 lazyItem.src = imgSrc; 8612 var srcset = lazyItem.getAttribute('data-nectar-img-srcset'); 8613 if( srcset ) { 8614 lazyItem.setAttribute( 'srcset', srcset ); 8615 lazyItem.removeAttribute('data-nectar-img-srcset'); 8616 } 8617 8618 lazyItem.parentNode.classList.add('img-loaded'); 8619 8620 } 8621 // BGs. 8622 else { 8623 lazyItem.style.backgroundImage = "url('" + imgSrc + "')"; 8624 lazyItem.classList.add('loaded'); 8625 lazyItem.removeAttribute('data-nectar-img-src'); 8626 lazyItemObserver.unobserve(lazyItem); 8627 } 8628 8629 } 8630 8631 } 8632 8633 }); 8634 8635 }, options); 8636 8637 lazyItems.forEach(function(lazyItem) { 8638 lazyItemObserver.observe(lazyItem); 8639 }); 8640 8641 } 8642 else { 8643 // load all the images when intersection observer is not supported. 8644 lazyItems.forEach(function(lazyItem) { 8645 8646 // img tags. 8647 if( lazyItem.classList.contains('nectar-lazy') ) { 8648 lazyItem.style.height = ""; 8649 lazyItem.style.width = ""; 8650 lazyItem.src = lazyItem.getAttribute('data-nectar-img-src'); 8651 var srcset = lazyItem.getAttribute('data-nectar-img-srcset'); 8652 if( srcset ) { 8653 lazyItem.setAttribute( 'srcset', srcset ); 8654 lazyItem.removeAttribute('data-nectar-img-srcset'); 8655 } 8656 8657 lazyItem.parentNode.classList.add('img-loaded'); 8658 lazyItem.classList.add('loaded'); 8659 lazyItem.removeAttribute('data-nectar-img-src'); 8660 } 8661 // BGs. 8662 else { 8663 lazyItem.style.backgroundImage = "url('" + lazyItem.getAttribute('data-nectar-img-src') + "')"; 8664 lazyItem.classList.add('loaded'); 8665 lazyItem.removeAttribute('data-nectar-img-src'); 8666 } 8667 8668 }); 8669 } 8670 8671 8672 } 8673 8674 8675 /** 8676 * Nectar lazy img size helper. 8677 * 8678 * @since 11.0 8679 */ 8680 8681 function nectarLazyImageSizing() { 8682 8683 $('img.nectar-lazy:not(.loaded)').each(function() { 8684 8685 // items to skip. 8686 if( $(this).hasClass('attachment-shop_thumbnail') || $(this).hasClass('attachment-woocommerce_thumbnail') ) { 8687 return true; 8688 } 8689 8690 $(this).css({ 8691 'height': '', 8692 'width' : '' 8693 }); 8694 8695 8696 var heightAttr = parseInt($(this).attr('height')); 8697 var widthAttr = parseInt($(this).attr('width')); 8698 8699 var width = ($(this).parents('.nectar_cascading_images').length > 0) ? $(this).parents('.bg-layer').width() : $(this).width(); 8700 8701 // Shadow img. 8702 if( $(this).parents('.img-with-aniamtion-wrap[data-shadow*="depth"]').length > 0 ) { 8703 width = $(this).parents('.img-with-aniamtion-wrap').width(); 8704 } 8705 8706 // Post grid.
8707 if( $(this).parents('.nectar-post-grid-item-bg-wrap-inner').length > 0 ) { 8708 width = $(this).parents('.nectar-post-grid-item-bg-wrap-inner').width(); 8709 } 8710 8711 var dimensions = calculateAspectRatio( widthAttr, heightAttr, width, 2000 ); 8712 8713 $(this).css({ 8714 'height': dimensions.height + 'px', 8715 'width' : dimensions.width + 'px' 8716 }); 8717 8718 }); 8719 8720 } 8721 8722 8723 /** 8724 * Nectar Post Grid Mouse Follow Init 8725 * 8726 * @since 11.0 8727 */ 8728 function nectarPostGridMouse() { 8729 8730 viewIndicatorArr = []; 8731 postGridImgMouseFollowArr = []; 8732 8733 if( !nectarDOMInfo.usingMobileBrowser ) { 8734 8735 $('.nectar-post-grid[data-indicator="yes"]').each(function(i) { 8736 viewIndicatorArr[i] = new NectarIconMouseFollow($(this),'view-indicator'); 8737 }); 8738 8739 $('.nectar-post-grid-wrap[data-style="mouse_follow_image"] .nectar-post-grid').each(function(i) { 8740 postGridImgMouseFollowArr[i] = new NectarIconMouseFollow($(this), 'post-grid-images'); 8741 }); 8742 8743 $('.nectar-category-grid[data-style="mouse_follow_image"]').each(function(i) { 8744 postGridImgMouseFollowArr[i] = new NectarIconMouseFollow($(this), 'post-grid-images'); 8745 }); 8746 8747 } 8748 8749 } 8750 8751 8752 8753 8754 8755 /** 8756 * Nectar Post Grid 8757 * 8758 * @since 11.0 8759 */ 8760 function nectarPostGridInit() { 8761 8762 $nectarPostGridArr = []; 8763 8764 // Mouse follow. 8765 nectarPostGridMouse(); 8766 8767 // Create grid instances. 8768 $('.nectar-post-grid-wrap').each(function(i) { 8769 $nectarPostGridArr[i] = new NectarPostGrid($(this)); 8770 }); 8771 8772 8773 } 8774 8775 8776 8777 function NectarPostGrid(el) { 8778 8779 this.el = el; 8780 this.currentPage = 0; 8781 this.activeFilter = 1; 8782 this.activeCatTotal = 0; 8783 this.settingsData = JSON.parse(this.el.attr('data-el-settings')); 8784 this.queryData = JSON.parse(this.el.attr('data-query')); 8785 this.sortable = this.el.find('.nectar-post-grid-filters').attr('data-sortable'); 8786 8787 this.initialMarkup(); 8788 this.clickEvents(); 8789 this.deepLinking(); 8790 this.lightboxGroups(); 8791 this.externalProjectLinks(); 8792 } 8793 8794 NectarPostGrid.prototype.initialMarkup = function() { 8795 8796 // Start Filter Active. 8797 if( this.el.find('.nectar-post-grid-filters a.active').length == 0 ) { 8798 this.el.find('.nectar-post-grid-filters a:first-child').addClass('active'); 8799 } 8800 8801 // Load More Markup. 8802 if( this.settingsData.pagination === 'load-more' && this.el.find('.load-more-wrap').length == 0 ) { 8803 8804 if( this.el.find('.active.all-filter').length > 0 ) { 8805 this.activeFilter = this.el.find('.active.all-filter').index() + 1; 8806 } 8807 8808 this.activeCatTotal = parseInt(this.el.find('.nectar-post-grid-filters a:nth-child(' + this.activeFilter + ')').attr('data-total-count')); 8809 8810 // Start hidden? 8811 if( this.el.find('.nectar-post-grid-item').length >= this.activeCatTotal ) { 8812 this.el.append('<div class="load-more-wrap inactive"><a href="#" class="load-more">'+ this.el.attr('data-load-more-text') + '</a></div>'); 8813 } else { 8814 this.el.append('<div class="load-more-wrap"><a href="#" class="load-more">'+ this.el.attr('data-load-more-text') + '</a></div>'); 8815 } 8816 8817 } 8818 8819 }; 8820 8821 NectarPostGrid.prototype.lightboxGroups = function() { 8822 8823 var unique_id = uniqueIdGenerate(); 8824 var usingLightbox = (this.el.find('.nectar-post-grid-link.pretty_photo').length > 0) ? true : false; 8825 8826 if ($('body[data-ls="magnific"]').length > 0) { 8827 this.el.find('.nectar-post-grid-link.pretty_photo') 8828 .addClass('magnific') 8829 .addClass('gallery') 8830 .removeClass('pretty_photo'); 8831 } 8832 else if ($('body[data-ls="fancybox"]').length > 0) { 8833 // New. 8834 this.el.find('.nectar-post-grid-link.pretty_photo') 8835 .attr('data-fancybox', 'group_' + unique_id) 8836 .removeClass('pretty_photo'); 8837 // Existing. 8838 this.el.find('.nectar-post-grid-link[data-fancybox]') 8839 .attr('data-fancybox','group_' + unique_id); 8840 } 8841 8842 if(usingLightbox) { 8843 lightBoxInit(); 8844 } 8845 8846 } 8847 8848 NectarPostGrid.prototype.externalProjectLinks = function() { 8849 if( this.el.hasClass('target-blank-external-urls') ) { 8850 this.el.find(".nectar-post-grid-item a[href*='http://']:not([href*='" + window.location.hostname + "'])").attr("target", "_blank"); 8851 this.el.find(".nectar-post-grid-item a[href*='https://']:not([href*='" + window.location.hostname + "'])").attr("target", "_blank"); 8852 } 8853 } 8854 8855 NectarPostGrid.prototype.clickEvents = function() { 8856 8857 // Sortable Mobile Toggle. 8858 this.el.find('.nectar-post-grid-filters h4').on('click', function(){ 8859 $(this).parent().find('div').toggleClass('visible'); 8860 $(this).toggleClass('visible'); 8861 });
8862 8863 // Sortable/Pagination. 8864 var settingsData = this.settingsData; 8865 var queryData = this.queryData; 8866 var instance = this; 8867 8868 this.el.find('.nectar-post-grid-filters a, .load-more-wrap .load-more').on('click', function() { 8869 8870 var $that = $(this); 8871 8872 // Filter active. 8873 if($that.parents('.nectar-post-grid-wrap.loading').length > 0 || $(this).hasClass('active') || $(this).hasClass('inactive') ) { 8874 return false; 8875 } 8876 8877 8878 if( $(this).parents('.nectar-post-grid-filters').length > 0 ) { 8879 // Filter specific. 8880 $that.parent().find('a').removeClass('active'); 8881 $that.addClass('active'); 8882 instance.currentPage = 0; 8883 instance.activeFilter = $that.index() + 1; 8884 } else { 8885 // Load More specific. 8886 instance.currentPage++; 8887 } 8888 8889 var $gridEl = $that.parents('.nectar-post-grid-wrap').find('.nectar-post-grid') 8890 var $pagination = settingsData.pagination; 8891 var $action = ($that.hasClass('load-more') && $pagination === 'load-more') ? 'load-more' : 'filter'; 8892 var $category = ''; 8893 var $custom_query = ''; 8894 8895 // Determine what category to load from. 8896 if( instance.sortable === 'yes' ) { 8897 $category = $that.parents('.nectar-post-grid-wrap').find('.nectar-post-grid-filters a.active').attr('data-filter'); 8898 $custom_query = $that.parents('.nectar-post-grid-wrap').find('.nectar-post-grid-filters a.active').attr('data-filter'); 8899 } else { 8900 8901 var skipAll = ( $that.parents('.nectar-post-grid-wrap').find('.nectar-post-grid-filters a').length > 1 ) ? ':not(.all-filter)' : ''; 8902 8903 $that.parents('.nectar-post-grid-wrap').find('.nectar-post-grid-filters a' + skipAll).each(function(){ 8904 $category += $(this).attr('data-filter') + ', '; 8905 $custom_query += $(this).attr('data-filter') + ', '; 8906 }); 8907 8908 $category = $category.substring(0, $category.length - 2); 8909 $custom_query = $custom_query.substring(0, $custom_query.length - 2); 8910 8911 } 8912 8913 8914 var $dataToPass = { 8915 action: 'nectar_get_post_grid_segment', 8916 post_type: queryData.post_type, 8917 cpt_name: queryData.cpt_name, 8918 custom_query_tax: $custom_query, 8919 category: $category, 8920 posts_per_page: queryData.posts_per_page, 8921 current_page: instance.currentPage, 8922 offset: queryData.offset, 8923 order: queryData.order, 8924 orderby: queryData.orderby, 8925 load_action: $action, 8926 settings: { 8927 pagination: $pagination, 8928 post_type: settingsData.post_type, 8929 image_size: settingsData.image_size, 8930 aspect_ratio_image_size: settingsData.aspect_ratio_image_size, 8931 card_bg_color: settingsData.card_bg_color, 8932 display_categories: settingsData.display_categories, 8933 display_excerpt: settingsData.display_excerpt, 8934 display_date: settingsData.display_date, 8935 color_overlay: settingsData.color_overlay, 8936 color_overlay_opacity: settingsData.color_overlay_opacity, 8937 color_overlay_hover_opacity: settingsData.color_overlay_hover_opacity, 8938 grid_style: settingsData.grid_style, 8939 heading_tag: settingsData.heading_tag, 8940 post_title_overlay: settingsData.post_title_overlay, 8941 enable_gallery_lightbox: settingsData.enable_gallery_lightbox 8942 } 8943 }; 8944 8945 $that.parents('.nectar-post-grid-wrap').addClass('loading'); 8946 8947 $.post(window.nectarLove.ajaxurl, $dataToPass, function (data) { 8948 8949 // Update markup. 8950 if( $action === 'load-more' ) { 8951 $gridEl.append(data); 8952 } else { 8953 $gridEl.html(data); 8954 } 8955 8956 // Load in animation. 8957 if( $gridEl.is('[data-animation="fade-in-from-bottom"]') ) { 8958 8959 $that.parents('.nectar-post-grid-wrap').removeClass('finished-animating'); 8960 8961 $gridEl.find('.nectar-post-grid-item:not(.animated-in)').each(function(i) { 8962 var $storedEl = $(this); 8963 setTimeout(function() { 8964 $storedEl.addClass('animated-in'); 8965 }, i * 90); 8966 8967 });
8968 8969 setTimeout(function(){ 8970 $that.parents('.nectar-post-grid-wrap').addClass('finished-animating'); 8971 }, 950); 8972 } 8973 8974 if( $pagination === 'load-more' ) { 8975 8976 instance.activeCatTotal = parseInt(instance.el.find('.nectar-post-grid-filters a:nth-child(' + instance.activeFilter + ')').attr('data-total-count')); 8977 8978 if( $gridEl.find('.nectar-post-grid-item').length >= instance.activeCatTotal ) { 8979 instance.el.find('.load-more-wrap').addClass('inactive'); 8980 } else { 8981 instance.el.find('.load-more-wrap').removeClass('inactive'); 8982 } 8983 8984 } 8985 8986 // Lightbox items. 8987 instance.lightboxGroups(); 8988 8989 // Ext. links. 8990 instance.externalProjectLinks(); 8991 8992 $that.parents('.nectar-post-grid-wrap').removeClass('loading'); 8993 8994 // Resize. 8995 $window.trigger('resize'); 8996 8997 // Mouse follow. 8998 nectarPostGridMouse(); 8999 9000 }); // end POST 9001 9002 return false; 9003 9004 }); 9005 9006 }; 9007 9008 NectarPostGrid.prototype.deepLinking = function() { 9009 9010 if (typeof nectarGetQueryParam['grid-filter'] != 'undefined') { 9011 9012 this.el.find('.nectar-post-grid-filters a').each(function () { 9013 9014 var $currentText = $(this).clone(), 9015 $getText = nectarGetQueryParam['grid-filter'], 9016 $that = $(this); 9017 9018 $currentText = $currentText.text(); 9019 $currentText = $currentText.replace(/\s+/g, '-').toLowerCase(); 9020 9021 if( $currentText.length > 0 && $currentText.substring(0,1) === '-' ) { 9022 $currentText = $currentText.substring(1); 9023 } 9024 9025 $getText = $getText.replace(/\s+/g, '-').replace(/</g, '<').replace(/"/g, '"').toLowerCase(); 9026 9027 // Switch to filter 9028 if ($currentText == $getText) { 9029 $(this).trigger('click'); 9030 } 9031 9032 }); 9033 9034 } 9035 9036 }; 9037 9038 9039 function NectarPostGridWaypoint() { 9040 9041 var postGridOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : '75%'; 9042 9043 $($fullscreenSelector + '.nectar-post-grid-wrap').each(function () { 9044 9045 var $that = $(this), 9046 waypoint = new Waypoint({ 9047 element: $that, 9048 handler: function () { 9049 9050 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 9051 waypoint.destroy(); 9052 return; 9053 } 9054 9055 $that.find('.nectar-post-grid-filters').addClass('animated-in'); 9056 $that.find('.nectar-post-grid-item').each(function(i) { 9057 9058 var $item = $(this); 9059 9060 setTimeout(function() { 9061 9062 $item.addClass('animated-in'); 9063 9064 }, i * 90); 9065 9066 });
9067 9068 setTimeout(function(){ 9069 $that.addClass('finished-animating'); 9070 }, 950); 9071 9072 9073 waypoint.destroy(); 9074 9075 }, 9076 offset: postGridOffsetPos 9077 }); 9078 9079 }); 9080 9081 } 9082 9083 9084 9085 /** 9086 * Animated title element initialization. 9087 * 9088 * @since 7.0 9089 * @see waypoints 9090 */ 9091 function animatedTitles() { 9092 9093 var $animatedTitlesOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : 'bottom-in-view'; 9094 9095 $($fullscreenSelector + '.nectar-animated-title').each(function () { 9096 9097 var $that = $(this), 9098 waypoint = new Waypoint({ 9099 element: $that, 9100 handler: function () { 9101 9102 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 9103 waypoint.destroy(); 9104 return; 9105 } 9106 9107 $that.addClass('completed'); 9108 9109 waypoint.destroy(); 9110 9111 }, 9112 offset: $animatedTitlesOffsetPos 9113 }); 9114 9115 }); 9116 } 9117 9118 9119 9120 9121 /** 9122 * Highlighted Text element initialization. 9123 * 9124 * @since 9.0 9125 * @see waypoints 9126 */ 9127 function highlightedText() { 9128 9129 var $highlightedTextOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : 'bottom-in-view'; 9130 9131 if( nectarDOMInfo.usingMobileBrowser && $highlightedTextOffsetPos == 'bottom-in-view' ) { 9132 $highlightedTextOffsetPos = '85%'; 9133 } 9134 9135 $($fullscreenSelector + '.nectar-highlighted-text').each(function (i) { 9136 9137 var $animationDelay = 0; 9138 9139 // convert italics to em. 9140 $(this).find('i').each(function(){ 9141 $(this).replaceWith(function(){ 9142 return $('<em />').append($(this).html()); 9143 }); 9144 }); 9145 9146 if($(this).is('[data-animation-delay]') && 9147 $(this).attr('data-animation-delay').length > 0 && 9148 $(this).attr('data-animation') != 'false') { 9149 $animationDelay = $(this).attr('data-animation-delay'); 9150 } 9151 9152 $(this).find('em:has(a)').addClass('has-link'); 9153 9154 if (bypassAnimations) { 9155 $(this).find('em').addClass('animated'); 9156 } 9157 9158 // Waypoint 9159 var $that = $(this); 9160 var waypoint = new Waypoint({ 9161 element: $that, 9162 handler: function () { 9163 9164 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated')) { 9165 waypoint.destroy(); 9166 return; 9167 } 9168 9169 setTimeout(function() { 9170 9171 $that.find('em').each(function (i) { 9172 var $highlighted_em = $(this); 9173 setTimeout(function () { 9174 $highlighted_em.addClass('animated'); 9175 }, i * 300); 9176 9177 }); 9178 9179 }, $animationDelay); 9180 9181 waypoint.destroy(); 9182 9183 }, 9184 offset: $highlightedTextOffsetPos 9185 }); 9186 9187 }); 9188 9189 } 9190 9191 9192 9193 /** 9194 * WooCommerce product carousel. 9195 * 9196 * @since 13.0 9197 * @see waypoints 9198 */ 9199 function wooProductCarouselAnimations() { 9200 9201 var $wooProductOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : '75%'; 9202 9203 $($fullscreenSelector + '.nectar-woo-flickity[data-animation*="fade-in"]').each(function () { 9204 9205 var $that = $(this), 9206 waypoint = new Waypoint({ 9207 element: $that, 9208 handler: function () { 9209 9210 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 9211 waypoint.destroy(); 9212 return; 9213 } 9214 9215 $that.addClass('animated-in'); 9216 9217 $that.find('.flickity-cell').each(function (i) { 9218 var $el = $(this); 9219 9220 setTimeout(function(){ 9221 $el.css({ 9222 'transform': 'translate3d(0,0,0)', 9223 'opacity': '1' 9224 }); 9225 }, i * 100); 9226 });
9227 9228 waypoint.destroy(); 9229 9230 }, 9231 offset: $wooProductOffsetPos 9232 }); 9233 9234 }); 9235 } 9236 9237 9238 /** 9239 * Pricing table element height calculations. 9240 * 9241 * @since 2.0 9242 */ 9243 function pricingTableHeight() { 9244 9245 var $tallestCol; 9246 9247 $('.pricing-table[data-style="default"]').each(function () { 9248 $tallestCol = 0; 9249 9250 $(this).find('> div ul').each(function () { 9251 9252 if( $(this).height() > $tallestCol ) { 9253 $tallestCol = $(this).height(); 9254 } 9255 9256 }); 9257 9258 //safety net incase pricing tables height couldn't be determined 9259 if ($tallestCol == 0) { 9260 $tallestCol = 'auto'; 9261 } 9262 9263 //set even height 9264 $(this).find('> div ul').css('height', $tallestCol); 9265 9266 }); 9267 } 9268 9269 9270 9271 9272 /** 9273 * Testimonial slider element initialization. 9274 * 9275 * @since 10.5 9276 */ 9277 function nectarTestimonialSliders() { 9278 9279 $testimonialSliders = []; 9280 9281 if (typeof NectarTestimonialSlider == 'undefined') { 9282 return; 9283 } 9284 9285 $('.testimonial_slider').each(function (i) { 9286 9287 var $that_el = $(this), 9288 $type = ($(this).is('[data-style]')) ? $(this).attr('data-style') : 'none'; 9289 9290 $testimonialSliders[i] = new NectarTestimonialSlider($that_el, $type, resizeVideoToCover, fullWidthContentColumns); 9291 9292 9293 if ($(this).is('.disable-height-animation:not([data-style*="multiple_visible"])')) { 9294 $testimonialSliders[i].testimonialSliderHeight(); 9295 setTimeout($testimonialSliders[i].testimonialSliderHeight.bind($testimonialSliders[i]), 500); 9296 } 9297 9298 if ($(this).is('.testimonial_slider[data-style="multiple_visible_minimal"]')) { 9299 $testimonialSliders[i].testimonialSliderHeightMinimalMult(); 9300 setTimeout($testimonialSliders[i].testimonialSliderHeightMinimalMult.bind($testimonialSliders[i]), 500); 9301 } 9302 9303 }); 9304 9305 9306 } 9307 9308 9309 /** 9310 * Testimonial slider element resize binding. 9311 * 9312 * @since 10.5 9313 */ 9314 function nectarTestimonialSlidersEvents() { 9315 9316 $window.off('smartresize.nectarTestimonials'); 9317 $window.off('resize.nectarTestimonialsMin'); 9318 9319 if($testimonialSliders.length > 0) { 9320 $window.on('smartresize.nectarTestimonials',nectarTestimonialMainResize); 9321 } 9322 9323 if( $('.testimonial_slider[data-style="multiple_visible_minimal"]').length > 0 ) { 9324 $window.on('resize.nectarTestimonialsMin',nectarTestimonialMiniamlResize); 9325 } 9326 9327 } 9328 9329 function nectarTestimonialMainResize() { 9330 for (var i = 0; i < $testimonialSliders.length; i++) { 9331 $testimonialSliders[i].testimonialSliderHeight(); 9332 $testimonialSliders[i].testimonialHeightResize(); 9333 } 9334 } 9335 function nectarTestimonialMiniamlResize() { 9336 for (var i = 0; i < $testimonialSliders.length; i++) { 9337 $testimonialSliders[i].testimonialSliderHeightMinimalMult(); 9338 } 9339 } 9340 9341 9342 9343 /** 9344 * Icon list element initialization. 9345 * 9346 * @since 6.0 9347 * @see waypoints 9348 */ 9349 function iconList() { 9350 9351 var $iconListOffsetPos = ($fullscreenMarkupBool == true) ? '250%' : '75%'; 9352 9353 $($fullscreenSelector + '.nectar-icon-list[data-animate="true"]').each(function () { 9354 9355 var $that = $(this), 9356 waypoint = new Waypoint({ 9357 element: $that, 9358 handler: function () { 9359 9360 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 9361 waypoint.destroy(); 9362 return; 9363 } 9364 9365 $that.each(function () { 9366 9367 var $listItemAnimationDelay = ($that.is('[data-direction="horizontal"]')) ? 100 : 300; 9368 9369 $(this).find('.nectar-icon-list-item').each(function (i) { 9370 var $thatt = $(this); 9371 setTimeout(function () { 9372 $thatt.addClass('animated'); 9373 }, i * $listItemAnimationDelay); 9374 }); 9375 9376 });
9377 9378 $that.addClass('completed'); 9379 9380 waypoint.destroy(); 9381 9382 }, 9383 offset: $iconListOffsetPos 9384 }); 9385 9386 }); 9387 } 9388 9389 9390 9391 /** 9392 * Get the BG color of parent column/row. 9393 * 9394 * @since 6.0 9395 */ 9396 function narrowParentBGC(element) { 9397 9398 var narrowedBGC; 9399 9400 if (element.parents('.wpb_column[data-bg-color*="#"]').length > 0 && element.parents('.wpb_column[data-bg-opacity="1"]').length > 0) { 9401 narrowedBGC = element.parents('.wpb_column').attr('data-bg-color'); 9402 } 9403 else if (element.parents('.wpb_row').length > 0 && element.parents('.wpb_row').find('.row-bg.using-bg-color').length > 0 || 9404 element.parents('.wpb_row').length > 0 && element.parents('.wpb_row').find('.row-bg.using-bg-color-excluded').length > 0) { 9405 narrowedBGC = element.parents('.wpb_row').find('.row-bg').css('background-color'); 9406 } 9407 else { 9408 if ($('#nectar_fullscreen_rows').length > 0) { 9409 narrowedBGC = $('#nectar_fullscreen_rows > .wpb_row .full-page-inner-wrap').css('background-color'); 9410 } 9411 else { 9412 narrowedBGC = $('.container-wrap').css('background-color'); 9413 } 9414 } 9415 9416 return narrowedBGC; 9417 9418 } 9419 9420 9421 /** 9422 * Icon BG matching row BG 9423 * 9424 * @since 6.0 9425 */ 9426 function nectarIconMatchColoring() { 9427 9428 var nectarMatchingBGCss = ''; 9429 9430 // Icon list 9431 $('.nectar-icon-list[data-icon-style="border"], .nectar_icon_wrap[data-style="border-animation"][data-color*="extra-color-gradient-"]').each(function (i) { 9432 9433 var $bgColorToSet = narrowParentBGC($(this)); 9434 9435 if( $(this).hasClass('nectar-icon-list') ) { 9436 $(this).find('.list-icon-holder').css('background-color', $bgColorToSet); 9437 } 9438 else { 9439 9440 $(this).removeClass(function (index, className) { 9441 return (className.match(/(^|\s)instance-\S+/g) || []).join(' '); 9442 }); 9443 9444 $(this).addClass('instance-' + i); 9445 nectarMatchingBGCss += '.nectar_icon_wrap.instance-' + i + ' .nectar_icon:before { background-color: ' + $bgColorToSet + '!important; }'; 9446 } 9447 9448 }); 9449 9450 // Material gradient btns 9451 $('body.material .nectar-button.see-through[class*="m-extra-color-gradient"]').each(function (i) { 9452 9453 var $bgColorToSet = narrowParentBGC($(this)); 9454 9455 $(this).removeClass(function (index, className) { 9456 return (className.match(/(^|\s)instance-\S+/g) || []).join(' '); 9457 }); 9458 9459 $(this).addClass('instance-' + i); 9460 nectarMatchingBGCss += '.nectar-button.see-through.instance-' + i + ':after { background-color: ' + $bgColorToSet + '!important; }'; 9461 9462 }); 9463 9464 // Style 9465 nectarCreateStyle(nectarMatchingBGCss, 'nectaricon-color-match'); 9466 9467 } 9468 9469 9470 9471 9472 9473 /** 9474 * One fourth column classes. 9475 * 9476 * @since 2.0 9477 */ 9478 function oneFourthClasses() { 9479 9480 $('.col.span_3, .vc_span3, .vc_col-sm-3').each(function () { 9481 if (!$(this).is('[data-t-w-inherits="small_desktop"]')) { 9482 9483 var $currentDiv = $(this); 9484 var $nextDiv = $(this).next('div'); 9485 9486 if ($nextDiv.hasClass('span_3') && !$currentDiv.hasClass('one-fourths') || 9487 $nextDiv.hasClass('vc_span3') && !$currentDiv.hasClass('one-fourths') || 9488 $nextDiv.hasClass('vc_col-sm-3') && !$currentDiv.hasClass('one-fourths')) { 9489 $currentDiv.addClass('one-fourths clear-both'); 9490 $nextDiv.addClass('one-fourths right-edge'); 9491 } 9492 } 9493 }); 9494 9495 // Make empty second 1/2 half columns display right on iPad 9496 $('.span_12 .col.span_6').each(function () { 9497 if ($(this).next('div').hasClass('span_6') && $.trim($(this).next('div').html()).length == 0) { 9498 $(this).addClass('empty-second'); 9499 } 9500 }); 9501 9502 } 9503 9504 9505 9506 9507 /** 9508 * Responsive video iframes initialization. 9509 * 9510 * @since 3.0 9511 */ 9512 function responsiveVideoIframesInit() { 9513 9514 $('iframe').each(function () { 9515 9516 // Make sure the iframe has a src 9517 if (typeof $(this).attr('src') != 'undefined' && 9518 !$(this).hasClass('skip-nectar-video-size') && 9519 !$(this).hasClass('iframe-embed') && 9520 $(this).parents('.ult_modal').length == 0 && 9521 $(this).parents('.ls-slide').length == 0 &&
9522 $(this).parents('.woo-variation-product-gallery').length == 0 && 9523 $(this).parents('.esg-entry-media').length == 0 && 9524 $(this).parents('.wpb_video_widget.wpb_content_element').length == 0) { 9525 9526 if( $(this).parents('.woocommerce-product-gallery').length > 0 ) { 9527 if( !$(this).is('[width="100%"]') || !$(this).is('[height="100%"]') ) { 9528 return true; 9529 } 9530 } 9531 9532 var embedSrcLower = $(this).attr('src').toLowerCase(); 9533 9534 if (embedSrcLower.indexOf("youtube") >= 0 || 9535 embedSrcLower.indexOf("vimeo") >= 0 || 9536 embedSrcLower.indexOf("twitch.tv") >= 0 || 9537 embedSrcLower.indexOf("kickstarter") >= 0 || 9538 embedSrcLower.indexOf("embed-ssl.ted") >= 0 || 9539 embedSrcLower.indexOf("dailymotion") >= 0) { 9540 9541 $(this).addClass('iframe-embed'); 9542 9543 if ($(this).width() < $(this).parent().width()) { 9544 $(this) 9545 .attr('data-aspectRatio', $(this).height() / $(this).width()) 9546 .removeAttr('height') 9547 .removeAttr('width'); 9548 } else { 9549 $(this) 9550 .attr('data-aspectRatio', '0.56') 9551 .removeAttr('height') 9552 .removeAttr('width'); 9553 } 9554 9555 if ($(this).parents('.post-area.masonry.classic').length > 0) { 9556 $(this) 9557 .attr('data-aspectRatio', '0.56') 9558 .removeAttr('height') 9559 .removeAttr('width'); 9560 } 9561 9562 } 9563 9564 } 9565 9566 }); 9567 9568 } 9569 9570 9571 /** 9572 * Responsive video iframes. 9573 * 9574 * @since 3.0 9575 */ 9576 function responsiveVideoIframes() { 9577 9578 $('iframe[data-aspectRatio]').each(function () { 9579 9580 var $el = $(this), 9581 newWidth = $el.parent().width(); 9582 9583 // In nectar slider 9584 if ($(this).parents('.swiper-slide').length > 0) { 9585 if ($(this).is(':visible')) { 9586 $el 9587 .width(newWidth) 9588 .height(newWidth * $el.attr('data-aspectRatio')); 9589 } 9590 } 9591 // All others 9592 else { 9593 $el 9594 .width(newWidth) 9595 .height(newWidth * $el.attr('data-aspectRatio')); 9596 } 9597 9598 }); 9599 9600 } 9601 9602 9603 /** 9604 * Reveal the audio/video elements after the size has been calculated. 9605 * 9606 * @since 10.5 9607 */ 9608 function audioVideoVis() { 9609 9610 //unwrap post and portfolio videos 9611 $('.video-wrap iframe').unwrap(); 9612 $('#sidebar iframe[src]').unwrap(); 9613 9614 $('audio') 9615 .attr('width', '100%') 9616 .attr('height', '100%') 9617 .css('visibility', 'visible'); 9618 9619 $('video').css('visibility', 'visible'); 9620 9621 $('.wp-video').each(function () { 9622 var video = $(this).find('video').get(0); 9623 video.addEventListener('loadeddata', function () { 9624 $window.trigger('resize'); 9625 }, false); 9626 }); 9627 9628 //webkit video back button fix 9629 $('.main-content iframe[src]').each(function () { 9630 $(this).css({ 9631 'opacity': '1', 9632 'visibility': 'visible' 9633 }); 9634 }); 9635 9636 } 9637 9638 9639 9640 9641 9642 /** 9643 * Nectar video background size calculations 9644 * 9645 * @since 5.0 9646 */ 9647 function resizeVideoToCover() { 9648 9649 var vid_w_orig = 1280, 9650 vid_h_orig = 720, 9651 min_w = 1200; 9652 9653 $('.nectar-video-wrap').each(function () { 9654 9655 var $containerHeight, $containerWidth; 9656 9657 if ($(this).find('video').length == 0) { 9658 return; 9659 } 9660 9661 if ($(this).parents('#page-header-bg').length > 0) { 9662 9663 if ($('.container-wrap.auto-height').length > 0) { 9664 return false; 9665 } 9666 9667 $containerHeight = $(this).parents('#page-header-bg').outerHeight(); 9668 $containerWidth = $(this).parents('#page-header-bg').outerWidth(); 9669 } else { 9670 9671 if ($(this).hasClass('column-video')) { 9672 if( $body.is('[data-flex-cols="true"]') ) { 9673 $containerHeight = $(this).parents('.vc_column-inner').outerHeight(); 9674 $containerWidth = $(this).parents('.vc_column-inner').outerWidth(); 9675 } else { 9676 $containerHeight = $(this).parents('.wpb_column').outerHeight(); 9677 $containerWidth = $(this).parents('.wpb_column').outerWidth(); 9678 } 9679 } else { 9680 $containerHeight = $(this).parents('.wpb_row').outerHeight(); 9681 $containerWidth = ($(this).parents('.full-width-section').length > 0) ? nectarDOMInfo.winW : $(this).parents('.wpb_row').outerWidth(); 9682 } 9683 } 9684 9685 // Set the video viewport to the window size 9686 $(this).width($containerWidth);
9687 if ($(this).parents('#page-header-bg').length > 0) { 9688 $(this).height($containerHeight); 9689 } 9690 9691 // Use largest scale factor of horizontal/vertical 9692 var scale_h = $containerWidth / vid_w_orig, 9693 scale_v = ($containerHeight - $containerHeight) / vid_h_orig, 9694 scale = scale_h > scale_v ? scale_h : scale_v; 9695 9696 // Update minium width to never allow excess space 9697 min_w = 1280 / 720 * ($containerHeight + 40); 9698 9699 // Don't allow scaled width < minimum video width 9700 if (scale * vid_w_orig < min_w) { 9701 scale = min_w / vid_w_orig; 9702 } 9703 9704 // Now scale the video 9705 $(this).find('video, .mejs-overlay, .mejs-poster').width(Math.ceil(scale * vid_w_orig + 0)); 9706 $(this).find('video, .mejs-overlay, .mejs-poster').height(Math.ceil(scale * vid_h_orig + 0)); 9707 9708 // And center it by scrolling the video viewport 9709 $(this).scrollLeft(($(this).find('video').width() - $containerWidth) / 2); 9710 $(this).scrollTop(($(this).find('video').height() - ($containerHeight)) / 2); 9711 $(this).find('.mejs-overlay, .mejs-poster').scrollTop(($(this).find('video').height() - ($containerHeight)) / 2); 9712 9713 9714 // Align bottom 9715 if ($(this).attr('data-bg-alignment') == 'center bottom' || $(this).attr('data-bg-alignment') == 'bottom') { 9716 $(this).scrollTop(($(this).find('video').height() - ($containerHeight + 6))); 9717 } 9718 // Align top 9719 else if ($(this).attr('data-bg-alignment') == 'center top' || $(this).attr('data-bg-alignment') == 'top') { 9720 $(this).scrollTop(0); 9721 } 9722 9723 // Add loaded class 9724 $(this).addClass('position-loaded'); 9725 }); 9726 9727 } 9728 9729 9730 9731 /** 9732 * Nectar video background initialization. 9733 * 9734 * @since 5.0 9735 */ 9736 function videoBGInit() { 9737 9738 if ($('.nectar-video-wrap').length == 0 && $('.nectar-youtube-bg').length == 0) { 9739 return; 9740 } 9741 9742 setTimeout(function () { 9743 9744 resizeVideoToCover(); 9745 9746 // Resize 9747 $window.on('resize',resizeVideoToCover); 9748 9749 $('.video-color-overlay').each(function () { 9750 $(this).css('background-color', $(this).attr('data-color')); 9751 }); 9752 9753 $('.nectar-video-wrap').each(function () { 9754 9755 if ($(this).find('video').length == 0) { 9756 return; 9757 } 9758 9759 var $headerVideo = ($(this).parents('#page-header-bg').length > 0) ? true : false; 9760 var $that = $(this); 9761 var videoReady = setInterval(function () { 9762 9763 if ($that.find('video').get(0).readyState > 3) { 9764 9765 if (!nectarDOMInfo.usingMobileBrowser) { 9766 $that.transition({ 9767 'opacity': '1' 9768 }, 400); 9769 $that.find('video').transition({ 9770 'opacity': '1' 9771 }, 400); 9772 $that.parent().find('.video-color-overlay').transition({ 9773 'opacity': '0.7' 9774 }, 400); 9775 if ($headerVideo == true) { 9776 pageHeaderTextEffect(); 9777 } 9778 } 9779 9780 // Remove page loading screen 9781 $loadingScreenEl.addClass('loaded'); 9782 setTimeout(function () { 9783 $loadingScreenEl.addClass('hidden'); 9784 }, 1000); 9785 9786 9787 clearInterval(videoReady); 9788 } 9789 9790 }, 60); 9791 9792 if (nectarDOMInfo.usingMobileBrowser) { 9793 9794 if ($that.parents('.full-width-section').length > 0 && 9795 $that.parents('#nectar_fullscreen_rows').length == 0 && 9796 !$that.hasClass('column-video') ) { 9797 9798 $that.css('left', '50%'); 9799 } else { 9800 $that.css('left', '0px'); 9801 } 9802 9803 if ($headerVideo == true) { 9804 pageHeaderTextEffect(); 9805 } 9806 9807 $that.find('video')[0].onplay = function () { 9808 $that.transition({ 9809 'opacity': '1' 9810 }, 400); 9811 $that.find('video').transition({ 9812 'opacity': '1' 9813 }, 400); 9814 $that.parent().find('.video-color-overlay').transition({ 9815 'opacity': '0.7' 9816 }, 400); 9817 }; 9818 9819 } // end mobile only 9820 9821 }); 9822 }, 300); 9823 9824 9825 if (nectarDOMInfo.usingMobileBrowser) { 9826 9827 $('.nectar-video-wrap').each(function () { 9828 9829 if (!$(this).find('video').is('[muted]')) { 9830 9831 // Autoplay not supported unless muted 9832 $(this).parent().find('.mobile-video-image').show(); 9833 $(this).remove(); 9834 } 9835 9836 });
9837 9838 } 9839 9840 9841 $('.wpb_row:has(".nectar-video-wrap"):not(.fp-section)').each(function (i) { 9842 $(this).css('z-index', 100 + i); 9843 }); 9844 9845 9846 $(".vc_row").each(function () { 9847 var youtubeUrl, youtubeId, $row = jQuery(this); 9848 $row.find('.nectar-youtube-bg').length > 0 ? (youtubeUrl = $row.find('.nectar-youtube-bg span').text(), youtubeId = nectarExtractYoutubeId(youtubeUrl), youtubeId && ($row.find(".vc_video-bg").remove(), nectarInsertYoutubeVideoAsBackground($row.find('.nectar-youtube-bg'), youtubeId))) : $row.find(".nectar-youtube-bg").remove(); 9849 9850 // Remove yt url 9851 $row.find('.nectar-youtube-bg span').remove(); 9852 9853 if (!nectarDOMInfo.usingMobileBrowser) { 9854 $row.find('.nectar-video-wrap, .nectar-youtube-bg').css({ 9855 'opacity': '1', 9856 'width': '100%', 9857 'height': '100%' 9858 }); 9859 } 9860 $row.find('.video-color-overlay').transition({ 9861 'opacity': '0.7' 9862 }, 400); 9863 }); 9864 9865 9866 function nectarInsertYoutubeVideoAsBackground($element, youtubeId, counter) { 9867 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 () { 9868 nectarInsertYoutubeVideoAsBackground($element, youtubeId, counter++) 9869 }, 100); 9870 var $container = $element.prepend('<div class="vc_video-bg"><div class="inner"></div></div>').find(".inner"); 9871 new YT.Player($container[0], { 9872 width: "100%", 9873 height: "100%", 9874 videoId: youtubeId, 9875 playerVars: { 9876 playlist: youtubeId, 9877 iv_load_policy: 3, 9878 enablejsapi: 1, 9879 disablekb: 1, 9880 autoplay: 1, 9881 controls: 0, 9882 showinfo: 0, 9883 rel: 0, 9884 loop: 1 9885 }, 9886 events: { 9887 onReady: function (event) { 9888 event.target.mute().setLoop(!0); 9889 nectarResizeVideoBackground($element); 9890 } 9891 } 9892 }), nectarResizeVideoBackground($element), jQuery(window).on("resize", function () { 9893 nectarResizeVideoBackground($element); 9894 }); 9895 9896 setTimeout(function () { 9897 nectarResizeVideoBackground($element); 9898 }, 100); 9899 } 9900 9901 function nectarResizeVideoBackground($element) { 9902 var iframeW, iframeH, marginLeft, marginTop, containerW = $element.innerWidth(), 9903 containerH = $element.innerHeight(), 9904 ratio1 = 16, 9905 ratio2 = 9; 9906 ratio1 / ratio2 > containerW / containerH ? (iframeW = containerH * (ratio1 / ratio2), 9907 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", 9908 marginLeft = -Math.round((iframeW - containerW) / 2) + "px", iframeW += "px", iframeH += "px"), 9909 $element.find(".vc_video-bg iframe").css({ 9910 maxWidth: "1000%", 9911 marginLeft: marginLeft, 9912 marginTop: marginTop, 9913 width: iframeW, 9914 height: iframeH 9915 }); 9916 } 9917 9918 function nectarExtractYoutubeId(url) { 9919 9920 if ("undefined" == typeof url) { 9921 return !1; 9922 } 9923 9924 var id = url.match(/(?:https?:\/{2})?(?:w{3}\.)?youtu(?:be)?\.(?:com|be)(?:\/watch\?v=|\/)([^\s&]+)/); 9925 return null !== id ? id[1] : !1 9926 } 9927 9928 9929 } 9930 9931 9932 9933 9934 /** 9935 * Single Blog Posts 9936 * 9937 * @since 11.0 9938 */ 9939 function blogSingle() { 9940 9941 // Remove first gallery on post when using the gallery slider option. 9942 if( $body.hasClass('single-post') && $('.content-inner[data-has-gallery]').length > 0 ) { 9943 9944 9945 if($('.wp-block-gallery').length > 0) { 9946 // Gutenberg. 9947 $('.content-inner').find('.wp-block-gallery').each(function(i) { 9948 if(i !== 0) { 9949 $(this).css('display','flex'); 9950 } 9951 }); 9952 9953 } else { 9954 // Classic Editor. 9955 $('.content-inner').find('.gallery').each(function(i) { 9956 if(i !== 0) { 9957 $(this).css('display','block'); 9958 } 9959 });
9960 9961 } 9962 9963 } // If using gallery slider on single conditional end. 9964 9965 } 9966 9967 9968 9969 9970 9971 /*-------------------------------------------------------------------------*/ 9972 /* Header + Search 9973 /*-------------------------------------------------------------------------*/ 9974 9975 /** 9976 * Correct megamenus in mobile navigation. 9977 * 9978 * @since 8.0 9979 */ 9980 function mobileNavMegamenuCorrect() { 9981 9982 ////mobile megamenus without titles / nested groupings 9983 var $mobileNavSelector = ( $('#top #mobile-menu').length > 0 ) ? '#top #mobile-menu ' : '.off-canvas-menu-container.mobile-only '; 9984 9985 $($mobileNavSelector + '.menu-item > ul > li > a').each(function () { 9986 9987 if ($(this).text() == '-' || $(this).text() == '–' || $(this).parent().hasClass('hide-title') || $(this).find('> .remove-menu-item-title').length > 0 ) { 9988 9989 var $navLIs = $(this).parent().find('> ul > li').clone(); 9990 9991 // column has widget 9992 if( $(this).parent().find('> .widget-area-active').length > 0 ) { 9993 $(this).parent().find('> a').remove(); 9994 } else { 9995 9996 $(this).parent().find('ul').remove(); 9997 $(this).parent().parent().append($navLIs); 9998 $(this).parent().remove(); 9999 } 10000 10001 } 10002 }); 10003 10004 } 10005 10006 10007 10008 /** 10009 * Material theme skin off canvas menu initialization. 10010 * 10011 * @since 10.5 10012 */ 10013 function materialSkinOCM_Init() { 10014 10015 if ($('body.material[data-slide-out-widget-area-style="slide-out-from-right"]').length > 0) { 10016 OCM_materialWidth(); 10017 10018 if( $wpAdminBar.length > 0 ) { 10019 var $topToolBar = $wpAdminBar.detach(); 10020 $('.ocm-effect-wrap-inner').append($topToolBar); 10021 } 10022 10023 } 10024 10025 OCM_materialIconMarkup(); 10026 materialSkinTransition(); 10027 10028 $window.on('resize', OCM_materialSize); 10029 10030 } 10031 10032 10033 10034 10035 /** 10036 * Material theme skin transition helper 10037 * 10038 * @since 10.5 10039 */ 10040 function materialSkinTransition() { 10041 10042 if ($('body.material[data-header-search="true"]').length > 0 || 10043 $('body.material .ocm-effect-wrap').length > 0) { 10044 10045 var materialTransTO, 10046 allowMaterialResizeCalc = false, 10047 orientTrack = 0, 10048 $winDOMWidth = nectarDOMInfo.winW, 10049 $winDOMHeight = nectarDOMInfo.winH; 10050 10051 // For mobile make sure the orientation has changed. 10052 window.addEventListener("orientationchange", function () { 10053 orientTrack = 1; 10054 }); 10055 10056 // Resize. 10057 $window.on('resize', function () { 10058 10059 if( nectarDOMInfo.usingMobileBrowser ) { 10060 // Mobile. 10061 if (($window.width() != $winDOMWidth && $window.height != $winDOMHeight) || orientTrack === 1) { 10062 10063 // Store the current window dimensions. 10064 $winDOMWidth = nectarDOMInfo.winW; 10065 $winDOMHeight = nectarDOMInfo.winH; 10066 10067 // Reset orientation change tracker. 10068 orientTrack = 0; 10069 10070 // Set to allow. 10071 allowMaterialResizeCalc = true; 10072 10073 } 10074 } else { 10075 // Desktop always allows. 10076 allowMaterialResizeCalc = true; 10077 } 10078 10079 if(allowMaterialResizeCalc) { 10080 10081 clearTimeout(materialTransTO); 10082 10083 $('body[data-slide-out-widget-area-style="slide-out-from-right"] > a.slide_out_area_close, .material #header-outer, .ocm-effect-wrap, .ocm-effect-wrap-shadow') 10084 .addClass('no-material-transition'); 10085 10086 materialTransTO = setTimeout(function () { 10087 $('body[data-slide-out-widget-area-style="slide-out-from-right"] > a.slide_out_area_close, .material #header-outer, .ocm-effect-wrap, .ocm-effect-wrap-shadow') 10088 .removeClass('no-material-transition'); 10089 }, 250); 10090 10091 OCM_materialWidth(); 10092 10093 // Reset allow. 10094 allowMaterialResizeCalc = false; 10095 10096 } // endif for allow. 10097 10098 }); // end resize. 10099 10100 } 10101 10102 } 10103 10104 10105 10106 /** 10107 * Calculate off canvas menu slide out from right on hover 10108 * 10109 * @since 8.0 10110 */ 10111 function calculateHoverNavMinHeight() { 10112 10113 var $widgetHeights = 0; 10114 $('#slide-out-widget-area > .widget').each(function () { 10115 $widgetHeights += $(this).height(); 10116 });
10117 10118 var $menuHeight; 10119 10120 if(($offCanvasEl.height() - 25 - $('.bottom-meta-wrap').outerHeight(true) - $widgetHeights) > $('#slide-out-widget-area .off-canvas-menu-container:last-child').height()) { 10121 $menuHeight = $offCanvasEl.height() - 25 - $('.bottom-meta-wrap').outerHeight(true) - $widgetHeights; 10122 } else { 10123 $menuHeight = $('#slide-out-widget-area .off-canvas-menu-container:last-child').height(); 10124 } 10125 10126 $('#slide-out-widget-area .inner').css({ 10127 'height': 'auto', 10128 'min-height': $menuHeight 10129 }); 10130 10131 10132 } 10133 10134 10135 /** 10136 * Material theme skin off canvas menu width. 10137 * 10138 * @since 8.0 10139 */ 10140 function OCM_materialWidth() { 10141 10142 $('#slide-out-widget-area.slide-out-from-right').css({ 10143 'padding-top': $window.height() * 0.1, 10144 'padding-bottom': $window.height() * 0.1 10145 }); 10146 10147 OCM_overflowState(); 10148 } 10149 10150 10151 10152 /** 10153 * Material theme skin off canvas menu icon markup 10154 * 10155 * @since 8.0 10156 */ 10157 function OCM_materialIconMarkup() { 10158 10159 if ($('body.material').length > 0 && $('body[data-slide-out-widget-area-style="slide-out-from-right-hover"]').length == 0 ) { 10160 10161 if ($('body[data-slide-out-widget-area-style*="fullscreen"]').length == 0 && $('#mobile-menu').length == 0) { 10162 var $menuIconClone = $('header#top nav ul .slide-out-widget-area-toggle a > span > i').clone(); 10163 $menuIconClone.addClass('hover-effect'); 10164 $('header#top nav ul .slide-out-widget-area-toggle a > span').append($menuIconClone); 10165 10166 var $menuIconClone2 = $('header#top .slide-out-widget-area-toggle.mobile-icon a > span > i').clone(); 10167 $menuIconClone2.addClass('hover-effect'); 10168 $('header#top .slide-out-widget-area-toggle.mobile-icon a > span').append($menuIconClone2); 10169 } 10170 10171 $('body:not([data-slide-out-widget-area-style="slide-out-from-right"]) header#top .slide-out-widget-area-toggle a > span') 10172 .append($('<span class="close-wrap"> <span class="close-line close-line1"></span> <span class="close-line close-line2"></span> </span>')); 10173 10174 setTimeout(function(){ 10175 $('header#top .slide-out-widget-area-toggle a > span .close-wrap').addClass('loaded'); 10176 },200); 10177 10178 } 10179 10180 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 ) { 10181 $('#ajax-content-wrap > .slide-out-widget-area-toggle.slide-out-hover-icon-effect').insertAfter('.ocm-effect-wrap'); 10182 } 10183 10184 //move material skin default ocm 10185 if ($('body.material').length > 0 && 10186 $('body[data-slide-out-widget-area-style*="fullscreen"]').length == 0 && 10187 $('.ocm-effect-wrap').length > 0 ) { 10188 $('body.material #slide-out-widget-area.slide-out-from-right .slide_out_area_close').insertAfter('.ocm-effect-wrap'); 10189 $('#slide-out-widget-area-bg').insertAfter('.ocm-effect-wrap'); 10190 $offCanvasEl.insertAfter('.ocm-effect-wrap'); 10191 10192 } 10193 10194 } 10195 10196 10197 10198 /** 10199 * Material theme skin off canvas menu height 10200 * 10201 * @since 8.0 10202 */ 10203 function OCM_materialSize() { 10204 if ($('.ocm-effect-wrap.material-ocm-open').length > 0) { 10205 10206 $('.ocm-effect-wrap').css({ 10207 'height': $window.height() 10208 }); 10209 10210 $('.ocm-effect-wrap-inner').css({ 10211 'padding-top': nectarDOMInfo.adminBarHeight 10212 }); 10213 10214 } 10215 } 10216 10217 10218 10219 /** 10220 * Off canvas menu dropdown markup 10221 * 10222 * @since 8.0 10223 */ 10224 function OCM_dropdownMarkup() { 10225 var $nectar_ocm_dropdown_func = ($('#slide-out-widget-area[data-dropdown-func]').length > 0) ? $offCanvasEl.attr('data-dropdown-func') : 'default'; 10226 if ($nectar_ocm_dropdown_func == 'separate-dropdown-parent-link') { 10227 $('#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>'); 10228 } 10229 } 10230 10231 10232 10233 /** 10234 * Off canvas menu dropdown icon position. 10235 * 10236 * @since 8.0 10237 */ 10238 function OCM_dropdownIconPos() { 10239 10240 $('#slide-out-widget-area[class*="slide-out-from-right"] .off-canvas-menu-container li.menu-item-has-children').each(function () { 10241 $(this).find('.ocm-dropdown-arrow').css({ 10242 'top': $(this).find('a').height() / 2 10243 });
10244 }); 10245 $('#slide-out-widget-area.fullscreen-split .off-canvas-menu-container li.menu-item-has-children').each(function () { 10246 $(this).find('.ocm-dropdown-arrow').css({ 10247 'top': $(this).find('a').height() / 2 10248 }); 10249 }); 10250 10251 } 10252 10253 10254 10255 10256 /** 10257 * Off canvas menu overflow scrolling. 10258 * 10259 * @since 8.0 10260 */ 10261 function OCM_overflowState() { 10262 10263 //switch position of social media/extra info based on screen size 10264 if (nectarDOMInfo.winW < 1000 || 10265 $('body > #boxed').length > 0 || 10266 $('.ocm-effect-wrap-inner > #boxed').length > 0) { 10267 10268 $('#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'); 10269 $('#slide-out-widget-area.fullscreen .bottom-text, #slide-out-widget-area.fullscreen-alt .bottom-text').appendTo('#slide-out-widget-area .inner'); 10270 10271 } else { 10272 $('#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'); 10273 $('#slide-out-widget-area.fullscreen .bottom-text, #slide-out-widget-area.fullscreen-alt .bottom-text').appendTo('#slide-out-widget-area .inner-wrap'); 10274 } 10275 10276 10277 //close mobile only slide out widget area if switching back to desktop 10278 if ($('.slide-out-from-right.open .off-canvas-menu-container.mobile-only').length > 0 && $('body.mobile').length == 0) { 10279 $('#slide-out-widget-area .slide_out_area_close').trigger('click'); 10280 } 10281 10282 //sizing for dropdown 10283 OCM_dropdownIconPos(); 10284 10285 } 10286 10287 10288 10289 /** 10290 * Off canvas menu: slide out from right hover open. 10291 * 10292 * @since 10.5 10293 */ 10294 function OCM_slideOutRightHoverOpen() { 10295 10296 calculateHoverNavMinHeight(); 10297 10298 if ( nectarDOMInfo.usingMobileBrowser && $('#slide-out-widget-area.open').length > 0 ) { 10299 OCM_mobileSlideOutRightHoverCloseCheck(); 10300 return false; 10301 } 10302 10303 if( nectarDOMInfo.usingMobileBrowser ) { 10304 $('.slide-out-widget-area-toggle a').attr('aria-expanded','true'); 10305 $offCanvasBG.css({ 10306 'height': '100%', 10307 'width': '100%' 10308 }); 10309 } 10310 10311 $offCanvasEl.css({ 10312 'transform': 'translate3d(0,0,0)' 10313 }).addClass('open'); 10314 10315 var withinCustomBreakpoint = mobileBreakPointCheck(); 10316 if( nectarDOMInfo.winW < 1000 ) { 10317 withinCustomBreakpoint = true; 10318 } 10319 var alignmentPosition = (window.nectarOptions && window.nectarOptions.mobile_header_format && window.nectarOptions.mobile_header_format === 'centered-menu' && withinCustomBreakpoint) ? 'left' : 'right'; 10320 10321 // Icon effect 10322 // Set position 10323 if ($('header#top .container .span_9 > .slide-out-widget-area-toggle').length > 0) { 10324 10325 var $hIconEl = $('.slide-out-hover-icon-effect'), 10326 secondaryBarHeight = nectarDOMInfo.secondaryHeaderHeight; 10327 10328 var $nectarHamMenuPos; 10329 var $withinCustomBreakpoint = mobileBreakPointCheck(); 10330 if( $('#header-outer[data-format="centered-menu-bottom-bar"]').length > 0 ) { 10331 $withinCustomBreakpoint = false; 10332 } 10333 10334 if ($('body.mobile').length > 0 || $withinCustomBreakpoint) { 10335 10336 $hIconEl.css({ 10337 'top': $('header#top .span_9 > .slide-out-widget-area-toggle a').offset().top - nectarDOMInfo.scrollTop 10338 }); 10339 10340 if( alignmentPosition === 'left' ) { 10341 $hIconEl.css({ 10342 'left' : parseInt($('#header-outer header > .container').css('padding-right')) + 1, 10343 'right' : '' 10344 });
10345 } else { 10346 $hIconEl.css({ 10347 'right' : parseInt($('#header-outer header > .container').css('padding-right')) + 1, 10348 'left' : '' 10349 }); 10350 } 10351 10352 } else { 10353 10354 if ($bodyBorderHeaderColorMatch) { 10355 10356 var $extraCushion = ($('#header-outer[data-has-menu="false"]').length > 0) ? 2 : 1; 10357 $hIconEl.css({ 10358 'top': nectarDOMInfo.adminBarHeight + secondaryBarHeight + parseInt($('header#top nav >ul .slide-out-widget-area-toggle a').css('padding-top')), 10359 'right': 29 + $extraCushion 10360 }); 10361 10362 } else { 10363 10364 if ($('#header-outer[data-format="centered-menu-bottom-bar"]').length > 0) { 10365 $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(); 10366 10367 if( $('#top .span_3 .slide-out-widget-area-toggle.mobile-icon').css('display') == 'flex' ) { 10368 $nectarHamMenuPos = $('#top .span_3 .slide-out-widget-area-toggle.mobile-icon a').offset(); 10369 } 10370 10371 $hIconEl.css({ 10372 'top': parseInt($nectarHamMenuPos.top) - nectarDOMInfo.scrollTop, 10373 'right': parseInt($('#header-outer header >.container').css('padding-right')) + 2, 10374 'left': '' 10375 }); 10376 } else { 10377 10378 if( $body.hasClass('ascend') ) { 10379 $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(); 10380 } else { 10381 $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(); 10382 } 10383 10384 10385 if ($('#header-secondary-outer.hide-up').length > 0) { 10386 secondaryBarHeight = 0; 10387 } 10388 10389 $hIconEl.css({ 10390 'top': nectarDOMInfo.adminBarHeight + secondaryBarHeight + parseInt($nectarHamMenuPos.top), 10391 'right': parseInt($('#header-outer header >.container').css('padding-right')) + 2, 10392 'left': '' 10393 }); 10394 } 10395 10396 } // No body border color match. 10397 10398 } //Not on mobile. 10399 10400 } 10401 10402 ////Open 10403 $('.slide-out-hover-icon-effect .lines-button') 10404 .removeClass('no-delay') 10405 .addClass('unhidden-line'); 10406 10407 if ($('#header-outer[data-permanent-transparent="1"]').length == 0 && 10408 $('#nectar_fullscreen_rows').length == 0 && 10409 !nectarDOMInfo.usingFrontEndEditor && 10410 nectarDOMInfo.winW > 1000) { 10411 10412 if (!(nectarDOMInfo.scrollTop == 0 && $('#header-outer.transparent').length > 0)) { 10413 10414 if ($('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) { 10415 10416 $headerOuterEl.attr('data-transparent', 'true').addClass('no-bg-color').addClass('slide-out-hover'); 10417 $('#header-outer header, #header-outer > .cart-outer').addClass('all-hidden'); 10418 } 10419 10420 } 10421 10422 if ($('#header-outer[data-remove-fixed="1"]').length == 0 && $('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) { 10423 10424 if (headerResize == true) { 10425 10426 $window.off('scroll', bigNav); 10427 $window.off('scroll', smallNav); 10428 10429 } else { 10430 $window.off('scroll', opaqueCheck); 10431 $window.off('scroll', transparentCheck); 10432 } 10433 } 10434 10435 } 10436 10437 if (!nectarDOMInfo.usingMobileBrowser) { 10438 $window.on('mousemove.rightOffsetCheck', OCM_slideOutRightHoverCloseCheck); 10439 } else { 10440 return false; 10441 } 10442 10443 } 10444 10445 10446 /** 10447 * Off canvas menu: slide out from right hover close 10448 * 10449 * @since 10.5 10450 */ 10451 function OCM_slideOutRightHoverCloseCheck(e) { 10452 10453 var $windowWidth = $window.width(); 10454 var $ocmHoverWidth = $offCanvasEl.outerWidth(); 10455 var withinCustomBreakpoint = mobileBreakPointCheck(); 10456 if( nectarDOMInfo.winW < 1000 ) { 10457 withinCustomBreakpoint = true; 10458 } 10459 var alignmentPosition = (window.nectarOptions && window.nectarOptions.mobile_header_format && window.nectarOptions.mobile_header_format === 'centered-menu' && withinCustomBreakpoint) ? 'left' : 'right'; 10460 10461 var conditionalShow = false; 10462 if( alignmentPosition !== 'left') { 10463 conditionalShow = (e.clientX < $windowWidth - parseInt($ocmHoverWidth) - $bodyBorderWidth);
10464 } else { 10465 conditionalShow = (e.clientX > parseInt($ocmHoverWidth) + $bodyBorderWidth); 10466 } 10467 10468 10469 if (conditionalShow && $offCanvasEl.hasClass('mouse-accessed')) { 10470 10471 $offCanvasEl.removeClass('mouse-accessed'); 10472 $window.off('mousemove.rightOffsetCheck', OCM_slideOutRightHoverCloseCheck); 10473 10474 $offCanvasEl.css({ 10475 'transform': '' 10476 }).removeClass('open'); 10477 10478 $headerOuterEl.removeClass('style-slide-out-from-right'); 10479 10480 $('.slide-out-hover-icon-effect .lines-button') 10481 .removeClass('unhidden-line') 10482 .addClass('no-delay'); 10483 10484 if ($('#header-outer[data-permanent-transparent="1"]').length == 0) { 10485 10486 if ($('#header-outer[data-remove-fixed="1"]').length == 0 && $('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) { 10487 10488 if ($('body.mobile').length == 0) { 10489 $headerOuterEl.removeClass('no-bg-color'); 10490 $('#header-outer header, #header-outer > .cart-outer').removeClass('all-hidden'); 10491 } 10492 } 10493 10494 if ($('#header-outer[data-remove-fixed="1"]').length == 0 && $('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) { 10495 10496 if (headerResize == true) { 10497 10498 $window.off('scroll.headerResizeEffect'); 10499 10500 if (nectarDOMInfo.scrollTop == 0) { 10501 10502 $window.on('scroll.headerResizeEffect', smallNav); 10503 10504 if ($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 && 10505 $bodyBorderTop.length > 0 && 10506 $bodyBorderHeaderColorMatch == true && 10507 $('#header-outer.pseudo-data-transparent').length > 0) { 10508 10509 $('#header-outer[data-full-width="true"] header > .container').stop(true, true).animate({ 10510 'padding': '0' 10511 }, { 10512 queue: false, 10513 duration: 250, 10514 easing: 'easeOutCubic' 10515 }); 10516 10517 } 10518 } else { 10519 $window.on('scroll.headerResizeEffect', bigNav); 10520 } 10521 10522 } else { 10523 10524 $window.off('scroll.headerResizeEffectOpaque'); 10525 $window.on('scroll.headerResizeEffectOpaque', opaqueCheck); 10526 } 10527 } 10528 } 10529 } 10530 10531 } 10532 10533 10534 /** 10535 * Off canvas menu: mobile slide out from right hover close. 10536 * 10537 * @since 10.5 10538 */ 10539 function OCM_mobileSlideOutRightHoverCloseCheck() { 10540 10541 if(nectarDOMInfo.usingMobileBrowser) { 10542 $('.slide-out-widget-area-toggle a').attr('aria-expanded','false'); 10543 $offCanvasBG.css({ 10544 'height': '1px', 10545 'width': '1px' 10546 }); 10547 } 10548 10549 $offCanvasEl.css({ 10550 'transform': '' 10551 }).removeClass('open'); 10552 10553 $headerOuterEl.removeClass('style-slide-out-from-right'); 10554 10555 $('.slide-out-hover-icon-effect .lines-button') 10556 .removeClass('unhidden-line') 10557 .addClass('no-delay'); 10558 10559 if ($('#header-outer[data-permanent-transparent="1"]').length == 0) { 10560 10561 $headerOuterEl.removeClass('no-bg-color'); 10562 $('#header-outer header').removeClass('all-hidden'); 10563 10564 } 10565 10566 10567 if ($('#header-outer[data-remove-fixed="1"]').length == 0 && $('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) { 10568 10569 if (headerResize == true) { 10570 10571 $window.off('scroll.headerResizeEffect'); 10572 10573 if (nectarDOMInfo.scrollTop == 0) { 10574 10575 $window.on('scroll.headerResizeEffect', smallNav); 10576 10577 if ($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 && 10578 $bodyBorderTop.length > 0 && 10579 $bodyBorderHeaderColorMatch == true && 10580 $('#header-outer.pseudo-data-transparent').length > 0) { 10581 10582 $('#header-outer[data-full-width="true"] header > .container').stop(true, true).animate({ 10583 'padding': '0' 10584 }, { 10585 queue: false, 10586 duration: 250, 10587 easing: 'easeOutCubic' 10588 }); 10589 10590 } 10591 } 10592 10593 else { 10594 $window.on('scroll.headerResizeEffect', bigNav); 10595 } 10596 10597 } else { 10598 10599 $window.off('scroll.headerResizeEffectOpaque'); 10600 $window.on('scroll.headerResizeEffectOpaque', opaqueCheck); 10601 10602 } 10603 10604 } 10605 10606 } 10607 10608 10609 10610 /** 10611 * Off canvas menu: slide out from right hover initialization. 10612 * 10613 * @since 10.5 10614 */ 10615 function OCM_slideOutRightHoverInit() { 10616 10617 if ($('#ajax-content-wrap > .slide-out-widget-area-toggle').length == 0) { 10618 10619 //icon effect html creation 10620 var $iconInsertLocation = ( $('.slide-out-widget-area-toggle[data-custom-color="true"]').length > 0 ) ? '#slide-out-widget-area > div' : '#slide-out-widget-area'; 10621 10622 $('<div class="slide-out-widget-area-toggle slide-out-hover-icon-effect" data-icon-animation="simple-transform"><div> <a href="#sidewidgetarea" class="closed"> <span> <i class="lines-button x2"> <i class="lines"></i> </i> </span> </a> </div> </div>').insertAfter($iconInsertLocation); 10623 10624 if ($('#header-outer[data-has-menu="true"]').length > 0 || 10625 $('body[data-header-search="true"]').length > 0 || 10626 $('.slide-out-widget-area-toggle a.using-label').length > 0 || 10627 $('.slide-out-widget-area-toggle[data-custom-color="true"]').length > 0 ) { 10628 $('.slide-out-widget-area-toggle').addClass('small'); 10629 } 10630 } 10631 10632 10633 //hover triggered 10634 if (!nectarDOMInfo.usingMobileBrowser) { 10635 $body.on('mouseenter', '#header-outer .slide-out-widget-area-toggle:not(.std-menu) a', OCM_slideOutRightHoverOpen); 10636 $offCanvasEl.on('mouseenter', function () { 10637 $(this).addClass('mouse-accessed'); 10638 });
10639 10640 } else { 10641 $body.on('click', '.slide-out-widget-area-toggle:not(.std-menu) a', OCM_slideOutRightHoverOpen); 10642 $body.on('click', '#slide-out-widget-area-bg', OCM_slideOutRightMobileClose); 10643 } 10644 10645 $window.on('smartresize', calculateHoverNavMinHeight); 10646 10647 10648 } 10649 10650 10651 /** 10652 * Off canvas menu: slide out from right close from body click on mobile. 10653 * 10654 * @since 12.2 10655 */ 10656 function OCM_slideOutRightMobileClose() { 10657 10658 if( $('.slide-out-from-right-hover.open').length > 0 ) { 10659 $('.slide-out-widget-area-toggle:not(.std-menu) a').first().addClass('non-human-allowed').trigger('click'); 10660 setTimeout(function () { 10661 $('.slide-out-widget-area-toggle:not(.std-menu) a').removeClass('non-human-allowed'); 10662 }, 100); 10663 } 10664 10665 } 10666 10667 10668 /** 10669 * Off canvas menu: slide out from right open. 10670 * 10671 * @since 10.5 10672 */ 10673 function OCM_slideOutRightOpen() { 10674 10675 var $slideOutAmount = ($bodyBorderTop.length > 0 && $('body.mobile').length == 0) ? $bodyBorderTop.height() : 0; 10676 10677 var withinCustomBreakpoint = mobileBreakPointCheck(); 10678 if( nectarDOMInfo.winW < 1000 ) { 10679 withinCustomBreakpoint = true; 10680 } 10681 var alignmentPosition = (window.nectarOptions && window.nectarOptions.mobile_header_format && window.nectarOptions.mobile_header_format === 'centered-menu' && withinCustomBreakpoint) ? 'left' : 'right'; 10682 10683 if ($('body.material').length == 0) { 10684 10685 // Calc height if used bottom meta. 10686 $('#slide-out-widget-area .inner').css({ 10687 'height': 'auto', 10688 'min-height': $offCanvasEl.height() - 25 - $('.bottom-meta-wrap').height() 10689 }); 10690 10691 // First item dropdown? 10692 if($('#slide-out-widget-area[data-dropdown-func="separate-dropdown-parent-link"] .inner > div:first-of-type > .menu > li:first-child').length > 0 && 10693 $('#slide-out-widget-area .inner > div:first-of-type > .menu > li:first-child').hasClass('menu-item-has-children')) { 10694 $('#slide-out-widget-area .inner > div:first-of-type').css({'margin-top':'50px'}); 10695 } 10696 10697 if ($('#boxed').length == 0) { 10698 10699 $('.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({ 10700 x: (alignmentPosition === 'left') ? '300px' : '-300px' 10701 }, 700, 'easeInOutCubic'); 10702 10703 var $withinCustomBreakpoint = mobileBreakPointCheck(); 10704 10705 if ($('#header-outer[data-format="centered-logo-between-menu"]').length == 0 || $withinCustomBreakpoint) { 10706 10707 if ($('#header-outer[data-transparency-option="1"]').length == 0 || 10708 ($('#header-outer[data-transparency-option="1"]').length > 0 && $('#header-outer[data-full-width="true"]').length == 0) || 10709 $('body.mobile').length > 0) { 10710 10711 $headerOuterEl.stop(true).css('transform', 'translateY(0)').transition({ 10712 x: (alignmentPosition === 'left') ? (300 + $slideOutAmount) + 'px' : '-' + (300 + $slideOutAmount) + 'px' 10713 }, 700, 'easeInOutCubic'); 10714 10715 } else { 10716 10717 $headerOuterEl.stop(true).css('transform', 'translateY(0)').transition({ 10718 x: (alignmentPosition === 'left') ? (300 + $slideOutAmount) + 'px' : '-' + (300 + $slideOutAmount) + 'px', 10719 'background-color': 'transparent', 10720 'border-bottom': '1px solid rgba(255,255,255,0.22)' 10721 }, 700, 'easeInOutCubic'); 10722 10723 } 10724 } else { 10725 $('#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({ 10726 x: (alignmentPosition === 'left') ? '300px' : '-300px' 10727 }, 700, 'easeInOutCubic'); 10728 } 10729 10730 } 10731 10732 $offCanvasEl.stop(true).transition({ 10733 x: (alignmentPosition === 'left') ? $slideOutAmount + 'px' : '-' + $slideOutAmount + 'px' 10734 }, 700, 'easeInOutCubic').addClass('open'); 10735 10736 10737 if ($('#boxed').length == 0) { 10738 10739 // Full width menu adjustments 10740 if ($('#header-outer[data-full-width="true"]').length > 0 && !$body.hasClass('mobile')) { 10741 $headerOuterEl.addClass('highzI'); 10742 $('#ascrail2000').addClass('z-index-adj'); 10743 10744 if ($('#header-outer[data-format="centered-logo-between-menu"]').length == 0) { 10745 10746 if ($bodyBorderWidth == 0) { 10747 $('header#top #logo').stop(true).transition({ 10748 x: (300 + $slideOutAmount) + 'px' //todo 10749 }, 700, 'easeInOutCubic'); 10750 } 10751 10752 } 10753 10754 $('header#top .slide-out-widget-area-toggle .lines-button:not(.legacy-double)').addClass('close'); 10755 10756 $('body #header-outer nav > ul > li > a').css({ 10757 'margin-bottom': '0' 10758 });
10759 10760 } 10761 10762 } 10763 10764 $headerOuterEl.addClass('style-slide-out-from-right'); 10765 10766 // Fade In BG Overlay 10767 $offCanvasBG.css({ 10768 'height': '100%', 10769 'width': '100%' 10770 }).stop(true).transition({ 10771 'opacity': 1 10772 }, 700, 'easeInOutCubic', function () { 10773 $('.slide-out-widget-area-toggle:not(.std-menu) > div > a').removeClass('animating'); 10774 }); 10775 10776 // Hide menu if no space 10777 if ($('#header-outer[data-format="centered-logo-between-menu"]').length == 0) { 10778 10779 var $logoWidth = ($('#logo img:visible').length > 0) ? $('#logo img:visible').width() : $('#logo').width(); 10780 10781 if ($('header#top nav > .sf-menu').offset().left - $logoWidth - 300 < 20) { 10782 $headerOuterEl.addClass('hidden-menu'); 10783 } 10784 10785 } else { 10786 $headerOuterEl.addClass('hidden-menu-items'); 10787 } 10788 10789 10790 if ($('#header-outer[data-remove-fixed="1"]').length == 0 && nectarDOMInfo.winW > 1000) { 10791 10792 if ($bodyBorderHeaderColorMatch == true && headerResize == true && $headerOuterEl.attr('data-transparent-header') == 'true') { 10793 10794 $headerOuterEl.stop(true).transition({ 10795 y: '0' 10796 }, 0).addClass('transparent').css('transition', 'transform'); 10797 10798 10799 $window.off('scroll', bigNav); 10800 $window.off('scroll', smallNav); 10801 10802 } else if ($bodyBorderHeaderColorMatch == true && $headerOuterEl.attr('data-transparent-header') == 'true') { 10803 10804 $headerOuterEl.addClass('transparent'); 10805 $window.off('scroll', opaqueCheck); 10806 $window.off('scroll', transparentCheck); 10807 10808 } 10809 } 10810 10811 } else if ($('body.material').length > 0) { 10812 10813 // Material theme skin slide out from right 10814 10815 //move ajax loading outside 10816 if ($loadingScreenEl.length > 0 && $('.ocm-effect-wrap #ajax-loading-screen').length > 0) { 10817 $loadingScreenEl.insertBefore('.ocm-effect-wrap'); 10818 } 10819 10820 // Hide secondary header when not at top with hhun 10821 if (nectarDOMInfo.scrollTop > 40) { 10822 $('body[data-hhun="1"] #header-secondary-outer').addClass('hidden'); 10823 } 10824 10825 setTimeout(function () { 10826 $('.slide-out-widget-area-toggle:not(.std-menu) > div > a').removeClass('animating'); 10827 }, 300); 10828 10829 $('#slide-out-widget-area, #slide-out-widget-area-bg, #header-outer .slide-out-widget-area-toggle').addClass('material-open'); 10830 10831 10832 // Handle bottom bar nav 10833 if ($('body:not(.mobile) #header-outer[data-format="centered-menu-bottom-bar"][data-condense="true"]').length > 0 && 10834 $('#header-outer[data-format="centered-menu-bottom-bar"] .span_9').css('display') != 'none') { 10835 10836 $('#header-outer:not(.fixed-menu)').css('top', nectarDOMInfo.adminBarHeight - nectarDOMInfo.scrollTop + 'px'); 10837 10838 if ($headerSecondaryEl.length > 0 && $('#header-outer.fixed-menu').length > 0) { 10839 $headerSecondaryEl.css('visibility', 'hidden'); 10840 } 10841 10842 } 10843 10844 $('#ajax-content-wrap').css({ 10845 'position': 'relative', 10846 'top': '-' + nectarDOMInfo.scrollTop + 'px' 10847 }); 10848 10849 $('.ocm-effect-wrap-inner').css({ 10850 'padding-top': nectarDOMInfo.adminBarHeight 10851 }); 10852 10853 $('#fp-nav').addClass('material-ocm-open'); 10854 10855 nectarState.materialOffCanvasOpen = true; 10856 $body.addClass('material-ocm-open'); 10857 $body.addClass('nectar-no-flex-height'); 10858 10859 $('.ocm-effect-wrap').css({ 10860 'height': nectarDOMInfo.winH 10861 }); 10862 10863 setTimeout(function () { 10864 $('.ocm-effect-wrap').addClass('material-ocm-open'); 10865 }, 40); 10866 10867 10868 $('body > .slide_out_area_close').addClass('follow-body'); 10869 10870 //icon effect 10871 $('#header-outer:not([data-format="left-header"]) header#top .slide-out-widget-area-toggle a').addClass('effect-shown'); 10872 10873 //handle hhun when at top 10874 $('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({ 10875 'transition': 'none', 10876 'transform': 'translateY(' + nectarDOMInfo.adminBarHeight + 'px)' 10877 });
10878 10879 10880 setTimeout(function () { 10881 $('body > .slide_out_area_close').addClass('material-ocm-open'); 10882 }, 350); 10883 10884 10885 } 10886 10887 } 10888 10889 10890 /** 10891 * Off canvas menu: slide out from right close. 10892 * 10893 * @since 10.5 10894 */ 10895 function OCM_slideOutRightClose() { 10896 10897 if ($('body.material').length == 0) { 10898 10899 var withinCustomBreakpoint = mobileBreakPointCheck(); 10900 if( nectarDOMInfo.winW < 1000 ) { 10901 withinCustomBreakpoint = true; 10902 } 10903 var alignmentPosition = (window.nectarOptions && window.nectarOptions.mobile_header_format && window.nectarOptions.mobile_header_format === 'centered-menu' && withinCustomBreakpoint) ? 'left' : 'right'; 10904 10905 $('.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({ 10906 x: '0px' 10907 }, 700, 'easeInOutCubic'); 10908 10909 if ($('#header-outer[data-transparency-option="1"]').length > 0 && $('#boxed').length == 0) { 10910 var $currentRowBG = ($('#header-outer[data-current-row-bg-color]').length > 0) ? $headerOuterEl.attr('data-current-row-bg-color') : $headerOuterEl.attr('data-user-set-bg'); 10911 $headerOuterEl.stop(true).transition({ 10912 x: '0px', 10913 'background-color': $currentRowBG 10914 }, 700, 'easeInOutCubic'); 10915 } else { 10916 $headerOuterEl.stop(true).transition({ 10917 x: '0px' 10918 }, 700, 'easeInOutCubic'); 10919 } 10920 10921 $offCanvasEl.stop(true).transition({ 10922 x: (alignmentPosition === 'left') ? '-301px' : '301px' 10923 }, 700, 'easeInOutCubic').removeClass('open'); 10924 10925 10926 if ($('#boxed').length == 0) { 10927 if ($('#header-outer[data-full-width="true"]').length > 0) { 10928 $headerOuterEl.removeClass('highzI'); 10929 $('header#top #logo').stop(true).transition({ 10930 x: '0px' 10931 }, 700, 'easeInOutCubic'); 10932 $('.lines-button').removeClass('close'); 10933 10934 } 10935 } 10936 10937 if ($('#header-outer[data-format="centered-logo-between-menu"]').length > 0) { 10938 $('#header-outer header#top nav > ul.buttons, #header-outer .cart-outer .cart-menu-wrap').stop(true).transition({ 10939 x: '0px' 10940 }, 700, 'easeInOutCubic'); 10941 } 10942 10943 //fade out overlay 10944 $offCanvasBG.stop(true).transition({ 10945 'opacity': 0 10946 }, 700, 'easeInOutCubic', function () { 10947 10948 $('.slide-out-widget-area-toggle a').removeClass('animating'); 10949 10950 $(this).css({ 10951 'height': '1px', 10952 'width': '1px' 10953 }); 10954 10955 if ($('#header-outer[data-remove-fixed="1"]').length == 0) { 10956 10957 //hide menu if transparent, user has scrolled down and hhun is on 10958 if ($headerOuterEl.hasClass('parallax-contained') && 10959 nectarDOMInfo.scrollTop > 0 && 10960 $('#header-outer[data-permanent-transparent="1"]').length == 0) { 10961 $headerOuterEl.removeClass('parallax-contained').addClass('detached').removeClass('transparent'); 10962 } 10963 else if (nectarDOMInfo.scrollTop == 0 && $('body[data-hhun="1"]').length > 0 && $('#page-header-bg[data-parallax="1"]').length > 0 || 10964 nectarDOMInfo.scrollTop == 0 && $('body[data-hhun="1"]').length > 0 && $('.parallax_slider_outer').length > 0) { 10965 10966 if ($('#header-outer[data-transparency-option="1"]').length > 0) { 10967 $headerOuterEl.addClass('transparent'); 10968 } 10969 10970 $headerOuterEl 10971 .addClass('parallax-contained') 10972 .removeClass('detached'); 10973 10974 } 10975 10976 } 10977 10978 //fix for fixed subpage menu 10979 $('.container-wrap').css('transform', 'none'); 10980 10981 }); 10982 10983 10984 $headerOuterEl.removeClass('style-slide-out-from-right'); 10985 10986 10987 if ($('#header-outer[data-remove-fixed="1"]').length == 0) { 10988 10989 if ($bodyBorderHeaderColorMatch == true && 10990 headerResize == true && 10991 nectarDOMInfo.winW > 1000) { 10992 10993 $window.off('scroll.headerResizeEffect'); 10994 if (nectarDOMInfo.scrollTop == 0) { 10995 10996 $window.on('scroll.headerResizeEffect', smallNav); 10997 10998 if ($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 && 10999 $bodyBorderTop.length > 0 && 11000 $bodyBorderHeaderColorMatch == true && 11001 $('#header-outer.pseudo-data-transparent').length > 0) { 11002 11003 $('#header-outer[data-full-width="true"] header > .container').stop(true, true).animate({ 11004 'padding': '0' 11005 }, { 11006 queue: false, 11007 duration: 250, 11008 easing: 'easeOutCubic' 11009 });
11010 11011 } 11012 } else { 11013 $window.on('scroll.headerResizeEffect', bigNav); 11014 } 11015 11016 if ($headerOuterEl.hasClass('pseudo-data-transparent')) { 11017 11018 $headerOuterEl.attr('data-transparent-header', 'false') 11019 .removeClass('pseudo-data-transparent') 11020 .removeClass('transparent'); 11021 } 11022 11023 $headerOuterEl.css('transition', 'transform'); 11024 11025 } else if ($bodyBorderHeaderColorMatch == true && nectarDOMInfo.winW > 1000) { 11026 11027 $window.off('scroll.headerResizeEffectOpaque'); 11028 $window.on('scroll.headerResizeEffectOpaque', opaqueCheck); 11029 11030 $headerOuterEl.css('transition', 'transform'); 11031 11032 if ($headerOuterEl.hasClass('pseudo-data-transparent')) { 11033 $headerOuterEl.attr('data-transparent-header', 'false') 11034 .removeClass('pseudo-data-transparent') 11035 .removeClass('transparent'); 11036 } 11037 } 11038 } 11039 } 11040 11041 else if ($('body.material').length > 0) { 11042 11043 //material 11044 $offCanvasEl.removeClass('open'); 11045 11046 $('#slide-out-widget-area, #slide-out-widget-area-bg, #header-outer .slide-out-widget-area-toggle').removeClass('material-open'); 11047 $('.ocm-effect-wrap, .ocm-effect-wrap-shadow, body > .slide_out_area_close, #fp-nav').removeClass('material-ocm-open'); 11048 11049 $('body > .slide_out_area_close').removeClass('follow-body'); 11050 11051 setTimeout(function () { 11052 $('.slide-out-widget-area-toggle a').removeClass('animating'); 11053 11054 $body.removeClass('material-ocm-open'); 11055 $body.removeClass('nectar-no-flex-height'); 11056 11057 $('.ocm-effect-wrap').css({ 11058 'height': '100%' 11059 }); 11060 11061 $('.ocm-effect-wrap-inner').css({ 11062 'padding-top': '0' 11063 }); 11064 11065 $window.scrollTop(Math.abs(parseInt($('#ajax-content-wrap').css('top')))); 11066 11067 $('#ajax-content-wrap').css({ 11068 'position': '', 11069 'top': '' 11070 }); 11071 11072 11073 //handle bottom bar nav 11074 if ($('#header-outer[data-format="centered-menu-bottom-bar"]').length > 0 && 11075 $('#header-outer[data-format="centered-menu-bottom-bar"] .span_9').css('display') != 'none' && 11076 $('body.mobile').length == 0) { 11077 11078 $('#header-outer:not(.fixed-menu)').css('top', ''); 11079 $headerSecondaryEl.css('visibility', ''); 11080 11081 } 11082 11083 //handle hhun when at top 11084 $('body[data-hhun="1"]:not(.no-scroll) #header-outer[data-permanent-transparent="false"]:not(.detached):not(.parallax-contained):not(.at-top-before-box)').css({ 11085 'transform': '' 11086 }); 11087 setTimeout(function () { 11088 $('body[data-hhun="1"]:not(.no-scroll) #header-outer[data-permanent-transparent="false"]:not(.detached):not(.parallax-contained):not(.at-top-before-box)').css({ 11089 'transition': '' 11090 });
11091 }, 30); 11092 11093 11094 $('body[data-hhun="1"] #header-secondary-outer.hidden').removeClass('hidden'); 11095 11096 nectarState.materialOffCanvasOpen = false; 11097 11098 }, 900); 11099 11100 setTimeout(function () { 11101 11102 //icon effect 11103 $('#header-outer:not([data-format="left-header"]) header#top .slide-out-widget-area-toggle a') 11104 .addClass('no-trans') 11105 .removeClass('effect-shown'); 11106 11107 }, 200); 11108 11109 setTimeout(function () { 11110 //icon 11111 $('#header-outer:not([data-format="left-header"]) header#top .slide-out-widget-area-toggle a').removeClass('no-trans'); 11112 }, 500); 11113 11114 } 11115 11116 } 11117 11118 11119 11120 11121 /** 11122 * Off canvas menu: fullscreen open. 11123 * 11124 * @since 10.5 11125 */ 11126 function OCM_fullscreenOpen() { 11127 11128 if ($('body.material').length > 0) { 11129 $('header#top .slide-out-widget-area-toggle a').addClass('menu-push-out'); 11130 } 11131 11132 // Scroll away from fixed reveal footer if shown (firefox bug with bluring over it) 11133 var $scrollDelay = 0; 11134 var $scrollDelay2 = 0; 11135 11136 if (nectarDOMInfo.scrollTop + $window.height() > $('.blurred-wrap').height() && $('#nectar_fullscreen_rows').length == 0) { 11137 $('body,html').stop().animate({ 11138 scrollTop: $('.blurred-wrap').height() - $window.height() 11139 }, 600, 'easeInOutCubic'); 11140 $scrollDelay = 550; 11141 $scrollDelay2 = 200; 11142 } 11143 11144 $('header#top .slide-out-widget-area-toggle:not(.std-menu) .lines-button:not(.legacy-double)').addClass('close'); 11145 setTimeout(function () { 11146 $('.blurred-wrap').addClass('blurred'); 11147 }, $scrollDelay); 11148 $('#slide-out-widget-area.fullscreen').show().addClass('open'); 11149 11150 if ($('.nectar-social.fixed').length == 0) { 11151 hideToTop(); 11152 } 11153 11154 // Remove box shadow incase at the top of the page with nectar box roll above 11155 $('.container-wrap').addClass('no-shadow'); 11156 $headerOuterEl.stop(true).css('transform', 'translateY(0)'); 11157 11158 setTimeout(function () { 11159 11160 $('.off-canvas-menu-container .menu > li').each(function (i) { 11161 $(this).delay(i * 50).transition({ 11162 y: 0, 11163 'opacity': 1 11164 }, 800, 'easeOutExpo'); 11165 }); 11166 11167 $('#slide-out-widget-area.fullscreen .widget').each(function (i) { 11168 $(this).delay(i * 100).transition({ 11169 y: 0, 11170 'opacity': 1 11171 }, 800, 'easeOutExpo'); 11172 }); 11173 }, 370 + $scrollDelay2); 11174 11175 setTimeout(function () { 11176 $('#slide-out-widget-area .off-canvas-social-links').addClass('line-shown'); 11177 11178 $('#slide-out-widget-area .off-canvas-social-links li').each(function (i) { 11179 $(this).delay(i * 50).transition({ 11180 'scale': 1 11181 }, 400, 'easeOutCubic'); 11182 }); 11183 11184 $('#slide-out-widget-area .bottom-text').transition({ 11185 'opacity': 0.7 11186 }, 400, 'easeOutCubic'); 11187 }, 750 + $scrollDelay2); 11188 11189 // Fade In BG Overlay 11190 setTimeout(function () { 11191 var $easing = ($('body.mobile').length > 0) ? 'easeOutCubic' : 'easeInOutQuint'; 11192 $offCanvasBG.css({ 11193 'height': '100%', 11194 'width': '100%' 11195 }).show().stop(true).transition({ 11196 'y': '0%' 11197 }, 920, $easing, function () { 11198 $('.slide-out-widget-area-toggle > div > a').removeClass('animating'); 11199 }); 11200 }, 50 + $scrollDelay2); 11201 11202 // Overflow state 11203 OCM_overflowState(); 11204 11205 if ($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && $('.container-wrap').hasClass('no-scroll')) { 11206 $('#ajax-content-wrap').addClass('at-content'); 11207 } 11208 11209 var headerOffset = $headerOuterEl.offset().top - nectarDOMInfo.scrollTop + nectarDOMInfo.secondaryHeaderHeight; 11210 11211 $('#slide-out-widget-area.fullscreen .inner-wrap').css('padding-top', ($headerOuterEl.outerHeight() + headerOffset)); 11212 11213 11214 } 11215 11216 11217 /** 11218 * Off canvas menu: fullscreen close. 11219 * 11220 * @since 10.5 11221 */ 11222 function OCM_fullscreenClose() { 11223 11224 if ($('body.material').length > 0) { 11225 setTimeout(function () { 11226 $('header#top .slide-out-widget-area-toggle a').removeClass('menu-push-out'); 11227 }, 350); 11228 } 11229 11230 $('.slide-out-widget-area-toggle:not(.std-menu) .lines-button:not(.legacy-double)').removeClass('close'); 11231 $('.blurred-wrap').removeClass('blurred'); 11232 $('#slide-out-widget-area.fullscreen').transition({ 11233 'opacity': 0 11234 }, 700, 'easeOutQuad', function () { 11235 $('#slide-out-widget-area.fullscreen').hide().css('opacity', '1'); 11236 }).removeClass('open'); 11237 $('#slide-out-widget-area.fullscreen .widget').transition({ 11238 'opacity': 0 11239 }, 700, 'easeOutQuad', function () { 11240 $(this).transition({ 11241 y: '110px' 11242 }, 0); 11243 });
11244 11245 setTimeout(function () { 11246 $('.off-canvas-menu-container .menu > li').transition({ 11247 y: '80px', 11248 'opacity': 0 11249 }, 0); 11250 $('#slide-out-widget-area .off-canvas-social-links li').transition({ 11251 'scale': 0 11252 }, 0); 11253 $('#slide-out-widget-area .off-canvas-social-links').removeClass('line-shown'); 11254 $('#slide-out-widget-area .bottom-text').transition({ 11255 'opacity': 0 11256 }, 0); 11257 11258 // Close submenu items 11259 $('#slide-out-widget-area .menuwrapper .menu').removeClass('subview'); 11260 $('#slide-out-widget-area .menuwrapper .menu li').removeClass('subview subviewopen'); 11261 $('#slide-out-widget-area.fullscreen .inner .menu-wrap').css('height', 'auto'); 11262 }, 800); 11263 11264 setTimeout(function () { 11265 if ($('.nectar-social.fixed').length == 0) { 11266 showToTop(); 11267 } 11268 $('.container-wrap').removeClass('no-shadow'); 11269 }, 500); 11270 11271 // Fade out overlay 11272 $offCanvasBG.stop(true).transition({ 11273 'opacity': 0 11274 }, 900, 'easeOutQuad', function () { 11275 11276 if ($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && $('.container-wrap').hasClass('no-scroll')) { 11277 $('#ajax-content-wrap').removeClass('at-content'); 11278 } 11279 if ($('.mobile #header-outer[data-permanent-transparent="false"]').length == 0) { 11280 $('#slide-out-widget-area.fullscreen .inner-wrap').css('padding-top', '0'); 11281 } 11282 11283 $('.slide-out-widget-area-toggle a').removeClass('animating'); 11284 11285 var $opacity = 0.4; 11286 11287 if ($offCanvasBG.hasClass('solid')) { 11288 $opacity = 1; 11289 } 11290 if ($offCanvasBG.hasClass('dark')) { 11291 $opacity = 0.93; 11292 } 11293 if ($offCanvasBG.hasClass('medium')) { 11294 $opacity = 0.6; 11295 } 11296 if ($offCanvasBG.hasClass('light')) { 11297 $opacity = 0.4; 11298 } 11299 $(this).css({ 11300 'height': '1px', 11301 'width': '1px', 11302 'opacity': $opacity 11303 }).transition({ 11304 y: '-100%' 11305 }, 0); 11306 }); 11307 11308 } 11309 11310 11311 /** 11312 * Off canvas menu: fullscreen alt open. 11313 * 11314 * @since 10.5 11315 */ 11316 function OCM_fullscreenAltOpen() { 11317 11318 var $ocm_fullscreen_class = ( $offCanvasEl.hasClass('fullscreen-alt') ) ? '.fullscreen-alt' : '.fullscreen-split'; 11319 11320 if ($('body.material').length > 0) { 11321 $('header#top .slide-out-widget-area-toggle a').addClass('menu-push-out'); 11322 } 11323 11324 $('header#top .slide-out-widget-area-toggle:not(.std-menu) .lines-button:not(.legacy-double)').addClass('close'); 11325 11326 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 11327 $('#slide-out-widget-area'+$ocm_fullscreen_class).show().addClass('open'); 11328 } else { 11329 $('#slide-out-widget-area'+$ocm_fullscreen_class).addClass('open').removeClass('hidden'); 11330 } 11331 11332 $offCanvasBG.addClass('open').removeClass('hidden'); 11333 11334 $('body > div[class*="body-border"]').css('z-index', '9995'); 11335 11336 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 11337 $('.off-canvas-menu-container .menu').transition({ 11338 y: '0px', 11339 'opacity': 1 11340 }, 0); 11341 } 11342 11343 if ($('.nectar-social.fixed').length == 0) { 11344 hideToTop(); 11345 } 11346 11347 if ($('#header-outer.transparent').length > 0) { 11348 11349 if ($bodyBorderTop.length > 0) { 11350 $('.admin-bar #slide-out-widget-area-bg'+$ocm_fullscreen_class).css({ 11351 'padding-top': ($bodyBorderTop.outerHeight(true) + 32) + 'px' 11352 }); 11353 $('body:not(.admin-bar) #slide-out-widget-area-bg'+$ocm_fullscreen_class).css({ 11354 'padding-top': ($bodyBorderTop.outerHeight(true)) + 'px' 11355 }); 11356 } 11357 } 11358 11359 // Set translateY to 0 in all cases 11360 $headerOuterEl.stop(true).css('transform', 'translateY(0)'); 11361 11362 if ($('#logo .starting-logo').length > 0 && 11363 $window.width() > 1000 && 11364 $('#header-outer[data-format="centered-menu-bottom-bar"].fixed-menu').length == 0 && 11365 $('body.material #header-outer[data-condense="true"]').length == 0 && 11366 $headerOuterEl.attr('data-transparent-header') == 'true' && 11367 !nectarDOMInfo.usingFrontEndEditor) { 11368 11369 $headerOuterEl.stop(true).css('transform', 'translateY(0)').addClass('transparent'); 11370 11371 } 11372 11373 $('.off-canvas-menu-container .clip-wrap').css('transition-duration', '0s'); 11374 11375 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 11376 11377 setTimeout(function () { 11378 11379 $('.off-canvas-menu-container .menu > li').each(function (i) { 11380 $(this).delay(i * 50).transition({ 11381 y: 0, 11382 'opacity': 1 11383 }, 750, 'easeOutCubic').addClass('no-pointer-events'); 11384 });
11385 11386 setTimeout(function () { 11387 $('.off-canvas-menu-container .menu > li').removeClass('no-pointer-events'); 11388 $('.off-canvas-menu-container .clip-wrap').css('transition-duration', '.45s'); 11389 }, 500); 11390 11391 $('#slide-out-widget-area.fullscreen-alt .widget').each(function (i) { 11392 $(this).delay(i * 100).transition({ 11393 y: 0, 11394 'opacity': 1 11395 }, 650, 'easeOutCubic'); 11396 }); 11397 11398 }, 200); 11399 11400 setTimeout(function () { 11401 $('#slide-out-widget-area .off-canvas-social-links').addClass('line-shown'); 11402 11403 $('#slide-out-widget-area .off-canvas-social-links li').css('opacity', '1').each(function (i) { 11404 $(this).delay(i * 50).transition({ 11405 'scale': 1 11406 }, 400, 'easeOutCubic'); 11407 }); 11408 $('#slide-out-widget-area .bottom-text').transition({ 11409 'opacity': 1 11410 }, 600, 'easeOutCubic'); 11411 }, 200); 11412 11413 } 11414 11415 // Fade In BG Overlay 11416 var $opacity = 0.4; 11417 11418 if ($offCanvasBG.hasClass('solid')) { 11419 $opacity = 1; 11420 } 11421 if ($offCanvasBG.hasClass('dark')) { 11422 $opacity = 0.97; 11423 } 11424 if ($offCanvasBG.hasClass('medium')) { 11425 $opacity = 0.6; 11426 } 11427 if ($offCanvasBG.hasClass('light')) { 11428 $opacity = 0.4; 11429 } 11430 $offCanvasBG.removeClass('no-transition'); 11431 11432 11433 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 11434 11435 $offCanvasBG.addClass('padding-removed').css({ 11436 'height': '100%', 11437 'width': '100%', 11438 'left': '0', 11439 'opacity': $opacity 11440 }); 11441 11442 // Overflow state 11443 OCM_overflowState(); 11444 11445 } 11446 11447 setTimeout(function () { 11448 $('.slide-out-widget-area-toggle > div > a').removeClass('animating'); 11449 }, 600); 11450 11451 11452 if ($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && 11453 $('.container-wrap').hasClass('no-scroll')) { 11454 $('#ajax-content-wrap').addClass('at-content'); 11455 } 11456 11457 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 11458 11459 var headerOffset = $headerOuterEl.offset().top - nectarDOMInfo.scrollTop + nectarDOMInfo.secondaryHeaderHeight; 11460 11461 $('#slide-out-widget-area'+$ocm_fullscreen_class+' .inner-wrap').css('padding-top', ($headerOuterEl.outerHeight() + headerOffset)); 11462 11463 } else { 11464 $('#slide-out-widget-area'+$ocm_fullscreen_class+' .inner-wrap').css('padding-top', $headerOuterEl.outerHeight()); 11465 } 11466 11467 } 11468 11469 11470 /** 11471 * Off canvas menu: fullscreen alt close. 11472 * 11473 * @since 10.5 11474 */ 11475 function OCM_fullscreenAltClose() { 11476 11477 var $ocm_fullscreen_class = ( $offCanvasEl.hasClass('fullscreen-alt') ) ? '.fullscreen-alt' : '.fullscreen-split'; 11478 11479 if ($('body.material').length > 0) { 11480 setTimeout(function () { 11481 $('header#top .slide-out-widget-area-toggle a').removeClass('menu-push-out'); 11482 }, 350); 11483 } 11484 11485 $('.slide-out-widget-area-toggle:not(.std-menu) .lines-button:not(.legacy-double)').removeClass('close'); 11486 11487 11488 $offCanvasBG.removeClass('open'); 11489 11490 if( $ocm_fullscreen_class === '.fullscreen-split' ) { 11491 setTimeout(function () { 11492 $offCanvasBG.addClass('hidden'); 11493 $('#slide-out-widget-area'+$ocm_fullscreen_class).addClass('hidden'); 11494 },600); 11495 } 11496 11497 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 11498 11499 $('.blurred-wrap').removeClass('blurred'); 11500 11501 $('#slide-out-widget-area.fullscreen-alt .widget').transition({ 11502 'opacity': 0 11503 }, 500, 'easeOutQuad', function () { 11504 $(this).transition({ 11505 y: '40px' 11506 }, 0); 11507 }); 11508 $('#slide-out-widget-area .bottom-text, #slide-out-widget-area .off-canvas-social-links li').transition({ 11509 'opacity': 0 11510 }, 250, 'easeOutQuad'); 11511 $('#slide-out-widget-area .off-canvas-social-links').removeClass('line-shown'); 11512 11513 $('.off-canvas-menu-container .menu').transition({ 11514 y: '-13px', 11515 'opacity': 0 11516 }, 400); 11517 11518 } 11519 11520 11521 setTimeout(function () { 11522 11523 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 11524 11525 $('.off-canvas-menu-container .menu > li').stop(true, true).transition({ 11526 y: '40px', 11527 'opacity': 0 11528 }, 0); 11529 $('#slide-out-widget-area .off-canvas-social-links li').transition({ 11530 'scale': 0 11531 }, 0); 11532 $('#slide-out-widget-area .off-canvas-social-links').removeClass('line-shown'); 11533 11534 // Close submenu items 11535 $('#slide-out-widget-area .menuwrapper .menu').removeClass('subview'); 11536 $('#slide-out-widget-area .menuwrapper .menu li').removeClass('subview subviewopen'); 11537 $('#slide-out-widget-area.fullscreen-alt .inner .menu-wrap').css('height', 'auto'); 11538 11539 $offCanvasBG.css({ 11540 'height': '1px', 11541 'width': '1px', 11542 'left': '-100%' 11543 });
11544 11545 } 11546 11547 if ($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && $('.container-wrap').hasClass('no-scroll')) { 11548 $('#ajax-content-wrap').removeClass('at-content'); 11549 } 11550 11551 if ($('.mobile #header-outer[data-permanent-transparent="false"]').length == 0) { 11552 $('#slide-out-widget-area'+$ocm_fullscreen_class+' .inner-wrap').css('padding-top', '0'); 11553 } 11554 11555 $('.slide-out-widget-area-toggle a').removeClass('animating'); 11556 11557 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 11558 $('#slide-out-widget-area'+$ocm_fullscreen_class).hide().removeClass('open'); 11559 } 11560 11561 }, 550); 11562 11563 if( $ocm_fullscreen_class === '.fullscreen-split' ) { 11564 $('#slide-out-widget-area'+$ocm_fullscreen_class).removeClass('open'); 11565 } 11566 11567 setTimeout(function () { 11568 if ($('.nectar-social.fixed').length == 0) { 11569 showToTop(); 11570 } 11571 }, 600); 11572 11573 // Fade out overlay 11574 setTimeout(function () { 11575 $offCanvasBG.removeClass('padding-removed'); 11576 }, 50); 11577 11578 11579 var borderDelay = ($bodyBorderHeaderColorMatch == true) ? 150 : 50; 11580 11581 setTimeout(function () { 11582 11583 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 11584 $offCanvasBG.stop(true).css({ 11585 'opacity': 0 11586 }); 11587 } 11588 if ($('#header-outer[data-transparent-header="true"]').length > 0) { 11589 $('body > div[class*="body-border"]').css('z-index', '10000'); 11590 } 11591 }, borderDelay); 11592 11593 setTimeout(function () { 11594 $('#header-outer:not([data-permanent-transparent="1"]).transparent.small-nav, #header-outer[data-hhun="1"]:not([data-permanent-transparent="1"]).transparent.scrolling, #header-outer:not([data-permanent-transparent="1"]).transparent.scrolled-down').removeClass('transparent'); 11595 11596 if ($headerOuterEl.hasClass('pseudo-data-transparent')) { 11597 11598 $headerOuterEl.attr('data-transparent-header', 'false') 11599 .removeClass('pseudo-data-transparent') 11600 .removeClass('transparent'); 11601 } 11602 11603 }, 100); 11604 11605 } 11606 11607 11608 /** 11609 * Off canvas menu: simple dropdown open. 11610 * 11611 * @since 10.5 11612 */ 11613 function OCM_simpleDropdownOpen(classname) { 11614 11615 $('#mobile-menu').show(); 11616 11617 $('header#top').find('.'+classname+':not(.std-menu) .lines-button').addClass('close'); 11618 11619 if ($('body.material').length > 0) { 11620 $('header#top').find('.'+classname+' a').addClass('menu-push-out'); 11621 } 11622 11623 setTimeout(function () { 11624 $('header#top').find('.'+classname+' > div > a').removeClass('animating'); 11625 }, 100); 11626 11627 } 11628 11629 /** 11630 * Off canvas menu: simple dropdown close.
11631 * 11632 * @since 10.5 11633 */ 11634 function OCM_simpleDropdownClose(classname) { 11635 11636 $('#mobile-menu').hide(); 11637 11638 $('body').find('.'+classname+':not(.std-menu) .lines-button').removeClass('close'); 11639 11640 setTimeout(function () { 11641 if ($('body.material').length > 0) { 11642 $('header#top .'+classname+' a').removeClass('menu-push-out'); 11643 } 11644 $('body').find('.'+classname+' a').removeClass('animating'); 11645 }, 350); 11646 } 11647 11648 11649 /** 11650 * Off canvas menu: simple dropdown click events. 11651 * 11652 * @since 10.5 11653 */ 11654 function OCM_simpleStyleInit() { 11655 11656 if( $('#header-outer #mobile-menu').length == 0 ) { 11657 return; 11658 } 11659 11660 $('#header-outer #mobile-menu li.megamenu').removeClass('megamenu'); 11661 11662 // Add icons/markup. 11663 $('#header-outer #mobile-menu ul li a').each(function() { 11664 if( !$(this).hasClass('nectar-widget-link') && $(this).find('.nectar-ext-menu-item').length == 0 ) { 11665 $(this).wrapInner('<span></span>'); 11666 } 11667 }); 11668 11669 $('#header-outer #mobile-menu ul li').each(function(){ 11670 11671 if($(this).find('> ul').length > 0) { 11672 $(this).find('> a').append('<span class="sf-sub-indicator"><i class="fa fa-angle-down"></i></span>'); 11673 } 11674 11675 }); 11676 11677 // Click event. 11678 $('#header-outer #mobile-menu .sf-sub-indicator').on('click', function(){ 11679 11680 var $parentLI = $(this).parent().parent(); 11681 11682 $parentLI.toggleClass('current-open-item'); 11683 11684 // Open. 11685 if( $parentLI.hasClass('current-open-item') ) { 11686 $parentLI.find('> ul').show(); 11687 setTimeout(function(){ 11688 $parentLI.addClass('visible'); 11689 },30); 11690 } else { 11691 // Close. 11692 $parentLI.find('ul').hide(); 11693 // Ensure open children also close. 11694 $parentLI.find('li').removeClass('visible').removeClass('current-open-item'); 11695 $parentLI.removeClass('visible'); 11696 } 11697 11698 return false; 11699 11700 }); 11701 11702 // Resize event. 11703 $window.on('smartresize', function(){ 11704 11705 if( nectarDOMInfo.winW > 1000 && $('.slide-out-widget-area-toggle.mobile-icon a.open').length > 0 || 11706 nectarDOMInfo.winW > 1000 && $('.nectar-ocm-trigger-open.simple-mobile-menu a.open').length > 0) { 11707 11708 $('.slide-out-widget-area-toggle.mobile-icon a, .nectar-ocm-trigger-open.simple-mobile-menu a').addClass('non-human-allowed'); 11709 11710 11711 $('.slide-out-widget-area-toggle.mobile-icon a.open, .nectar-ocm-trigger-open.simple-mobile-menu a.open').trigger('click'); 11712 11713 setTimeout(function () { 11714 $('.slide-out-widget-area-toggle.mobile-icon a, .nectar-ocm-trigger-open.simple-mobile-menu a').removeClass('non-human-allowed'); 11715 }, 100); 11716 11717 } 11718 11719 }); 11720 11721 } 11722 11723 11724 /** 11725 * Off canvas menu click triggered styles initialization 11726 * 11727 * @since 10.5 11728 */ 11729 function OCM_clickTriggeredStylesInit() { 11730 11731 // Click triggered open bind. 11732 $body.on('click', '.slide-out-widget-area-toggle:not(.std-menu) a.closed:not(.animating), .nectar-ocm-trigger-open', function () { 11733 11734 if (nectarBoxRoll.animating == 'true' || $('.slide-out-from-right-hover').length > 0) { 11735 return false; 11736 } 11737 11738 $headerOuterEl.removeClass('no-transition'); 11739 11740 // Classic Mobile Direct Custom Link. 11741 if( $(this).hasClass('simple-mobile-menu')) { 11742 OCM_simpleDropdownOpen('simple-mobile-menu'); 11743 $(this).find('a').addClass('open'); 11744 return false; 11745 } 11746 11747 // Slide out from right. 11748 if ($offCanvasEl.hasClass('slide-out-from-right')) { 11749 OCM_slideOutRightOpen(); 11750 } 11751 // Fullscreen. 11752 else if ($offCanvasEl.hasClass('fullscreen')) { 11753 OCM_fullscreenOpen(); 11754 } 11755 // Fullscreen Alt. 11756 else if ($offCanvasEl.hasClass('fullscreen-alt') || $offCanvasEl.hasClass('fullscreen-split')) { 11757 OCM_fullscreenAltOpen(); 11758 } 11759 // Simple dropdown. 11760 else if( $('#header-outer #mobile-menu').length > 0 ) { 11761 OCM_simpleDropdownOpen('slide-out-widget-area-toggle'); 11762 } 11763 11764 11765 // Add open class 11766 if( $('#header-outer #mobile-menu').length == 0 ) { 11767 11768 $headerOuterEl 11769 .removeClass('side-widget-closed') 11770 .addClass('side-widget-open'); 11771 11772 11773 // Give header transparent state 11774 if ($('#header-outer[data-transparency-option="1"]').length > 0 && 11775 $('#boxed').length == 0 && 11776 $('#header-outer[data-full-width="true"]').length > 0 && 11777 !nectarDOMInfo.usingFrontEndEditor) { 11778
11779 if ($('body.material[data-slide-out-widget-area-style="slide-out-from-right"]').length == 0 && 11780 $('body.material #header-outer[data-condense="true"]').length == 0) { 11781 11782 $headerOuterEl.addClass('transparent'); 11783 11784 } 11785 11786 } 11787 11788 // Dark slide transparent nav 11789 if ($('#header-outer.dark-slide.transparent').length > 0 && 11790 $('#boxed').length == 0 && 11791 $('body.material-ocm-open').length == 0) { 11792 $headerOuterEl 11793 .removeClass('dark-slide') 11794 .addClass('temp-removed-dark-slide'); 11795 } 11796 11797 } // Not using simple OCM. 11798 11799 11800 $('.slide-out-widget-area-toggle:not(.simple-mobile-menu) > div > a') 11801 .removeClass('closed') 11802 .addClass('open') 11803 .attr('aria-expanded','true'); 11804 11805 $('.slide-out-widget-area-toggle:not(.simple-mobile-menu) > div > a').addClass('animating'); 11806 11807 return false; 11808 11809 }); 11810 11811 11812 11813 // Close event bind. 11814 $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, #slide-out-widget-area-bg.slide-out-from-right, .material-ocm-open #ajax-content-wrap', function (e) { 11815 11816 if (e.originalEvent == undefined && 11817 $('.slide_out_area_close.non-human-allowed').length == 0 && 11818 $('.slide-out-widget-area-toggle.mobile-icon a.non-human-allowed').length == 0) { 11819 return; 11820 } 11821 11822 if ($('.slide-out-widget-area-toggle:not(.std-menu) a.animating').length > 0) { 11823 return; 11824 } 11825 11826 $headerOuterEl.removeClass('no-transition'); 11827 11828 // Classic Mobile Direct Custom Link. 11829 if( $(this).parents('.simple-mobile-menu').length > 0 ) { 11830 OCM_simpleDropdownClose('simple-mobile-menu'); 11831 $(this).removeClass('open'); 11832 return false; 11833 } 11834 11835 $('.slide-out-widget-area-toggle:not(.std-menu):not(.simple-mobile-menu) a') 11836 .removeClass('open') 11837 .addClass('closed') 11838 .attr('aria-expanded','false'); 11839 11840 $('.slide-out-widget-area-toggle:not(.simple-mobile-menu):not(.std-menu) a') 11841 .addClass('animating'); 11842 11843 // Slide out from right. 11844 if ($offCanvasEl.hasClass('slide-out-from-right')) { 11845 OCM_slideOutRightClose(); 11846 } 11847 11848 // Fullscreen. 11849 else if ($offCanvasEl.hasClass('fullscreen')) { 11850 OCM_fullscreenClose(); 11851 } 11852 // Fullscreen alt. 11853 else if ($offCanvasEl.hasClass('fullscreen-alt') || $offCanvasEl.hasClass('fullscreen-split')) { 11854 OCM_fullscreenAltClose(); 11855 } 11856 // Simple dropdown. 11857 else if( $('#header-outer #mobile-menu').length > 0 ) { 11858 OCM_simpleDropdownClose('slide-out-widget-area-toggle'); 11859 } 11860 11861 if( $('#header-outer #mobile-menu').length == 0 ) { 11862 11863 // Dark slide transparent nav 11864 if ($('#header-outer.temp-removed-dark-slide.transparent').length > 0 && $('#boxed').length == 0) { 11865 $headerOuterEl 11866 .removeClass('temp-removed-dark-slide') 11867 .addClass('dark-slide'); 11868 } 11869 11870 // Remove header transparent state 11871 if ($('#header-outer[data-permanent-transparent="1"]').length == 0 && $('#slide-out-widget-area.fullscreen-alt').length == 0) { 11872 11873 if ($('.nectar-box-roll').length == 0) { 11874 if ($('#header-outer.small-nav').length > 0 || 11875 $('#header-outer.scrolled-down').length > 0) { 11876 $headerOuterEl.removeClass('transparent'); 11877 } 11878 } 11879 else { 11880 if ($('#header-outer.small-nav').length > 0 || 11881 $('#header-outer.scrolled-down').length > 0 || 11882 $('.container-wrap.auto-height').length > 0) { 11883 $headerOuterEl.removeClass('transparent'); 11884 } 11885 } 11886 11887 } 11888 11889 // Remove hidden menu 11890 $headerOuterEl.removeClass('hidden-menu'); 11891 11892 $headerOuterEl 11893 .removeClass('side-widget-open') 11894 .addClass('side-widget-closed'); 11895 11896 } // Not using simple OCM. 11897 11898 return false; 11899 11900 }); 11901 11902 } 11903 11904 11905 /** 11906 * Off canvas menu main initialization. 11907 * 11908 * @since 10.5 11909 */ 11910 function OCM_init() { 11911 11912 if ($('#slide-out-widget-area.slide-out-from-right-hover').length > 0) { 11913 OCM_slideOutRightHoverInit(); 11914 } else { 11915 OCM_clickTriggeredStylesInit(); 11916 OCM_simpleStyleInit(); 11917 } 11918 11919 11920 if ($('#slide-out-widget-area.fullscreen-split').length == 0 &&
11921 $('body.material[data-slide-out-widget-area-style*="slide-out-from-right"]').length == 0 && 11922 $('#slide-out-widget-area[data-dropdown-func="separate-dropdown-parent-link"]').length == 0) { 11923 11924 fullscreenMenuInit(); 11925 11926 } else if ($('body.using-mobile-browser[data-slide-out-widget-area-style="slide-out-from-right-hover"]').length > 0) { 11927 11928 // Close OCM on mobile when clicking anchor on same page 11929 $('body #slide-out-widget-area .inner .off-canvas-menu-container li a[href*="#"]').on('click', function () { 11930 if ($(this).attr('href') != '#') { 11931 OCM_close($(this).parent()); 11932 } 11933 11934 }); 11935 11936 } 11937 11938 // Page fullscreen row close OCM fullscreen/classic slide out from right 11939 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) ) { 11940 11941 $('body #slide-out-widget-area .inner .off-canvas-menu-container li a[href]').on('click', function () { 11942 11943 var $link_href = ($(this).is('[href*="#"]')) ? $(this).attr('href') : ''; 11944 if ($link_href != '#' && $('div[data-fullscreen-anchor-id="' + $link_href.substr($link_href.indexOf("#") + 1) + '"]').length > 0) { 11945 11946 setTimeout(function () { 11947 11948 $('#slide-out-widget-area .slide_out_area_close') 11949 .addClass('non-human-allowed') 11950 .trigger('click'); 11951 11952 }, 100); 11953 11954 setTimeout(function () { 11955 $('#slide-out-widget-area .slide_out_area_close').removeClass('non-human-allowed'); 11956 }, 150); 11957 11958 } 11959 11960 }); 11961 } 11962 11963 11964 // Submenu link hover fix 11965 $body.on('mouseover', '#slide-out-widget-area .off-canvas-menu-container .menuwrapper > .sub-menu li > a', function () { 11966 var $currentTxt = $(this).text(); 11967 $('.off-canvas-menu-container .menuwrapper .menu li > a').removeClass('hovered'); 11968 $('.off-canvas-menu-container .menuwrapper .menu li > a:contains(' + $currentTxt + ')').addClass('hovered'); 11969 }); 11970 11971 $body.on('mouseover', '.off-canvas-menu-container .menuwrapper .menu li > a', function () { 11972 $('.off-canvas-menu-container .menuwrapper .menu li > a').removeClass('hovered'); 11973 }); 11974 11975 11976 // Bind mousewheel. 11977 setTimeout(OCM_scrolling, 500); 11978 11979 // Handle mobile scrolling. 11980 if (nectarDOMInfo.usingMobileBrowser) { 11981 $offCanvasEl.addClass('mobile'); 11982 } 11983 11984 11985 } 11986 11987 11988 11989 11990 /** 11991 * Off canvas menu scrolling. 11992 * 11993 * @since 10.5 11994 */ 11995 function OCM_scrolling() { 11996 11997 $offCanvasEl.mousewheel(function (event, delta) { 11998 11999 this.scrollTop -= (event.deltaY * event.deltaFactor)/1.5; 12000 12001 event.preventDefault(); 12002 }); 12003 12004 } 12005 12006 12007 12008 /** 12009 * Off canvas menu close. 12010 * 12011 * @since 10.5 12012 */ 12013 function OCM_close(item) { 12014 12015 if ($('#slide-out-widget-area.open').length > 0) { 12016 12017 var $windowCurrentLocation = window.location.href.split("#")[0]; 12018 var $windowClickedLocation = item.find('> a').attr('href').split("#")[0]; 12019 12020 if ($windowCurrentLocation == $windowClickedLocation || item.find('a[href^="#"]').length > 0) { 12021 if (item.parents('.slide-out-from-right-hover').length > 0) { 12022 $('.slide-out-widget-area-toggle.slide-out-hover-icon-effect a').trigger('click'); 12023 } else { 12024 $('.slide-out-widget-area-toggle a').trigger('click'); 12025 } 12026 12027 } 12028 } 12029 12030 } 12031 12032 12033 12034 12035 /** 12036 * Click based submenus. 12037 * 12038 * Used by left header layout and off canvas menu. 12039 * 12040 * @since 10.5 12041 */ 12042 function clickToggleSubmenus() { 12043 12044 if (!$('#header-outer[data-format="left-header"]').length > 0 && 12045 !$('body.material[data-slide-out-widget-area-style*="slide-out-from-right"]').length > 0 && 12046 !$('#slide-out-widget-area.fullscreen-split').length > 0 && 12047 !$('#slide-out-widget-area[data-dropdown-func="separate-dropdown-parent-link"]').length > 0) { 12048 return; 12049 } 12050 12051 // Remove megamenu class. 12052 $('#header-outer[data-format="left-header"] nav li.megamenu').removeClass('nectar-megamenu-menu-item').removeClass('megamenu'); 12053 12054 var $ocm_link_selector; 12055 12056 if ($('#slide-out-widget-area[data-dropdown-func="separate-dropdown-parent-link"]').length > 0) { 12057 $ocm_link_selector = '#slide-out-widget-area .off-canvas-menu-container li.menu-item-has-children > .ocm-dropdown-arrow'; 12058 } else { 12059 $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'; 12060 } 12061 12062 var left_header_selector = '#header-outer[data-format="left-header"] nav li.menu-item-has-children > a'; 12063 var lh_dropdown_func = ( window.nectarOptions && window.nectarOptions.left_header_dropdown_func ) ? window.nectarOptions.left_header_dropdown_func : 'default'; 12064 if( lh_dropdown_func === 'separate-dropdown-parent-link' ) { 12065 left_header_selector = '#header-outer[data-format="left-header"] nav li.menu-item-has-children > a .sf-sub-indicator'; 12066 } 12067 12068 // Click event. 12069 $(left_header_selector + ', ' + $ocm_link_selector).on('click', function () { 12070 12071 var $parentSelector = $(this).parent(); 12072 if( lh_dropdown_func === 'separate-dropdown-parent-link' ) { 12073 $parentSelector = $(this).closest('.menu-item'); 12074 } 12075 12076 if ($parentSelector.hasClass('open-submenu')) { 12077 $parentSelector.find('.sub-menu').css({ 12078 'max-height': '0' 12079 });
12080 $parentSelector.removeClass('open-submenu'); 12081 } else { 12082 12083 // Get max height. 12084 var $that = $(this); 12085 var $maxSubMenuHeight; 12086 12087 $parentSelector 12088 .find('> .sub-menu') 12089 .addClass('no-trans'); 12090 12091 setTimeout(function () { 12092 12093 $parentSelector.find('> .sub-menu').css({ 12094 'max-height': 'none', 12095 'position': 'absolute', 12096 'visibility': 'hidden' 12097 }); 12098 12099 $maxSubMenuHeight = $parentSelector.find('> .sub-menu').height(); 12100 12101 $parentSelector 12102 .find('> .sub-menu') 12103 .removeClass('no-trans'); 12104 12105 $parentSelector.find('> .sub-menu').css({ 12106 'max-height': '0', 12107 'position': 'relative', 12108 'visibility': 'visible' 12109 }); 12110 12111 }, 25); 12112 12113 setTimeout(function () { 12114 12115 // Reset Max Height. 12116 $that.closest('ul') 12117 .find('li.menu-item-has-children') 12118 .removeClass('open-submenu'); 12119 12120 $that.closest('ul').find('li.menu-item-has-children > .sub-menu').css({ 12121 'max-height': '0' 12122 });
12123 12124 $parentSelector.addClass('open-submenu'); 12125 12126 $parentSelector 12127 .find('> .sub-menu') 12128 .css('max-height', $maxSubMenuHeight); 12129 12130 // Add height to open parents. 12131 if ($that.parents('ul').length > 0) { 12132 12133 $that.parents('ul:not(.sf-menu)').each(function () { 12134 $(this).css('max-height'); 12135 $(this).css('max-height', parseInt($(this).height() + parseInt($(this).css('padding-top')) * 2 + $maxSubMenuHeight) + 'px'); 12136 }); 12137 } 12138 12139 12140 }, 50); 12141 } 12142 12143 return false; 12144 12145 }); 12146 12147 // Start open for current page items. 12148 if($('#header-outer[data-format="left-header"] nav .sf-menu > .current-menu-ancestor.menu-item-has-children > ul > li.current-menu-item').length > 0) { 12149 12150 if( lh_dropdown_func === 'separate-dropdown-parent-link' ) { 12151 $('#header-outer[data-format="left-header"] nav .sf-menu > .current-menu-ancestor.menu-item-has-children > a .sf-sub-indicator').trigger('click'); 12152 } else { 12153 $('#header-outer[data-format="left-header"] nav .sf-menu > .current-menu-ancestor.menu-item-has-children > a').trigger('click'); 12154 } 12155 12156 } 12157 12158 12159 } 12160 12161 12162 12163 12164 12165 12166 12167 12168 /** 12169 * DLMenu - plugin used for submenus in off canvas menu. 12170 * 12171 * @since 6.0 12172 */ 12173 $.DLMenu = function (options, element) { 12174 this.$el = $(element); 12175 this._init(options); 12176 }; 12177 12178 // the options 12179 $.DLMenu.defaults = { 12180 // classes for the animation effects 12181 animationClasses: { 12182 classin: 'dl-animate-in-1', 12183 classout: 'dl-animate-out-1' 12184 }, 12185 onLevelClick: function () { 12186 return false; 12187 }, 12188 onLinkClick: function () { 12189 return false; 12190 } 12191 }; 12192 12193 $.DLMenu.prototype = { 12194 _init: function (options) { 12195 12196 // options 12197 this.options = $.extend(true, {}, $.DLMenu.defaults, options); 12198 this._config(); 12199 12200 var animEndEventNames = { 12201 'WebkitAnimation': 'webkitAnimationEnd', 12202 'OAnimation': 'oAnimationEnd', 12203 'msAnimation': 'MSAnimationEnd', 12204 'animation': 'animationend' 12205 }, 12206 transEndEventNames = { 12207 'WebkitTransition': 'webkitTransitionEnd', 12208 'MozTransition': 'transitionend', 12209 'OTransition': 'oTransitionEnd', 12210 'msTransition': 'MSTransitionEnd', 12211 'transition': 'transitionend' 12212 }; 12213 // animation end event name 12214 this.animEndEventName = animEndEventNames['animation'] + '.menu'; 12215 // transition end event name 12216 this.transEndEventName = transEndEventNames['transition'] + '.menu', 12217 // support for css animations and css transitions 12218 this.supportAnimations = true, 12219 this.supportTransitions = true; 12220 this._initEvents(); 12221 12222 }, 12223 _config: function () { 12224 this.open = false; 12225 this.$trigger = this.$el.children('.trigger'); 12226 this.$menu = this.$el.children('ul.menu'); 12227 this.$menuitems = this.$menu.find('li:not(.back) > a'); 12228 12229 this.$el.find('ul.sub-menu') 12230 .prepend('<li class="back"><a href="#"> ' + $offCanvasEl.attr('data-back-txt') + ' </a></li>'); 12231 12232 this.$back = this.$menu.find('li.back'); 12233 }, 12234 _initEvents: function () { 12235 12236 var self = this; 12237 12238 this.$trigger.on('click.menu', function () { 12239 12240 if (self.open) { 12241 self._closeMenu(); 12242 } else { 12243 self._openMenu(); 12244 } 12245 return false; 12246 12247 }); 12248 12249 this.$menuitems.on('click.menu', function (event) { 12250 12251 12252 var $item = $(this).parent('li'), 12253 $submenu = $item.children('ul.sub-menu'); 12254 12255 $('.fullscreen-alt .off-canvas-menu-container .clip-wrap, .fullscreen-alt .off-canvas-menu-container .clip-wrap span').css('transition-duration', '0s'); 12256 12257 if ($submenu.length > 0) { 12258 12259 var $flyin = $submenu.clone().css('opacity', 0).insertAfter(self.$menu), 12260 onAnimationEndFn = function () { 12261 self.$menu.off(self.animEndEventName).removeClass(self.options.animationClasses.classout).addClass('subview'); 12262 $item.addClass('subviewopen').parents('.subviewopen:first').removeClass('subviewopen').addClass('subview'); 12263 $flyin.remove(); 12264 setTimeout(function () { 12265 $('.off-canvas-menu-container .menu > li').removeClass('no-pointer-events'); 12266 $('.off-canvas-menu-container .clip-wrap, .off-canvas-menu-container .clip-wrap span').css('transition-duration', '.45s'); 12267 }, 300); 12268 12269 }; 12270 12271 setTimeout(function () { 12272 $flyin.addClass(self.options.animationClasses.classin); 12273 self.$menu.addClass(self.options.animationClasses.classout); 12274 if (self.supportAnimations) { 12275 self.$menu.on(self.animEndEventName, onAnimationEndFn); 12276 } else { 12277 onAnimationEndFn.call(); 12278 } 12279 12280 self.options.onLevelClick($item, $item.children('a:first').text()); 12281 });
12282 12283 12284 $item.parents('.menu-wrap').css('height', $item.parents('.off-canvas-menu-container').find('.menuwrapper .menu').height()).transition({ 12285 'height': $flyin.height() 12286 }, 500, 'easeInOutQuad'); 12287 12288 setTimeout(OCM_overflowState,600); 12289 12290 return false; 12291 12292 } else { 12293 12294 self.options.onLinkClick($item.find('> a'), event); 12295 } 12296 12297 OCM_close($item); 12298 12299 }); 12300 12301 12302 12303 this.$back.on('click.menu', function () { 12304 12305 var $this = $(this), 12306 $submenu = $this.parents('ul.sub-menu:first'), 12307 $item = $submenu.parent(), 12308 $flyin = $submenu.clone().insertAfter(self.$menu); 12309 12310 var onAnimationEndFn = function () { 12311 self.$menu.off(self.animEndEventName).removeClass(self.options.animationClasses.classin); 12312 $flyin.remove(); 12313 }; 12314 12315 setTimeout(function () { 12316 $flyin.addClass(self.options.animationClasses.classout); 12317 self.$menu.addClass(self.options.animationClasses.classin); 12318 if (self.supportAnimations) { 12319 self.$menu.on(self.animEndEventName, onAnimationEndFn); 12320 } else { 12321 onAnimationEndFn.call(); 12322 } 12323 12324 $item.removeClass('subviewopen'); 12325 12326 var $subview = $this.parents('.subview:first'); 12327 if ($subview.is('li')) { 12328 $subview.addClass('subviewopen'); 12329 } 12330 $subview.removeClass('subview'); 12331 }); 12332 12333 12334 12335 setTimeout(function () { 12336 $item.parents('.menu-wrap').transition({ 12337 'height': $item.parent().height() 12338 }, 500, 'easeInOutQuad'); 12339 setTimeout(OCM_overflowState,600); 12340 }, 50); 12341 12342 12343 return false; 12344 12345 }); 12346 12347 }, 12348 closeMenu: function () { 12349 if (this.open) { 12350 this._closeMenu(); 12351 } 12352 }, 12353 _closeMenu: function () { 12354 var self = this, 12355 onTransitionEndFn = function () { 12356 self.$menu.off(self.transEndEventName); 12357 self._resetMenu(); 12358 }; 12359 12360 this.$menu.removeClass('menuopen'); 12361 this.$menu.addClass('menu-toggle'); 12362 this.$trigger.removeClass('active'); 12363 12364 if (this.supportTransitions) { 12365 this.$menu.on(this.transEndEventName, onTransitionEndFn); 12366 } else { 12367 onTransitionEndFn.call(); 12368 } 12369 12370 this.open = false; 12371 }, 12372 openMenu: function () { 12373 if (!this.open) { 12374 this._openMenu(); 12375 } 12376 }, 12377 _openMenu: function () { 12378 var self = this; 12379 $body.off('click').on('click.menu', function () { 12380 self._closeMenu(); 12381 }); 12382 this.$menu.addClass('menuopen menu-toggle').on(this.transEndEventName, function () { 12383 $(this).removeClass('menu-toggle'); 12384 }); 12385 this.$trigger.addClass('active'); 12386 this.open = true; 12387 }, 12388 _resetMenu: function () { 12389 this.$menu.removeClass('subview'); 12390 this.$menuitems.removeClass('subview subviewopen'); 12391 } 12392 }; 12393 12394 var logError = function (message) { 12395 if (window.console) { 12396 window.console.error(message); 12397 } 12398 }; 12399 12400 $.fn.dlmenu = function (options) { 12401 if (typeof options === 'string') { 12402 var args = Array.prototype.slice.call(arguments, 1); 12403 this.each(function () { 12404 var instance = $.data(this, 'menu'); 12405 if (!instance) { 12406 logError("cannot call methods on menu prior to initialization; " + 12407 "attempted to call method '" + options + "'"); 12408 return; 12409 } 12410 if (!$.isFunction(instance[options]) || options.charAt(0) === "_") { 12411 logError("no such method '" + options + "' for menu instance"); 12412 return; 12413 } 12414 instance[options].apply(instance, args); 12415 }); 12416 } else { 12417 this.each(function () { 12418 var instance = $.data(this, 'menu'); 12419 if (instance) { 12420 instance._init(); 12421 } else { 12422 instance = $.data(this, 'menu', new $.DLMenu(options, this)); 12423 } 12424 }); 12425 } 12426 return this; 12427 }; 12428 12429 12430 /** 12431 * Initialize DL menu. 12432 * 12433 * @since 6.0 12434 */ 12435 function fullscreenMenuInit() { 12436 12437 $('#slide-out-widget-area .off-canvas-menu-container .menu').wrap('<div class="menu-wrap menuwrapper" />'); 12438 $('#slide-out-widget-area .off-canvas-menu-container .menu').addClass('menuopen'); 12439 12440 var $ocmAnimationClassNum = ($('#slide-out-widget-area.fullscreen-alt').length > 0) ? '4' : '5'; 12441 $('#slide-out-widget-area .off-canvas-menu-container .menu-wrap').dlmenu({ 12442 animationClasses: { 12443 classin: 'dl-animate-in-' + $ocmAnimationClassNum, 12444 classout: 'dl-animate-out-' + $ocmAnimationClassNum 12445 } 12446 });
12447 12448 } 12449 12450 12451 12452 12453 12454 12455 12456 12457 12458 /** 12459 * Set the page header height when using "slide down" theme option effect. 12460 * 12461 * @since 2.0 12462 */ 12463 function pageHeaderSlideInHeight() { 12464 12465 var pageHeaderHeight = parseInt($pageHeaderBG.height()); 12466 $('body[data-aie="slide-down"] #page-header-wrap:not(.fullscreen-header):not([data-responsive="true"])').css('height', pageHeaderHeight + 'px'); 12467 12468 } 12469 12470 12471 /** 12472 * Fired after page header image has loaded. 12473 * 12474 * @since 2.0 12475 */ 12476 function pageHeaderAfterLoad() { 12477 12478 //fade in header 12479 if ($('#ajax-content-wrap').length == 0 || !$body.hasClass('ajax-loaded')) { 12480 $('#page-header-bg[data-parallax="1"]').animate({ 12481 'opacity': 1 12482 }, 350, 'easeInCubic'); 12483 } else if ($('#ajax-content-wrap').length == 1) { 12484 $('#page-header-bg[data-parallax="1"]').css({ 12485 'opacity': 1 12486 }); 12487 } 12488 12489 $('#page-header-bg[data-parallax="1"] .nectar-particles').append('<div class="fade-out" />'); 12490 12491 } 12492 12493 12494 12495 /** 12496 * Page header unload event. 12497 * 12498 * @since 2.0 12499 */ 12500 function pageHeaderUnload() { 12501 12502 if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1 || navigator.userAgent.match(/(iPod|iPhone|iPad)/)) { 12503 window.onunload = function () { 12504 12505 pageHeaderInit(); 12506 12507 $('#page-header-bg[data-parallax="1"] .span_6').css({ 12508 'opacity': 1 12509 }); 12510 12511 }; 12512 } 12513 12514 } 12515 12516 12517 /** 12518 * Page header initialization. 12519 * 12520 * @since 2.0 12521 */ 12522 function pageHeaderInit() { 12523 12524 var pageHeaderState = { 12525 inView: true 12526 } 12527 12528 var $pageHeaderInnerEl = $('#page-header-bg .span_6 .inner-wrap'); 12529 var $pageHeaderCanvasEl = $('#page-header-bg #canvas'); 12530 12531 if ($('#page-header-bg[data-parallax="1"]').length > 0) { 12532 12533 // Fade in 12534 var img = new Image(), 12535 pageHeaderHeight = parseInt($pageHeaderBG.height()), 12536 headerSpaceHeight = $('#header-space').height(), 12537 globalTopSectionHeight = ($('.nectar-global-section.after-nav').length > 0) ? $('.nectar-global-section.after-nav').height() : 0, 12538 $initialImgCheck = extractUrl($('#page-header-bg[data-parallax="1"]').css('background-image')); 12539 12540 if ($initialImgCheck && $initialImgCheck.indexOf('.') !== -1) { 12541 img.onload = function () { 12542 pageHeaderAfterLoad(); 12543 }; 12544 12545 img.src = extractUrl($('#page-header-bg[data-parallax="1"]').css('background-image')); 12546 12547 } else { 12548 pageHeaderAfterLoad(); 12549 } 12550 12551 12552 if ($('body[data-hhun="1"]').length > 0 && !$('#header-outer[data-remove-fixed="1"]').length > 0) { 12553 $headerOuterEl.addClass('parallax-contained'); 12554 } 12555 12556 // Calculate on scroll. 12557 if( nectarDOMInfo.winW > 1000 ) { 12558 parallaxPageHeaderCalc(); 12559 } 12560 window.addEventListener('scroll', function () { 12561 if( nectarDOMInfo.winW > 1000 ) { 12562 window.requestAnimationFrame(parallaxPageHeaderCalc); 12563 } 12564 }, false); 12565 12566 } 12567 12568 var $pt_timeout = ($('body[data-ajax-transitions="true"]').length > 0 && $('#page-header-bg[data-animate-in-effect="slide-down"]').length > 0) ? 350 : 0; 12569 12570 if ($pageHeaderBG.length > 0) { 12571 12572 // Slide in height effect. 12573 setTimeout(function () { 12574 pageHeaderSlideInHeight(); 12575 }, $pt_timeout); 12576 12577 $('#page-header-bg[data-animate-in-effect="fade-in"]').addClass('loaded'); 12578 12579 // Using bg classname. 12580 var $initialImgCheckAscend = extractUrl($pageHeaderBG.css('background-image')); 12581 if ($initialImgCheckAscend && $initialImgCheckAscend.indexOf('.') !== -1) { 12582 $pageHeaderBG.addClass('has-bg'); 12583 } 12584 12585 // Resize slide in height. 12586 $window.on('smartresize',pageHeaderSlideInHeight); 12587 12588 } 12589 12590 12591 function parallaxPageHeaderCalc() { 12592 12593 var $multiplier = 0.15; 12594 12595 if (nectarDOMInfo.winW >= 1000 && 12596 navigator.userAgent.match(/iPad/i) == null && 12597 nectarState.materialOffCanvasOpen != true ) { 12598 12599 // Calc parallax. 12600 if (pageHeaderState.inView == true) { 12601 12602 $pageHeaderInnerEl.css({ 12603 'transform': 'translateY(' + nectarDOMInfo.scrollTop * $multiplier + 'px)', 12604 'opacity': 1 - (nectarDOMInfo.scrollTop / ((globalTopSectionHeight + pageHeaderHeight)*.7)) 12605 });
12606 12607 if( $pageHeaderCanvasEl ) { 12608 $pageHeaderCanvasEl.css({ 12609 'transform': 'translateY(' + nectarDOMInfo.scrollTop * $multiplier*2 + 'px)' 12610 }); 12611 } 12612 12613 } 12614 12615 // Hide elements to allow other parallax sections to work in webkit browsers. 12616 if ((nectarDOMInfo.scrollTop / (pageHeaderHeight + headerSpaceHeight + nectarDOMInfo.adminBarHeight)) > 1) { 12617 pageHeaderState.inView = false; 12618 $('.nectar-particles, #page-header-bg .fade-out').css('visibility', 'hidden').addClass('out-of-sight'); 12619 $('#page-header-bg').addClass('out-of-sight'); 12620 } 12621 else { 12622 pageHeaderState.inView = true; 12623 $('#page-header-bg, .nectar-particles, #page-header-bg .fade-out').css('visibility', 'visible').removeClass('out-of-sight'); 12624 } 12625 12626 } 12627 12628 } 12629 12630 if ($pageHeaderBG.length > 0) { 12631 12632 // Bind unload event 12633 pageHeaderUnload(); 12634 12635 // Initialize text effects. 12636 if( $('.nectar-box-roll').length == 0 ) { 12637 pageHeaderTextEffectInit(); 12638 } 12639 12640 } 12641 12642 } 12643 12644 12645 12646 12647 12648 12649 12650 /** 12651 * Page header text effect markup creation. 12652 * 12653 * @since 6.0 12654 */ 12655 function pageHeaderTextEffectMarkup() { 12656 12657 $pageHeaderBG.each(function () { 12658 12659 if ($(this).attr('data-text-effect') == 'rotate_in') { 12660 12661 var $topHeading = 'none'; 12662 12663 if ($(this).find('.span_6 h1').length > 0) { 12664 $topHeading = 'h1'; 12665 } 12666 12667 if ($topHeading != 'none') { 12668 12669 var $selector = ($(this).find('.nectar-particles').length > 0) ? '.inner-wrap.shape-1' : '.span_6'; 12670 12671 $(this).find($selector).find($topHeading).addClass('top-heading').contents().filter(function () { 12672 return this.nodeType === 3 && typeof this.data != 'undefined' && this.data.replace(/\s+/, ""); 12673 }).wrap('<span class="wraped"></span>'); 12674 12675 $(this).find($selector).find('.wraped').each(function () { 12676 12677 var textNode = $(this), 12678 text = textNode.text().split(' '), 12679 replace = ''; 12680 12681 $.each(text, function (index, value) { 12682 if (value.replace(/\s+/, "")) { 12683 replace += '<span class="wraped"><span>' + value + '</span></span> '; 12684 } 12685 }); 12686 12687 textNode.replaceWith($(replace)); 12688 12689 });
12690 12691 } 12692 12693 } 12694 12695 }); 12696 12697 } 12698 12699 12700 /** 12701 * Page header text effect animation. 12702 * 12703 * @since 6.0 12704 */ 12705 function pageHeaderTextEffect() { 12706 12707 if ($('#page-header-bg .nectar-particles').length == 0 && $('#page-header-bg[data-text-effect="none"]').length == 0 || 12708 $('.nectar-box-roll').length > 0 && $('#page-header-bg .nectar-particles').length == 0) { 12709 12710 var $selector = ($('.nectar-box-roll').length == 0) ? '#page-header-bg .span_6' : '.nectar-box-roll .overlaid-content .span_6'; 12711 12712 $($selector).find('.wraped').each(function (i) { 12713 $(this).find('span').delay(i * 370).transition({ 12714 rotateX: '0', 12715 'opacity': 1, 12716 y: 0 12717 }, 400, 'easeOutQuad'); 12718 }); 12719 12720 setTimeout(function () { 12721 12722 $($selector).find('.inner-wrap > *:not(.top-heading)').each(function (i) { 12723 $(this).delay(i * 370).transition({ 12724 rotateX: '0', 12725 'opacity': 1, 12726 y: 0 12727 }, 650, 'easeOutQuad'); 12728 }); 12729 12730 $('.scroll-down-wrap, .scroll-down-wrap .section-down-arrow').removeClass('hidden'); 12731 12732 }, $($selector).find('.wraped').length * 370); 12733 } 12734 12735 } 12736 12737 12738 /** 12739 * Page header text effect initialization. 12740 * 12741 * @since 6.0 12742 */ 12743 function pageHeaderTextEffectInit() { 12744 12745 pageHeaderTextEffectMarkup(); 12746 12747 var $effectTimeout = ($loadingScreenEl.length > 0) ? 800 : 0; 12748 12749 if ($('#page-header-bg .nectar-video-wrap video').length == 0) { 12750 setTimeout(pageHeaderTextEffect, $effectTimeout); 12751 } 12752 12753 } 12754 12755 12756 12757 12758 12759 12760 12761 /** 12762 * Permanent transparent header effect. 12763 * 12764 * @since 6.0 12765 */ 12766 function midnightInit() { 12767 12768 if ($('#header-outer[data-permanent-transparent="1"]').length > 0 && 12769 $('body[data-bg-header="true"]').length > 0) { 12770 12771 12772 // Pages that set no midnight coloring. 12773 if ($('.container-wrap div[data-midnight]').length == 0) { 12774 $('.container-wrap').attr('data-midnight', 'dark'); 12775 } 12776 12777 //// Cache midnight compat divs. 12778 var $midnightCompatArr = []; 12779 $('div[data-midnight]').each(function () { 12780 12781 if ($(this).attr('data-midnight') == 'light' && $(this).parents('.pum-content').length == 0 || 12782 $(this).attr('data-midnight') == 'dark' && $(this).parents('.pum-content').length == 0) { 12783 12784 if( $(this).is('#page-header-bg') && $(this).parents('#page-header-wrap[data-midnight]').length > 0 ) { 12785 // skip. 12786 } else { 12787 $midnightCompatArr.push($(this)); 12788 } 12789 12790 } 12791 12792 }); 12793 12794 12795 if ($midnightCompatArr.length > 0) { 12796 12797 $.each($midnightCompatArr, function (k, v) { 12798 12799 if (v.attr('data-midnight') == 'light' || v.attr('data-midnight') == 'dark') { 12800 12801 var $that = v; 12802 var waypoint = new Waypoint({ 12803 element: $that, 12804 handler: function (direction) { 12805 12806 12807 if ($('body.material-ocm-open').length > 0 || $that.css('display') == 'none' ) { 12808 return; 12809 } 12810 12811 12812 var $textColor; 12813 12814 if (direction == 'down') { 12815 $textColor = ($that.attr('data-midnight') == 'light') ? '' : 'dark-slide'; 12816 $headerOuterEl.removeClass('dark-slide').addClass($textColor); 12817 12818 } else { 12819 12820 var $prevMidItem; 12821 12822 if (k - 1 >= 0) { 12823 $prevMidItem = k - 1; 12824 } else { 12825 $prevMidItem = k; 12826 } 12827 12828 $textColor = ($midnightCompatArr[$prevMidItem].attr('data-midnight') == 'light') ? '' : 'dark-slide'; 12829 $headerOuterEl.removeClass('dark-slide').addClass($textColor); 12830 12831 } 12832 12833 }, 12834 offset: $headerOuterEl.height() 12835 12836 }); 12837 12838 } 12839 12840 }); 12841 12842 } 12843 12844 } 12845 12846 12847 } 12848 12849 12850 12851 12852 /** 12853 * Box roll header effect initialization. 12854 * 12855 * @since 6.0 12856 */ 12857 function nectarBoxRollInit() { 12858 if ($('.nectar-box-roll').length > 0 && typeof NectarBoxRoll !== 'undefined') { 12859 12860 pageHeaderTextEffectInit(); 12861 12862 // listen for emits. 12863 $(window).on('nectar-box-roll-scroll-disabled', function() { 12864 nectarState.preventScroll = true; 12865 });
12866 $(window).on('nectar-box-roll-scroll-enabled', function() { 12867 nectarState.preventScroll = false; 12868 }); 12869 12870 nectarBoxRoll = new NectarBoxRoll(nectarDOMInfo, waypoints, midnightInit, pageLoadHash, resizeVideoToCover); 12871 12872 } 12873 } 12874 12875 12876 12877 12878 /** 12879 * Create all waypoints. 12880 * 12881 * @since 6.0 12882 */ 12883 function waypoints() { 12884 rowBGAnimations(); 12885 columnBGAnimations(); 12886 colAndImgAnimations(); 12887 progressBars(); 12888 dividers(); 12889 iconList(); 12890 animatedTitles(); 12891 highlightedText(); 12892 imageWithHotspots(); 12893 clientsFadeIn(); 12894 splitLineHeadings(); 12895 svgAnimations(); 12896 milestoneInit(); 12897 nectarFancyUlInit(); 12898 owl_carousel_animate(); 12899 headerRowColorInheritInit(); 12900 morphingOutlines(); 12901 animatedColBorders(); 12902 wooProductCarouselAnimations(); 12903 foodMenuItems(); 12904 vcWaypoints(); 12905 NectarPostGridWaypoint(); 12906 nectarRotatingWordsInit(); 12907 } 12908 12909 12910 12911 /** 12912 * Salient page builder elements initialization. 12913 * 12914 * @since 10.5 12915 */ 12916 function salientPageBuilderElInit() { 12917 flexsliderInit(); 12918 flickityLazyInit(); 12919 setTimeout(flickityInit, 100); 12920 twentytwentyInit(); 12921 standardCarouselInit(); 12922 productCarouselInit(); 12923 clientsCarouselInit(); 12924 carouselfGrabbingClass(); 12925 setTimeout(tabbedInit, 60); 12926 accordionInit(); 12927 accordionClickEvents(); 12928 largeIconHover(); 12929 nectarIconMatchColoring(); 12930 coloredButtons(); 12931 ctaLinkBG(); 12932 teamMemberFullscreen(); 12933 flipBoxInit(); 12934 owlCarouselInit(); 12935 mouseParallaxInit(); 12936 ulCheckmarks(); 12937 nectarFancyUlIcons(); 12938 nectarFancyBoxHover(); 12939 nectarVideoLightbox(); 12940 nectarKeyframeAssist(); 12941 morphingOutlinesInit(); 12942 nectarPostGridInit(); 12943 cascadingImageInit(); 12944 imageWithHotspotEvents(); 12945 pricingTableHeight(); 12946 pageSubmenuInit(); 12947 nectarLiquidBGs(); 12948 nectarTestimonialSliders(); 12949 nectarTestimonialSlidersEvents(); 12950 recentPostsTitleOnlyEqualHeight(); 12951 recentPostsInit(); 12952 parallaxItemHoverEffect(); 12953 fsProjectSliderInit(); 12954 postMouseEvents(); 12955 masonryPortfolioInit(); 12956 masonryBlogInit(); 12957 portfolioCustomColoring(); 12958 searchResultMasonryInit(); 12959 stickySidebarInit(); 12960 portfolioSidebarFollow(); 12961 splitLineHeadingInit(); 12962 var stickyEls = new NectarStickyEls(); 12963 } 12964 12965 12966 12967 12968 /***************** WooCommerce *****************/ 12969 12970 /** 12971 * Woo filter toggle 12972 * 12973 * @since 13.0 12974 */ 12975 function NectarWooCommerceFilters() { 12976 12977 this.$toggleBtn = $('.nectar-shop-filters .nectar-shop-filter-trigger'); 12978 this.$sidebar = $('#sidebar'); 12979 this.sidebarPos = (this.$sidebar.hasClass('col_last')) ? 'right' : 'left'; 12980 12981 this.state = { 12982 open: (this.getLS()) ? this.getLS() : 'true' 12983 }; 12984 12985 this.setup(); 12986 this.events(); 12987 } 12988 12989 NectarWooCommerceFilters.prototype.events = function() { 12990 12991 this.$toggleBtn.on('click', this.toggle.bind(this)); 12992 this.$sidebar.find('.nectar-close-btn-wrap').on('click', this.mobileToggle.bind(this)); 12993 $(window).on('smartresize', this.mobileToggleResize.bind(this)); 12994 12995 }; 12996 12997 NectarWooCommerceFilters.prototype.mobileToggleResize = function() { 12998 12999 if( this.$sidebar.hasClass('open') && nectarDOMInfo.winW > 999 ) { 13000 this.$sidebar.removeClass('open'); 13001 this.$sidebar.find('.nectar-close-btn-wrap').removeClass('open'); 13002 $('.container-wrap').css('z-index','11'); 13003 } 13004 13005 }; 13006 13007 NectarWooCommerceFilters.prototype.mobileToggle = function() { 13008 13009 if( this.$sidebar.hasClass('open') ) { 13010 this.$sidebar.removeClass('open'); 13011 this.$sidebar.find('.nectar-close-btn-wrap').removeClass('open'); 13012 $('.container-wrap').css('z-index','11'); 13013 } else { 13014 $('.container-wrap').css('z-index','10000'); 13015 this.$sidebar.addClass('open'); 13016 this.$sidebar.find('.nectar-close-btn-wrap').addClass('open'); 13017 } 13018 13019 return false; 13020 13021 }; 13022 13023 NectarWooCommerceFilters.prototype.toggle = function() { 13024 13025 // Mobile. 13026 if( nectarDOMInfo.winW < 1000 ) { 13027 this.mobileToggle(); 13028 return false; 13029 } 13030 13031 var visibility = ''; 13032 13033 // Close.
13034 if( this.state.open == 'true' ) { 13035 13036 // Handle state. 13037 this.state.open = 'false'; 13038 visibility = 'false'; 13039 13040 // Layout change. 13041 this.$toggleBtn.find('.hide').hide(); 13042 this.$toggleBtn.find('.show').show(); 13043 13044 this.$toggleBtn.find('.top-line, .bottom-line').css({ 13045 'transform': 'translateX(0)' 13046 }); 13047 13048 if( this.sidebarPos == 'left' ) { 13049 this.$sidebar.css({ 13050 'margin-right' : '-25%', 13051 'opacity': '0' 13052 }); 13053 } else { 13054 this.$sidebar.css({ 13055 'margin-left': '-25%', 13056 'opacity': '0' 13057 }); 13058 } 13059 13060 this.$sidebar.find('> .inner').css({ 13061 'transform': (this.sidebarPos == 'left') ? 'translateX(-100%)' : 'translateX(100%)', 13062 }); 13063 13064 } 13065 // Open. 13066 else { 13067 13068 // Handle state. 13069 this.state.open = 'true'; 13070 visibility = 'true'; 13071 13072 // Layout change. 13073 this.$toggleBtn.find('.show').hide(); 13074 this.$toggleBtn.find('.hide').show(); 13075 13076 this.$toggleBtn.find('.top-line').css({ 13077 'transform': 'translateX(10px)' 13078 }); 13079 this.$toggleBtn.find('.bottom-line').css({ 13080 'transform': 'translateX(-10px)' 13081 }); 13082 13083 if( this.sidebarPos == 'left' ) { 13084 this.$sidebar.css({ 13085 'margin-right' : '0', 13086 'opacity': '1' 13087 }); 13088 } else { 13089 this.$sidebar.css({ 13090 'margin-left' : '0', 13091 'opacity': '1' 13092 }); 13093 } 13094 13095 this.$sidebar.find('> .inner').css({ 13096 'transform': 'translateX(0)' 13097 }); 13098 13099 } 13100 13101 // Trigger event. 13102 setTimeout(function(){ 13103 $(window).trigger('nectar-product-filters-layout'); 13104 },425); 13105 13106 13107 // Store in LS. 13108 if( typeof(Storage) !== "undefined" ) { 13109 localStorage.setItem("nectar_product_filters_vis", visibility); 13110 } 13111 13112 return false; 13113 13114 }; 13115 13116 NectarWooCommerceFilters.prototype.setup = function() { 13117 13118 // Start filters expanded on mobile. 13119 this.$sidebar.find('.widget.woocommerce') 13120 .addClass('open-filter') 13121 .find('ul') 13122 .css({ 13123 'display':'block' 13124 }); 13125 13126 // Mobile active filters. 13127 if( $('.nectar-active-product-filters').length > 0 ) { 13128 var $filtersHTML = $('.nectar-active-product-filters').clone(); 13129 this.$sidebar.find('> .inner').prepend($filtersHTML); 13130 } 13131 13132 }; 13133 13134 NectarWooCommerceFilters.prototype.getLS = function() { 13135 13136 if( typeof(Storage) !== "undefined" ) { 13137 return localStorage.getItem("nectar_product_filters_vis"); 13138 } 13139 13140 return null; 13141 13142 }; 13143 13144 13145 13146 13147 /** 13148 * Handle Woo quantity button functionality 13149 * 13150 * @since 13.0 13151 */ 13152 function wooQauntityBtns() { 13153 var quantityButtons = new NectarWooCommerceQuantity(); 13154 } 13155 13156 function NectarWooCommerceQuantity() { 13157 13158 this.$qty = ''; 13159 this.step = 1; 13160 this.ajaxTimeout = ''; 13161 this.ajaxTimeoutDur = 500; 13162 13163 this.state = { 13164 max: 100000, 13165 min: 0, 13166 currentVal: 1, 13167 key: 0, 13168 removeFlag: false 13169 }; 13170 13171 this.events(); 13172 13173 } 13174 13175 NectarWooCommerceQuantity.prototype.updateState = function(el) { 13176 13177 // Get key. 13178 var key = 0; 13179 13180 if( true === this.checkMiniCart(this.$qty) ) { 13181 var matches = this.$qty.attr('name').match(/cart\[(\w+)\]/); 13182 key = matches[1]; 13183 } 13184 13185 // Store current. 13186 var currentVal = parseFloat(this.$qty.val()); 13187 13188 if (!currentVal || currentVal === '' || currentVal === 'NaN') { 13189 currentVal = 0; 13190 } 13191 13192 // Max/Min vals. 13193 var max = parseFloat(this.$qty.attr('max')); 13194 var min = parseFloat(this.$qty.attr('min')); 13195 13196 if (max === '' || max === 'NaN' || isNaN(max) ) { 13197 max = ''; 13198 } 13199 13200 if (min === '' || min === 'NaN' || isNaN(min) ) { 13201 min = 0; 13202 } 13203 13204 // Push to state. 13205 this.state = { 13206 currentVal: currentVal, 13207 max: max, 13208 min: min, 13209 key: key 13210 }; 13211 13212 }; 13213 13214 NectarWooCommerceQuantity.prototype.events = function() { 13215 13216 var that = this; 13217 13218 $('body').on('click', '.quantity .plus', function() { 13219 that.$qty = $(this).closest('.quantity').find('.qty'); 13220 that.setStep(); 13221 that.updateState(); 13222 that.increment($(this)); 13223 });
13224 13225 $('body').on('click', '.quantity .minus', function() { 13226 that.$qty = $(this).closest('.quantity').find('.qty'); 13227 that.setStep(); 13228 that.updateState(); 13229 that.decrement($(this)); 13230 }); 13231 13232 $('body').on('keyup', '.woocommerce-mini-cart .quantity .qty', function(e) { 13233 that.$qty = $(this); 13234 13235 that.updateState(); 13236 13237 // Max value. 13238 if( that.state.max && that.$qty.val() > that.state.max ) { 13239 that.$qty.val(that.state.max); 13240 } 13241 13242 // Check if item should be removed. 13243 if (that.state.min && (that.state.min == that.state.currentVal || that.state.currentVal < that.state.min)) { 13244 that.state.removeFlag = true; 13245 } 13246 13247 $(this).trigger('change'); 13248 13249 }); 13250 13251 $('body').on('change', '.woocommerce-mini-cart .quantity .qty', function(e) { 13252 13253 if( !e.originalEvent && true === that.checkMiniCart(that.$qty) ) { 13254 that.updateCart(that.$qty.val()); 13255 } 13256 13257 }); 13258 13259 }; 13260 13261 NectarWooCommerceQuantity.prototype.setStep = function() { 13262 if( this.$qty.is('[step]') ) { 13263 var step = parseInt(this.$qty.attr('step')); 13264 13265 if( !isNaN(step) && step != '' && step != 0) { 13266 this.step = step; 13267 } 13268 13269 } 13270 } 13271 13272 NectarWooCommerceQuantity.prototype.increment = function() { 13273 13274 if (this.state.max && (this.state.max == this.state.currentVal || this.state.currentVal > this.state.max)) { 13275 this.$qty.val(this.state.max); 13276 } else { 13277 this.$qty.val(this.state.currentVal + parseFloat(this.step)); 13278 } 13279 13280 this.$qty.trigger('change'); 13281 13282 }; 13283 13284 NectarWooCommerceQuantity.prototype.decrement = function() { 13285 13286 if (this.state.min && (this.state.min == this.state.currentVal || this.state.currentVal < this.state.min)) { 13287 this.$qty.val(0); 13288 this.state.removeFlag = true; 13289 13290 } else if (this.state.currentVal > 0) { 13291 this.$qty.val(this.state.currentVal - parseFloat(this.step)); 13292 } 13293 13294 this.$qty.trigger('change'); 13295 13296 }; 13297 13298 NectarWooCommerceQuantity.prototype.checkMiniCart = function(el) { 13299 return ( el.parents('.woocommerce-mini-cart').length > 0 ) ? true : false; 13300 }; 13301 13302 NectarWooCommerceQuantity.prototype.updateCart = function(val) { 13303 13304 var that = this; 13305 13306 // Debounce a little to prevent too many requests when clicking a lot 13307 clearTimeout(this.ajaxTimeout); 13308 13309 this.ajaxTimeout = setTimeout(function() { 13310 13311 that.$qty.closest( '.widget_shopping_cart_content' ).addClass('loading'); 13312 that.$qty.closest( '.woocommerce-mini-cart-item' ).addClass('blockUI').addClass('blockOverlay'); 13313 13314 $.ajax({
13315 type: 'POST', 13316 url: window.nectarLove.ajaxurl, 13317 data: { 13318 action: "nectar_minicart_update_quantity", 13319 quantity: val, 13320 item_key: that.state.key 13321 }, 13322 cache: false, 13323 success: function (response) { 13324 if( response ) { 13325 13326 that.$qty.closest( '.widget_shopping_cart_content' ).removeClass('loading'); 13327 that.$qty.closest( '.woocommerce-mini-cart-item' ).removeClass('blockUI').removeClass('blockOverlay'); 13328 13329 // Update subtotal. 13330 var $subtotal = that.$qty.closest( '.widget_shopping_cart_content' ).find('.woocommerce-mini-cart__total'); 13331 $subtotal.find('.woocommerce-Price-amount').remove(); 13332 $subtotal.append(response.subtotal); 13333 13334 // Does the item need to be removed? 13335 if( that.state.removeFlag === true ) { 13336 that.$qty.closest( '.woocommerce-mini-cart-item' ).remove(); 13337 that.state.removeFlag = false; 13338 $( document.body ).trigger( 'updated_wc_div' ); 13339 } 13340 13341 // Update cart count. 13342 if( $('#header-outer a.cart-contents .cart-wrap span').length > 0 ) { 13343 $('#header-outer a.cart-contents .cart-wrap span').text(response.item_count); 13344 } 13345 13346 } 13347 13348 13349 } 13350 13351 }); 13352 13353 }, this.ajaxTimeoutDur); 13354 13355 }; 13356 13357 13358 /** 13359 * WooCommerce Single Product AJAX Add to Cart. 13360 * 13361 * @since 13.0 13362 */ 13363 function NectarWooCommerceCartAJAX() { 13364 13365 this.state = { 13366 processing: false, 13367 productID: false, 13368 type: 'regular' 13369 }; 13370 13371 this.events(); 13372 } 13373 13374 NectarWooCommerceCartAJAX.prototype.events = function() { 13375 $('body').on('submit', 'form.cart', this.addToCartAJAX.bind(this)); 13376 }; 13377 13378 NectarWooCommerceCartAJAX.prototype.addNotices = function(notices) { 13379 13380 var that = this; 13381 13382 var $noticeParent = $('.nectar-slide-in-cart.style_slide_in_click .widget_shopping_cart_content') 13383 13384 $.each(notices, function(k,item) { 13385 $noticeParent.prepend('<div class="nectar-notice">'+item.notice+'</div>'); 13386 }); 13387 13388 // Remove. 13389 setTimeout(function(){ 13390 $noticeParent.find('.nectar-notice').slideUp(function(){ 13391 $(this).remove(); 13392 }); 13393 },6000); 13394 13395 }; 13396 13397 NectarWooCommerceCartAJAX.prototype.addToCartAJAX = function(e) { 13398 13399 var that = this; 13400 13401 var $wooForm = $(e.currentTarget); 13402 13403 // External or redirect active. 13404 if( $wooForm.closest('.product').hasClass('product-type-external') || (wc_add_to_cart_params && wc_add_to_cart_params.cart_redirect_after_add === 'yes') ) { 13405 return; 13406 } 13407 13408 e.preventDefault(); 13409 13410 // If already submitted 13411 if( that.state.processing == true ) { 13412 return; 13413 } 13414 13415 that.state.processing = true; 13416 that.state.productID = false; 13417 13418 // Store type 13419 that.state.type = 'regular'; 13420 if( $wooForm.parents('.nectar-quick-view-box').length > 0 ) { 13421 that.state.type = 'quickview'; 13422 } 13423 13424 // Gather info to pass. 13425 var $parentProduct = $wooForm.closest('.product'); 13426 var $addToCartBtn = $wooForm.find('button.single_add_to_cart_button'); 13427 var $formData = $wooForm.serializeArray(); 13428 var regID = 0; 13429 13430 // Try and get ID from parent. 13431 if( $parentProduct.is('[id*="product-"]') ) { 13432 regID = $parentProduct.attr('id').match(/\d+/); 13433 13434 if(regID && regID[0]) { 13435 that.state.productID = regID[0]; 13436 } 13437 } 13438 // Fallback to ID from submit. 13439 if( that.state.productID === false && $addToCartBtn.length > 0 ) { 13440 regID = $addToCartBtn.val().match(/\d+/); 13441 13442 if(regID && regID[0]) { 13443 that.state.productID = regID[0]; 13444 } 13445 } 13446 13447 // No ID found, bail out. 13448 if( that.state.productID === false ) { 13449 console.log('Error: no product ID found.'); 13450 return; 13451 } 13452 13453 // Add Loading. 13454 if( that.state.type === 'quickview' ) { 13455 $addToCartBtn = $('.single_add_to_cart_button_wrap .single_add_to_cart_button'); 13456 } 13457 13458 $addToCartBtn.prepend('<div class="loading-wrap"><div class="loading" /></div></div>'); 13459 setTimeout(function(){ 13460 $addToCartBtn.addClass('processing'); 13461 },50); 13462 13463 // Must be formatted like this to use add-to-cart key for WooCommerce to trigger AJAX. 13464 $formData.push({ 13465 name: 'action', 13466 value: 'nectar_ajax_add_to_cart' 13467 }, { 13468 name: 'add-to-cart', 13469 value: that.state.productID 13470 });
13471 13472 $.ajax({ 13473 type: 'POST', 13474 url: window.nectarLove.ajaxurl, 13475 data: $formData, 13476 cache: false, 13477 success: function (response) { 13478 13479 setTimeout(function(){ 13480 that.state.processing = false; 13481 $addToCartBtn.removeClass('processing'); 13482 $addToCartBtn.find('.loading-wrap').remove(); 13483 }, 300); 13484 13485 if( response && response.fragments ) { 13486 13487 // Update content. 13488 $('body').trigger( 'added_to_cart', [response.fragments, response.cart_hash] ); 13489 13490 // Check for/Output errors. 13491 if( response.notices && response.notices.length > 0 ) { 13492 setTimeout(function(){ 13493 that.addNotices(response.notices); 13494 },100); 13495 } 13496 13497 // Close quickview. 13498 if( that.state.type === 'quickview' ) { 13499 $('.nectar-quick-view-box .close').trigger('click'); 13500 } 13501 13502 } 13503 13504 } // end success. 13505 13506 }); // end ajax. 13507 13508 }; 13509 13510 13511 /** 13512 * WooCommerce events. 13513 * 13514 * @since 10.5 13515 */ 13516 function wooCommerceEvents() { 13517 13518 var wooCartTimeout; 13519 13520 // Notification. 13521 $body.on('click', '.product .add_to_cart_button', function () { 13522 13523 var $productHeading = ($(this).parents('li').find('h2').length > 0) ? 'h2' : 'h3', 13524 productToAdd = $(this).parents('li').find($productHeading).text(); 13525 13526 $('#header-outer .cart-notification span.item-name').html(productToAdd); 13527 13528 }); 13529 13530 // Notification hover. 13531 $body.on('mouseenter', '#header-outer .cart-notification', function () { 13532 13533 $(this).hide(); 13534 13535 $('#header-outer .widget_shopping_cart') 13536 .addClass('open') 13537 .stop(true, true) 13538 .show(); 13539 13540 $('#header-outer .cart_list') 13541 .stop(true, true) 13542 .show(); 13543 13544 clearTimeout(wooCartTimeout); 13545 13546 }); 13547 13548 13549 // Cart dropdown. 13550 var $headerCartSelector = '#header-outer .nectar-woo-cart'; 13551 13552 if ($($headerCartSelector).length > 0) { 13553 13554 $($headerCartSelector).hoverIntent(function () { 13555 13556 $('#header-outer .widget_shopping_cart') 13557 .addClass('open') 13558 .stop(true, true) 13559 .show(); 13560 13561 $('#header-outer .cart_list') 13562 .stop(true, true) 13563 .show(); 13564 13565 clearTimeout(wooCartTimeout); 13566 13567 $('#header-outer .cart-notification').hide(); 13568 13569 }); 13570 } 13571 13572 13573 $body.on('mouseleave', $headerCartSelector, function () { 13574 var $that = $(this); 13575 setTimeout(function () { 13576 if (!$that.is(':hover')) { 13577 $('#header-outer .widget_shopping_cart') 13578 .removeClass('open') 13579 .stop(true, true) 13580 .fadeOut(300); 13581 13582 $('#header-outer .cart_list') 13583 .stop(true, true) 13584 .fadeOut(300); 13585 } 13586 }, 200); 13587 }); 13588 13589 if ($('#header-outer[data-cart="false"]').length == 0) { 13590 13591 $body.on('added_to_cart', shopping_cart_dropdown_show); 13592 $body.on('added_to_cart', shopping_cart_dropdown); 13593 13594 } 13595 13596 function shopping_cart_dropdown() { 13597 13598 if (!$('.widget_shopping_cart .widget_shopping_cart_content .cart_list .empty').length && 13599 $('.widget_shopping_cart .widget_shopping_cart_content .cart_list').length > 0) { 13600 13601 $('.cart-menu-wrap').addClass('has_products'); 13602 $('header#top nav > ul, #search-outer #search #close a, header#top .span_9 >.slide-out-widget-area-toggle').addClass('product_added'); 13603 13604 if (!$('.cart-menu-wrap').hasClass('static')) { 13605 $('.cart-menu-wrap, #mobile-cart-link').addClass('first-load'); 13606 } 13607 13608 13609 } 13610 13611 } 13612 13613 13614 function shopping_cart_dropdown_show(e) { 13615 13616 clearTimeout(wooCartTimeout); 13617 13618 if (!$('.widget_shopping_cart .widget_shopping_cart_content .cart_list .empty').length && 13619 $('.widget_shopping_cart .widget_shopping_cart_content .cart_list').length > 0 && 13620 typeof e.type != 'undefined') { 13621 13622 // Standalone woocommerce add to cart buttons. 13623 if ($('#header-outer .cart-notification .item-name').length > 0 && 13624 $('#header-outer .cart-notification .item-name').text().length == 0) { 13625 return; 13626 } 13627 13628 // Before cart has slide in. 13629 if (!$('#header-outer .cart-menu-wrap').hasClass('has_products')) { 13630 13631 setTimeout(function () { 13632 $('#header-outer .cart-notification').fadeIn(400); 13633 }, 400); 13634 13635 } else if (!$('#header-outer .cart-notification').is(':visible')) { 13636 $('#header-outer .cart-notification').fadeIn(400); 13637 } else { 13638 $('#header-outer .cart-notification').show(); 13639 } 13640 13641 $('body #header-outer [data-cart-style="slide_in_click"] .cart-menu-wrap').trigger('click'); 13642 13643 13644 wooCartTimeout = setTimeout(hideCart, 2700); 13645 13646 } 13647 } 13648 13649 function hideCart() { 13650 $('#header-outer .cart-notification').stop(true, true).fadeOut(); 13651 } 13652 13653 function checkForWooItems() { 13654 13655 var checkForCartItems = setInterval(shopping_cart_dropdown, 250); 13656 setTimeout(function () { 13657 clearInterval(checkForCartItems); 13658 }, 4500); 13659 13660 } 13661 13662 13663 if ($('#header-outer[data-cart="false"]').length == 0) { 13664 checkForWooItems();
13665 } 13666 13667 function nectarAccountPageTabs() { 13668 13669 // Not on account page. 13670 if ($('body.woocommerce-account #customer_login').length == 0) { 13671 return; 13672 } 13673 13674 // Create HTML. 13675 $('.woocommerce-account .woocommerce > #customer_login').prepend('<div class="nectar-form-controls" />'); 13676 13677 $('.woocommerce-account .woocommerce > #customer_login > div:not(.nectar-form-controls)').each(function () { 13678 var $title = $(this).find('> h2').text(); 13679 $('#customer_login .nectar-form-controls').append('<div class="control">' + $title + '</div>'); 13680 }); 13681 13682 // Click event. 13683 $('.woocommerce-account .woocommerce > #customer_login .nectar-form-controls .control').on('click', function () { 13684 13685 $('.woocommerce-account .woocommerce > #customer_login .nectar-form-controls .control').removeClass('active'); 13686 $(this).addClass('active'); 13687 13688 var formIndex = $(this).index() + 1; 13689 $('#customer_login div[class*="u-column"]').hide(); 13690 $('#customer_login div[class*="u-column"].col-' + formIndex).show(); 13691 13692 setTimeout(function () { 13693 $('#customer_login div[class*="u-column"]').removeClass('visible'); 13694 $('#customer_login div[class*="u-column"].col-' + formIndex).addClass('visible'); 13695 }, 30); 13696 13697 }); 13698 13699 // Starting. 13700 $('.woocommerce-account .woocommerce > #customer_login .nectar-form-controls .control:nth-child(1)').trigger('click'); 13701 13702 } 13703 13704 nectarAccountPageTabs(); 13705 13706 var bindTextOnHoverMobile = ( $('.products[data-rm-m-hover="1"]').length > 0 && nectarDOMInfo.usingMobileBrowser ) ? false : true; 13707 13708 // Text on hover effect. 13709 if(bindTextOnHoverMobile) { 13710 $body.on('mouseover', '.text_on_hover .product-wrap, .text_on_hover > a:first-child', function () { 13711 $(this).parent().addClass('hovered'); 13712 }); 13713 13714 $body.on('mouseout', '.text_on_hover .product-wrap, .text_on_hover > a:first-child', function () { 13715 $(this).parent().removeClass('hovered'); 13716 }); 13717 } 13718 13719 13720 // Material/fancy parallax hover effect zindex. 13721 if ($('.material.product').length > 0 || 13722 $('.minimal.product').length > 0 || 13723 $('.nectar-fancy-box[data-style="parallax_hover"]').length > 0 || 13724 $('.nectar-category-grid[data-shadow-hover="yes"]').length > 0 || 13725 $('.nectar-post-grid[data-shadow-hover="yes"]').length > 0) { 13726 13727 var $productZindex = 101; 13728 13729 $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 () { 13730 $productZindex++; 13731 $(this).css('z-index', $productZindex + 1); 13732 }); 13733 13734 $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 () { 13735 13736 var $that = $(this); 13737 setTimeout(function () { 13738 if (!$that.is(':hover')) { 13739 $that.css('z-index', 100); 13740 } 13741 }, 350); 13742 }); 13743 13744 if( window.nectarOptions && window.nectarOptions.woo_minimal_product_effect && window.nectarOptions.woo_minimal_product_effect === 'default' ) { 13745 $body.on('mouseenter', '.minimal.product', function () { 13746 $productZindex++; 13747 $(this).css('z-index', $productZindex + 1); 13748 }); 13749 13750 $body.on('mouseleave', '.minimal.product', function () { 13751 13752 var $that = $(this); 13753 setTimeout(function () { 13754 if (!$that.is(':hover')) { 13755 $that.css('z-index', 100); 13756 } 13757 }, 350); 13758 }); 13759 } 13760 13761 // Reset to stop zindex from getting too high. 13762 setInterval(function () { 13763 if ($('.nectar-fancy-box[data-style="parallax_hover"]:hover').length > 0 || 13764 $('.minimal.product:hover').length > 0) { 13765 return; 13766 } 13767 13768 $('.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); 13769 $productZindex = 101; 13770 }, 10000); 13771 13772 } 13773 13774 function minimalProductHover() { 13775 13776 // Add icons. 13777 $('.products .classic .product-wrap .add_to_cart_button').wrapInner('<span />'); 13778 $('.products .classic .product-wrap .add_to_cart_button').prepend('<i class="normal icon-salient-cart"></i>'); 13779 13780 // Bind hover. 13781 var bindMobileHover = ( $('.products[data-rm-m-hover="1"]').length > 0 && nectarDOMInfo.usingMobileBrowser ) ? false : true; 13782 13783 if( bindMobileHover && window.nectarOptions && window.nectarOptions.woo_minimal_product_effect && window.nectarOptions.woo_minimal_product_effect === 'default' ) { 13784 13785 $body.on('mouseover', '.products .minimal.product', function () { 13786 minimalProductCalc($(this)); 13787 });
13788 13789 $body.on('mouseleave', '.products .minimal.product', function () { 13790 $(this).find('.background-color-expand').css({ 13791 'transform': 'scale(1, 1) translateY(0) translateZ(0px)' 13792 }); 13793 }); 13794 13795 } 13796 13797 // Starting trigger mouse over. 13798 $('.products .minimal.product').each(function () { 13799 if ($(this).is(':hover')) { 13800 $(this).trigger('mouseover'); 13801 } 13802 }); 13803 13804 } 13805 13806 13807 13808 function minimalProductCalc(el) { 13809 13810 var expansionAmtX = 40, 13811 expansionAmtY = expansionAmtX, 13812 translateYAmt = 0; 13813 13814 var $item = el, 13815 $itemWidth = $item.width(), 13816 $itemHeight = $item.height(), 13817 $wChange = (parseInt($itemWidth) + expansionAmtX) / parseInt($itemWidth), 13818 $hChange = (parseInt($itemHeight) + expansionAmtY) / parseInt($itemHeight); 13819 13820 $item.addClass('hover-bound'); 13821 13822 $item.find('.background-color-expand').css({ 13823 'transform': 'scale(' + $wChange + ',' + $hChange + ') translateY('+translateYAmt+'px) translateZ(0px)' 13824 }); 13825 13826 } 13827 13828 minimalProductHover(); 13829 13830 13831 13832 // Mobile widget filters. 13833 $('.woocommerce #sidebar .widget.woocommerce').each(function () { 13834 13835 // Skip widgets without any titles. 13836 if ($(this).find('> h4').length == 0) { 13837 $(this).addClass('no-widget-title'); 13838 } 13839 13840 }); 13841 13842 $body.on('click', '#sidebar .widget.woocommerce:not(.widget_price_filter) h4', function () { 13843 13844 if(window.nectarOptions && window.nectarOptions.woo_sidebar_toggles !== 'false') { 13845 13846 if ($window.width() < 1000 ) { 13847 13848 if ($(this).parent().is('.widget_product_tag_cloud')) { 13849 $(this).parent().find('> div').slideToggle(); 13850 } 13851 if ($(this).parent().is('.woocommerce-widget-layered-nav') && $(this).parent().find('> .woocommerce-widget-layered-nav-dropdown').length > 0) { 13852 $(this).parent().find('> .woocommerce-widget-layered-nav-dropdown').slideToggle(); 13853 } 13854 13855 $(this).parent().find('> ul').slideToggle(); 13856 13857 $(this).parent().toggleClass('open-filter'); 13858 } 13859 13860 } 13861 13862 }); 13863 13864 13865 // Slide in cart event. 13866 $body.on('mouseenter', '#header-outer [data-cart-style="slide_in"] .cart-menu-wrap', openRightCartHover); 13867 13868 $body.on('mouseenter', '.nectar-slide-in-cart', function () { 13869 $(this).addClass('mouse-accessed'); 13870 }); 13871 13872 13873 function openRightCartHover() { 13874 13875 if ($('.nectar-slide-in-cart ul.cart_list li:not(.empty)').length > 0) { 13876 13877 $('.nectar-slide-in-cart').addClass('open'); 13878 $window.on('mousemove.rightCartOffsetCheck', closeCartCheck); 13879 13880 } 13881 } 13882 13883 function closeCartCheck(e) { 13884 13885 var $windowWidth = $window.width(); 13886 if (e.clientX < $windowWidth - 370 - $bodyBorderWidth && $('.nectar-slide-in-cart').hasClass('mouse-accessed')) { 13887 13888 $window.off('mousemove.rightCartOffsetCheck', closeCartCheck); 13889 13890 $('.nectar-slide-in-cart').removeClass('open').removeClass('mouse-accessed'); 13891 13892 } 13893 13894 } 13895 13896 // Slide in click cart. 13897 var wooBgOverlayTimeout; 13898 13899 $body.on('click', '#header-outer [data-cart-style="slide_in_click"] .cart-menu-wrap, #mobile-cart-link[data-cart-style="slide_in_click"]', openRightCart); 13900 13901 function openRightCart() { 13902 if( $body.is('.woocommerce-checkout') || $body.is('.woocommerce-cart') ) { 13903 return true; 13904 } 13905 13906 $('.nectar-slide-in-cart, .nectar-slide-in-cart-bg').addClass('open'); 13907 $('.nectar-slide-in-cart-bg').addClass('revealed'); 13908 clearTimeout(wooBgOverlayTimeout); 13909 13910 // YITH ajax filters compat. 13911 $('.style_slide_in_click div.quantity').each(function(){ 13912 if( $(this).find('.minus').length > 1 ) { 13913 $(this).find('.minus').first().remove(); 13914 } 13915 if( $(this).find('.plus').length > 1 ) { 13916 $(this).find('.plus').first().remove(); 13917 } 13918 }); 13919 13920 return false; 13921 } 13922 13923 $body.on('click', '.nectar-slide-in-cart.style_slide_in_click .close-cart, .nectar-slide-in-cart-bg', closeRightCart); 13924 13925 function closeRightCart() { 13926 13927 $('.nectar-slide-in-cart, .nectar-slide-in-cart-bg').removeClass('open'); 13928 13929 wooBgOverlayTimeout = setTimeout(function() { 13930 $('.nectar-slide-in-cart-bg').removeClass('revealed'); 13931 },400); 13932 13933 return false; 13934 } 13935 13936 // Add quantity functionality. 13937 wooQauntityBtns(); 13938 13939 // AJAX add to cart. 13940 if( window.nectarOptions && window.nectarOptions.ajax_add_to_cart === '1' ) { 13941 var ajaxAddToCart = new NectarWooCommerceCartAJAX(); 13942 } 13943 13944 if( window.nectarOptions && window.nectarOptions.woo_product_filter_toggle === '1' && $body.is('.archive.woocommerce') ) { 13945 var nectarProductFilters = new NectarWooCommerceFilters(); 13946 } 13947 13948 // Third party. 13949 // YITH Ajax filters. 13950 $(document).on( 'yith-wcan-ajax-filtered', nectarLazyImageLoading ); 13951 13952 13953 } 13954 13955 13956 13957 /** 13958 * Modern quick search. 13959 * 13960 * @since 13.0 13961 */ 13962 function NectarQuickSearch() { 13963 13964 this.$el = $('#search-outer #search .container #s'); 13965 this.$container = ''; 13966 this.$parent = ''; 13967 this.$searchEl = $('#search-outer'); 13968 this.request = ''; 13969 this.timeout = ''; 13970 this.setup(); 13971 this.events(); 13972 13973 this.state = { 13974 requesting: false, 13975 open: false, 13976 prevResults: '' 13977 } 13978 13979 this.minChars = 2; 13980 13981 } 13982 13983 13984 NectarQuickSearch.prototype.setup = function() { 13985
13986 this.$container = $('<div class="inner"></div>'); 13987 $('#search-outer').append($('<div class="nectar-ajax-search-results"><div class="container"></div></div>')); 13988 this.$parent = $('#search-outer .nectar-ajax-search-results'); 13989 $('#search-outer .nectar-ajax-search-results .container').append(this.$container); 13990 13991 }; 13992 13993 NectarQuickSearch.prototype.events = function() { 13994 13995 var that = this; 13996 13997 this.throttled = throttle(this.getResults.bind(this),350); 13998 this.$el.on('keyup', this.keyHandle.bind(this) ); 13999 14000 $(window).on('resize', this.resize.bind(this)); 14001 $(window).on('nectar-search-close', function() { 14002 that.resetHeight(); 14003 that.requestCheck(); 14004 }); 14005 14006 }; 14007 14008 NectarQuickSearch.prototype.keyHandle = function(e) { 14009 14010 // Verify Key. 14011 var keysToSkip = [16,91,32,37,39,17]; 14012 14013 if( keysToSkip.indexOf(e.keyCode) != -1 ) { 14014 return; 14015 } 14016 14017 this.throttled(); 14018 this.debouncedSearch(); 14019 14020 }; 14021 14022 NectarQuickSearch.prototype.debouncedSearch = function() { 14023 14024 var that = this; 14025 14026 clearTimeout(this.timeout); 14027 this.timeout = setTimeout(function(){ 14028 if(that.state.requesting) { 14029 return; 14030 } 14031 that.getResults(); 14032 },400); 14033 14034 }; 14035 14036 14037 NectarQuickSearch.prototype.resize = function() { 14038 14039 this.$parent.css({ 14040 'max-height': '' 14041 }); 14042 14043 if( this.state.open === true ) { 14044 this.$parent.css({ 14045 'max-height': parseInt(this.$container.outerHeight()) + 'px' 14046 }); 14047 } 14048 14049 }; 14050 14051 NectarQuickSearch.prototype.resetHeight = function() { 14052 14053 var that = this; 14054 14055 this.$parent.css({ 14056 'max-height': '' 14057 }); 14058 14059 setTimeout(function(){ 14060 $headerOuterEl.removeClass('results-shown'); 14061 },400); 14062 14063 this.state.prevResults = ''; 14064 this.state.open = false; 14065 }; 14066 14067 14068 NectarQuickSearch.prototype.requestCheck = function() { 14069 14070 if( this.state.requesting === true ) { 14071 this.request.abort(); 14072 this.state.requesting = false; 14073 } 14074 14075 }; 14076 14077 NectarQuickSearch.prototype.getResults = function() { 14078 14079 var that = this; 14080 var val = this.$el.val(); 14081 14082 // Deleted all chars / too few chars. 14083 if( val.length == 0 || val.length < this.minChars ) { 14084 $headerOuterEl.removeClass('results-shown'); 14085 this.requestCheck(); 14086 this.resetHeight(); 14087 return; 14088 } 14089 14090 this.request = $.ajax({ 14091 type: 'POST', 14092 url: window.nectarLove.ajaxurl, 14093 data: { 14094 action: "nectar_ajax_ext_search_results", 14095 search: val 14096 }, 14097 cache: false, 14098 success: function (response) { 14099 14100 that.state.requesting = false; 14101 14102 // No results. 14103 if( !response ) { 14104 that.resetHeight(); 14105 } 14106 14107 if( response && response.content && response.content !== that.state.prevResults && that.$searchEl.hasClass('material-open') ) { 14108 14109 that.$container.html(response.content); 14110 14111 that.$parent.css({ 14112 'max-height': parseInt(that.$container.outerHeight()) + 'px' 14113 }); 14114 14115 setTimeout(function(){ 14116 $headerOuterEl.addClass('results-shown'); 14117 },200); 14118 14119 // Desktop animation 14120 if( nectarDOMInfo.winW >= 1000 && !$headerOuterEl.hasClass('results-shown') ) { 14121 14122 that.$container.find('.product, .search-post-item').css({ 14123 'opacity': '0', 14124 'transform': 'translateY(25px)', 14125 'transition': 'none' 14126 }); 14127 14128 setTimeout(function(){ 14129 that.$container.find('.product, .search-post-item').css({ 14130 '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)' 14131 }); 14132 },50); 14133 14134 14135 that.$container.find('.product, .search-post-item').each(function(i) { 14136 var $that = $(this); 14137 setTimeout(function(){ 14138 $that.css({ 14139 'opacity': '1', 14140 'transform': 'translateY(0)' 14141 }) 14142 }, 50 + (i*60)); 14143 });
14144 14145 } 14146 14147 that.state.open = true; 14148 that.state.prevResults = response.content; 14149 14150 } 14151 14152 } 14153 14154 }); 14155 14156 this.state.requesting = true; 14157 14158 }; 14159 14160 14161 /** 14162 * Search in navigation functionality. 14163 * 14164 * @since 10.5 14165 */ 14166 14167 function navigationSearchInit() { 14168 14169 // Init quick search. 14170 var quickSearch = false; 14171 if( window.nectarOptions && window.nectarOptions.quick_search && window.nectarOptions.quick_search === 'true' ) { 14172 quickSearch = new NectarQuickSearch(); 14173 } 14174 14175 var $placeholder = ($('#search-outer #search input[type=text][data-placeholder]').length > 0) ? $('#search-outer #search input[type=text]').attr('data-placeholder') : ''; 14176 14177 // Material skin add search BG markup. 14178 if ($body.hasClass('material') && $('#header-outer .bg-color-stripe').length == 0) { 14179 $headerOuterEl.append('<div class="bg-color-stripe" />'); 14180 } 14181 14182 // Prevent jumping on click. 14183 $body.on('click', '#search-btn a', function () { 14184 return false; 14185 }); 14186 14187 // Open search on mouseup. 14188 $body.on('click', '#search-btn a:not(.inactive), #header-outer .mobile-search', function () { 14189 14190 if ($(this).hasClass('open-search')) { 14191 return false; 14192 } 14193 14194 // Close menu on original skin. 14195 if( $body.hasClass('original') && $('.slide-out-widget-area-toggle.mobile-icon a.open').length > 0 ) { 14196 $('.slide-out-widget-area-toggle.mobile-icon a') 14197 .addClass('non-human-allowed') 14198 .trigger('click'); 14199 14200 setTimeout(function () { 14201 $('.slide-out-widget-area-toggle.mobile-icon a').removeClass('non-human-allowed'); 14202 }, 100); 14203 } 14204 14205 if ($body.hasClass('ascend') || 14206 $('body[data-header-format="left-header"]').length > 0 && $('body.material').length == 0) { 14207 14208 // Ascend theme skin. 14209 $('#search-outer > #search form, #search-outer #search .span_12 span, #search-outer #search #close').css('opacity', 0); 14210 14211 $('#search-outer > #search form').css('transform', 'translateY(-30px)'); 14212 $('#search-outer #search .span_12 span').css('transform', 'translateY(20px)'); 14213 14214 $('#search-outer').show(); 14215 $('#search-outer').stop().transition({ 14216 scale: '1,0', 14217 'opacity': 1 14218 }, 0).transition({ 14219 scale: '1,1' 14220 }, 700, 'cubic-bezier(0.2, 1, 0.3, 1)'); 14221 14222 $('#search-outer > #search form').delay(350).transition({ 14223 'opacity': 1, 14224 'transform': 'translateY(0)' 14225 }, 700, 'cubic-bezier(0.2, 1, 0.3, 1)'); 14226 14227 $('#search-outer #search #close').delay(500).transition({ 14228 'opacity': 1 14229 }, 700, 'cubic-bezier(0.2, 1, 0.3, 1)'); 14230 14231 14232 $('#search-outer #search .span_12 span').delay(450).transition({ 14233 'opacity': 1, 14234 'transform': 'translateY(0)' 14235 }, 700, 'cubic-bezier(0.2, 1, 0.3, 1)'); 14236 14237 } 14238 14239 else if (!$body.hasClass('material')) { 14240 // Original theme skin. 14241 $('#search-outer').stop(true).fadeIn(600, 'easeOutExpo'); 14242 } 14243 else { 14244 14245 // Material theme skin. 14246 $('#header-outer[data-transparent-header="true"] .bg-color-stripe').css('transition', ''); 14247 $('#search-outer, #ajax-content-wrap').addClass('material-open'); 14248 nectarState.materialSearchOpen = true; 14249 $headerOuterEl.addClass('material-search-open'); 14250 $('#fp-nav').addClass('material-ocm-open'); 14251 14252 $(window).trigger('nectar-search-open'); 14253 14254 } 14255 14256 14257 setTimeout(function () { 14258 14259 $('#search input[type=text]').trigger('focus'); 14260 14261 if ($('#search input[type=text]').val() == $placeholder) { 14262 $('#search input[type=text]').setCursorPosition(0); 14263 } 14264 14265 }, 300); 14266 14267 14268 $(this).toggleClass('open-search'); 14269 14270 // Close slide out widget area. 14271 $('.slide-out-widget-area-toggle a:not(#toggle-nav).open:not(.animating)').trigger('click'); 14272 14273 return false; 14274 14275 }); 14276 14277 // Handle the placeholder value. 14278 $('body:not(.material)').on('keydown', '#search input[type=text]', function () { 14279 if ($(this).val() == $placeholder) { 14280 $(this).val(''); 14281 } 14282 });
14283 14284 $('body:not(.material)').on('keyup', '#search input[type=text]', function () { 14285 if ($(this).val().length == 0 ) { 14286 $(this).val($placeholder); 14287 $(this).setCursorPosition(0); 14288 } 14289 }); 14290 14291 14292 // Close search btn event. 14293 $body.on('click', '#close', function () { 14294 closeSearch(); 14295 $searchButtonEl.removeClass('open-search'); 14296 $('#header-outer .mobile-search').removeClass('open-search'); 14297 return false; 14298 }); 14299 14300 // Original and Ascend skin close search when clicking off. 14301 $('body:not(.material)').on('blur', '#search-box input[type=text]', function () { 14302 closeSearch(); 14303 $searchButtonEl.removeClass('open-search'); 14304 $('#header-outer .mobile-search').removeClass('open-search'); 14305 }); 14306 14307 14308 // Material skin close when clicking off the search. 14309 $('body.material').on('click', '#ajax-content-wrap', function (e) { 14310 if (e.originalEvent !== undefined) { 14311 closeSearch(); 14312 $searchButtonEl.removeClass('open-search'); 14313 $('#header-outer .mobile-search').removeClass('open-search'); 14314 14315 } 14316 }); 14317 14318 // Material skin close on esc button event. 14319 if ($('body.material').length > 0) { 14320 $(document).on('keyup', function (e) { 14321 14322 if (e.keyCode == 27) { 14323 closeSearch(); 14324 $searchButtonEl.removeClass('open-search'); 14325 14326 // Close ocm material 14327 if ($('.ocm-effect-wrap.material-ocm-open').length > 0) { 14328 $('.slide-out-widget-area-toggle.material-open a').trigger('click'); 14329 } 14330 } 14331 14332 }); 14333 } 14334 14335 14336 14337 // Called to hide the search bar. 14338 function closeSearch() { 14339 14340 if ($body.hasClass('ascend') || $('body[data-header-format="left-header"]').length > 0 && $('body.material').length == 0) { 14341 $('#search-outer').stop().transition({ 14342 'opacity': 0 14343 }, 300, 'cubic-bezier(0.2, 1, 0.3, 1)'); 14344 $searchButtonEl.addClass('inactive'); 14345 setTimeout(function () { 14346 $('#search-outer').hide(); 14347 $searchButtonEl.removeClass('inactive'); 14348 }, 300); 14349 } else if ($('body.material').length == 0) { 14350 $('#search-outer').stop(true).fadeOut(450, 'easeOutExpo'); 14351 } 14352 14353 if ($body.hasClass('material')) { 14354 14355 $(window).trigger('nectar-search-close'); 14356 14357 var closeTimeoutDur = ($headerOuterEl.hasClass('results-shown')) ? 800 : 400; 14358 setTimeout(function(){ 14359 $('#search-outer #s').val(''); 14360 },closeTimeoutDur); 14361 14362 $('#ajax-content-wrap').removeClass('material-open'); 14363 nectarState.materialSearchOpen = false; 14364 $headerOuterEl.removeClass('material-search-open'); 14365 $('#search-outer').removeClass('material-open'); 14366 $('#fp-nav').removeClass('material-ocm-open'); 14367 } 14368 14369 } 14370 14371 } 14372 14373 14374 14375 14376 14377 14378 /** 14379 * Header layout "Centered header bottom bar" functionality. 14380 * 14381 * @since 9.0 14382 */ 14383 function centeredNavBottomBarReposition() { 14384 14385 var $headerOuter = $headerOuterEl, 14386 $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'), 14387 $headerSpan3 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_3'), 14388 $secondaryHeader = $headerSecondaryEl, 14389 $headerBtns = $headerSpan3.find('nav >ul.buttons'), 14390 $navLogoMargin = parseInt($('body.material #header-outer').attr('data-padding')), 14391 $navLogoHeight = parseInt($('body.material #header-outer').attr('data-logo-height')), 14392 $separatorExtra = parseInt($headerSpan3.css('margin-bottom')), 14393 $triggerCondition = $navLogoMargin + $separatorExtra + $navLogoHeight + parseInt(nectarDOMInfo.secondaryHeaderHeight); 14394 14395 if ($secondaryHeader.length > 0) { 14396 14397 if ($('#header-outer[data-remove-fixed="1"]').length == 0 && $('#header-outer[data-condense="true"]').length > 0) { 14398 14399 setTimeout(function () { 14400 if( $headerSecondaryEl.css('display') != 'none' ) { 14401 nectarDOMInfo.secondaryHeaderHeight = $headerSecondaryEl.outerHeight(); 14402 } 14403 14404 }, 50); 14405 } 14406 14407 } 14408 14409 // Helper to determine if custom mobile breakpoint is active. 14410 function condenseCustomBreakPointHelper() { 14411 14412 var $withinCustomBreakpoint = mobileBreakPointCheck(); 14413 14414 // Adding class to prevent logo from hiding when opening OCM 14415 if ( $withinCustomBreakpoint ) { 14416 $headerOuterEl.addClass('within-custom-breakpoint'); 14417 } else { 14418 $headerOuterEl.removeClass('within-custom-breakpoint'); 14419 } 14420 } 14421 14422 14423 // Bind events if "Condense Header On Scroll" effect is enabled. 14424 if ($('#header-outer[data-condense="true"]').length > 0) { 14425 14426 $window.on('scroll.centeredNavCondense', centeredNavBottomFixed_Scroll); 14427 $window.trigger('scroll'); 14428 14429 $window.on('resize', function(){ 14430 if(nectarDOMInfo.winW < 1000 || mobileBreakPointCheck() ) { 14431 $headerOuter.addClass('force-condense-remove'); 14432 $window.off('scroll.centeredNavCondense'); 14433 } 14434 });
14435 14436 $window.on('smartresize', function() { 14437 14438 condenseCustomBreakPointHelper(); 14439 14440 if(nectarDOMInfo.winW >= 1000 && false == mobileBreakPointCheck() ) { 14441 14442 // Coming from mobile. 14443 if($headerOuter.hasClass('force-condense-remove')) { 14444 14445 // Remove condense effect. 14446 centeredNavBottomFixed_Scroll(); 14447 $headerOuter.removeClass('force-condense-remove'); 14448 14449 // See if the condense effect needs to be reapplied. 14450 setTimeout(function() { 14451 14452 if(nectarDOMInfo.scrollTop >= $triggerCondition) { 14453 $headerOuter.addClass('force-condense'); 14454 centeredNavBottomFixed_Scroll(); 14455 $headerOuter.removeClass('force-condense'); 14456 } 14457 // Bind scroll event. 14458 $window.on('scroll.centeredNavCondense', centeredNavBottomFixed_Scroll); 14459 },200); 14460 14461 } 14462 } 14463 14464 }); 14465 14466 condenseCustomBreakPointHelper(); 14467 14468 } 14469 14470 14471 14472 function centeredNavBottomFixed_Scroll() { 14473 14474 // Bypass calculating. 14475 if (nectarDOMInfo.winW < 1000 || 14476 $('body.page-template-template-no-header').length > 0 || 14477 $('body.page-template-template-no-header-footer').length > 0 || 14478 $('body.material-ocm-open').length > 0 || 14479 $('#header-outer[data-has-menu="true"][data-format="centered-menu-bottom-bar"] .span_9').css('display') == 'none' || 14480 $('#header-outer[data-has-menu="true"][data-format="centered-menu-bottom-bar"] .span_9 > nav').css('display') == 'none') { 14481 return; 14482 } 14483 14484 $bodyBorderTop = ($bodyBorderTop.length > 0 && nectarDOMInfo.secondaryHeaderHeight > 0) ? $bodyBorderTop.height() : 0; 14485 14486 // Add condense effect. 14487 if ($headerOuter.hasClass('force-condense') || !$headerOuter.hasClass('fixed-menu') && nectarDOMInfo.scrollTop >= $triggerCondition) { 14488 14489 var amountToMove = (parseInt($headerSpan9.position().top) - $navLogoMargin - parseInt(nectarDOMInfo.adminBarHeight)) + parseInt(nectarDOMInfo.secondaryHeaderHeight) - $bodyBorderTop; 14490 14491 // Megamenu removes transparency option 14492 if ($('#header-outer[data-megamenu-rt="1"]').length > 0 && $('#header-outer .megamenu').length > 0 && $('#header-outer[data-transparent-header="true"]').length > 0) { 14493 $headerOuterEl.removeClass('no-transition'); 14494 } 14495 14496 $headerOuter.addClass('fixed-menu').removeClass('transparent').css({ 14497 'top': '-' + amountToMove + 'px', 14498 'position': 'fixed' 14499 }); 14500 14501 if( !$headerOuter.is('[data-menu-bottom-bar-align="left"]') ) { 14502 14503 var $headerNavBarOffset = ($('header#top .span_9 nav > ul').length > 0) ? $('header#top .span_9 nav > ul').offset().top : 0; 14504 var $headerButtonsOffset = ($headerBtns.find('li:first-child > *').length > 0) ? $headerBtns.find('li:first-child > *').offset().top : 0; 14505 var $headerButtonsHeight = ($headerSpan9.find('.sf-menu > li > a').length > 0) ? (20 - parseInt($headerSpan9.find('.sf-menu > li > a').height())) / 2 : 2; 14506 14507 $headerBtns.css('transform', 'translateY(' + Math.ceil(parseInt($headerNavBarOffset) - parseInt($headerButtonsOffset) - $headerButtonsHeight) + 'px)'); 14508 $headerBtns.find('.nectar-woo-cart').css('height', $headerOuter.height() + parseInt($headerOuter.css('top')) - parseInt(nectarDOMInfo.adminBarHeight)); 14509 } 14510 14511 } 14512 14513 // Remove condense effect. 14514 else if ($headerOuter.hasClass('force-condense-remove') || $headerOuter.hasClass('fixed-menu') && nectarDOMInfo.scrollTop < $triggerCondition ) { 14515 14516 $headerOuter.removeClass('fixed-menu').css({ 14517 'top': '0', 14518 'position': 'absolute' 14519 }); 14520 14521 $headerBtns.css('transform', 'translateY(0px)'); 14522 $headerBtns.find('.nectar-woo-cart').css('height', ''); 14523 14524 if ($('#header-outer.transparent').length == 0) { 14525 14526 if ($('#header-outer[data-megamenu-rt="1"]').length > 0 && 14527 $('#header-outer .megamenu').length > 0) { 14528 $headerOuterEl.removeClass('no-transition'); 14529 } 14530 14531 if ($('#header-outer[data-megamenu-rt="1"]').length > 0 && 14532 $('#header-outer[data-transparent-header="true"]').length > 0 && 14533 $('#header-outer .megamenu').length > 0) { 14534 14535 if ($headerOuterEl.attr('data-transparent-header') == 'true' && 14536 $('.nectar-box-roll').length == 0 && 14537 $('.megamenu.sfHover:not(.width-75):not(.width-50)').length == 0) { 14538 14539 $headerOuterEl.addClass('transparent'); 14540 $headerOuterEl.removeClass('no-transition'); 14541 14542 } 14543 else if ($headerOuterEl.attr('data-transparent-header') == 'true' && 14544 $('.nectar-box-roll').length == 0 && 14545 $('.megamenu.sfHover').length > 0) { 14546 14547 $headerOuterEl.addClass('no-transition'); 14548 } 14549 14550 } 14551 14552 else { 14553 if ($headerOuterEl.attr('data-transparent-header') == 'true' && $('.nectar-box-roll').length == 0) { 14554 $headerOuterEl.addClass('transparent'); 14555 } 14556 } 14557 14558 } // endif transparent header conditional. 14559 14560 14561 }
14561 // End Remove condense effect. 14562 14563 } // End centeredNavBottomFixed_Scroll. 14564 14565 14566 14567 } 14568 14569 14570 14571 14572 /** 14573 * Header layout "Centered header bottom bar" initialization. 14574 * 14575 * @since 10.5 14576 */ 14577 function centeredNavBottomBarInit() { 14578 14579 if ($('#header-outer[data-format="centered-menu-bottom-bar"]').length > 0) { 14580 centeredNavBottomBarReposition(); 14581 } 14582 14583 } 14584 14585 14586 14587 14588 14589 /** 14590 * Header layout "Centered logo between menu". 14591 * 14592 * Splits the main navigation menu into two sections placed on each side of logo. 14593 * 14594 * @since 8.0 14595 */ 14596 function centeredLogoMargins() { 14597 14598 if (nectarDOMInfo.winW > 1000) { 14599 14600 var $navItemLength = $('#header-outer[data-format="centered-logo-between-menu"] #top nav > .sf-menu:not(.buttons) > li').length; 14601 14602 if ($('#header-outer #social-in-menu').length > 0) { 14603 $navItemLength--; 14604 } 14605 14606 var $centerLogoWidth, 14607 $extraMenuSpace; 14608 14609 if ($('#header-outer #top .row .col.span_3 #logo img:visible').length == 0) { 14610 $centerLogoWidth = parseInt($('#header-outer #top .row .col.span_3').width()); 14611 } else { 14612 $centerLogoWidth = parseInt($('#header-outer #top .row .col.span_3 img:visible').width()); 14613 } 14614 14615 if ($('#header-outer[data-lhe="animated_underline"]').length > 0) { 14616 $extraMenuSpace = parseInt($('header#top nav > ul > li:first-child > a').css('margin-right')); 14617 } else { 14618 $extraMenuSpace = parseInt($('header#top nav > ul > li:first-child > a').css('padding-right')); 14619 } 14620 14621 if ($extraMenuSpace > 30) { 14622 $extraMenuSpace += 45; 14623 } else if ($extraMenuSpace > 20) { 14624 $extraMenuSpace += 40; 14625 } else { 14626 $extraMenuSpace += 30; 14627 } 14628 14629 if (!$body.hasClass('rtl')) { 14630 $('#header-outer[data-format="centered-logo-between-menu"] #top nav > .sf-menu:not(.buttons) > li:nth-child(' + Math.floor($navItemLength / 2) + ')').css({ 14631 'margin-right': ($centerLogoWidth + $extraMenuSpace) + 'px' 14632 }).addClass('menu-item-with-margin'); 14633 } else { 14634 $('#header-outer[data-format="centered-logo-between-menu"] #top nav > .sf-menu:not(.buttons) > li:nth-child(' + Math.floor($navItemLength / 2) + ')').css({ 14635 'margin-left': ($centerLogoWidth + $extraMenuSpace) + 'px' 14636 }).addClass('menu-item-with-margin'); 14637 } 14638 14639 var $leftMenuWidth = 0; 14640 var $rightMenuWidth = 0; 14641 14642 $('#header-outer[data-format="centered-logo-between-menu"] #top nav > .sf-menu:not(.buttons) > li:not(#social-in-menu)').each(function (i) { 14643 if (i + 1 <= Math.floor($navItemLength / 2)) { 14644 $leftMenuWidth += $(this).width(); 14645 } else { 14646 $rightMenuWidth += $(this).width(); 14647 } 14648 14649 }); 14650 14651 var $menuDiff = Math.abs($rightMenuWidth - $leftMenuWidth); 14652 14653 if ($leftMenuWidth > $rightMenuWidth || ($body.hasClass('rtl') && $leftMenuWidth < $rightMenuWidth) ) { 14654 $('#header-outer #top .row > .col.span_9').css('padding-right', $menuDiff); 14655 } else { 14656 $('#header-outer #top .row > .col.span_9').css('padding-left', $menuDiff); 14657 } 14658 14659 $('#header-outer[data-format="centered-logo-between-menu"] nav').css('visibility', 'visible'); 14660 14661 } 14662 14663 else if ($('#header-outer[data-format="centered-logo-between-menu"]').length > 0 && nectarDOMInfo.winW < 1000) { 14664 $('#header-outer .row > .col.span_9').css({ 14665 'padding-right': '0', 14666 'padding-left': '0' 14667 }); 14668 } 14669 14670 } 14671 14672 14673 /** 14674 * Header layout "Centered logo between menu" initialization. 14675 * 14676 * @since 10.5 14677 */ 14678 function centeredLogoHeaderInit() { 14679 14680 if($('#header-outer[data-format="centered-logo-between-menu"]').length > 0) { 14681 14682 if(!usingLogoImage) { 14683 centeredLogoMargins(); 14684 } 14685 else if(usingLogoImage && $('#header-outer[data-format="centered-logo-between-menu"]').length > 0 && $('header#top #logo img:first[src]').length > 0) { 14686 14687 //fadein img on load 14688 var tempLogoImg = new Image(); 14689 tempLogoImg.src = $('header#top #logo img:first').attr('src'); 14690 14691 tempLogoImg.onload = function() { 14692 centeredLogoMargins(); 14693 }; 14694 14695 } 14696 14697 // Resize event. 14698 $window.on('smartresize', centeredLogoMargins); 14699 14700 } 14701 14702 } 14703 14704 14705 14706 14707 14708 14709 14710 14711 /** 14712 * Handle basic items before initializing effects. 14713 * 14714 * @since 10.5 14715 */ 14716 function headerNavPreInit() { 14717 14718 // Deactivate hide header until needed effect on mobile. 14719 if (nectarDOMInfo.usingMobileBrowser && $('#header-outer[data-remove-fixed="1"]').length == 0) { 14720 $body.attr('data-hhun', '0'); 14721 } 14722 14723 // Page fullscreen rows does not need permanent transparent. 14724 if ($('#nectar_fullscreen_rows').length > 0) { 14725 ($headerOuterEl.attr('data-permanent-transparent', 'false')); 14726 } 14727 14728 // Set mobile header height. 14729 if (nectarDOMInfo.usingMobileBrowser && $('#header-outer[data-mobile-fixed="1"]').length > 0 && 14730 $('#header-outer[data-transparent-header="true"]').length == 0) { 14731 $('#header-space').css('height', $headerOuterEl.outerHeight()); 14732 } 14733 14734 } 14735 14736 14737 14738 14739 14740 14741 /** 14742 * Hide header until needed. 14743 * 14744 * Used when "Header Hide Until Needed" is active. 14745 * 14746 * @since 10.5 14747 */ 14748 var hhunState = { 14749 timeoutQueued: false, 14750 visible: true 14751 } 14752 function hhunHeaderEffect() { 14753 14754 var previousScroll = 0, // previous scroll position 14755 menuOffset = ( headerTransparent == false && $('#page-header-bg[data-
14755parallax="1"]').length > 0 ) ? 200 : 60, // height of menu (once scroll passed it, menu is hidden) 14756 hideShowOffset = 3, // scrolling value after which triggers hide/show menu 14757 stickyPageSubmenu = ( $('.page-submenu[data-sticky="true"]').length > 0 ) ? true : false, 14758 bodyOffsetHeight = document.body.offsetHeight; 14759 14760 function getBodyHeight() { 14761 if( nectarDOMInfo.winW > 999 && nectarState.materialOffCanvasOpen != true ) { 14762 bodyOffsetHeight = document.body.offsetHeight; 14763 } 14764 } 14765 // Periodically update the body height. 14766 setInterval(getBodyHeight, 1500); 14767 14768 // Called in RAF loop to calculate the header visibility. 14769 function hhunCalcs() { 14770 14771 $headerOuterEl.addClass('detached'); 14772 14773 var currentScroll = nectarDOMInfo.scrollTop, // Gets current scroll position 14774 scrollDifference = Math.abs(currentScroll - previousScroll); // Calculates how fast user is scrolling 14775 14776 // Stop scrolling while animated anchors / box roll 14777 if ( nectarState.animatedScrolling == true && $('#header-outer.detached').length > 0 || nectarState.preventScroll == true ) { 14778 14779 if (nectarDOMInfo.winW > 999) { 14780 14781 if (currentScroll > menuOffset) { 14782 14783 // Remove transparent when clicking anchor from the top 14784 if( nectarState.animatedScrolling == true && headerTransparent == true && nectarState.permanentTransHeader == false ) { 14785 $headerOuterEl.removeClass('transparent').addClass('scrolling'); 14786 } 14787 14788 // Still keep scroll tracking to continue hiding menu. 14789 previousScroll = nectarDOMInfo.scrollTop; 14790 currentScroll = nectarDOMInfo.scrollTop; 14791 14792 } 14793 14794 requestAnimationFrame(hhunCalcs); 14795 return; 14796 } 14797 } 14798 14799 // Stop when material ocm or material search is open 14800 if ( nectarState.materialOffCanvasOpen == true || nectarState.materialSearchOpen == true ) { 14801 if (nectarDOMInfo.winW > 999) { 14802 14803 // Still handle transparency when scrolling with material search open. 14804 if( nectarState.materialSearchOpen == true && headerTransparent == true) { 14805 14806 if( nectarState.permanentTransHeader == false && currentScroll > menuOffset ) { 14807 $headerOuterEl.removeClass('transparent').addClass('scrolling'); 14808 } else { 14809 $headerOuterEl.addClass('transparent').removeClass('scrolling'); 14810 } 14811 14812 } 14813 14814 requestAnimationFrame(hhunCalcs); 14815 return; 14816 } 14817 } 14818 14819 // Stop on mobile if not using sticky option 14820 if (headerMobileFixed == false && nectarDOMInfo.winW < 1000) { 14821 $headerOuterEl.removeClass('detached').removeClass('scrolling'); 14822 return; 14823 } 14824 14825 14826 if (!$headerOuterEl.hasClass('side-widget-open') && !$('#header-outer .slide-out-widget-area-toggle a').hasClass('animating')) { 14827 14828 var heightToAdjust; 14829 14830 // Remove transparent and body border margin 14831 if (currentScroll > 1) { 14832 14833 // Handle secondary header 14834 if ($headerSecondaryEl.length > 0) { 14835 if (currentScroll > menuOffset) { 14836 $headerSecondaryEl.addClass('hide-up'); 14837 $headerOuterEl.css('transform', 'translateY(-' + nectarDOMInfo.secondaryHeaderHeight + 'px)'); 14838 } else { 14839 $headerSecondaryEl.removeClass('hide-up'); 14840 $headerOuterEl.css('transform', '0px)'); 14841 } 14842 } 14843 14844 } 14845 14846 // Scrolled past menu 14847 if (currentScroll > menuOffset) { 14848 14849 // Handle transparency 14850 if ( nectarState.permanentTransHeader == false ) { 14851 14852 if( hhunState.timeoutQueued == false ) { 14853 setTimeout(function() { 14854 $headerOuterEl.removeClass('transparent'); 14855 $headerOuterEl.addClass('scrolling'); 14856 hhunState.timeoutQueued = false; 14857 },400); 14858 } 14859 hhunState.timeoutQueued = true; 14860 14861 } 14862 14863 // Scrolled past detach point add class to fix menu 14864 if (!$headerOuterEl.hasClass('detached')) { 14865 14866 $headerOuterEl 14867 .addClass('detached') 14868 .removeClass('parallax-contained'); 14869 } 14870 14871 $headerOuterEl.removeClass('no-transition'); 14872 14873 14874 // Scrolling faster than hideShowOffset hide/show menu 14875 if (scrollDifference >= hideShowOffset) { 14876 14877 if (currentScroll > previousScroll) { 14878 14879 // Hide menu 14880 if (!$headerOuterEl.hasClass('invisible')) { 14881 14882 $headerOuterEl 14883 .addClass('invisible') 14884 .removeClass('at-top'); 14885 14886 // Close submenus 14887 if ($(".sf-menu").length > 0 && $().superfish) { 14888 $(".sf-menu").superfish('hide'); 14889 $('header#top nav > ul.sf-menu > li.menu-item-over').removeClass('menu-item-over'); 14890 } 14891 14892 } 14893 14894 if( stickyPageSubmenu == true ) { 14895 $('.page-submenu.stuck') 14896 .css('transform', 'translateY(0px)') 14897 .addClass('header-not-visible'); 14898 } 14899 14900 } else { 14901 14902 // Show menu 14903 if ($headerOuterEl.hasClass('invisible')) { 14904 $headerOuterEl.removeClass('invisible'); 14905 } 14906 14907 // Page submenu adjust 14908 if( stickyPageSubmenu == true ) { 14909 14910 heightToAdjust = $headerOuterEl.outerHeight(); 14911 14912 if( $headerSecondaryEl.length > 0) { 14913 heightToAdjust -= nectarDOMInfo.secondaryHeaderHeight; 14914 } 14915 14916 if ($bodyBorderTop.length > 0 && $('body.mobile').length == 0) { 14917 14918 $bodyBorderSizeToRemove = ($bodyBorderHeaderColorMatch) ? $bodyBorderTop.height() : 0; 14919 14920 $('.page-submenu.stuck') 14921 .css('transform', 'translateY(' + (heightToAdjust - $bodyBorderSizeToRemove) + 'px)') 14922 .removeClass('header-not-visible'); 14923 14924 } else { 14925 $('.page-submenu.stuck') 14926 .css('transform', 'translateY(' + heightToAdjust + 'px)') 14927 .removeClass('header-not-visible'); 14928 } 14929 14930 } // End sticky page sub conditional. 14931 14932 } 14933 14934 } 14935 14936 } 14937 else { 14938 // At top of document. 14939 var $topDetachNum = ($('#header-outer[data-using-secondary="1"]').length > 0) ? 32 : 0; 14940 if ($bodyBorderTop.length > 0) { 14941 $topDetachNum = ($('#header-outer[data-using-secondary="1"]').length > 0) ? 32 + $bodyBorderTop.height() : $bodyBorderTop.height(); 14942 } 14943 14944 if (currentScroll <= $topDetachNum) { 14945 14946 $headerOuterEl 14947 .addClass('at-top') 14948 .removeClass('invisible') 14949 .removeClass('scrolling'); 14950 14951 // Megamenu removes transparent. 14952 if ($('#header-outer[data-megamenu-rt="1"]').length > 0 && 14953 headerTransparent == true && 14954 $('#header-outer .megamenu').length > 0) { 14955 14956 if ($('.nectar-box-roll').length == 0 && 14957 $('.megamenu.sfHover:not(.width-75):not(.width-50)').length == 0) { 14958 14959 $headerOuterEl 14960 .addClass('transparent') 14961 .css('transform', 'translateY(0)') 14962 .removeClass('no-transition'); 14963 14964 } else if ($('.nectar-box-roll').length > 0) { 14965 14966 $headerOuterEl 14967 .css('transform', 'translateY(0)') 14968 .addClass('at-top-before-box'); 14969 } 14970 14971 } else { 14972 14973 if (headerTransparent == true && 14974 $('.nectar-box-roll').length == 0) { 14975 14976 $headerOuterEl 14977 .addClass('transparent') 14978 .css('transform', 'translateY(0)'); 14979 14980 } else if ($('.nectar-box-roll').length > 0) { 14981 14982 $headerOuterEl 14983 .css('transform', 'translateY(0)') 14984 .addClass('at-top-before-box'); 14985 } 14986 } 14987
14988 if ($('#page-header-bg[data-parallax="1"]').length > 0) { 14989 14990 $headerOuterEl 14991 .addClass('parallax-contained') 14992 .css('transform', 'translateY(0)'); 14993 } 14994 14995 } 14996 14997 } 14998 14999 // At the bottom of document - show menu 15000 if ((nectarDOMInfo.winH + nectarDOMInfo.scrollTop) >= bodyOffsetHeight) { 15001 15002 $headerOuterEl.removeClass('invisible'); 15003 15004 // Page submenu adjust 15005 if( stickyPageSubmenu == true ) { 15006 15007 heightToAdjust = $headerOuterEl.outerHeight(); 15008 if( $headerSecondaryEl.length > 0) { 15009 heightToAdjust -= nectarDOMInfo.secondaryHeaderHeight; 15010 } 15011 15012 if ($bodyBorderTop.length > 0 && $('body.mobile').length == 0) { 15013 15014 $bodyBorderSizeToRemove = ($bodyBorderHeaderColorMatch) ? $bodyBorderTop.height() : 0; 15015 $('.page-submenu.stuck') 15016 .css('transform', 'translateY(' + (heightToAdjust - $bodyBorderSizeToRemove) + 'px)') 15017 .removeClass('header-not-visible'); 15018 } else { 15019 15020 $('.page-submenu.stuck') 15021 .css('transform', 'translateY(' + heightToAdjust + 'px)') 15022 .removeClass('header-not-visible'); 15023 } 15024 15025 } // End sticky page submenu conditional. 15026 15027 } 15028 15029 } 15030 15031 // Keep track of current scroll position 15032 previousScroll = currentScroll; 15033 15034 if (nectarDOMInfo.winW > 999) { 15035 requestAnimationFrame(hhunCalcs); 15036 } 15037 15038 } 15039 15040 // Start the animation loop. 15041 hhunCalcs(); 15042 15043 } 15044 15045 15046 15047 /** 15048 * Shrink the header navigation size. 15049 * 15050 * Used when "Header Resize On Scroll" is active. 15051 * 15052 * @since 1.0 15053 */ 15054 function smallNav() { 15055 15056 var $offset = nectarDOMInfo.scrollTop, 15057 $windowWidth = nectarDOMInfo.winW, 15058 $scrollTriggerOffset = 30; 15059 15060 if( headerTransparent == true && !nectarDOMInfo.usingMobileBrowser ) { 15061 $scrollTriggerOffset = 0; 15062 } 15063 15064 if ($offset > $scrollTriggerOffset && $windowWidth >= 1000 && $('body.material-ocm-open').length == 0) { 15065 15066 15067 // Going to small when material search is closing, it must be closed immediately 15068 if ($body.is('.material')) { 15069 15070 if ($('#search-outer.material-open').length == 0) { 15071 $('#header-outer[data-transparent-header="true"] .bg-color-stripe').css('transition', 'none'); 15072 } 15073 15074 // Secondary header 15075 if ($headerSecondaryEl.length > 0) { 15076 $headerSecondaryEl.addClass('hide-up'); 15077 $headerOuterEl.css('transform', 'translateY(-' + nectarDOMInfo.secondaryHeaderHeight + 'px)'); 15078 } 15079 15080 } 15081 15082 if ($('#header-outer[data-megamenu-rt="1"]').length > 0 && 15083 $('#header-outer[data-transparent-header="true"]').length > 0 && 15084 $('#header-outer .megamenu').length > 0) { 15085 15086 if ($headerOuterEl.attr('data-transparent-header') == 'true' && 15087 $('#header-outer.side-widget-open').length == 0 && 15088 $('#header-outer[data-permanent-transparent="1"]').length == 0 && 15089 $('.megamenu.sfHover:not(.width-75):not(.width-50)').length == 0) { 15090 $headerOuterEl.removeClass('transparent'); 15091 $headerOuterEl.removeClass('no-transition'); 15092 } 15093 15094 } else { 15095 15096 if ($headerOuterEl.attr('data-transparent-header') == 'true' && 15097 $('#header-outer.side-widget-open').length == 0 && 15098 $('#header-outer[data-permanent-transparent="1"]').length == 0) { 15099 $headerOuterEl.removeClass('transparent'); 15100 } 15101 15102 } 15103 15104 // Centered logo between menu. 15105 $('#header-outer:not(.small-nav) header#top nav > ul > li.menu-item-with-margin').stop(true, true).animate({ 15106 'margin-right': (parseInt($('header#top nav > ul > li.menu-item-with-margin').css('margin-right')) - parseInt(logoShrinkNum) * 3) + 'px' 15107 }, { 15108 queue: false, 15109 duration: 250, 15110 easing: 'easeOutCubic' 15111 }); 15112 15113 // Add small nav class. 15114 $('#header-outer, #search-outer').addClass('small-nav'); 15115 15116 // Body border full width side padding 15117 if ($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 && 15118 $bodyBorderTop.length > 0 && 15119 $bodyBorderHeaderColorMatch == true) { 15120 15121 $('#header-outer[data-full-width="true"] header > .container').stop(true, true).animate({ 15122 'padding': '0' 15123 }, { 15124 queue: false, 15125 duration: 250, 15126 easing: 'easeOutCubic' 15127 });
15128 15129 } 15130 15131 15132 // Box roll effect 15133 if ($('.nectar-box-roll').length > 0 && $('#header-outer[data-permanent-transparent="1"]').length == 0) { 15134 $('#ajax-content-wrap').animate({ 15135 'margin-top': (Math.floor(($logoHeight - logoShrinkNum) + (headerPadding * 2) / 1.8 + nectarDOMInfo.adminBarHeight + nectarDOMInfo.secondaryHeaderHeight)) 15136 }, { 15137 queue: false, 15138 duration: 250, 15139 easing: 'easeOutCubic' 15140 }); 15141 } 15142 15143 $window.off('scroll.headerResizeEffect', smallNav); 15144 $window.on('scroll.headerResizeEffect', bigNav); 15145 15146 // Dark slider coloring border 15147 $('#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'); 15148 $('#header-outer[data-transparent-header="true"] .cart-menu').css('transition', 'none'); 15149 setTimeout(function () { 15150 $('#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'); 15151 $('#header-outer[data-transparent-header="true"] .cart-menu').css('transition', 'border-color 0.30s ease'); 15152 }, 300); 15153 15154 } 15155 15156 } 15157 15158 15159 /** 15160 * Return header navigation size to full. 15161 * 15162 * Used when "Header Resize On Scroll" is active. 15163 * 15164 * @since 1.0 15165 */ 15166 function bigNav() { 15167 15168 var $offset = nectarDOMInfo.scrollTop, 15169 $windowWidth = nectarDOMInfo.winW, 15170 $scrollTriggerOffset = 30; 15171 15172 if ($body.is('.material-ocm-open')) { 15173 return false; 15174 } 15175 15176 if( headerTransparent == true && !nectarDOMInfo.usingMobileBrowser ) { 15177 $scrollTriggerOffset = 0; 15178 } 15179 15180 if ($offset <= $scrollTriggerOffset && $windowWidth >= 1000 || $('.small-nav').length > 0 && $('#ajax-content-wrap.no-scroll').length > 0) { 15181 15182 $('#header-outer, #search-outer').removeClass('small-nav'); 15183 15184 if ($('#header-outer[data-megamenu-rt="1"]').length > 0 && 15185 $('#header-outer[data-transparent-header="true"]').length > 0 && 15186 $('#header-outer .megamenu').length > 0) { 15187 15188 if ($headerOuterEl.attr('data-transparent-header') == 'true' && 15189 $('.nectar-box-roll').length == 0 && 15190 $('.megamenu.sfHover:not(.width-75):not(.width-50)').length == 0) { 15191 15192 $headerOuterEl.addClass('transparent'); 15193 $headerOuterEl.removeClass('no-transition'); 15194 } 15195 15196 } else { 15197 15198 if ($headerOuterEl.attr('data-transparent-header') == 'true' && $('.nectar-box-roll').length == 0) { 15199 $headerOuterEl.addClass('transparent'); 15200 } 15201 15202 } 15203 15204 // Body border full width side padding 15205 if ($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 && 15206 $bodyBorderTop.length > 0 && 15207 $bodyBorderHeaderColorMatch == true) { 15208 15209 $('#header-outer[data-full-width="true"] header > .container').stop(true, true).animate({ 15210 'padding': '0 28px' 15211 }, { 15212 queue: false, 15213 duration: 250, 15214 easing: 'easeOutCubic' 15215 }); 15216 15217 } 15218 15219 // centered logo between menu. 15220 $('header#top nav > ul > li.menu-item-with-margin').stop(true, true).animate({ 15221 'margin-right': (parseInt($('header#top nav > ul > li.menu-item-with-margin').css('margin-right')) + parseInt(logoShrinkNum) * 3) + 'px' 15222 }, { 15223 queue: false, 15224 duration: 150, 15225 easing: 'easeOutCubic' 15226 }); 15227 15228 15229 // Secondary header 15230 if ($headerSecondaryEl.length > 0) { 15231 15232 $headerSecondaryEl.removeClass('hide-up'); 15233 $headerOuterEl 15234 .removeClass('hide-up') 15235 .css('transform', 'translateY(0%)'); 15236 15237 } 15238 15239 // Box roll 15240 if ($('.nectar-box-roll').length > 0 && $('#header-outer[data-permanent-transparent="1"]').length == 0) { 15241 $('#ajax-content-wrap').animate({ 15242 'margin-top': (Math.floor(($logoHeight) + (headerPadding * 2) + nectarDOMInfo.adminBarHeight + nectarDOMInfo.secondaryHeaderHeight)) 15243 }, { 15244 queue: false, 15245 duration: 250, 15246 easing: 'easeOutCubic' 15247 });
15248 } 15249 15250 $window.off('scroll.headerResizeEffect', bigNav); 15251 $window.on('scroll.headerResizeEffect', smallNav); 15252 15253 // Dark slider coloring border 15254 $('#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'); 15255 $('#header-outer[data-transparent-header="true"] .cart-menu').css('transition', 'none'); 15256 setTimeout(function () { 15257 $('#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'); 15258 $('#header-outer[data-transparent-header="true"] .cart-menu').css('transition', 'border-color 0.30s ease'); 15259 }, 300); 15260 } 15261 15262 } 15263 15264 15265 15266 /** 15267 * Default scroll event to handle transparency/secondary header when no header effects are enabled. 15268 * 15269 * @since 4.0 15270 */ 15271 function opaqueCheck() { 15272 15273 // The condense header effect will bypass this unless in the custom mobile breakpoint (which is defined in theme options). 15274 if ($('#header-outer[data-format="centered-menu-bottom-bar"][data-condense="true"]').length > 0 && !$headerOuterEl.hasClass('within-custom-breakpoint') ) { 15275 return; 15276 } 15277 15278 if (nectarDOMInfo.scrollTop > 0) { 15279 15280 if ($('body.material').length > 0) { 15281 $headerOuterEl.addClass('scrolled-down'); 15282 15283 // Secondary header 15284 if ($headerSecondaryEl.length > 0 && nectarDOMInfo.winW > 1000) { 15285 $headerSecondaryEl.addClass('hide-up'); 15286 $headerOuterEl.css('transform', 'translateY(-' + nectarDOMInfo.secondaryHeaderHeight + 'px)'); 15287 } 15288 } 15289 15290 if ($headerOuterEl.attr('data-transparent-header') == 'true' && $('#header-outer[data-permanent-transparent="1"]').length == 0) { 15291 $headerOuterEl.removeClass('transparent').addClass('scrolled-down'); 15292 } 15293 15294 // Switch event to watch. 15295 $window.off('scroll.headerResizeEffectOpaque', opaqueCheck); 15296 $window.on('scroll.headerResizeEffectOpaque', transparentCheck); 15297 } 15298 } 15299 15300 15301 /** 15302 * Default scroll event to handle transparency/secondary header when no header effects are enabled. 15303 * 15304 * @since 4.0 15305 */ 15306 function transparentCheck() { 15307 15308 // The condense header effect will bypass this unless in the custom mobile breakpoint (which is defined in theme options). 15309 if ($('#header-outer[data-format="centered-menu-bottom-bar"][data-condense="true"]').length > 0 && !$headerOuterEl.hasClass('within-custom-breakpoint') ) { 15310 return; 15311 } 15312 15313 if (nectarDOMInfo.scrollTop == 0 && $('body.material-ocm-open').length == 0) { 15314 15315 if ($('#header-outer[data-megamenu-rt="1"]').length > 0 && 15316 $('#header-outer[data-transparent-header="true"]').length > 0 && 15317 $('#header-outer .megamenu').length > 0) { 15318 15319 if ($headerOuterEl.attr('data-transparent-header') == 'true' && $('.megamenu.sfHover:not(.width-75):not(.width-50)').length == 0) { 15320 15321 $headerOuterEl 15322 .addClass('transparent') 15323 .removeClass('scrolled-down'); 15324 15325 $headerOuterEl.removeClass('no-transition'); 15326 15327 } else if ($headerOuterEl.attr('data-transparent-header') == 'true') { 15328 15329 $headerOuterEl.removeClass('scrolled-down'); 15330 } 15331 15332 } else { 15333 15334 if ($headerOuterEl.attr('data-transparent-header') == 'true') { 15335 $headerOuterEl 15336 .addClass('transparent') 15337 .removeClass('scrolled-down'); 15338 } 15339 15340 } 15341 15342 if ($('body.material').length > 0) { 15343 $headerOuterEl.removeClass('scrolled-down'); 15344 15345 // Secondary header 15346 if ($headerSecondaryEl.length > 0 && nectarDOMInfo.winW > 1000) { 15347 15348 $headerSecondaryEl.removeClass('hide-up'); 15349 $headerOuterEl 15350 .removeClass('hide-up') 15351 .css('transform', 'translateY(0%)'); 15352 } 15353 } 15354 15355 // Switch event to watch. 15356 $window.off('scroll.headerResizeEffectOpaque', transparentCheck); 15357 $window.on('scroll.headerResizeEffectOpaque', opaqueCheck); 15358 } 15359 15360 } 15361 15362 15363 15364 15365 /** 15366 * Mobile header event for handling transparency/secondary header. 15367 * 15368 * @since 10.5 15369 * @see bindScrollEffectsMobile 15370 */ 15371 function mobileHeaderRAF() { 15372 15373 if ( nectarState.materialOffCanvasOpen == true ) { 15374 requestAnimationFrame(mobileHeaderRAF); 15375 return; 15376 } 15377 // Scrolled down. 15378 if (nectarDOMInfo.scrollTop > 5 ) { 15379 15380 if( nectarState.mobileHeader != 'scrolled' ) { 15381 15382 if ( nectarState.permanentTransHeader == false ) { 15383 $headerOuterEl.removeClass('transparent'); 15384 } 15385 15386 if (nectarDOMInfo.secondaryHeaderHeight > 0) { 15387 $headerSecondaryEl.addClass('hide-up'); 15388 $headerOuterEl.css('transform', 'translateY(-' + nectarDOMInfo.secondaryHeaderHeight + 'px)').addClass('hidden-secondary'); 15389 } else { 15390 $headerOuterEl.removeClass('hidden-secondary'); 15391 } 15392 15393 $headerOuterEl.addClass('scrolled-down'); 15394 15395 // Update state. 15396 nectarState.mobileHeader = 'scrolled'; 15397 } 15398 15399 } 15400 // At top. 15401 else { 15402 15403 if( nectarState.mobileHeader != 'at-top' ) { 15404 15405 if ($headerOuterEl.attr('data-transparent-header') == 'true') { 15406 $headerOuterEl.addClass('transparent'); 15407 } 15408 15409 if (nectarDOMInfo.secondaryHeaderHeight > 0) { 15410 $headerSecondaryEl.removeClass('hide-up'); 15411 $headerOuterEl.css('transform', 'translateY(0px)'); 15412 } 15413 $headerOuterEl.removeClass('hidden-secondary').removeClass('scrolled-down'); 15414 15415 // Update state. 15416 nectarState.mobileHeader = 'at-top'; 15417 } 15418 15419 } 15420 15421 if (nectarDOMInfo.winW < 1000) { 15422 requestAnimationFrame(mobileHeaderRAF); 15423 } 15424 } 15425 15426 15427 15428 /** 15429 * Bind mobile header scroll effects. 15430 * 15431 * @since 10.5 15432 * @see headerNavScrollInit 15433 */ 15434 function bindScrollEffectsMobile() { 15435 15436 if (nectarDOMInfo.winW > 999) { 15437 return; 15438 } 15439 15440 // Reset state. 15441 nectarState.mobileHeader = ''; 15442 15443 // Unbind desktop effects. 15444 $window.off('scroll.headerResizeEffect'); 15445 $window.off('scroll.headerResizeEffectOpaque'); 15446 15447 // Remove HHUN classes. 15448 $headerOuterEl 15449 .removeClass('scrolled-down') 15450 .removeClass('detached') 15451 .removeClass('invisible') 15452 .removeClass('at-top') 15453 .css('transform', 'none'); 15454 15455 // Handle mobile transparent class. 15456 if ($('#header-outer[data-mobile-fixed="1"]').length > 0) { 15457 requestAnimationFrame(mobileHeaderRAF); 15458 } else if ($headerOuterEl.attr('data-transparent-header') == 'true') { 15459 $headerOuterEl.addClass('transparent'); 15460 } 15461 15462 $window.off('smartresize.nectarNavScrollEffects'); 15463 $window.on('smartresize.nectarNavScrollEffects', bindScrollEffectsDesktop); 15464 15465 } 15466 15467 /** 15468 * Bind deaktop header scroll effects. 15469 * 15470 * @since 10.5 15471 * @see headerNavScrollInit 15472 */ 15473 function bindScrollEffectsDesktop() { 15474 15475 if (nectarDOMInfo.winW < 1000) { 15476 return; 15477 } 15478 15479 if (headerResize == true && headerHideUntilNeeded != '1') { 15480 15481 $window.off('scroll.headerResizeEffect'); 15482 15483 if ($('#nectar_fullscreen_rows').length == 0) { 15484 $window.on('scroll.headerResizeEffect', smallNav); 15485 } else if ($('#nectar_fullscreen_rows[data-mobile-disable="on"]').length > 0 && nectarDOMInfo.usingMobileBrowser) { 15486 $window.on('scroll.headerResizeEffect', smallNav); 15487 } 15488 15489 } else if (headerHideUntilNeeded != '1') { 15490 15491 $window.off('scroll.headerResizeEffectOpaque'); 15492 $window.on('scroll.headerResizeEffectOpaque', opaqueCheck); 15493 15494 }
15494 else if (headerHideUntilNeeded == '1') { 15495 15496 15497 if ($('.nectar-box-roll').length > 0) { 15498 $headerOuterEl.addClass('at-top-before-box'); 15499 } 15500 15501 // Don't trigger for header remove stickiness. 15502 if ($('#header-outer[data-remove-fixed="1"]').length == 0) { 15503 hhunHeaderEffect(); 15504 } 15505 15506 } //end if hhun 15507 15508 // Condense header effect coming from mobile. 15509 if ($('#header-outer[data-format="centered-menu-bottom-bar"][data-condense="true"]').length > 0 ) { 15510 15511 if( $headerSecondaryEl.length > 0 ) { 15512 // Remove transform. 15513 $headerOuterEl.css('transform',''); 15514 } 15515 15516 if ( nectarDOMInfo.scrollTop > 200 && !$headerOuterEl.hasClass('fixed-menu') ) { 15517 $headerOuterEl.addClass('fixed-menu'); 15518 } 15519 15520 } 15521 15522 // Only bind mobile if applicable. 15523 15524 $window.off('smartresize.nectarNavScrollEffects'); 15525 $window.on('smartresize.nectarNavScrollEffects', bindScrollEffectsMobile); 15526 15527 } 15528 15529 15530 15531 /** 15532 * Header Navigation scroll events initialization. 15533 * 15534 * @since 10.5 15535 */ 15536 function headerNavScrollInit() { 15537 15538 // Remove transparent class if page loaded further down. 15539 if ($('#header-outer[data-remove-fixed="1"]').length == 0 && nectarDOMInfo.winW > 1000) { 15540 if ( $(window).scrollTop() != 0 && $('#header-outer.transparent[data-permanent-transparent="false"]').length == 1) { 15541 $headerOuterEl.removeClass('transparent'); 15542 } 15543 } 15544 15545 // Permanent transparent header. 15546 if ($('#nectar_fullscreen_rows').length == 0 && $('.nectar-box-roll').length == 0) { 15547 midnightInit(); 15548 } 15549 15550 // Determine which events to bind at start. 15551 if (nectarDOMInfo.winW < 1000 && $('.nectar-box-roll').length == 0) { 15552 bindScrollEffectsMobile(); 15553 $window.on('smartresize.nectarNavScrollEffects', bindScrollEffectsMobile); 15554 } else { 15555 bindScrollEffectsDesktop(); 15556 $window.on('smartresize.nectarNavScrollEffects', bindScrollEffectsDesktop); 15557 } 15558 15559 } 15560 15561 15562 15563 15564 15565 15566 /** 15567 * Set the header space div height. 15568 * 15569 * @since 10.5 15570 */ 15571 function headerSpace() { 15572 15573 if ($('.mobile').length > 0) { 15574 15575 if (nectarDOMInfo.winH < nectarDOMInfo.winW && nectarDOMInfo.winW > 1000) { 15576 if ($('#header-outer.small-nav').length == 0) { 15577 $('#header-space').css('height', $headerOuterEl.outerHeight()); 15578 } 15579 } else { 15580 $('#header-space').css('height', $headerOuterEl.outerHeight()); 15581 } 15582 15583 } else { 15584 15585 if ($('.nectar-parallax-scene.first-section').length == 0) { 15586 15587 var headerPadding2 = headerPadding - headerPadding / 1.8; 15588 var $headerHeight = ($('#header-outer[data-header-resize="1"]').length > 0 && $('.small-nav').length > 0) ? $headerOuterEl.outerHeight() + (parseInt(logoShrinkNum) + headerPadding2 * 2) : $headerOuterEl.outerHeight(); 15589 15590 // Is the calculation greater than the margin of error? 15591 if( Math.abs($headerHeight - $('#header-space').height()) > 7) { 15592 $('#header-space').css('height', $headerHeight); 15593 } 15594 15595 15596 } 15597 15598 } 15599 15600 } 15601 15602 15603 15604 /** 15605 * Handle header nav distance away from top to account for admin bar. 15606 * 15607 * @since 10.5 15608 */ 15609 15610 function headerNavOffsetInit() { 15611 15612 var lastPosition = -1; 15613 var $headerScrollTop = nectarDOMInfo.scrollTop; 15614 15615 // Verify scroll pos has changed before calculating. 15616 function headerOffsetAdjust() { 15617 15618 if ( $body.hasClass('compose-mode') ) { 15619 return; 15620 } 15621 15622 $headerScrollTop = nectarDOMInfo.scrollTop; 15623 15624 if (lastPosition == $headerScrollTop) { 15625 requestAnimationFrame(headerOffsetAdjust); 15626 return false; 15627 } else { 15628 lastPosition = $headerScrollTop; 15629 } 15630 15631 headerOffsetAdjustCalc(); 15632 requestAnimationFrame(headerOffsetAdjust); 15633 15634 } 15635 15636 // Called when scrolling occurs. 15637 function headerOffsetAdjustCalc() { 15638 15639 var $eleHeight = 0; 15640 15641 // Mobile. 15642 if (nectarDOMInfo.winW < 1000 || 15643 (condenseHeaderLayout == true && $('#header-outer .span_9').css('display') == 'none') || 15644 (condenseHeaderLayout == true && $('#header-outer .span_9 > nav').css('display') == 'none')) { 15645 15646 $eleHeight = 0; 15647 var $endOffset = ($wpAdminBar.css('position') == 'fixed') ? $wpAdminBar.height() : 0; 15648 15649 $eleHeight += nectarDOMInfo.adminBarHeight; 15650 15651 if ($eleHeight - $headerScrollTop > $endOffset) { 15652 $headerOuterEl.css('top', $eleHeight - $headerScrollTop + 'px'); 15653 } else { 15654 $headerOuterEl.css('top', $endOffset); 15655 } 15656 15657 } 15658 // Desktop 15659 else { 15660 if ( condenseHeaderLayout == false ) { 15661 15662 $eleHeight = 0; 15663 15664 if( !$headerOuterEl.is('[data-remove-fixed="1"]') ) { 15665 $eleHeight += nectarDOMInfo.adminBarHeight; 15666 } 15667 $headerOuterEl.css('top', $eleHeight + 'px'); 15668 } 15669 } 15670 15671 } 15672 15673 // Bind event and begin if needed. 15674 if ($('#header-outer[data-mobile-fixed="1"]').length > 0 && $wpAdminBar.length > 0) { 15675 15676 if ($('#nectar_fullscreen_rows').length == 0) { 15677 requestAnimationFrame(headerOffsetAdjust); 15678 } else if ($('#nectar_fullscreen_rows').length > 0 && nectarDOMInfo.usingMobileBrowser) { 15679 requestAnimationFrame(headerOffsetAdjust); 15680 } 15681 15682 $window.on('smartresize', headerOffsetAdjustCalc); 15683 15684 } 15685 15686 } 15687 15688 15689 15690 15691 15692 15693 15694 /** 15695 * Calculate the minimum body height when using the footer reveal effect or material OCM 15696 * 15697 * @since 7.0 15698 */ 15699 function footerRevealCalcs() { 15700 15701 var $headerNavSpace = 0; 15702 var pageHeaderHeight = 0; 15703 15704 if( $headerOuterEl.is('[data-logo-height]') && $headerOuterEl.is('[data-padding]') ) { 15705 15706 if( !$headerOuterEl.hasClass('transparent') ) { 15707 15708 if( $headerOuterEl.find('#logo.no-image').length > 0 ) { 15709 $headerNavSpace = ( headerLayoutFormat == 'left-header' && nectarDOMInfo.winW > 1000) ? 0 : parseInt($headerOuterEl.find('#logo.no-image').height()) + (parseInt($headerOuterEl.attr('data-padding')*2)); 15710 } else { 15711 $headerNavSpace = ( headerLayoutFormat == 'left-header' && nectarDOMInfo.winW > 1000) ? 0 : parseInt($headerOuterEl.attr('data-logo-height')) + (parseInt($headerOuterEl.attr('data-padding')*2)); 15712 } 15713 15714 } 15715 15716 } else { 15717 $headerNavSpace = ( headerLayoutFormat == 'left-header' && nectarDOMInfo.winW > 1000) ? 0 : $headerOuterEl.outerHeight(); 15718 } 15719 15720 if( $pageHeaderBG.length > 0 ) { 15721 pageHeaderHeight += $pageHeaderBG.height(); 15722 } 15723 if( $('.page-header-no-bg').length > 0 ) { 15724 pageHeaderHeight += $('.page-header-no-bg').height(); 15725 } 15726 15727 if (nectarDOMInfo.winH - nectarDOMInfo.adminBarHeight - $headerNavSpace - nectarDOMInfo.footerOuterHeight - 1 - pageHeaderHeight > 0) { 15728 15729 var $resizeExtra = ($('body:not(.material) #header-outer[data-header-resize="1"]').length > 0) ? 55 : 0; 15730 15731 $('body[data-footer-reveal="1"]:not(.nectar_using_pfsr) .container-wrap').css({ 15732 'margin-bottom': nectarDOMInfo.footerOuterHeight 15733 });
15734 15735 $('.container-wrap').css({ 15736 'min-height': nectarDOMInfo.winH - nectarDOMInfo.adminBarHeight - $headerNavSpace - nectarDOMInfo.footerOuterHeight - pageHeaderHeight + $resizeExtra 15737 }); 15738 15739 } else { 15740 $('body[data-footer-reveal="1"]:not(.nectar_using_pfsr) .container-wrap').css({ 15741 'margin-bottom': nectarDOMInfo.footerOuterHeight 15742 }); 15743 } 15744 15745 if (nectarDOMInfo.winW < 1000) { 15746 $footerOuterEl.attr('data-midnight', 'light'); 15747 } 15748 else { 15749 $footerOuterEl.removeAttr('data-midnight'); 15750 } 15751 } 15752 15753 15754 /** 15755 * Initialize footer reveal and bind event 15756 * 15757 * @since 10.5 15758 */ 15759 function footerRevealInit() { 15760 15761 if ($('body[data-footer-reveal="1"]').length > 0 || $('body.material[data-slide-out-widget-area-style="slide-out-from-right"]').length > 0) { 15762 15763 setTimeout(footerRevealCalcs, 60); 15764 footerRevealCalcs(); 15765 15766 $window.on('resize', footerRevealCalcs); 15767 15768 if ($('body[data-footer-reveal="1"][data-footer-reveal-shadow="large_2"]').length > 0) { 15769 $('.container-wrap').css({ 15770 boxShadow: '0 70px 110px -30px ' + $footerOuterEl.css('backgroundColor') 15771 }); 15772 } 15773 15774 } 15775 15776 } 15777 15778 15779 15780 15781 15782 /** 15783 * Switch header navigation BG color to match row BG color that is passes. 15784 * 15785 * Only called when using "Header Inherit Row Color" option. 15786 * 15787 * @since 5.0 15788 */ 15789 function headerRowColorInheritInit() { 15790 15791 if ($('body[data-header-inherit-rc="true"]').length > 0 && $('.mobile').length == 0 && $('#header-outer[data-transparent-header="true"]').length > 0 ) { 15792 15793 var headerOffset = $logoHeight / 2 + headerPadding + nectarDOMInfo.adminBarHeight; 15794 15795 if( $('#header-outer[data-permanent-transparent="1"]').length == 0 ) { 15796 headerOffset = ($logoHeight - logoShrinkNum) + Math.ceil((headerPadding * 2) / 1.8) + nectarDOMInfo.adminBarHeight; 15797 } 15798 15799 $('.main-content > .row > .wpb_row').each(function () { 15800 15801 var $that = $(this); 15802 var $textColor; 15803 15804 var waypoint = new Waypoint({ 15805 element: $that, 15806 handler: function (direction) { 15807 15808 //User is scrolling down. 15809 if (direction == 'down') { 15810 15811 if ($that.find('.row-bg.using-bg-color').length > 0) { 15812 15813 $textColor = ($that.find('> .col.span_12.light').length > 0) ? 'light-text' : 'dark-text'; 15814 15815 $headerOuterEl 15816 .css('background-color', $that.find('.row-bg').css('background-color')) 15817 .removeClass('light-text') 15818 .removeClass('dark-text') 15819 .addClass($textColor); 15820 15821 $headerOuterEl.attr('data-current-row-bg-color', $that.find('.row-bg').css('background-color')); 15822 $('body.material #header-outer .bg-color-stripe').css('background-color', $that.find('.row-bg').css('background-color')); 15823 15824 } else { 15825 15826 $headerOuterEl 15827 .css('background-color', $headerOuterEl.attr('data-user-set-bg')) 15828 .removeClass('light-text') 15829 .removeClass('dark-text'); 15830 15831 $headerOuterEl.attr('data-current-row-bg-color', $headerOuterEl.attr('data-user-set-bg')); 15832 $('body.material #header-outer .bg-color-stripe').css('background-color', ''); 15833 15834 } 15835 15836 } 15837 15838 //User is scrolling up. 15839 else { 15840 15841 if ($that.prev('div.wpb_row').find('.row-bg.using-bg-color').length > 0) { 15842 15843 $textColor = ($that.prev('div.wpb_row').find('> .col.span_12.light').length > 0) ? 'light-text' : 'dark-text'; 15844 15845 $headerOuterEl 15846 .css('background-color', $that.prev('div.wpb_row').find('.row-bg').css('background-color')) 15847 .removeClass('light-text') 15848 .removeClass('dark-text') 15849 .addClass($textColor); 15850 15851 $headerOuterEl.attr('data-current-row-bg-color', $that.prev('div.wpb_row').find('.row-bg').css('background-color')); 15852 $('body.material #header-outer .bg-color-stripe').css('background-color', $that.prev('div.wpb_row').find('.row-bg').css('background-color')); 15853 15854 } else { 15855 15856 $headerOuterEl 15857 .css('background-color', $headerOuterEl.attr('data-user-set-bg')) 15858 .removeClass('light-text') 15859 .removeClass('dark-text'); 15860 15861 $headerOuterEl.attr('data-current-row-bg-color', $headerOuterEl.attr('data-user-set-bg')); 15862 $('body.material #header-outer .bg-color-stripe').css('background-color', ''); 15863 15864 } 15865 15866 } 15867 15868 }, 15869 offset: headerOffset 15870 15871 }); // End of waypoint bind. 15872 15873 }); // End of loop through rows. 15874 15875 } 15876 15877 } 15878 15879 15880 15881 /** 15882 * Page submenu sticky functionality 15883 * 15884 * @since 10.5.2 15885 */ 15886 15887 function stickyPageSubmenuInit() { 15888 15889 var $ = window.jQuery, 15890 Waypoint = window.Waypoint, 15891 $offsetHeight = calcHeaderNavHeight(), 15892 $headerHeight = calcHeaderNavHeight(); 15893 15894 $window.on('smartresize', function () { 15895 15896 $offsetHeight = calcHeaderNavHeight(); 15897 15898 if ($wpAdminBar.length > 0 && 15899 $wpAdminBar.css('position') == 'fixed') { 15900 $offsetHeight += $wpAdminBar.height(); 15901 } 15902 15903 if ($bodyBorderTop.length > 0 && 15904 $window.width() > 1000 && 15905 $('body[data-hhun="1"]').length > 0) { 15906 $offsetHeight += $bodyBorderTop.height(); 15907 } 15908 15909 // Recalc for resizing (same as stuck/unstuck logic below) 15910 if ($('.page-submenu.stuck').length > 0) { 15911 15912 $('.page-submenu.stuck') 15913 .addClass('no-trans') 15914 .css('top', $offsetHeight) 15915 .css('transform', 'translateY(0)').addClass('stuck'); 15916 15917 setTimeout(function () { 15918 $('.page-submenu.stuck').removeClass('no-trans'); 15919 }, 50); 15920 15921 $('.page-submenu.stuck') 15922 .parents('.wpb_row') 15923 .css('z-index', 10000); 15924 15925 // Boxed layout 15926 if ($('#boxed').length > 0) { 15927 15928 var $negMargin = ($window.width() > 1000) ? $('.container-wrap').width() * 0.04 : 39; 15929 15930 $('.page-submenu.stuck').css({ 15931 'margin-left': '-' + $negMargin + 'px', 15932 'width': $('.container-wrap').width() 15933 });
15934 15935 } 15936 15937 } else { 15938 15939 $('.page-submenu.stuck') 15940 .css('top', '0') 15941 .removeClass('stuck'); 15942 15943 $('.page-submenu.stuck') 15944 .parents('.wpb_row') 15945 .css('z-index', 'auto'); 15946 15947 if ($('#boxed').length > 0) { 15948 $('.page-submenu.stuck').css({ 15949 'margin-left': '0px', 15950 'width': '100%' 15951 }); 15952 } 15953 15954 } 15955 15956 }); 15957 15958 /* http://imakewebthings.com/waypoints/shortcuts/sticky-elements */ 15959 function Sticky(options) { 15960 this.options = $.extend({}, Waypoint.defaults, Sticky.defaults, options); 15961 this.element = this.options.element; 15962 this.$element = $(this.element); 15963 this.createWrapper(); 15964 this.topLevel = ($(this.element).parents('.top-level').length > 0) ? true : false; 15965 this.createWaypoint(); 15966 } 15967 15968 /* Private */ 15969 Sticky.prototype.createWaypoint = function () { 15970 15971 var originalHandler = this.options.handler; 15972 15973 $offsetHeight = calcHeaderNavHeight(); 15974 15975 // top level hhun 15976 if( this.topLevel && $('body[data-hhun="1"] #header-outer.detached:not(.invisible)').length > 0) { 15977 $offsetHeight += 1; 15978 this.$element.css({ 15979 'margin-top': '-1px', 15980 }); 15981 } 15982 15983 if ($wpAdminBar.length > 0 && $wpAdminBar.css('position') == 'fixed') { 15984 $offsetHeight += $wpAdminBar.height(); 15985 } 15986 15987 if ($bodyBorderTop.length > 0 && $window.width() > 1000 && $('body[data-hhun="1"]').length > 0) { 15988 $offsetHeight += $bodyBorderTop.height(); 15989 } 15990 15991 this.waypoint = new Waypoint($.extend({}, this.options, { 15992 element: this.wrapper, 15993 handler: $.proxy(function (direction) { 15994 var shouldBeStuck = this.options.direction.indexOf(direction) > -1; 15995 var wrapperHeight = shouldBeStuck ? this.$element.outerHeight(true) : ''; 15996 15997 this.$wrapper.height(wrapperHeight); 15998 if (shouldBeStuck) { 15999 16000 // top level hhun 16001 var transformAmt = 0; 16002 if( this.topLevel && $('body[data-hhun="1"] #header-outer.detached:not(.invisible)').length > 0) { 16003 16004 // Page submenu adjust 16005 var heightToAdjust = $headerOuterEl.outerHeight(); 16006 var $bodyBorderSizeToRemove = 0; 16007 16008 if( $headerSecondaryEl.length > 0) { 16009 heightToAdjust -= nectarDOMInfo.secondaryHeaderHeight; 16010 } 16011 16012 if ($bodyBorderTop.length > 0 && $('body.mobile').length == 0) { 16013 $bodyBorderSizeToRemove = ($bodyBorderHeaderColorMatch) ? $bodyBorderTop.height() : 0; 16014 } 16015 16016 transformAmt = heightToAdjust - $bodyBorderSizeToRemove; 16017 16018 } 16019 16020 this.$element 16021 .addClass('no-trans') 16022 .css('top', $offsetHeight) 16023 .css('transform', 'translateY('+transformAmt+'px)') 16024 .addClass('stuck'); 16025 16026 var $that = this; 16027 16028 setTimeout(function () { 16029 $that.$element.removeClass('no-trans'); 16030 }, 50); 16031 16032 this.$element.parents('.wpb_row').css('z-index', 10000); 16033 16034 //boxed 16035 if ($('#boxed').length > 0) { 16036 var $negMargin = ($window.width() > 1000) ? $('.container-wrap').width() * 0.04 : 39; 16037 this.$element.css({ 16038 'margin-left': '-' + $negMargin + 'px', 16039 'width': $('.container-wrap').width() 16040 }); 16041 } 16042 16043 } else { 16044 this.$element.css('top', '0').removeClass('stuck'); 16045 16046 if ($('#boxed').length > 0) this.$element.css({ 16047 'margin-left': '0px', 16048 'width': '100%' 16049 }); 16050 } 16051 16052 if (originalHandler) { 16053 originalHandler.call(this, direction); 16054 } 16055 }, this), 16056 offset: $offsetHeight 16057 })); 16058 16059 var $that = this; 16060 16061 16062 setInterval(function () { 16063 16064 if ($('body[data-hhun="1"] #header-outer.detached:not(.invisible)').length > 0) { 16065 16066 var heightToAdjust = $headerOuterEl.outerHeight(); 16067 16068 if( $headerSecondaryEl.length > 0) { 16069 heightToAdjust -= nectarDOMInfo.secondaryHeaderHeight; 16070 } 16071 16072 $that.waypoint.options.offset = $offsetHeight + heightToAdjust; 16073 } 16074 else { 16075 $that.waypoint.options.offset = $offsetHeight; 16076 } 16077 16078 Waypoint.refreshAll(); 16079 16080 }, 100); 16081 16082 16083 }; 16084 16085 /* Private */ 16086 Sticky.prototype.createWrapper = function () { 16087 if (this.options.wrapper) { 16088 this.$element.wrap(this.options.wrapper); 16089 } 16090 this.$wrapper = this.$element.parent(); 16091 this.wrapper = this.$wrapper[0]; 16092 }; 16093 16094 /* Public */ 16095 Sticky.prototype.destroy = function () { 16096 16097 if (this.$element.parent()[0] === this.wrapper) { 16098 this.waypoint.destroy(); 16099 this.$element.removeClass(this.options.stuckClass); 16100 if (this.options.wrapper) { 16101 this.$element.unwrap(); 16102 } 16103 } 16104 16105 }; 16106 16107 Sticky.defaults = { 16108 wrapper: '<div class="sticky-wrapper" />', 16109 stuckClass: 'stuck', 16110 direction: 'down right' 16111 }; 16112
16113 Waypoint.Sticky = Sticky; 16114 16115 } 16116 16117 16118 16119 /** 16120 * Page submenu page builder element. 16121 * 16122 * @since 10.5 16123 */ 16124 16125 function pageSubmenuInit() { 16126 16127 if ($('.page-submenu[data-sticky="true"]').length > 0 && $('#nectar_fullscreen_rows').length == 0) { 16128 16129 stickyPageSubmenuInit(); 16130 16131 // Remove outside of column setups 16132 if ($('.page-submenu').parents('.span_12').find('> .wpb_column').length > 1) { 16133 16134 var pageMenu = $('.page-submenu').clone(), 16135 pageMenuParentRow = $('.page-submenu').parents('.wpb_row'); 16136 16137 $('.page-submenu').remove(); 16138 pageMenuParentRow.before(pageMenu); 16139 } 16140 16141 var sticky = new Waypoint.Sticky({ 16142 element: $('.page-submenu[data-sticky="true"]')[0] 16143 }); 16144 16145 } 16146 16147 // Adjust to be higher. 16148 if ($('#nectar_fullscreen_rows').length == 0) { 16149 16150 $('.page-submenu') 16151 .parents('.wpb_row') 16152 .css('z-index', 10000); 16153 } 16154 16155 // Bind events. 16156 $('.page-submenu .mobile-menu-link').on('click', function () { 16157 16158 $(this).parents('.page-submenu') 16159 .find('ul') 16160 .stop(true) 16161 .slideToggle(350); 16162 16163 return false; 16164 16165 }); 16166 16167 $('.page-submenu ul li a').on('click', function () { 16168 16169 if ($('body.mobile').length > 0) { 16170 $(this).parents('.page-submenu') 16171 .find('ul') 16172 .stop(true) 16173 .slideToggle(350); 16174 } 16175 16176 }); 16177 16178 } 16179 16180 16181 16182 16183 /** 16184 * Page builder full height row option. 16185 * 16186 * @since 8.0 16187 */ 16188 16189 function vcFullHeightRow() { 16190 16191 var $element = $(".vc_row-o-full-height:first"); 16192 if ($element.length) { 16193 16194 var windowHeight, offsetTop, fullHeight; 16195 windowHeight = $window.height(); 16196 16197 $(".vc_row-o-full-height").each(function () { 16198 16199 offsetTop = $(this).offset().top; 16200 16201 if (offsetTop < windowHeight && 16202 $(this).hasClass('top-level') && 16203 !nectarDOMInfo.usingFrontEndEditor) { 16204 16205 fullHeight = 100 - offsetTop / (windowHeight / 100); 16206 $(this).css("min-height", fullHeight + "vh"); 16207 $(this).find('> .col.span_12').css("min-height", fullHeight + "vh"); 16208 16209 } else { 16210 16211 $(this).css("min-height", windowHeight); 16212 $(this).find('> .col.span_12').css("min-height", windowHeight); 16213 16214 } 16215 16216 }); 16217 16218 } 16219 16220 } 16221 16222 16223 /** 16224 * Page builder full height row init. 16225 * 16226 * @since 10.5 16227 */ 16228 16229 function vcFullHeightRowInit() { 16230 16231 if( $('.vc_row-o-full-height').length > 0 ) { 16232 vcFullHeightRow(); 16233 $window.on('smartresize', vcFullHeightRow); 16234 } 16235 16236 } 16237 16238 16239 /** 16240 * Page builder equal height row IE helper. 16241 * 16242 * @since 8.0 16243 */ 16244 function fixIeFlexbox() { 16245 var ua = window.navigator.userAgent, 16246 msie = ua.indexOf("MSIE "); 16247 (msie > 0 || navigator.userAgent.match(/Trident.*rv\:11\./)) && $(".vc_row-o-full-height").each(function () { 16248 "flex" === $(this).find('> .span_12').css("display") && $(this).wrap('<div class="vc_ie-flexbox-fixer"></div>') 16249 }); 16250 16251 if( msie > 0 || navigator.userAgent.match(/Trident.*rv\:11\./)) { 16252 fixIE11Images(); 16253 $(window).on('resize',fixIE11Images); 16254 } 16255 16256 } 16257 16258 /** 16259 * Fix the IE11 bug with max-width 100% on imgs 16260 * 16261 * @since 11.0 16262 */ 16263 function fixIE11Images() { 16264 16265 $('.img-with-aniamtion-wrap img.img-with-animation').each(function() { 16266 16267 if( $(this).parents('.tabbed').length == 0 && $(this).parents('.toggle').length == 0 ) { 16268 16269 var $parentWrap = $(this).parents('.img-with-aniamtion-wrap'); 16270 $parentWrap.css({ 16271 'height' : '' 16272 }); 16273 var height = $(this).height(); 16274 16275 $parentWrap.css({ 16276 'height' : height 16277 }); 16278 16279 } 16280 16281 }); 16282 16283 } 16284 16285 16286 16287 16288 16289 16290 16291 16292 16293 /** 16294 * Recent post height 16295 * 16296 * @since 10.5 16297 */ 16298 function recentPostsTitleOnlyEqualHeight() { 16299 16300 function recentPostHeight() { 16301 16302 $('.blog-recent[data-style="title_only"]').each(function () { 16303 16304 if ($(this).find('> .col').length > 1) { 16305 return false; 16306 } 16307 var $parentsSeletor = $(this).parent().parent().parent(); 16308 16309 if ($parentsSeletor.hasClass('vc_col-sm-3') || 16310 $parentsSeletor.hasClass('vc_col-sm-4') || 16311 $parentsSeletor.hasClass('vc_col-sm-6') || 16312 $parentsSeletor.hasClass('vc_col-sm-8') || 16313 $parentsSeletor.hasClass('vc_col-sm-9')) { 16314 16315 if ($('body.mobile').length == 0 && $(this).next('div').length == 0) { 16316 var tallestColumn = 0; 16317 16318 $(this).find('> .col').css('padding', '50px 20px'); 16319 16320 $(this).parents('.span_12').find(' > .wpb_column').each(function () { 16321 16322 if( Math.floor($(this).height()) > tallestColumn ) { 16323 tallestColumn = Math.floor($(this).height()); 16324 } 16325 16326 });
16327 16328 if (Math.floor($(this).find('> .col').outerHeight(true)) < Math.floor($(this).parents('.wpb_row').height()) - 1) { 16329 $(this).find('> .col').css('padding-top', (tallestColumn - $(this).find('> .col').height()) / 2 + 'px'); 16330 $(this).find('> .col').css('padding-bottom', (tallestColumn - $(this).find('> .col').height()) / 2 + 'px'); 16331 } 16332 16333 } else { 16334 $(this).find('> .col').css('padding', '50px 20px'); 16335 } 16336 } 16337 }); 16338 16339 } 16340 16341 // Set heights. 16342 if( $('.blog-recent[data-style="title_only"]').length > 0 ) { 16343 recentPostHeight(); 16344 $window.on('smartresize',recentPostHeight); 16345 } 16346 16347 } 16348 16349 16350 16351 16352 16353 /** 16354 * Helper to calculate recent post slider height 16355 * 16356 * @since 7.0 16357 */ 16358 function recentPostSliderHeight() { 16359 16360 $('.nectar-recent-posts-slider').each(function () { 16361 16362 var $minHeight = 250, 16363 $definedHeight = parseInt($(this).attr('data-height')), 16364 dif = ($('body[data-ext-responsive="true"]').length > 0) ? $window.width() / 1400 : $window.width() / 1100, 16365 $sliderSelectors = $(this).find('.nectar-recent-post-slide, .flickity-viewport'); 16366 16367 if (nectarDOMInfo.winW > 1000 && $('#boxed').length == 0) { 16368 16369 if ($(this).parents('.full-width-content').length == 0) { 16370 16371 if ($('body[data-ext-responsive="true"]').length > 0 && nectarDOMInfo.winW >= 1400) { 16372 $sliderSelectors.css('height', Math.ceil($definedHeight)); 16373 } else if ($('body[data-ext-responsive="true"]').length == 0 && nectarDOMInfo.winW >= 1100) { 16374 $sliderSelectors.css('height', Math.ceil($definedHeight)); 16375 } else { 16376 $sliderSelectors.css('height', Math.ceil($definedHeight * dif)); 16377 } 16378 16379 } else { 16380 $sliderSelectors.css('height', Math.ceil($definedHeight * dif)); 16381 } 16382 16383 } else { 16384 16385 // Column sliders 16386 var $parentCol = ($(this).parents('.wpb_column').length > 0) ? $(this).parents('.wpb_column') : $(this).parents('.col'); 16387 16388 if ($parentCol.length == 0) { 16389 $parentCol = $('.main-content'); 16390 } 16391 16392 if (!$parentCol.hasClass('vc_span12') && 16393 !$parentCol.hasClass('main-content') && 16394 !$parentCol.hasClass('span_12') && 16395 !$parentCol.hasClass('vc_col-sm-12')) { 16396 16397 var $parentColWidth = sliderColumnDesktopWidth($parentCol), 16398 $aspectRatio = $definedHeight / $parentColWidth; 16399 16400 // Min height 16401 if ($aspectRatio * $parentCol.width() <= $minHeight) { 16402 $sliderSelectors.css('height', $minHeight); 16403 } else { 16404 $sliderSelectors.css('height', $aspectRatio * $parentCol.width()); 16405 } 16406 16407 } 16408 16409 // Regular 16410 else { 16411 16412 // Min height 16413 if ($definedHeight * dif <= $minHeight) { 16414 $sliderSelectors.css('height', $minHeight); 16415 } else { 16416 $sliderSelectors.css('height', Math.ceil($definedHeight * dif)); 16417 } 16418 16419 } 16420 16421 } 16422 16423 }); 16424 16425 } 16426 16427 16428 function sliderColumnDesktopWidth(parentCol) { 16429 16430 var $parentColWidth = 1100, 16431 $columnNumberParsed = $(parentCol).attr('class').match(/\d+/); 16432 16433 if ($columnNumberParsed == '2') { 16434 $parentColWidth = 170 16435 } else if ($columnNumberParsed == '3') { 16436 $parentColWidth = 260 16437 } else if ($columnNumberParsed == '4') { 16438 $parentColWidth = 340 16439 } else if ($columnNumberParsed == '6') { 16440 $parentColWidth = 530 16441 } else if ($columnNumberParsed == '8') { 16442 $parentColWidth = 700 16443 } else if ($columnNumberParsed == '9') { 16444 $parentColWidth = 805 16445 } else if ($columnNumberParsed == '10') { 16446 $parentColWidth = 916.3 16447 } else if ($columnNumberParsed == '12') { 16448 $parentColWidth = 1100 16449 } 16450 16451 return $parentColWidth; 16452 } 16453 16454 16455 /** 16456 * Spit text into separate lines to animate in 16457 * 16458 * @since 7.0 16459 */ 16460 16461 function splitLineText() { 16462 $('.nectar-recent-posts-single_featured.multiple_featured').each(function () { 16463 16464 var $slideClass = ($(this).find('.project-slides').length > 0) ? '.project-slide' : '.nectar-recent-post-slide', 16465 $slideInfoClass = ($(this).find('.project-slides').length > 0) ? '.project-info h1' : '.inner-wrap h2 a'; 16466 16467 $(this).find($slideClass).each(function () { 16468 16469 $(this).find($slideInfoClass).each(function () { 16470 16471 var textArr = $(this).text(); 16472 textArr = textArr.trim(); 16473 textArr = textArr.split(' '); 16474 16475 $(this)[0].innerHTML = ''; 16476 16477 for (var i = 0; i < textArr.length; i++) { 16478 $(this)[0].innerHTML += '<span>' + textArr[i] + '</span> '; 16479 } 16480 16481 });
16482 16483 $(this).find($slideInfoClass + ' > span').wrapInner('<span class="inner" />'); 16484 16485 }); 16486 16487 }); 16488 16489 } 16490 16491 16492 /** 16493 * Spit text into separate lines to animate in 16494 * 16495 * @since 7.0 16496 */ 16497 16498 function splitLineHeadingMarkup() { 16499 16500 $('.nectar-split-heading[data-animation-type="line-reveal-by-space"]').each(function () { 16501 16502 var animatedClass = ( $(this).hasClass('animated-in') ) ? ' animated' : ''; 16503 16504 $(this).find('> *').each(function () { 16505 16506 var textArr = $(this).text(); 16507 textArr = textArr.trim(); 16508 textArr = textArr.split(' '); 16509 16510 $(this)[0].innerHTML = ''; 16511 16512 for (var i = 0; i < textArr.length; i++) { 16513 $(this)[0].innerHTML += '<span><span class="inner'+animatedClass+'">' + textArr[i] + '</span></span> '; 16514 } 16515 16516 }); 16517 16518 $(this).addClass('markup-generated'); 16519 16520 }); 16521 16522 $('.nectar-split-heading[data-animation-type="letter-fade-reveal"]').each(function () { 16523 16524 16525 $(this).find('> *').each(function () { 16526 16527 var textArr = $(this).text(); 16528 textArr = textArr.trim(); 16529 textArr = textArr.split(' '); 16530 16531 $(this)[0].innerHTML = ''; 16532 16533 for (var i = 0; i < textArr.length; i++) { 16534 $(this)[0].innerHTML += '<span>' + textArr[i] + '</span> '; 16535 } 16536 16537 }); 16538 16539 16540 $(this).find('span').each(function () { 16541 16542 var $this = $(this); 16543 var textArr = $(this).text().split(''); 16544 16545 $this.empty(); 16546 16547 $.each(textArr, function (i, el) { 16548 $this.append("<span>" + el + "</span"); 16549 }); 16550 16551 }); 16552 16553 $(this).addClass('markup-generated'); 16554 16555 }); 16556 16557 } 16558 16559 function splitLineHeadingInit() { 16560 16561 if( $('.nectar-split-heading[data-animation-type="line-reveal-by-space"]').length > 0 || $('.nectar-split-heading[data-animation-type="letter-fade-reveal"]').length > 0 ) { 16562 // Generate markup. 16563 splitLineHeadingMarkup(); 16564 } 16565 16566 } 16567 16568 16569 /** 16570 * Create recent post sliders 16571 * 16572 * @since 7.0 16573 */ 16574 function recentPostsFlickityInit() { 16575 16576 16577 if ($('.nectar-recent-posts-slider-inner').length > 0) { 16578 16579 var $rpFGroupCells = ($('.nectar-recent-posts-slider_multiple_visible').length > 0) ? '90%' : false; 16580 16581 var $rpF = $('.nectar-recent-posts-slider-inner').flickity({ 16582 contain: true, 16583 groupCells: $rpFGroupCells, 16584 draggable: true, 16585 lazyLoad: false, 16586 imagesLoaded: true, 16587 percentPosition: true, 16588 prevNextButtons: false, 16589 pageDots: true, 16590 resize: true, 16591 setGallerySize: true, 16592 wrapAround: true, 16593 accessibility: false 16594 }); 16595 16596 setTimeout(function () { 16597 $('.nectar-recent-posts-slider-inner').addClass('loaded'); 16598 }, 1150); 16599 var flkty = $rpF.data('flickity'); 16600 16601 $rpF.on('dragStart.flickity', function () { 16602 $('.flickity-viewport').addClass('is-moving'); 16603 }); 16604 16605 $rpF.on('dragEnd.flickity', function () { 16606 $('.flickity-viewport').removeClass('is-moving'); 16607 }); 16608 16609 var $dragTimeout; 16610 16611 $rpF.on('select.flickity', function () { 16612 16613 $('.flickity-viewport').addClass('no-hover'); 16614 clearTimeout($dragTimeout); 16615 $dragTimeout = setTimeout(function () { 16616 $('.flickity-viewport').removeClass('no-hover'); 16617 }, 400); 16618 16619 }); 16620 16621 recentPostSliderHeight(); 16622 $window.on('resize', recentPostSliderHeight); 16623 16624 if (!nectarDOMInfo.usingMobileBrowser && !nectarDOMInfo.usingFrontEndEditor) { 16625 $window.on('resize', recentPostSliderParallaxMargins); 16626 } 16627 16628 16629 } 16630 16631 16632 16633 // Multiple featured controls 16634 function multipleLargeFeaturedInit() { 16635 $('.nectar-recent-posts-single_featured.multiple_featured').each(function (sliderIndex) { 16636 16637 if ($(this).find('> .normal-container').length > 0) { 16638 $(this).find('> .normal-container').remove(); 16639 } 16640 16641 $(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>'); 16642 var $that = $(this); 16643 var tallestFeaturedSlide = 0; 16644 var $slideClickTimeout; 16645 16646 // Store instance 16647 $nectarCustomSliderRotate[sliderIndex] = { 16648 autorotate: '' 16649 }; 16650 16651 $(this).find('.nectar-recent-post-slide').each(function (i) { 16652 16653 if ($(this).find('.recent-post-container').height() > tallestFeaturedSlide) { 16654 $(this).siblings().removeClass('tallest'); 16655 $(this).addClass('tallest'); 16656 tallestFeaturedSlide = $(this).find('.recent-post-container').height(); 16657 } 16658 16659 var $activeClass = (i == 0 && $(this).parents('.nectar-recent-posts-single_featured.multiple_featured[data-autorotate="none"]').length > 0) ? 'class="active"' : ''; 16660 $that.find('.controls').append('<li ' + $activeClass + '><span class="title">' + $(this).find('h2').text() + '</span></li>'); 16661 });
16662 16663 $(this).addClass('js-loaded'); 16664 16665 16666 // Click event 16667 $(this).find('.controls li').on('click', function (e) { 16668 16669 if ($(this).hasClass('active')) { 16670 return; 16671 } 16672 16673 if (e.originalEvent !== undefined) { 16674 $(this).parent().find('.active').addClass('trans-out'); 16675 } 16676 16677 var $index = $(this).index(), 16678 $oldIndex = $(this).parent().find('.active').index(), 16679 $that = $(this); 16680 16681 clearTimeout($slideClickTimeout); 16682 16683 $(this).siblings().removeClass('active'); 16684 $(this).addClass('active'); 16685 16686 $slideClickTimeout = setTimeout(function () { 16687 16688 $that.parents('.multiple_featured') 16689 .find('.nectar-recent-post-slide:not(:eq(' + $index + '))') 16690 .css('opacity', '0') 16691 .removeClass('active'); 16692 16693 $that.parent() 16694 .find('.trans-out') 16695 .removeClass('trans-out'); 16696 16697 }, 300); 16698 16699 $that.parents('.multiple_featured') 16700 .find('.nectar-recent-post-slide:not(:eq(' + $index + '))') 16701 .css('z-index', '10'); 16702 16703 $that.parents('.multiple_featured') 16704 .find('.nectar-recent-post-slide:eq(' + $oldIndex + ')') 16705 .css('z-index', '15'); 16706 16707 $(this).parents('.multiple_featured').find('.nectar-recent-post-slide').eq($index).css({ 16708 'opacity': '1', 16709 'z-index': '20' 16710 }).addClass('active'); 16711 16712 if ($(this).parents('.multiple_featured').attr('data-autorotate') != 'none') { 16713 nectarCustomSliderResetRotate($that.parents('.nectar-recent-posts-single_featured.multiple_featured'), sliderIndex); 16714 } 16715 }); 16716 16717 16718 // Autorotate 16719 $that = $(this); 16720 16721 if ($(this).attr('data-autorotate').length > 0 && 16722 $(this).attr('data-autorotate') != 'none' && 16723 $('body.vc_editor').length == 0) { 16724 16725 setTimeout(function () { 16726 var slide_interval = (parseInt($that.attr('data-autorotate')) < 100) ? 4000 : parseInt($that.attr('data-autorotate')); 16727 16728 $nectarCustomSliderRotate[sliderIndex].autorotate = setInterval(function () { 16729 nectarCustomSliderRotate($that) 16730 }, slide_interval); 16731 16732 // Set first active class 16733 $that 16734 .find('.controls > li:first-child') 16735 .addClass('active'); 16736 16737 }, 30); 16738 16739 } 16740 16741 }); 16742 16743 splitLineText(); 16744 $window.on('resize', splitLineText); 16745 16746 } 16747 16748 multipleLargeFeaturedInit(); 16749 16750 } 16751 16752 16753 16754 /** 16755 * Default recent post slider parallax RAF loop. 16756 * 16757 * @since 7.0 16758 */ 16759 function recentPostSliderParallax() { 16760 16761 $('.nectar-recent-posts-slider').each(function () { 16762 16763 var $offset = parseInt($(this).find('.flickity-slider').position().left), 16764 $slides = $(this).find('.nectar-recent-post-slide'), 16765 $slideLength = $slides.length, 16766 $slideWidth = $slides.width(), 16767 $lastChildIndex = $(this).find('.nectar-recent-post-slide:last-child').index(), 16768 $slideFirstChildBG = $(this).find('.nectar-recent-post-slide:first-child .nectar-recent-post-bg'), 16769 $slideLastChildBG = $(this).find('.nectar-recent-post-slide:last-child .nectar-recent-post-bg'); 16770 16771 // First going to last 16772 if ($offset >= -3) { 16773 $slideLastChildBG.css('margin-left', parseInt(Math.ceil($slideWidth / 3.5)) + 'px'); 16774 } else { 16775 $slideLastChildBG.css('margin-left', '-' + parseInt(Math.ceil($slideWidth / 3.5 * $lastChildIndex)) + 'px'); 16776 } 16777 16778 // Last going to first 16779 if (Math.abs($offset) >= ($slideLength - 1) * $slideWidth) { 16780 $slideFirstChildBG.css('margin-left', '-' + parseInt(Math.ceil(($slideWidth / 3.5) * $slideLength)) + 'px'); 16781 } else { 16782 $slideFirstChildBG.css('margin-left', '0px'); 16783 } 16784 16785 $(this) 16786 .find('.nectar-recent-post-bg') 16787 .css('transform', 'translateX(' + Math.ceil($(this).find('.flickity-slider').position().left / -3.5) + 'px)'); 16788 16789 }); 16790 16791 requestAnimationFrame(recentPostSliderParallax); 16792 16793 } 16794 16795 /** 16796 * Default recent post slider margin calculations. 16797 * 16798 * @since 7.0 16799 */ 16800 function recentPostSliderParallaxMargins() { 16801 16802 $('.nectar-recent-posts-slider').each(function () { 16803 16804 var $slideWidth = $(this).find('.nectar-recent-post-slide').width(); 16805 16806 $(this).find('.nectar-recent-post-slide').each(function (i) { 16807 $(this).find('.nectar-recent-post-bg').css('margin-left', '-' + parseInt(Math.ceil($slideWidth / 3.5) * i) + 'px'); 16808 });
16809 16810 }); 16811 16812 } 16813 16814 16815 16816 /** 16817 * Initialize all recent post elements. 16818 * 16819 * @since 7.0 16820 */ 16821 function recentPostsInit() { 16822 16823 // Start flickity based sliders. 16824 recentPostsFlickityInit(); 16825 16826 16827 // Classic enhanced specific 16828 $('.blog-recent[data-style="classic_enhanced_alt"] .inner-wrap').each(function () { 16829 $(this).find('.post-featured-img').each(function () { 16830 var $src = $(this).find('img').attr('src'); 16831 $(this).css('background-image', 'url(' + $src + ')'); 16832 }); 16833 }); 16834 16835 $('.blog-recent[data-style="classic_enhanced"]').each(function () { 16836 if ($(this).find('.inner-wrap.has-post-thumbnail').length == 0) { 16837 $(this).addClass('no-thumbs'); 16838 } 16839 }); 16840 16841 // Regular recent posts slider. 16842 if (!nectarDOMInfo.usingMobileBrowser) { 16843 if ($('.nectar-recent-posts-slider').length > 0 && !nectarDOMInfo.usingFrontEndEditor) { 16844 window.requestAnimationFrame(recentPostSliderParallax); 16845 } 16846 } 16847 16848 if (!nectarDOMInfo.usingMobileBrowser && !nectarDOMInfo.usingFrontEndEditor) { 16849 recentPostSliderParallaxMargins(); 16850 } 16851 16852 } 16853 16854 16855 16856 16857 /** 16858 * Parallax on mousemove effect 16859 * 16860 * @since 10.5 16861 */ 16862 function parallaxItemHoverEffect() { 16863 16864 //change sizer pos 16865 $('.style-5').each(function () { 16866 $(this) 16867 .find('.sizer') 16868 .insertBefore($(this).find('.parallaxImg')); 16869 }); 16870 16871 // Set parent zindex 16872 $('.style-5') 16873 .parents('.wpb_row') 16874 .css('z-index', '100'); 16875 16876 var d = document, 16877 bd = d.getElementsByTagName('body')[0], 16878 win = window, 16879 imgs = d.querySelectorAll('.parallaxImg'), 16880 totalImgs = imgs.length, 16881 supportsTouch = 'ontouchstart' in win || navigator.msMaxTouchPoints, 16882 lazyLoadedItems = false; 16883 16884 if (totalImgs <= 0) { 16885 return; 16886 } 16887 16888 // Build HTML 16889 for (var l = 0; l < totalImgs; l++) { 16890 16891 var thisImg = imgs[l], 16892 layerElems = thisImg.querySelectorAll('.parallaxImg-layer'), 16893 totalLayerElems = layerElems.length; 16894 16895 if (totalLayerElems <= 0) { 16896 continue; 16897 } 16898 16899 while (thisImg.firstChild) { 16900 thisImg.removeChild(thisImg.firstChild); 16901 } 16902 16903 var lastMove = 0; 16904 16905 //throttle performance old browsers 16906 var eventThrottle = 80; 16907 if ( navigator.userAgent.indexOf("Chrome") > -1 && navigator.userAgent.indexOf("Edge/") < 1 ) { 16908 eventThrottle = 1; 16909 $('html').addClass('cssreflections'); 16910 } else { 16911 $body.addClass('cssreflections'); 16912 } 16913 16914 var containerHTML = d.createElement('div'), 16915 shineHTML = d.createElement('div'), 16916 shadowHTML = d.createElement('div'), 16917 layersHTML = d.createElement('div'), 16918 layers = []; 16919 16920 thisImg.id = 'parallaxImg__' + l; 16921 containerHTML.className = 'parallaxImg-container'; 16922 shadowHTML.className = 'parallaxImg-shadow'; 16923 layersHTML.className = 'parallaxImg-layers'; 16924 16925 for (var i = 0; i < totalLayerElems; i++) { 16926 16927 var layer = d.createElement('div'), 16928 layerInner = d.createElement('div'), 16929 imgSrc = layerElems[i].getAttribute('data-img'); 16930 16931 $(layer).html($(layerElems[i]).html()); 16932 layer.className = 'parallaxImg-rendered-layer'; 16933 layer.setAttribute('data-layer', i); 16934 16935 if (i == 0 && $(thisImg).parents('.wpb_gallery').length == 0) { 16936 layerInner.className = 'bg-img'; 16937 16938 if( $(thisImg).parents('.nectar-fancy-box').length > 0 ) { 16939 layerInner.setAttribute('data-nectar-img-src', imgSrc); 16940 lazyLoadedItems = true; 16941 } else { 16942 layerInner.style.backgroundImage = 'url(' + imgSrc + ')'; 16943 } 16944 layer.appendChild(layerInner); 16945 } 16946 layersHTML.appendChild(layer); 16947 16948 layers.push(layer); 16949 } 16950 16951 16952 containerHTML.appendChild(layersHTML); 16953 thisImg.appendChild(containerHTML); 16954 $(thisImg).wrap('<div class="parallaxImg-wrap" />'); 16955 if (!(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1)) { 16956 $(thisImg).parent().append(shadowHTML); 16957 } 16958 16959 if (supportsTouch && $('body.using-mobile-browser').length > 0) { 16960 // Stop processing. 16961 } else { 16962 (function (_thisImg, _layers, _totalLayers, _shine) { 16963 $(thisImg).parents('.style-5').on('mousemove', function (e) { 16964 16965 var parentEl = $(this); 16966 var parallaxContainer = parentEl.find('.parallaxImg-container'); 16967 var parallaxShad = parentEl.find('.parallaxImg-shadow'); 16968 16969 var now = Date.now(); 16970 16971 var usingGallery = ($(_thisImg).parents('.wpb_gallery').length > 0) ? true : false; 16972 16973 if (now > lastMove + eventThrottle) { 16974 lastMove = now; 16975 window.requestAnimationFrame(function () { 16976 processMovement(e, false, _thisImg, _layers, _totalLayers, _shine, parentEl, parallaxContainer, parallaxShad, usingGallery); 16977 });
16978 } 16979 16980 16981 }); 16982 $(thisImg).parents('.style-5').on('mouseenter', function (e) { 16983 processEnter(e, _thisImg, _layers, _totalLayers, _shine); 16984 }); 16985 $(thisImg).parents('.style-5').on('mouseleave', function (e) { 16986 processExit(e, _thisImg, _layers, _totalLayers, _shine); 16987 }); 16988 })(thisImg, layers, totalLayerElems, shineHTML); 16989 } 16990 16991 // Set the depths 16992 (function (_thisImg, _layers, _totalLayers, _shine) { 16993 depths(false, _thisImg, _layers, _totalLayers, _shine); 16994 window.addEventListener('resize', function () { 16995 depths(false, _thisImg, _layers, _totalLayers, _shine); 16996 }); 16997 })(thisImg, layers, totalLayerElems, shineHTML); 16998 } 16999 17000 if( lazyLoadedItems ) { 17001 nectarLazyImageLoading(); 17002 } 17003 17004 function processMovement(e, touchEnabled, elem, layers, totalLayers, shine, parentEl, parallaxContainer, parallaxShad, usingGal) { 17005 17006 // Stop raf if exit already called 17007 if (!$(elem.firstChild).hasClass('over')) { 17008 processExit(e, elem, layers, totalLayers, shine); 17009 return false 17010 } 17011 17012 // Set up multipliers 17013 var yMult = 0.03; 17014 var xMult = 0.063; 17015 17016 var scaleAmount = '1.03'; 17017 var offsetAmount = '-10'; 17018 var usingMasonrySize = false; 17019 17020 if ($(elem).parents('.col.wide').length > 0) { 17021 yMult = 0.03; 17022 xMult = 0.063; 17023 usingMasonrySize = true; 17024 } else if ($(elem).parents('.col.regular').length > 0 || $(elem).parents('.wpb_gallery').length > 0) { 17025 yMult = 0.045; 17026 xMult = 0.045; 17027 } else if ($(elem).parents('.col.tall').length > 0) { 17028 yMult = 0.05; 17029 xMult = 0.015; 17030 usingMasonrySize = true; 17031 } else if ($(elem).parents('.col.wide_tall').length > 0) { 17032 yMult = 0.04; 17033 xMult = 0.04; 17034 usingMasonrySize = true; 17035 } else if (parentEl.hasClass('nectar-fancy-box')) { 17036 yMult = 0.045; 17037 xMult = 0.022; 17038 scaleAmount = '1.06'; 17039 offsetAmount = '-2'; 17040 } else { 17041 yMult = 0.045; 17042 xMult = 0.075; 17043 } 17044 17045 var bdst = nectarDOMInfo.scrollTop, 17046 bdsl = 0, 17047 pageX = (touchEnabled) ? e.touches[0].pageX : e.pageX, 17048 pageY = (touchEnabled) ? e.touches[0].pageY : e.pageY, 17049 offsets = elem.getBoundingClientRect(), 17050 w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth, 17051 h = elem.clientHeight || elem.offsetHeight || elem.scrollHeight, 17052 wMultiple = 320 / w, 17053 offsetX = 0.52 - (pageX - offsets.left - bdsl) / w, 17054 offsetY = 0.52 - (pageY - offsets.top - bdst) / h, 17055 dy = (pageY - offsets.top - bdst) - h / 2, 17056 dx = (pageX - offsets.left - bdsl) - w / 2, 17057 yRotate = (offsetX - dx) * (yMult * wMultiple), 17058 xRotate = (dy - offsetY) * (xMult * wMultiple); 17059 17060 var imgCSS; 17061 17062 if (usingGal == true) { 17063 imgCSS = ' perspective(' + w * 3 + 'px) rotateX(' + -xRotate * 1.9 + 'deg) rotateY(' + -yRotate * 1.3 + 'deg)'; 17064 } else { 17065 17066 if (usingMasonrySize == false) { 17067 imgCSS = ' perspective(' + w * 3 + 'px) rotateX(' + xRotate + 'deg) rotateY(' + yRotate + 'deg) translateY(' + offsetY * offsetAmount + 'px) translateX(' + offsetX * offsetAmount + 'px) scale(' + scaleAmount + ')'; 17068 } else { 17069 imgCSS = ' perspective(' + w * 3 + 'px) rotateX(' + xRotate + 'deg) rotateY(' + yRotate + 'deg) translateY(' + offsetY * -10 + 'px) translateX(' + offsetX * -10 + 'px) scale(1.013)'; 17070 } 17071 17072 } 17073 17074 17075 // Container transform 17076 parallaxContainer.css('transform', imgCSS); 17077 17078 if (!(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1)) { 17079 parallaxShad.css('transform', imgCSS); 17080 } 17081 17082 17083 } 17084 17085 17086 function processEnter(e, elem) { 17087 17088 elem.firstChild.className += ' over'; 17089 elem.className += ' over'; 17090 17091 $(elem).addClass('transition'); 17092 17093 if ($(elem).parents('.wpb_gallery').length > 0) { 17094 setTimeout(function () { 17095 $(elem).removeClass('transition'); 17096 }, 450); 17097 } else { 17098 setTimeout(function () { 17099 $(elem).removeClass('transition'); 17100 }, 200); 17101 } 17102 17103 } 17104 17105 17106 function processExit(e, elem) { 17107 17108 var w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth; 17109 var container = elem.firstChild; 17110 17111 container.className = container.className.replace(' over', ''); 17112 elem.className = elem.className.replace(' over', ''); 17113 $(container).css('transform', 'perspective(' + w * 3 + 'px) rotateX(0deg) rotateY(0deg) translateZ(0)'); 17114 $(elem).parents('.parallaxImg-wrap').find('.parallaxImg-shadow').css('transform', 'perspective(' + w * 3 + 'px) rotateX(0deg) rotateY(0deg) translateZ(0)'); 17115 17116 $(elem).addClass('transition'); 17117 setTimeout(function () { 17118 $(elem).removeClass('transition'); 17119 }, 200); 17120 17121 } 17122 17123 17124 function depths(touchEnabled, elem, layers, totalLayers) { 17125 17126 var w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth; 17127 var container = elem.firstChild; 17128 17129 // Set z 17130 for (var ly = 0; ly < totalLayers; ly++) { 17131 if (ly == 0) { 17132 $(layers[ly]).css('transform', 'translateZ(0px)'); 17133 } 17134 else { 17135 $(layers[ly]).css('transform', 'translateZ(' + (w * 3) / 27 * (ly * 1.1) + 'px) '); 17136 } 17137 17138 } 17139 17140 totalLayers = totalLayers + 3; 17141 17142 // Set perspective from beginning 17143 $(container).css('transform', 'perspective(' + w * 3 + 'px)'); 17144 17145 } 17146 17147 } 17148 17149 17150 /** 17151 * Fancy Box 17152 * 17153 * @since 11.0 17154 */ 17155 function nectarFancyBoxHover() { 17156 17157 if( $('.nectar-fancy-box[data-style="hover_desc"]').length == 0 ) { 17158 return false; 17159 } 17160 17161 var $hoverContentHeight = 0; 17162 17163 $('body').on('mouseenter touchstart','.nectar-fancy-box[data-style="hover_desc"]', function() { 17164 $hoverContentHeight = parseInt($(this).find('.hover-content').outerHeight(true)); 17165 $(this).addClass('hovered'); 17166 $(this).find('.heading-wrap').css('transform','translateY(-'+ $hoverContentHeight +'px)'); 17167 });
17168 17169 $('body').on('mouseleave touchend','.nectar-fancy-box[data-style="hover_desc"]', function() { 17170 $(this).removeClass('hovered'); 17171 $(this).find('.heading-wrap').css('transform','translateY(0)'); 17172 }); 17173 17174 } 17175 17176 17177 17178 /** 17179 * Mouse Follow Icon 17180 * 17181 * @since 11.0 17182 */ 17183 function NectarMouseFollowIcon(el,iconSelector) { 17184 17185 this.$el = el; 17186 this.$iconEl = this.$el.find(iconSelector); 17187 17188 this.elX = 0; 17189 this.elY = 0; 17190 17191 this.initialX = this.$el.width() / 2; 17192 this.initialY = this.$el.height() / 2; 17193 17194 this.elX = 0; 17195 this.elY = 0; 17196 17197 this.lastScroll = 0; 17198 this.scrollAdjust = 0; 17199 17200 this.lastX = this.initialX; 17201 this.lastY = this.initialY; 17202 this.activeFollow = false; 17203 17204 this.percentage = 0.13; 17205 this.percentageTimeout; 17206 17207 $window.on('resize', this.resizeEvent.bind(this)); 17208 this.mouseEvents(); 17209 this.rafLoop(); 17210 17211 } 17212 17213 NectarMouseFollowIcon.prototype.resizeEvent = function() { 17214 this.initialX = this.$el.width() / 2; 17215 this.initialY = this.$el.height() / 2; 17216 }; 17217 17218 NectarMouseFollowIcon.prototype.mouseEvents = function() { 17219 17220 var that = this; 17221 17222 that.$el.on('mouseenter', function(e) { 17223 17224 that.activeFollow = true; 17225 17226 that.elX = e.offsetX; 17227 that.elY = e.offsetY; 17228 17229 that.lastScroll = 0; 17230 17231 clearTimeout(that.percentageTimeout); 17232 that.percentageTimeout = setTimeout(function(){ 17233 that.percentage = 0.2; 17234 },700); 17235 }); 17236 17237 that.$el.on('mouseleave', function() { 17238 17239 that.activeFollow = false; 17240 that.lastScroll = 0; 17241 17242 clearTimeout(that.percentageTimeout); 17243 that.percentage = 0.13; 17244 }); 17245 17246 that.$el.on('mousemove', function(e){ 17247 that.elX = e.offsetX; 17248 that.elY = e.offsetY; 17249 that.lastScroll = 0; 17250 }); 17251 17252 $(window).on('scroll',function() { 17253 if( that.activeFollow == true && that.lastScroll == 0) { 17254 that.lastScroll = nectarDOMInfo.scrollTop; 17255 } 17256 }); 17257 17258 }; 17259 17260 17261 NectarMouseFollowIcon.prototype.rafLoop = function() { 17262 17263 if( this.activeFollow == true ) { 17264 17265 this.scrollAdjust = ( this.lastScroll > 0 ) ? nectarDOMInfo.scrollTop - this.lastScroll : 0; 17266 17267 this.lastY = linearInterpolate(this.lastY, this.elY + this.scrollAdjust, this.percentage); 17268 this.lastX = linearInterpolate(this.lastX, this.elX, this.percentage); 17269 } else { 17270 this.lastY = linearInterpolate(this.lastY, this.initialY, 0.13); 17271 this.lastX = linearInterpolate(this.lastX, this.initialX, 0.13); 17272 } 17273 17274 this.$iconEl.css({ 17275 'transform': 'translateX(' + this.lastX + 'px) translateY(' + this.lastY + 'px)' 17276 }); 17277 17278 requestAnimationFrame(this.rafLoop.bind(this)); 17279 17280 }; 17281 17282 17283 17284 17285 /** 17286 * Video Lightbox 17287 * 17288 * @since 11.0 17289 */ 17290 function nectarVideoLightbox() { 17291 17292 iconMouseFollowArr = []; 17293 17294 // Parent hover relationship. 17295 $body.on('mouseenter','.nectar_video_lightbox[data-parent-hover="1"]', function() { 17296 var $parentRow = $(this).parents('.wpb_row'); 17297 $parentRow.find('> .row-bg-wrap .row-bg, > .nectar-video-wrap .nectar-video-inner').addClass('transition'); 17298 $parentRow.find('> .row-bg-wrap .row-bg, > .nectar-video-wrap .nectar-video-inner').css({ 17299 'transform' : 'scale(1.08)' 17300 }); 17301 }); 17302 17303 $body.on('mouseleave','.nectar_video_lightbox[data-parent-hover="1"]', function() { 17304 var $parentRow = $(this).parents('.wpb_row'); 17305 $parentRow.find('> .row-bg-wrap .row-bg, > .nectar-video-wrap .nectar-video-inner').css({ 17306 'transform' : 'scale(1)' 17307 }); 17308 }); 17309 17310 // Mouse Indicator. 17311 $('.nectar-video-box').each(function(i){ 17312 17313 if( $(this).find('.play_button_mouse_follow') ) { 17314 17315 var $that = $(this); 17316 17317 $(this).imagesLoaded(function () { 17318 17319 // Follow mouse. 17320 if( !nectarDOMInfo.usingMobileBrowser ) { 17321 iconMouseFollowArr[i] = new NectarMouseFollowIcon($that, '.play_button_mouse_follow'); 17322 } 17323 17324 // Initial setup. 17325 var $playColor = ( $that.is('[data-mouse-icon-color]') && $that.attr('data-mouse-icon-color').length > 0 ) ? $that.attr('data-mouse-icon-color') : '#000'; 17326 17327 if( $that.is('[data-mouse-style="solid_color"]') ) { 17328 17329 $that.find('.play_button_mouse_follow').css({ 17330 'background-color': $playColor 17331 });
17332 } 17333 17334 $that.find('.play_button_mouse_follow').addClass('visible'); 17335 17336 }); 17337 17338 } 17339 17340 }); 17341 17342 } 17343 17344 17345 17346 /** 17347 * Salient slider rotation 17348 * 17349 * @since 10.5 17350 */ 17351 function nectarCustomSliderRotate(slider) { 17352 17353 if ($('body.vc_editor').length > 0) { 17354 return; 17355 } 17356 17357 var $controlSelector = (slider.find('.project-slides').length > 0) ? '.dot-nav > span' : '.controls > li', 17358 $controlSelectorInd = (slider.find('.project-slides').length > 0) ? 'span' : ' li', 17359 $slideLength = slider.find($controlSelector).length, 17360 $currentSlide = slider.find($controlSelector + '.active').index(); 17361 17362 if ($currentSlide + 1 == $slideLength) { 17363 slider.find($controlSelector + ':first-child').trigger('click'); 17364 } else { 17365 slider.find($controlSelector + '.active').next($controlSelectorInd).trigger('click'); 17366 } 17367 } 17368 17369 17370 /** 17371 * Salient slider rotation reset 17372 * 17373 * @since 10.5 17374 */ 17375 function nectarCustomSliderResetRotate(slider, index) { 17376 clearInterval($nectarCustomSliderRotate[index].autorotate); 17377 17378 // Reinit autorotate 17379 if (slider.attr('data-autorotate').length > 0) { 17380 var slide_interval = (parseInt(slider.attr('data-autorotate')) < 100) ? 4000 : parseInt(slider.attr('data-autorotate')); 17381 $nectarCustomSliderRotate[index].autorotate = setInterval(function () { 17382 nectarCustomSliderRotate(slider) 17383 }, slide_interval); 17384 } 17385 } 17386 17387 17388 17389 /** 17390 * Fullscreen recent project slider 17391 * 17392 * @since 10.5 17393 */ 17394 function fsProjectSliderInit() { 17395 17396 $fsProjectSliderArr = []; 17397 17398 if (typeof SalientRecentProjectsFullScreen === 'undefined') { 17399 return; 17400 } 17401 17402 $('.nectar_fullscreen_zoom_recent_projects').each(function (i) { 17403 $fsProjectSliderArr[i] = new SalientRecentProjectsFullScreen($(this)); 17404 }); 17405 17406 } 17407 17408 17409 17410 17411 17412 /** 17413 * Portfolio single template sticky sidebar 17414 * 17415 * @since 6.0 17416 */ 17417 function portfolioSidebarFollow() { 17418 17419 var sidebarFollow = $('.single-portfolio #sidebar').attr('data-follow-on-scroll'); 17420 17421 if ($('body.single-portfolio').length == 0 || $('#sidebar[data-follow-on-scroll]').length == 0) { 17422 return; 17423 } 17424 17425 sidebarFollow = $('.single-portfolio #sidebar').attr('data-follow-on-scroll'); 17426 17427 if (sidebarFollow == 1 && 17428 !$body.hasClass('mobile') && 17429 parseInt($('#sidebar').height()) + 50 <= parseInt($('.post-area').height())) { 17430 17431 //padding from top of screen 17432 var $ssExtraTopSpace = 50; 17433 17434 if ($('#header-outer[data-remove-fixed="0"]').length > 0 && 17435 $('body[data-hhun="1"]').length == 0) { 17436 17437 $ssExtraTopSpace += $headerOuterEl.outerHeight(); 17438 17439 // Resize effect 17440 if ($('#header-outer[data-shrink-num][data-header-resize="1"]').length > 0) { 17441 var headerPadding2 = parseInt($headerOuterEl.attr('data-padding')) - parseInt($headerOuterEl.attr('data-padding')) / 1.8; 17442 $ssExtraTopSpace -= logoShrinkNum; 17443 $ssExtraTopSpace -= headerPadding2; 17444 } 17445 17446 // Condense 17447 if ($('body.mobile').length == 0 && $('#header-outer[data-condense="true"]').length > 0) { 17448 17449 var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'); 17450 17451 $ssExtraTopSpace = 50; 17452 $ssExtraTopSpace += $headerOuterEl.height() - (parseInt($headerSpan9.position().top) - parseInt($('#header-outer #logo').css('margin-top'))) - parseInt(nectarDOMInfo.secondaryHeaderHeight); 17453 } 17454 17455 } 17456 17457 if ($wpAdminBar.length > 0) { 17458 $ssExtraTopSpace += $wpAdminBar.outerHeight(); 17459 } 17460 17461 17462 $('.single-portfolio #sidebar').theiaStickySidebar({ 17463 additionalMarginTop: $ssExtraTopSpace, 17464 updateSidebarHeight: false 17465 }); 17466 17467 17468 } 17469 17470 } 17471 17472 17473 17474 17475 17476 /** 17477 * Infinite scroll pagination 17478 * 17479 * @since 6.0 17480 */ 17481 function infiniteScrollInit() { 17482 17483 if ($('.infinite_scroll').length > 0) { 17484 17485 // Portfolio 17486 $('.portfolio-items.infinite_scroll').infinitescroll({ 17487 navSelector: "div#pagination", 17488 nextSelector: "div#pagination a:first", 17489 itemSelector: ".portfolio-items.infinite_scroll .element", 17490 finishedMsg: "<em>Congratulations, you've reached the end of the internet.</em>", 17491 msgText: " ", 17492 }, function (newElements) { 17493 17494 17495 var $container = $('.portfolio-items.infinite_scroll:not(.carousel)'), 17496 $newElems = $(newElements).css('opacity', 0); 17497 17498 // Ensure that images load before adding to masonry layout 17499 $newElems.imagesLoaded(function () { 17500 17501 $(newElements).css('opacity', 1); 17502 17503 $container.isotope('appended', $(newElements)); 17504 17505 $(newElements).find('.work-item').addClass('ajax-loaded'); 17506 $(newElements).addClass('ajax-loaded'); 17507
17508 // Show elems now they're ready 17509 $(newElements).find('.work-meta, .nectar-love-wrap').css({ 17510 'opacity': 1 17511 }); 17512 17513 // Keep current filtering 17514 if ($('.portfolio-filters-inline').length > 0 || $('.portfolio-filters').length > 0) { 17515 17516 var selector; 17517 17518 if ($('.portfolio-filters-inline').length > 0) { 17519 selector = $('.portfolio-filters-inline a.active').attr('data-filter'); 17520 } else { 17521 selector = $('.portfolio-filters a.active').attr('data-filter'); 17522 } 17523 17524 $('.portfolio-filters-inline a.active').attr('data-filter'); 17525 $container.isotope({ 17526 filter: selector 17527 }); 17528 } 17529 17530 // Set width 17531 for (var i = 0; i < $portfolio_containers.length; i++) { 17532 $portfolio_containers[i].reLayout(); 17533 } 17534 17535 if ($(newElements).find('.work-item.style-5').length > 0) { 17536 parallaxItemHoverEffect(); 17537 } 17538 17539 if ($(newElements).find('.inner-wrap').attr('data-animation') == 'none') { 17540 $('.portfolio-items .col .inner-wrap').removeClass('animated'); 17541 } else { 17542 17543 for (var i = 0; i < $portfolio_containers.length; i++) { 17544 $portfolio_containers[i].masonryZindex(); 17545 $portfolio_containers[i].portfolioAccentColor(); 17546 } 17547 17548 $(newElements).each(function () { 17549 17550 var $portfolioOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '90%'; 17551 17552 // Not already visible 17553 var $that = $(this); 17554 var waypoint = new Waypoint({ 17555 element: $that, 17556 handler: function () { 17557 17558 var $portfolioAnimationDelay = ($that.is('[data-masonry-type="photography"].masonry-items')) ? 85 : 115; 17559 17560 setTimeout(function () { 17561 $that.addClass("animated-in"); 17562 }, $portfolioAnimationDelay * $that.attr('data-delay-amount')); 17563 17564 17565 waypoint.destroy(); 17566 }, 17567 offset: $portfolioOffsetPos 17568 17569 }); 17570 17571 17572 }); 17573 } 17574 17575 17576 // Lightbox reinit. 17577 $('.portfolio-items').each(function () { 17578 var $unique_id = uniqueIdGenerate(); 17579 $(this).find('a[rel^="prettyPhoto"], a.pretty_photo').attr('rel', 'prettyPhoto[' + $unique_id + '_gal]').removeClass('pretty_photo'); 17580 });
17581 17582 17583 $('.portfolio-items').each(function () { 17584 var $unique_id = uniqueIdGenerate(); 17585 $(this).find('a[data-fancybox^="group_"]').attr('data-fancybox', 'group_' + $unique_id); 17586 }); 17587 17588 lightBoxInit(); 17589 17590 setTimeout(function () { 17591 17592 for (var i = 0; i < $portfolio_containers.length; i++) { 17593 $portfolio_containers[i].masonryZindex(); 17594 $portfolio_containers[i].reLayout(); 17595 $portfolio_containers[i].isotopeCatSelection(); 17596 } 17597 $(newElements).removeClass('ajax-loaded'); 17598 }, 700); 17599 17600 parallaxRowsBGCals(); 17601 17602 }); 17603 17604 17605 }); 17606 17607 // Blog 17608 $('.post-area.infinite_scroll .posts-container').infinitescroll({ 17609 navSelector: "div#pagination", 17610 nextSelector: "div#pagination a:first", 17611 itemSelector: ".post-area.infinite_scroll .posts-container .post", 17612 finishedMsg: "<em>Congratulations, you've reached the end of the internet.</em>", 17613 msgText: " " 17614 }, function (newElements) { 17615 17616 if($(newElements).find('[data-nectar-img-src]').length > 0) { 17617 nectarLazyImageLoading(); 17618 } 17619 17620 // Only trigger recalc of waypoints and elements if needed. 17621 if ($('.masonry.classic').length > 0 || 17622 $('.post-area:not(.masonry):not(.featured_img_left)').length > 0 || 17623 $('.post-area.standard-minimal').length > 0) { 17624 17625 // Gallery. 17626 flexsliderInit(); 17627 17628 // Media players. 17629 if ($().mediaelementplayer) { 17630 $(newElements).find('.wp-audio-shortcode, .wp-video-shortcode').mediaelementplayer(); 17631 } 17632 17633 // Lightbox. 17634 lightBoxInit(); 17635 17636 // Carousels. 17637 if ($('.carousel').length > 0) { 17638 standardCarouselInit(); 17639 clientsCarouselInit(); 17640 } 17641 17642 // Waypoints. 17643 waypoints(); 17644 17645 // Testimonial slider. 17646 $('.testimonial_slider').animate({ 17647 'opacity': '1' 17648 }, 800); 17649 nectarTestimonialSliders(); 17650 nectarTestimonialSlidersEvents(); 17651 17652 setTimeout(function () { 17653 responsiveVideoIframesInit(); 17654 responsiveVideoIframes(); 17655 $window.trigger('resize'); 17656 }, 500); 17657 17658 17659 parallaxRowsBGCals(); 17660 17661 $window.trigger('resize'); 17662 17663 } // Non meta overlaid style. 17664 else { 17665 parallaxRowsBGCals(); 17666 17667 $window.trigger('resize'); 17668 } 17669 17670 // Trigger Masonry as a callback. 17671 var $container = $('.infinite_scroll .posts-container'); 17672 if ($container.parent().hasClass('masonry')) { 17673 17674 $(newElements).addClass('masonry-blog-item'); 17675 17676 17677 } //if masonry. 17678 17679 17680 // Loading effect. 17681 17682 //// hide new items while they are loading. 17683 var $newElems = $(newElements); 17684 //// ensure that images load before adding to masonry layout. 17685 17686 if ($newElems.find('img').length == 0) { 17687 $newElems = $('body'); 17688 } 17689 17690 $newElems.imagesLoaded(function () { 17691 17692 if ($container.parent().hasClass('masonry') && 17693 !$container.parent().hasClass('auto_meta_overlaid_spaced')) { 17694 $container.isotope('appended', $(newElements)); 17695 } 17696 17697 for (var i = 0; i < $nectarMasonryBlogs.length; i++) { 17698 $nectarMasonryBlogs[i].flickityBlogInit(); 17699 } 17700 17701 $(newElements).addClass('ajax-loaded');
17702 // Show elems now they're ready. 17703 17704 // Classic enhanced specific 17705 if ($container.parent().hasClass('classic_enhanced')) { 17706 $container.find('.large_featured.has-post-thumbnail.ajax-loaded .post-featured-img, .wide_tall.has-post-thumbnail.ajax-loaded .post-featured-img').each(function () { 17707 var $src = $(this).find('img').attr('src'); 17708 $(this).css('background-image', 'url(' + $src + ')'); 17709 }); 17710 17711 $container.find('.large_featured.ajax-loaded .nectar-flickity, .wide_tall.ajax-loaded .nectar-flickity').each(function () { 17712 17713 $(this).find('.cell').each(function () { 17714 var $src = $(this).find('img').attr('src'); 17715 $(this).css('background-image', 'url(' + $src + ')'); 17716 }); 17717 17718 }); 17719 } 17720 17721 17722 if ($(newElements).parents('.posts-container').attr('data-animation') == 'none') { 17723 $(newElements).find('.inner-wrap').removeClass('animated'); 17724 } else { 17725 17726 for (var i = 0; i < $nectarMasonryBlogs.length; i++) { 17727 $nectarMasonryBlogs[i].blogMasonryZindex(); 17728 } 17729 17730 $(newElements).each(function () { 17731 17732 var $that = $(this); 17733 var waypoint = new Waypoint({ 17734 17735 element: $that, 17736 handler: function () { 17737 17738 setTimeout(function () { 17739 $that.addClass("animated-in"); 17740 }, 80 * $that.attr('data-delay-amount')); 17741 17742 waypoint.destroy(); 17743 }, 17744 offset: '90%' 17745 17746 }); 17747 17748 17749 }); 17750 } 17751 17752 setTimeout(function () { 17753 $(newElements).removeClass('ajax-loaded'); 17754 }, 700); 17755 17756 17757 }); 17758 17759 17760 }); 17761 17762 } 17763 17764 } 17765 17766 17767 17768 17769 17770 17771 /** 17772 * Scroll to top scroll bind. 17773 * 17774 * @since 2.0 17775 */ 17776 function toTopBind() { 17777 17778 if ($('#to-top').length > 0 && $window.width() > 1020 || 17779 $('#to-top').length > 0 && $('#to-top.mobile-enabled').length > 0) { 17780 17781 if (nectarDOMInfo.scrollTop > 350) { 17782 $window.on('scroll', hideToTop); 17783 } else { 17784 $window.on('scroll', showToTop); 17785 } 17786 } 17787 17788 } 17789 17790 /** 17791 * Scroll to top show. 17792 * 17793 * @since 2.0 17794 */ 17795 function showToTop() { 17796 17797 if (nectarDOMInfo.scrollTop > 350 && !$offCanvasEl.is('.fullscreen.open') ) { 17798 17799 $('#to-top').stop().transition({ 17800 'transform': 'translateY(-50%)' 17801 }, 350, 'easeInOutCubic'); 17802 17803 $window.off('scroll', showToTop); 17804 $window.on('scroll', hideToTop); 17805 } 17806 17807 } 17808 17809 17810 /** 17811 * Scroll to top hide. 17812 * 17813 * @since 2.0 17814 */ 17815 function hideToTop() { 17816 17817 if (nectarDOMInfo.scrollTop < 350 || $offCanvasEl.is('.fullscreen.open') ) { 17818 17819 var $animationTiming = ($('#slide-out-widget-area.fullscreen.open').length > 0) ? 1150 : 350; 17820 17821 $('#to-top').stop().transition({ 17822 'transform': 'translateY(105%)' 17823 }, $animationTiming, 'easeInOutQuint'); 17824 17825 $window.off('scroll', hideToTop); 17826 $window.on('scroll', showToTop); 17827 17828 } 17829 } 17830 17831 17832 /** 17833 * Scroll to top initialization. 17834 * 17835 * @since 10.5 17836 */ 17837 function scrollToTopInit() { 17838 17839 // Show/hide based on scroll pos 17840 if ($('.nectar-social.fixed').length == 0) { 17841 toTopBind(); 17842 } 17843 17844 17845 // Rounded style 17846 if ($('body[data-button-style*="rounded"]').length > 0) { 17847 var $clone = $('#to-top .fa-angle-up').clone(); 17848 $clone.addClass('top-icon'); 17849 $('#to-top').prepend($clone); 17850 } 17851 17852 // Scroll up click event 17853 $body.on('click', '#to-top, a[href="#top"]', function () { 17854 $('body,html').stop().animate({ 17855 scrollTop: 0 17856 }, 800, 'easeOutQuad', function () { 17857 if ($('.nectar-box-roll').length > 0) { 17858 $body.trigger('mousewheel', [1, 0, 0]); 17859 } 17860 }); 17861 return false; 17862 }); 17863 17864 } 17865 17866 17867 17868 17869 17870 17871 17872 17873 17874 /** 17875 * Scrollspy plugin initialization. 17876 * 17877 * @since 5.0 17878 */ 17879 function scrollSpyInit() { 17880 17881 var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $window.width() > 1000) ? 0 : $headerOuterEl.outerHeight(); 17882 17883 if ($('.page-template-template-no-header-footer').length > 0 || $('.page-template-template-no-header').length > 0) { 17884 $headerNavSpace = 0; 17885 } 17886 17887 // Track whether scrollspy is really needed. 17888 var hashLinksFound = false; 17889 17890 //prevent jump to top on empty items 17891 $('header#top .sf-menu li a[href="#"]').on('click', function (e) { 17892 e.preventDefault(); 17893 });
17894 17895 if ($('#nectar_fullscreen_rows').length == 0 || $nectarFullPage.$usingFullScreenRows == false) { 17896 17897 $('a.nectar-next-section').each(function () { 17898 17899 if ($(this).parents('.wpb_row:not(.inner_row)').length > 0) { 17900 17901 var $parentRow = $(this).parents('.wpb_row:not(.inner_row)'); 17902 17903 if ($parentRow.next('.wpb_row[id]:not(.inner_row)').length > 0) { 17904 17905 var $nextRowID = $parentRow.next('.wpb_row[id]:not(.inner_row)').attr('id'); 17906 $(this).attr('href', '#' + $nextRowID); 17907 hashLinksFound = true; 17908 } 17909 17910 } 17911 17912 }); 17913 } 17914 17915 else if ($().fullpage) { 17916 $('a.nectar-next-section').on('click', function () { 17917 $.fn.fullpage.moveSectionDown(); 17918 return false; 17919 }); 17920 } 17921 17922 17923 // Links in off canvas menu. 17924 if ($('#slide-out-widget-area .off-canvas-menu-container').length > 0) { 17925 $('#slide-out-widget-area .off-canvas-menu-container').find("a[href*='" + location.pathname + "']").each(function () { 17926 17927 var $href = $(this).attr('href'); 17928 17929 // Regular animated anchors. 17930 if ($href != '#' && 17931 $href.indexOf("#") != -1 && 17932 $href.substr($href.indexOf("#")) !== '#' && 17933 $('div' + $href.substr($href.indexOf("#"))).length > 0) { 17934 17935 $(this).attr('href', $href.substr($href.indexOf("#"))); 17936 17937 $(this).parent() 17938 .removeClass('current_page_item') 17939 .removeClass('current-menu-item'); 17940 17941 } 17942 17943 // Fullpage is a little different. 17944 if ($('div[data-fullscreen-anchor-id="' + $href.substr($href.indexOf("#") + 1) + '"]').length > 0) { 17945 17946 $(this).parent() 17947 .removeClass('current_page_item') 17948 .removeClass('current-menu-item'); 17949 17950 } 17951 17952 }); 17953 } 17954 17955 // Links in header navigation. 17956 $("#header-outer").find("a[href*='" + location.pathname + "']").each(function () { 17957 17958 var $href = $(this).attr('href'); 17959 17960 // Regular animated anchors 17961 if ($href.indexOf("#") != -1 && 17962 $href.substr($href.indexOf("#")) !== '#' && 17963 $('div' + $href.substr($href.indexOf("#"))).length > 0) { 17964 17965 $(this).attr('href', $href.substr($href.indexOf("#"))); 17966 $(this).parent() 17967 .removeClass('current_page_item') 17968 .removeClass('current-menu-item'); 17969 17970 } 17971 17972 // Fullpage is a little different 17973 if ($('div[data-fullscreen-anchor-id="' + $href.substr($href.indexOf("#") + 1) + '"]').length > 0) { 17974 17975 $(this).parent() 17976 .removeClass('current_page_item') 17977 .removeClass('current-menu-item'); 17978 17979 } 17980 17981 }); 17982 17983 // Hash links in menu? 17984 if( $("#header-outer").length > 0 ) { 17985 $("#header-outer").find("a[href*='#']:not([href='#'])").each(function() { 17986 if( $(this).attr('href') !== '#' && 17987 $(this).attr('href') !== '#searchbox' && 17988 $(this).attr('href') !== '#sidewidgetarea') { 17989 hashLinksFound = true; 17990 } 17991 }); 17992 } 17993 17994 if( $("#slide-out-widget-area .off-canvas-menu-container").length > 0 ) { 17995 $("#slide-out-widget-area .off-canvas-menu-container").find("a[href*='#']:not([href='#'])").each(function() { 17996 if( $(this).attr('href') !== '#' ) { 17997 hashLinksFound = true; 17998 } 17999 }); 18000 } 18001 18002 // Init scrollspy. 18003 var targetList = []; 18004 if( hashLinksFound == true ) { 18005 targetList.push('#header-outer nav'); 18006 } 18007 if( $('.page-submenu[data-sticky="true"] a[href*="#"]').length > 0 ) { 18008 targetList.push('.page-submenu[data-sticky="true"]'); 18009 } 18010 18011 if( targetList.length > 0 ) { 18012 targetList.forEach(function(tar, i) { 18013 var $el = (i == 0) ? $body : $(window); 18014 $el.scrollspy({ 18015 target: tar, 18016 offset: $headerNavSpace + nectarDOMInfo.adminBarHeight + 40 18017 }); 18018 }); 18019 } 18020 18021 } 18022 18023 18024 18025 18026 /** 18027 * Called to scroll to hash link on page load 18028 * 18029 * @since 5.0 18030 */ 18031 function pageLoadHash() { 18032 18033 var $hash = window.location.hash; 18034 18035 if( $hash && $hash.length > 0 ) { 18036 $hash = $hash.replace(/<|>/g,''); 18037 } 18038 18039 var $hashSubstrng = ($hash && $hash.length > 0) ? $hash.substring(1, $hash.length) : 0, 18040 headerPadding2 = headerPadding - headerPadding / 1.8, 18041 $hasSlashLength = 0; 18042 18043 18044 // If the hash has slashes 18045 if ($hashSubstrng) { 18046 $hasSlashLength = $hashSubstrng.split("/"); 18047 $hasSlashLength = $hasSlashLength.length; 18048 } 18049 18050 if ($hashSubstrng && $hasSlashLength > 1) { 18051 $hashSubstrng = $hashSubstrng.replace(/\//g, ""); 18052 $hash = $hash.replace(/\//g, ""); 18053 } 18054 18055 if ($hash && $('.main-content').find($hash).length > 0 || 18056 $hash && $('.main-content').find('[data-fullscreen-anchor-id="' + $hashSubstrng + '"]').length > 0) { 18057 18058 var $hashObj = ($('.main-content').find($hash).length > 0) ? $('.main-content').find($hash) : $('.main-content').find('[data-fullscreen-anchor-id="' + $hashSubstrng + '"]'), 18059 $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $window.width() > 1000) ? 0 : $('#header-space').outerHeight(); 18060 18061 if ($('.page-template-template-no-header-footer').length > 0 || $('.page-template-template-no-header').length > 0) { 18062 $headerNavSpace = 0; 18063 } 18064 18065 var $timeoutVar = 100; 18066 18067 if ($('.nectar-box-roll').length > 0 && $('.container-wrap.bottomBoxOut').length > 0) { 18068 nectarBoxRoll.boxRoll(null, -1); 18069 $timeoutVar = 2050; 18070 } 18071 18072 setTimeout(function () { 18073 18074 var $scrollTopDistance; 18075 18076 if ($('body[data-permanent-transparent="1"]').length == 0) { 18077 18078 if (!$body.hasClass('mobile')) { 18079 var $resize = ($('#header-outer[data-header-resize="0"]').length > 0) ? 0 : parseInt(logoShrinkNum) + headerPadding2 * 2; 18080 if ($('#header-outer[data-remove-fixed="1"]').length > 0) { 18081 $headerNavSpace = 0; 18082 } 18083 $scrollTopDistance = $hashObj.offset().top - parseInt($headerNavSpace) + $resize + 3 - nectarDOMInfo.adminBarHeight; 18084 18085 18086 // Condense 18087 if ($('body.mobile').length == 0 && 18088 $('#header-outer[data-condense="true"]').length > 0 && 18089 $('body.page-template-template-no-header').length === 0 && 18090 $('body.page-template-template-no-header-footer').length === 0) { 18091 18092 var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'), 18093 $headerHeightStored = $headerOuterEl.height(),
18094 $headerHeightCondensed = $headerHeightStored - (parseInt($headerSpan9.height()) + parseInt($('#header-outer #logo').css('margin-top'))); 18095 18096 $scrollTopDistance = $hashObj.offset().top - parseInt($headerNavSpace) + $headerHeightCondensed - nectarDOMInfo.adminBarHeight; 18097 } 18098 18099 } else { 18100 $scrollTopDistance = ($('#header-outer[data-mobile-fixed="1"]').length > 0) ? $hashObj.offset().top + 2 - $headerNavSpace + nectarDOMInfo.adminBarHeight : $hashObj.offset().top - nectarDOMInfo.adminBarHeight + 1; 18101 } 18102 18103 } else { 18104 $scrollTopDistance = $hashObj.offset().top - nectarDOMInfo.adminBarHeight + 1; 18105 } 18106 18107 if ($('body[data-hhun="1"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length == 0) { 18108 18109 // Alter offset 18110 if ($('#header-outer.detached').length == 0) { 18111 $scrollTopDistance = $scrollTopDistance + $headerNavSpace; 18112 } 18113 } 18114 18115 var $pageSubMenu = ($('.page-submenu[data-sticky="true"]').length > 0) ? $('.page-submenu').height() : 0; 18116 var $headerSecondary; 18117 18118 if ($('body.material').length > 0 && 18119 $headerSecondaryEl.length > 0 && 18120 $('body[data-hhun="1"]').length == 0 && 18121 $('#header-outer[data-remove-fixed="1"]').length == 0 && 18122 !$body.hasClass('mobile')) { 18123 18124 $headerSecondary = $headerSecondaryEl.height(); 18125 18126 } else { 18127 $headerSecondary = 0; 18128 } 18129 18130 nectar_scrollToY($scrollTopDistance - $pageSubMenu + $headerSecondary, 700, 'easeInOutQuint'); 18131 18132 }, $timeoutVar); 18133 } 18134 } 18135 18136 18137 /** 18138 * Initialize page load hash functionality 18139 * 18140 * @since 10.5 18141 */ 18142 function pageLoadHashInit() { 18143 18144 if ($('body[data-animated-anchors="true"]').length > 0) { 18145 if ($('.nectar-box-roll').length == 0 && $('#nectar_fullscreen_rows').length == 0) { 18146 18147 // Inside tabs 18148 if (typeof nectarGetQueryParam['tab'] != 'undefined') { 18149 setTimeout(function () { 18150 pageLoadHash(); 18151 }, 800); 18152 } 18153 // Regular 18154 else { 18155 pageLoadHash(); 18156 } 18157 18158 } 18159 18160 if ($('#nectar_fullscreen_rows[data-mobile-disable="on"]').length > 0 && $('.nectar-box-roll').length == 0 && 18161 nectarDOMInfo.usingMobileBrowser) { 18162 pageLoadHash(); 18163 } 18164 18165 } 18166 18167 } 18168 18169 18170 /** 18171 * Animated anchor link theme option. 18172 * 18173 * @since 10.5 18174 */ 18175 function animatedAnchorLinks() { 18176 18177 if ($('body[data-animated-anchors="true"]').length > 0 || 18178 $('.single-product [data-gallery-style="left_thumb_sticky"]').length > 0) { 18179 18180 var headerPadding2 = headerPadding - headerPadding / 1.8; 18181 18182 setTimeout(scrollSpyInit, 200); 18183 18184 var $animatedScrollingTimeout; 18185 18186 $body.on('click', '#header-outer nav .sf-menu a, #footer-outer .nectar-button, #footer-outer .widget_nav_menu a, #mobile-menu li a, .nectar-scrolling-tabs .scrolling-tab-nav a, .container-wrap a:not(.wpb_tabs_nav 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) { 18187 18188 var triggerAnimatedScroll = true; 18189 var $hash = $(this).prop("hash"); 18190 18191 if( !$(this).hasClass('nectar-next-section') && headerHideUntilNeeded == '1' ) { 18192 $body.addClass('animated-scrolling'); 18193 nectarState.animatedScrolling = true; 18194 } 18195 18196 clearTimeout($animatedScrollingTimeout); 18197 18198 $animatedScrollingTimeout = setTimeout(function () { 18199 $body.removeClass('animated-scrolling'); 18200 nectarState.animatedScrolling = false; 18201 }, 850); 18202 18203 var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $window.width() > 1000) ? 0 : $('#header-space').outerHeight(); 18204 18205 if ($('.page-template-template-no-header-footer').length > 0 || 18206 $('.page-template-template-no-header').length > 0 || 18207 $('#header-space').length == 0 ) { 18208 $headerNavSpace = 0; 18209 } 18210 18211 // Delay full page anchors until material right OCM closes 18212 if ( $nectarFullPage.$usingFullScreenRows != false && 18213 $('#nectar_fullscreen_rows[data-anchors="on"]').length > 0 && 18214 $hash && $hash != '' && $hash != '#top' &&
18215 $('body.material[data-slide-out-widget-area-style="slide-out-from-right"].material-ocm-open').length > 0) { 18216 18217 e.preventDefault(); 18218 18219 if (!$(this).hasClass('skip-hash')) { 18220 if (history.pushState) { 18221 history.pushState(null, null, $hash); 18222 } else { 18223 location.hash = $hash; 18224 } 18225 18226 } 18227 18228 setTimeout(function() { 18229 $(window).trigger('hashchange'); 18230 },800); 18231 18232 } 18233 18234 18235 if ($hash && $body.find($hash).length > 0 && $hash != '#top' && $hash != '' && $(this).attr('href').indexOf(window.location.href.split("#")[0]) !== -1 || 18236 $(this).is('[href^="#"]') && $hash != '' && $body.find($hash).length > 0 && $hash != '#top') { 18237 18238 //update hash 18239 if (!$(this).hasClass('skip-hash')) { 18240 if (history.pushState) { 18241 history.pushState(null, null, $hash); 18242 } else { 18243 location.hash = $hash; 18244 } 18245 } 18246 18247 if ($(this).parents('ul').length > 0) { 18248 18249 $(this) 18250 .parents('ul') 18251 .find('li') 18252 .removeClass('current-menu-item'); 18253 } 18254 18255 // Side widget area click 18256 if ($(this).parents('#slide-out-widget-area').length > 0) { 18257 18258 if ($('body.material[data-slide-out-widget-area-style="slide-out-from-right"].material-ocm-open').length > 0) { 18259 18260 $('body > .slide_out_area_close') 18261 .addClass('non-human-allowed') 18262 .trigger('click'); 18263 18264 // Scroll 18265 var $clickedLinkStore = $(this); 18266 18267 triggerAnimatedScroll = false; 18268 18269 setTimeout(function () { 18270 $clickedLinkStore.trigger('click'); 18271 }, 1000); 18272 18273 } else { 18274 $('#slide-out-widget-area .slide_out_area_close') 18275 .addClass('non-human-allowed') 18276 .trigger('click'); 18277 } 18278 18279 setTimeout(function () { 18280 if ($('body.material[data-slide-out-widget-area-style="slide-out-from-right"]').length > 0) { 18281 $('body > .slide_out_area_close').removeClass('non-human-allowed'); 18282 18283 } else { 18284 $('#slide-out-widget-area .slide_out_area_close').removeClass('non-human-allowed'); 18285 } 18286 }, 100); 18287 } 18288 18289 // Mobile menu click 18290 if ( $(this).parents('#mobile-menu').length > 0 ) { 18291 $('.slide-out-widget-area-toggle.mobile-icon a') 18292 .addClass('non-human-allowed') 18293 .trigger('click'); 18294 18295 setTimeout(function () { 18296 $('.slide-out-widget-area-toggle.mobile-icon a').removeClass('non-human-allowed'); 18297 }, 100); 18298 } 18299 18300 var $mobileMenuHeight = ($(this).parents('#mobile-menu').length > 0) ? $(this).parents('#mobile-menu').height() : null; 18301 var $timeoutVar = 1; 18302 var $that = $(this); 18303 18304 if ($('.nectar-box-roll').length > 0 && $('.container-wrap.bottomBoxOut').length > 0) { 18305 nectarBoxRoll.boxRoll(null, -1); 18306 $timeoutVar = 2050; 18307 } 18308 18309 18310 setTimeout(function () { 18311 18312 var $scrollTopDistance; 18313 18314 // Scrolling 18315 if ($('body[data-permanent-transparent="1"]').length == 0) { 18316 18317 if (!$body.hasClass('mobile')) { 18318 var $resize = ($('#header-outer[data-header-resize="0"]').length > 0) ? 0 : parseInt(logoShrinkNum) + headerPadding2 * 2; 18319 if ($('#header-outer[data-remove-fixed="1"]').length > 0) { 18320 $headerNavSpace = 0; 18321 } 18322 18323 $scrollTopDistance = $($hash).offset().top - $mobileMenuHeight - parseInt($headerNavSpace) + $resize + 3 - nectarDOMInfo.adminBarHeight; 18324 18325 // Condense 18326 if ($('body.mobile').length == 0 && 18327 $('body.page-template-template-no-header').length === 0 && 18328 $('body.page-template-template-no-header-footer').length === 0 && 18329 $('#header-outer[data-condense="true"]').length > 0) { 18330 18331 var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'), 18332 $headerHeightStored = $headerOuterEl.height(),
18333 $headerHeightCondensed = $headerHeightStored - (parseInt($headerSpan9.height()) + parseInt($('#header-outer #logo').css('margin-top'))); 18334 $scrollTopDistance = $($hash).offset().top - parseInt($headerNavSpace) + $headerHeightCondensed - nectarDOMInfo.adminBarHeight; 18335 18336 18337 } 18338 18339 18340 } else { 18341 $scrollTopDistance = ($('#header-outer[data-mobile-fixed="1"]').length > 0) ? $($hash).offset().top + 2 - $headerNavSpace + nectarDOMInfo.adminBarHeight : $($hash).offset().top - $mobileMenuHeight - nectarDOMInfo.adminBarHeight + 1; 18342 } 18343 18344 } else { 18345 $scrollTopDistance = $($hash).offset().top - nectarDOMInfo.adminBarHeight + 1; 18346 } 18347 18348 if ($('body[data-hhun="1"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length == 0) { 18349 18350 // Alter offset 18351 if ($('#header-outer.detached').length == 0 || $that.parents('.page-submenu[data-sticky="true"]').length > 0) { 18352 $scrollTopDistance = $scrollTopDistance + $headerNavSpace; 18353 } 18354 18355 // Hide top header 18356 if ($that.parents('.page-submenu[data-sticky="true"]').length > 0) { 18357 18358 $('#header-outer.detached').addClass('invisible'); 18359 $('.page-submenu') 18360 .addClass('header-not-visible') 18361 .css('transform', 'translateY(0px)'); 18362 18363 } 18364 } 18365 18366 var $pageSubMenu = ($that.parents('.page-submenu[data-sticky="true"]').length > 0) ? $that.parents('.page-submenu').height() : 0; 18367 var $headerSecondary; 18368 18369 if ($('body.material').length > 0 && 18370 $headerSecondaryEl.length > 0 && 18371 $('body[data-hhun="1"]').length == 0 && 18372 $('#header-outer[data-remove-fixed="1"]').length == 0 && 18373 !$body.hasClass('mobile')) { 18374 18375 $headerSecondary = $headerSecondaryEl.height(); 18376 18377 } else { 18378 18379 if($('body[data-hhun="1"]').length > 0 && 18380 $headerSecondaryEl.length > 0 && 18381 !$body.hasClass('mobile') && 18382 $('#header-outer[data-remove-fixed="1"]').length == 0) { 18383 $headerSecondary = $headerSecondaryEl.height(); 18384 } else { 18385 $headerSecondary = 0; 18386 } 18387 18388 } 18389 18390 18391 if( triggerAnimatedScroll ) { 18392 nectar_scrollToY($scrollTopDistance - $pageSubMenu + $headerSecondary, 700, 'easeInOutQuint'); 18393 } 18394 18395 18396 }, $timeoutVar); 18397 18398 e.preventDefault(); 18399 18400 } 18401 18402 if ($hash == '#top') { 18403 // Side widget area click 18404 if ($(this).parents('#slide-out-widget-area').length > 0) { 18405 $('#slide-out-widget-area .slide_out_area_close').trigger('click'); 18406 } 18407 } 18408 18409 }); 18410 18411 18412 } 18413 18414 } 18415 18416 18417 18418 18419 18420 18421 /** 18422 * Search results masonry layout. 18423 * 18424 * @since 10.0 18425 */ 18426 function searchResultMasonry() { 18427 18428 var $searchContainer = $('#search-results'), 18429 $dividerNum = ($searchContainer.is('[data-layout="masonry-no-sidebar"]')) ? 4 : 3; 18430 18431 $searchContainer.imagesLoaded(function () { 18432 18433 $searchContainer.isotope({ 18434 itemSelector: '.result', 18435 layoutMode: 'packery', 18436 packery: { 18437 gutter: 0 18438 } 18439 }); 18440 18441 $searchContainer 18442 .find('article') 18443 .css('opacity', '1'); 18444 18445 }); 18446 18447 $window.on('resize', function () { 18448 18449 $searchContainer.isotope({ 18450 layoutMode: 'packery', 18451 packery: { 18452 gutter: 0 18453 } 18454 }); 18455 }); 18456 18457 } 18458 18459 18460 /** 18461 * Search results masonry layout initialization. 18462 * 18463 * @since 10.5 18464 */ 18465 function searchResultMasonryInit() { 18466 if ($('body.search-results').length > 0 && 18467 $('#search-results article').length > 0 && 18468 $('#search-results[data-layout="list-no-sidebar"]').length == 0 && 18469 $('#search-results[data-layout="list-with-sidebar"]').length == 0) { 18470 searchResultMasonry(); 18471 } 18472 } 18473 18474 18475 18476 18477 /** 18478 * Custom colors for portfolio grid elements. 18479 * 18480 * @since 10.5 18481 */ 18482 function portfolioCustomColoring() { 18483 18484 //portfolio colors 18485 if ($('.portfolio-items .col .style-3-alt').length > 0 || 18486 $('.portfolio-items .col .style-3').length > 0 || 18487 $('.portfolio-items .col .style-2').length > 0 || 18488 $('.portfolio-items .col .style-5').length > 0) { 18489 18490 var portfolioColorCss = ''; 18491 18492 $('.portfolio-items .col').each(function () { 18493 18494 var $titleColor = $(this).attr('data-title-color'), 18495 $subTitleColor = $(this).attr('data-subtitle-color'); 18496 18497 if ($titleColor.length > 0) { 18498 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; } '; 18499 portfolioColorCss += ' .portfolio-items[data-ps="8"] .col[data-title-color="' + $titleColor + '"] .line { background-color: ' + $titleColor + '; }'; 18500 portfolioColorCss += '.portfolio-items[data-ps="8"] .col[data-title-color="' + $titleColor + '"] .next-arrow line { stroke: ' + $titleColor + '; } '; 18501 } 18502 if ($subTitleColor.length > 0) { 18503 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; } '; 18504 } 18505 18506 });
18507 18508 //style 18509 nectarCreateStyle(portfolioColorCss, 'nectar-portfolio-colors'); 18510 18511 } 18512 18513 } 18514 18515 18516 18517 18518 /** 18519 * Single post pagination/recent post mouse events 18520 * 18521 * @since 10.5 18522 */ 18523 function postMouseEvents() { 18524 18525 18526 $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 () { 18527 $(this).parents('.grav-wrap') 18528 .find('img') 18529 .addClass('hovered'); 18530 }); 18531 18532 $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 () { 18533 $(this).parents('.grav-wrap') 18534 .find('img') 18535 .removeClass('hovered'); 18536 }); 18537 18538 $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 () { 18539 $(this).addClass('mouse-leaving'); 18540 }); 18541 18542 } 18543 18544 18545 18546 18547 /** 18548 * Masonry portfolio initialization. 18549 * 18550 * @since 10.5 18551 */ 18552 function masonryPortfolioInit() { 18553 18554 $portfolio_containers = []; 18555 18556 var portfolioElCount = 0; 18557 18558 $('.portfolio-items:not(.carousel)').each(function(i) { 18559 18560 if( $(this).parents('.wpb_gallery').length > 0 && $(this).find('.nectar-lazy').length > 0 ) { 18561 18562 $(this).find('.col').each(function(i) { 18563 $(this).delay(90*i).queue(function(next){ 18564 $(this).addClass("animated-in"); 18565 next(); 18566 });
18567 }); 18568 18569 return true; 18570 } 18571 18572 $(this).attr('instance', i); 18573 $(this).parent().parent().find('div[class^=portfolio-filters]').attr('instance', i); 18574 18575 if (typeof SalientPortfolio !== 'undefined') { 18576 $portfolio_containers[portfolioElCount] = new SalientPortfolio($(this), fullWidthContentColumns); 18577 portfolioElCount++; 18578 } 18579 18580 }); 18581 18582 } 18583 18584 18585 18586 18587 /** 18588 * Perspective load in styling. 18589 * 18590 * @since 8.0 18591 */ 18592 function updatePerspectiveOrigin() { 18593 18594 if( nectarDOMInfo.winW > 690 ) { 18595 $('.posts-container[data-load-animation="perspective"]').css('perspective-origin', '50% ' + (nectarDOMInfo.scrollTop + nectarDOMInfo.winH) + 'px'); 18596 } 18597 requestAnimationFrame(updatePerspectiveOrigin); 18598 18599 } 18600 18601 18602 /** 18603 * Perspective load in styling. 18604 * 18605 * @since 8.0 18606 */ 18607 function updatePerspectiveOriginInit() { 18608 18609 if ($('.posts-container[data-load-animation="perspective"]').length > 0) { 18610 requestAnimationFrame(updatePerspectiveOrigin); 18611 } 18612 18613 } 18614 18615 18616 18617 /** 18618 * Blog load in animation. 18619 * 18620 * @since 3.0 18621 */ 18622 function blogLoadIn(post_container) { 18623 18624 if (post_container.attr('data-load-animation') == 'none') { 18625 18626 post_container 18627 .find('.inner-wrap') 18628 .removeClass('animated'); 18629 18630 } else { 18631 18632 post_container.find('article').each(function (i) { 18633 18634 // Loaded visible 18635 if ($(this).visible(true)) { 18636 18637 $(this).delay(110 * i).queue(function (next) { 18638 $(this).addClass("animated-in"); 18639 next(); 18640 });
18641 18642 18643 } else { 18644 18645 // Not already visible 18646 var $that = $(this); 18647 var waypoint = new Waypoint({ 18648 18649 element: $that, 18650 handler: function () { 18651 18652 setTimeout(function () { 18653 $that.addClass("animated-in"); 18654 }, 80 * $that.attr('data-delay-amount')); 18655 18656 waypoint.destroy(); 18657 }, 18658 offset: '90%' 18659 18660 }); 18661 } 18662 18663 }); 18664 18665 } 18666 18667 } 18668 18669 18670 /** 18671 * Masonry blog initialization. 18672 * 18673 * @since 10.5 18674 */ 18675 function masonryBlogInit() { 18676 18677 $nectarMasonryBlogs = []; 18678 18679 $('.posts-container').each(function (i) { 18680 18681 if ($(this).parent().hasClass('masonry') && !$(this).parent().hasClass('auto_meta_overlaid_spaced')) { 18682 18683 if (typeof NectarMasonryBlog == 'undefined') { 18684 return; 18685 } 18686 18687 $nectarMasonryBlogs[i] = new NectarMasonryBlog($(this), fullWidthSections, blogLoadIn); 18688 18689 } else { 18690 18691 blogLoadIn($(this)); 18692 18693 } 18694 18695 }); 18696 } 18697 18698 18699 18700 /** 18701 * Sticky Sidebar initialization. 18702 * 18703 * @since 10.5 18704 */ 18705 function stickySidebarInit() { 18706 18707 if (!$().theiaStickySidebar || nectarDOMInfo.usingMobileBrowser && nectarDOMInfo.winW < 1000 ) { 18708 return; 18709 } 18710 18711 var stickySelectors = '#sidebar[data-nectar-ss="true"], #sidebar[data-nectar-ss="1"], .nectar-scrolling-tabs .scrolling-tab-nav'; 18712 if( window.nectarOptions && window.nectarOptions.woo_sticky_sidebar && window.nectarOptions.woo_sticky_sidebar === '1' ) { 18713 stickySelectors += ', .woocommerce.archive #sidebar'; 18714 } 18715 18716 $(stickySelectors).each(function () { 18717 18718 // Padding from top of screen 18719 var $ssExtraTopSpace = 50; 18720 18721 if ($('#header-outer[data-remove-fixed="0"]').length > 0 && 18722 $('body[data-hhun="1"]').length == 0 && 18723 $('#header-outer[data-format="left-header"]').length == 0) { 18724 18725 $ssExtraTopSpace += $headerOuterEl.outerHeight(); 18726 18727 // Resize effect 18728 if ($('#header-outer[data-shrink-num][data-header-resize="1"]').length > 0) { 18729 var headerPadding2 = parseInt($headerOuterEl.attr('data-padding')) - parseInt($headerOuterEl.attr('data-padding')) / 1.8; 18730 $ssExtraTopSpace -= logoShrinkNum; 18731 $ssExtraTopSpace -= headerPadding2; 18732 } 18733 18734 // Condense 18735 if ($('body.mobile').length == 0 && $('#header-outer[data-condense="true"]').length > 0) { 18736 18737 var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'); 18738 $ssExtraTopSpace = 50; 18739 $ssExtraTopSpace += $headerOuterEl.height() - (parseInt($headerSpan9.position().top) - parseInt($('#header-outer #logo').css('margin-top'))) - parseInt(nectarDOMInfo.secondaryHeaderHeight); 18740 } 18741 18742 } 18743 18744 if ($wpAdminBar.length > 0) { 18745 $ssExtraTopSpace += $wpAdminBar.outerHeight(); 18746 } 18747 18748 18749 if ($(this).parents('.wpb_widgetised_column').length > 0) { 18750 18751 if ($('body.vc_editor').length > 0) { 18752 // Skip processing. 18753 } else { 18754 $(this).parents('.wpb_column').theiaStickySidebar({ 18755 additionalMarginTop: $ssExtraTopSpace, 18756 updateSidebarHeight: false 18757 });
18758 } 18759 18760 } else { 18761 $(this).theiaStickySidebar({ 18762 additionalMarginTop: $ssExtraTopSpace, 18763 updateSidebarHeight: false 18764 }); 18765 } 18766 18767 }); 18768 } 18769 18770 18771 18772 18773 18774 /** 18775 * Section down arrow animated link 18776 * 18777 * @since 10.5 18778 */ 18779 function sectionDownArrowEvent() { 18780 18781 var headerPadding2 = headerPadding - headerPadding / 1.8; 18782 18783 $body.on('click', '.section-down-arrow, .scroll-down-wrap > .minimal-arrow', function () { 18784 18785 if ($(this).parents('.nectar-box-roll').length > 0) { 18786 return false; 18787 } 18788 18789 var $currentSection = $(this).parents('#page-header-bg'), 18790 $topDistance = $currentSection.height(), 18791 $offset = ($currentSection.parents('.first-section').length == 0 || $('body[data-transparent-header="false"]').length > 0) ? $currentSection.offset().top : 0, 18792 $bodyBorderSize = ($bodyBorderTop.length > 0 && $window.width() > 1000) ? $bodyBorderTop.height() : 0, 18793 $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0) ? 0 : $('#header-space').height(), 18794 $materialSecondary = 0; 18795 18796 if ($('body.material').length > 0 && $headerSecondaryEl.length > 0) { 18797 $materialSecondary = $headerSecondaryEl.height(); 18798 } 18799 18800 if ($('body[data-permanent-transparent="1"]').length == 0) { 18801 18802 // Regular 18803 if (!$body.hasClass('mobile')) { 18804 18805 if ($('body[data-hhun="1"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length == 0) { 18806 18807 nectar_scrollToY(parseInt($topDistance) + $offset + 2 - $bodyBorderSize * 2, 700, 'easeInOutQuint'); 18808 18809 } else { 18810 18811 var $resize = ($('#header-outer[data-header-resize="0"]').length > 0) ? 0 : parseInt(logoShrinkNum) + headerPadding2 * 2; 18812 if ($('#header-outer[data-remove-fixed="1"]').length > 0) { 18813 $headerNavSpace = 0; 18814 $offset = 0; 18815 } 18816 18817 // Condense 18818 if ($('body.mobile').length == 0 && $('#header-outer[data-condense="true"]').length > 0) { 18819 var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'); 18820 $headerNavSpace = $headerOuterEl.height() - (parseInt($headerSpan9.position().top) - parseInt($('#header-outer #logo').css('margin-top'))) - parseInt(nectarDOMInfo.secondaryHeaderHeight); 18821 } 18822 18823 nectar_scrollToY(parseInt($topDistance - $headerNavSpace) + $resize + 3 + $offset + $materialSecondary, 700, 'easeInOutQuint'); 18824 18825 } 18826 18827 } else { 18828 18829 var $scrollPos; 18830 18831 if($('#header-outer[data-mobile-fixed="1"]').length > 0) { 18832 $scrollPos = parseInt($topDistance) - $headerNavSpace + parseInt($currentSection.offset().top) + 2; 18833 } else { 18834 $scrollPos = parseInt($topDistance) + parseInt($currentSection.offset().top) + 2; 18835 } 18836 18837 nectar_scrollToY($scrollPos - $bodyBorderSize * 2, 700, 'easeInOutQuint'); 18838 18839 } 18840 18841 } else { 18842 // Permanent transparent 18843 nectar_scrollToY(parseInt($topDistance) + parseInt($currentSection.offset().top) + 2 - $bodyBorderSize * 2, 700, 'easeInOutQuint'); 18844 18845 } 18846 return false; 18847 }); 18848 18849 } 18850 18851 18852 18853 18854 18855 /** 18856 * Displace filter column/row BG effect - fullpage 18857 * 18858 * @since 10.5 18859 */ 18860 function nectarLiquidBGFP() { 18861 18862 $('.nectar-liquid-bg').removeClass('animated-in'); 18863 18864 for (var k = 0; k < $liquidBG_EL.length; k++) { 18865 18866 if ($liquidBG_EL[k].animationType == 'displace-filter-fade' && $($liquidBG_EL[k].canvasContainer).parents('.fp-section.active').length > 0) { 18867 18868 //add bg to container 18869 if ($($liquidBG_EL[k].canvasContainer).find('.image-added-to-stage').length == 0) { 18870 $liquidBG_EL[k].imgContainer.addChild($liquidBG_EL[k].bg); 18871 } 18872 18873 $($liquidBG_EL[k].canvasContainer) 18874 .find('.nectar-liquid-bg') 18875 .addClass('image-added-to-stage'); 18876 18877 $liquidBG_EL[k].animateProps($liquidBG_EL[k]); 18878 18879 } 18880 } 18881 } 18882 18883 18884 /** 18885 * Page Full Screen Rows 18886 * 18887 * @since 10.5 18888 */ 18889 function nectarFullPageInit() { 18890 18891 if ($('#nectar_fullscreen_rows').length > 0 && $().fullpage) { 18892 18893 $fullscreenSelector = (window.vc_iframe) ? '.vc_element.vc_vc_row.active ' : '.wpb_row.active '; 18894 18895 var $disableFPonMobile = ($('#nectar_fullscreen_rows[data-mobile-disable]').length > 0) ? $('#nectar_fullscreen_rows').attr('data-mobile-disable') : 'off'; 18896 if( !nectarDOMInfo.usingMobileBrowser ) { 18897 $disableFPonMobile = 'off'; 18898 }
18899 // Support for mobile animation theme option. 18900 if( $disableFPonMobile != 'on' ) { 18901 $fullscreenMarkupBool = true; 18902 } else { 18903 $fullscreenSelector = ''; 18904 } 18905 18906 $nectarFullPage = new NectarFullScreenRows(waypoints, $mouseParallaxScenes, nectarLiquidBGFP, nectarDOMInfo, responsiveTooltips, $standAnimatedColTimeout, $svgIcons); 18907 18908 } 18909 18910 } 18911 18912 18913 18914 18915 /** 18916 * Cross browser adjustments. 18917 * 18918 * @since 1.0 18919 */ 18920 function crossBrowserAdjust() { 18921 18922 // Add specific class if on device for better tablet tracking. 18923 if (nectarDOMInfo.usingMobileBrowser) { 18924 $body.addClass('using-mobile-browser'); 18925 } 18926 18927 // Add class for old IE. 18928 var ua = window.navigator.userAgent; 18929 var msie = ua.indexOf("Edge/"); 18930 if (msie > 0) { 18931 $body.addClass('msie'); 18932 } 18933 18934 // For users updating to 8 with a custom, old header template file 18935 if ($('html.js').length == 0) { 18936 $('html').removeClass('no-js').addClass('js'); 18937 } 18938 18939 //remove br's from code tag 18940 $('code').find('br').remove(); 18941 18942 // Contact form 7. 18943 $('.wpcf7-form p:has(input[type=submit])').css('padding-bottom', '0px'); 18944 18945 $('.full-width-content .wpcf7-submit').on('click', function () { 18946 setTimeout(function () { 18947 fullWidthContentColumns(); 18948 }, 1000); 18949 setTimeout(function () { 18950 fullWidthContentColumns(); 18951 }, 2000); 18952 }); 18953 18954 // Gravity form inside fw content row 18955 $('.gform_body').on('click', function () { 18956 setTimeout(function () { 18957 fullWidthContentColumns(); 18958 }, 200); 18959 }); 18960 18961 // Popup Maker. 18962 $('.pum.pum-theme-salient-page-builder-optimized button.pum-close').wrapInner('<span />'); 18963 18964 // pum inside fspr 18965 if ($('#nectar_fullscreen_rows').length > 0 && 18966 $('.pum-container .pum-content > .wpb_row .full-page-inner > .container > .span_12').length > 0) { 18967 $('.pum-container .pum-content > .wpb_row .full-page-inner > .container > .span_12').unwrap(); 18968 } 18969 18970 // Blog bottom padding 18971 if ($('.single .blog_next_prev_buttons').length > 0) { 18972 $('.container-wrap').css('padding-bottom', 0); 18973 } 18974 18975 // Remove margin on last cols inside of full width sections 18976 $('.full-width-section').each(function () { 18977 $(this).find('> .span_12 > div.col_last').last().css('margin-bottom', '0'); 18978 }); 18979 18980 // Remove boxed style from full width content 18981 $('.full-width-content .col.boxed').removeClass('boxed'); 18982 18983 // Neg marg z-index adjust 18984 $('.wpb_column.neg-marg').parents('.wpb_row').css('z-index', '110'); 18985 18986 // Using full width section shortcode with WPBakery columns. 18987 $('.wpb_row.legacy').each(function(){ 18988 if( $(this).find('.wpb_column').length > 0 ) { 18989 $(this).removeClass('legacy'); 18990 } 18991 }); 18992 18993 } 18994 18995 18996 18997 18998 //vc col mobile fixes 18999 function vcMobileColumns() { 19000 19001 $('.wpb_row').each(function () { 19002 if (typeof $(this).find('.span_12').offset() != 'undefined') { 19003 19004 $(this).find('[class*="vc_col-"]').each(function () { 19005 19006 var $firstChildOffset = $(this).parents('.span_12').offset().left; 19007 19008 $(this).removeClass('no-left-margin'); 19009 19010 if ($(this).offset().left < $firstChildOffset + 27) { 19011 $(this).addClass('no-left-margin'); 19012 } else { 19013 $(this).removeClass('no-left-margin'); 19014 } 19015 });
19016 } 19017 }); 19018 } 19019 19020 function vcMobileColumnsInit() { 19021 19022 var $winDOMWidth = nectarDOMInfo.winW, 19023 $winDOMHeight = nectarDOMInfo.winH, 19024 $orientChangeTrack = 0; 19025 19026 // Only needed in legacy column setups. 19027 if( $body.is('[data-flex-cols="true"]') ) { 19028 return; 19029 } 19030 19031 if ($('[class*="vc_col-xs-"], [class*="vc_col-md-"], [class*="vc_col-lg-"]').length > 0) { 19032 19033 // Trigger immediately. 19034 vcMobileColumns(); 19035 19036 // Resize. 19037 if( !nectarDOMInfo.usingMobileBrowser ) { 19038 // Bind normally for desktop. 19039 $window.on('resize',vcMobileColumns); 19040 } 19041 else { 19042 19043 // For mobile make sure the orientation has changed. 19044 window.addEventListener("orientationchange", function () { 19045 $orientChangeTrack = 1; 19046 }); 19047 19048 $window.on('resize', function () { 19049 19050 if (($window.width() != $winDOMWidth && $window.height != $winDOMHeight) || $orientChangeTrack === 1) { 19051 19052 vcMobileColumns(); 19053 19054 // Store the current window dimensions. 19055 $winDOMWidth = nectarDOMInfo.winW; 19056 $winDOMHeight = nectarDOMInfo.winH; 19057 19058 // Reset orientation change tracker. 19059 $orientChangeTrack = 0; 19060 } 19061 19062 }); 19063 19064 19065 } // end mobile only. 19066 19067 } // endif vc offset cols found. 19068 19069 19070 } 19071 19072 19073 19074 19075 /** 19076 * Select2 plugin initialization. 19077 * 19078 * @since 5.0 19079 */ 19080 function select2Init() { 19081 19082 $('select:not(.state_select):not(.country_select):not(.comment-form-rating #rating):not(#tribe-bar-form select):not(.woocommerce-currency-switcher):not(.nectar-custom-product-attr select)').each(function () { 19083 19084 // Prevent search from triggering on small devices. 19085 var $minimumToSearch = ( nectarDOMInfo.winW > 690 ) ? 7 : 200; 19086 19087 // Skip search class 19088 if( $(this).hasClass('skip-select2-search') || $(this).parents('.skip-select2-search').length > 0 ) { 19089 $minimumToSearch = 1000; 19090 } 19091 19092 if ($(this).parents('#buddypress').length == 0) { 19093 19094 var woo_product_dropdown_style = (window.nectarOptions && window.nectarOptions.woo_product_variable_select ) ? window.nectarOptions.woo_product_variable_select : 'default'; 19095 19096 // Default. 19097 var select2OptionsObj = { 19098 minimumResultsForSearch: $minimumToSearch, 19099 width: '100%' 19100 }; 19101 19102 // Inline scenario els 19103 if( woo_product_dropdown_style == 'underline' || 19104 $(this).parents('.woocommerce-ordering').length > 0 ) { 19105 19106 select2OptionsObj = { 19107 minimumResultsForSearch: $minimumToSearch, 19108 dropdownParent: $(this).parent(), 19109 dropdownAutoWidth: true 19110 }; 19111 19112 } 19113 19114 $(this).select2(select2OptionsObj); 19115 19116 } 19117 19118 }); 19119 } 19120 19121 19122 /** 19123 * Fancy select styling theme option. 19124 * 19125 * @since 10.5 19126 */ 19127 function fancySelectStyling() { 19128 19129 if ( $('body[data-fancy-form-rcs="1"]').length > 0 ) { 19130 19131 $('select:not(.comment-form-rating #rating)').each(function () { 19132 19133 var $selector; 19134 19135 //cf7 19136 if ($(this).parents('.wpcf7-form-control-wrap').length > 0) { 19137 19138 //select 2 already initialized 19139 if ($(this).parents('.wpcf7-form-control-wrap').find('.select2-container').length > 0) { 19140 $selector = $($(this).prev('.select2-container')); 19141 } else { 19142 $selector = $(this); 19143 } 19144 19145 //if label is found 19146 if ($selector.parents('.wpcf7-form-control-wrap').parent().find('label').length == 1) { 19147 $selector.parents('.wpcf7-form-control-wrap').parent().wrapInner('<div class="fancy-select-wrap" />'); 19148 } else { 19149 //default wrap 19150 $selector.wrap('<div class="fancy-select-wrap" />'); 19151 } 19152 } 19153 //default 19154 else { 19155 19156 //select 2 already initialized 19157 if ($(this).prev('.select2-container').length > 0) { 19158 $selector = $(this).prev('.select2-container'); 19159 } else { 19160 $selector = $(this); 19161 } 19162 19163 if ($(this).parents('#buddypress').length == 0 && $(this).parents('.widget_categories').length == 0) { 19164 //if label is found 19165 if ($selector.prev('label').length == 1) { 19166 $selector.prev('label').andSelf().wrapAll('<div class="fancy-select-wrap" />'); 19167 } else if ($selector.next('label').length == 1) { 19168 $selector.next('label').andSelf().wrapAll('<div class="fancy-select-wrap" />'); 19169 } else { 19170 //default wrap 19171 $selector.wrap('<div class="fancy-select-wrap" />'); 19172 } 19173 } 19174 19175 } 19176 });
19177 19178 select2Init(); 19179 19180 } 19181 19182 } 19183 19184 19185 19186 19187 19188 /** 19189 * Back/Forward Safari cache assist. 19190 * 19191 * @since 10.5 19192 */ 19193 function bfCacheAssist() { 19194 19195 //Back/forward cache OCM close 19196 if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1 || 19197 navigator.userAgent.match(/(iPod|iPhone|iPad)/)) { 19198 19199 window.onpageshow = function (event) { 19200 19201 if (event.persisted) { 19202 19203 // Play video BGs 19204 $('.nectar-video-wrap, .nectar-slider-wrap .swiper-slide .video-wrap').each(function () { 19205 19206 if ($(this).find('video').length > 0) { 19207 $(this).find('video')[0].play(); 19208 } 19209 19210 }); 19211 19212 19213 // Close mobile nav 19214 19215 //// Material Skin. 19216 if ($('body.material-ocm-open').length > 0) { 19217 $('body > .slide_out_area_close').addClass('non-human-allowed').trigger('click'); 19218 19219 setTimeout(function () { 19220 $('body > .slide_out_area_close').removeClass('non-human-allowed'); 19221 }, 100); 19222 19223 } else if ($('#slide-out-widget-area.slide-out-from-right-hover.open').length > 0 && navigator.userAgent.match(/(iPod|iPhone|iPad)/)) { 19224 OCM_mobileSlideOutRightHoverCloseCheck(); 19225 } 19226 // Others 19227 else if ($('#slide-out-widget-area.fullscreen.open').length > 0 || 19228 $('#slide-out-widget-area.fullscreen-alt.open').length > 0 || 19229 $('#slide-out-widget-area.slide-out-from-right.open').length > 0) { 19230 19231 $('#slide-out-widget-area .slide_out_area_close').addClass('non-human-allowed'); 19232 $('.slide-out-widget-area-toggle:not(.std-menu) a.open') 19233 .addClass('non-human-allowed') 19234 .trigger('click'); 19235 19236 setTimeout(function () { 19237 $('#slide-out-widget-area .slide_out_area_close').removeClass('non-human-allowed'); 19238 }, 100); 19239 19240 } 19241 19242 } // Loaded from bf cache 19243 19244 }; // onpage show 19245 19246 } 19247 19248 } 19249 19250 19251 19252 19253 19254 19255 /*-------------------------------------------------------------------------*/ 19256 /* WPBakery Frontend Editor 19257 /*-------------------------------------------------------------------------*/ 19258 19259 /** 19260 * Control adjustments 19261 * 19262 * @since 10.0 19263 */ 19264 function addRowCtrls() { 19265 19266 //remove padding for rows with only fullwidth ns 19267 $('.wpb_row').removeClass('only-ns'); 19268 19269 $('.nectar-slider-wrap[data-full-width="true"], .page-submenu, .portfolio-items[data-col-num="elastic"]:not(.fullwidth-constrained), .blog-fullwidth-wrap') 19270 .parents('.wpb_row') 19271 .addClass('only-ns'); 19272 19273 //padding when column contains item that could get lost under column controls 19274 $('body.vc_editor.compose-mode .wpb_row .vc_vc_column > .wpb_column > .vc_column-inner').each(function() { 19275 19276 if ($(this).find('> .vc_element-container > div').length > 0) { 19277 19278 if ($(this).find('> .vc_element-container > div:first-child').is('.vc_vc_row_inner')) { 19279 $(this).find('> .vc_element-container > div:first-child').addClass('first-inner-row-el'); 19280 } else { 19281 $(this).find('> .vc_element-container > div:first-child').removeClass('first-inner-row-el'); 19282 } 19283 19284 } 19285 19286 }); 19287 19288 } //addRowCtrl end 19289 19290 19291 /** 19292 * Convert front end padding 19293 * 19294 * Needed when the flexbox grid is not active due to 19295 * different markup in front end page builder view. 19296 * 19297 * @since 10.0 19298 */ 19299 function convertFrontEndPadding() { 19300 19301 $('.vc_element > .wpb_column[class*="padding-"][class*="-percent"]').each(function() { 19302 19303 var $elPaddingPercent = 4; 19304 19305 var elclassName = this.className.match(/padding-\d+/); 19306 if (elclassName) { 19307 $elPaddingPercent = elclassName[0].match(/\d+/); 19308 if ($elPaddingPercent) { 19309 $elPaddingPercent = $elPaddingPercent[0] / 100; 19310 } else { 19311 $elPaddingPercent = 0; 19312 } 19313 } 19314 19315 if ($elPaddingPercent) { 19316 var $parentRowWidth = $(this).parents('.span_12').width(); 19317 19318 if ($(this).is('[data-padding-pos="all"]')) { 19319 $(this).css('padding', $parentRowWidth * $elPaddingPercent); 19320 } else if ($(this).is('[data-padding-pos="top"]')) { 19321 $(this).css('padding-top', $parentRowWidth * $elPaddingPercent); 19322 } else if ($(this).is('[data-padding-pos="bottom"]')) { 19323 $(this).css('padding-bottom', $parentRowWidth * $elPaddingPercent); 19324 } else if ($(this).is('[data-padding-pos="left"]')) { 19325 $(this).css('padding-left', $parentRowWidth * $elPaddingPercent); 19326 } else if ($(this).is('[data-padding-pos="right"]')) { 19327 $(this).css('padding-right', $parentRowWidth * $elPaddingPercent); 19328 } else if ($(this).is('[data-padding-pos="top-bottom"]')) { 19329 $(this).css({ 19330 'padding-top': $parentRowWidth * $elPaddingPercent, 19331 'padding-bottom': $parentRowWidth * $elPaddingPercent, 19332 });
19333 } else if ($(this).is('[data-padding-pos="top-right"]')) { 19334 $(this).css({ 19335 'padding-top': $parentRowWidth * $elPaddingPercent, 19336 'padding-right': $parentRowWidth * $elPaddingPercent, 19337 }); 19338 } else if ($(this).is('[data-padding-pos="bottom-right"]')) { 19339 $(this).css({ 19340 'padding-right': $parentRowWidth * $elPaddingPercent, 19341 'padding-bottom': $parentRowWidth * $elPaddingPercent, 19342 }); 19343 } else if ($(this).is('[data-padding-pos="bottom-left"]')) { 19344 $(this).css({ 19345 'padding-left': $parentRowWidth * $elPaddingPercent, 19346 'padding-bottom': $parentRowWidth * $elPaddingPercent, 19347 }); 19348 } else if ($(this).is('[data-padding-pos="left-right"]')) { 19349 $(this).css({ 19350 'padding-left': $parentRowWidth * $elPaddingPercent, 19351 'padding-right': $parentRowWidth * $elPaddingPercent, 19352 }); 19353 } 19354 } 19355 19356 }); 19357 19358 $('.wpb_row[class*="vc_custom_"]').each(function() { 19359 19360 $(this).parent().addClass('no-bottom-margin'); 19361 19362 }); 19363 19364 } 19365 19366 19367 /** 19368 * WPBakery Front end editor integration 19369 * 19370 * @since 10.0 19371 */ 19372 function wpBakeryFrontendInit() { 19373 19374 // Set up controls/column padding. 19375 setTimeout(function() { 19376 19377 if ($('body.compose-mode').length > 0) { 19378 $('.container-wrap').addClass('visible-editor-controls'); 19379 } 19380 19381 if (nectarDOMInfo.usingFrontEndEditor) { 19382 addRowCtrls(); 19383 19384 if( !$body.is('[data-flex-cols="true"]') ) { 19385 convertFrontEndPadding(); 19386 $window.on('smartresize',convertFrontEndPadding); 19387 } 19388 19389 } 19390 19391 }, 200); 19392 19393 // Bind reload event 19394 $window.on('vc_reload', function() { 19395 19396 addRowCtrls(); 19397 columnBGColors(); 19398 coloredButtons(); 19399 twentytwentyInit(); 19400 parallaxRowsBGCals(); 19401 flexsliderInit(); 19402 accordionInit(); 19403 ulCheckmarks(); 19404 nectarFancyUlIcons(); 19405 nectarFancyBoxHover(); 19406 oneFourthClasses(); 19407 carouselfGrabbingClass(); 19408 nectarPostGridInit(); 19409 splitLineHeadingInit(); 19410 nectarVideoLightbox(); 19411 nectarKeyframeAssist(); 19412 nectarLazyImageLoading(); 19413 19414 if ($('.carousel').length > 0) { 19415 standardCarouselInit(); 19416 clientsCarouselInit(); 19417 carouselHeightCalcs(); 19418 } 19419 19420 if ($('.owl-carousel').length > 0) { 19421 $('.owl-carousel').each(function() { 19422 $(this).trigger('destroy.owl.carousel').removeClass('owl-loaded'); 19423 $(this).find('.owl-stage-outer .owl-stage > *').unwrap(); 19424 $(this).find('.owl-stage-outer > *').unwrap(); 19425 $(this).find('.owl-item > *').unwrap(); 19426 $(this).find('.owl-dots').remove(); 19427 $(this).find('.owl-nav').remove(); 19428 }); 19429 owlCarouselInit(); 19430 } 19431 19432 if ($('.nectar_cascading_images').length > 0) { 19433 imagesLoaded($('.nectar_cascading_images'), function() { 19434 cascadingImageBGSizing(); 19435 }); 19436 } 19437 19438 fullWidthSections(); 19439 fwsClasses(); 19440 recentPostsInit(); 19441 fullWidthRowPaddingAdjust(); 19442 19443 /*flickity carousels*/ 19444 if ($flickitySliders.length > 0) { 19445 for (var i = 0; i < $flickitySliders.length; i++) { 19446 19447 $flickitySliders[i].reloadCells(); 19448 $flickitySliders[i].off('scroll.flickity'); 19449 $flickitySliders[i].off('dragStart.flickity'); 19450 $flickitySliders[i].off('dragEnd.flickity'); 19451 19452 } 19453 } 19454 19455 flickityLazyInit(); 19456 19457 setTimeout(function() { 19458 19459 flickityInit(); 19460 if ($flickitySliders.length > 0) { 19461 for (var i = 0; i < $flickitySliders.length; i++) { 19462 $flickitySliders[i].reloadCells(); 19463 $flickitySliders[i].resize(); 19464 } 19465 } 19466 19467 }, 100); 19468 19469 /*flickity product carousels*/ 19470 if ($wooFlickityCarousels.length > 0) { 19471 for (var i = 0; i < $wooFlickityCarousels.length; i++) { 19472 19473 $wooFlickityCarousels[i].flickity('reloadCells'); 19474 $wooFlickityCarousels[i].off('scroll.flickity'); 19475 $wooFlickityCarousels[i].off('dragStart.flickity'); 19476 $wooFlickityCarousels[i].off('dragEnd.flickity'); 19477 19478 } 19479 } 19480 19481 setTimeout(function() { 19482 19483 if ($('.nectar-woo-flickity').length > 0) { 19484 productCarouselInit(); 19485 } 19486 if ($wooFlickityCarousels.length > 0) { 19487 for (var i = 0; i < $wooFlickityCarousels.length; i++) { 19488 $wooFlickityCarousels[i].flickity('reloadCells'); 19489 $wooFlickityCarousels[i].flickity('resize'); 19490 } 19491 } 19492 19493 }, 100); 19494 19495 nectarTestimonialSliders(); 19496 19497 for (var i = 0; i < $testimonialSliders.length; i++) { 19498 19499 if ($testimonialSliders[i].type == 'multiple_visible' || 19500 $testimonialSliders[i].type == 'multiple_visible_minimal') { 19501 19502 $testimonialSliders[i].flickityEl.flickity('reloadCells'); 19503 $testimonialSliders[i].flickityEl.off('select.flickity'); 19504 nectarTestimonialSliders(); 19505 $testimonialSliders[i].flickityEl.resize(); 19506 } 19507 19508 $testimonialSliders[i].testimonialSliderHeight(); 19509 } 19510 nectarTestimonialSlidersEvents(); 19511 19512 pricingTableHeight(); 19513 nectarIconMatchColoring(); 19514 lightBoxInit(); 19515 imageWithHotspotEvents(); 19516 largeIconHover(); 19517 nectarBoxRollInit(); 19518 midnightInit(); 19519 responsiveVideoIframesInit(); 19520 responsiveVideoIframes(); 19521 fullWidthContentColumns(); 19522 setTimeout(fullWidthContentColumns, 1000); 19523 videoBGInit(); 19524 vcFullHeightRowInit(); 19525 $window.off('scroll.parallaxSections').off('resize.parallaxSections'); 19526 parallaxScrollInit(); 19527 masonryBlogInit(); 19528 masonryPortfolioInit(); 19529 19530 if ($portfolio_containers.length > 0) { 19531 for (var i = 0; i < $portfolio_containers.length; i++) { 19532 $portfolio_containers[i].portfolioAccentColor(); 19533 } 19534 } 19535 19536 parallaxItemHoverEffect(); 19537 fsProjectSliderInit(); 19538 19539 setTimeout(function() { 19540 if ($('.nectar_fullscreen_zoom_recent_projects').length > 0) { 19541 19542 if ($fsProjectSliderArr.length > 0) { 19543 for (var i = 0; i < $fsProjectSliderArr.length; i++) { 19544 $fsProjectSliderArr[i].sliderCalcs(); 19545 } 19546 } 19547 19548 } 19549 }, 300); 19550 19551 $window.unbind('.infscr'); 19552 infiniteScrollInit();
19553 mouseParallaxInit(); 19554 19555 //play video BGs 19556 $('.nectar-video-wrap').each(function() { 19557 if ($(this).find('video').length > 0) { 19558 $(this).find('video').css('visibility', 'visible'); 19559 } 19560 }); 19561 19562 //tablet inherits small desktop 19563 $('.wpb_column[data-t-w-inherits]').each(function() { 19564 if ($(this).is('[data-t-w-inherits="small_desktop"]')) { 19565 $(this).parent().addClass('inherits-s-desktop-col'); 19566 } else { 19567 $(this).parent().removeClass('inherits-s-desktop-col'); 19568 } 19569 }); 19570 19571 //full screen page rows 19572 if ($('#nectar_fullscreen_rows').length > 0) { 19573 19574 if ($('#nectar_fullscreen_rows > .vc_element').length == 0) { 19575 $('#nectar_fullscreen_rows').prepend('<div class="vc_element empty_placeholder" />'); 19576 } 19577 19578 19579 if ($('#nectar_fullscreen_rows > .vc_element:not(.empty_placeholder)').length > 0) { 19580 $('#nectar_fullscreen_rows >.vc_element.empty_placeholder').remove(); 19581 } 19582 19583 19584 $.fn.fullpage.destroy('all'); 19585 nectarFullPageInit(); 19586 19587 //keep tooltip active status 19588 var nectarFPOffsets = [{ 19589 el: '', 19590 offset: 0 19591 }]; 19592 19593 ////create list of offsets 19594 $('#nectar_fullscreen_rows > div.vc_element').each(function(i) { 19595 nectarFPOffsets[i] = { 19596 el: $(this), 19597 offset: $(this).offset().top 19598 }; 19599 }); 19600 19601 19602 ////start active on that index 19603 19604 //move back to first section when all have been deleted but one 19605 if ($('#nectar_fullscreen_rows > div.vc_element').length === 1) { 19606 $('#nectar_fullscreen_rows').css({ 19607 'transform': 'translate3d(0,0,0)' 19608 });
19609 } 19610 19611 $body.scrollTo(0, 0); 19612 19613 19614 } else { 19615 19616 //remove container wrap padding/margin when needded 19617 if ($('body .main-content > .row > .vc_element:first > .wpb_row[class*="full-width-"]').length > 0 || 19618 $('body .main-content > .row > .vc_element:first .nectar-slider-wrap[data-full-width="true"]').length > 0) { 19619 $('.container-wrap').css({ 19620 'padding-top': '0', 19621 'margin-top': '0' 19622 }); 19623 } else { 19624 $('.container-wrap').css({ 19625 'padding-top': '40px' 19626 }); 19627 } 19628 19629 } 19630 19631 //reset svg icon arr 19632 $svgIcons = []; 19633 $('.svg-icon-holder') 19634 .removeClass('animated-in') 19635 .removeClass('bound'); 19636 19637 19638 //gmap 19639 if ($('.vc_nectar_gmap').length > 0) { 19640 19641 setTimeout(function() { 19642 19643 if (typeof google === 'object' && typeof google.maps === 'object') { 19644 window.mapAPI_Loaded(); 19645 } else { 19646 19647 if (window.nectarLove.mapApiKey.length > 0) { 19648 $.getScript('https://maps.google.com/maps/api/js?sensor=false&key=' + window.nectarLove.mapApiKey + '&callback=mapAPI_Loaded'); 19649 } 19650 } 19651 19652 }, 100); 19653 } 19654 19655 19656 stickySidebarInit(); 19657 19658 19659 if (typeof window.Waypoint != 'undefined') { 19660 Waypoint.destroyAll(); 19661 waypoints(); 19662 } 19663 19664 }); 19665 19666 } 19667 19668 19669 19670 19671 19672 19673 19674 19675 /** 19676 * Page transitions and waypoint triggering 19677 * 19678 * @since 10.5 19679 */ 19680 function pageTransitionInit() { 19681 19682 var mobileDisabledCondition = false; 19683 19684 if( $('body[data-ajax-transitions="true"]').length > 0 && 19685 $('#ajax-loading-screen[data-disable-mobile="1"]').length > 0 && 19686 nectarDOMInfo.winW < 1000 ) { 19687 19688 mobileDisabledCondition = true; 19689 19690 } 19691 19692 if ($('body[data-ajax-transitions="true"]').length > 0 && $('#ajax-loading-screen[data-method="standard"]').length > 0 && mobileDisabledCondition == false) { 19693 19694 $('html').addClass('page-trans-loaded'); 19695 19696 // Fade loading animation 19697 if ($('#ajax-loading-screen[data-effect="standard"]').length > 0) { 19698 19699 if ($('.nectar-particles').length == 0) { 19700 19701 $loadingScreenEl.transition({ 19702 'opacity': 0 19703 }, 500, function () { 19704 $(this).css({ 19705 'display': 'none' 19706 }); 19707 });
19708 $('#ajax-loading-screen .loading-icon').transition({ 19709 'opacity': 0 19710 }, 500); 19711 19712 } 19713 19714 // Bind waypoints after loading screen has left 19715 if ($('.nectar-box-roll').length == 0) { 19716 setTimeout(function () { 19717 waypoints(); 19718 }, 550); 19719 } 19720 19721 } 19722 19723 // Swipe loading animation 19724 else { 19725 19726 if ($('#ajax-loading-screen[data-effect*="horizontal_swipe"]').length > 0) { 19727 setTimeout(function () { 19728 $loadingScreenEl.addClass('loaded'); 19729 }, 60); 19730 } 19731 19732 if ($('#page-header-wrap #page-header-bg[data-animate-in-effect="zoom-out"] .nectar-video-wrap').length == 0) { 19733 setTimeout(function () { 19734 $('#ajax-loading-screen:not(.loaded)').addClass('loaded'); 19735 setTimeout(function () { 19736 $loadingScreenEl.addClass('hidden'); 19737 }, 1000); 19738 }, 150); 19739 } 19740 19741 19742 // Bind waypoints after loading screen has left 19743 if ($('.nectar-box-roll').length == 0 && $('#ajax-loading-screen[data-effect*="horizontal_swipe"]').length > 0) { 19744 setTimeout(function () { 19745 waypoints(); 19746 }, 750); 19747 } else if ($('.nectar-box-roll').length == 0) setTimeout(function () { 19748 waypoints(); 19749 }, 350); 19750 19751 } 19752 19753 19754 // Safari back/prev fix 19755 if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1 || 19756 navigator.userAgent.match(/(iPod|iPhone|iPad)/)) { 19757 19758 window.onunload = function () { 19759 19760 $('#ajax-loading-screen').stop().transition({ 19761 'opacity': 0 19762 }, 800, function () { 19763 $(this).css({ 19764 'display': 'none' 19765 }); 19766 });
19767 $('#ajax-loading-screen .loading-icon').transition({ 19768 'opacity': 0 19769 }, 600); 19770 }; 19771 window.onpageshow = function (event) { 19772 19773 if (event.persisted) { 19774 19775 $('#ajax-loading-screen').stop().transition({ 19776 'opacity': 0 19777 }, 800, function () { 19778 $(this).css({ 19779 'display': 'none' 19780 }); 19781 }); 19782 $('#ajax-loading-screen .loading-icon').transition({ 19783 'opacity': 0 19784 }, 600); 19785 19786 } 19787 19788 }; 19789 19790 } 19791 19792 else if (navigator.userAgent.indexOf('Firefox') != -1) { 19793 window.onunload = function () {}; 19794 } 19795 19796 19797 // Remove excess loading images if using page transitions. 19798 $('.portfolio-loading, .nectar-slider-loading .loading-icon').remove(); 19799 19800 19801 if ($('#ajax-loading-screen[data-disable-fade-on-click="1"]').length == 0) { 19802 19803 if ($('body.using-mobile-browser #ajax-loading-screen[data-method="standard"][data-disable-mobile="1"]').length == 0) { 19804 19805 var ignore_onbeforeunload = false; 19806 $('a[href^="mailto"], a[href^="tel"], .woocommerce-order-downloads a[class*="downloads-file"], .wpdm-cta.download-l
19806ink a[data-downloadurl], .nectar-ignore-beforeunload a').on('click', function () { 19807 ignore_onbeforeunload = true; 19808 }); 19809 window.addEventListener('beforeunload', function () { 19810 19811 if (!ignore_onbeforeunload) { 19812 $loadingScreenEl.addClass('set-to-fade'); 19813 transitionPage(); 19814 } 19815 ignore_onbeforeunload = false; 19816 }); 19817 } 19818 19819 } 19820 19821 } 19822 19823 // No page transitions 19824 else { 19825 19826 // Mobile disabled. 19827 if( mobileDisabledCondition == true ) { 19828 $loadingScreenEl.css({ 19829 'opacity': '0', 19830 'display': 'none' 19831 }).addClass('loaded').addClass('hidden'); 19832 } 19833 19834 if ($('.nectar-box-roll').length == 0 && !nectarDOMInfo.usingFrontEndEditor) { 19835 19836 // Waypoints. 19837 setTimeout(function () { 19838 waypoints(); 19839 }, 80); 19840 19841 } 19842 19843 } 19844 19845 19846 function transitionPage() { 19847 19848 if ($('#ajax-loading-screen[data-effect*="horizontal_swipe"]').length > 0) { 19849 $loadingScreenEl.removeClass('loaded'); 19850 $loadingScreenEl.addClass('in-from-right'); 19851 19852 setTimeout(function () { 19853 $loadingScreenEl.addClass('loaded'); 19854 }, 30); 19855 19856 } 19857 else { 19858 if ($('#ajax-loading-screen[data-effect="center_mask_reveal"]').length > 0) { 19859 $loadingScreenEl.css('opacity', '0').css('display', 'block').transition({ 19860 'opacity': '1' 19861 }, 450); 19862 } else { 19863 $loadingScreenEl.show().transition({ 19864 'opacity': '1' 19865 }, 450); 19866 } 19867 } 19868 19869 } 19870 19871 } 19872 19873 19874 19875 // Document ready event - starting everything up. 19876 jQuery(document).ready(function ($) { 19877 19878 // Initialize Nectar DOM helper. 19879 nectarDOMInfo.init(); 19880 19881 // Priority calls 19882 nectarBoxRollInit(); 19883 nectarFullPageInit(); 19884 nectarLazyImageLoading(); 19885 19886 // Header navigation. 19887 initSF(); 19888 navigationSearchInit(); 19889 centeredNavBottomBarInit(); 19890 centeredLogoHeaderInit(); 19891 headerNavPreInit(); 19892 headerNavScrollInit(); 19893 headerNavOffsetInit(); 19894 19895 // Page builder elements. 19896 salientPageBuilderElInit(); 19897 19898 // Column related. 19899 columnBGColors(); 19900 vcMobileColumnsInit(); 19901 19902 // Row related. 19903 fullWidthSections(); 19904 fwsClasses(); 19905 fwCarouselLinkFix(); 19906 fullWidthSectionsPreInit(); 19907 firstFWSection(); 19908 parallaxScrollInit(); 19909 parallaxRowsBGCals(); 19910 fullWidthRowPaddingAdjust(); 19911 fullWidthContentColumns(); 19912 oneFourthClasses(); 19913 fixIeFlexbox(); 19914 vcFullHeightRowInit(); 19915 19916 // Media. 19917 lightBoxInit(); 19918 audioVideoVis(); 19919 responsiveVideoIframesInit(); 19920 responsiveVideoIframes(); 19921 videoBGInit(); 19922 blogSingle(); 19923 19924 19925 // Off canvas navigation. 19926 mobileNavMegamenuCorrect(); 19927 materialSkinOCM_Init(); 19928 OCM_dropdownMarkup(); 19929 OCM_dropdownIconPos(); 19930 clickToggleSubmenus(); 19931 OCM_init(); 19932 19933 19934 // Page header 19935 pageHeaderInit(); 19936 19937 // Footer. 19938 footerRevealInit(); 19939 19940 // Third party. 19941 wooCommerceEvents(); 19942 fancySelectStyling(); 19943 19944 // Scrolling 19945 infiniteScrollInit(); 19946 scrollToTopInit(); 19947 animatedAnchorLinks(); 19948 updatePerspectiveOriginInit(); 19949 sectionDownArrowEvent(); 19950 19951 // Cross browser assist. 19952 crossBrowserAdjust(); 19953 bfCacheAssist(); 19954 19955 // Front end editing. 19956 wpBakeryFrontendInit(); 19957 19958 // Page transitions and waypoint activation. 19959 pageTransitionInit(); 19960 19961 19962 19963 // Main Debounced Resize Event. 19964 $window.off('smartresize.srInit'); 19965 $window.on('smartresize.srInit', smartResizeInit); 19966 19967 // Main Resize Event. 19968 $window.off('resize.srInit'); 19969 $window.on('resize.srInit', resizeInit); 19970 19971 // Orientation change. 19972 window.addEventListener("orientationchange", orientationChangeInit); 19973 19974 // If window load has already triggered prior to the below bind. 19975 if( document.readyState === 'complete' ) { 19976 19977 setTimeout(function(){ 19978 $window.trigger('load'); 19979 },30); 19980 19981 } 19982 // Window Load Event. 19983 $window.on('load', function () { 19984 19985 // Set header space. 19986 if ( $(window).scrollTop() == 0 ) { 19987 headerSpace(); 19988 } 19989 19990 $('video').css('visibility', 'visible'); 19991 19992 // Scroll to anchor 19993 pageLoadHashInit(); 19994 19995 // Row/Column related. 19996 fullWidthContentColumns();
19997 parallaxRowsBGCals(); 19998 19999 // Video BG 20000 resizeVideoToCover(); 20001 20002 }); 20003 20004 20005 }); 20006 20007 20008 20009}(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.