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('.iosSlider.product-slider').length == 0) { 3353 3354 var match = $(this).parent().attr('href').match(/\.(jpg|png|gif)\b/); 3355 if (match) { 3356 $(this).parent().attr('data-fancybox', ''); 3357 } 3358 } 3359 }); 3360 } 3361 3362 // Regular. 3363 var fbMarginArr = ($('body.admin-bar').length > 0) ? [60, 100] : [60, 100]; 3364 if (nectarDOMInfo.winW < 1000) { 3365 fbMarginArr = [0, 0]; 3366 } 3367 $("[data-fancybox]").fancybox({ 3368 animationEffect: "zoom-in-out", 3369 animationDuration: 350, 3370 buttons: [ 3371 'fullScreen', 3372 'zoom', 3373 'close' 3374 ], 3375 margin: fbMarginArr, 3376 backFocus: false, 3377 loop: true, 3378 caption: function() { 3379 return $(this).attr('title'); 3380 }, 3381 hash: false, 3382 beforeLoad: function(instance) { 3383 3384 if (typeof instance.current.src !== 'string') { 3385 $.fancybox.close(true); 3386 } 3387 3388 }, 3389 mobile: { 3390 margin: 0 3391 } 3392 }); 3393 } 3394 3395 /** 3396 * Magnific lightbox. 3397 * 3398 * @since 6.0 3399 */ 3400 function magnificInit() { 3401 3402 // Convert old pp links 3403 $('a.pp') 3404 .removeClass('pp') 3405 .addClass('magnific-popup'); 3406 3407 $("a[rel^='prettyPhoto']:not([rel*='_gal']):not([rel*='product-gallery']):not([rel*='prettyPhoto['])") 3408 .removeAttr('rel') 3409 .addClass('magnific-popup'); 3410 3411 // Image gallery nectar. 3412 $('.wpb_gallery .wpb_gallery_slidesnectarslider_style').each(function() { 3413 $(this).find('.swiper-slide a:not(.ext-url-link)').addClass('pretty_photo'); 3414 }); 3415 3416 // Flexslider. 3417 $('.wpb_gallery_slides.wpb_flexslider:not([data-onclick="custom_link"])').each(function() { 3418 $(this).find('.slides > li > a').addClass('pretty_photo'); 3419 }); 3420 3421 // Touch enabled gallery. 3422 $('.wpb_gallery_slidesflickity_style, .wpb_gallery_slidesflickity_static_height_style').each(function() { 3423 $(this).find('.cell > a:not(.ext-url-link)').addClass('pretty_photo'); 3424 }); 3425 3426 // Add galleries to portfolios. 3427 $('.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() { 3428 3429 if ($(this).find('.pretty_photo').length > 0) { 3430 3431 $(this) 3432 .find('.pretty_photo') 3433 .removeClass('pretty_photo') 3434 .addClass('gallery') 3435 .addClass('magnific'); 3436 3437 } else if ($(this).find('a[rel*="prettyPhoto["]').length > 0) { 3438 3439 $(this) 3440 .find('a[rel*="prettyPhoto["]') 3441 .removeAttr('rel') 3442 .addClass('gallery') 3443 .addClass('magnific'); 3444 } 3445 3446 }); 3447 3448 $("a[data-rel='prettyPhoto[product-gallery]']").each(function() { 3449 $(this) 3450 .removeAttr('data-rel') 3451 .addClass('magnific') 3452 .addClass('gallery'); 3453 }); 3454 3455 // Nectar auto lightbox theme option. 3456 if ($body.hasClass('nectar-auto-lightbox')) { 3457 $('.gallery').each(function() { 3458 if ($(this).find('.gallery-icon a[rel^="prettyPhoto"]').length == 0) { 3459 3460 $(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"]') 3461 .addClass('magnific') 3462 .addClass('gallery') 3463 .removeClass('pretty_photo'); 3464 } 3465 }); 3466 3467 $('.main-content img').each(function() { 3468 3469 if ($(this).parent().is("[href]") && 3470 !$(this).parent().is(".magnific-popup") && 3471 $(this).parents('.tiled-gallery').length == 0 && 3472 $(this).parents('.product-image').length == 0 && 3473 $(this).parents('.iosSlider.product-slider').length == 0) { 3474 3475 var match = $(this).parent().attr('href').match(/\.(jpg|png|gif)\b/); 3476 if (match) { 3477 3478 $(this).parent() 3479 .addClass('magnific-popup') 3480 .addClass('image-link'); 3481 } 3482 } 3483 3484 }); 3485 3486 } 3487 3488 3489 // Regular. 3490 $('a.magnific-popup:not(.gallery):not(.nectar_video_lightbox)').magnificPopup({ 3491 type: 'image', 3492 callbacks: { 3493 imageLoadComplete: function() { 3494 var $that = this; 3495 setTimeout(function() { 3496 $that.wrap.addClass('mfp-image-loaded'); 3497 }, 10); 3498 }, 3499 beforeOpen: function() { 3500 this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim'); 3501 }, 3502 open: function() { 3503 3504 $.magnificPopup.instance.next = function() { 3505 var $that = this; 3506 3507 this.wrap.removeClass('mfp-image-loaded'); 3508 setTimeout(function() { 3509 $.magnificPopup.proto.next.call($that); 3510 }, 100); 3511 }; 3512 3513 $.magnificPopup.instance.prev = function() { 3514 var $that = this; 3515 3516 this.wrap.removeClass('mfp-image-loaded'); 3517 setTimeout(function() { 3518 $.magnificPopup.proto.prev.call($that); 3519 }, 100); 3520 }; 3521 3522 } 3523 },
3524 fixedContentPos: false, 3525 mainClass: 'mfp-zoom-in', 3526 removalDelay: 400 3527 }); 3528 3529 // Video. 3530 $('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({ 3531 type: 'iframe', 3532 fixedContentPos: false, 3533 mainClass: 'mfp-zoom-in', 3534 removalDelay: 400 3535 }); 3536 3537 3538 // Galleries. 3539 $('a.magnific.gallery').each(function() { 3540 3541 var $parentRow = ($(this).closest('.wpb_column').length > 0) ? $(this).closest('.wpb_column') : $(this).parents('.row'); 3542 3543 if ($parentRow.length > 0 && !$parentRow.hasClass('lightbox-col')) { 3544 3545 $parentRow.magnificPopup({ 3546 type: 'image', 3547 delegate: 'a.magnific', 3548 mainClass: 'mfp-zoom-in', 3549 fixedContentPos: false, 3550 callbacks: { 3551 3552 elementParse: function(item) { 3553 3554 if ($(item.el).is('[href]') && $(item.el).attr('href').indexOf('iframe=true') != -1 || 3555 $(item.el).is('[href]') && $(item.el).attr('href').indexOf('https://www.youtube.com/watch') != -1) { 3556 item.type = 'iframe'; 3557 } else if ($(item.el).is('[href]') && $(item.el).attr('href').indexOf('video-popup-') != -1) { 3558 item.type = 'inline'; 3559 } else { 3560 item.type = 'image'; 3561 } 3562 }, 3563 3564 imageLoadComplete: function() { 3565 var $that = this; 3566 setTimeout(function() { 3567 $that.wrap.addClass('mfp-image-loaded'); 3568 }, 10); 3569 }, 3570 3571 beforeOpen: function() { 3572 this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim'); 3573 }, 3574 3575 open: function() { 3576 3577 // Self hosted video. 3578 if ($(this.content).find('.mejs-video video').length > 0 && $().mediaelementplayer) { 3579 $(this.content).find('.mejs-video video')[0].player.remove(); 3580 3581 var $that = this; 3582 setTimeout(function() { 3583 $($that.content).find('video').mediaelementplayer(); 3584 $($that.content).find('.mejs-video video')[0].player.play(); 3585 }, 50); 3586 3587 } 3588 3589 $.magnificPopup.instance.next = function() { 3590 var $that = this; 3591 3592 this.wrap.removeClass('mfp-image-loaded'); 3593 setTimeout(function() { 3594 $.magnificPopup.proto.next.call($that); 3595 3596 // Self hosted video. 3597 if ($($that.content).find('.mejs-video video').length > 0) { 3598 $($that.content).find('.mejs-video video')[0].play(); 3599 } 3600 3601 }, 100); 3602 }; 3603 3604 $.magnificPopup.instance.prev = function() { 3605 var $that = this; 3606 3607 this.wrap.removeClass('mfp-image-loaded'); 3608 setTimeout(function() { 3609 $.magnificPopup.proto.prev.call($that); 3610 3611 // Self hosted video. 3612 if ($($that.content).find('.mejs-video video').length > 0) { 3613 $($that.content).find('.mejs-video video')[0].play(); 3614 } 3615 }, 100); 3616 }; 3617 3618 }, 3619 3620 close: function() { 3621 // Self hosted video. 3622 if ($(this.content).find('.mejs-video video').length > 0) { 3623 $(this.content).find('.mejs-video video')[0].load(); 3624 } 3625 } 3626 }, 3627 removalDelay: 400, 3628 gallery: { 3629 enabled: true 3630 } 3631 }); 3632 3633 $parentRow.addClass('lightbox-col'); 3634 } 3635 3636 }); 3637 3638 } 3639 3640 3641 /** 3642 * Lightbox initialization. 3643 * 3644 * Determines which lightbox to use based on theme option. 3645 * 3646 * @since 8.0 3647 */ 3648 function lightBoxInit() { 3649 3650 setTimeout(function(){ 3651 if ($('body[data-ls="magnific"]').length > 0 || $('body[data-ls="pretty_photo"]').length > 0) { 3652 magnificInit(); 3653 } else if ($('body[data-ls="fancybox"]').length > 0) { 3654 fancyBoxInit(); 3655 } 3656 },100); 3657 3658 } 3659 3660 3661 /** 3662 * WPBakery page builder standard animations. 3663 * 3664 * @since 7.0 3665 * @see waypoints 3666 */ 3667 function vcWaypoints() { 3668 3669 $($fullscreenSelector + ' .wpb_animate_when_almost_visible').each(function () { 3670 3671 var $that = $(this), 3672 $vcOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : '90%', 3673 waypoint = new Waypoint({ 3674 element: $that, 3675 handler: function () { 3676 3677 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated')) { 3678 waypoint.destroy(); 3679 return; 3680 } 3681 3682 $that.addClass("animated"); 3683 $that.addClass("wpb_start_animation"); 3684 waypoint.destroy(); 3685 3686 if ($that.is('.nectar-button') && $('body[data-button-style*="rounded_shadow"]').length > 0) { 3687 setTimeout(function () { 3688 $that.removeClass('wpb_start_animation'); 3689 }, 1100); 3690 } 3691 3692 }, 3693 offset: $vcOffsetPos 3694 3695 }); 3696 3697 }); 3698 } 3699 3700 3701 /** 3702 * Nectar Rotating Words Title 3703 * 3704 * @since 13.0 3705 */ 3706 function NectarRotatingWords(el,dur) { 3707 3708 this.$el = el; 3709 this.duration = dur; 3710 3711 this.interval = ''; 3712 this.words = []; 3713 3714 this.state = { 3715 activeIndex: 0, 3716 sequenceStarted: 0, 3717 visible: false 3718 }; 3719 3720 this.setup(); 3721 3722 } 3723 3724 NectarRotatingWords.prototype.setup = function() { 3725 3726 var that = this; 3727 3728 this.$el.find('.dynamic-words > span').each(function(i) { 3729 that.words[i] = $(this); 3730 }); 3731 3732 // In View. 3733 this.viewportTracking(); 3734 3735 // Waypoint. 3736 if( this.$el.hasClass('element_stagger_words') ) { 3737 this.staggerWaypoint(); 3738 $(window).on('nectar-waypoints-reinit nectar-tab-changed', this.staggerWaypoint.bind(this)); 3739 } 3740 else { 3741 // Start sequence immediately. 3742 clearInterval(this.interval); 3743 3744 this.interval = setInterval(this.sequence.bind(this), this.duration); 3745 } 3746 3747 if( !nectarDOMInfo.usingMobileBrowser ) { 3748 $(window).on('resize', this.calcWidth.bind(this)); 3749 } else { 3750 window.addEventListener("orientationchange", this.calcWidth.bind(this)); 3751 } 3752 3753 }; 3754 3755 NectarRotatingWords.prototype.viewportTracking = function() { 3756 3757 var that = this; 3758 3759 if( 'IntersectionObserver' in window ) { 3760 3761 var options = { 3762 rootMargin: '0px', 3763 threshold: 0 3764 } 3765 3766 this.observer = new IntersectionObserver(function(entries) { 3767
3768 entries.forEach(function(entry) { 3769 if ( entry.isIntersecting ) { 3770 that.state.visible = true; 3771 } else { 3772 that.state.visible = false; 3773 } 3774 }); 3775 3776 }, options); 3777 3778 this.observer.observe(this.$el[0]); 3779 3780 3781 } else { 3782 // fallback. 3783 this.state.visible = true; 3784 } 3785 3786 } 3787 3788 NectarRotatingWords.prototype.calcWidth = function() { 3789 3790 var that = this; 3791 var storedWidth = this.$el.find('.dynamic-words').width(); 3792 3793 this.$el.find('.dynamic-words').css({ 'width': '' }); 3794 3795 var width = this.words[this.state.activeIndex].find('span').width(); 3796 3797 this.$el.find('.dynamic-words').css({ 3798 'width': storedWidth 3799 }); 3800 3801 setTimeout(function(){ 3802 that.$el.find('.dynamic-words').css({ 3803 'width': width 3804 }); 3805 },30); 3806 3807 } 3808 3809 NectarRotatingWords.prototype.sequence = function() { 3810 3811 if( this.$el.find('.dynamic-words > span').length < 2 || this.state.visible == false ) { 3812 return true; 3813 } 3814 3815 this.state.activeIndex = wrap( this.words.length, this.state.activeIndex + 1 ); 3816 3817 this.calcWidth(); 3818 3819 this.$el.find('.dynamic-words > span').removeClass('active'); 3820 3821 this.words[this.state.activeIndex].addClass('active'); 3822 3823 }; 3824 3825 NectarRotatingWords.prototype.staggerWaypoint = function() { 3826 3827 var that = this; 3828 3829 if( $fullscreenMarkupBool == true && this.$el.parents('.active').length == 0 ) { 3830 return true; 3831 } 3832 3833 // Generate Markup 3834 var animatedClass = ( $(this).hasClass('animated-in') ) ? ' animated' : ''; 3835 3836 this.$el.find('.beginning-text, .ending-text').each(function () { 3837 3838 var textArr = $(this).text(); 3839 textArr = textArr.trim(); 3840 textArr = textArr.split(' '); 3841 3842 $(this)[0].innerHTML = ''; 3843 3844 for (var i = 0; i < textArr.length; i++) { 3845 $(this)[0].innerHTML += '<span class="text-wrap"><span class="inner'+animatedClass+'">' + textArr[i] + '</span></span> '; 3846 } 3847 3848 }); 3849 3850 if( this.$el.hasClass('animated-in') ) { 3851 this.$el.find('.beginning-text .inner, .ending-text .inner').css({ 3852 'transform': 'translateY(0)' 3853 }); 3854 } 3855 3856 this.$el.addClass('markup-generated'); 3857 3858 // Waypoint. 3859 var offsetPos = ($fullscreenMarkupBool == true) ? '500%' : 'bottom-in-view'; 3860 3861 var $that = this.$el; 3862 var $delay = ( $that.is('[data-delay]') ) ? parseInt($that.attr('data-delay')) : 0; 3863 3864 var waypoint = new Waypoint({ 3865 element: $that, 3866 handler: function () { 3867 3868 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 3869 waypoint.destroy(); 3870 return; 3871 } 3872 3873 if (!bypassAnimations || $('body[data-responsive="0"]').length > 0) { 3874 3875 var $animationDurationCap; 3876 3877 setTimeout(function() { 3878 3879 var stagger = 0; 3880 stagger = 500 / $that.find('.text-wrap').length; 3881 stagger = Math.min(Math.max(stagger, 15), 50); // Clamp val 3882 3883 $animationDurationCap = (parseInt($animationDuration) < 1100) ? $animationDuration : '1100'; 3884 3885 var i = 0; 3886 $that.find('.text-wrap').each(function () { 3887 3888 var spanEl = $(this); 3889 3890 if( $(this).parents('.dynamic-words').length > 0 && !$(this).hasClass('active') ) { 3891 // hidden words in sequence. 3892 spanEl.find('> span').css({ 3893 'transform': 'translate3d(0,0,0)' 3894 }); 3895 return true; 3896 } 3897 3898 // visible words. 3899 setTimeout(function(){ 3900 spanEl.find('> span').css({ 3901 'transform': 'translate3d(0,0,0)' 3902 }); 3903 }, i * stagger); 3904 3905 i++; 3906 3907 });
3908 3909 $that.addClass('animated-in'); 3910 3911 }, $delay); 3912 3913 } 3914 3915 3916 // start sequence. 3917 if( that.state.sequenceStarted != true ) { 3918 clearInterval(that.interval); 3919 that.interval = setInterval(that.sequence.bind(that), that.duration); 3920 } 3921 3922 that.state.sequenceStarted = true; 3923 3924 waypoint.destroy(); 3925 }, 3926 offset: offsetPos 3927 }); 3928 3929 3930 } 3931 3932 3933 function nectarRotatingWordsInit() { 3934 3935 var rotatingTitles = []; 3936 3937 $('.nectar-rotating-words-title').each(function(i) { 3938 var duration = parseInt($(this).attr('data-rotation')); 3939 rotatingTitles[i] = new NectarRotatingWords($(this), duration); 3940 }); 3941 3942 } 3943 3944 3945 /** 3946 * Milestone element initialization. 3947 * 3948 * @since 4.0 3949 * @see waypoints 3950 */ 3951 function milestoneInit() { 3952 3953 $('.nectar-milestone').each(function () { 3954 3955 // Symbol 3956 if ($(this).is('[data-symbol]')) { 3957 3958 if ($(this).find('.symbol-wrap').length == 0) { 3959 3960 if ($(this).attr('data-symbol-pos') == 'before') { 3961 $(this) 3962 .find('.number') 3963 .prepend('<div class="symbol-wrap"><span class="symbol">' + $(this).attr('data-symbol') + '</span></div>'); 3964 } else { 3965 $(this) 3966 .find('.number') 3967 .append('<div class="symbol-wrap"><span class="symbol">' + $(this).attr('data-symbol') + '</span></div>'); 3968 } 3969 } 3970 3971 var $symbol_size; 3972 3973 if ($(this).attr('data-symbol-size') == $(this).find('.number').attr('data-number-size') && $(this).attr('data-symbol-alignment') == 'superscript') { 3974 $symbol_size = 32; 3975 } else { 3976 $symbol_size = parseInt($(this).attr('data-symbol-size')); 3977 } 3978 3979 $(this).find('.symbol-wrap').css({ 3980 'font-size': $symbol_size + 'px', 3981 'line-height': $symbol_size + 'px' 3982 }); 3983 } 3984 3985 $(this).find('.number').css({ 3986 'font-size': $(this).find('.number').attr('data-number-size') + 'px', 3987 'line-height': $(this).find('.number').attr('data-number-size') + 'px' 3988 }); 3989 }); 3990 3991 if (!bypassAnimations && $('.nectar-milestone').length > 0 || $body.hasClass('rtl') && $('.nectar-milestone').length > 0) { 3992 3993 // Blur effect 3994 var $blurCssString = ''; 3995 $($fullscreenSelector + '.nectar-milestone.motion_blur').each(function (i) { 3996 3997 $(this).removeClass(function (index, className) { 3998 return (className.match(/(^|\s)instance-\S+/g) || []).join(' '); 3999 }); 4000 4001 $(this).addClass('instance-' + i); 4002 4003 var $currentColor = $(this).find('.number').css('color'), 4004 colorInt = parseInt($currentColor.substring(1), 16); 4005 4006 var R = (colorInt & 0xFF0000) >> 16, 4007 G = (colorInt & 0x00FF00) >> 8, 4008 B = (colorInt & 0x0000FF) >> 0; 4009 4010 var $rgbaColorStart = 'rgba(' + R + ',' + G + ',' + B + ',0.2)', 4011 $rgbaColorEnd = 'rgba(' + R + ',' + G + ',' + B + ',1)', 4012 $numberSize = parseInt($(this).find('.number').attr('data-number-size')); 4013 4014 $blurCssString += '@keyframes motion-blur-number-' + i + ' { ' + 4015 ' 0% { ' + 4016 'opacity: 0;' + 4017 'color: ' + $rgbaColorStart + '; ' + 4018 '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 + '; ' + 4019 'transform: translateZ(0px) translateY(-100%); ' + 4020 '-webkit-transform: translateZ(0px) translateY(-100%); ' + 4021 '} ' + 4022 '33% { opacity: 1 }' + 4023 '100% { ' + 4024 'color: ' + $rgbaColorEnd + '; ' + 4025 'text-shadow: none; ' + 4026 'transform: translateZ(0px) translateY(0px); ' + 4027 '-webkit-transform: translateZ(0px) translateY(0px); ' + 4028 '} ' + 4029 '} ' + 4030 '@-webkit-keyframes motion-blur-number-' + i + ' { ' + 4031 ' 0% { ' + 4032 'opacity: 0;' + 4033 'color: ' + $rgbaColorStart + '; ' + 4034 '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 + '; ' + 4035 'transform: translateZ(0px) translateY(-100%); ' + 4036 '-webkit-transform: translateZ(0px) translateY(-100%); ' + 4037 '} ' + 4038 '33% { opacity: 1 }' + 4039 '100% { ' + 4040 'color: ' + $rgbaColorEnd + '; ' + 4041 'text-shadow: none; ' + 4042 'transform: translateZ(0px) translateY(0px); ' + 4043 '-webkit-transform: translateZ(0px) translateY(0px); ' + 4044 '} ' + 4045 '} ' + 4046 '.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 + '; } '; 4047 4048 if( $nectarFullPage.$usingFullScreenRows != false || $(this).find('.number > span').length == 0 ) { 4049 4050 // Separate each character into spans 4051 var $symbol = $(this).find('.symbol-wrap').clone(); 4052 $(this).find('.symbol-wrap').remove(); 4053 4054 var characters = $(this).find('.number').text().split(""); 4055 var $this = $(this).find('.number'); 4056 4057 $this.empty(); 4058 $.each(characters, function (i, el) { 4059 $this.append("<span>" + el + "</span"); 4060 });
4061 4062 // Handle symbol 4063 if ($(this).has('[data-symbol]')) { 4064 if ($(this).attr('data-symbol-pos') == 'after') { 4065 $this.append($symbol); 4066 } else { 4067 $this.prepend($symbol); 4068 } 4069 } 4070 4071 } // already made markup 4072 4073 }); 4074 4075 // Style 4076 nectarCreateStyle($blurCssString, 'milestone-blur'); 4077 4078 // Activate 4079 milestoneWaypoint(); 4080 4081 } 4082 4083 } 4084 4085 4086 /** 4087 * Milestone animation 4088 * 4089 * @since 4.0 4090 */ 4091 function milestoneWaypoint() { 4092 4093 $($fullscreenSelector + '.nectar-milestone').each(function () { 4094 4095 // Animation 4096 var $offset = ($fullscreenMarkupBool == true) ? '250%' : '98%'; 4097 4098 if( nectarDOMInfo.usingMobileBrowser && $offset == '98%') { 4099 $offset = '110%'; 4100 } 4101 4102 var $that = $(this), 4103 waypoint = new Waypoint({ 4104 element: $that, 4105 handler: function () { 4106 4107 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 4108 waypoint.destroy(); 4109 return; 4110 } 4111 4112 var $endNum = parseInt($that.find('.number span:not(.symbol)').text().replace(/,/g, '')); 4113 4114 if (!$that.hasClass('motion_blur')) { 4115 4116 var countOptions = { 4117 easingFn: easeOutCubic 4118 }; 4119 var $countEle = $that.find('.number span:not(.symbol)')[0]; 4120 var numAnim = new CountUp($countEle, 0, $endNum, 0, 2.2, countOptions); 4121 numAnim.start(); 4122 4123 } else { 4124 $that.find('span').each(function (i) { 4125 var $that = $(this); 4126 setTimeout(function () { 4127 $that.addClass('in-sight'); 4128 }, 200 * i); 4129 }); 4130 } 4131 4132 4133 $that.addClass('animated-in'); 4134 waypoint.destroy(); 4135 }, 4136 offset: $offset 4137 4138 }); 4139 4140 }); 4141 } 4142 4143 4144 4145 /** 4146 * Tabbed element change section event. 4147 * 4148 * @since 10.5 4149 */ 4150 function tabbedChangeSection(clickedTab) { 4151 4152 var $id = clickedTab.parents('li').index() + 1; 4153 var $frontEndEditorTabDiv = ($('body.vc_editor').length > 0) ? '> .wpb_tab ' : ''; 4154 4155 if (!clickedTab.hasClass('active-tab') && !clickedTab.hasClass('loading')) { 4156 4157 clickedTab.parents('ul') 4158 .find('a') 4159 .removeClass('active-tab'); 4160 4161 clickedTab 4162 .addClass('active-tab'); 4163 4164 clickedTab.parents('.tabbed').find('> div:not(.clear)' + $frontEndEditorTabDiv).css({ 4165 'visibility': 'hidden', 4166 'position': 'absolute', 4167 'opacity': '0', 4168 'left': '-9999px', 4169 'display': 'none' 4170 }).removeClass('visible-tab'); 4171 4172 if ($('body.vc_editor').length > 0) { 4173 4174 var $data_m_id = (clickedTab.parent().is('[data-m-id]')) ? clickedTab.parent().attr('data-m-id') : ''; 4175 4176 clickedTab.parents('.tabbed').find('> div[data-model-id="' + $data_m_id + '"]' + $frontEndEditorTabDiv).css({ 4177 'visibility': 'visible', 4178 'position': 'relative', 4179 'left': '0', 4180 'display': 'block' 4181 }).stop().transition({ 4182 'opacity': 1 4183 }, 400).addClass('visible-tab'); 4184 4185 if( !$body.is('[data-flex-cols="true"]') ) { 4186 convertFrontEndPadding(); 4187 } 4188 4189 } else { 4190 clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ')' + $frontEndEditorTabDiv).css({ 4191 'visibility': 'visible', 4192 'position': 'relative', 4193 'left': '0', 4194 'display': 'block' 4195 }).stop().transition({ 4196 'opacity': 1 4197 }, 400).addClass('visible-tab'); 4198 } 4199 4200 if (clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ') .iframe-embed').length > 0 || 4201 clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ') .portfolio-items').length > 0) { 4202 setTimeout(function () { 4203 $window.trigger('resize'); 4204 }, 10); 4205 } 4206 } 4207 4208 // Waypoint checking 4209 if ($tabbedClickCount != 0) { 4210 4211 var $currentVisTab = clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ')' + $frontEndEditorTabDiv); 4212 4213 if ($currentVisTab.find('.nectar-progress-bar').length > 0) { 4214 progressBars(); 4215 } 4216 if ($currentVisTab.find('.divider-small-border [data-animate="yes"]').length > 0 || 4217 $currentVisTab.find('.divider-border [data-animate="yes"]').length > 0) { 4218 dividers(); 4219 } 4220 if ($currentVisTab.find('img.img-with-animation').length > 0 || 4221 $currentVisTab.find('.col.has-animation').length > 0 || 4222 $currentVisTab.find('.nectar_cascading_images').length > 0 || 4223 $currentVisTab.find('.wpb_column.has-animation').length > 0) { 4224 colAndImgAnimations();
4225 cascadingImageBGSizing(); 4226 } 4227 if ($currentVisTab.find('.parallax-layer').length > 0 || $currentVisTab.parents('.nectar-parallax-enabled').length > 0) { 4228 parallaxRowsBGCals(); 4229 for(var i=0; i < parallaxItemsArr.length; i++ ) { 4230 parallaxItemsArr[i].resize(); 4231 } 4232 } 4233 if ($currentVisTab.find('.nectar-milestone').length > 0) { 4234 milestoneWaypoint(); 4235 } 4236 if ($currentVisTab.find('.nectar_image_with_hotspots[data-animation="true"]').length > 0) { 4237 imageWithHotspots(); 4238 setTimeout(function(){ 4239 $window.trigger('resize'); 4240 },100); 4241 } 4242 if ($currentVisTab.find('.nectar-fancy-ul').length > 0) { 4243 nectarFancyUlInit(); 4244 } 4245 if ($currentVisTab.find('.nectar-split-heading').length > 0) { 4246 splitLineHeadings(); 4247 } 4248 if ($currentVisTab.find('.wpb_column[data-border-animation="true"]').length > 0) { 4249 animatedColBorders(); 4250 } 4251 if ($currentVisTab.find('.wpb_animate_when_almost_visible').length > 0) { 4252 vcWaypoints(); 4253 } 4254 if ($currentVisTab.find('.nectar-animated-title').length > 0) { 4255 animatedTitles(); 4256 } 4257 if ($currentVisTab.find('.nectar-highlighted-text').length > 0) { 4258 highlightedText(); 4259 } 4260 if ($currentVisTab.find('.nectar_food_menu_item').length > 0) { 4261 foodMenuItems(); 4262 } 4263 if ($currentVisTab.find('.nectar-post-grid:not([data-animation="none"])').length > 0) { 4264 NectarPostGridWaypoint(); 4265 } 4266 4267 if (clickedTab.parents('.wpb_row').length > 0) { 4268 4269 if ($currentVisTab.find('.vc_pie_chart').length > 0 || 4270 $currentVisTab.find('.wp-video-shortcode').length > 0 || 4271 $currentVisTab.find('.post-area.masonry .posts-container').length > 0 || 4272 $currentVisTab.find('.twentytwenty-container').length > 0 || 4273 clickedTab.parents('#nectar_fullscreen_rows[data-content-overflow="scrollbar"]').length > 0 || 4274 clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ')').find('.wpb_gallery').length > 0 || 4275 clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ')').find('.swiper-container').length > 0 || 4276 clickedTab.parents('.wpb_row').next().hasClass('parallax_section')) { 4277 $window.trigger('resize'); 4278 } 4279 4280 if ($currentVisTab.find('.nectar-flickity').length > 0 && typeof Flickity != 'undefined') { 4281 var tabbedFlkty = Flickity.data(clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ')').find('.nectar-flickity')[0]); 4282 tabbedFlkty.resize(); 4283 } 4284 4285 if ($currentVisTab.find('.nectar-woo-flickity').length > 0 && typeof Flickity != 'undefined') { 4286 var wootabbedFlkty = Flickity.data(clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ')').find('.nectar-woo-flickity > ul')[0]); 4287 wootabbedFlkty.resize(); 4288 $(window).trigger('nectar-product-filters-layout'); 4289 } 4290 4291 } 4292 4293 //SVG icons 4294 $currentVisTab.find('.svg-icon-holder').each(function (i) { 4295 4296 var $that = $(this); 4297 4298 setTimeout(function () { 4299 4300 var $animationDelay = 0; 4301 4302 if($that.is('[data-animation-delay]') && 4303 $that.attr('data-animation-delay').length > 0 && 4304 $that.attr('data-animation') != 'false') { 4305 $animationDelay = $that.attr('data-animation-delay'); 4306 } 4307 4308 clearTimeout($animatedSVGIconTimeout[i]); 4309 4310 if ($that.attr('data-animation') == 'false') { 4311 $that.css('opacity', '1'); 4312 $svgIcons[$that.find('svg').attr('id').slice(-1)].finish(); 4313 } else { 4314 4315 $svgIcons[$that.find('svg').attr('id').slice(-1)].reset(); 4316 $animatedSVGIconTimeout[i] = setTimeout(function () { 4317 $svgIcons[$that.find('svg').attr('id').slice(-1)].play(); 4318 }, $animationDelay); 4319 4320 } 4321 }, 150); 4322 }); 4323 4324 } 4325 4326 // Fix columns inside tabs 4327 clickedTab.parents('.tabbed').find('.wpb_row').each(function () { 4328 if (typeof $(this).find('[class*="vc_col-"]').first().offset() != 'undefined') { 4329 4330 var $firstChildOffset = $(this).find('[class*="vc_col-"]').first().offset().left; 4331 4332 $(this).find('[class*="vc_col-"]').each(function () { 4333 $(this).removeClass('no-left-margin'); 4334 if ($(this).offset().left < $firstChildOffset + 15) { 4335 $(this).addClass('no-left-margin'); 4336 } else { 4337 $(this).removeClass('no-left-margin'); 4338 } 4339 });
4340 } 4341 4342 }); 4343 4344 $tabbedClickCount++; 4345 4346 // Magic line 4347 if (clickedTab.parent().parent().find('.magic-line').length > 0) { 4348 magicLineCalc(clickedTab); 4349 } 4350 4351 $(window).trigger('nectar-tab-changed'); 4352 4353 } 4354 4355 4356 /** 4357 * Tabbed element magic line - used for style "Minimal alt" 4358 * 4359 * @since 7.0 4360 */ 4361 function magicLineCalc($ele) { 4362 4363 var el, leftPos, ratio; 4364 4365 el = $ele.parent(); 4366 if (el.length) { 4367 leftPos = el.position().left; 4368 ratio = el.width(); 4369 } else { 4370 leftPos = ratio = 0; 4371 } 4372 4373 4374 $ele.parent().parent() 4375 .find('.magic-line') 4376 .css('transform', 'translateX(' + leftPos + 'px) scaleX(' + ratio + ')'); 4377 } 4378 4379 4380 /** 4381 * Tabbed element deep linking. 4382 * 4383 * @since 3.0 4384 */ 4385 function tabbbedDeepLinking() { 4386 4387 if (typeof nectarGetQueryParam['tab'] != 'undefined') { 4388 4389 $('.wpb_tabs_nav').each(function () { 4390 4391 $(this).find('li').each(function () { 4392 4393 var $currentText = $(this).find('a').clone(), 4394 $getText = nectarGetQueryParam['tab'], 4395 $that = $(this); 4396 4397 $currentText.find('svg').remove(); 4398 $currentText = $currentText.text(); 4399 $currentText = $currentText.replace(/\s+/g, '-').toLowerCase(); 4400 4401 // SVG icons. 4402 if( $currentText.length > 0 && $currentText.substring(0,1) === '-' ) { 4403 $currentText = $currentText.substring(1); 4404 } 4405 4406 $getText = $getText.replace(/\s+/g, '-').replace(/</g, '<').replace(/"/g, '"').toLowerCase(); 4407 4408 if ($currentText == $getText) { 4409 4410 $(this).find('a').trigger('click'); 4411 4412 setTimeout(function () { 4413 $that.find('a').trigger('click'); 4414 }, 501); 4415 } 4416 4417 }); 4418 4419 }); 4420 4421 } 4422 4423 } 4424 4425 4426 4427 /** 4428 * Tabbed element initialization. 4429 * 4430 * @since 3.0 4431 */ 4432 function tabbedInit() { 4433 4434 // Click event. 4435 $body.on('click', '.tabbed > ul li:not(.cta-button) a', function(e){ 4436 4437 tabbedChangeSection($(this)); 4438 4439 // Mobile scroll to. 4440 if (e.originalEvent !== undefined && nectarDOMInfo.winW < 1000 && $nectarFullPage.$usingFullScreenRows == false) { 4441 4442 // Ensure that it would be needed. 4443 var $tabbedNav = $(this).closest('.tabbed').find('> ul'); 4444 4445 if( $tabbedNav.height() > 350 ) { 4446 4447 var $scrollTopDistance = $tabbedNav.offset().top + $tabbedNav.height() - nectarDOMInfo.adminBarHeight; 4448 4449 if( $('#header-outer[data-mobile-fixed="1"]').length > 0 ) { 4450 $scrollTopDistance = $tabbedNav.offset().top + $tabbedNav.height() - $headerOuterEl.outerHeight() - nectarDOMInfo.adminBarHeight 4451 } 4452 4453 nectar_scrollToY($scrollTopDistance, 700, 'easeInOutQuint'); 4454 } 4455 4456 } 4457 4458 return false; 4459 }); 4460 4461 // Custom user def anchor click event helper. 4462 $('a[class*="nectar-tab-trigger"]').on('click', function(e) { 4463 4464 // verify the link is setup correct. 4465 if( !$(this).is('[href*="#"]') || $(this).attr('href').length < 1 ) { 4466 return true; 4467 } 4468 4469 var clickedTrigger = $(this).attr('href'); 4470 clickedTrigger = clickedTrigger.substr(1); 4471 clickedTrigger = clickedTrigger.replace(/\s+/g, '-').replace(/</g, '<').replace(/"/g, '"').toLowerCase(); 4472 4473 $('.wpb_tabs_nav').each(function () { 4474 4475 $(this).find('li').each(function () { 4476 4477 var $currentText = $(this).find('a').clone(); 4478 4479 $currentText.find('svg').remove(); 4480 $currentText = $currentText.text(); 4481 $currentText = $currentText.replace(/\s+/g, '-').toLowerCase(); 4482 4483 // SVG icons. 4484 if( $currentText.length > 0 && $currentText.substring(0,1) === '-' ) { 4485 $currentText = $currentText.substring(1); 4486 } 4487 4488 // trigger. 4489 if ($currentText == clickedTrigger) { 4490 $(this).find('a').trigger('click'); 4491 } 4492 4493 }); 4494 4495 }); 4496 4497 e.preventDefault(); 4498 4499 }); 4500 4501 4502 $('.tabbed').each(function () { 4503 4504 var $that; 4505 4506 // Handle icons 4507 $(this).find('.wpb_tab').each(function (i) { 4508 4509 if ($(this).is('[data-tab-icon]') && $(this).attr('data-tab-icon').length > 0) { 4510 4511 $(this) 4512 .parents('.tabbed') 4513 .addClass('using-icons'); 4514 4515 $(this) 4516 .parents('.tabbed') 4517 .find('.wpb_tabs_nav li:nth-child(' + (i + 1) + ') > a') 4518 .prepend('<i class="' + $(this).attr("data-tab-icon") + '"></i>'); 4519 4520 } 4521 4522 // SVG icons 4523 if ($(this).find('.im-icon-wrap.tab-icon').length > 0) { 4524 4525 var $svg_icon_markup = $(this).find('.im-icon-wrap.tab-icon').detach(); 4526 $(this).parents('.tabbed') 4527 .find('.wpb_tabs_nav li:nth-child(' + (i + 1) + ') > a') 4528 .prepend($svg_icon_markup); 4529 } 4530 4531 }); 4532 4533 4534 $(this).find('> ul li:first-child a').trigger('click'); 4535 4536 $that = $(this); 4537 4538 // Minimal alt effect 4539 setTimeout(function () { 4540 if ($that.is('[data-style="minimal_alt"]')) { 4541 $that.find('> ul').append('<li class="magic-line" />'); 4542 magicLineCalc($that.find('> ul > li:first-child > a')); 4543 } 4544 }, 100); 4545 4546 4547 }); 4548 4549 // Minimal alt resize event. 4550 if ( $('.tabbed[data-style="minimal_alt"]').length > 0 ) { 4551 $window.on('smartresize',function(){ 4552 4553 $('.tabbed[data-style="minimal_alt"]').each(function(){ 4554 4555 if( $(this).find('a.active-tab').length > 0 ) { 4556 magicLineCalc( $(this).find('a.active-tab') ); 4557 } 4558 4559 });
4560 4561 4562 }); 4563 4564 } 4565 4566 4567 tabbbedDeepLinking(); 4568 4569 // Vertical scrolling 4570 $('.nectar-scrolling-tabs').each(function(i) { 4571 if(!nectarDOMInfo.usingFrontEndEditor) { 4572 $verticalScrollingTabs[i] = new VerticalScrollingTabs($(this)); 4573 } 4574 }); 4575 4576 // Tab change event. 4577 $(window).on('nectar-tab-changed', wooProductCarouselAnimations); 4578 4579 4580 } 4581 4582 4583 /** 4584 * Vertical Scrolling Tabs 4585 * 4586 * @since 12.0 4587 */ 4588 4589 function VerticalScrollingTabs(el) { 4590 4591 this.$el = el; 4592 this.$tabContent = el.find('.scrolling-tab-content'); 4593 this.$lineEl = el.find('.scrolling-tab-nav .line'); 4594 this.observer = null; 4595 4596 this.domSetup(); 4597 this.highlightObserve(); 4598 // Sticky handled in NectarStickyEls(); 4599 4600 } 4601 4602 VerticalScrollingTabs.prototype.domSetup = function() { 4603 4604 var that = this; 4605 var href = ''; 4606 4607 4608 // Icons 4609 this.$el.find('.wpb_tab').each(function (i) { 4610 4611 if ($(this).is('[data-tab-icon]') && $(this).attr('data-tab-icon').length > 0) { 4612 that.$el.addClass('using-icons'); 4613 4614 href = that.$el.find('.wpb_tabs_nav li:nth-child(' + (i + 1) + ') a').attr('href'); 4615 4616 that.$el 4617 .find('.wpb_tabs_nav li:nth-child(' + (i + 1) + ')') 4618 .addClass('has-icon') 4619 .prepend('<a class="skip-hash" href="'+href+'"><i class="' + $(this).attr("data-tab-icon") + '"></i></a>'); 4620 } 4621 4622 // SVG icons 4623 if ($(this).find('.im-icon-wrap.tab-icon').length > 0) { 4624 4625 href = that.$el.find('.wpb_tabs_nav li:nth-child(' + (i + 1) + ') a').attr('href'); 4626 4627 var $svg_icon_markup = $(this).find('.im-icon-wrap.tab-icon').detach(); 4628 that.$el 4629 .find('.wpb_tabs_nav li:nth-child(' + (i + 1) + ')') 4630 .addClass('has-icon') 4631 .prepend('<a class="skip-hash svg-icon-link" href="'+href+'"></a>'); 4632 4633 that.$el.find('.wpb_tabs_nav li:nth-child(' + (i + 1) + ') .svg-icon-link').append($svg_icon_markup); 4634 4635 } 4636 4637 }); 4638 4639 4640 // First active 4641 this.$el.find('.scrolling-tab-nav .menu-item:first').addClass('active'); 4642 this.lineAnimation(); 4643 4644 // Only tab 4645 if( this.$el.find('.scrolling-tab-nav .menu-item').length == 1 ) { 4646 this.$el.find('.scrolling-tab-nav').addClass('single-tab'); 4647 } 4648 4649 var $tabContent = this.$el.find('.scrolling-tab-content'); 4650 4651 this.$el.find('.scrolling-tab-nav .menu-item').each(function(i) { 4652 4653 i = i+1; 4654 var $tab = $tabContent.find('> div:nth-child('+i+')'); 4655 4656 // Add titles to mobile 4657 var $title = $(this).html(); 4658 $tab.prepend('<div class="scrolling-tab-mobile-title"><div class="inner">' + wlEls($title) + '</div></div>'); 4659 $tab.find('.scrolling-tab-mobile-title a').contents().unwrap(); 4660 4661 // Create normal anchor relation. 4662 if( $tab ) { 4663 var id = $(this).find('a').attr('href'); 4664 id = id.substr(1); 4665 $tab.find('> .scrolling-tab-mobile-title').attr('id',id); 4666 $tab.removeAttr('id'); 4667 } 4668 4669 }); 4670 4671 this.$el.addClass('initalized'); 4672 4673 }; 4674 4675 VerticalScrollingTabs.prototype.highlightObserve = function() { 4676 4677 var that = this; 4678 4679 if( !(nectarDOMInfo.usingMobileBrowser && nectarDOMInfo.winW < 1000) ) { 4680 4681 if( 'IntersectionObserver' in window ) { 4682 4683 var rMarign = ($headerOuterEl.is('[data-remove-fixed="1"]')) ? '100px 0px 0px 0px' : '5px 0px 0px 0px'; 4684 4685 var options = { 4686 rootMargin: rMarign, 4687 threshold: 1 4688 } 4689 4690 this.observer = new IntersectionObserver(function(entries) { 4691 4692 entries.forEach(function(entry) { 4693 4694 var href = '#' + $(entry.target).attr('id'); 4695 var $menuItem = that.$el.find('.scrolling-tab-nav a[href="'+href+'"]'); 4696 4697 if (entry.isIntersecting && entry.intersectionRatio >= 1) { 4698 4699 $menuItem.parents('.menu-item').addClass('visible'); 4700 4701 } else { 4702 $menuItem.parents('.menu-item').removeClass('visible'); 4703 } 4704 4705 // Highlight 4706 var $firstVisLink = that.$el.find('.scrolling-tab-nav .menu-item.visible:first'); 4707 4708 // a link is visible 4709 if( $firstVisLink.length > 0 ) { 4710 that.$el.find('.scrolling-tab-nav .menu-item').removeClass('active'); 4711 $firstVisLink.addClass('active'); 4712 that.lineAnimation(); 4713 } 4714 4715 4716 });
4717 4718 }, options); 4719 4720 // Observe each section. 4721 this.$tabContent.find('> div > .scrolling-tab-mobile-title[id]').each(function() { 4722 that.observer.observe($(this)[0]); 4723 }); 4724 4725 } // if intersection observer. 4726 4727 } // don't trigger on mobile. 4728 4729 }; 4730 4731 VerticalScrollingTabs.prototype.lineAnimation = function() { 4732 4733 var activeItem = this.$el.find('.scrolling-tab-nav .active'); 4734 4735 if( activeItem.length == 0 ) { 4736 return; 4737 } 4738 4739 var itemOffset = parseInt(activeItem.position().top); 4740 var itemHeight = parseInt(activeItem.height()); 4741 4742 this.$lineEl.css({ 4743 'max-height': itemHeight + 'px', 4744 'transform' : 'translate3d(0px, '+itemOffset+'px, 0px)' 4745 }); 4746 4747 }; 4748 4749 4750 4751 4752 4753 4754 4755 4756 /** 4757 * Toggle Panels element deep linking. 4758 * 4759 * @since 3.0 4760 */ 4761 function accordionDeepLinking() { 4762 4763 if (typeof nectarGetQueryParam['toggle'] != 'undefined') { 4764 $('.toggles').each(function () { 4765 4766 $(this).find('.toggle').each(function () { 4767 var $currentText = $(this).find('h3 a').clone(); 4768 var $getText = nectarGetQueryParam['toggle']; 4769 4770 $($currentText).find('i').remove(); 4771 $currentText = $currentText.text(); 4772 $currentText = $currentText.replace(/\s+/g, '-').toLowerCase(); 4773 $getText = $getText.replace(/\s+/g, '-').replace(/</g, '<').replace(/"/g, '"').toLowerCase(); 4774 4775 if ($currentText == $getText) { 4776 $(this).find('h3 a').trigger('click'); 4777 } 4778 }); 4779 }); 4780 } 4781 4782 } 4783 4784 4785 4786 4787 function accordionSizing() { 4788 4789 $('.toggles').each(function(){ 4790 4791 var openToggle = $(this).find('.toggle.open'); 4792 4793 if( openToggle.length > 0 ) { 4794 4795 openToggle.each(function() { 4796 var openToggleInner = $(this).find('> div')[0]; 4797 openToggleInner.style.maxHeight = openToggleInner.scrollHeight + "px"; 4798 }); 4799 4800 } 4801 4802 4803 }); 4804 4805 } 4806 4807 /** 4808 * Toggle Panels element initialization. 4809 * 4810 * @since 3.0 4811 */ 4812 function accordionInit() { 4813 4814 setTimeout(function() { 4815 4816 $('.toggles.accordion:not([data-starting="closed"])').each(function () { 4817 4818 // Legacy. 4819 if( $(this).find('.toggle[data-inner-wrap="true"]').length == 0 ) { 4820 $(this).find('> .toggle').first().addClass('open').find('> div').show(); 4821 } else if(!nectarDOMInfo.usingFrontEndEditor) { 4822 var $firstToggle = $(this).find('> .toggle').first(); 4823 $firstToggle.addClass('open'); 4824 $firstToggle.find('> div')[0].style.maxHeight = $firstToggle.find('> div')[0].scrollHeight + "px"; 4825 } 4826 4827 $(this).find('> .toggle').first().find('a:not(.nectar-button) i').attr('class', 'fa fa-minus-circle'); 4828 4829 }); 4830 4831 setTimeout(accordionDeepLinking,300); 4832 4833 }, 60); 4834 4835 if( $('.toggle[data-inner-wrap="true"]').length > 0 ) { 4836 $window.on('smartresize', accordionSizing); 4837 } 4838 4839 } 4840 4841 function accordionClickEvents() { 4842 4843 4844 $body.on('click', '.toggle h3 a', function () { 4845 4846 // Regular toggle click event 4847 if (!$(this).parents('.toggles').hasClass('accordion')) { 4848 4849 // Legacy. 4850 if( $(this).parents('.toggle[data-inner-wrap="true"]').length == 0 ) { 4851 4852 $(this).parents('.toggle') 4853 .find('> div') 4854 .slideToggle(300); 4855 4856 } else { 4857 4858 var parentEl = $(this).parents('.toggle').find('> div')[0]; 4859 4860 if (parentEl.style.maxHeight) { 4861 parentEl.style.maxHeight = null; 4862 } else { 4863 parentEl.style.maxHeight = parentEl.scrollHeight + "px"; 4864 } 4865 4866 } 4867 4868 4869 $(this).parents('.toggle') 4870 .toggleClass('open'); 4871 4872 // Switch icon 4873 if ($(this).parents('.toggle').hasClass('open')) { 4874 $(this) 4875 .find('i') 4876 .attr('class', 'fa fa-minus-circle'); 4877 } else { 4878 $(this) 4879 .find('i') 4880 .attr('class', 'fa fa-plus-circle'); 4881 } 4882 4883 if ($(this).parents('.toggle').find('> div .iframe-embed').length > 0 && 4884 $(this).parents('.toggle').find('> div iframe.iframe-embed').height() == '0') { 4885 responsiveVideoIframes(); 4886 } 4887 4888 // toggles which contain images 4889 if( $(this).parents('.toggle').find('> div img').length > 0 && 4890 $(this).parents('.toggle').is('[data-inner-wrap="true"]') ) { 4891 4892 for(var j=1; j<10; j++ ) { 4893 setTimeout(accordionSizing, j*100); 4894 } 4895 } 4896 4897 if ($(this).parents('.full-width-content').length > 0) { 4898 setTimeout(function () { 4899 fullWidthContentColumns(); 4900 }, 300); 4901 } 4902 4903 if ($('#nectar_fullscreen_rows').length > 0) { 4904 setTimeout(function () { 4905 $window.trigger('smartresize'); 4906 }, 300); 4907 } 4908 return false; 4909 } 4910 }); 4911 4912 // Accordion click event 4913 $body.on('click', '.toggles.accordion .toggle h3 a', function (e) { 4914 4915 if ($(this).parents('.toggle').hasClass('open')) { 4916 return false; 4917 } 4918 4919 var $t; 4920 var $parentToggles = $(this).parents('.toggles'); 4921 var $parentToggle = $(this).parents('.toggle'); 4922 4923 4924 // Legacy. 4925 if( $(this).parents('.toggle[data-inner-wrap="true"]').length == 0 ) { 4926 4927 $parentToggles.find('.toggle > div').slideUp(300); 4928 $parentToggles.find('.toggle h3 a i').attr('class', 'fa fa-plus-circle'); 4929 $parentToggles.find('.toggle').removeClass('open'); 4930 $parentToggle.find('> div').slideDown(300); 4931 $parentToggle.addClass('open'); 4932 4933 } else { 4934 4935 // Mobile scroll to. 4936 if (e.originalEvent !== undefined && 4937 nectarDOMInfo.winW < 1000 && 4938 $parentToggles.find('.toggle.open').length > 0 && 4939 $nectarFullPage.$usingFullScreenRows == false) { 4940 4941 var $openToggle = $parentToggles.find('.toggle.open'); 4942 4943 setTimeout(function(){ 4944 var $scrollTopDistance = $parentToggle.offset().top - nectarDOMInfo.adminBarHeight; 4945 4946 if( $('#header-outer[data-mobile-fixed="1"]').length > 0 ) { 4947 $scrollTopDistance = $parentToggle.offset().top - $headerOuterEl.outerHeight() - nectarDOMInfo.adminBarHeight 4948 } 4949 4950 nectar_scrollToY($scrollTopDistance, 500, 'easeInOutQuint'); 4951 },50); 4952 4953 } 4954 4955 4956 var parentEl = $parentToggle.find('> div')[0]; 4957 4958 $parentToggles.find('.toggle > div').each(function(){ 4959 $(this)[0].style.maxHeight = null; 4960 });
4961 4962 $parentToggles.find('.toggle h3 a i').attr('class', 'fa fa-plus-circle'); 4963 $parentToggles.find('.toggle').removeClass('open'); 4964 4965 parentEl.style.maxHeight = parentEl.scrollHeight + "px"; 4966 4967 $parentToggle.addClass('open'); 4968 4969 } 4970 4971 4972 // Switch icon 4973 if ($parentToggle.hasClass('open')) { 4974 $(this).find('i').attr('class', 'fa fa-minus-circle'); 4975 } else { 4976 $(this).find('i').attr('class', 'fa fa-plus-circle'); 4977 } 4978 4979 if ($(this).parents('.full-width-content').length > 0) { 4980 clearTimeout($t); 4981 $t = setTimeout(function () { 4982 fullWidthContentColumns(); 4983 }, 400); 4984 } 4985 if ($('#nectar_fullscreen_rows').length > 0) { 4986 clearTimeout($t); 4987 $t = setTimeout(function () { 4988 $window.trigger('smartresize'); 4989 }, 400); 4990 } 4991 4992 return false; 4993 4994 }); 4995 4996 } 4997 4998 4999 /** 5000 * Sticky elements powered by CSS. 5001 * 5002 * @since 12.2 5003 */ 5004 function NectarStickyEls() { 5005 this.selectors = '.nectar-sticky-pos'; 5006 5007 if($(this.selectors).length === 0) { 5008 return; 5009 } 5010 5011 this.topOffset = 0; 5012 this.topOffsetCushion = 60; 5013 this.calcTopOffset(); 5014 this.resizeEvent(); 5015 $window.on('resize', this.resizeEvent.bind(this)); 5016 } 5017 5018 NectarStickyEls.prototype.calcTopOffset = function() { 5019 5020 if ($('.page-template-template-no-header-footer').length > 0 || 5021 $('.page-template-template-no-header').length > 0 || 5022 $('#header-outer[data-remove-fixed="1"]').length > 0 || 5023 $('body[data-header-format="left-header"]').length > 0 ) { 5024 this.topOffset = 0; 5025 } else { 5026 5027 var $headerNavSpace = $('#header-space').outerHeight(); 5028 var resize = 0; 5029 5030 // Resize effect. 5031 if( $('#header-outer[data-header-resize="1"]').length > 0 ) { 5032 var headerPadding = parseInt($headerOuterEl.attr('data-padding')) - parseInt($headerOuterEl.attr('data-padding')) / 1.8; 5033 resize = parseInt(logoShrinkNum) + headerPadding * 2; 5034 } 5035 5036 this.topOffset = parseInt($headerNavSpace) + resize + nectarDOMInfo.adminBarHeight; 5037 5038 // Condense effect. 5039 if ($('#header-outer[data-condense="true"]').length > 0) { 5040 5041 var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'), 5042 $headerHeightStored = $headerOuterEl.height(),
5043 $headerHeightCondensed = $headerHeightStored - (parseInt($headerSpan9.height()) + parseInt($('#header-outer #logo').css('margin-top'))); 5044 5045 this.topOffset = parseInt($headerNavSpace) + $headerHeightCondensed - nectarDOMInfo.adminBarHeight; 5046 5047 } 5048 5049 } 5050 5051 this.topOffset += this.topOffsetCushion; 5052 5053 5054 }; 5055 5056 NectarStickyEls.prototype.resizeEvent = function() { 5057 5058 if( nectarDOMInfo.winW > 1000 ) { 5059 5060 this.calcTopOffset(); 5061 5062 $(this.selectors).css({ 5063 'position':'sticky', 5064 'top': this.topOffset 5065 }); 5066 } else { 5067 $(this.selectors).css({ 5068 'position': '', 5069 'top': '' 5070 }); 5071 } 5072 5073 }; 5074 5075 5076 /** 5077 * Color hex to rgb 5078 * 5079 * @since 3.0 5080 */ 5081 function shadeColor(hex, lum) { 5082 5083 // Validate hex string 5084 hex = String(hex).replace(/[^0-9a-f]/gi, ''); 5085 if (hex.length < 6) { 5086 hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2]; 5087 } 5088 lum = lum || 0; 5089 5090 // Convert to decimal and change luminosity 5091 var rgb = "#", 5092 c, i; 5093 for (i = 0; i < 3; i++) { 5094 c = parseInt(hex.substr(i * 2, 2), 16); 5095 c = Math.round(Math.min(Math.max(0, c + (c * lum)), 255)).toString(16); 5096 rgb += ("00" + c).substr(c.length); 5097 } 5098 5099 return rgb; 5100 } 5101 5102 /** 5103 * Jumbo size 3D nectar button. 5104 * 5105 * @since 3.0 5106 */ 5107 function createExtraJumboSize() { 5108 5109 $('.nectar-3d-transparent-button').each(function () { 5110 5111 if ($(this).css('visibility') != 'visible') { 5112 return; 5113 } 5114 5115 var $that = $(this), 5116 $size = $that.attr('data-size'), 5117 $padding = 0; 5118 5119 var $vert_height_divider = 1.7; 5120 5121 if ($size == 'extra_jumbo') { 5122 5123 var $font_size; 5124 5125 if (nectarDOMInfo.winW < 1000 && nectarDOMInfo.winW > 690) { 5126 $padding = 64; 5127 $font_size = 34; 5128 $that.find('.back-3d rect').attr('stroke-width', '12'); 5129 $vert_height_divider = 1.7; 5130 } else if (nectarDOMInfo.winW <= 690) { 5131 $padding = 46; 5132 $font_size = 16; 5133 $that.find('.back-3d rect').attr('stroke-width', '10'); 5134 $vert_height_divider = 1.7; 5135 } else { 5136 $padding = 100; 5137 $font_size = 64; 5138 $that.find('.back-3d rect').attr('stroke-width', '20'); 5139 $vert_height_divider = 1.6; 5140 } 5141 5142 5143 $that.find('svg text').attr('font-size', $font_size); 5144 5145 var $boundingRect = $(this).find('.back-3d .button-text')[0].getBoundingClientRect(), 5146 $text_width = $boundingRect.width, 5147 $text_height = $font_size * 1.5; 5148 5149 $that.css({ 5150 'width': ($text_width + $padding * 1.5) + 'px', 5151 'height': ($text_height + $padding) + 'px' 5152 }); 5153 5154 $that.find('> a').css({ 5155 'height': ($text_height + $padding) + 'px' 5156 }); 5157 5158 $that.find('.back-3d svg, .front-3d svg').css({ 5159 'width': ($text_width + $padding * 1.5) + 'px', 5160 'height': ($text_height + $padding) + 'px' 5161 }).attr('viewBox', '0 0 ' + ($text_width + $padding * 1.5) + ' ' + ($text_height + $padding)); 5162 5163 $that.find('svg text').attr('transform', 'matrix(1 0 0 1 ' + ($text_width + $padding * 1.6) / 2 + ' ' + (($text_height + $padding) / $vert_height_divider) + ')'); 5164 $that.find('.front-3d ').css('transform-origin', '50% 50% -' + ($text_height + $padding) / 2 + 'px'); 5165 $that.find('.back-3d').css('transform-origin', '50% 50% -' + ($text_height + $padding) / 2 + 'px'); 5166 5167 } 5168 5169 }); 5170 5171 } 5172 5173 5174 /** 5175 * Nectar Button custom coloring 5176 * 5177 * @since 3.0 5178 */ 5179 function coloredButtons() { 5180 5181 $('.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 () { 5182 5183 var $usingMaterialSkin = ($('body.material[data-button-style^="rounded"]').length > 0) ? true : false; 5184 $(this).css('visibility', 'visible'); 5185 5186 if ($(this).hasClass('see-through-3') && $(this).attr('data-color-override') == 'false') { 5187 return true; 5188 } 5189 5190 var $color; 5191 var $that; 5192 5193 if ($(this).attr('data-color-override') != 'false') { 5194 $color = $(this).attr('data-color-override'); 5195 } else { 5196
5197 if ($(this).parents('.dark').length > 0) { 5198 $color = '#000000'; 5199 } else { 5200 $color = '#ffffff'; 5201 } 5202 5203 } 5204 5205 if (!$(this).hasClass('see-through-3')) { 5206 $(this).css('color', $color); 5207 } 5208 5209 $(this).find('i').css('color', $color); 5210 5211 var colorInt = parseInt($color.substring(1), 16); 5212 var $hoverColor = ($(this).has('[data-hover-color-override]')) ? $(this).attr('data-hover-color-override') : 'no-override'; 5213 var $hoverTextColor = ($(this).has('[data-hover-text-color-override]')) ? $(this).attr('data-hover-text-color-override') : '#fff'; 5214 5215 var R = (colorInt & 0xFF0000) >> 16; 5216 var G = (colorInt & 0x00FF00) >> 8; 5217 var B = (colorInt & 0x0000FF) >> 0; 5218 5219 var $opacityStr = ($(this).hasClass('see-through-3')) ? '1' : '0.75'; 5220 5221 $(this).css('border-color', 'rgba(' + R + ',' + G + ',' + B + ',' + $opacityStr + ')'); 5222 5223 // Material theme skin buttons w/ icons starting 5224 if ($usingMaterialSkin) { 5225 $(this).find('i').css({ 5226 'background-color': 'rgba(' + R + ',' + G + ',' + B + ',1)', 5227 'box-shadow': '0px 8px 15px rgba(' + R + ',' + G + ',' + B + ',0.24)' 5228 }); 5229 } 5230 5231 if ($(this).hasClass('see-through')) { 5232 5233 $that = $(this); 5234 5235 $(this).on('mouseenter touchstart', function () { 5236 $that.css('border-color', 'rgba(' + R + ',' + G + ',' + B + ',1)'); 5237 }); 5238 5239 $(this).on('mouseleave touchtouchend', function () { 5240 $that.css('border-color', 'rgba(' + R + ',' + G + ',' + B + ',1)'); 5241 $opacityStr = ($(this).hasClass('see-through-3')) ? '1' : '0.75'; 5242 $that.css('border-color', 'rgba(' + R + ',' + G + ',' + B + ',' + $opacityStr + ')'); 5243 }); 5244 5245 } else { 5246 5247 $(this).find('i').css('color', $hoverTextColor); 5248 5249 if ($hoverColor != 'no-override') { 5250 5251 $that = $(this); 5252 5253 $(this).on('mouseenter touchstart', function () { 5254 5255 $that.css({ 5256 'border-color': $hoverColor, 5257 'background-color': $hoverColor, 5258 'color': $hoverTextColor 5259 });
5260 5261 // Material buttons w/ icons over 5262 if ($usingMaterialSkin) { 5263 $that.find('i').css({ 5264 'background-color': '', 5265 'box-shadow': '' 5266 }); 5267 } 5268 }); 5269 5270 $(this).on('mouseleave touchtouchend', function () { 5271 5272 $opacityStr = ($(this).hasClass('see-through-3')) ? '1' : '0.75'; 5273 5274 if ($usingMaterialSkin) { 5275 $that.find('i').css({ 5276 'background-color': 'rgba(' + R + ',' + G + ',' + B + ',1)', 5277 'box-shadow': '0px 8px 15px rgba(' + R + ',' + G + ',' + B + ',0.24)' 5278 }); 5279 } 5280 5281 if (!$that.hasClass('see-through-3')) { 5282 $that.css({ 5283 'border-color': 'rgba(' + R + ',' + G + ',' + B + ',' + $opacityStr + ')', 5284 'background-color': 'transparent', 5285 'color': $color 5286 }); 5287 } else { 5288 $that.css({ 5289 'border-color': 'rgba(' + R + ',' + G + ',' + B + ',' + $opacityStr + ')', 5290 'background-color': 'transparent' 5291 }); 5292 } 5293 5294 }); 5295 5296 } else { 5297 5298 $that = $(this); 5299 5300 $(this).on('mouseenter touchstart', function () { 5301 5302 $that.css({ 5303 'border-color': $hoverColor, 5304 'color': $hoverTextColor 5305 });
5306 5307 }); 5308 5309 $(this).on('mouseleave touchtouchend', function () { 5310 5311 $opacityStr = ($that.hasClass('see-through-3')) ? '1' : '0.75'; 5312 $that.css({ 5313 'border-color': 'rgba(' + R + ',' + G + ',' + B + ',' + $opacityStr + ')', 5314 'color': $hoverTextColor 5315 }); 5316 5317 }); 5318 5319 } 5320 } 5321 }); 5322 5323 $('.nectar-button:not(.see-through):not(.see-through-2):not(.see-through-3)[data-color-override]').each(function () { 5324 5325 $(this).css('visibility', 'visible'); 5326 5327 if ($(this).attr('data-color-override') != 'false') { 5328 5329 var $color = $(this).attr('data-color-override'); 5330 5331 $(this) 5332 .removeClass('accent-color') 5333 .removeClass('extra-color-1') 5334 .removeClass('extra-color-2') 5335 .removeClass('extra-color-3') 5336 .css('background-color', $color); 5337 } 5338 5339 }); 5340 5341 5342 // Solid color tilt 5343 if ($('.swiper-slide .solid_color_2').length > 0 || $('.tilt-button-inner').length > 0) { 5344 5345 var $tiltButtonCssString = ''; 5346 var $color; 5347 5348 $('.swiper-slide .solid_color_2 a').each(function (i) { 5349 5350 $(this).addClass('instance-' + i); 5351 5352 if ($(this).attr('data-color-override') != 'false') { 5353 $color = $(this).attr('data-color-override'); 5354 } else { 5355 if ($(this).parents('.dark').length > 0) { 5356 $color = '#000000'; 5357 } 5358 else { 5359 $color = '#ffffff'; 5360 } 5361 } 5362 5363 $(this).css('color', $color); 5364 $(this).find('i').css('color', $color); 5365 5366 var $currentColor = $(this).css('background-color'), 5367 $topColor = shadeColor($currentColor, 0.13), 5368 $bottomColor = shadeColor($currentColor, -0.15); 5369 5370 $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 + '; } '; 5371 5372 }); 5373 5374 5375 $('.tilt-button-wrap a').each(function (i) { 5376 5377 $(this).addClass('instance-' + i); 5378 5379 var $currentColor = $(this).css('background-color'); 5380 var $color; 5381 5382 if ($(this).attr('data-color-override') != 'false') { 5383 $color = $(this).attr('data-color-override'); 5384 $(this).css('background-color', $color); 5385 $currentColor = $color; 5386 } 5387 5388 var $topColor = shadeColor($currentColor, 0.13), 5389 $bottomColor = shadeColor($currentColor, -0.15); 5390 5391 $tiltButtonCssString += '.tilt-button-wrap a.instance-' + i + ':after { background-color: ' + $topColor + '; }' + ' .tilt-button-wrap a.instance-' + i + ':before { background-color: ' + $bottomColor + '; } '; 5392 5393 }); 5394 5395 // Style 5396 nectarCreateStyle($tiltButtonCssString, 'tilt-button'); 5397 5398 } 5399 5400 5401 // Transparent 3D 5402 if ($('.nectar-3d-transparent-button').length > 0) { 5403 5404 var $3dTransButtonCssString = ''; 5405 $('.nectar-3d-transparent-button').each(function (i) { 5406 5407 var $that = $(this), 5408 $size = $that.attr('data-size'), 5409 $padding = 0, 5410 v1 = 1.5, 5411 v2 = 1.65, 5412 $font_size; 5413 5414 // Size 5415 if ($size == 'large') { 5416 $padding = 46; 5417 $font_size = 16; 5418 v1 = 1.5; 5419 v2 = 1.7; 5420 } else if ($size == 'medium') { 5421 $padding = 30; 5422 $font_size = 16; 5423 } else if ($size == 'small') { 5424 $padding = 20; 5425 $font_size = 12; 5426 } else if ($size == 'jumbo') { 5427 $padding = 54; 5428 $font_size = 24; 5429 v1 = 1.5; 5430 v2 = 1.68; 5431 } else if ($size == 'extra_jumbo') { 5432 $padding = 100; 5433 $font_size = 64; 5434 v1 = 1.6; 5435 v2 = 1.6; 5436 } 5437 5438 $that.find('svg text').attr('font-size', $font_size); 5439 5440 var $boundingRect = $(this).find('.back-3d .button-text')[0].getBoundingClientRect(), 5441 $text_width = $boundingRect.width, 5442 $text_height = $font_size * 1.5; 5443 5444 $that.css({ 5445 'width': ($text_width + $padding * 1.5) + 'px', 5446 'height': ($text_height + $padding) + 'px' 5447 });
5448 5449 $that.find('> a').css({ 5450 'height': ($text_height + $padding) + 'px' 5451 }); 5452 5453 $that.find('.back-3d svg, .front-3d svg').css({ 5454 'width': ($text_width + $padding * 1.5) + 'px', 5455 'height': ($text_height + $padding) + 'px' 5456 }).attr('viewBox', '0 0 ' + ($text_width + $padding * 1.5) + ' ' + ($text_height + $padding)); 5457 5458 $that.find('svg text').attr('transform', 'matrix(1 0 0 1 ' + ($text_width + $padding * v1) / 2 + ' ' + (($text_height + $padding) / v2) + ')'); 5459 $that.find('.front-3d, .back-3d').css('transform-origin', '50% 50% -' + ($text_height + $padding) / 2 + 'px'); 5460 5461 // Mask 5462 $(this).find('.front-3d svg > rect').attr('id', 'masked-rect-id-' + i); 5463 $(this).find('.front-3d defs mask').attr('id', 'button-text-mask-' + i); 5464 5465 $that.css('visibility', 'visible'); 5466 $3dTransButtonCssString += '#masked-rect-id-' + i + ' { mask: url(#button-text-mask-' + i + '); -webkit-mask: url(#button-text-mask-' + i + ')} '; 5467 5468 }); 5469 5470 // Extra jumbo resize 5471 createExtraJumboSize(); 5472 $window.on('smartresize', createExtraJumboSize); 5473 5474 // Style 5475 nectarCreateStyle($3dTransButtonCssString, 'nectar-td-button'); 5476 5477 } 5478 5479 // Gradient btn init 5480 setTimeout(function () { 5481 $('.nectar-button[class*="color-gradient"] .start').removeClass('loading'); 5482 }, 150); 5483 // No grad for ff 5484 if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1 || 5485 navigator.userAgent.indexOf("MSIE ") > -1 || 5486 navigator.userAgent.match(/Trident\/7\./)) { 5487 $('.nectar-button[class*="color-gradient"] .start').addClass('no-text-grad'); 5488 } 5489 } 5490 5491 5492 5493 5494 /** 5495 * Shortcode icon large style 5496 * 5497 * @since 1.0 5498 */ 5499 function largeIconHover() { 5500 $('.icon-3x').each(function () { 5501 $(this).closest('.col').on('mouseenter', function () { 5502 $(this).find('.icon-3x').addClass('hovered'); 5503 }); 5504 5505 $(this).closest('.col').on('mouseleave', function () { 5506 $(this).find('.icon-3x').removeClass('hovered'); 5507 }); 5508 }); 5509 5510 if (navigator.userAgent.indexOf("MSIE ") > -1 || navigator.userAgent.match(/Trident\/7\./)) { 5511 $('[class^="icon-"][class*="color-gradient"], .nectar_icon_wrap[data-color*="extra-color-gradient"] .nectar_icon, .nectar-gradient-text').addClass('no-grad'); 5512 } 5513 } 5514 5515 5516 5517 /** 5518 * Team member element - fullscreen style. 5519 * 5520 * @since 7.0 5521 */ 5522 function teamMemberFullscreen() { 5523 5524 if ( $('.team-member').length === 0 ) { 5525 return; 5526 } 5527 5528 // Open click event 5529 $body.on('click', '.team-member[data-style="bio_fullscreen"], .team-member[data-style="bio_fullscreen_alt"]', function () { 5530 5531 if ($('.nectar_team_member_overlay').length > 0) { 5532 return; 5533 } 5534 5535 var $usingBoxedClass = ($('body > #boxed').length > 0) ? 'in-boxed' : '', 5536 $teamMemberMeta = $(this).find('.nectar_team_bio').html(), 5537 $teamMemberTitle = ($(this).is('[data-style="bio_fullscreen_alt"]')) ? $(this).find('.team-meta h5').text() : $(this).find('.team-meta p').text(), 5538 $teamMemberImg = ($(this).find('.nectar_team_bio_img[data-img-src]').length > 0) ? $(this).find('.nectar_team_bio_img').attr('data-img-src') : '', 5539 $teamMemberStyle = ($(this).is('[data-style="bio_fullscreen_alt"]')) ? 'bio-fullscreen-alt' : 'bio-fullscreen', 5540 $teamName = ''; 5541 5542 if($(this).is('[data-style="bio_fullscreen_alt"]')) { 5543 $teamName = '<div class="title">' + $teamMemberTitle + '</div><h2>' + $(this).find('.team-meta h3').text() + '</h2>'; 5544 } else { 5545 $teamName = '<h2>' + $(this).find('.team-meta h3').text() + '</h2><div class="title">' + $teamMemberTitle + '</div>'; 5546 } 5547 5548 $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>'); 5549 5550 if ($teamMemberImg.length > 0) { 5551
5552 // Fade in img on load 5553 var teamTmpImg = new Image(); 5554 teamTmpImg.src = $teamMemberImg; 5555 teamTmpImg.onload = function () { 5556 $('.nectar_team_member_overlay .team_member_image').css('opacity', '1'); 5557 }; 5558 $('.nectar_team_member_overlay .team_member_image').css({ 5559 'background-image': 'url("' + $teamMemberImg + '")' 5560 }); 5561 } 5562 5563 var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $window.width() > 1000) ? 0 : $headerOuterEl.height(); 5564 $('.nectar_team_member_overlay .inner-wrap').css({ 5565 'padding-top': $headerNavSpace 5566 }); 5567 5568 // No-scroll class - ios ready 5569 if ($('.using-mobile-browser').length > 0) { 5570 $('body,html').addClass('nectar-no-scrolling'); 5571 } 5572 5573 teamFullscreenResize(); 5574 5575 // Transition in 5576 $('.nectar_team_member_overlay') 5577 .addClass('open') 5578 .addClass('animating'); 5579 5580 setTimeout(function () { 5581 $('.nectar_team_member_close').addClass('visible'); 5582 $('.nectar_team_member_overlay').removeClass('animating'); 5583 }, 500); 5584 5585 if ($('.team-member[data-style="bio_fullscreen"]').length > 0 && nectarDOMInfo.usingMobileBrowser) { 5586 $('.nectar_team_member_overlay').addClass('on-mobile'); 5587 } 5588 5589 }); 5590 5591 // Close click event 5592 $body.on('click', '.nectar_team_member_overlay', function () { 5593 5594 if (!$(this).hasClass('animating')) { 5595 5596 $('.nectar_team_member_overlay').removeClass('open'); 5597 $('.nectar_team_member_close').removeClass('visible'); 5598 5599 if ($('.using-mobile-browser').length > 0) { 5600 $('body,html').removeClass('nectar-no-scrolling'); 5601 } 5602 5603 setTimeout(function () { 5604 5605 $('.nectar_team_member_overlay, .nectar_team_member_close').remove(); 5606 5607 }, 820); 5608 } 5609 }); 5610 5611 if ($('.team-member[data-style="bio_fullscreen"]').length > 0 || $('.team-member[data-style="bio_fullscreen_alt"]').length > 0) { 5612 $window.on('resize', teamFullscreenResize); 5613 if( !nectarDOMInfo.usingMobileBrowser ) { 5614 var closeIndicator = new NectarIconMouseFollow('','close-indicator'); 5615 } 5616 5617 } 5618 5619 } 5620 5621 5622 /** 5623 * Team member element fullscreen resize event. 5624 * 5625 * @since 7.0 5626 */ 5627 function teamFullscreenResize() { 5628 var $leftHeaderSize = ($('body[data-header-format="left-header"]').length > 0 && $window.width() > 1000) ? 275 : 0; 5629 $('.nectar_team_member_overlay').css({ 5630 'width': $window.width() - $leftHeaderSize, 5631 'left': $leftHeaderSize 5632 }); 5633 } 5634 5635 5636 /** 5637 * WPBakery column element BG hover 5638 * 5639 * @since 5.0 5640 */ 5641 function columnBGColors() { 5642 5643 var $columnColorCSS = ''; 5644 5645 $('.wpb_column').each(function (i) { 5646 5647 $(this).removeClass(function (index, className) { 5648 return (className.match(/(^|\s)instance-\S+/g) || []).join(' '); 5649 }); 5650 5651 if( $(this).attr('data-has-bg-color') == 'true' || $(this).is('[data-hover-bg^="#"]') ) { 5652 $(this).addClass('instance-' + i); 5653 } 5654 5655 5656 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 ' : ''; 5657 var $innerWrapSelector = ( $(this).find($innerSelector + ' > .column-bg-overlay-wrap').length > 0 ) ? '> .column-bg-overlay-wrap ' : ''; 5658 5659 // BG color 5660 if ($(this).attr('data-has-bg-color') == 'true') { 5661 $columnColorCSS += '.wpb_column.instance-' + i + $innerSelector + $innerWrapSelector + ' > .column-bg-overlay { background-color:' + $(this).attr('data-bg-color') + '; opacity: ' + $(this).attr('data-bg-opacity') + '; }'; 5662 } 5663 5664 // Hover bg color 5665 if ($(this).is('[data-hover-bg^="#"]')) { 5666 $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; }'; 5667 } 5668 });
5669 5670 // Style 5671 nectarCreateStyle($columnColorCSS, 'column-bg-colors'); 5672 5673 } 5674 5675 5676 5677 /** 5678 * Displace filter column/row BG effect 5679 * 5680 * @since 10.5 5681 */ 5682 function nectarLiquidBGs() { 5683 $liquidBG_EL = []; 5684 5685 if (typeof NectarLiquid == 'undefined' || nectarDOMInfo.usingFrontEndEditor) { 5686 return; 5687 } 5688 5689 $('.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) { 5690 5691 var $that_el = $(this); 5692 var $type; 5693 var $el_type; 5694 5695 if ($(this).is('.row-bg')) { 5696 $type = $(this).parents('.row-bg-wrap').attr('data-bg-animation'); 5697 $el_type = 'row'; 5698 } 5699 else if ($(this).is('.column-image-bg')) { 5700 $type = $(this).parents('.column-image-bg-wrap').attr('data-bg-animation'); 5701 $el_type = 'col'; 5702 } 5703 5704 $liquidBG_EL[i] = new NectarLiquid($that_el, $type, $el_type); 5705 5706 }); 5707 } 5708 5709 5710 5711 /** 5712 * Morphing outline element creation. 5713 * 5714 * @since 5.0 5715 */ 5716 function morphingOutlines() { 5717 5718 if ($('.morphing-outline').length > 0) { 5719 5720 var $morphingOutlineCSS = '', 5721 $frontEndEditorMOSelector = ($('body.vc_editor').length > 0) ? '' : '>'; 5722 5723 $('.morphing-outline').each(function (i) { 5724 5725 $(this).removeClass(function (index, className) { 5726 return (className.match(/(^|\s)instance-\S+/g) || []).join(' '); 5727 }); 5728 5729 $(this).addClass('instance-' + i).css({ 5730 'visibility': 'visible' 5731 }); 5732 5733 var $width = $(this).find('.inner').width(), 5734 $height = $(this).find('.inner').height(), 5735 $border = parseInt($(this).attr("data-border-thickness")), 5736 $hover = ($('body[data-button-style*="rounded"]').length > 0) ? ':hover' : '', 5737 $hover2 = ($('body[data-button-style*="rounded"]').length > 0) ? '' : ':hover'; 5738 5739 $morphingOutlineCSS += 'body .morphing-outline.instance-' + i + ' .inner > * { color: ' + $(this).attr("data-starting-color") + '; } '; 5740 $morphingOutlineCSS += 'body .morphing-outline.instance-' + i + ' .inner:after { border-width:' + $(this).attr("data-border-thickness") + 'px ; border-color: ' + $(this).attr("data-starting-color") + '; } '; 5741 5742 $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") + '; } '; 5743 $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") + '; } '; 5744 5745 // Padding calcs 5746 $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}'; 5747 $morphingOutlineCSS += '.morphing-outline.instance-' + i + ' { padding: ' + (30 + ($width + 80 + $border * 2 - $height) / 2 - $border) + 'px 50px}'; 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 { top: -' + parseInt((($width + 100 + $border * 2 - $height) / 2 - $border) + $border) + 'px }'; 5749 5750 $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 }'; 5751 5752 // Hover 5753 $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}'; 5754 $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 }'; 5755 5756 });
5757 5758 // Style 5759 nectarCreateStyle($morphingOutlineCSS, 'morphing-outlines'); 5760 5761 } 5762 5763 } 5764 5765 5766 /** 5767 * Morphing outline element initialization. 5768 * 5769 * @since 5.0 5770 */ 5771 function morphingOutlinesInit() { 5772 5773 if($('.morphing-outline').length > 0) { 5774 5775 // Create style. 5776 setTimeout(morphingOutlines, 100); 5777 setTimeout(fullWidthContentColumns, 125); 5778 5779 // Handle resize. 5780 $window.on('smartresize', morphingOutlines); 5781 5782 } 5783 5784 } 5785 5786 5787 5788 /** 5789 * SVG icon element animations 5790 * 5791 * @since 6.0 5792 * @see waypoints 5793 */ 5794 function svgAnimations() { 5795 5796 var $svgOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : 'bottom-in-view'; 5797 5798 if ($svgIcons.length == 0) { 5799 5800 $('.svg-icon-holder:not(.animated-in)').has('svg').each(function (i) { 5801 5802 var $that = $(this); 5803 5804 if (bypassAnimations) { 5805 $that.attr('data-animation', 'false'); 5806 } 5807 // Size 5808 $that.find('svg').css({ 5809 'height': parseInt($that.attr('data-size')) + 'px', 5810 'width': parseInt($that.attr('data-size')) + 'px' 5811 }); 5812 5813 // Animation 5814 $(this).find('svg').attr('id', 'nectar-svg-animation-instance-' + i); 5815 5816 var $animationSpeed = ($that.is('[data-animation-speed]') && $that.attr('data-animation-speed').length > 0) ? $that.attr('data-animation-speed') : 200; 5817 5818 if ($that.attr('data-animation') == 'false') { 5819 $animationSpeed = 1; 5820 $that.css('opacity', '1'); 5821 } 5822 5823 if (!$that.hasClass('bound')) { 5824 $svgIcons[i] = new Vivus($that.find('svg').attr('id'), { 5825 type: 'delayed', 5826 pathTimingFunction: Vivus.EASE_OUT, 5827 animTimingFunction: Vivus.LINEAR, 5828 duration: $animationSpeed, 5829 onReady: svgInit 5830 });
5831 } 5832 5833 if ($animationSpeed !== 1) { 5834 5835 var waypoint = new Waypoint({ 5836 element: $that, 5837 handler: function () { 5838 if ($that.hasClass('animated-in')) { 5839 waypoint.destroy(); 5840 return; 5841 } 5842 5843 checkIfReady(); 5844 $that.addClass('animated-in'); 5845 waypoint.destroy(); 5846 }, 5847 offset: $svgOffsetPos 5848 5849 }); 5850 5851 } else { 5852 checkIfReady(); 5853 } 5854 5855 function checkIfReady() { 5856 5857 var $animationDelay = 0; 5858 5859 if($that.is('[data-animation-delay]') && 5860 $that.attr('data-animation-delay').length > 0 && 5861 $that.attr('data-animation') != 'false') { 5862 $animationDelay = $that.attr('data-animation-delay'); 5863 } 5864 5865 var $iconID = $that.find('svg').attr('id').replace(/[^0-9]/g, ''); 5866 5867 if ($svgIcons[$iconID].isReady == true) { 5868 setTimeout(function () { 5869 $that.css('opacity', '1'); 5870 $svgIcons[$iconID].reset().play(); 5871 }, $animationDelay); 5872 } else { 5873 setTimeout(checkIfReady, 50); 5874 } 5875 } 5876 5877 function svgInit() { 5878 5879 //set size 5880 $that.css({ 5881 'height': parseInt($that.attr('data-size')) + 'px', 5882 'width': parseInt($that.attr('data-size')) + 'px' 5883 });
5884 5885 } 5886 5887 $that.addClass('bound'); 5888 5889 }); 5890 5891 5892 // SVG in equal height column resize 5893 if ($('.vc_row-o-equal-height .svg-icon-holder[data-animation="true"]').length > 0 && 5894 $('#nectar_fullscreen_rows').length == 0) { 5895 5896 $window.on('smartresize', function () { 5897 clearTimeout($svgResizeTimeout); 5898 $svgResizeTimeout = setTimeout(function () { 5899 5900 if ($svgIcons.length > 0) { 5901 $('.svg-icon-holder.animated-in').each(function () { 5902 5903 $(this).css('opacity', '1'); 5904 if ($(this).is('[id]')) { 5905 var $iconID = $(this).attr('id').replace(/[^0-9]/g, ''); 5906 $svgIcons[$iconID].finish(); 5907 } 5908 5909 }); 5910 } 5911 5912 }, 300); 5913 5914 }); 5915 5916 } 5917 5918 } 5919 5920 // After svg animated icons initalized 5921 else { 5922 $('.svg-icon-holder').addClass('animated-in').css('opacity', '1'); 5923 } 5924 5925 // Full vc row support 5926 $('#nectar_fullscreen_rows .svg-icon-holder.animated-in').has('svg').each(function (i) { 5927 5928 var $animationDelay = 0; 5929 5930 if($(this).is('[data-animation-delay]') && 5931 $(this).attr('data-animation-delay').length > 0 && 5932 $(this).attr('data-animation') != 'false') { 5933 $animationDelay = $(this).attr('data-animation-delay'); 5934 } 5935 5936 var $that = $(this); 5937 5938 var $iconID = $that.find('svg').attr('id').replace(/[^0-9]/g, ''); 5939 5940 clearTimeout($animatedSVGIconTimeout[i]); 5941 5942 if ($that.attr('data-animation') == 'false') { 5943 5944 $that.css('opacity', '1'); 5945 $svgIcons[$iconID].finish(); 5946 5947 } else { 5948 5949 if ($(this).parents('.active').length > 0 || 5950 $(this).parents('#footer-outer').length > 0 || 5951 $('body.mobile').length > 0) { 5952 5953 $svgIcons[$iconID].reset(); 5954 $animatedSVGIconTimeout[i] = setTimeout(function () { 5955 $svgIcons[$iconID].play(); 5956 }, $animationDelay); 5957 5958 } else { 5959 $svgIcons[$iconID].reset().stop(); 5960 } 5961 } 5962 }); 5963 5964 } 5965 5966 5967 5968 /** 5969 * Fancy unordered list element initialization. 5970 * 5971 * @since 4.0 5972 * @see waypoints 5973 */ 5974 function nectarFancyUlInit() { 5975 5976 $($fullscreenSelector + '.nectar-fancy-ul').each(function () { 5977 5978 var $animation = $(this).attr('data-animation'), 5979 $animationDelay = 0; 5980 5981 if($(this).is('[data-animation-delay]') && 5982 $(this).attr('data-animation-delay').length > 0 && 5983 $(this).attr('data-animation') != 'false') { 5984 $animationDelay = $(this).attr('data-animation-delay'); 5985 } 5986 5987 if ($animation == 'true') { 5988 5989 var $that = $(this), 5990 waypoint = new Waypoint({ 5991 element: $that, 5992 handler: function () { 5993 5994 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 5995 waypoint.destroy(); 5996 return; 5997 } 5998 5999 setTimeout(function () { 6000 $that.find('li').each(function (i) { 6001 var $that = $(this); 6002 $that.delay(i * 220).transition({ 6003 'opacity': '1', 6004 'left': '0' 6005 }, 220, 'easeOutCubic'); 6006 }); 6007 }, $animationDelay); 6008 6009 $that.addClass('animated-in'); 6010 waypoint.destroy(); 6011 }, 6012 offset: 'bottom-in-view' 6013 6014 }); 6015 6016 } 6017 6018 }); 6019 6020 } 6021 6022 6023 /** 6024 * Fancy unordered list element icons. 6025 * 6026 * @since 11.0 6027 */ 6028 function nectarFancyUlIcons() { 6029 6030 $('.nectar-fancy-ul:not([data-list-icon="dot"]):not([data-list-icon="none"])').each(function () { 6031 6032 var $icon = $(this).attr('data-list-icon'), 6033 $color = $(this).attr('data-color'); 6034 6035 $(this).find('li').each(function () { 6036 $(this).find('> i').remove(); 6037 $(this).prepend('<i class="icon-default-style ' + $icon + ' ' + $color + '"></i> '); 6038 }); 6039 6040 }); 6041 6042 } 6043 6044 6045 /** 6046 * Flipbox element height calculations. 6047 * 6048 * @since 7.0 6049 */ 6050 function flipBoxHeights() { 6051 6052 $('.nectar-flip-box').each(function () { 6053
6054 var $flipBoxMinHeight = parseInt($(this).attr('data-min-height')), 6055 $flipBoxHeight = $(this).find('.flip-box-front .inner').height(); 6056 6057 if ($(this).find('.flip-box-back .inner').height() > $(this).find('.flip-box-front .inner').height()) { 6058 $flipBoxHeight = $(this).find('.flip-box-back .inner').height(); 6059 } 6060 6061 if ($flipBoxHeight >= $flipBoxMinHeight - 80) { 6062 $(this).find('> div').css('height', $flipBoxHeight + 80); 6063 } else { 6064 $(this).find('> div').css('height', 'auto'); 6065 } 6066 6067 // Safari needs 3D translate. 6068 if ($(this).parent().hasClass('wpb_wrapper')) { 6069 $(this).parent().css('transform', 'translateZ(0)'); 6070 } 6071 6072 }); 6073 } 6074 6075 6076 6077 6078 /** 6079 * Flipbox element events. 6080 * 6081 * @since 7.0 6082 */ 6083 function flipBoxInit() { 6084 6085 if( $('.nectar-flip-box').length > 0 ) { 6086 6087 // Mobile gets click. 6088 if (nectarDOMInfo.usingMobileBrowser) { 6089 $body.on('click', '.nectar-flip-box', function () { 6090 $(this).toggleClass('flipped'); 6091 }); 6092 } 6093 6094 flipBoxHeights(); 6095 6096 // Handle resize. 6097 $window.on('smartresize', flipBoxHeights); 6098 } 6099 6100 } 6101 6102 6103 6104 6105 /** 6106 * Runs before other full width section calculations. 6107 * 6108 * @since 4.0 6109 */ 6110 function fullWidthSectionsPreInit() { 6111 6112 // Nectar Slider force full width parent row when using full width element option. 6113 $('.wpb_row .vc_col-sm-12 .nectar-slider-wrap[data-full-width="true"]').each(function () { 6114 if ($(this).parents('.wpb_row.full-width-section').length == 0 && $(this).parents('.wpb_row.full-width-content').length == 0) { 6115 $(this).parents('.wpb_row').addClass('full-width-section'); 6116 } 6117 }); 6118 6119 // Handle percent row padding values when using the boxed theme option. 6120 if( !nectarDOMInfo.usingMobileBrowser && $('body[data-boxed-style="1"]').length > 0 && $('#boxed').length > 0 ) { 6121 fullWidthRowPaddingAdjustCalcBoxed(); 6122 } 6123 6124 } 6125 6126 6127 6128 /** 6129 * Full width calculations for legacy items. 6130 * 6131 * @since 4.0 6132 */ 6133 function fullWidthSections() { 6134 6135 var $windowInnerWidth = nectarDOMInfo.winW, 6136 $bodyBorderWidth = ($('.body-border-right').length > 0 && $windowInnerWidth > 1000) ? parseInt($('.body-border-right').width()) * 2 : 0, 6137 $container_width = ($('.container-wrap').length > 0) ? parseInt($('.container-wrap').outerWidth()) : $window.width(), 6138 $extended_padding = ($('body[data-ext-padding]').length > 0) ? parseInt($('body').attr('data-ext-padding'))*2 : 180; 6139 6140 var $windowWidth, 6141 $justOutOfSight, 6142 $mainContentWidth; 6143 6144 if ($('#boxed').length == 1) { 6145 $justOutOfSight = ((parseInt($('.container-wrap').width()) - parseInt($('.main-content').width())) / 2) + 4; 6146 } else { 6147 6148 // Ext responsive mode is on - add the extra padding into the calcs 6149 var $extResponsivePadding = ($('body[data-ext-responsive="true"]').length > 0 && $windowInnerWidth >= 1000) ? $extended_padding : 0; 6150 6151 if ($container_width - $bodyBorderWidth <= parseInt($('.main-content').css('max-width'))) { 6152 $windowWidth = parseInt($('.main-content').css('max-width')); 6153 } else { 6154 $windowWidth = $container_width - $bodyBorderWidth; 6155 } 6156 6157 6158 var $contentWidth = parseInt($('.main-content').css('max-width')); 6159 6160 // Single post fullwidth 6161 if ($('body.single-post[data-ext-responsive="true"]').length > 0 && $('.container-wrap.no-sidebar').length > 0) { 6162 $contentWidth = $('.post-area').width(); 6163 $extResponsivePadding = 0; 6164 } 6165 6166 $justOutOfSight = Math.ceil((($windowWidth + $extResponsivePadding - $contentWidth) / 2)); 6167 } 6168 6169 6170 $('.carousel-outer').has('.carousel-wrap[data-full-width="true"]').css('overflow', 'visible'); 6171 6172 $('.carousel-wrap[data-full-width="true"], .portfolio-items[data-col-num="elastic"]:not(.fullwidth-constrained), #boxed .full-width-content').each(function () { 6173 6174 var $leftHeaderSize = ($('#header-outer[data-format="left-header"]').length > 0 && $windowInnerWidth >= 1000) ? parseInt($('#header-outer[data-format="left-header"]').width()) : 0; 6175 var $bodyBorderWidth = ($('.body-border-right').length > 0 && $windowInnerWidth > 1000) ? (parseInt($('.body-border-right').width()) * 2) - 2 : 0; 6176 6177 // Single post fullwidth. 6178 if ($('#boxed').length == 1) { 6179 6180 $mainContentWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').width()) : parseInt($(this).parents('.container').width()); 6181 6182 if ($('body.single-post[data-ext-responsive="true"]').length > 0 && $('.container-wrap.no-sidebar').length > 0 && $(this).parents('.post-area').length > 0) { 6183 $contentWidth = $('.post-area').width(); 6184 $extResponsivePadding = 0; 6185 $windowWidth = $container_width - $bodyBorderWidth;
6186 $justOutOfSight = Math.ceil((($windowWidth + $extResponsivePadding - $contentWidth) / 2)); 6187 } else { 6188 if ($(this).parents('.page-submenu').length > 0) { 6189 $justOutOfSight = ((parseInt($('.container-wrap').width()) - $mainContentWidth) / 2); 6190 } 6191 else { 6192 $justOutOfSight = ((parseInt($('.container-wrap').width()) - $mainContentWidth) / 2) + 4; 6193 } 6194 } 6195 } else { 6196 6197 if ($('body.single-post[data-ext-responsive="true"]').length > 0 && $('.container-wrap.no-sidebar').length > 0 && $(this).parents('.post-area').length > 0) { 6198 6199 $contentWidth = $('.post-area').width(); 6200 $extResponsivePadding = 0; 6201 $windowWidth = $container_width - $bodyBorderWidth; 6202 6203 } else { 6204 6205 var $mainContentMaxWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').css('max-width')) : parseInt($(this).parents('.container').css('max-width')); 6206 6207 if ($container_width - $bodyBorderWidth <= $mainContentMaxWidth) { 6208 $windowWidth = $mainContentMaxWidth; 6209 } 6210 6211 $contentWidth = $mainContentMaxWidth; 6212 $extResponsivePadding = ($('body[data-ext-responsive="true"]').length > 0 && nectarDOMInfo.winW >= 1000) ? $extended_padding : 0; 6213 6214 if ($leftHeaderSize > 0) { 6215 $extResponsivePadding = ($('body[data-ext-responsive="true"]').length > 0 && nectarDOMInfo.winW >= 1000) ? 120 : 0; 6216 } 6217 6218 } 6219 6220 $justOutOfSight = Math.ceil((($windowWidth + $extResponsivePadding - $contentWidth) / 2)); 6221 } 6222 6223 var $extraSpace = 0; 6224 if ($(this).hasClass('carousel-wrap')) { 6225 $extraSpace = 1; 6226 } 6227 if ($(this).hasClass('portfolio-items')) { 6228 $extraSpace = 5; 6229 } 6230 6231 var $carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight * 2) : $container_width - $bodyBorderWidth + $extraSpace; 6232 6233 // When using gutter on portfolio don't add extra space 6234 if ($('#boxed').length == 0 && $(this).hasClass('portfolio-items') && $(this).is('[data-gutter*="px"]') && $(this).attr('data-gutter').length > 0 && $(this).attr('data-gutter') != 'none') { 6235 if ($container_width > 1000) { 6236 $carouselWidth = $container_width - $bodyBorderWidth + 3; 6237 } 6238 else { 6239 $carouselWidth = $container_width - $bodyBorderWidth; 6240 } 6241 } 6242 6243 if ($(this).parent().hasClass('default-style')) { 6244 6245 $mainContentWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').width()) : parseInt($(this).parents('.container').width()); 6246 6247 if ($('#boxed').length != 0) { 6248 $carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight * 2) : $container_width + $extraSpace; 6249 } else { 6250 $carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight * 2) : ($container_width - $bodyBorderWidth) - (($container_width - $bodyBorderWidth) * 0.025) + $extraSpace; 6251 $windowWidth = ($container_width - $bodyBorderWidth <= $mainContentWidth) ? $mainContentWidth : ($container_width - $bodyBorderWidth) - (($container_width - $bodyBorderWidth) * 0.025); 6252 $justOutOfSight = Math.ceil((($windowWidth - $mainContentWidth) / 2)); 6253 } 6254 6255 } 6256 6257 else if ($(this).parent().hasClass('spaced')) { 6258 6259 $mainContentWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').width()) : parseInt($(this).parents('.container').width()); 6260 6261 if ($('#boxed').length != 0) { 6262 $carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight * 2) - ($container_width * 0.02) : $container_width + $extraSpace; 6263 } else { 6264 $carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight * 2) : ($container_width - $bodyBorderWidth) - Math.ceil(($container_width - $bodyBorderWidth) * 0.02) + $extraSpace; 6265 var $windowWidth2 = ($container_width - $bodyBorderWidth <= $mainContentWidth) ? $mainContentWidth : ($container_width - $bodyBorderWidth) - (($container_width - $bodyBorderWidth) * 0.02);
6266 $justOutOfSight = Math.ceil((($windowWidth2 - $mainContentWidth) / 2) + 2); 6267 } 6268 } 6269 6270 // Make sure the element/row is capable of going full width. 6271 if (!$(this).parents('.span_9').length > 0 && 6272 !$(this).parent().hasClass('span_3') && 6273 $(this).parent().attr('id') != 'sidebar-inner' && 6274 !$(this).find('.nectar-carousel-flickity-fixed-content').length > 0 && 6275 $(this).parent().attr('id') != 'portfolio-extra' ) { 6276 6277 // Escape if inside woocoommerce page and not using applicable layout 6278 if ($('.single-product').length > 0 && 6279 $(this).parents('#tab-description').length > 0 && 6280 $(this).parents('.full-width-tabs').length == 0) { 6281 6282 $(this).css({ 6283 'visibility': 'visible' 6284 }); 6285 6286 } else { 6287 // Portfolio. 6288 if ($(this).hasClass('portfolio-items')) { 6289 6290 if( $(this).parents('.full-width-content').length == 0 ) { 6291 6292 $(this).css({ 6293 'margin-left': -$justOutOfSight, 6294 'left': 0, 6295 'width': $carouselWidth, 6296 'visibility': 'visible' 6297 }); 6298 6299 } 6300 6301 } else { 6302 6303 // Fullscreen page rows left. 6304 if ($('#nectar_fullscreen_rows').length > 0 && $(this).hasClass('wpb_row')) { 6305 6306 $(this).css({ 6307 'margin-left': -$justOutOfSight, 6308 'width': $carouselWidth, 6309 'visibility': 'visible' 6310 }); 6311 6312 } else { 6313 // Regular rows. 6314 if( $(this).parents('.full-width-content').length == 0 ) { 6315 $(this).css({ 6316 'left': 0, 6317 'margin-left': -$justOutOfSight, 6318 'width': $carouselWidth, 6319 'visibility': 'visible' 6320 }); 6321 } 6322 } 6323 6324 } 6325 6326 } 6327 } 6328 6329 else if ($(this).parent().attr('id') == 'portfolio-extra' && $('#full_width_portfolio').length != 0) { 6330 6331 if( !$(this).find('.nectar-carousel-flickity-fixed-content').length > 0 ) { 6332 $(this).css({ 6333 'left': 0, 6334 'margin-left': -$justOutOfSight, 6335 'width': $carouselWidth, 6336 'visibility': 'visible' 6337 });
6338 } 6339 6340 } else { 6341 6342 $(this).css({ 6343 'margin-left': 0, 6344 'width': 'auto', 6345 'left': '0', 6346 'visibility': 'visible' 6347 }); 6348 } 6349 6350 }); 6351 6352 } 6353 6354 6355 6356 /** 6357 * First full width row on page 6358 * 6359 * @since 4.0 6360 */ 6361 function firstFWSection() { 6362 6363 $('.full-width-section.wpb_row, .full-width-content.wpb_row').each(function () { 6364 6365 if (!$(this).parent().hasClass('span_9') && 6366 !$(this).parent().hasClass('span_3') && 6367 $(this).parent().attr('id') != 'sidebar-inner') { 6368 6369 if ($(this).parents('#portfolio-extra').length > 0 && $('#full_width_portfolio').length == 0) { 6370 return false; 6371 } 6372 6373 if ($(this).index() == '0' && 6374 $pageHeaderBG.length == 0 && 6375 $('.page-header-no-bg').length == 0 && 6376 $('.project-title').length == 0 && 6377 $('body.single').length == 0 && 6378 $('.project-title').length == 0) { 6379 6380 $(this).addClass('first-section'); 6381 6382 var $that = $(this); 6383 setTimeout(function () { 6384 $that.addClass('loaded'); 6385 }, 50); 6386 6387 } 6388 6389 } 6390 6391 }); 6392 6393 } 6394 6395 6396 6397 /** 6398 * Parallax Scrolling 6399 * 6400 * @since 13.0 6401 */ 6402 function NectarParallaxScroll(el, parallaxElClass, speed, type) { 6403 6404 this.$el = el; 6405 this.$parallaxEl = this.$el.find(parallaxElClass); 6406 this.firstSection = false; 6407 this.type = type; 6408 this.speed = speed; 6409 this.storedWinH = nectarDOMInfo.winH; 6410 6411 this.setup(); 6412 this.resize(); 6413 this.update(); 6414 6415 } 6416 6417 NectarParallaxScroll.prototype.setup = function() { 6418 6419 var that = this; 6420 6421 // Page Header. 6422 if( this.$el.parents('#page-header-bg').length > 0 ) { 6423 this.type = 'page-header'; 6424 } 6425 6426 // Is the element in the first row on the page? 6427 if(this.$el.parents('.top-level').length > 0 && this.$el.parents('.parallax_slider_outer').length > 0 || 6428 this.$el.parents('.top-level').length > 0 && this.$el.hasClass('nectar-simple-slider') || 6429 this.$el.parents('.top-level').length > 0 && this.$el.hasClass('nectar-recent-posts-single_featured') || 6430 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)') || 6431 this.$el.is('.wpb_row.top-level') || 6432 this.type == 'page-header' || 6433 $('.wpb_row').length == 0) { 6434 this.firstSection = true; 6435 } 6436 6437 //// Nectar Slider. 6438 if($('.wpb_row').length == 0 && 6439 this.$el.parents('.parallax_slider_outer').length > 0 && 6440 this.$el.is('[data-full-width="true"]') || 6441 ($('#portfolio-extra').length > 0 && 6442 this.$el.parents('.parallax_slider_outer').length > 0 && 6443 this.$el.parents('.wpb_row').length > 0 && 6444 this.$el.parents('.wpb_row').index() == '0')) { 6445 this.firstSection = true; 6446 } 6447 //// Disable first section calcs when using FE editor. 6448 if (nectarDOMInfo.usingFrontEndEditor && this.type != 'page-header') { 6449 this.firstSection = false; 6450 } 6451 6452 // Init class. 6453 this.$parallaxEl.addClass('translate'); 6454 6455 // Need to periodically check height/offset. 6456 setInterval(function() { 6457 6458 if( nectarState.materialOffCanvasOpen != true ) { 6459 that.offsetTop = that.$el.offset().top; 6460 that.height = that.$el.outerHeight(true); 6461 } 6462 6463 }, 800); 6464 6465 $(window).on('nectar-column-animation-start',this.checkColumnAnimation.bind(this)); 6466 6467 // Bind events. 6468 $(window).on('resize load', this.resize.bind(this)); 6469 window.addEventListener("orientationchange", this.orientationChange.bind(this)); 6470 }; 6471 6472 NectarParallaxScroll.prototype.checkColumnAnimation = function() { 6473 if( this.$parallaxEl.parents('.col.has-animation.triggered-animation:not(.animated-in)').length > 0 ) { 6474 this.realtimeOffsetUpdate(); 6475 } 6476 }; 6477 6478 NectarParallaxScroll.prototype.realtimeOffsetUpdate = function() { 6479 // Triggered when a column animation is active. 6480 var that = this; 6481 6482 var realTimeOffset = setInterval(function() { 6483 if( nectarState.materialOffCanvasOpen != true ) { 6484 that.offsetTop = that.$el.offset().top; 6485 that.height = that.$el.outerHeight(true); 6486 } 6487 },30); 6488 6489 setTimeout(function(){ 6490 clearInterval(realTimeOffset); 6491 },2000); 6492 6493 } 6494 6495 NectarParallaxScroll.prototype.resize = function() { 6496 6497 this.offsetTop = this.$el.offset().top; 6498 this.height = this.$el.outerHeight(true); 6499 6500 if( !nectarDOMInfo.usingMobileBrowser ) { 6501 this.storedWinH = nectarDOMInfo.winH; 6502 } 6503 6504 }; 6505 6506 NectarParallaxScroll.prototype.orientationChange = function() { 6507 6508 if( nectarDOMInfo.usingMobileBrowser ) { 6509 this.offsetTop = this.$el.offset().top; 6510 this.height = this.$el.outerHeight(true); 6511 this.storedWinH = nectarDOMInfo.winH; 6512 } 6513 6514 }; 6515 6516 6517 NectarParallaxScroll.prototype.update = function() { 6518 6519 // Outside of viewport. 6520 if(this.offsetTop + this.height < nectarDOMInfo.scrollTop || 6521 this.offsetTop > nectarDOMInfo.scrollTop + nectarDOMInfo.winH || 6522 nectarState.materialOffCanvasOpen == true) { 6523
6524 for(var i = 0; i < this.$parallaxEl.length; i++) { 6525 this.$parallaxEl[i].style.willChange = 'auto'; 6526 } 6527 6528 requestAnimationFrame(this.update.bind(this)); 6529 return; 6530 } 6531 6532 for(var i = 0; i < this.$parallaxEl.length; i++) { 6533 6534 if( this.firstSection === true ) { 6535 this.$parallaxEl[i].style.transform = 'translate3d(0, ' + parseInt(nectarDOMInfo.scrollTop * this.speed) + 'px, 0)'; 6536 } 6537 else { 6538 this.$parallaxEl[i].style.transform = 'translate3d(0, ' + parseInt(((this.storedWinH + nectarDOMInfo.scrollTop - this.offsetTop) * this.speed)) + 'px, 0) scale(1.005)'; 6539 } 6540 this.$parallaxEl[i].style.willChange = 'transform'; 6541 } 6542 6543 requestAnimationFrame(this.update.bind(this)); 6544 }; 6545 6546 6547 6548 /** 6549 * Parallax scroll speed helper. 6550 * 6551 * @since 4.0 6552 */ 6553 function parallaxSrollSpeed(speedString) { 6554 6555 var speed; 6556 switch (speedString) { 6557 case 'slow': 6558 speed = 0.6; 6559 break; 6560 case 'medium': 6561 speed = 0.4; 6562 break; 6563 case 'medium_fast': 6564 speed = 0.28; 6565 break; 6566 case 'fast': 6567 speed = 0.20; 6568 break; 6569 case 'very_subtle': 6570 speed = 0.12; 6571 break; 6572 } 6573 6574 return speed; 6575 } 6576 6577 6578 /** 6579 * Parallax scroll initialization. 6580 * 6581 * @since 4.0 6582 */ 6583 function parallaxScrollInit() { 6584 6585 if (nectarDOMInfo.usingMobileBrowser && $('body[data-remove-m-parallax="1"]').length > 0) { 6586 return; 6587 } 6588 6589 parallaxRowsBGCals(); 6590 6591 var parallaxItemCount = 0; 6592 6593 $('.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() { 6594 6595 6596 // Generic. 6597 if( $(this).is('[data-n-parallax-bg][data-parallax-speed]') ) { 6598 parallaxItemsArr[parallaxItemCount] = new NectarParallaxScroll($(this), '.parallax-layer', parallaxSrollSpeed($(this).attr('data-parallax-speed')), 'regular'); 6599 parallaxItemCount++; 6600 } 6601 else { 6602 6603 if ( $(this).find('[data-parallax-speed="fixed"]').length == 0) { 6604 6605 // Slider. 6606 if ( $(this).hasClass('nectar-slider-wrap') ) { 6607 parallaxItemsArr[parallaxItemCount] = new NectarParallaxScroll($(this), '.video-wrap, .image-bg', 0.25, 'nectar-slider'); 6608 } 6609 // Page Header. 6610 else if( $(this).hasClass('page-header-bg-image-wrap') ) { 6611 parallaxItemsArr[parallaxItemCount] = new NectarParallaxScroll($(this), '.page-header-bg-image', 0.25, 'page-header'); 6612 } 6613 else if( $(this).hasClass('nectar-video-wrap') && $(this).parents('#page-header-bg').length > 0 ) { 6614 parallaxItemsArr[parallaxItemCount] = new NectarParallaxScroll($(this), '.nectar-video-bg', 0.25, 'page-header'); 6615 } 6616 // All Others. 6617 else { 6618 parallaxItemsArr[parallaxItemCount] = new NectarParallaxScroll($(this), '.row-bg.using-image', parallaxSrollSpeed($(this).find('.row-bg').attr('data-parallax-speed')), 'regular'); 6619 } 6620 6621 parallaxItemCount++; 6622 6623 } 6624 6625 } 6626 6627 $(this).addClass('nectar-parallax-enabled'); 6628 6629 }); 6630 6631 $('.woocommerce-tabs .wc-tabs li').on('click', function(){ 6632 setTimeout(parallaxRowsBGCals,100); 6633 }); 6634 6635 6636 } 6637 6638 6639 6640 /** 6641 * Parallax row background height calculations. 6642 * 6643 * @since 6.0 6644 */ 6645 function parallaxRowsBGCals() { 6646 6647 if (nectarDOMInfo.usingMobileBrowser && $('body[data-remove-m-parallax="1"]').length > 0) { 6648 return; 6649 } 6650 6651 $('.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 () { 6652 6653 var $non_page_builder_slider; 6654 6655 if( $(this).parents('.wpb_tab:not(.visible-tab)').length > 0 || $(this).parents('.wc-tab').length > 0 && $(this).parents('.wc-tab').css('display') !== 'block' ) { 6656 return true; 6657 } 6658 6659 if ($(this).find('.row-bg').length == 0 && 6660 $(this).find('.page-header-bg-image').length > 0 ) { 6661 //skip processing. 6662 } 6663 else if ($(this).find('.row-bg').length == 0 && 6664 $(this).find('.image-bg').length > 0) { 6665 6666 $non_page_builder_slider = false; 6667 6668 // First nectar slider shortcode without page builder 6669 if ($('.wpb_row').length == 0 && 6670 $(this).parents('.nectar-slider-wrap[data-full-width="true"]').length > 0 && 6671 $(this).parents('.parallax_slider_outer').length > 0 && 6672 $(this).parents('.parallax_slider_outer').index() == '1') { 6673 $non_page_builder_slider = true; 6674 } 6675 6676 // Portfolio first 6677 if ($('#portfolio-extra').length > 0 && 6678 $(this).parents('.wpb_row').length > 0 && 6679 $(this).parents('.parallax_slider_outer').length > 0 && 6680 $(this).parents('.wpb_row').index() == '0') { 6681 $non_page_builder_slider = true; 6682 } 6683 6684 // Set heights. 6685 if ($(this).parents('.top-level').length > 0 && !nectarDOMInfo.usingFrontEndEditor || 6686 $non_page_builder_slider && !nectarDOMInfo.usingFrontEndEditor) { 6687 6688 $(this).find('.image-bg').css({ 6689 'height': Math.ceil($(this).parent().offset().top * 0.25) + $(this).outerHeight(true) 6690 });
6691 } else { 6692 $(this).find('.image-bg').css({ 6693 'height': Math.ceil($window.height() * 0.25) + $(this).outerHeight(true) 6694 }); 6695 } 6696 6697 } 6698 6699 // Video backgrounds. 6700 else if ($(this).find('.row-bg').length == 0 && $(this).find('.video-wrap').length > 0) { 6701 6702 $non_page_builder_slider = false; 6703 // First nectar slider shortcode without page builder 6704 if ($('.wpb_row').length == 0 && 6705 $(this).parents('.nectar-slider-wrap[data-full-width="true"]').length > 0 && 6706 $(this).parents('.parallax_slider_outer').length > 0 && 6707 $(this).parents('.parallax_slider_outer').index() == '1') { 6708 $non_page_builder_slider = true; 6709 } 6710 // Portfolio first 6711 if ($('#portfolio-extra').length > 0 && 6712 $(this).parents('.wpb_row').length > 0 && 6713 $(this).parents('.parallax_slider_outer').length > 0 && 6714 $(this).parents('.wpb_row').index() == '0') { 6715 $non_page_builder_slider = true; 6716 } 6717 6718 // Set heights. 6719 if ($(this).parents('.top-level').length > 0 && !nectarDOMInfo.usingFrontEndEditor || 6720 $non_page_builder_slider && !nectarDOMInfo.usingFrontEndEditor) { 6721 6722 $(this).find('.video-wrap').css({ 6723 'height': Math.ceil($(this).parent().offset().top * 0.25) + $(this).outerHeight(true) 6724 });
6725 } 6726 6727 else { 6728 $(this).find('.video-wrap').css({ 6729 'height': Math.ceil($window.height() * 0.25) + $(this).outerHeight(true) 6730 }); 6731 } 6732 6733 var vid = $(this).find('.video-wrap video'), 6734 vid_w_orig = 1280, 6735 vid_h_orig = 720; 6736 6737 // Get the parent element size 6738 var container_w = vid.parent().width(), 6739 container_h = vid.parent().height(), 6740 scale_w = container_w / vid_w_orig, 6741 scale_h = container_h / vid_h_orig; 6742 6743 var scale = scale_w > scale_h ? scale_w : scale_h; 6744 6745 // Scale the video. 6746 vid.width(scale * vid_w_orig); 6747 vid.height(scale * vid_h_orig); 6748 6749 } else { 6750 6751 // Top Level Special elements, Recent posts/ Simple Slider. 6752 if ($(this).is('.nectar-recent-posts-single_featured') && 6753 $(this).parents('.top-level').length > 0 && 6754 !nectarDOMInfo.usingFrontEndEditor) { 6755 //skip processing. 6756 } 6757 else if ($(this).is('.nectar-simple-slider') && 6758 $(this).parents('.top-level').length > 0 && 6759 !nectarDOMInfo.usingFrontEndEditor) { 6760 //skip processing. 6761 } 6762 else if($(this).is('.column-image-bg-wrap') && 6763 $(this).parents('.top-level').length > 0 && 6764 $(this).parent().parent().is('.vc_col-sm-12:not(.child_column)')) { 6765 //skip processing. 6766 } 6767 // Regular. 6768 else if (!$(this).hasClass('top-level') || nectarDOMInfo.usingFrontEndEditor || $(this).find('.parallax-layer').length > 0) { 6769 6770 var classSelector = '.row-bg'; 6771 var parallaxSpeed = $(this).find('.row-bg').attr('data-parallax-speed'); 6772 6773 if( $(this).find('.parallax-layer').length > 0 ) { 6774 classSelector = '.parallax-layer'; 6775 parallaxSpeed = $(this).attr('data-parallax-speed'); 6776 } 6777 6778 var $ifFast = ($(this).find(classSelector + '[data-parallax-speed="fast"]').length > 0) ? 60 : 0; 6779 $(this).find(classSelector).css({ 6780 'height': Math.ceil($window.height() * parallaxSrollSpeed(parallaxSpeed) ) + $(this).outerHeight(true) + $ifFast 6781 });
6782 6783 6784 } 6785 6786 } 6787 6788 }); 6789 6790 } 6791 6792 6793 /** 6794 * Class names added for specific full width section rows at top 6795 * 6796 * @since 3.0 6797 */ 6798 function fwsClasses() { 6799 6800 $('.wpb_wrapper > .nectar-slider-wrap[data-full-width="true"]').each(function () { 6801 if (!$(this).parent().hasClass('span_9') && !$(this).parent().hasClass('span_3') && $(this).parent().attr('id') != 'sidebar-inner') { 6802 if ($(this).parents('.wpb_row').index() == '0') { 6803 $(this).addClass('first-nectar-slider'); 6804 } 6805 } 6806 }); 6807 6808 var $contentElementsNum = ($('#portfolio-extra').length == 0) ? $('.main-content > .row > *').length : $('.main-content > .row #portfolio-extra > *').length; 6809 6810 if ($('#portfolio-extra').length == 0) { 6811 $contentElementsNum = ($('.main-content > .row > .wpb_row').length > 0) ? $('.main-content > .row > .wpb_row').length : $('.main-content > .row > *').length; 6812 } else { 6813 $contentElementsNum = $('.main-content > .row #portfolio-extra > *').length; 6814 } 6815 6816 $('.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 () { 6817 6818 if( $(this).parents('.nectar-global-section.before-footer').length > 0 ) { 6819 return true; 6820 } 6821 6822 6823 if (!$(this).parent().hasClass('span_9') && !$(this).parent().hasClass('span_3') && $(this).parent().attr('id') != 'sidebar-inner') { 6824 6825 if ($(this).parents('.wpb_row').length > 0) { 6826 6827 if ($(this).parents('#portfolio-extra').length > 0 && 6828 $('#full_width_portfolio').length == 0) { 6829 return false; 6830 } 6831 6832 ////first 6833 if ($(this).parents('.wpb_row').index() == '0' && $pageHeaderBG.length != 0) { 6834 //skip processing. 6835 } 6836 else if ($(this).parents('.wpb_row').index() == '0' && 6837 $pageHeaderBG.length == 0 && $('.page-header-no-bg').length == 0 && 6838 $('.project-title').length == 0 && $(this).parents('.wpb_row').index() == '0' && 6839 $('.project-title').length == 0 && $('body[data-bg-header="true"]').length == 0) { 6840 6841 if ($('.single').length == 0) { 6842 $('.container-wrap').css('padding-top', '0px'); 6843 } else { 6844 $(this).addClass('first-section'); 6845 } 6846 6847 } 6848 6849 // Check if it's also last (i.e. the only fws) 6850 if ($(this).parents('.wpb_row').index() == $contentElementsNum - 1 && $('#respond').length == 0) { 6851 if ($(this).attr('id') != 'portfolio-filters-inline') { 6852 $('.container-wrap').css('padding-bottom', '0px'); 6853 $('#call-to-action .triangle').remove(); 6854 } 6855 } 6856 6857 } else { 6858 6859 if ($(this).parents('#portfolio-extra').length > 0 && $('#full_width_portfolio').length == 0) { 6860 return false; 6861 } 6862 6863 if ($(this).find('.portfolio-filters-inline').length == 0 && $(this).attr('id') != 'post-area') { 6864 6865 ////first 6866 if ($(this).index() == '0' && $pageHeaderBG.length != 0) { 6867 //skip processing. 6868 } 6869 else if ($(this).index() == '0' && $pageHeaderBG.length == 0 && 6870 $(this).index() == '0' && $('.page-header-no-bg').length == 0 && 6871 $(this).index() == '0' && !$(this).hasClass('blog_next_prev_buttons') && 6872 !$(this).hasClass('nectar-shop-outer') && $(this).parents('.pum-container').length == 0) { 6873 6874 if ($('body[data-header-resize="0"]').length == 1 && $('.single').length == 0 || $('body.material').length > 0 && $('.single').length == 0) { 6875 6876 if (!$('body.blog .blog-fullwidth-wrap > .masonry:not(.meta-overlaid)').length > 0) { 6877 $('.container-wrap').css('padding-top', '0px'); 6878 } 6879 6880 } 6881 6882 else { 6883 $(this).addClass('first-section'); 6884 } 6885 6886 } 6887 6888 //check if it's also last (i.e. the only fws) 6889 if ($(this).index() == $contentElementsNum - 1 && $('#respond').length == 0 && $('body.woocommerce-checkout').length == 0) { 6890 $('.container-wrap').css('padding-bottom', '0px'); 6891 $('.bottom_controls').css('margin-top', '0px'); 6892 $('#call-to-action .triangle').remove(); 6893 } 6894 6895 } 6896 } 6897 } 6898 6899 });
6900 6901 6902 $('#portfolio-extra > .nectar-slider-wrap[data-full-width="true"], .portfolio-wrap').each(function () { 6903 //check if it's last 6904 if ($(this).index() == $contentElementsNum - 1 && $('#commentform').length == 0 && $('#pagination').length == 0) { 6905 if (parseInt($('.container-wrap').css('padding-bottom')) > 0) { 6906 $(this).css('margin-bottom', '-40px'); 6907 } 6908 $('#call-to-action .triangle').remove(); 6909 } 6910 }); 6911 6912 6913 $('.portfolio-filters').each(function () { 6914 ////first 6915 if ($(this).index() == '0' && $pageHeaderBG.length != 0 || $(this).index() == '0') { 6916 $(this).addClass('first-section nder-page-header'); 6917 } else if ($(this).index() == '0' && $pageHeaderBG.length == 0 || $(this).index() == '0') { 6918 $(this).css({ 6919 'margin-top': '0px' 6920 }).addClass('first-section'); 6921 } 6922 }); 6923 6924 6925 $('.portfolio-filters-inline').each(function () { 6926 ////first 6927 if ($(this).parents('.wpb_row').length > 0) { 6928 //skip processing. 6929 } else { 6930 if ($(this).index() == '0' && $pageHeaderBG.length != 0 || $(this).index() == '0') { 6931 $(this).addClass('first-section nder-page-header'); 6932 } else if ($(this).index() == '0' && $pageHeaderBG.length == 0 || $(this).index() == '0') { 6933 6934 $(this).css({ 6935 'margin-top': '-30px', 6936 'padding-top': '50px' 6937 }).addClass('first-section'); 6938 6939 } 6940 } 6941 6942 }); 6943 6944 6945 } 6946 6947 6948 6949 6950 /** 6951 * Full width row padding adjust calculations. 6952 * 6953 * @since 3.0 6954 */ 6955 function fullWidthRowPaddingAdjustCalc() { 6956 6957 if ($('#boxed').length == 0) { 6958 6959 $('.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 () { 6960 6961 var $windowHeight = $window.width(), 6962 $topPadding = ($(this).attr('data-top-percent')) ? $(this).attr('data-top-percent') : 'skip', 6963 $bottomPadding = ($(this).attr('data-bottom-percent')) ? $(this).attr('data-bottom-percent') : 'skip'; 6964 6965 //top 6966 if ($topPadding != 'skip') { 6967 $(this).css('padding-top', $windowHeight * (parseInt($topPadding) / 100)); 6968 } 6969 6970 //bottom 6971 if ($bottomPadding != 'skip') { 6972 $(this).css('padding-bottom', $windowHeight * (parseInt($bottomPadding) / 100)); 6973 } 6974 6975 }); 6976 } 6977 } 6978 6979 /** 6980 * Full width row padding adjust calculations for boxed theme option. 6981 * 6982 * @since 11.0.4 6983 */ 6984 function fullWidthRowPaddingAdjustCalcBoxed() { 6985 6986 if ($('#boxed').length > 0) { 6987 6988 $('.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 () { 6989 6990 var $topPadding = ($(this).attr('data-top-percent')) ? $(this).attr('data-top-percent') : 'skip', 6991 $bottomPadding = ($(this).attr('data-bottom-percent')) ? $(this).attr('data-bottom-percent') : 'skip'; 6992 6993 //top 6994 if ($topPadding != 'skip') { 6995 $(this).css('padding-top', $topPadding); 6996 } 6997 6998 //bottom 6999 if ($bottomPadding != 'skip') { 7000 $(this).css('padding-bottom', $bottomPadding); 7001 } 7002 7003 }); 7004 } 7005 7006 } 7007 7008 7009 /** 7010 * Full width row padding adjust initialization 7011 * 7012 * @since 10.5 7013 */ 7014 function fullWidthRowPaddingAdjust() { 7015 7016 if (nectarDOMInfo.usingMobileBrowser) { 7017 fullWidthRowPaddingAdjustCalc(); 7018 } 7019 7020 $window.on('resize', fullWidthRowPaddingAdjustCalc); 7021 7022 } 7023 7024 7025 7026 7027 /** 7028 * Full width content row auto equal height cols. 7029 * 7030 * @since 4.0 7031 */ 7032 function fullWidthContentColumns() { 7033 7034 var $frontEndEditorElDiv = ($('body.vc_editor').length > 0) ? '.vc_element > ' : ''; 7035 7036 $('.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 () { 7037 7038 // Only set the height if more than one column 7039 if ($(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col').length > 1) { 7040 7041 var tallestColumn = 0;
7042 var $columnInnerHeight = 0; 7043 var $column_inner_selector; 7044 7045 $(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col').each(function () { 7046 7047 $column_inner_selector = ($(this).find('> .vc_column-inner > .wpb_wrapper').length > 0) ? '.vc_column-inner' : '.column-inner-wrap > .column-inner'; 7048 7049 var $padding = ( $body.is('[data-flex-cols="true"]') ) ? parseInt($(this).find('> .vc_column-inner').css('padding-top')) : parseInt($(this).css('padding-top')); 7050 var $frontEndEditorElPadding = ($frontEndEditorElDiv.length > 2 && $(this).find('> .vc_column-inner').length > 0) ? parseInt($(this).find('> .vc_column-inner').css('padding-top')) : 0; 7051 7052 if( $(this).find('> ' + $column_inner_selector + ' > .wpb_wrapper').height() + ($padding * 2) + $frontEndEditorElPadding > tallestColumn ) { 7053 tallestColumn = $(this).find('> ' + $column_inner_selector + ' > .wpb_wrapper').height() + ($padding * 2) + $frontEndEditorElPadding; 7054 } 7055 7056 }); 7057 7058 $(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col').each(function () { 7059 7060 $column_inner_selector = ($(this).find('> .vc_column-inner > .wpb_wrapper').length > 0) ? '.vc_column-inner' : '.column-inner-wrap > .column-inner'; 7061 7062 // Columns with content 7063 if ($(this).find('> ' + $column_inner_selector + ' > .wpb_wrapper > *').length > 0) { 7064 7065 // Added in 7.6 to fix equal height columns 7066 if ($frontEndEditorElDiv.length < 2 && !$(this).parent().parent().hasClass('vc_row-o-equal-height')) { 7067 $(this).css('height', tallestColumn); 7068 7069 if( $body.is('[data-flex-cols="true"]') ) { 7070 $(this).find('> .vc_column-inner').css('height', tallestColumn); 7071 } 7072 7073 } else if ($frontEndEditorElDiv.length > 2 && !$(this).parent().parent().parent().hasClass('vc_row-o-equal-height')) { 7074 $(this).css('height', tallestColumn); 7075 7076 if( $body.is('[data-flex-cols="true"]') ) { 7077 $(this).find('> .vc_column-inner').css('height', tallestColumn); 7078 } 7079 7080 } 7081 } 7082 7083 // Empty columns 7084 else { 7085 if ($(this).is('[data-using-bg="true"]')) { 7086 7087 $(this).css('min-height', tallestColumn); 7088 7089 if( $body.is('[data-flex-cols="true"]') ) { 7090 $(this).find('> .vc_column-inner').css('min-height', tallestColumn); 7091 } 7092 7093 if ($(this).is('[data-animation*="reveal"]')) { 7094 $(this).find('.column-inner') 7095 .css('min-height', tallestColumn); 7096 } 7097 7098 } 7099 } 7100 7101 }); 7102 7103 // Nested column height 7104 if (nectarDOMInfo.winW < 1000) { 7105 $(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col .wpb_row .col').css('min-height', '0px'); 7106 } 7107 7108 // Vertically center 7109 if ($(this).hasClass('vertically-align-columns') && 7110 nectarDOMInfo.winW > 1000 && 7111 !$(this).hasClass('vc_row-o-equal-height')) { 7112 7113 // Parent columns 7114 $(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col').each(function () { 7115 7116 $column_inner_selector = ($(this).find('> .vc_column-inner > .wpb_wrapper').length > 0) ? '.vc_column-inner' : '.column-inner-wrap > .column-inner'; 7117
7118 $columnInnerHeight = $(this).find('> ' + $column_inner_selector + ' > .wpb_wrapper').height(); 7119 7120 var $marginCalc = ($(this).height() / 2) - ($columnInnerHeight / 2); 7121 7122 if ($marginCalc <= 0) { 7123 $marginCalc = 0; 7124 } 7125 7126 $(this).find('> ' + $column_inner_selector + ' > .wpb_wrapper') 7127 .css('margin-top', $marginCalc) 7128 .css('margin-bottom', $marginCalc); 7129 7130 }); 7131 7132 7133 } 7134 7135 } 7136 7137 }); 7138 7139 7140 if( $('body[data-flex-cols="true"]').length == 0 ) { 7141 7142 // Equal height columns in container type with reveal columns 7143 $('.main-content > .row > .wpb_row:not(.full-width-content).vc_row-o-equal-height').each(function () { 7144 if ($(this).find('>.span_12 > ' + $frontEndEditorElDiv + ' .wpb_column[data-animation*="reveal"]').length > 0) { 7145 7146 var tallestColumn = 0; 7147 7148 $(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col').each(function () { 7149 7150 var $padding = parseInt($(this).find('> .column-inner-wrap > .column-inner').css('padding-top')); 7151 7152 if( $(this).find('> .column-inner-wrap > .column-inner').height() + ($padding * 2) > tallestColumn ) { 7153 tallestColumn = $(this).find('> .column-inner-wrap > .column-inner').height() + ($padding * 2); 7154 } 7155 7156 });
7157 7158 $(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col').each(function () { 7159 7160 // Columns with content 7161 if ($(this).find('> .column-inner-wrap > .column-inner .wpb_wrapper > *').length > 0) { 7162 $(this).find('> .column-inner-wrap').css('height', tallestColumn); 7163 } 7164 // Empty columns 7165 else { 7166 $(this).css('min-height', tallestColumn); 7167 if ($(this).is('[data-animation*="reveal"]')) { 7168 $(this).find('.column-inner').css('min-height', tallestColumn); 7169 } 7170 } 7171 }); 7172 7173 } 7174 }); 7175 7176 // Using equal height option, top/bottom padding % needs to be convered into px for cross browser (flex bug) 7177 $('.wpb_row.vc_row-o-equal-height>.span_12> ' + $frontEndEditorElDiv + '.wpb_column[class*="padding-"][data-padding-pos="all"]').each(function () { 7178 if ($(this).parents('.tabbed').length == 0) { 7179 $(this).css({ 7180 'padding-top': $(this).css('padding-left'), 7181 'padding-bottom': $(this).css('padding-left') 7182 });
7183 } 7184 }); 7185 7186 } // endif; Not using modern grid system. 7187 7188 } 7189 7190 7191 7192 7193 /** 7194 * Mouse parallax row option. 7195 * 7196 * @since 4.0 7197 */ 7198 function mouseParallaxInit() { 7199 7200 $('.wpb_row:has(.nectar-parallax-scene)').each(function (i) { 7201 7202 var $strength = parseInt($(this).find('.nectar-parallax-scene').attr('data-scene-strength')); 7203 7204 $mouseParallaxScenes[i] = $(this).find('.nectar-parallax-scene').parallax({ 7205 scalarX: $strength, 7206 scalarY: $strength 7207 }); 7208 7209 // Wait until the images in the scene have loaded. 7210 var images = $(this).find('.nectar-parallax-scene li'); 7211 7212 $.each(images, function () { 7213 if ($(this).find('div').length > 0) { 7214 var el = $(this).find('div'), 7215 image = el.css('background-image').replace(/"/g, '').replace(/url\(|\)$/ig, ''); 7216 if (image && image !== '' && image !== 'none') { 7217 images = images.add($('<img>').attr('src', image)); 7218 } 7219 } 7220 }); 7221 7222 }); 7223 7224 } 7225 7226 7227 7228 7229 /** 7230 * Add checkmark icons to unorder list with checkmark class. 7231 * 7232 * @since 2.0 7233 */ 7234 function ulCheckmarks() { 7235 $('ul.checks li').each(function () { 7236 if ($(this).find('i.fa-check-circle').length == 0) { 7237 $(this).prepend('<i class="fa fa-check-circle"></i>'); 7238 } 7239 }); 7240 } 7241 7242 7243 7244 /** 7245 * Allow CTA element BG color to also act as a link. 7246 * 7247 * @since 11.0 7248 */ 7249 function ctaLinkBG() { 7250 7251 $body.on('click','.nectar-cta[data-using-bg="true"]:not([data-style="material"]) .link_wrap', function(e) { 7252 if( !$(e.target).is('a') ) { 7253 $(this).find('a.link_text')[0].click(); 7254 } 7255 }); 7256 7257 } 7258 7259 7260 7261 /** 7262 * Add CSS default animation classes through JS to 7263 * avoid inital animation on page load. 7264 * 7265 * @since 11.0 7266 */ 7267 function nectarKeyframeAssist() { 7268 7269 $('.nectar-cta[data-style="arrow-animation"]').addClass('loaded'); 7270 7271 } 7272 7273 7274 7275 7276 /** 7277 * Page builder row background layer animations. 7278 * 7279 * @since 9.0 7280 * @see waypoints 7281 */ 7282 function rowBGAnimations() { 7283 7284 var $rowBGAnimationsOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : '93%'; 7285 var $rowBGAnimationsRevealOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : '97%'; 7286 var $rowBGOffset; 7287 7288 $($fullscreenSelector + '.row-bg-wrap[data-bg-animation]:not([data-bg-animation="none"]) .row-bg').each(function () { 7289 7290 var $animation = $(this).parents('.row-bg-wrap').attr('data-bg-animation'); 7291 7292 if( $animation != 'zoom-out-reveal' && $animation.indexOf('reveal-from-') == -1 ) { 7293 $rowBGOffset = $rowBGAnimationsOffsetPos; 7294 } else { 7295 $rowBGOffset = $rowBGAnimationsRevealOffsetPos; 7296 } 7297 7298 if( !$(this).hasClass('using-image') && $(this).parents('.nectar-scrolling-text').length == 0 ) { 7299 7300 if( $animation != 'zoom-out-reveal' && $animation.indexOf('reveal-from-') == -1 ) { 7301 return; 7302 } 7303 7304 } 7305 7306 7307 var $that = $(this); 7308 var waypoint = new Waypoint({ 7309 element: $that.parents('.row-bg-wrap'), 7310 handler: function () { 7311 7312 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 7313 waypoint.destroy(); 7314 return; 7315 } 7316 7317 $that.parents('.inner-wrap').addClass('animated-in'); 7318 7319 if( $animation == 'zoom-out-reveal' || $animation.indexOf('reveal-from-') > -1 || $that.parents('.nectar-scrolling-text').length > 0 ) { 7320 $that.parents('.row-bg-wrap').addClass('animated-in'); 7321 } 7322 7323 waypoint.destroy(); 7324 }, 7325 offset: $rowBGOffset 7326 }); 7327 7328 }); 7329 7330 } 7331 7332 7333 /** 7334 * Page builder column background layer animations. 7335 * 7336 * @since 9.0 7337 * @see waypoints 7338 */ 7339 function columnBGAnimations() { 7340 7341 var $colBGAnimationsOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : '93%'; 7342 var $colBGAnimationsRevealOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : '80%'; 7343 var $colBGOffset; 7344 7345 $($fullscreenSelector + '.column-image-bg-wrap[data-bg-animation]:not([data-bg-animation="none"]):not([data-bg-animation*="displace-filter"]) .column-image-bg').each(function () { 7346 7347 var $animation = $(this).parents('.column-image-bg-wrap').attr('data-bg-animation'); 7348 7349 if( $animation != 'zoom-out-reveal' && $animation.indexOf('reveal-from-') == -1 ) { 7350 $colBGOffset = $colBGAnimationsOffsetPos; 7351 } else { 7352 7353 if( $animation == 'ro-reveal-from-bottom' && $fullscreenMarkupBool == false ) { 7354 $colBGOffset = '95%'; 7355 } else if( $animation == 'ro-reveal-from-top' && $fullscreenMarkupBool == false ) { 7356 $colBGOffset = '65%'; 7357 } else { 7358 $colBGOffset = $colBGAnimationsRevealOffsetPos; 7359 } 7360 } 7361 7362 var $that = $(this); 7363 7364 var waypoint = new Waypoint({ 7365 element: $that.parents('.column-image-bg-wrap'), 7366 handler: function () { 7367 7368 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 7369 waypoint.destroy(); 7370 return; 7371 } 7372 7373 $that.parents('.inner-wrap').addClass('animated-in'); 7374 if( $animation == 'zoom-out-reveal' || $animation.indexOf('reveal-from-') > -1 ) { 7375 $that.parents('.column-image-bg-wrap').addClass('animated-in'); 7376 $that.parents('.column-image-bg-wrap').siblings('.column-bg-overlay-wrap').addClass('animated-in'); 7377 $that.parents('.vc_column-inner').addClass('revealed-bg'); 7378 } 7379 waypoint.destroy(); 7380 }, 7381 offset: $colBGOffset 7382 });
7383 7384 }); 7385 7386 // Zoom out reveal with BG color only 7387 $($fullscreenSelector + '.column-bg-overlay-wrap[data-bg-animation]').each(function () { 7388 7389 $colBGOffset = $colBGAnimationsRevealOffsetPos; 7390 7391 var $that = $(this); 7392 var $animation = $(this).attr('data-bg-animation'); 7393 7394 if( $animation == 'zoom-out-reveal' || $animation.indexOf('reveal-from-') > 0 ) { 7395 7396 if( $that.parent().find('.column-image-bg-wrap').length == 0 ) { 7397 7398 var waypoint = new Waypoint({ 7399 element: $that, 7400 handler: function () { 7401 7402 if ( $that.hasClass('animated-in') ) { 7403 waypoint.destroy(); 7404 return; 7405 } 7406 7407 $that.addClass('animated-in'); 7408 $that.parents('.vc_column-inner').addClass('revealed-bg'); 7409 waypoint.destroy(); 7410 7411 }, 7412 offset: $colBGOffset 7413 }); 7414 7415 } 7416 7417 } 7418 7419 }); 7420 7421 } 7422 7423 7424 7425 /** 7426 * Page builder column and image animations. 7427 * 7428 * @since 4.0 7429 * @see waypoints 7430 */ 7431 function colAndImgAnimations() { 7432 7433 var $colAndImgOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : '88%'; 7434 var $cascadingOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : '70%'; 7435 var $colAndImgRevealOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : '70%'; 7436 7437 $($fullscreenSelector + '.img-with-animation').each(function () { 7438 7439 var $that = $(this); 7440 7441 var $animationType = ($that.is('[data-animation]')) ? $that.attr('data-animation') : 'fade-in'; 7442 7443 // reveal images alters offset 7444 if( $animationType == 'ro-reveal-from-right' && $colAndImgOffsetPos == '88%' || 7445 $animationType == 'ro-reveal-from-left' && $colAndImgOffsetPos == '88%' ) { 7446 $colAndImgOffsetPos = '75%'; 7447 } 7448 7449 // initiate waypoint. 7450 var waypoint = new Waypoint({ 7451 element: $that, 7452 handler: function () { 7453 7454 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 7455 waypoint.destroy(); 7456 return; 7457 } 7458 7459 if (!bypassAnimations || $('body[data-responsive="0"]').length > 0) { 7460 7461 var $delay = ($that.is('[data-delay]')) ? $that.attr('data-delay') : 0; 7462 var $elToAnimate = ($that.parents('.hover-wrap').length > 0) ? $that.parents('.hover-wrap') : $that; 7463 7464 7465 if ($animationType == 'fade-in-from-left' || $animationType == 'fade-in-from-right') { 7466 7467 $elToAnimate.delay($delay).transition({ 7468 'opacity': 1, 7469 'x': '0px' 7470 }, $animationDuration, $animationEasing); 7471 7472 } else if ($animationType == 'fade-in-from-bottom') { 7473 7474 $elToAnimate.delay($delay).transition({ 7475 'opacity': 1, 7476 'y': '0px' 7477 }, $animationDuration, $animationEasing); 7478 7479 } else if ($animationType == 'fade-in') { 7480 7481 $elToAnimate.delay($delay).transition({ 7482 'opacity': 1 7483 }, $animationDuration, $animationEasing); 7484 7485 } else if ($animationType == 'grow-in') { 7486 7487 setTimeout(function () { 7488 $elToAnimate.transition({ 7489 scale: 1, 7490 'opacity': 1 7491 }, $animationDuration, $animationEasing); 7492 }, $delay); 7493 7494 } else if ($animationType == 'flip-in') { 7495 7496 setTimeout(function () { 7497 $elToAnimate.transition({ 7498 rotateY: 0, 7499 'opacity': 1 7500 }, $animationDuration, $animationEasing); 7501 }, $delay); 7502 7503 } else if ($animationType == 'flip-in-vertical') { 7504 7505 setTimeout(function () { 7506 $elToAnimate.transition({ 7507 rotateX: 0, 7508 'opacity': 1 7509 }, $animationDuration, $animationEasing); 7510 }, $delay); 7511 7512 } 7513 else if ($animationType == 'ro-reveal-from-left' || 7514 $animationType == 'ro-reveal-from-right' || 7515 $animationType == 'ro-reveal-from-bottom' || 7516 $animationType == 'ro-reveal-from-top') { 7517 $that.parents('.img-with-aniamtion-wrap').addClass('animated-in'); 7518 } 7519 7520 $that.addClass('animated-in'); 7521 7522 } 7523 7524 waypoint.destroy(); 7525 7526 }, 7527 offset: $colAndImgOffsetPos 7528 });
7529 7530 7531 7532 }); 7533 7534 7535 $($fullscreenSelector + '.nectar_cascading_images').each(function () { 7536 7537 var $that = $(this); 7538 var $animationDelay = ($(this).is('[data-animation-timing]')) ? $(this).attr('data-animation-timing') : 175; 7539 $animationDelay = parseInt($animationDelay); 7540 7541 var waypoint = new Waypoint({ 7542 element: $that, 7543 handler: function () { 7544 7545 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 7546 waypoint.destroy(); 7547 return; 7548 } 7549 7550 if (!bypassAnimations || $('body[data-responsive="0"]').length > 0) { 7551 7552 $that.find('.cascading-image').each(function (i) { 7553 7554 var $that2 = $(this); 7555 7556 if ($that2.attr('data-animation') == 'flip-in' || $that2.attr('data-animation') == 'flip-in-vertical') { 7557 setTimeout(function () { 7558 $that2.find('.inner-wrap').css({ 7559 'opacity': 1, 7560 'transform': 'rotate(0deg) translateZ(0px)' 7561 }); 7562 }, i * $animationDelay); 7563 } else if( $that2.attr('data-animation') == 'grow-in-reveal' ) { 7564 setTimeout(function () { 7565 $that2.find('.inner-wrap').css({ 7566 'opacity': 1, 7567 'transform': 'translateX(0px) translateY(0px) scale(1,1) translateZ(0px)' 7568 }); 7569 $that2.find('.inner-wrap img').css({ 7570 'transform': 'translateX(0px) translateY(0px) scale(1,1) translateZ(0px)' 7571 }); 7572 }, i * $animationDelay); 7573 } 7574 else { 7575 setTimeout(function () { 7576 $that2.find('.inner-wrap').css({ 7577 'opacity': 1, 7578 'transform': 'translateX(0px) translateY(0px) scale(1,1) translateZ(0px)' 7579 }); 7580 }, i * $animationDelay); 7581 } 7582 7583 7584 }); 7585 7586 $that.addClass('animated-in'); 7587 7588 } 7589 7590 waypoint.destroy(); 7591 7592 }, 7593 offset: $cascadingOffsetPos 7594 }); 7595 7596 }); 7597 7598 7599 $($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) { 7600 7601 var $that = $(this); 7602 7603 var waypoint = new Waypoint({ 7604 element: $that, 7605 handler: function () { 7606 7607 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 7608 waypoint.destroy(); 7609 return; 7610 } 7611 7612 if (!bypassAnimations || $('body[data-responsive="0"]').length > 0) { 7613 7614 $that.addClass('triggered-animation'); 7615 $(window).trigger('nectar-column-animation-start'); 7616 7617 var $delay = $that.attr('data-delay'); 7618 7619 if ($that.attr('data-animation') == 'fade-in-from-left' || $that.attr('data-animation') == 'fade-in-from-right') { 7620 7621 $standAnimatedColTimeout[i] = setTimeout(function () { 7622 $that.transition({ 7623 'opacity': 1, 7624 'x': '0px' 7625 }, $animationDuration, $animationEasing); 7626 }, $delay); 7627 7628 } else if ($that.attr('data-animation') == 'fade-in-from-bottom') { 7629 7630 $standAnimatedColTimeout[i] = setTimeout(function () { 7631 $that.transition({ 7632 'opacity': 1, 7633 'y': '0px' 7634 }, $animationDuration, $animationEasing); 7635 }, $delay); 7636 7637 } else if ($that.attr('data-animation') == 'fade-in') { 7638 7639 $standAnimatedColTimeout[i] = setTimeout(function () { 7640 $that.transition({ 7641 'opacity': 1 7642 }, $animationDuration, $animationEasing); 7643 }, $delay); 7644 7645 } else if ($that.attr('data-animation') == 'grow-in' || $that.attr('data-animation') == 'zoom-out') { 7646 7647 $standAnimatedColTimeout[i] = setTimeout(function () { 7648 $that.transition({ 7649 scale: 1, 7650 'opacity': 1 7651 }, $animationDuration, $animationEasing); 7652 }, $delay); 7653 7654 } else if ($that.attr('data-animation') == 'flip-in') { 7655 7656 $standAnimatedColTimeout[i] = setTimeout(function () { 7657 $that.transition({ 7658 rotateY: '0', 7659 'opacity': 1 7660 }, $animationDuration, $animationEasing); 7661 }, $delay); 7662 7663 } else if ($that.attr('data-animation') == 'flip-in-vertical') { 7664 7665 $standAnimatedColTimeout[i] = setTimeout(function () { 7666 $that.transition({ 7667 rotateX: '0', 7668 y: '0', 7669 'opacity': 1 7670 }, $animationDuration, $animationEasing); 7671 }, $delay); 7672 7673 } else if ($that.attr('data-animation') == 'slight-twist') { 7674 7675 $standAnimatedColTimeout[i] = setTimeout(function () { 7676 anime({ 7677 targets: $that[0], 7678 rotateY: [20, 0], 7679 rotateZ: [-4, 0], 7680 opacity: 1, 7681 easing: $animationEasing, 7682 duration: $animationDuration 7683 });
7684 }, $delay); 7685 7686 } 7687 7688 //boxed column hover fix 7689 if ($that.hasClass('boxed')) { 7690 $that.addClass('no-pointer-events'); 7691 setTimeout(function () { 7692 $that.removeClass('no-pointer-events'); 7693 }, parseInt($animationDuration) + parseInt($delay) + 30); 7694 } 7695 7696 if ($that.find('.nectar-post-grid-wrap[data-style="mouse_follow_image"]')) { 7697 setTimeout(function() { 7698 $that[0].style.transform = 'none'; 7699 }, parseInt($animationDuration) + parseInt($delay) + 30 ); 7700 } 7701 7702 $that.addClass('animated-in'); 7703 7704 } 7705 7706 waypoint.destroy(); 7707 }, 7708 offset: $colAndImgOffsetPos 7709 }); 7710 7711 }); 7712 7713 7714 $($fullscreenSelector + '.wpb_column.has-animation[data-animation*="reveal"]').each(function () { 7715 7716 var $that = $(this), 7717 waypoint = new Waypoint({ 7718 element: $that, 7719 handler: function () { 7720 7721 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 7722 waypoint.destroy(); 7723 return; 7724 } 7725 7726 var $delay = $that.attr('data-delay'); 7727 7728 if (!bypassAnimations || $('body[data-responsive="0"]').length > 0) { 7729 7730 var $columnInnerSelector = ( $that.find('> .vc_column-inner').length > 0 ) ? true : false; 7731 7732 if ($that.attr('data-animation') == 'reveal-from-bottom' || $that.attr('data-animation') == 'reveal-from-top') { 7733 7734 setTimeout(function () { 7735 7736 if ($that.hasClass('animated-in')) { 7737 7738 if( $columnInnerSelector == true ) { 7739 7740 // Modern. 7741 $that.find('> .vc_column-inner').transition({ 7742 'y': 0 7743 }, $animationDuration, $animationEasing ); 7744 7745 } else { 7746 7747 // Legacy. 7748 $that.find('.column-inner-wrap, .column-inner').transition({ 7749 'y': 0 7750 }, $animationDuration, $animationEasing, function () { 7751 $that.find('.column-inner-wrap, .column-inner').addClass('no-transform'); 7752 }); 7753 } 7754 7755 } 7756 7757 }, $delay); 7758 7759 } else if ($that.attr('data-animation') == 'reveal-from-right' || $that.attr('data-animation') == 'reveal-from-left') { 7760 setTimeout(function () { 7761 if ($that.hasClass('animated-in')) { 7762 7763 if( $columnInnerSelector == true ) { 7764 7765 // Modern. 7766 $that.find('> .vc_column-inner').transition({ 7767 'x': 0 7768 }, $animationDuration, $animationEasing); 7769 7770 7771 } else { 7772 // Legacy. 7773 $that.find('.column-inner-wrap, .column-inner').transition({ 7774 'x': 0 7775 }, $animationDuration, $animationEasing, function () { 7776 $that.find('.column-inner-wrap, .column-inner').addClass('no-transform'); 7777 }); 7778 7779 } 7780 7781 7782 } 7783 }, $delay); 7784 } 7785 7786 $that.addClass('animated-in'); 7787 7788 } 7789 7790 waypoint.destroy(); 7791 }, 7792 offset: $colAndImgRevealOffsetPos 7793 }); 7794 7795 }); 7796 7797 } 7798 7799 7800 7801 /** 7802 * Cascading images element sizing 7803 * 7804 * @since 6.0 7805 */ 7806 function cascadingImageBGSizing() { 7807 7808 $('.nectar_cascading_images').each(function () { 7809 7810 var forcedAspect = ( $(this).hasClass('forced-aspect') ) ? true : false; 7811 7812 //handle max width for cascading images in equal height columns 7813 if ($(this).parents('.vc_row-o-equal-height').length > 0 && $(this).parents('.wpb_column').length > 0) { 7814 $(this).css('max-width', $(this).parents('.wpb_column').width()); 7815 } 7816 7817 //set size for layers with no images 7818 $(this).find('.bg-color').each(function () { 7819 7820 if( forcedAspect == true && $(this).parents('.cascading-image').index() == 0 ) { 7821 return true; 7822 } 7823 7824 var $bgColorHeight = 0; 7825 var $bgColorWidth = 0; 7826 7827 if ($(this).parent().find('.img-wrap').length == 0) { 7828 7829 var $firstSibling = $(this).parents('.cascading-image').siblings('.cascading-image[data-has-img="true"]').first(); 7830 7831 $bgColorHeight = $firstSibling.find('.img-wrap').height(); 7832 $bgColorWidth = $firstSibling.find('.img-wrap').width(); 7833 7834 } else { 7835 $bgColorHeight = $(this).parent().find('.img-wrap').height(); 7836 $bgColorWidth = $(this).parent().find('.img-wrap').width(); 7837 } 7838 7839 $(this).css({ 7840 'height': $bgColorHeight, 7841 'width': $bgColorWidth 7842 }).addClass('calculated'); 7843 7844 });
7845 7846 }); 7847 7848 } 7849 7850 7851 7852 7853 /** 7854 * Cascading images element initialization. 7855 * 7856 * @since 10.5 7857 */ 7858 function cascadingImageInit() { 7859 7860 if ($('.nectar_cascading_images').length > 0) { 7861 7862 var cascadingParallax = []; 7863 7864 $('.nectar_cascading_images').each(function(i){ 7865 7866 imagesLoaded($(this), function (instance) { 7867 7868 // Create sizes. 7869 cascadingImageBGSizing(); 7870 7871 // Parallax scrolling. 7872 if( $(instance.elements[0]).is('[data-parallax="yes"]') && !nectarDOMInfo.usingMobileBrowser && $('#nectar_fullscreen_rows').length == 0 ) { 7873 cascadingParallax[i] = new CascadingParallax($(instance.elements[0]), $(instance.elements[0]).attr('data-parallax-intensity')); 7874 } 7875 7876 }); 7877 7878 }); 7879 7880 // BG Sizing Resize. 7881 $window.on('resize', cascadingImageBGSizing); 7882 7883 } 7884 7885 } 7886 7887 7888 7889 7890 function CascadingParallax(el, intensity) { 7891 7892 this.$element = el; 7893 this.inView = false; 7894 this.topLevel = false; 7895 this.lastY = 0; 7896 7897 this.layer1Parallax = ( this.$element.is('[data-layer-1-parallax="yes"]') ) ? true : false; 7898 7899 switch(intensity) { 7900 case 'subtle': 7901 this.intensity = 0.09; 7902 break; 7903 case 'medium': 7904 this.intensity = 0.15; 7905 break; 7906 case 'high': 7907 this.intensity = 0.25; 7908 break; 7909 } 7910 this.calculatePos(); 7911 this.trackView(); 7912 this.animate(); 7913 7914 if( $('.portfolio-filters').length > 0 || 7915 $('.portfolio-filters-inline').length > 0 ) { 7916 setInterval(this.calculatePos.bind(this),700); 7917 } 7918 7919 $window.on('resize', this.calculatePos.bind(this)); 7920 } 7921 7922 CascadingParallax.prototype.calculatePos = function() { 7923 this.offsetTop = this.$element.offset().top; 7924 this.height = this.$element.outerHeight(); 7925 this.vertCenter = nectarDOMInfo.winH/2 - this.height/2; 7926 }; 7927 7928 CascadingParallax.prototype.trackView = function() { 7929 7930 var that = this; 7931 7932 if( this.$element.parents('.top-level').length > 0 ) { 7933 this.topLevel = true; 7934 } 7935 7936 if( 'IntersectionObserver' in window ) { 7937 7938 var options = { 7939 rootMargin: '250px', 7940 } 7941 var observer = new IntersectionObserver(function(entries) { 7942 7943 entries.forEach(function(entry){ 7944 var isIntersecting = entry.isIntersecting; 7945 7946 if (isIntersecting) { 7947 that.inView = true; 7948 } else { 7949 that.inView = false; 7950 } 7951 }); 7952 7953 }, options); 7954 7955 observer.observe(this.$element[0]); 7956 7957 } 7958 7959 }; 7960 7961 CascadingParallax.prototype.animate = function() { 7962 7963 if( nectarState.materialOffCanvasOpen == true ) { 7964 window.requestAnimationFrame(this.animate.bind(this)); 7965 return; 7966 } 7967 7968 this.lastY = linearInterpolate(this.lastY, nectarDOMInfo.scrollTop, 0.2); 7969 7970 if( this.inView ) { 7971 7972 var that = this; 7973 7974 this.$element.find('.bg-layer').each(function(i) { 7975 7976 var $scale = $(this).data('scale'); 7977 7978 if( that.layer1Parallax ) { 7979 i = (i/1.5)+1; 7980 } 7981 7982 if( that.topLevel === true && nectarDOMInfo.winW > 1000) { 7983 $(this)[0].style.transform = 'translateY(' + -(that.lastY * that.intensity * i) + 'px) translateZ(0) scale(' + $scale + ')'; 7984 } else { 7985 $(this)[0].style.transform = 'translateY(' + -((that.lastY - that.offsetTop + that.vertCenter ) * that.intensity * i ) + 'px) translateZ(0) scale(' + $scale + ')'; 7986 } 7987 7988 }); 7989 } 7990 7991 window.requestAnimationFrame(this.animate.bind(this)); 7992 }; 7993 7994 7995 7996 7997 /** 7998 * Split line heading element initialization. 7999 * 8000 * @since 10.5 8001 * @see waypoints 8002 */ 8003 function splitLineHeadings() { 8004 8005 // Create waypoint. 8006 var $splitLineOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : 'bottom-in-view'; 8007 $($fullscreenSelector + '.nectar-split-heading').each(function () { 8008 8009 var $that = $(this); 8010 var $delay = ( $that.is('[data-animation-delay]') ) ? parseInt($that.attr('data-animation-delay')) : 0; 8011 8012 var waypoint = new Waypoint({ 8013 element: $that, 8014 handler: function () { 8015 8016 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 8017 waypoint.destroy(); 8018 return; 8019 } 8020 8021 if (!bypassAnimations || $('body[data-responsive="0"]').length > 0) { 8022 8023 var $animationDurationCap; 8024 8025 setTimeout(function() { 8026 8027 if( $that.is('[data-animation-type="line-reveal-by-space"]') ) { 8028 8029 var stagger = 0; 8030 if( $that.is('[data-stagger="true"]') ) { 8031 stagger = 500 / $that.find('> * > span').length; 8032 stagger = Math.min(Math.max(stagger, 15), 50); // Clamp val 8033 } 8034 8035 $animationDurationCap = (parseInt($animationDuration) < 1100) ? $animationDuration : '1100'; 8036 8037 if( $that.is('[data-m-rm-animation="true"]') && nectarDOMInfo.winW < 1000 ) { 8038 $that.find('> * > span .inner').css({ 8039 'transform' : 'translateY(0)' 8040 });
8041 } 8042 else { 8043 $that.find('> * > span').each(function (i) { 8044 8045 if( stagger == 0 ) { 8046 $(this).find('> .inner').delay(i * stagger).transition({ 8047 'y': '0px' 8048 }, $animationDurationCap, $animationEasing); 8049 } 8050 else { 8051 var spanEl = $(this); 8052 var $innerEl = spanEl.find('> .inner'); 8053 setTimeout(function(){ 8054 $innerEl[0].style.transform = 'translateY(0em)'; 8055 }, i * stagger); 8056 8057 } 8058 8059 }); 8060 } 8061 8062 } else if( $that.is('[data-animation-type="letter-fade-reveal"]') ) { 8063 8064 $animationDurationCap = (parseInt($animationDuration) < 1000) ? $animationDuration : '1000'; 8065 $that.find('> * > span span').each(function (i) { 8066 8067 $(this).delay(i * 8).transition({ 8068 'y': '0px', 8069 'opacity': '1' 8070 }, $animationDurationCap, $animationEasing); 8071 8072 }); 8073 8074 } else { 8075 $that.find('.heading-line').each(function (i) { 8076 8077 $(this).find('> div').delay(i * 70).transition({ 8078 'y': '0px' 8079 }, $animationDuration, $animationEasing); 8080 8081 }); 8082 } 8083 8084 $that.addClass('animated-in'); 8085 8086 }, $delay); 8087 8088 } 8089 8090 waypoint.destroy(); 8091 }, 8092 offset: $splitLineOffsetPos 8093 }); 8094 8095 }); 8096 } 8097 8098 8099 8100 /** 8101 * Progress bar element initialization. 8102 * 8103 * @since 3.0 8104 * @see waypoints 8105 */ 8106 8107 function progressBars() { 8108 8109 var $progressBarsOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : 'bottom-in-view'; 8110 var $progressSelector = ($('#nectar_fullscreen_rows[data-mobile-disable="on"]').length > 0 && nectarDOMInfo.usingMobileBrowser) ? '.nectar-progress-bar' : $fullscreenSelector + '.nectar-progress-bar'; 8111 8112 if( nectarDOMInfo.usingMobileBrowser && $progressBarsOffsetPos == 'bottom-in-view') { 8113 $progressBarsOffsetPos = '70%'; 8114 } 8115 8116 $($progressSelector).each(function () { 8117 8118 var $that = $(this); 8119 8120 var waypoint = new Waypoint({ 8121 element: $that, 8122 handler: function () { 8123 8124 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 8125 waypoint.destroy(); 8126 return; 8127 } 8128 8129 if ($progressBarsOffsetPos == '100%') { 8130 $that.find('.bar-wrap').css('opacity', '1'); 8131 } 8132 8133 8134 var percent = $that.find('span').attr('data-width'), 8135 $endNum = parseInt($that.find('span strong i').text()); 8136 8137 $that.find('span').transition({ 8138 'width': percent + '%' 8139 }, 800, 'easeInOutCubic'); 8140 8141 var countOptions = { 8142 useEasing: false 8143 }; 8144 var $countEle = $that.find('span strong i')[0]; 8145 var numAnim = new CountUp($countEle, 0, $endNum, 0, 1, countOptions); 8146 numAnim.start(); 8147 8148 $that.find('span strong').transition({ 8149 'opacity': 1 8150 }, 550, 'easeInCirc'); 8151 8152 ////100% progress bar 8153 if (percent == '100') { 8154 $that.find('span strong').addClass('full'); 8155 } 8156 8157 $that.addClass('completed'); 8158 8159 waypoint.destroy(); 8160 8161 }, 8162 offset: $progressBarsOffsetPos 8163 }); 8164 8165 }); 8166 8167 } 8168 8169 8170 8171 /** 8172 * Page builder column border animations. 8173 * 8174 * @since 8.0 8175 * @see waypoints 8176 */ 8177 function animatedColBorders() { 8178 8179 var $progressBarsOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : '75%'; 8180 $($fullscreenSelector + '.wpb_column[data-border-animation="true"]').each(function () { 8181 8182 var $that = $(this), 8183 waypoint = new Waypoint({ 8184 element: $that, 8185 handler: function () { 8186 8187 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 8188 waypoint.destroy(); 8189 return; 8190 } 8191 8192 var $borderDelay = ($that.attr('data-border-animation-delay').length > 0) ? parseInt($that.attr('data-border-animation-delay')) : 0; 8193 setTimeout(function () { 8194 $that.find('.border-wrap').addClass('animation'); 8195 $that.find('.border-wrap').addClass('completed'); 8196 }, $borderDelay); 8197 8198 waypoint.destroy(); 8199 8200 }, 8201 offset: $progressBarsOffsetPos 8202 });
8203 8204 }); 8205 } 8206 8207 8208 8209 /** 8210 * Food menu item element. 8211 * 8212 * @since 8.0 8213 * @see waypoints 8214 */ 8215 function foodMenuItems() { 8216 8217 var $foodItemOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : '80%'; 8218 $($fullscreenSelector + '.nectar_food_menu_item').parent().each(function () { 8219 8220 var $that = $(this), 8221 waypoint = new Waypoint({ 8222 element: $that, 8223 handler: function () { 8224 8225 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 8226 waypoint.destroy(); 8227 return; 8228 } 8229 8230 $that.find('.nectar_food_menu_item').each(function (i) { 8231 8232 var $that = $(this); 8233 8234 setTimeout(function () { 8235 $that.addClass('animated-in'); 8236 }, i * 150); 8237 8238 }); 8239 8240 waypoint.destroy(); 8241 8242 }, 8243 offset: $foodItemOffsetPos 8244 }); 8245 8246 }); 8247 } 8248 8249 8250 8251 /** 8252 * Divider element 8253 * 8254 * @since 3.0 8255 * @see waypoints 8256 */ 8257 function dividers() { 8258 8259 var $dividerOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : 'bottom-in-view'; 8260 8261 $($fullscreenSelector + '.divider-small-border[data-animate="yes"], ' + $fullscreenSelector + '.divider-border[data-animate="yes"]').each(function () { 8262 8263 var $lineDur = ($(this).hasClass('divider-small-border')) ? 1300 : 1500, 8264 $that = $(this), 8265 waypoint = new Waypoint({ 8266 element: $that, 8267 handler: function () { 8268 8269 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 8270 waypoint.destroy(); 8271 return; 8272 } 8273 8274 $that.each(function () { 8275 8276 $(this).css({ 8277 'transform': 'scale(0,1)', 8278 'visibility': 'visible' 8279 }); 8280 var $that = $(this); 8281 8282 $that.delay($that.attr('data-animation-delay')).transition({ 8283 'transform': 'scale(1, 1)' 8284 }, $lineDur, 'cubic-bezier(.18,1,.22,1)'); 8285 8286 });
8287 8288 $that.addClass('completed'); 8289 8290 waypoint.destroy(); 8291 8292 }, 8293 offset: $dividerOffsetPos 8294 }); 8295 8296 }); 8297 } 8298 8299 8300 8301 /** 8302 * Image with hotspots element hover event 8303 * 8304 * @since 7.0 8305 */ 8306 function hotSpotHoverBind() { 8307 8308 //add pulse animation 8309 $('.nectar_image_with_hotspots[data-hotspot-icon="numerical"]').each(function () { 8310 $(this).find('.nectar_hotspot_wrap').each(function (i) { 8311 var $that = $(this); 8312 setTimeout(function () { 8313 $that.find('.nectar_hotspot').addClass('pulse'); 8314 }, i * 300); 8315 }); 8316 }); 8317 8318 8319 var hotSpotHoverTimeout = []; 8320 8321 $('.nectar_image_with_hotspots:not([data-tooltip-func="click"]) .nectar_hotspot').each(function (i) { 8322 8323 hotSpotHoverTimeout[i] = ''; 8324 8325 $(this).on('mouseover', function () { 8326 clearTimeout(hotSpotHoverTimeout[i]); 8327 $(this).parent().css({ 8328 'z-index': '400', 8329 'height': 'auto', 8330 'width': 'auto' 8331 }); 8332 }); 8333 8334 $(this).on('mouseleave', function () { 8335 8336 var $that = $(this); 8337 $that.parent().css({ 8338 'z-index': 'auto' 8339 }); 8340 8341 hotSpotHoverTimeout[i] = setTimeout(function () { 8342 $that.parent().css({ 8343 'height': '30px', 8344 'width': '30px' 8345 });
8346 }, 300); 8347 8348 }); 8349 8350 }); 8351 8352 } 8353 8354 8355 8356 /** 8357 * Image with hotspots element responsive behavior. 8358 * 8359 * @since 7.0 8360 */ 8361 function responsiveTooltips() { 8362 8363 $('.nectar_image_with_hotspots').each(function () { 8364 8365 $(this).find('.nectar_hotspot_wrap').each(function () { 8366 8367 if (nectarDOMInfo.winW > 690) { 8368 8369 // Remove click if applicable 8370 if ($(this).parents('.nectar_image_with_hotspots[data-tooltip-func="hover"]').length > 0) { 8371 $(this).find('.nectar_hotspot').removeClass('click'); 8372 $(this).find('.nttip').removeClass('open'); 8373 } 8374 8375 $(this).find('.nttip .inner a.tipclose').remove(); 8376 $('.nttip').css('height', 'auto'); 8377 8378 // Reset for positioning 8379 $(this).css({ 8380 'width': 'auto', 8381 'height': 'auto' 8382 }); 8383 8384 $(this).find('.nttip') 8385 .removeClass('force-right') 8386 .removeClass('force-left') 8387 .removeClass('force-top') 8388 .css('width', 'auto'); 8389 8390 var $tipOffset = $(this).find('.nttip').offset(); 8391 8392 // Against right side 8393 if ($tipOffset.left > $(this).parents('.nectar_image_with_hotspots').width() - 200) { 8394 $(this).find('.nttip').css('width', '250px'); 8395 } 8396 else { 8397 $(this).find('.nttip').css('width', 'auto'); 8398 } 8399 8400 // Responsive 8401 if ($tipOffset.left < 0) { 8402 $(this).find('.nttip').addClass('force-right'); 8403 } 8404 else if ($tipOffset.left + $(this).find('.nttip').outerWidth(true) > nectarDOMInfo.winW) { 8405 $(this).find('.nttip').addClass('force-left').css('width', '250px'); 8406 } 8407 else if ($tipOffset.top + $(this).find('.nttip').height() + 35 > $window.height() && $('#nectar_fullscreen_rows').length > 0) { 8408 $(this).find('.nttip').addClass('force-top'); 8409 } 8410 8411 if ($(this).find('> .open').length == 0) { 8412 8413 $(this).css({ 8414 'width': '30px', 8415 'height': '30px' 8416 }); 8417 } 8418 8419 } else { 8420 8421 //fixed position 8422 $(this).find('.nttip') 8423 .removeClass('force-left') 8424 .removeClass('force-right') 8425 .removeClass('force-top'); 8426 8427 $(this).find('.nectar_hotspot').addClass('click'); 8428 8429 if ($(this).find('.nttip a.tipclose').length == 0) { 8430 $(this).find('.nttip .inner').append('<a href="#" class="tipclose"><span></span></a>'); 8431 } 8432 8433 // Change height of fixed 8434 $('.nttip').css('height', $window.height()); 8435 } 8436 }); 8437 }); 8438 8439 } 8440 8441 8442 /** 8443 * Image with hotspots events 8444 * 8445 * @since 10.5 8446 */ 8447 function imageWithHotspotEvents() { 8448 8449 if( $('.nectar_image_with_hotspots').length == 0 ) { 8450 return; 8451 } 8452 8453 // Hover 8454 hotSpotHoverBind(); 8455 8456 // Click 8457 $body.on('click', '.nectar_hotspot.click', function () { 8458 $(this).parents('.nectar_image_with_hotspots').find('.nttip').removeClass('open'); 8459 $(this).parent().find('.nttip').addClass('open'); 8460 8461 $(this).parents('.nectar_image_with_hotspots').find('.nectar_hotspot').removeClass('open'); 8462 $(this).parent().find('.nectar_hotspot').addClass('open'); 8463 8464 if (nectarDOMInfo.winW > 690) { 8465 $(this).parent().css({ 8466 'z-index': '120', 8467 'height': 'auto', 8468 'width': 'auto' 8469 }); 8470 8471 var $that = $(this); 8472 8473 setTimeout(function () { 8474 $that.parents('.nectar_image_with_hotspots').find('.nectar_hotspot_wrap').each(function () { 8475 8476 if ($(this).find('> .open').length == 0) { 8477 $(this).css({ 8478 'height': '30px', 8479 'width': '30px', 8480 'z-index': 'auto' 8481 }); 8482 } 8483 });
8484 }, 300); 8485 } 8486 8487 if (nectarDOMInfo.winW <= 690) { 8488 $(this).parents('.wpb_row, [class*="vc_col-"]').css('z-index', '200'); 8489 } 8490 8491 return false; 8492 }); 8493 8494 $body.on('click', '.nectar_hotspot.open', function () { 8495 $(this).parent().find('.nttip').removeClass('open'); 8496 $(this).parent().find('.nectar_hotspot').removeClass('open'); 8497 8498 $(this).parents('.wpb_row').css('z-index', 'auto'); 8499 8500 return false; 8501 }); 8502 8503 $body.on('click', '.nttip.open', function (e) { 8504 if (nectarDOMInfo.winW < 690) { 8505 8506 if( e.target && $(e.target).is('a') ) { 8507 return; 8508 } 8509 8510 $(this).parents('.nectar_image_with_hotspots').find('.nttip').removeClass('open'); 8511 $(this).parents('.nectar_image_with_hotspots').find('.nectar_hotspot').removeClass('open'); 8512 $(this).parents('.wpb_row').css('z-index', 'auto'); 8513 return false; 8514 } 8515 }); 8516 8517 8518 // Calculate on init. 8519 responsiveTooltips(); 8520 8521 // Resize event. 8522 $window.on('resize',responsiveTooltips); 8523 8524 } 8525 8526 8527 8528 /** 8529 * Image with hotspots initialization. 8530 * 8531 * @since 7.0 8532 * @see waypoints 8533 */ 8534 function imageWithHotspots() { 8535 8536 var $imageWithHotspotsOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : '50%'; 8537 8538 $($fullscreenSelector + '.nectar_image_with_hotspots[data-animation="true"]').each(function () { 8539 8540 var $that = $(this); 8541 var waypoint = new Waypoint({ 8542 element: $that, 8543 handler: function () { 8544 8545 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 8546 waypoint.destroy(); 8547 return; 8548 } 8549 8550 $that.addClass('completed'); 8551 $that.find('.nectar_hotspot_wrap').each(function (i) { 8552 var $that2 = $(this); 8553 var $extrai = ($that2.parents('.col.has-animation').length > 0) ? 1 : 0; 8554 setTimeout(function () { 8555 $that2.addClass('animated-in'); 8556 }, 175 * (i + $extrai)); 8557 });
8558 8559 waypoint.destroy(); 8560 8561 }, 8562 offset: $imageWithHotspotsOffsetPos 8563 }); 8564 8565 }); 8566 8567 8568 } 8569 8570 8571 /** 8572 * Nectar Lazy Loading 8573 * 8574 * @since 11.0 8575 */ 8576 function nectarLazyImageLoading() { 8577 8578 var lazyItems = [].slice.call(document.querySelectorAll('[data-nectar-img-src]')); 8579 8580 if ('IntersectionObserver' in window) { 8581 8582 var options = { 8583 rootMargin: '300px', 8584 } 8585 8586 nectarLazyImageSizing(); 8587 $window.off('resize.nectarLazySizing', nectarLazyImageSizing); 8588 $window.on('resize.nectarLazySizing', nectarLazyImageSizing); 8589 8590 var lazyItemObserver = new IntersectionObserver(function(entries) { 8591 8592 entries.forEach(function(entry) { 8593 if (entry.isIntersecting) { 8594 var lazyItem = entry.target; 8595 8596 var imgSrc = lazyItem.getAttribute('data-nectar-img-src'); 8597 8598 if( imgSrc ) { 8599 8600 // img tags. 8601 if( lazyItem.classList.contains('nectar-lazy') ) { 8602 lazyItem.addEventListener( 'load', function() { 8603 lazyItem.style.height = ""; 8604 lazyItem.style.width = ""; 8605 lazyItem.classList.add('loaded'); 8606 lazyItem.removeAttribute('data-nectar-img-src'); 8607 lazyItemObserver.unobserve(lazyItem); 8608 }); 8609 lazyItem.src = imgSrc; 8610 var srcset = lazyItem.getAttribute('data-nectar-img-srcset'); 8611 if( srcset ) { 8612 lazyItem.setAttribute( 'srcset', srcset ); 8613 lazyItem.removeAttribute('data-nectar-img-srcset'); 8614 } 8615 8616 lazyItem.parentNode.classList.add('img-loaded'); 8617 8618 } 8619 // BGs. 8620 else { 8621 lazyItem.style.backgroundImage = "url('" + imgSrc + "')"; 8622 lazyItem.classList.add('loaded'); 8623 lazyItem.removeAttribute('data-nectar-img-src'); 8624 lazyItemObserver.unobserve(lazyItem); 8625 } 8626 8627 } 8628 8629 } 8630 8631 }); 8632 8633 }, options); 8634 8635 lazyItems.forEach(function(lazyItem) { 8636 lazyItemObserver.observe(lazyItem); 8637 }); 8638 8639 } 8640 else { 8641 // load all the images when intersection observer is not supported. 8642 lazyItems.forEach(function(lazyItem) { 8643 8644 // img tags. 8645 if( lazyItem.classList.contains('nectar-lazy') ) { 8646 lazyItem.style.height = ""; 8647 lazyItem.style.width = ""; 8648 lazyItem.src = lazyItem.getAttribute('data-nectar-img-src'); 8649 var srcset = lazyItem.getAttribute('data-nectar-img-srcset'); 8650 if( srcset ) { 8651 lazyItem.setAttribute( 'srcset', srcset ); 8652 lazyItem.removeAttribute('data-nectar-img-srcset'); 8653 } 8654 8655 lazyItem.parentNode.classList.add('img-loaded'); 8656 lazyItem.classList.add('loaded'); 8657 lazyItem.removeAttribute('data-nectar-img-src'); 8658 } 8659 // BGs. 8660 else { 8661 lazyItem.style.backgroundImage = "url('" + lazyItem.getAttribute('data-nectar-img-src') + "')"; 8662 lazyItem.classList.add('loaded'); 8663 lazyItem.removeAttribute('data-nectar-img-src'); 8664 } 8665 8666 }); 8667 } 8668 8669 8670 } 8671 8672 8673 /** 8674 * Nectar lazy img size helper. 8675 * 8676 * @since 11.0 8677 */ 8678 8679 function nectarLazyImageSizing() { 8680 8681 $('img.nectar-lazy:not(.loaded)').each(function() { 8682 8683 // items to skip. 8684 if( $(this).hasClass('attachment-shop_thumbnail') || $(this).hasClass('attachment-woocommerce_thumbnail') ) { 8685 return true; 8686 } 8687 8688 $(this).css({ 8689 'height': '', 8690 'width' : '' 8691 }); 8692 8693 8694 var heightAttr = parseInt($(this).attr('height')); 8695 var widthAttr = parseInt($(this).attr('width')); 8696 8697 var width = ($(this).parents('.nectar_cascading_images').length > 0) ? $(this).parents('.bg-layer').width() : $(this).width(); 8698 8699 // Shadow img. 8700 if( $(this).parents('.img-with-aniamtion-wrap[data-shadow*="depth"]').length > 0 ) { 8701 width = $(this).parents('.img-with-aniamtion-wrap').width(); 8702 } 8703 8704 // Post grid.
8705 if( $(this).parents('.nectar-post-grid-item-bg-wrap-inner').length > 0 ) { 8706 width = $(this).parents('.nectar-post-grid-item-bg-wrap-inner').width(); 8707 } 8708 8709 var dimensions = calculateAspectRatio( widthAttr, heightAttr, width, 2000 ); 8710 8711 $(this).css({ 8712 'height': dimensions.height + 'px', 8713 'width' : dimensions.width + 'px' 8714 }); 8715 8716 }); 8717 8718 } 8719 8720 8721 /** 8722 * Nectar Post Grid Mouse Follow Init 8723 * 8724 * @since 11.0 8725 */ 8726 function nectarPostGridMouse() { 8727 8728 viewIndicatorArr = []; 8729 postGridImgMouseFollowArr = []; 8730 8731 if( !nectarDOMInfo.usingMobileBrowser ) { 8732 8733 $('.nectar-post-grid[data-indicator="yes"]').each(function(i) { 8734 viewIndicatorArr[i] = new NectarIconMouseFollow($(this),'view-indicator'); 8735 }); 8736 8737 $('.nectar-post-grid-wrap[data-style="mouse_follow_image"] .nectar-post-grid').each(function(i) { 8738 postGridImgMouseFollowArr[i] = new NectarIconMouseFollow($(this), 'post-grid-images'); 8739 }); 8740 8741 $('.nectar-category-grid[data-style="mouse_follow_image"]').each(function(i) { 8742 postGridImgMouseFollowArr[i] = new NectarIconMouseFollow($(this), 'post-grid-images'); 8743 }); 8744 8745 } 8746 8747 } 8748 8749 8750 8751 8752 8753 /** 8754 * Nectar Post Grid 8755 * 8756 * @since 11.0 8757 */ 8758 function nectarPostGridInit() { 8759 8760 $nectarPostGridArr = []; 8761 8762 // Mouse follow. 8763 nectarPostGridMouse(); 8764 8765 // Create grid instances. 8766 $('.nectar-post-grid-wrap').each(function(i) { 8767 $nectarPostGridArr[i] = new NectarPostGrid($(this)); 8768 }); 8769 8770 8771 } 8772 8773 8774 8775 function NectarPostGrid(el) { 8776 8777 this.el = el; 8778 this.currentPage = 0; 8779 this.activeFilter = 1; 8780 this.activeCatTotal = 0; 8781 this.settingsData = JSON.parse(this.el.attr('data-el-settings')); 8782 this.queryData = JSON.parse(this.el.attr('data-query')); 8783 this.sortable = this.el.find('.nectar-post-grid-filters').attr('data-sortable'); 8784 8785 this.initialMarkup(); 8786 this.clickEvents(); 8787 this.deepLinking(); 8788 this.lightboxGroups(); 8789 this.externalProjectLinks(); 8790 } 8791 8792 NectarPostGrid.prototype.initialMarkup = function() { 8793 8794 // Start Filter Active. 8795 if( this.el.find('.nectar-post-grid-filters a.active').length == 0 ) { 8796 this.el.find('.nectar-post-grid-filters a:first-child').addClass('active'); 8797 } 8798 8799 // Load More Markup. 8800 if( this.settingsData.pagination === 'load-more' && this.el.find('.load-more-wrap').length == 0 ) { 8801 8802 if( this.el.find('.active.all-filter').length > 0 ) { 8803 this.activeFilter = this.el.find('.active.all-filter').index() + 1; 8804 } 8805 8806 this.activeCatTotal = parseInt(this.el.find('.nectar-post-grid-filters a:nth-child(' + this.activeFilter + ')').attr('data-total-count')); 8807 8808 // Start hidden? 8809 if( this.el.find('.nectar-post-grid-item').length >= this.activeCatTotal ) { 8810 this.el.append('<div class="load-more-wrap inactive"><a href="#" class="load-more">'+ this.el.attr('data-load-more-text') + '</a></div>'); 8811 } else { 8812 this.el.append('<div class="load-more-wrap"><a href="#" class="load-more">'+ this.el.attr('data-load-more-text') + '</a></div>'); 8813 } 8814 8815 } 8816 8817 }; 8818 8819 NectarPostGrid.prototype.lightboxGroups = function() { 8820 8821 var unique_id = uniqueIdGenerate(); 8822 var usingLightbox = (this.el.find('.nectar-post-grid-link.pretty_photo').length > 0) ? true : false; 8823 8824 if ($('body[data-ls="magnific"]').length > 0) { 8825 this.el.find('.nectar-post-grid-link.pretty_photo') 8826 .addClass('magnific') 8827 .addClass('gallery') 8828 .removeClass('pretty_photo'); 8829 } 8830 else if ($('body[data-ls="fancybox"]').length > 0) { 8831 // New. 8832 this.el.find('.nectar-post-grid-link.pretty_photo') 8833 .attr('data-fancybox', 'group_' + unique_id) 8834 .removeClass('pretty_photo'); 8835 // Existing. 8836 this.el.find('.nectar-post-grid-link[data-fancybox]') 8837 .attr('data-fancybox','group_' + unique_id); 8838 } 8839 8840 if(usingLightbox) { 8841 lightBoxInit(); 8842 } 8843 8844 } 8845 8846 NectarPostGrid.prototype.externalProjectLinks = function() { 8847 if( this.el.hasClass('target-blank-external-urls') ) { 8848 this.el.find(".nectar-post-grid-item a[href*='http://']:not([href*='" + window.location.hostname + "'])").attr("target", "_blank"); 8849 this.el.find(".nectar-post-grid-item a[href*='https://']:not([href*='" + window.location.hostname + "'])").attr("target", "_blank"); 8850 } 8851 } 8852 8853 NectarPostGrid.prototype.clickEvents = function() { 8854 8855 // Sortable Mobile Toggle. 8856 this.el.find('.nectar-post-grid-filters h4').on('click', function(){ 8857 $(this).parent().find('div').toggleClass('visible'); 8858 $(this).toggleClass('visible'); 8859 });
8860 8861 // Sortable/Pagination. 8862 var settingsData = this.settingsData; 8863 var queryData = this.queryData; 8864 var instance = this; 8865 8866 this.el.find('.nectar-post-grid-filters a, .load-more-wrap .load-more').on('click', function() { 8867 8868 var $that = $(this); 8869 8870 // Filter active. 8871 if($that.parents('.nectar-post-grid-wrap.loading').length > 0 || $(this).hasClass('active') || $(this).hasClass('inactive') ) { 8872 return false; 8873 } 8874 8875 8876 if( $(this).parents('.nectar-post-grid-filters').length > 0 ) { 8877 // Filter specific. 8878 $that.parent().find('a').removeClass('active'); 8879 $that.addClass('active'); 8880 instance.currentPage = 0; 8881 instance.activeFilter = $that.index() + 1; 8882 } else { 8883 // Load More specific. 8884 instance.currentPage++; 8885 } 8886 8887 var $gridEl = $that.parents('.nectar-post-grid-wrap').find('.nectar-post-grid') 8888 var $pagination = settingsData.pagination; 8889 var $action = ($that.hasClass('load-more') && $pagination === 'load-more') ? 'load-more' : 'filter'; 8890 var $category = ''; 8891 var $custom_query = ''; 8892 8893 // Determine what category to load from. 8894 if( instance.sortable === 'yes' ) { 8895 $category = $that.parents('.nectar-post-grid-wrap').find('.nectar-post-grid-filters a.active').attr('data-filter'); 8896 $custom_query = $that.parents('.nectar-post-grid-wrap').find('.nectar-post-grid-filters a.active').attr('data-filter'); 8897 } else { 8898 8899 var skipAll = ( $that.parents('.nectar-post-grid-wrap').find('.nectar-post-grid-filters a').length > 1 ) ? ':not(.all-filter)' : ''; 8900 8901 $that.parents('.nectar-post-grid-wrap').find('.nectar-post-grid-filters a' + skipAll).each(function(){ 8902 $category += $(this).attr('data-filter') + ', '; 8903 $custom_query += $(this).attr('data-filter') + ', '; 8904 }); 8905 8906 $category = $category.substring(0, $category.length - 2); 8907 $custom_query = $custom_query.substring(0, $custom_query.length - 2); 8908 8909 } 8910 8911 8912 var $dataToPass = { 8913 action: 'nectar_get_post_grid_segment', 8914 post_type: queryData.post_type, 8915 cpt_name: queryData.cpt_name, 8916 custom_query_tax: $custom_query, 8917 category: $category, 8918 posts_per_page: queryData.posts_per_page, 8919 current_page: instance.currentPage, 8920 offset: queryData.offset, 8921 order: queryData.order, 8922 orderby: queryData.orderby, 8923 load_action: $action, 8924 settings: { 8925 pagination: $pagination, 8926 post_type: settingsData.post_type, 8927 image_size: settingsData.image_size, 8928 aspect_ratio_image_size: settingsData.aspect_ratio_image_size, 8929 card_bg_color: settingsData.card_bg_color, 8930 display_categories: settingsData.display_categories, 8931 display_excerpt: settingsData.display_excerpt, 8932 display_date: settingsData.display_date, 8933 color_overlay: settingsData.color_overlay, 8934 color_overlay_opacity: settingsData.color_overlay_opacity, 8935 color_overlay_hover_opacity: settingsData.color_overlay_hover_opacity, 8936 grid_style: settingsData.grid_style, 8937 heading_tag: settingsData.heading_tag, 8938 post_title_overlay: settingsData.post_title_overlay, 8939 enable_gallery_lightbox: settingsData.enable_gallery_lightbox 8940 } 8941 }; 8942 8943 $that.parents('.nectar-post-grid-wrap').addClass('loading'); 8944 8945 $.post(window.nectarLove.ajaxurl, $dataToPass, function (data) { 8946 8947 // Update markup. 8948 if( $action === 'load-more' ) { 8949 $gridEl.append(data); 8950 } else { 8951 $gridEl.html(data); 8952 } 8953 8954 // Load in animation. 8955 if( $gridEl.is('[data-animation="fade-in-from-bottom"]') ) { 8956 8957 $that.parents('.nectar-post-grid-wrap').removeClass('finished-animating'); 8958 8959 $gridEl.find('.nectar-post-grid-item:not(.animated-in)').each(function(i) { 8960 var $storedEl = $(this); 8961 setTimeout(function() { 8962 $storedEl.addClass('animated-in'); 8963 }, i * 90); 8964 8965 });
8966 8967 setTimeout(function(){ 8968 $that.parents('.nectar-post-grid-wrap').addClass('finished-animating'); 8969 }, 950); 8970 } 8971 8972 if( $pagination === 'load-more' ) { 8973 8974 instance.activeCatTotal = parseInt(instance.el.find('.nectar-post-grid-filters a:nth-child(' + instance.activeFilter + ')').attr('data-total-count')); 8975 8976 if( $gridEl.find('.nectar-post-grid-item').length >= instance.activeCatTotal ) { 8977 instance.el.find('.load-more-wrap').addClass('inactive'); 8978 } else { 8979 instance.el.find('.load-more-wrap').removeClass('inactive'); 8980 } 8981 8982 } 8983 8984 // Lightbox items. 8985 instance.lightboxGroups(); 8986 8987 // Ext. links. 8988 instance.externalProjectLinks(); 8989 8990 $that.parents('.nectar-post-grid-wrap').removeClass('loading'); 8991 8992 // Resize. 8993 $window.trigger('resize'); 8994 8995 // Mouse follow. 8996 nectarPostGridMouse(); 8997 8998 }); // end POST 8999 9000 return false; 9001 9002 }); 9003 9004 }; 9005 9006 NectarPostGrid.prototype.deepLinking = function() { 9007 9008 if (typeof nectarGetQueryParam['grid-filter'] != 'undefined') { 9009 9010 this.el.find('.nectar-post-grid-filters a').each(function () { 9011 9012 var $currentText = $(this).clone(), 9013 $getText = nectarGetQueryParam['grid-filter'], 9014 $that = $(this); 9015 9016 $currentText = $currentText.text(); 9017 $currentText = $currentText.replace(/\s+/g, '-').toLowerCase(); 9018 9019 if( $currentText.length > 0 && $currentText.substring(0,1) === '-' ) { 9020 $currentText = $currentText.substring(1); 9021 } 9022 9023 $getText = $getText.replace(/\s+/g, '-').replace(/</g, '<').replace(/"/g, '"').toLowerCase(); 9024 9025 // Switch to filter 9026 if ($currentText == $getText) { 9027 $(this).trigger('click'); 9028 } 9029 9030 }); 9031 9032 } 9033 9034 }; 9035 9036 9037 function NectarPostGridWaypoint() { 9038 9039 var postGridOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : '75%'; 9040 9041 $($fullscreenSelector + '.nectar-post-grid-wrap').each(function () { 9042 9043 var $that = $(this), 9044 waypoint = new Waypoint({ 9045 element: $that, 9046 handler: function () { 9047 9048 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 9049 waypoint.destroy(); 9050 return; 9051 } 9052 9053 $that.find('.nectar-post-grid-filters').addClass('animated-in'); 9054 $that.find('.nectar-post-grid-item').each(function(i) { 9055 9056 var $item = $(this); 9057 9058 setTimeout(function() { 9059 9060 $item.addClass('animated-in'); 9061 9062 }, i * 90); 9063 9064 });
9065 9066 setTimeout(function(){ 9067 $that.addClass('finished-animating'); 9068 }, 950); 9069 9070 9071 waypoint.destroy(); 9072 9073 }, 9074 offset: postGridOffsetPos 9075 }); 9076 9077 }); 9078 9079 } 9080 9081 9082 9083 /** 9084 * Animated title element initialization. 9085 * 9086 * @since 7.0 9087 * @see waypoints 9088 */ 9089 function animatedTitles() { 9090 9091 var $animatedTitlesOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : 'bottom-in-view'; 9092 9093 $($fullscreenSelector + '.nectar-animated-title').each(function () { 9094 9095 var $that = $(this), 9096 waypoint = new Waypoint({ 9097 element: $that, 9098 handler: function () { 9099 9100 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 9101 waypoint.destroy(); 9102 return; 9103 } 9104 9105 $that.addClass('completed'); 9106 9107 waypoint.destroy(); 9108 9109 }, 9110 offset: $animatedTitlesOffsetPos 9111 }); 9112 9113 }); 9114 } 9115 9116 9117 9118 9119 /** 9120 * Highlighted Text element initialization. 9121 * 9122 * @since 9.0 9123 * @see waypoints 9124 */ 9125 function highlightedText() { 9126 9127 var $highlightedTextOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : 'bottom-in-view'; 9128 9129 if( nectarDOMInfo.usingMobileBrowser && $highlightedTextOffsetPos == 'bottom-in-view' ) { 9130 $highlightedTextOffsetPos = '85%'; 9131 } 9132 9133 $($fullscreenSelector + '.nectar-highlighted-text').each(function (i) { 9134 9135 var $animationDelay = 0; 9136 9137 // convert italics to em. 9138 $(this).find('i').each(function(){ 9139 $(this).replaceWith(function(){ 9140 return $('<em />').append($(this).html()); 9141 }); 9142 }); 9143 9144 if($(this).is('[data-animation-delay]') && 9145 $(this).attr('data-animation-delay').length > 0 && 9146 $(this).attr('data-animation') != 'false') { 9147 $animationDelay = $(this).attr('data-animation-delay'); 9148 } 9149 9150 $(this).find('em:has(a)').addClass('has-link'); 9151 9152 if (bypassAnimations) { 9153 $(this).find('em').addClass('animated'); 9154 } 9155 9156 // Waypoint 9157 var $that = $(this); 9158 var waypoint = new Waypoint({ 9159 element: $that, 9160 handler: function () { 9161 9162 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated')) { 9163 waypoint.destroy(); 9164 return; 9165 } 9166 9167 setTimeout(function() { 9168 9169 $that.find('em').each(function (i) { 9170 var $highlighted_em = $(this); 9171 setTimeout(function () { 9172 $highlighted_em.addClass('animated'); 9173 }, i * 300); 9174 9175 }); 9176 9177 }, $animationDelay); 9178 9179 waypoint.destroy(); 9180 9181 }, 9182 offset: $highlightedTextOffsetPos 9183 }); 9184 9185 }); 9186 9187 } 9188 9189 9190 9191 /** 9192 * WooCommerce product carousel. 9193 * 9194 * @since 13.0 9195 * @see waypoints 9196 */ 9197 function wooProductCarouselAnimations() { 9198 9199 var $wooProductOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : '75%'; 9200 9201 $($fullscreenSelector + '.nectar-woo-flickity[data-animation*="fade-in"]').each(function () { 9202 9203 var $that = $(this), 9204 waypoint = new Waypoint({ 9205 element: $that, 9206 handler: function () { 9207 9208 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 9209 waypoint.destroy(); 9210 return; 9211 } 9212 9213 $that.addClass('animated-in'); 9214 9215 $that.find('.flickity-cell').each(function (i) { 9216 var $el = $(this); 9217 9218 setTimeout(function(){ 9219 $el.css({ 9220 'transform': 'translate3d(0,0,0)', 9221 'opacity': '1' 9222 }); 9223 }, i * 100); 9224 });
9225 9226 waypoint.destroy(); 9227 9228 }, 9229 offset: $wooProductOffsetPos 9230 }); 9231 9232 }); 9233 } 9234 9235 9236 /** 9237 * Pricing table element height calculations. 9238 * 9239 * @since 2.0 9240 */ 9241 function pricingTableHeight() { 9242 9243 var $tallestCol; 9244 9245 $('.pricing-table[data-style="default"]').each(function () { 9246 $tallestCol = 0; 9247 9248 $(this).find('> div ul').each(function () { 9249 9250 if( $(this).height() > $tallestCol ) { 9251 $tallestCol = $(this).height(); 9252 } 9253 9254 }); 9255 9256 //safety net incase pricing tables height couldn't be determined 9257 if ($tallestCol == 0) { 9258 $tallestCol = 'auto'; 9259 } 9260 9261 //set even height 9262 $(this).find('> div ul').css('height', $tallestCol); 9263 9264 }); 9265 } 9266 9267 9268 9269 9270 /** 9271 * Testimonial slider element initialization. 9272 * 9273 * @since 10.5 9274 */ 9275 function nectarTestimonialSliders() { 9276 9277 $testimonialSliders = []; 9278 9279 if (typeof NectarTestimonialSlider == 'undefined') { 9280 return; 9281 } 9282 9283 $('.testimonial_slider').each(function (i) { 9284 9285 var $that_el = $(this), 9286 $type = ($(this).is('[data-style]')) ? $(this).attr('data-style') : 'none'; 9287 9288 $testimonialSliders[i] = new NectarTestimonialSlider($that_el, $type, resizeVideoToCover, fullWidthContentColumns); 9289 9290 9291 if ($(this).is('.disable-height-animation:not([data-style*="multiple_visible"])')) { 9292 $testimonialSliders[i].testimonialSliderHeight(); 9293 setTimeout($testimonialSliders[i].testimonialSliderHeight.bind($testimonialSliders[i]), 500); 9294 } 9295 9296 if ($(this).is('.testimonial_slider[data-style="multiple_visible_minimal"]')) { 9297 $testimonialSliders[i].testimonialSliderHeightMinimalMult(); 9298 setTimeout($testimonialSliders[i].testimonialSliderHeightMinimalMult.bind($testimonialSliders[i]), 500); 9299 } 9300 9301 }); 9302 9303 9304 } 9305 9306 9307 /** 9308 * Testimonial slider element resize binding. 9309 * 9310 * @since 10.5 9311 */ 9312 function nectarTestimonialSlidersEvents() { 9313 9314 $window.off('smartresize.nectarTestimonials'); 9315 $window.off('resize.nectarTestimonialsMin'); 9316 9317 if($testimonialSliders.length > 0) { 9318 $window.on('smartresize.nectarTestimonials',nectarTestimonialMainResize); 9319 } 9320 9321 if( $('.testimonial_slider[data-style="multiple_visible_minimal"]').length > 0 ) { 9322 $window.on('resize.nectarTestimonialsMin',nectarTestimonialMiniamlResize); 9323 } 9324 9325 } 9326 9327 function nectarTestimonialMainResize() { 9328 for (var i = 0; i < $testimonialSliders.length; i++) { 9329 $testimonialSliders[i].testimonialSliderHeight(); 9330 $testimonialSliders[i].testimonialHeightResize(); 9331 } 9332 } 9333 function nectarTestimonialMiniamlResize() { 9334 for (var i = 0; i < $testimonialSliders.length; i++) { 9335 $testimonialSliders[i].testimonialSliderHeightMinimalMult(); 9336 } 9337 } 9338 9339 9340 9341 /** 9342 * Icon list element initialization. 9343 * 9344 * @since 6.0 9345 * @see waypoints 9346 */ 9347 function iconList() { 9348 9349 var $iconListOffsetPos = ($fullscreenMarkupBool == true) ? '250%' : '75%'; 9350 9351 $($fullscreenSelector + '.nectar-icon-list[data-animate="true"]').each(function () { 9352 9353 var $that = $(this), 9354 waypoint = new Waypoint({ 9355 element: $that, 9356 handler: function () { 9357 9358 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 9359 waypoint.destroy(); 9360 return; 9361 } 9362 9363 $that.each(function () { 9364 9365 var $listItemAnimationDelay = ($that.is('[data-direction="horizontal"]')) ? 100 : 300; 9366 9367 $(this).find('.nectar-icon-list-item').each(function (i) { 9368 var $thatt = $(this); 9369 setTimeout(function () { 9370 $thatt.addClass('animated'); 9371 }, i * $listItemAnimationDelay); 9372 }); 9373 9374 });
9375 9376 $that.addClass('completed'); 9377 9378 waypoint.destroy(); 9379 9380 }, 9381 offset: $iconListOffsetPos 9382 }); 9383 9384 }); 9385 } 9386 9387 9388 9389 /** 9390 * Get the BG color of parent column/row. 9391 * 9392 * @since 6.0 9393 */ 9394 function narrowParentBGC(element) { 9395 9396 var narrowedBGC; 9397 9398 if (element.parents('.wpb_column[data-bg-color*="#"]').length > 0 && element.parents('.wpb_column[data-bg-opacity="1"]').length > 0) { 9399 narrowedBGC = element.parents('.wpb_column').attr('data-bg-color'); 9400 } 9401 else if (element.parents('.wpb_row').length > 0 && element.parents('.wpb_row').find('.row-bg.using-bg-color').length > 0 || 9402 element.parents('.wpb_row').length > 0 && element.parents('.wpb_row').find('.row-bg.using-bg-color-excluded').length > 0) { 9403 narrowedBGC = element.parents('.wpb_row').find('.row-bg').css('background-color'); 9404 } 9405 else { 9406 if ($('#nectar_fullscreen_rows').length > 0) { 9407 narrowedBGC = $('#nectar_fullscreen_rows > .wpb_row .full-page-inner-wrap').css('background-color'); 9408 } 9409 else { 9410 narrowedBGC = $('.container-wrap').css('background-color'); 9411 } 9412 } 9413 9414 return narrowedBGC; 9415 9416 } 9417 9418 9419 /** 9420 * Icon BG matching row BG 9421 * 9422 * @since 6.0 9423 */ 9424 function nectarIconMatchColoring() { 9425 9426 var nectarMatchingBGCss = ''; 9427 9428 // Icon list 9429 $('.nectar-icon-list[data-icon-style="border"], .nectar_icon_wrap[data-style="border-animation"][data-color*="extra-color-gradient-"]').each(function (i) { 9430 9431 var $bgColorToSet = narrowParentBGC($(this)); 9432 9433 if( $(this).hasClass('nectar-icon-list') ) { 9434 $(this).find('.list-icon-holder').css('background-color', $bgColorToSet); 9435 } 9436 else { 9437 9438 $(this).removeClass(function (index, className) { 9439 return (className.match(/(^|\s)instance-\S+/g) || []).join(' '); 9440 }); 9441 9442 $(this).addClass('instance-' + i); 9443 nectarMatchingBGCss += '.nectar_icon_wrap.instance-' + i + ' .nectar_icon:before { background-color: ' + $bgColorToSet + '!important; }'; 9444 } 9445 9446 }); 9447 9448 // Material gradient btns 9449 $('body.material .nectar-button.see-through[class*="m-extra-color-gradient"]').each(function (i) { 9450 9451 var $bgColorToSet = narrowParentBGC($(this)); 9452 9453 $(this).removeClass(function (index, className) { 9454 return (className.match(/(^|\s)instance-\S+/g) || []).join(' '); 9455 }); 9456 9457 $(this).addClass('instance-' + i); 9458 nectarMatchingBGCss += '.nectar-button.see-through.instance-' + i + ':after { background-color: ' + $bgColorToSet + '!important; }'; 9459 9460 }); 9461 9462 // Style 9463 nectarCreateStyle(nectarMatchingBGCss, 'nectaricon-color-match'); 9464 9465 } 9466 9467 9468 9469 9470 9471 /** 9472 * One fourth column classes. 9473 * 9474 * @since 2.0 9475 */ 9476 function oneFourthClasses() { 9477 9478 $('.col.span_3, .vc_span3, .vc_col-sm-3').each(function () { 9479 if (!$(this).is('[data-t-w-inherits="small_desktop"]')) { 9480 9481 var $currentDiv = $(this); 9482 var $nextDiv = $(this).next('div'); 9483 9484 if ($nextDiv.hasClass('span_3') && !$currentDiv.hasClass('one-fourths') || 9485 $nextDiv.hasClass('vc_span3') && !$currentDiv.hasClass('one-fourths') || 9486 $nextDiv.hasClass('vc_col-sm-3') && !$currentDiv.hasClass('one-fourths')) { 9487 $currentDiv.addClass('one-fourths clear-both'); 9488 $nextDiv.addClass('one-fourths right-edge'); 9489 } 9490 } 9491 }); 9492 9493 // Make empty second 1/2 half columns display right on iPad 9494 $('.span_12 .col.span_6').each(function () { 9495 if ($(this).next('div').hasClass('span_6') && $.trim($(this).next('div').html()).length == 0) { 9496 $(this).addClass('empty-second'); 9497 } 9498 }); 9499 9500 } 9501 9502 9503 9504 9505 /** 9506 * Responsive video iframes initialization. 9507 * 9508 * @since 3.0 9509 */ 9510 function responsiveVideoIframesInit() { 9511 9512 $('iframe').each(function () { 9513 9514 // Make sure the iframe has a src 9515 if (typeof $(this).attr('src') != 'undefined' && 9516 !$(this).hasClass('skip-nectar-video-size') && 9517 !$(this).hasClass('iframe-embed') && 9518 $(this).parents('.ult_modal').length == 0 && 9519 $(this).parents('.ls-slide').length == 0 &&
9520 $(this).parents('.woo-variation-product-gallery').length == 0 && 9521 $(this).parents('.esg-entry-media').length == 0 && 9522 $(this).parents('.wpb_video_widget.wpb_content_element').length == 0) { 9523 9524 if( $(this).parents('.woocommerce-product-gallery').length > 0 ) { 9525 if( !$(this).is('[width="100%"]') || !$(this).is('[height="100%"]') ) { 9526 return true; 9527 } 9528 } 9529 9530 var embedSrcLower = $(this).attr('src').toLowerCase(); 9531 9532 if (embedSrcLower.indexOf("youtube") >= 0 || 9533 embedSrcLower.indexOf("vimeo") >= 0 || 9534 embedSrcLower.indexOf("twitch.tv") >= 0 || 9535 embedSrcLower.indexOf("kickstarter") >= 0 || 9536 embedSrcLower.indexOf("embed-ssl.ted") >= 0 || 9537 embedSrcLower.indexOf("dailymotion") >= 0) { 9538 9539 $(this).addClass('iframe-embed'); 9540 9541 if ($(this).width() < $(this).parent().width()) { 9542 $(this) 9543 .attr('data-aspectRatio', $(this).height() / $(this).width()) 9544 .removeAttr('height') 9545 .removeAttr('width'); 9546 } else { 9547 $(this) 9548 .attr('data-aspectRatio', '0.56') 9549 .removeAttr('height') 9550 .removeAttr('width'); 9551 } 9552 9553 if ($(this).parents('.post-area.masonry.classic').length > 0) { 9554 $(this) 9555 .attr('data-aspectRatio', '0.56') 9556 .removeAttr('height') 9557 .removeAttr('width'); 9558 } 9559 9560 } 9561 9562 } 9563 9564 }); 9565 9566 } 9567 9568 9569 /** 9570 * Responsive video iframes. 9571 * 9572 * @since 3.0 9573 */ 9574 function responsiveVideoIframes() { 9575 9576 $('iframe[data-aspectRatio]').each(function () { 9577 9578 var $el = $(this), 9579 newWidth = $el.parent().width(); 9580 9581 // In nectar slider 9582 if ($(this).parents('.swiper-slide').length > 0) { 9583 if ($(this).is(':visible')) { 9584 $el 9585 .width(newWidth) 9586 .height(newWidth * $el.attr('data-aspectRatio')); 9587 } 9588 } 9589 // All others 9590 else { 9591 $el 9592 .width(newWidth) 9593 .height(newWidth * $el.attr('data-aspectRatio')); 9594 } 9595 9596 }); 9597 9598 } 9599 9600 9601 /** 9602 * Reveal the audio/video elements after the size has been calculated. 9603 * 9604 * @since 10.5 9605 */ 9606 function audioVideoVis() { 9607 9608 //unwrap post and portfolio videos 9609 $('.video-wrap iframe').unwrap(); 9610 $('#sidebar iframe[src]').unwrap(); 9611 9612 $('audio') 9613 .attr('width', '100%') 9614 .attr('height', '100%') 9615 .css('visibility', 'visible'); 9616 9617 $('video').css('visibility', 'visible'); 9618 9619 $('.wp-video').each(function () { 9620 var video = $(this).find('video').get(0); 9621 video.addEventListener('loadeddata', function () { 9622 $window.trigger('resize'); 9623 }, false); 9624 }); 9625 9626 //webkit video back button fix 9627 $('.main-content iframe[src]').each(function () { 9628 $(this).css({ 9629 'opacity': '1', 9630 'visibility': 'visible' 9631 }); 9632 }); 9633 9634 } 9635 9636 9637 9638 9639 9640 /** 9641 * Nectar video background size calculations 9642 * 9643 * @since 5.0 9644 */ 9645 function resizeVideoToCover() { 9646 9647 var vid_w_orig = 1280, 9648 vid_h_orig = 720, 9649 min_w = 1200; 9650 9651 $('.nectar-video-wrap').each(function () { 9652 9653 var $containerHeight, $containerWidth; 9654 9655 if ($(this).find('video').length == 0) { 9656 return; 9657 } 9658 9659 if ($(this).parents('#page-header-bg').length > 0) { 9660 9661 if ($('.container-wrap.auto-height').length > 0) { 9662 return false; 9663 } 9664 9665 $containerHeight = $(this).parents('#page-header-bg').outerHeight(); 9666 $containerWidth = $(this).parents('#page-header-bg').outerWidth(); 9667 } else { 9668 9669 if ($(this).hasClass('column-video')) { 9670 if( $body.is('[data-flex-cols="true"]') ) { 9671 $containerHeight = $(this).parents('.vc_column-inner').outerHeight(); 9672 $containerWidth = $(this).parents('.vc_column-inner').outerWidth(); 9673 } else { 9674 $containerHeight = $(this).parents('.wpb_column').outerHeight(); 9675 $containerWidth = $(this).parents('.wpb_column').outerWidth(); 9676 } 9677 } else { 9678 $containerHeight = $(this).parents('.wpb_row').outerHeight(); 9679 $containerWidth = ($(this).parents('.full-width-section').length > 0) ? nectarDOMInfo.winW : $(this).parents('.wpb_row').outerWidth(); 9680 } 9681 } 9682 9683 // Set the video viewport to the window size 9684 $(this).width($containerWidth);
9685 if ($(this).parents('#page-header-bg').length > 0) { 9686 $(this).height($containerHeight); 9687 } 9688 9689 // Use largest scale factor of horizontal/vertical 9690 var scale_h = $containerWidth / vid_w_orig, 9691 scale_v = ($containerHeight - $containerHeight) / vid_h_orig, 9692 scale = scale_h > scale_v ? scale_h : scale_v; 9693 9694 // Update minium width to never allow excess space 9695 min_w = 1280 / 720 * ($containerHeight + 40); 9696 9697 // Don't allow scaled width < minimum video width 9698 if (scale * vid_w_orig < min_w) { 9699 scale = min_w / vid_w_orig; 9700 } 9701 9702 // Now scale the video 9703 $(this).find('video, .mejs-overlay, .mejs-poster').width(Math.ceil(scale * vid_w_orig + 0)); 9704 $(this).find('video, .mejs-overlay, .mejs-poster').height(Math.ceil(scale * vid_h_orig + 0)); 9705 9706 // And center it by scrolling the video viewport 9707 $(this).scrollLeft(($(this).find('video').width() - $containerWidth) / 2); 9708 $(this).scrollTop(($(this).find('video').height() - ($containerHeight)) / 2); 9709 $(this).find('.mejs-overlay, .mejs-poster').scrollTop(($(this).find('video').height() - ($containerHeight)) / 2); 9710 9711 9712 // Align bottom 9713 if ($(this).attr('data-bg-alignment') == 'center bottom' || $(this).attr('data-bg-alignment') == 'bottom') { 9714 $(this).scrollTop(($(this).find('video').height() - ($containerHeight + 6))); 9715 } 9716 // Align top 9717 else if ($(this).attr('data-bg-alignment') == 'center top' || $(this).attr('data-bg-alignment') == 'top') { 9718 $(this).scrollTop(0); 9719 } 9720 9721 // Add loaded class 9722 $(this).addClass('position-loaded'); 9723 }); 9724 9725 } 9726 9727 9728 9729 /** 9730 * Nectar video background initialization. 9731 * 9732 * @since 5.0 9733 */ 9734 function videoBGInit() { 9735 9736 if ($('.nectar-video-wrap').length == 0 && $('.nectar-youtube-bg').length == 0) { 9737 return; 9738 } 9739 9740 setTimeout(function () { 9741 9742 resizeVideoToCover(); 9743 9744 // Resize 9745 $window.on('resize',resizeVideoToCover); 9746 9747 $('.video-color-overlay').each(function () { 9748 $(this).css('background-color', $(this).attr('data-color')); 9749 }); 9750 9751 $('.nectar-video-wrap').each(function () { 9752 9753 if ($(this).find('video').length == 0) { 9754 return; 9755 } 9756 9757 var $headerVideo = ($(this).parents('#page-header-bg').length > 0) ? true : false; 9758 var $that = $(this); 9759 var videoReady = setInterval(function () { 9760 9761 if ($that.find('video').get(0).readyState > 3) { 9762 9763 if (!nectarDOMInfo.usingMobileBrowser) { 9764 $that.transition({ 9765 'opacity': '1' 9766 }, 400); 9767 $that.find('video').transition({ 9768 'opacity': '1' 9769 }, 400); 9770 $that.parent().find('.video-color-overlay').transition({ 9771 'opacity': '0.7' 9772 }, 400); 9773 if ($headerVideo == true) { 9774 pageHeaderTextEffect(); 9775 } 9776 } 9777 9778 // Remove page loading screen 9779 $loadingScreenEl.addClass('loaded'); 9780 setTimeout(function () { 9781 $loadingScreenEl.addClass('hidden'); 9782 }, 1000); 9783 9784 9785 clearInterval(videoReady); 9786 } 9787 9788 }, 60); 9789 9790 if (nectarDOMInfo.usingMobileBrowser) { 9791 9792 if ($that.parents('.full-width-section').length > 0 && 9793 $that.parents('#nectar_fullscreen_rows').length == 0 && 9794 !$that.hasClass('column-video') ) { 9795 9796 $that.css('left', '50%'); 9797 } else { 9798 $that.css('left', '0px'); 9799 } 9800 9801 if ($headerVideo == true) { 9802 pageHeaderTextEffect(); 9803 } 9804 9805 $that.find('video')[0].onplay = function () { 9806 $that.transition({ 9807 'opacity': '1' 9808 }, 400); 9809 $that.find('video').transition({ 9810 'opacity': '1' 9811 }, 400); 9812 $that.parent().find('.video-color-overlay').transition({ 9813 'opacity': '0.7' 9814 }, 400); 9815 }; 9816 9817 } // end mobile only 9818 9819 }); 9820 }, 300); 9821 9822 9823 if (nectarDOMInfo.usingMobileBrowser) { 9824 9825 $('.nectar-video-wrap').each(function () { 9826 9827 if (!$(this).find('video').is('[muted]')) { 9828 9829 // Autoplay not supported unless muted 9830 $(this).parent().find('.mobile-video-image').show(); 9831 $(this).remove(); 9832 } 9833 9834 });
9835 9836 } 9837 9838 9839 $('.wpb_row:has(".nectar-video-wrap"):not(.fp-section)').each(function (i) { 9840 $(this).css('z-index', 100 + i); 9841 }); 9842 9843 9844 $(".vc_row").each(function () { 9845 var youtubeUrl, youtubeId, $row = jQuery(this); 9846 $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(); 9847 9848 // Remove yt url 9849 $row.find('.nectar-youtube-bg span').remove(); 9850 9851 if (!nectarDOMInfo.usingMobileBrowser) { 9852 $row.find('.nectar-video-wrap, .nectar-youtube-bg').css({ 9853 'opacity': '1', 9854 'width': '100%', 9855 'height': '100%' 9856 }); 9857 } 9858 $row.find('.video-color-overlay').transition({ 9859 'opacity': '0.7' 9860 }, 400); 9861 }); 9862 9863 9864 function nectarInsertYoutubeVideoAsBackground($element, youtubeId, counter) { 9865 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 () { 9866 nectarInsertYoutubeVideoAsBackground($element, youtubeId, counter++) 9867 }, 100); 9868 var $container = $element.prepend('<div class="vc_video-bg"><div class="inner"></div></div>').find(".inner"); 9869 new YT.Player($container[0], { 9870 width: "100%", 9871 height: "100%", 9872 videoId: youtubeId, 9873 playerVars: { 9874 playlist: youtubeId, 9875 iv_load_policy: 3, 9876 enablejsapi: 1, 9877 disablekb: 1, 9878 autoplay: 1, 9879 controls: 0, 9880 showinfo: 0, 9881 rel: 0, 9882 loop: 1 9883 }, 9884 events: { 9885 onReady: function (event) { 9886 event.target.mute().setLoop(!0); 9887 nectarResizeVideoBackground($element); 9888 } 9889 } 9890 }), nectarResizeVideoBackground($element), jQuery(window).on("resize", function () { 9891 nectarResizeVideoBackground($element); 9892 }); 9893 9894 setTimeout(function () { 9895 nectarResizeVideoBackground($element); 9896 }, 100); 9897 } 9898 9899 function nectarResizeVideoBackground($element) { 9900 var iframeW, iframeH, marginLeft, marginTop, containerW = $element.innerWidth(), 9901 containerH = $element.innerHeight(), 9902 ratio1 = 16, 9903 ratio2 = 9; 9904 ratio1 / ratio2 > containerW / containerH ? (iframeW = containerH * (ratio1 / ratio2), 9905 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", 9906 marginLeft = -Math.round((iframeW - containerW) / 2) + "px", iframeW += "px", iframeH += "px"), 9907 $element.find(".vc_video-bg iframe").css({ 9908 maxWidth: "1000%", 9909 marginLeft: marginLeft, 9910 marginTop: marginTop, 9911 width: iframeW, 9912 height: iframeH 9913 }); 9914 } 9915 9916 function nectarExtractYoutubeId(url) { 9917 9918 if ("undefined" == typeof url) { 9919 return !1; 9920 } 9921 9922 var id = url.match(/(?:https?:\/{2})?(?:w{3}\.)?youtu(?:be)?\.(?:com|be)(?:\/watch\?v=|\/)([^\s&]+)/); 9923 return null !== id ? id[1] : !1 9924 } 9925 9926 9927 } 9928 9929 9930 9931 9932 /** 9933 * Single Blog Posts 9934 * 9935 * @since 11.0 9936 */ 9937 function blogSingle() { 9938 9939 // Remove first gallery on post when using the gallery slider option. 9940 if( $body.hasClass('single-post') && $('.content-inner[data-has-gallery]').length > 0 ) { 9941 9942 9943 if($('.wp-block-gallery').length > 0) { 9944 // Gutenberg. 9945 $('.content-inner').find('.wp-block-gallery').each(function(i) { 9946 if(i !== 0) { 9947 $(this).css('display','flex'); 9948 } 9949 }); 9950 9951 } else { 9952 // Classic Editor. 9953 $('.content-inner').find('.gallery').each(function(i) { 9954 if(i !== 0) { 9955 $(this).css('display','block'); 9956 } 9957 });
9958 9959 } 9960 9961 } // If using gallery slider on single conditional end. 9962 9963 } 9964 9965 9966 9967 9968 9969 /*-------------------------------------------------------------------------*/ 9970 /* Header + Search 9971 /*-------------------------------------------------------------------------*/ 9972 9973 /** 9974 * Correct megamenus in mobile navigation. 9975 * 9976 * @since 8.0 9977 */ 9978 function mobileNavMegamenuCorrect() { 9979 9980 ////mobile megamenus without titles / nested groupings 9981 var $mobileNavSelector = ( $('#top #mobile-menu').length > 0 ) ? '#top #mobile-menu ' : '.off-canvas-menu-container.mobile-only '; 9982 9983 $($mobileNavSelector + '.menu-item > ul > li > a').each(function () { 9984 9985 if ($(this).text() == '-' || $(this).text() == '–' || $(this).parent().hasClass('hide-title') || $(this).find('> .remove-menu-item-title').length > 0 ) { 9986 9987 var $navLIs = $(this).parent().find('> ul > li').clone(); 9988 9989 // column has widget 9990 if( $(this).parent().find('> .widget-area-active').length > 0 ) { 9991 $(this).parent().find('> a').remove(); 9992 } else { 9993 9994 $(this).parent().find('ul').remove(); 9995 $(this).parent().parent().append($navLIs); 9996 $(this).parent().remove(); 9997 } 9998 9999 } 10000 }); 10001 10002 } 10003 10004 10005 10006 /** 10007 * Material theme skin off canvas menu initialization. 10008 * 10009 * @since 10.5 10010 */ 10011 function materialSkinOCM_Init() { 10012 10013 if ($('body.material[data-slide-out-widget-area-style="slide-out-from-right"]').length > 0) { 10014 OCM_materialWidth(); 10015 10016 if( $wpAdminBar.length > 0 ) { 10017 var $topToolBar = $wpAdminBar.detach(); 10018 $('.ocm-effect-wrap-inner').append($topToolBar); 10019 } 10020 10021 } 10022 10023 OCM_materialIconMarkup(); 10024 materialSkinTransition(); 10025 10026 $window.on('resize', OCM_materialSize); 10027 10028 } 10029 10030 10031 10032 10033 /** 10034 * Material theme skin transition helper 10035 * 10036 * @since 10.5 10037 */ 10038 function materialSkinTransition() { 10039 10040 if ($('body.material[data-header-search="true"]').length > 0 || 10041 $('body.material .ocm-effect-wrap').length > 0) { 10042 10043 var materialTransTO, 10044 allowMaterialResizeCalc = false, 10045 orientTrack = 0, 10046 $winDOMWidth = nectarDOMInfo.winW, 10047 $winDOMHeight = nectarDOMInfo.winH; 10048 10049 // For mobile make sure the orientation has changed. 10050 window.addEventListener("orientationchange", function () { 10051 orientTrack = 1; 10052 }); 10053 10054 // Resize. 10055 $window.on('resize', function () { 10056 10057 if( nectarDOMInfo.usingMobileBrowser ) { 10058 // Mobile. 10059 if (($window.width() != $winDOMWidth && $window.height != $winDOMHeight) || orientTrack === 1) { 10060 10061 // Store the current window dimensions. 10062 $winDOMWidth = nectarDOMInfo.winW; 10063 $winDOMHeight = nectarDOMInfo.winH; 10064 10065 // Reset orientation change tracker. 10066 orientTrack = 0; 10067 10068 // Set to allow. 10069 allowMaterialResizeCalc = true; 10070 10071 } 10072 } else { 10073 // Desktop always allows. 10074 allowMaterialResizeCalc = true; 10075 } 10076 10077 if(allowMaterialResizeCalc) { 10078 10079 clearTimeout(materialTransTO); 10080 10081 $('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') 10082 .addClass('no-material-transition'); 10083 10084 materialTransTO = setTimeout(function () { 10085 $('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') 10086 .removeClass('no-material-transition'); 10087 }, 250); 10088 10089 OCM_materialWidth(); 10090 10091 // Reset allow. 10092 allowMaterialResizeCalc = false; 10093 10094 } // endif for allow. 10095 10096 }); // end resize. 10097 10098 } 10099 10100 } 10101 10102 10103 10104 /** 10105 * Calculate off canvas menu slide out from right on hover 10106 * 10107 * @since 8.0 10108 */ 10109 function calculateHoverNavMinHeight() { 10110 10111 var $widgetHeights = 0; 10112 $('#slide-out-widget-area > .widget').each(function () { 10113 $widgetHeights += $(this).height(); 10114 });
10115 10116 var $menuHeight; 10117 10118 if(($offCanvasEl.height() - 25 - $('.bottom-meta-wrap').outerHeight(true) - $widgetHeights) > $('#slide-out-widget-area .off-canvas-menu-container:last-child').height()) { 10119 $menuHeight = $offCanvasEl.height() - 25 - $('.bottom-meta-wrap').outerHeight(true) - $widgetHeights; 10120 } else { 10121 $menuHeight = $('#slide-out-widget-area .off-canvas-menu-container:last-child').height(); 10122 } 10123 10124 $('#slide-out-widget-area .inner').css({ 10125 'height': 'auto', 10126 'min-height': $menuHeight 10127 }); 10128 10129 10130 } 10131 10132 10133 /** 10134 * Material theme skin off canvas menu width. 10135 * 10136 * @since 8.0 10137 */ 10138 function OCM_materialWidth() { 10139 10140 $('#slide-out-widget-area.slide-out-from-right').css({ 10141 'padding-top': $window.height() * 0.1, 10142 'padding-bottom': $window.height() * 0.1 10143 }); 10144 10145 OCM_overflowState(); 10146 } 10147 10148 10149 10150 /** 10151 * Material theme skin off canvas menu icon markup 10152 * 10153 * @since 8.0 10154 */ 10155 function OCM_materialIconMarkup() { 10156 10157 if ($('body.material').length > 0 && $('body[data-slide-out-widget-area-style="slide-out-from-right-hover"]').length == 0 ) { 10158 10159 if ($('body[data-slide-out-widget-area-style*="fullscreen"]').length == 0 && $('#mobile-menu').length == 0) { 10160 var $menuIconClone = $('header#top nav ul .slide-out-widget-area-toggle a > span > i').clone(); 10161 $menuIconClone.addClass('hover-effect'); 10162 $('header#top nav ul .slide-out-widget-area-toggle a > span').append($menuIconClone); 10163 10164 var $menuIconClone2 = $('header#top .slide-out-widget-area-toggle.mobile-icon a > span > i').clone(); 10165 $menuIconClone2.addClass('hover-effect'); 10166 $('header#top .slide-out-widget-area-toggle.mobile-icon a > span').append($menuIconClone2); 10167 } 10168 10169 $('body:not([data-slide-out-widget-area-style="slide-out-from-right"]) header#top .slide-out-widget-area-toggle a > span') 10170 .append($('<span class="close-wrap"> <span class="close-line close-line1"></span> <span class="close-line close-line2"></span> </span>')); 10171 10172 setTimeout(function(){ 10173 $('header#top .slide-out-widget-area-toggle a > span .close-wrap').addClass('loaded'); 10174 },200); 10175 10176 } 10177 10178 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 ) { 10179 $('#ajax-content-wrap > .slide-out-widget-area-toggle.slide-out-hover-icon-effect').insertAfter('.ocm-effect-wrap'); 10180 } 10181 10182 //move material skin default ocm 10183 if ($('body.material').length > 0 && 10184 $('body[data-slide-out-widget-area-style*="fullscreen"]').length == 0 && 10185 $('.ocm-effect-wrap').length > 0 ) { 10186 $('body.material #slide-out-widget-area.slide-out-from-right .slide_out_area_close').insertAfter('.ocm-effect-wrap'); 10187 $('#slide-out-widget-area-bg').insertAfter('.ocm-effect-wrap'); 10188 $offCanvasEl.insertAfter('.ocm-effect-wrap'); 10189 10190 } 10191 10192 } 10193 10194 10195 10196 /** 10197 * Material theme skin off canvas menu height 10198 * 10199 * @since 8.0 10200 */ 10201 function OCM_materialSize() { 10202 if ($('.ocm-effect-wrap.material-ocm-open').length > 0) { 10203 10204 $('.ocm-effect-wrap').css({ 10205 'height': $window.height() 10206 }); 10207 10208 $('.ocm-effect-wrap-inner').css({ 10209 'padding-top': nectarDOMInfo.adminBarHeight 10210 }); 10211 10212 } 10213 } 10214 10215 10216 10217 /** 10218 * Off canvas menu dropdown markup 10219 * 10220 * @since 8.0 10221 */ 10222 function OCM_dropdownMarkup() { 10223 var $nectar_ocm_dropdown_func = ($('#slide-out-widget-area[data-dropdown-func]').length > 0) ? $offCanvasEl.attr('data-dropdown-func') : 'default'; 10224 if ($nectar_ocm_dropdown_func == 'separate-dropdown-parent-link') { 10225 $('#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>'); 10226 } 10227 } 10228 10229 10230 10231 /** 10232 * Off canvas menu dropdown icon position. 10233 * 10234 * @since 8.0 10235 */ 10236 function OCM_dropdownIconPos() { 10237 10238 $('#slide-out-widget-area[class*="slide-out-from-right"] .off-canvas-menu-container li.menu-item-has-children').each(function () { 10239 $(this).find('.ocm-dropdown-arrow').css({ 10240 'top': $(this).find('a').height() / 2 10241 });
10242 }); 10243 $('#slide-out-widget-area.fullscreen-split .off-canvas-menu-container li.menu-item-has-children').each(function () { 10244 $(this).find('.ocm-dropdown-arrow').css({ 10245 'top': $(this).find('a').height() / 2 10246 }); 10247 }); 10248 10249 } 10250 10251 10252 10253 10254 /** 10255 * Off canvas menu overflow scrolling. 10256 * 10257 * @since 8.0 10258 */ 10259 function OCM_overflowState() { 10260 10261 //switch position of social media/extra info based on screen size 10262 if (nectarDOMInfo.winW < 1000 || 10263 $('body > #boxed').length > 0 || 10264 $('.ocm-effect-wrap-inner > #boxed').length > 0) { 10265 10266 $('#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'); 10267 $('#slide-out-widget-area.fullscreen .bottom-text, #slide-out-widget-area.fullscreen-alt .bottom-text').appendTo('#slide-out-widget-area .inner'); 10268 10269 } else { 10270 $('#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'); 10271 $('#slide-out-widget-area.fullscreen .bottom-text, #slide-out-widget-area.fullscreen-alt .bottom-text').appendTo('#slide-out-widget-area .inner-wrap'); 10272 } 10273 10274 10275 //close mobile only slide out widget area if switching back to desktop 10276 if ($('.slide-out-from-right.open .off-canvas-menu-container.mobile-only').length > 0 && $('body.mobile').length == 0) { 10277 $('#slide-out-widget-area .slide_out_area_close').trigger('click'); 10278 } 10279 10280 //sizing for dropdown 10281 OCM_dropdownIconPos(); 10282 10283 } 10284 10285 10286 10287 /** 10288 * Off canvas menu: slide out from right hover open. 10289 * 10290 * @since 10.5 10291 */ 10292 function OCM_slideOutRightHoverOpen() { 10293 10294 calculateHoverNavMinHeight(); 10295 10296 if ( nectarDOMInfo.usingMobileBrowser && $('#slide-out-widget-area.open').length > 0 ) { 10297 OCM_mobileSlideOutRightHoverCloseCheck(); 10298 return false; 10299 } 10300 10301 if( nectarDOMInfo.usingMobileBrowser ) { 10302 $('.slide-out-widget-area-toggle a').attr('aria-expanded','true'); 10303 $offCanvasBG.css({ 10304 'height': '100%', 10305 'width': '100%' 10306 }); 10307 } 10308 10309 $offCanvasEl.css({ 10310 'transform': 'translate3d(0,0,0)' 10311 }).addClass('open'); 10312 10313 var withinCustomBreakpoint = mobileBreakPointCheck(); 10314 if( nectarDOMInfo.winW < 1000 ) { 10315 withinCustomBreakpoint = true; 10316 } 10317 var alignmentPosition = (window.nectarOptions && window.nectarOptions.mobile_header_format && window.nectarOptions.mobile_header_format === 'centered-menu' && withinCustomBreakpoint) ? 'left' : 'right'; 10318 10319 // Icon effect 10320 // Set position 10321 if ($('header#top .container .span_9 > .slide-out-widget-area-toggle').length > 0) { 10322 10323 var $hIconEl = $('.slide-out-hover-icon-effect'), 10324 secondaryBarHeight = nectarDOMInfo.secondaryHeaderHeight; 10325 10326 var $nectarHamMenuPos; 10327 var $withinCustomBreakpoint = mobileBreakPointCheck(); 10328 if( $('#header-outer[data-format="centered-menu-bottom-bar"]').length > 0 ) { 10329 $withinCustomBreakpoint = false; 10330 } 10331 10332 if ($('body.mobile').length > 0 || $withinCustomBreakpoint) { 10333 10334 $hIconEl.css({ 10335 'top': $('header#top .span_9 > .slide-out-widget-area-toggle a').offset().top - nectarDOMInfo.scrollTop 10336 }); 10337 10338 if( alignmentPosition === 'left' ) { 10339 $hIconEl.css({ 10340 'left' : parseInt($('#header-outer header > .container').css('padding-right')) + 1, 10341 'right' : '' 10342 });
10343 } else { 10344 $hIconEl.css({ 10345 'right' : parseInt($('#header-outer header > .container').css('padding-right')) + 1, 10346 'left' : '' 10347 }); 10348 } 10349 10350 } else { 10351 10352 if ($bodyBorderHeaderColorMatch) { 10353 10354 var $extraCushion = ($('#header-outer[data-has-menu="false"]').length > 0) ? 2 : 1; 10355 $hIconEl.css({ 10356 'top': nectarDOMInfo.adminBarHeight + secondaryBarHeight + parseInt($('header#top nav >ul .slide-out-widget-area-toggle a').css('padding-top')), 10357 'right': 29 + $extraCushion 10358 }); 10359 10360 } else { 10361 10362 if ($('#header-outer[data-format="centered-menu-bottom-bar"]').length > 0) { 10363 $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(); 10364 10365 if( $('#top .span_3 .slide-out-widget-area-toggle.mobile-icon').css('display') == 'flex' ) { 10366 $nectarHamMenuPos = $('#top .span_3 .slide-out-widget-area-toggle.mobile-icon a').offset(); 10367 } 10368 10369 $hIconEl.css({ 10370 'top': parseInt($nectarHamMenuPos.top) - nectarDOMInfo.scrollTop, 10371 'right': parseInt($('#header-outer header >.container').css('padding-right')) + 2, 10372 'left': '' 10373 }); 10374 } else { 10375 10376 if( $body.hasClass('ascend') ) { 10377 $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(); 10378 } else { 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').position(); 10380 } 10381 10382 10383 if ($('#header-secondary-outer.hide-up').length > 0) { 10384 secondaryBarHeight = 0; 10385 } 10386 10387 $hIconEl.css({ 10388 'top': nectarDOMInfo.adminBarHeight + secondaryBarHeight + parseInt($nectarHamMenuPos.top), 10389 'right': parseInt($('#header-outer header >.container').css('padding-right')) + 2, 10390 'left': '' 10391 }); 10392 } 10393 10394 } // No body border color match. 10395 10396 } //Not on mobile. 10397 10398 } 10399 10400 ////Open 10401 $('.slide-out-hover-icon-effect .lines-button') 10402 .removeClass('no-delay') 10403 .addClass('unhidden-line'); 10404 10405 if ($('#header-outer[data-permanent-transparent="1"]').length == 0 && 10406 $('#nectar_fullscreen_rows').length == 0 && 10407 !nectarDOMInfo.usingFrontEndEditor && 10408 nectarDOMInfo.winW > 1000) { 10409 10410 if (!(nectarDOMInfo.scrollTop == 0 && $('#header-outer.transparent').length > 0)) { 10411 10412 if ($('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) { 10413 10414 $headerOuterEl.attr('data-transparent', 'true').addClass('no-bg-color').addClass('slide-out-hover'); 10415 $('#header-outer header, #header-outer > .cart-outer').addClass('all-hidden'); 10416 } 10417 10418 } 10419 10420 if ($('#header-outer[data-remove-fixed="1"]').length == 0 && $('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) { 10421 10422 if (headerResize == true) { 10423 10424 $window.off('scroll', bigNav); 10425 $window.off('scroll', smallNav); 10426 10427 } else { 10428 $window.off('scroll', opaqueCheck); 10429 $window.off('scroll', transparentCheck); 10430 } 10431 } 10432 10433 } 10434 10435 if (!nectarDOMInfo.usingMobileBrowser) { 10436 $window.on('mousemove.rightOffsetCheck', OCM_slideOutRightHoverCloseCheck); 10437 } else { 10438 return false; 10439 } 10440 10441 } 10442 10443 10444 /** 10445 * Off canvas menu: slide out from right hover close 10446 * 10447 * @since 10.5 10448 */ 10449 function OCM_slideOutRightHoverCloseCheck(e) { 10450 10451 var $windowWidth = $window.width(); 10452 var $ocmHoverWidth = $offCanvasEl.outerWidth(); 10453 var withinCustomBreakpoint = mobileBreakPointCheck(); 10454 if( nectarDOMInfo.winW < 1000 ) { 10455 withinCustomBreakpoint = true; 10456 } 10457 var alignmentPosition = (window.nectarOptions && window.nectarOptions.mobile_header_format && window.nectarOptions.mobile_header_format === 'centered-menu' && withinCustomBreakpoint) ? 'left' : 'right'; 10458 10459 var conditionalShow = false; 10460 if( alignmentPosition !== 'left') { 10461 conditionalShow = (e.clientX < $windowWidth - parseInt($ocmHoverWidth) - $bodyBorderWidth);
10462 } else { 10463 conditionalShow = (e.clientX > parseInt($ocmHoverWidth) + $bodyBorderWidth); 10464 } 10465 10466 10467 if (conditionalShow && $offCanvasEl.hasClass('mouse-accessed')) { 10468 10469 $offCanvasEl.removeClass('mouse-accessed'); 10470 $window.off('mousemove.rightOffsetCheck', OCM_slideOutRightHoverCloseCheck); 10471 10472 $offCanvasEl.css({ 10473 'transform': '' 10474 }).removeClass('open'); 10475 10476 $headerOuterEl.removeClass('style-slide-out-from-right'); 10477 10478 $('.slide-out-hover-icon-effect .lines-button') 10479 .removeClass('unhidden-line') 10480 .addClass('no-delay'); 10481 10482 if ($('#header-outer[data-permanent-transparent="1"]').length == 0) { 10483 10484 if ($('#header-outer[data-remove-fixed="1"]').length == 0 && $('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) { 10485 10486 if ($('body.mobile').length == 0) { 10487 $headerOuterEl.removeClass('no-bg-color'); 10488 $('#header-outer header, #header-outer > .cart-outer').removeClass('all-hidden'); 10489 } 10490 } 10491 10492 if ($('#header-outer[data-remove-fixed="1"]').length == 0 && $('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) { 10493 10494 if (headerResize == true) { 10495 10496 $window.off('scroll.headerResizeEffect'); 10497 10498 if (nectarDOMInfo.scrollTop == 0) { 10499 10500 $window.on('scroll.headerResizeEffect', smallNav); 10501 10502 if ($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 && 10503 $bodyBorderTop.length > 0 && 10504 $bodyBorderHeaderColorMatch == true && 10505 $('#header-outer.pseudo-data-transparent').length > 0) { 10506 10507 $('#header-outer[data-full-width="true"] header > .container').stop(true, true).animate({ 10508 'padding': '0' 10509 }, { 10510 queue: false, 10511 duration: 250, 10512 easing: 'easeOutCubic' 10513 }); 10514 10515 } 10516 } else { 10517 $window.on('scroll.headerResizeEffect', bigNav); 10518 } 10519 10520 } else { 10521 10522 $window.off('scroll.headerResizeEffectOpaque'); 10523 $window.on('scroll.headerResizeEffectOpaque', opaqueCheck); 10524 } 10525 } 10526 } 10527 } 10528 10529 } 10530 10531 10532 /** 10533 * Off canvas menu: mobile slide out from right hover close. 10534 * 10535 * @since 10.5 10536 */ 10537 function OCM_mobileSlideOutRightHoverCloseCheck() { 10538 10539 if(nectarDOMInfo.usingMobileBrowser) { 10540 $('.slide-out-widget-area-toggle a').attr('aria-expanded','false'); 10541 $offCanvasBG.css({ 10542 'height': '1px', 10543 'width': '1px' 10544 }); 10545 } 10546 10547 $offCanvasEl.css({ 10548 'transform': '' 10549 }).removeClass('open'); 10550 10551 $headerOuterEl.removeClass('style-slide-out-from-right'); 10552 10553 $('.slide-out-hover-icon-effect .lines-button') 10554 .removeClass('unhidden-line') 10555 .addClass('no-delay'); 10556 10557 if ($('#header-outer[data-permanent-transparent="1"]').length == 0) { 10558 10559 $headerOuterEl.removeClass('no-bg-color'); 10560 $('#header-outer header').removeClass('all-hidden'); 10561 10562 } 10563 10564 10565 if ($('#header-outer[data-remove-fixed="1"]').length == 0 && $('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) { 10566 10567 if (headerResize == true) { 10568 10569 $window.off('scroll.headerResizeEffect'); 10570 10571 if (nectarDOMInfo.scrollTop == 0) { 10572 10573 $window.on('scroll.headerResizeEffect', smallNav); 10574 10575 if ($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 && 10576 $bodyBorderTop.length > 0 && 10577 $bodyBorderHeaderColorMatch == true && 10578 $('#header-outer.pseudo-data-transparent').length > 0) { 10579 10580 $('#header-outer[data-full-width="true"] header > .container').stop(true, true).animate({ 10581 'padding': '0' 10582 }, { 10583 queue: false, 10584 duration: 250, 10585 easing: 'easeOutCubic' 10586 }); 10587 10588 } 10589 } 10590 10591 else { 10592 $window.on('scroll.headerResizeEffect', bigNav); 10593 } 10594 10595 } else { 10596 10597 $window.off('scroll.headerResizeEffectOpaque'); 10598 $window.on('scroll.headerResizeEffectOpaque', opaqueCheck); 10599 10600 } 10601 10602 } 10603 10604 } 10605 10606 10607 10608 /** 10609 * Off canvas menu: slide out from right hover initialization. 10610 * 10611 * @since 10.5 10612 */ 10613 function OCM_slideOutRightHoverInit() { 10614 10615 if ($('#ajax-content-wrap > .slide-out-widget-area-toggle').length == 0) { 10616 10617 //icon effect html creation 10618 var $iconInsertLocation = ( $('.slide-out-widget-area-toggle[data-custom-color="true"]').length > 0 ) ? '#slide-out-widget-area > div' : '#slide-out-widget-area'; 10619 10620 $('<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); 10621 10622 if ($('#header-outer[data-has-menu="true"]').length > 0 || 10623 $('body[data-header-search="true"]').length > 0 || 10624 $('.slide-out-widget-area-toggle a.using-label').length > 0 || 10625 $('.slide-out-widget-area-toggle[data-custom-color="true"]').length > 0 ) { 10626 $('.slide-out-widget-area-toggle').addClass('small'); 10627 } 10628 } 10629 10630 10631 //hover triggered 10632 if (!nectarDOMInfo.usingMobileBrowser) { 10633 $body.on('mouseenter', '#header-outer .slide-out-widget-area-toggle:not(.std-menu) a', OCM_slideOutRightHoverOpen); 10634 $offCanvasEl.on('mouseenter', function () { 10635 $(this).addClass('mouse-accessed'); 10636 });
10637 10638 } else { 10639 $body.on('click', '.slide-out-widget-area-toggle:not(.std-menu) a', OCM_slideOutRightHoverOpen); 10640 $body.on('click', '#slide-out-widget-area-bg', OCM_slideOutRightMobileClose); 10641 } 10642 10643 $window.on('smartresize', calculateHoverNavMinHeight); 10644 10645 10646 } 10647 10648 10649 /** 10650 * Off canvas menu: slide out from right close from body click on mobile. 10651 * 10652 * @since 12.2 10653 */ 10654 function OCM_slideOutRightMobileClose() { 10655 10656 if( $('.slide-out-from-right-hover.open').length > 0 ) { 10657 $('.slide-out-widget-area-toggle:not(.std-menu) a').first().addClass('non-human-allowed').trigger('click'); 10658 setTimeout(function () { 10659 $('.slide-out-widget-area-toggle:not(.std-menu) a').removeClass('non-human-allowed'); 10660 }, 100); 10661 } 10662 10663 } 10664 10665 10666 /** 10667 * Off canvas menu: slide out from right open. 10668 * 10669 * @since 10.5 10670 */ 10671 function OCM_slideOutRightOpen() { 10672 10673 var $slideOutAmount = ($bodyBorderTop.length > 0 && $('body.mobile').length == 0) ? $bodyBorderTop.height() : 0; 10674 10675 var withinCustomBreakpoint = mobileBreakPointCheck(); 10676 if( nectarDOMInfo.winW < 1000 ) { 10677 withinCustomBreakpoint = true; 10678 } 10679 var alignmentPosition = (window.nectarOptions && window.nectarOptions.mobile_header_format && window.nectarOptions.mobile_header_format === 'centered-menu' && withinCustomBreakpoint) ? 'left' : 'right'; 10680 10681 if ($('body.material').length == 0) { 10682 10683 // Calc height if used bottom meta. 10684 $('#slide-out-widget-area .inner').css({ 10685 'height': 'auto', 10686 'min-height': $offCanvasEl.height() - 25 - $('.bottom-meta-wrap').height() 10687 }); 10688 10689 // First item dropdown? 10690 if($('#slide-out-widget-area[data-dropdown-func="separate-dropdown-parent-link"] .inner > div:first-of-type > .menu > li:first-child').length > 0 && 10691 $('#slide-out-widget-area .inner > div:first-of-type > .menu > li:first-child').hasClass('menu-item-has-children')) { 10692 $('#slide-out-widget-area .inner > div:first-of-type').css({'margin-top':'50px'}); 10693 } 10694 10695 if ($('#boxed').length == 0) { 10696 10697 $('.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({ 10698 x: (alignmentPosition === 'left') ? '300px' : '-300px' 10699 }, 700, 'easeInOutCubic'); 10700 10701 var $withinCustomBreakpoint = mobileBreakPointCheck(); 10702 10703 if ($('#header-outer[data-format="centered-logo-between-menu"]').length == 0 || $withinCustomBreakpoint) { 10704 10705 if ($('#header-outer[data-transparency-option="1"]').length == 0 || 10706 ($('#header-outer[data-transparency-option="1"]').length > 0 && $('#header-outer[data-full-width="true"]').length == 0) || 10707 $('body.mobile').length > 0) { 10708 10709 $headerOuterEl.stop(true).css('transform', 'translateY(0)').transition({ 10710 x: (alignmentPosition === 'left') ? (300 + $slideOutAmount) + 'px' : '-' + (300 + $slideOutAmount) + 'px' 10711 }, 700, 'easeInOutCubic'); 10712 10713 } else { 10714 10715 $headerOuterEl.stop(true).css('transform', 'translateY(0)').transition({ 10716 x: (alignmentPosition === 'left') ? (300 + $slideOutAmount) + 'px' : '-' + (300 + $slideOutAmount) + 'px', 10717 'background-color': 'transparent', 10718 'border-bottom': '1px solid rgba(255,255,255,0.22)' 10719 }, 700, 'easeInOutCubic'); 10720 10721 } 10722 } else { 10723 $('#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({ 10724 x: (alignmentPosition === 'left') ? '300px' : '-300px' 10725 }, 700, 'easeInOutCubic'); 10726 } 10727 10728 } 10729 10730 $offCanvasEl.stop(true).transition({ 10731 x: (alignmentPosition === 'left') ? $slideOutAmount + 'px' : '-' + $slideOutAmount + 'px' 10732 }, 700, 'easeInOutCubic').addClass('open'); 10733 10734 10735 if ($('#boxed').length == 0) { 10736 10737 // Full width menu adjustments 10738 if ($('#header-outer[data-full-width="true"]').length > 0 && !$body.hasClass('mobile')) { 10739 $headerOuterEl.addClass('highzI'); 10740 $('#ascrail2000').addClass('z-index-adj'); 10741 10742 if ($('#header-outer[data-format="centered-logo-between-menu"]').length == 0) { 10743 10744 if ($bodyBorderWidth == 0) { 10745 $('header#top #logo').stop(true).transition({ 10746 x: (300 + $slideOutAmount) + 'px' //todo 10747 }, 700, 'easeInOutCubic'); 10748 } 10749 10750 } 10751 10752 $('header#top .slide-out-widget-area-toggle .lines-button:not(.legacy-double)').addClass('close'); 10753 10754 $('body #header-outer nav > ul > li > a').css({ 10755 'margin-bottom': '0' 10756 });
10757 10758 } 10759 10760 } 10761 10762 $headerOuterEl.addClass('style-slide-out-from-right'); 10763 10764 // Fade In BG Overlay 10765 $offCanvasBG.css({ 10766 'height': '100%', 10767 'width': '100%' 10768 }).stop(true).transition({ 10769 'opacity': 1 10770 }, 700, 'easeInOutCubic', function () { 10771 $('.slide-out-widget-area-toggle:not(.std-menu) > div > a').removeClass('animating'); 10772 }); 10773 10774 // Hide menu if no space 10775 if ($('#header-outer[data-format="centered-logo-between-menu"]').length == 0) { 10776 10777 var $logoWidth = ($('#logo img:visible').length > 0) ? $('#logo img:visible').width() : $('#logo').width(); 10778 10779 if ($('header#top nav > .sf-menu').offset().left - $logoWidth - 300 < 20) { 10780 $headerOuterEl.addClass('hidden-menu'); 10781 } 10782 10783 } else { 10784 $headerOuterEl.addClass('hidden-menu-items'); 10785 } 10786 10787 10788 if ($('#header-outer[data-remove-fixed="1"]').length == 0 && nectarDOMInfo.winW > 1000) { 10789 10790 if ($bodyBorderHeaderColorMatch == true && headerResize == true && $headerOuterEl.attr('data-transparent-header') == 'true') { 10791 10792 $headerOuterEl.stop(true).transition({ 10793 y: '0' 10794 }, 0).addClass('transparent').css('transition', 'transform'); 10795 10796 10797 $window.off('scroll', bigNav); 10798 $window.off('scroll', smallNav); 10799 10800 } else if ($bodyBorderHeaderColorMatch == true && $headerOuterEl.attr('data-transparent-header') == 'true') { 10801 10802 $headerOuterEl.addClass('transparent'); 10803 $window.off('scroll', opaqueCheck); 10804 $window.off('scroll', transparentCheck); 10805 10806 } 10807 } 10808 10809 } else if ($('body.material').length > 0) { 10810 10811 // Material theme skin slide out from right 10812 10813 //move ajax loading outside 10814 if ($loadingScreenEl.length > 0 && $('.ocm-effect-wrap #ajax-loading-screen').length > 0) { 10815 $loadingScreenEl.insertBefore('.ocm-effect-wrap'); 10816 } 10817 10818 // Hide secondary header when not at top with hhun 10819 if (nectarDOMInfo.scrollTop > 40) { 10820 $('body[data-hhun="1"] #header-secondary-outer').addClass('hidden'); 10821 } 10822 10823 setTimeout(function () { 10824 $('.slide-out-widget-area-toggle:not(.std-menu) > div > a').removeClass('animating'); 10825 }, 300); 10826 10827 $('#slide-out-widget-area, #slide-out-widget-area-bg, #header-outer .slide-out-widget-area-toggle').addClass('material-open'); 10828 10829 10830 // Handle bottom bar nav 10831 if ($('body:not(.mobile) #header-outer[data-format="centered-menu-bottom-bar"][data-condense="true"]').length > 0 && 10832 $('#header-outer[data-format="centered-menu-bottom-bar"] .span_9').css('display') != 'none') { 10833 10834 $('#header-outer:not(.fixed-menu)').css('top', nectarDOMInfo.adminBarHeight - nectarDOMInfo.scrollTop + 'px'); 10835 10836 if ($headerSecondaryEl.length > 0 && $('#header-outer.fixed-menu').length > 0) { 10837 $headerSecondaryEl.css('visibility', 'hidden'); 10838 } 10839 10840 } 10841 10842 $('#ajax-content-wrap').css({ 10843 'position': 'relative', 10844 'top': '-' + nectarDOMInfo.scrollTop + 'px' 10845 }); 10846 10847 $('.ocm-effect-wrap-inner').css({ 10848 'padding-top': nectarDOMInfo.adminBarHeight 10849 }); 10850 10851 $('#fp-nav').addClass('material-ocm-open'); 10852 10853 nectarState.materialOffCanvasOpen = true; 10854 $body.addClass('material-ocm-open'); 10855 $body.addClass('nectar-no-flex-height'); 10856 10857 $('.ocm-effect-wrap').css({ 10858 'height': nectarDOMInfo.winH 10859 }); 10860 10861 setTimeout(function () { 10862 $('.ocm-effect-wrap').addClass('material-ocm-open'); 10863 }, 40); 10864 10865 10866 $('body > .slide_out_area_close').addClass('follow-body'); 10867 10868 //icon effect 10869 $('#header-outer:not([data-format="left-header"]) header#top .slide-out-widget-area-toggle a').addClass('effect-shown'); 10870 10871 //handle hhun when at top 10872 $('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({ 10873 'transition': 'none', 10874 'transform': 'translateY(' + nectarDOMInfo.adminBarHeight + 'px)' 10875 });
10876 10877 10878 setTimeout(function () { 10879 $('body > .slide_out_area_close').addClass('material-ocm-open'); 10880 }, 350); 10881 10882 10883 } 10884 10885 } 10886 10887 10888 /** 10889 * Off canvas menu: slide out from right close. 10890 * 10891 * @since 10.5 10892 */ 10893 function OCM_slideOutRightClose() { 10894 10895 if ($('body.material').length == 0) { 10896 10897 var withinCustomBreakpoint = mobileBreakPointCheck(); 10898 if( nectarDOMInfo.winW < 1000 ) { 10899 withinCustomBreakpoint = true; 10900 } 10901 var alignmentPosition = (window.nectarOptions && window.nectarOptions.mobile_header_format && window.nectarOptions.mobile_header_format === 'centered-menu' && withinCustomBreakpoint) ? 'left' : 'right'; 10902 10903 $('.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({ 10904 x: '0px' 10905 }, 700, 'easeInOutCubic'); 10906 10907 if ($('#header-outer[data-transparency-option="1"]').length > 0 && $('#boxed').length == 0) { 10908 var $currentRowBG = ($('#header-outer[data-current-row-bg-color]').length > 0) ? $headerOuterEl.attr('data-current-row-bg-color') : $headerOuterEl.attr('data-user-set-bg'); 10909 $headerOuterEl.stop(true).transition({ 10910 x: '0px', 10911 'background-color': $currentRowBG 10912 }, 700, 'easeInOutCubic'); 10913 } else { 10914 $headerOuterEl.stop(true).transition({ 10915 x: '0px' 10916 }, 700, 'easeInOutCubic'); 10917 } 10918 10919 $offCanvasEl.stop(true).transition({ 10920 x: (alignmentPosition === 'left') ? '-301px' : '301px' 10921 }, 700, 'easeInOutCubic').removeClass('open'); 10922 10923 10924 if ($('#boxed').length == 0) { 10925 if ($('#header-outer[data-full-width="true"]').length > 0) { 10926 $headerOuterEl.removeClass('highzI'); 10927 $('header#top #logo').stop(true).transition({ 10928 x: '0px' 10929 }, 700, 'easeInOutCubic'); 10930 $('.lines-button').removeClass('close'); 10931 10932 } 10933 } 10934 10935 if ($('#header-outer[data-format="centered-logo-between-menu"]').length > 0) { 10936 $('#header-outer header#top nav > ul.buttons, #header-outer .cart-outer .cart-menu-wrap').stop(true).transition({ 10937 x: '0px' 10938 }, 700, 'easeInOutCubic'); 10939 } 10940 10941 //fade out overlay 10942 $offCanvasBG.stop(true).transition({ 10943 'opacity': 0 10944 }, 700, 'easeInOutCubic', function () { 10945 10946 $('.slide-out-widget-area-toggle a').removeClass('animating'); 10947 10948 $(this).css({ 10949 'height': '1px', 10950 'width': '1px' 10951 }); 10952 10953 if ($('#header-outer[data-remove-fixed="1"]').length == 0) { 10954 10955 //hide menu if transparent, user has scrolled down and hhun is on 10956 if ($headerOuterEl.hasClass('parallax-contained') && 10957 nectarDOMInfo.scrollTop > 0 && 10958 $('#header-outer[data-permanent-transparent="1"]').length == 0) { 10959 $headerOuterEl.removeClass('parallax-contained').addClass('detached').removeClass('transparent'); 10960 } 10961 else if (nectarDOMInfo.scrollTop == 0 && $('body[data-hhun="1"]').length > 0 && $('#page-header-bg[data-parallax="1"]').length > 0 || 10962 nectarDOMInfo.scrollTop == 0 && $('body[data-hhun="1"]').length > 0 && $('.parallax_slider_outer').length > 0) { 10963 10964 if ($('#header-outer[data-transparency-option="1"]').length > 0) { 10965 $headerOuterEl.addClass('transparent'); 10966 } 10967 10968 $headerOuterEl 10969 .addClass('parallax-contained') 10970 .removeClass('detached'); 10971 10972 } 10973 10974 } 10975 10976 //fix for fixed subpage menu 10977 $('.container-wrap').css('transform', 'none'); 10978 10979 }); 10980 10981 10982 $headerOuterEl.removeClass('style-slide-out-from-right'); 10983 10984 10985 if ($('#header-outer[data-remove-fixed="1"]').length == 0) { 10986 10987 if ($bodyBorderHeaderColorMatch == true && 10988 headerResize == true && 10989 nectarDOMInfo.winW > 1000) { 10990 10991 $window.off('scroll.headerResizeEffect'); 10992 if (nectarDOMInfo.scrollTop == 0) { 10993 10994 $window.on('scroll.headerResizeEffect', smallNav); 10995 10996 if ($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 && 10997 $bodyBorderTop.length > 0 && 10998 $bodyBorderHeaderColorMatch == true && 10999 $('#header-outer.pseudo-data-transparent').length > 0) { 11000 11001 $('#header-outer[data-full-width="true"] header > .container').stop(true, true).animate({ 11002 'padding': '0' 11003 }, { 11004 queue: false, 11005 duration: 250, 11006 easing: 'easeOutCubic' 11007 });
11008 11009 } 11010 } else { 11011 $window.on('scroll.headerResizeEffect', bigNav); 11012 } 11013 11014 if ($headerOuterEl.hasClass('pseudo-data-transparent')) { 11015 11016 $headerOuterEl.attr('data-transparent-header', 'false') 11017 .removeClass('pseudo-data-transparent') 11018 .removeClass('transparent'); 11019 } 11020 11021 $headerOuterEl.css('transition', 'transform'); 11022 11023 } else if ($bodyBorderHeaderColorMatch == true && nectarDOMInfo.winW > 1000) { 11024 11025 $window.off('scroll.headerResizeEffectOpaque'); 11026 $window.on('scroll.headerResizeEffectOpaque', opaqueCheck); 11027 11028 $headerOuterEl.css('transition', 'transform'); 11029 11030 if ($headerOuterEl.hasClass('pseudo-data-transparent')) { 11031 $headerOuterEl.attr('data-transparent-header', 'false') 11032 .removeClass('pseudo-data-transparent') 11033 .removeClass('transparent'); 11034 } 11035 } 11036 } 11037 } 11038 11039 else if ($('body.material').length > 0) { 11040 11041 //material 11042 $offCanvasEl.removeClass('open'); 11043 11044 $('#slide-out-widget-area, #slide-out-widget-area-bg, #header-outer .slide-out-widget-area-toggle').removeClass('material-open'); 11045 $('.ocm-effect-wrap, .ocm-effect-wrap-shadow, body > .slide_out_area_close, #fp-nav').removeClass('material-ocm-open'); 11046 11047 $('body > .slide_out_area_close').removeClass('follow-body'); 11048 11049 setTimeout(function () { 11050 $('.slide-out-widget-area-toggle a').removeClass('animating'); 11051 11052 $body.removeClass('material-ocm-open'); 11053 $body.removeClass('nectar-no-flex-height'); 11054 11055 $('.ocm-effect-wrap').css({ 11056 'height': '100%' 11057 }); 11058 11059 $('.ocm-effect-wrap-inner').css({ 11060 'padding-top': '0' 11061 }); 11062 11063 $window.scrollTop(Math.abs(parseInt($('#ajax-content-wrap').css('top')))); 11064 11065 $('#ajax-content-wrap').css({ 11066 'position': '', 11067 'top': '' 11068 }); 11069 11070 11071 //handle bottom bar nav 11072 if ($('#header-outer[data-format="centered-menu-bottom-bar"]').length > 0 && 11073 $('#header-outer[data-format="centered-menu-bottom-bar"] .span_9').css('display') != 'none' && 11074 $('body.mobile').length == 0) { 11075 11076 $('#header-outer:not(.fixed-menu)').css('top', ''); 11077 $headerSecondaryEl.css('visibility', ''); 11078 11079 } 11080 11081 //handle hhun when at top 11082 $('body[data-hhun="1"]:not(.no-scroll) #header-outer[data-permanent-transparent="false"]:not(.detached):not(.parallax-contained):not(.at-top-before-box)').css({ 11083 'transform': '' 11084 }); 11085 setTimeout(function () { 11086 $('body[data-hhun="1"]:not(.no-scroll) #header-outer[data-permanent-transparent="false"]:not(.detached):not(.parallax-contained):not(.at-top-before-box)').css({ 11087 'transition': '' 11088 });
11089 }, 30); 11090 11091 11092 $('body[data-hhun="1"] #header-secondary-outer.hidden').removeClass('hidden'); 11093 11094 nectarState.materialOffCanvasOpen = false; 11095 11096 }, 900); 11097 11098 setTimeout(function () { 11099 11100 //icon effect 11101 $('#header-outer:not([data-format="left-header"]) header#top .slide-out-widget-area-toggle a') 11102 .addClass('no-trans') 11103 .removeClass('effect-shown'); 11104 11105 }, 200); 11106 11107 setTimeout(function () { 11108 //icon 11109 $('#header-outer:not([data-format="left-header"]) header#top .slide-out-widget-area-toggle a').removeClass('no-trans'); 11110 }, 500); 11111 11112 } 11113 11114 } 11115 11116 11117 11118 11119 /** 11120 * Off canvas menu: fullscreen open. 11121 * 11122 * @since 10.5 11123 */ 11124 function OCM_fullscreenOpen() { 11125 11126 if ($('body.material').length > 0) { 11127 $('header#top .slide-out-widget-area-toggle a').addClass('menu-push-out'); 11128 } 11129 11130 // Scroll away from fixed reveal footer if shown (firefox bug with bluring over it) 11131 var $scrollDelay = 0; 11132 var $scrollDelay2 = 0; 11133 11134 if (nectarDOMInfo.scrollTop + $window.height() > $('.blurred-wrap').height() && $('#nectar_fullscreen_rows').length == 0) { 11135 $('body,html').stop().animate({ 11136 scrollTop: $('.blurred-wrap').height() - $window.height() 11137 }, 600, 'easeInOutCubic'); 11138 $scrollDelay = 550; 11139 $scrollDelay2 = 200; 11140 } 11141 11142 $('header#top .slide-out-widget-area-toggle:not(.std-menu) .lines-button:not(.legacy-double)').addClass('close'); 11143 setTimeout(function () { 11144 $('.blurred-wrap').addClass('blurred'); 11145 }, $scrollDelay); 11146 $('#slide-out-widget-area.fullscreen').show().addClass('open'); 11147 11148 if ($('.nectar-social.fixed').length == 0) { 11149 hideToTop(); 11150 } 11151 11152 // Remove box shadow incase at the top of the page with nectar box roll above 11153 $('.container-wrap').addClass('no-shadow'); 11154 $headerOuterEl.stop(true).css('transform', 'translateY(0)'); 11155 11156 setTimeout(function () { 11157 11158 $('.off-canvas-menu-container .menu > li').each(function (i) { 11159 $(this).delay(i * 50).transition({ 11160 y: 0, 11161 'opacity': 1 11162 }, 800, 'easeOutExpo'); 11163 }); 11164 11165 $('#slide-out-widget-area.fullscreen .widget').each(function (i) { 11166 $(this).delay(i * 100).transition({ 11167 y: 0, 11168 'opacity': 1 11169 }, 800, 'easeOutExpo'); 11170 }); 11171 }, 370 + $scrollDelay2); 11172 11173 setTimeout(function () { 11174 $('#slide-out-widget-area .off-canvas-social-links').addClass('line-shown'); 11175 11176 $('#slide-out-widget-area .off-canvas-social-links li').each(function (i) { 11177 $(this).delay(i * 50).transition({ 11178 'scale': 1 11179 }, 400, 'easeOutCubic'); 11180 }); 11181 11182 $('#slide-out-widget-area .bottom-text').transition({ 11183 'opacity': 0.7 11184 }, 400, 'easeOutCubic'); 11185 }, 750 + $scrollDelay2); 11186 11187 // Fade In BG Overlay 11188 setTimeout(function () { 11189 var $easing = ($('body.mobile').length > 0) ? 'easeOutCubic' : 'easeInOutQuint'; 11190 $offCanvasBG.css({ 11191 'height': '100%', 11192 'width': '100%' 11193 }).show().stop(true).transition({ 11194 'y': '0%' 11195 }, 920, $easing, function () { 11196 $('.slide-out-widget-area-toggle > div > a').removeClass('animating'); 11197 }); 11198 }, 50 + $scrollDelay2); 11199 11200 // Overflow state 11201 OCM_overflowState(); 11202 11203 if ($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && $('.container-wrap').hasClass('no-scroll')) { 11204 $('#ajax-content-wrap').addClass('at-content'); 11205 } 11206 11207 var headerOffset = $headerOuterEl.offset().top - nectarDOMInfo.scrollTop + nectarDOMInfo.secondaryHeaderHeight; 11208 11209 $('#slide-out-widget-area.fullscreen .inner-wrap').css('padding-top', ($headerOuterEl.outerHeight() + headerOffset)); 11210 11211 11212 } 11213 11214 11215 /** 11216 * Off canvas menu: fullscreen close. 11217 * 11218 * @since 10.5 11219 */ 11220 function OCM_fullscreenClose() { 11221 11222 if ($('body.material').length > 0) { 11223 setTimeout(function () { 11224 $('header#top .slide-out-widget-area-toggle a').removeClass('menu-push-out'); 11225 }, 350); 11226 } 11227 11228 $('.slide-out-widget-area-toggle:not(.std-menu) .lines-button:not(.legacy-double)').removeClass('close'); 11229 $('.blurred-wrap').removeClass('blurred'); 11230 $('#slide-out-widget-area.fullscreen').transition({ 11231 'opacity': 0 11232 }, 700, 'easeOutQuad', function () { 11233 $('#slide-out-widget-area.fullscreen').hide().css('opacity', '1'); 11234 }).removeClass('open'); 11235 $('#slide-out-widget-area.fullscreen .widget').transition({ 11236 'opacity': 0 11237 }, 700, 'easeOutQuad', function () { 11238 $(this).transition({ 11239 y: '110px' 11240 }, 0); 11241 });
11242 11243 setTimeout(function () { 11244 $('.off-canvas-menu-container .menu > li').transition({ 11245 y: '80px', 11246 'opacity': 0 11247 }, 0); 11248 $('#slide-out-widget-area .off-canvas-social-links li').transition({ 11249 'scale': 0 11250 }, 0); 11251 $('#slide-out-widget-area .off-canvas-social-links').removeClass('line-shown'); 11252 $('#slide-out-widget-area .bottom-text').transition({ 11253 'opacity': 0 11254 }, 0); 11255 11256 // Close submenu items 11257 $('#slide-out-widget-area .menuwrapper .menu').removeClass('subview'); 11258 $('#slide-out-widget-area .menuwrapper .menu li').removeClass('subview subviewopen'); 11259 $('#slide-out-widget-area.fullscreen .inner .menu-wrap').css('height', 'auto'); 11260 }, 800); 11261 11262 setTimeout(function () { 11263 if ($('.nectar-social.fixed').length == 0) { 11264 showToTop(); 11265 } 11266 $('.container-wrap').removeClass('no-shadow'); 11267 }, 500); 11268 11269 // Fade out overlay 11270 $offCanvasBG.stop(true).transition({ 11271 'opacity': 0 11272 }, 900, 'easeOutQuad', function () { 11273 11274 if ($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && $('.container-wrap').hasClass('no-scroll')) { 11275 $('#ajax-content-wrap').removeClass('at-content'); 11276 } 11277 if ($('.mobile #header-outer[data-permanent-transparent="false"]').length == 0) { 11278 $('#slide-out-widget-area.fullscreen .inner-wrap').css('padding-top', '0'); 11279 } 11280 11281 $('.slide-out-widget-area-toggle a').removeClass('animating'); 11282 11283 var $opacity = 0.4; 11284 11285 if ($offCanvasBG.hasClass('solid')) { 11286 $opacity = 1; 11287 } 11288 if ($offCanvasBG.hasClass('dark')) { 11289 $opacity = 0.93; 11290 } 11291 if ($offCanvasBG.hasClass('medium')) { 11292 $opacity = 0.6; 11293 } 11294 if ($offCanvasBG.hasClass('light')) { 11295 $opacity = 0.4; 11296 } 11297 $(this).css({ 11298 'height': '1px', 11299 'width': '1px', 11300 'opacity': $opacity 11301 }).transition({ 11302 y: '-100%' 11303 }, 0); 11304 }); 11305 11306 } 11307 11308 11309 /** 11310 * Off canvas menu: fullscreen alt open. 11311 * 11312 * @since 10.5 11313 */ 11314 function OCM_fullscreenAltOpen() { 11315 11316 var $ocm_fullscreen_class = ( $offCanvasEl.hasClass('fullscreen-alt') ) ? '.fullscreen-alt' : '.fullscreen-split'; 11317 11318 if ($('body.material').length > 0) { 11319 $('header#top .slide-out-widget-area-toggle a').addClass('menu-push-out'); 11320 } 11321 11322 $('header#top .slide-out-widget-area-toggle:not(.std-menu) .lines-button:not(.legacy-double)').addClass('close'); 11323 11324 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 11325 $('#slide-out-widget-area'+$ocm_fullscreen_class).show().addClass('open'); 11326 } else { 11327 $('#slide-out-widget-area'+$ocm_fullscreen_class).addClass('open').removeClass('hidden'); 11328 } 11329 11330 $offCanvasBG.addClass('open').removeClass('hidden'); 11331 11332 $('body > div[class*="body-border"]').css('z-index', '9995'); 11333 11334 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 11335 $('.off-canvas-menu-container .menu').transition({ 11336 y: '0px', 11337 'opacity': 1 11338 }, 0); 11339 } 11340 11341 if ($('.nectar-social.fixed').length == 0) { 11342 hideToTop(); 11343 } 11344 11345 if ($('#header-outer.transparent').length > 0) { 11346 11347 if ($bodyBorderTop.length > 0) { 11348 $('.admin-bar #slide-out-widget-area-bg'+$ocm_fullscreen_class).css({ 11349 'padding-top': ($bodyBorderTop.outerHeight(true) + 32) + 'px' 11350 }); 11351 $('body:not(.admin-bar) #slide-out-widget-area-bg'+$ocm_fullscreen_class).css({ 11352 'padding-top': ($bodyBorderTop.outerHeight(true)) + 'px' 11353 }); 11354 } 11355 } 11356 11357 // Set translateY to 0 in all cases 11358 $headerOuterEl.stop(true).css('transform', 'translateY(0)'); 11359 11360 if ($('#logo .starting-logo').length > 0 && 11361 $window.width() > 1000 && 11362 $('#header-outer[data-format="centered-menu-bottom-bar"].fixed-menu').length == 0 && 11363 $('body.material #header-outer[data-condense="true"]').length == 0 && 11364 $headerOuterEl.attr('data-transparent-header') == 'true' && 11365 !nectarDOMInfo.usingFrontEndEditor) { 11366 11367 $headerOuterEl.stop(true).css('transform', 'translateY(0)').addClass('transparent'); 11368 11369 } 11370 11371 $('.off-canvas-menu-container .clip-wrap').css('transition-duration', '0s'); 11372 11373 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 11374 11375 setTimeout(function () { 11376 11377 $('.off-canvas-menu-container .menu > li').each(function (i) { 11378 $(this).delay(i * 50).transition({ 11379 y: 0, 11380 'opacity': 1 11381 }, 750, 'easeOutCubic').addClass('no-pointer-events'); 11382 });
11383 11384 setTimeout(function () { 11385 $('.off-canvas-menu-container .menu > li').removeClass('no-pointer-events'); 11386 $('.off-canvas-menu-container .clip-wrap').css('transition-duration', '.45s'); 11387 }, 500); 11388 11389 $('#slide-out-widget-area.fullscreen-alt .widget').each(function (i) { 11390 $(this).delay(i * 100).transition({ 11391 y: 0, 11392 'opacity': 1 11393 }, 650, 'easeOutCubic'); 11394 }); 11395 11396 }, 200); 11397 11398 setTimeout(function () { 11399 $('#slide-out-widget-area .off-canvas-social-links').addClass('line-shown'); 11400 11401 $('#slide-out-widget-area .off-canvas-social-links li').css('opacity', '1').each(function (i) { 11402 $(this).delay(i * 50).transition({ 11403 'scale': 1 11404 }, 400, 'easeOutCubic'); 11405 }); 11406 $('#slide-out-widget-area .bottom-text').transition({ 11407 'opacity': 1 11408 }, 600, 'easeOutCubic'); 11409 }, 200); 11410 11411 } 11412 11413 // Fade In BG Overlay 11414 var $opacity = 0.4; 11415 11416 if ($offCanvasBG.hasClass('solid')) { 11417 $opacity = 1; 11418 } 11419 if ($offCanvasBG.hasClass('dark')) { 11420 $opacity = 0.97; 11421 } 11422 if ($offCanvasBG.hasClass('medium')) { 11423 $opacity = 0.6; 11424 } 11425 if ($offCanvasBG.hasClass('light')) { 11426 $opacity = 0.4; 11427 } 11428 $offCanvasBG.removeClass('no-transition'); 11429 11430 11431 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 11432 11433 $offCanvasBG.addClass('padding-removed').css({ 11434 'height': '100%', 11435 'width': '100%', 11436 'left': '0', 11437 'opacity': $opacity 11438 }); 11439 11440 // Overflow state 11441 OCM_overflowState(); 11442 11443 } 11444 11445 setTimeout(function () { 11446 $('.slide-out-widget-area-toggle > div > a').removeClass('animating'); 11447 }, 600); 11448 11449 11450 if ($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && 11451 $('.container-wrap').hasClass('no-scroll')) { 11452 $('#ajax-content-wrap').addClass('at-content'); 11453 } 11454 11455 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 11456 11457 var headerOffset = $headerOuterEl.offset().top - nectarDOMInfo.scrollTop + nectarDOMInfo.secondaryHeaderHeight; 11458 11459 $('#slide-out-widget-area'+$ocm_fullscreen_class+' .inner-wrap').css('padding-top', ($headerOuterEl.outerHeight() + headerOffset)); 11460 11461 } else { 11462 $('#slide-out-widget-area'+$ocm_fullscreen_class+' .inner-wrap').css('padding-top', $headerOuterEl.outerHeight()); 11463 } 11464 11465 } 11466 11467 11468 /** 11469 * Off canvas menu: fullscreen alt close. 11470 * 11471 * @since 10.5 11472 */ 11473 function OCM_fullscreenAltClose() { 11474 11475 var $ocm_fullscreen_class = ( $offCanvasEl.hasClass('fullscreen-alt') ) ? '.fullscreen-alt' : '.fullscreen-split'; 11476 11477 if ($('body.material').length > 0) { 11478 setTimeout(function () { 11479 $('header#top .slide-out-widget-area-toggle a').removeClass('menu-push-out'); 11480 }, 350); 11481 } 11482 11483 $('.slide-out-widget-area-toggle:not(.std-menu) .lines-button:not(.legacy-double)').removeClass('close'); 11484 11485 11486 $offCanvasBG.removeClass('open'); 11487 11488 if( $ocm_fullscreen_class === '.fullscreen-split' ) { 11489 setTimeout(function () { 11490 $offCanvasBG.addClass('hidden'); 11491 $('#slide-out-widget-area'+$ocm_fullscreen_class).addClass('hidden'); 11492 },600); 11493 } 11494 11495 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 11496 11497 $('.blurred-wrap').removeClass('blurred'); 11498 11499 $('#slide-out-widget-area.fullscreen-alt .widget').transition({ 11500 'opacity': 0 11501 }, 500, 'easeOutQuad', function () { 11502 $(this).transition({ 11503 y: '40px' 11504 }, 0); 11505 }); 11506 $('#slide-out-widget-area .bottom-text, #slide-out-widget-area .off-canvas-social-links li').transition({ 11507 'opacity': 0 11508 }, 250, 'easeOutQuad'); 11509 $('#slide-out-widget-area .off-canvas-social-links').removeClass('line-shown'); 11510 11511 $('.off-canvas-menu-container .menu').transition({ 11512 y: '-13px', 11513 'opacity': 0 11514 }, 400); 11515 11516 } 11517 11518 11519 setTimeout(function () { 11520 11521 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 11522 11523 $('.off-canvas-menu-container .menu > li').stop(true, true).transition({ 11524 y: '40px', 11525 'opacity': 0 11526 }, 0); 11527 $('#slide-out-widget-area .off-canvas-social-links li').transition({ 11528 'scale': 0 11529 }, 0); 11530 $('#slide-out-widget-area .off-canvas-social-links').removeClass('line-shown'); 11531 11532 // Close submenu items 11533 $('#slide-out-widget-area .menuwrapper .menu').removeClass('subview'); 11534 $('#slide-out-widget-area .menuwrapper .menu li').removeClass('subview subviewopen'); 11535 $('#slide-out-widget-area.fullscreen-alt .inner .menu-wrap').css('height', 'auto'); 11536 11537 $offCanvasBG.css({ 11538 'height': '1px', 11539 'width': '1px', 11540 'left': '-100%' 11541 });
11542 11543 } 11544 11545 if ($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && $('.container-wrap').hasClass('no-scroll')) { 11546 $('#ajax-content-wrap').removeClass('at-content'); 11547 } 11548 11549 if ($('.mobile #header-outer[data-permanent-transparent="false"]').length == 0) { 11550 $('#slide-out-widget-area'+$ocm_fullscreen_class+' .inner-wrap').css('padding-top', '0'); 11551 } 11552 11553 $('.slide-out-widget-area-toggle a').removeClass('animating'); 11554 11555 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 11556 $('#slide-out-widget-area'+$ocm_fullscreen_class).hide().removeClass('open'); 11557 } 11558 11559 }, 550); 11560 11561 if( $ocm_fullscreen_class === '.fullscreen-split' ) { 11562 $('#slide-out-widget-area'+$ocm_fullscreen_class).removeClass('open'); 11563 } 11564 11565 setTimeout(function () { 11566 if ($('.nectar-social.fixed').length == 0) { 11567 showToTop(); 11568 } 11569 }, 600); 11570 11571 // Fade out overlay 11572 setTimeout(function () { 11573 $offCanvasBG.removeClass('padding-removed'); 11574 }, 50); 11575 11576 11577 var borderDelay = ($bodyBorderHeaderColorMatch == true) ? 150 : 50; 11578 11579 setTimeout(function () { 11580 11581 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 11582 $offCanvasBG.stop(true).css({ 11583 'opacity': 0 11584 }); 11585 } 11586 if ($('#header-outer[data-transparent-header="true"]').length > 0) { 11587 $('body > div[class*="body-border"]').css('z-index', '10000'); 11588 } 11589 }, borderDelay); 11590 11591 setTimeout(function () { 11592 $('#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'); 11593 11594 if ($headerOuterEl.hasClass('pseudo-data-transparent')) { 11595 11596 $headerOuterEl.attr('data-transparent-header', 'false') 11597 .removeClass('pseudo-data-transparent') 11598 .removeClass('transparent'); 11599 } 11600 11601 }, 100); 11602 11603 } 11604 11605 11606 /** 11607 * Off canvas menu: simple dropdown open. 11608 * 11609 * @since 10.5 11610 */ 11611 function OCM_simpleDropdownOpen(classname) { 11612 11613 $('#mobile-menu').show(); 11614 11615 $('header#top').find('.'+classname+':not(.std-menu) .lines-button').addClass('close'); 11616 11617 if ($('body.material').length > 0) { 11618 $('header#top').find('.'+classname+' a').addClass('menu-push-out'); 11619 } 11620 11621 setTimeout(function () { 11622 $('header#top').find('.'+classname+' > div > a').removeClass('animating'); 11623 }, 100); 11624 11625 } 11626 11627 /** 11628 * Off canvas menu: simple dropdown close.
11629 * 11630 * @since 10.5 11631 */ 11632 function OCM_simpleDropdownClose(classname) { 11633 11634 $('#mobile-menu').hide(); 11635 11636 $('body').find('.'+classname+':not(.std-menu) .lines-button').removeClass('close'); 11637 11638 setTimeout(function () { 11639 if ($('body.material').length > 0) { 11640 $('header#top .'+classname+' a').removeClass('menu-push-out'); 11641 } 11642 $('body').find('.'+classname+' a').removeClass('animating'); 11643 }, 350); 11644 } 11645 11646 11647 /** 11648 * Off canvas menu: simple dropdown click events. 11649 * 11650 * @since 10.5 11651 */ 11652 function OCM_simpleStyleInit() { 11653 11654 if( $('#header-outer #mobile-menu').length == 0 ) { 11655 return; 11656 } 11657 11658 $('#header-outer #mobile-menu li.megamenu').removeClass('megamenu'); 11659 11660 // Add icons/markup. 11661 $('#header-outer #mobile-menu ul li a').each(function() { 11662 if( !$(this).hasClass('nectar-widget-link') && $(this).find('.nectar-ext-menu-item').length == 0 ) { 11663 $(this).wrapInner('<span></span>'); 11664 } 11665 }); 11666 11667 $('#header-outer #mobile-menu ul li').each(function(){ 11668 11669 if($(this).find('> ul').length > 0) { 11670 $(this).find('> a').append('<span class="sf-sub-indicator"><i class="fa fa-angle-down"></i></span>'); 11671 } 11672 11673 }); 11674 11675 // Click event. 11676 $('#header-outer #mobile-menu .sf-sub-indicator').on('click', function(){ 11677 11678 var $parentLI = $(this).parent().parent(); 11679 11680 $parentLI.toggleClass('current-open-item'); 11681 11682 // Open. 11683 if( $parentLI.hasClass('current-open-item') ) { 11684 $parentLI.find('> ul').show(); 11685 setTimeout(function(){ 11686 $parentLI.addClass('visible'); 11687 },30); 11688 } else { 11689 // Close. 11690 $parentLI.find('ul').hide(); 11691 // Ensure open children also close. 11692 $parentLI.find('li').removeClass('visible').removeClass('current-open-item'); 11693 $parentLI.removeClass('visible'); 11694 } 11695 11696 return false; 11697 11698 }); 11699 11700 // Resize event. 11701 $window.on('smartresize', function(){ 11702 11703 if( nectarDOMInfo.winW > 1000 && $('.slide-out-widget-area-toggle.mobile-icon a.open').length > 0 || 11704 nectarDOMInfo.winW > 1000 && $('.nectar-ocm-trigger-open.simple-mobile-menu a.open').length > 0) { 11705 11706 $('.slide-out-widget-area-toggle.mobile-icon a, .nectar-ocm-trigger-open.simple-mobile-menu a').addClass('non-human-allowed'); 11707 11708 11709 $('.slide-out-widget-area-toggle.mobile-icon a.open, .nectar-ocm-trigger-open.simple-mobile-menu a.open').trigger('click'); 11710 11711 setTimeout(function () { 11712 $('.slide-out-widget-area-toggle.mobile-icon a, .nectar-ocm-trigger-open.simple-mobile-menu a').removeClass('non-human-allowed'); 11713 }, 100); 11714 11715 } 11716 11717 }); 11718 11719 } 11720 11721 11722 /** 11723 * Off canvas menu click triggered styles initialization 11724 * 11725 * @since 10.5 11726 */ 11727 function OCM_clickTriggeredStylesInit() { 11728 11729 // Click triggered open bind. 11730 $body.on('click', '.slide-out-widget-area-toggle:not(.std-menu) a.closed:not(.animating), .nectar-ocm-trigger-open', function () { 11731 11732 if (nectarBoxRoll.animating == 'true' || $('.slide-out-from-right-hover').length > 0) { 11733 return false; 11734 } 11735 11736 $headerOuterEl.removeClass('no-transition'); 11737 11738 // Classic Mobile Direct Custom Link. 11739 if( $(this).hasClass('simple-mobile-menu')) { 11740 OCM_simpleDropdownOpen('simple-mobile-menu'); 11741 $(this).find('a').addClass('open'); 11742 return false; 11743 } 11744 11745 // Slide out from right. 11746 if ($offCanvasEl.hasClass('slide-out-from-right')) { 11747 OCM_slideOutRightOpen(); 11748 } 11749 // Fullscreen. 11750 else if ($offCanvasEl.hasClass('fullscreen')) { 11751 OCM_fullscreenOpen(); 11752 } 11753 // Fullscreen Alt. 11754 else if ($offCanvasEl.hasClass('fullscreen-alt') || $offCanvasEl.hasClass('fullscreen-split')) { 11755 OCM_fullscreenAltOpen(); 11756 } 11757 // Simple dropdown. 11758 else if( $('#header-outer #mobile-menu').length > 0 ) { 11759 OCM_simpleDropdownOpen('slide-out-widget-area-toggle'); 11760 } 11761 11762 11763 // Add open class 11764 if( $('#header-outer #mobile-menu').length == 0 ) { 11765 11766 $headerOuterEl 11767 .removeClass('side-widget-closed') 11768 .addClass('side-widget-open'); 11769 11770 11771 // Give header transparent state 11772 if ($('#header-outer[data-transparency-option="1"]').length > 0 && 11773 $('#boxed').length == 0 && 11774 $('#header-outer[data-full-width="true"]').length > 0 && 11775 !nectarDOMInfo.usingFrontEndEditor) { 11776
11777 if ($('body.material[data-slide-out-widget-area-style="slide-out-from-right"]').length == 0 && 11778 $('body.material #header-outer[data-condense="true"]').length == 0) { 11779 11780 $headerOuterEl.addClass('transparent'); 11781 11782 } 11783 11784 } 11785 11786 // Dark slide transparent nav 11787 if ($('#header-outer.dark-slide.transparent').length > 0 && 11788 $('#boxed').length == 0 && 11789 $('body.material-ocm-open').length == 0) { 11790 $headerOuterEl 11791 .removeClass('dark-slide') 11792 .addClass('temp-removed-dark-slide'); 11793 } 11794 11795 } // Not using simple OCM. 11796 11797 11798 $('.slide-out-widget-area-toggle:not(.simple-mobile-menu) > div > a') 11799 .removeClass('closed') 11800 .addClass('open') 11801 .attr('aria-expanded','true'); 11802 11803 $('.slide-out-widget-area-toggle:not(.simple-mobile-menu) > div > a').addClass('animating'); 11804 11805 return false; 11806 11807 }); 11808 11809 11810 11811 // Close event bind. 11812 $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) { 11813 11814 if (e.originalEvent == undefined && 11815 $('.slide_out_area_close.non-human-allowed').length == 0 && 11816 $('.slide-out-widget-area-toggle.mobile-icon a.non-human-allowed').length == 0) { 11817 return; 11818 } 11819 11820 if ($('.slide-out-widget-area-toggle:not(.std-menu) a.animating').length > 0) { 11821 return; 11822 } 11823 11824 $headerOuterEl.removeClass('no-transition'); 11825 11826 // Classic Mobile Direct Custom Link. 11827 if( $(this).parents('.simple-mobile-menu').length > 0 ) { 11828 OCM_simpleDropdownClose('simple-mobile-menu'); 11829 $(this).removeClass('open'); 11830 return false; 11831 } 11832 11833 $('.slide-out-widget-area-toggle:not(.std-menu):not(.simple-mobile-menu) a') 11834 .removeClass('open') 11835 .addClass('closed') 11836 .attr('aria-expanded','false'); 11837 11838 $('.slide-out-widget-area-toggle:not(.simple-mobile-menu):not(.std-menu) a') 11839 .addClass('animating'); 11840 11841 // Slide out from right. 11842 if ($offCanvasEl.hasClass('slide-out-from-right')) { 11843 OCM_slideOutRightClose(); 11844 } 11845 11846 // Fullscreen. 11847 else if ($offCanvasEl.hasClass('fullscreen')) { 11848 OCM_fullscreenClose(); 11849 } 11850 // Fullscreen alt. 11851 else if ($offCanvasEl.hasClass('fullscreen-alt') || $offCanvasEl.hasClass('fullscreen-split')) { 11852 OCM_fullscreenAltClose(); 11853 } 11854 // Simple dropdown. 11855 else if( $('#header-outer #mobile-menu').length > 0 ) { 11856 OCM_simpleDropdownClose('slide-out-widget-area-toggle'); 11857 } 11858 11859 if( $('#header-outer #mobile-menu').length == 0 ) { 11860 11861 // Dark slide transparent nav 11862 if ($('#header-outer.temp-removed-dark-slide.transparent').length > 0 && $('#boxed').length == 0) { 11863 $headerOuterEl 11864 .removeClass('temp-removed-dark-slide') 11865 .addClass('dark-slide'); 11866 } 11867 11868 // Remove header transparent state 11869 if ($('#header-outer[data-permanent-transparent="1"]').length == 0 && $('#slide-out-widget-area.fullscreen-alt').length == 0) { 11870 11871 if ($('.nectar-box-roll').length == 0) { 11872 if ($('#header-outer.small-nav').length > 0 || 11873 $('#header-outer.scrolled-down').length > 0) { 11874 $headerOuterEl.removeClass('transparent'); 11875 } 11876 } 11877 else { 11878 if ($('#header-outer.small-nav').length > 0 || 11879 $('#header-outer.scrolled-down').length > 0 || 11880 $('.container-wrap.auto-height').length > 0) { 11881 $headerOuterEl.removeClass('transparent'); 11882 } 11883 } 11884 11885 } 11886 11887 // Remove hidden menu 11888 $headerOuterEl.removeClass('hidden-menu'); 11889 11890 $headerOuterEl 11891 .removeClass('side-widget-open') 11892 .addClass('side-widget-closed'); 11893 11894 } // Not using simple OCM. 11895 11896 return false; 11897 11898 }); 11899 11900 } 11901 11902 11903 /** 11904 * Off canvas menu main initialization. 11905 * 11906 * @since 10.5 11907 */ 11908 function OCM_init() { 11909 11910 if ($('#slide-out-widget-area.slide-out-from-right-hover').length > 0) { 11911 OCM_slideOutRightHoverInit(); 11912 } else { 11913 OCM_clickTriggeredStylesInit(); 11914 OCM_simpleStyleInit(); 11915 } 11916 11917 11918 if ($('#slide-out-widget-area.fullscreen-split').length == 0 &&
11919 $('body.material[data-slide-out-widget-area-style*="slide-out-from-right"]').length == 0 && 11920 $('#slide-out-widget-area[data-dropdown-func="separate-dropdown-parent-link"]').length == 0) { 11921 11922 fullscreenMenuInit(); 11923 11924 } else if ($('body.using-mobile-browser[data-slide-out-widget-area-style="slide-out-from-right-hover"]').length > 0) { 11925 11926 // Close OCM on mobile when clicking anchor on same page 11927 $('body #slide-out-widget-area .inner .off-canvas-menu-container li a[href*="#"]').on('click', function () { 11928 if ($(this).attr('href') != '#') { 11929 OCM_close($(this).parent()); 11930 } 11931 11932 }); 11933 11934 } 11935 11936 // Page fullscreen row close OCM fullscreen/classic slide out from right 11937 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) ) { 11938 11939 $('body #slide-out-widget-area .inner .off-canvas-menu-container li a[href]').on('click', function () { 11940 11941 var $link_href = ($(this).is('[href*="#"]')) ? $(this).attr('href') : ''; 11942 if ($link_href != '#' && $('div[data-fullscreen-anchor-id="' + $link_href.substr($link_href.indexOf("#") + 1) + '"]').length > 0) { 11943 11944 setTimeout(function () { 11945 11946 $('#slide-out-widget-area .slide_out_area_close') 11947 .addClass('non-human-allowed') 11948 .trigger('click'); 11949 11950 }, 100); 11951 11952 setTimeout(function () { 11953 $('#slide-out-widget-area .slide_out_area_close').removeClass('non-human-allowed'); 11954 }, 150); 11955 11956 } 11957 11958 }); 11959 } 11960 11961 11962 // Submenu link hover fix 11963 $body.on('mouseover', '#slide-out-widget-area .off-canvas-menu-container .menuwrapper > .sub-menu li > a', function () { 11964 var $currentTxt = $(this).text(); 11965 $('.off-canvas-menu-container .menuwrapper .menu li > a').removeClass('hovered'); 11966 $('.off-canvas-menu-container .menuwrapper .menu li > a:contains(' + $currentTxt + ')').addClass('hovered'); 11967 }); 11968 11969 $body.on('mouseover', '.off-canvas-menu-container .menuwrapper .menu li > a', function () { 11970 $('.off-canvas-menu-container .menuwrapper .menu li > a').removeClass('hovered'); 11971 }); 11972 11973 11974 // Bind mousewheel. 11975 setTimeout(OCM_scrolling, 500); 11976 11977 // Handle mobile scrolling. 11978 if (nectarDOMInfo.usingMobileBrowser) { 11979 $offCanvasEl.addClass('mobile'); 11980 } 11981 11982 11983 } 11984 11985 11986 11987 11988 /** 11989 * Off canvas menu scrolling. 11990 * 11991 * @since 10.5 11992 */ 11993 function OCM_scrolling() { 11994 11995 $offCanvasEl.mousewheel(function (event, delta) { 11996 11997 this.scrollTop -= (event.deltaY * event.deltaFactor)/1.5; 11998 11999 event.preventDefault(); 12000 }); 12001 12002 } 12003 12004 12005 12006 /** 12007 * Off canvas menu close. 12008 * 12009 * @since 10.5 12010 */ 12011 function OCM_close(item) { 12012 12013 if ($('#slide-out-widget-area.open').length > 0) { 12014 12015 var $windowCurrentLocation = window.location.href.split("#")[0]; 12016 var $windowClickedLocation = item.find('> a').attr('href').split("#")[0]; 12017 12018 if ($windowCurrentLocation == $windowClickedLocation || item.find('a[href^="#"]').length > 0) { 12019 if (item.parents('.slide-out-from-right-hover').length > 0) { 12020 $('.slide-out-widget-area-toggle.slide-out-hover-icon-effect a').trigger('click'); 12021 } else { 12022 $('.slide-out-widget-area-toggle a').trigger('click'); 12023 } 12024 12025 } 12026 } 12027 12028 } 12029 12030 12031 12032 12033 /** 12034 * Click based submenus. 12035 * 12036 * Used by left header layout and off canvas menu. 12037 * 12038 * @since 10.5 12039 */ 12040 function clickToggleSubmenus() { 12041 12042 if (!$('#header-outer[data-format="left-header"]').length > 0 && 12043 !$('body.material[data-slide-out-widget-area-style*="slide-out-from-right"]').length > 0 && 12044 !$('#slide-out-widget-area.fullscreen-split').length > 0 && 12045 !$('#slide-out-widget-area[data-dropdown-func="separate-dropdown-parent-link"]').length > 0) { 12046 return; 12047 } 12048 12049 // Remove megamenu class. 12050 $('#header-outer[data-format="left-header"] nav li.megamenu').removeClass('nectar-megamenu-menu-item').removeClass('megamenu'); 12051 12052 var $ocm_link_selector; 12053 12054 if ($('#slide-out-widget-area[data-dropdown-func="separate-dropdown-parent-link"]').length > 0) { 12055 $ocm_link_selector = '#slide-out-widget-area .off-canvas-menu-container li.menu-item-has-children > .ocm-dropdown-arrow'; 12056 } else { 12057 $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'; 12058 } 12059 12060 var left_header_selector = '#header-outer[data-format="left-header"] nav li.menu-item-has-children > a'; 12061 var lh_dropdown_func = ( window.nectarOptions && window.nectarOptions.left_header_dropdown_func ) ? window.nectarOptions.left_header_dropdown_func : 'default'; 12062 if( lh_dropdown_func === 'separate-dropdown-parent-link' ) { 12063 left_header_selector = '#header-outer[data-format="left-header"] nav li.menu-item-has-children > a .sf-sub-indicator'; 12064 } 12065 12066 // Click event. 12067 $(left_header_selector + ', ' + $ocm_link_selector).on('click', function () { 12068 12069 var $parentSelector = $(this).parent(); 12070 if( lh_dropdown_func === 'separate-dropdown-parent-link' ) { 12071 $parentSelector = $(this).closest('.menu-item'); 12072 } 12073 12074 if ($parentSelector.hasClass('open-submenu')) { 12075 $parentSelector.find('.sub-menu').css({ 12076 'max-height': '0' 12077 });
12078 $parentSelector.removeClass('open-submenu'); 12079 } else { 12080 12081 // Get max height. 12082 var $that = $(this); 12083 var $maxSubMenuHeight; 12084 12085 $parentSelector 12086 .find('> .sub-menu') 12087 .addClass('no-trans'); 12088 12089 setTimeout(function () { 12090 12091 $parentSelector.find('> .sub-menu').css({ 12092 'max-height': 'none', 12093 'position': 'absolute', 12094 'visibility': 'hidden' 12095 }); 12096 12097 $maxSubMenuHeight = $parentSelector.find('> .sub-menu').height(); 12098 12099 $parentSelector 12100 .find('> .sub-menu') 12101 .removeClass('no-trans'); 12102 12103 $parentSelector.find('> .sub-menu').css({ 12104 'max-height': '0', 12105 'position': 'relative', 12106 'visibility': 'visible' 12107 }); 12108 12109 }, 25); 12110 12111 setTimeout(function () { 12112 12113 // Reset Max Height. 12114 $that.closest('ul') 12115 .find('li.menu-item-has-children') 12116 .removeClass('open-submenu'); 12117 12118 $that.closest('ul').find('li.menu-item-has-children > .sub-menu').css({ 12119 'max-height': '0' 12120 });
12121 12122 $parentSelector.addClass('open-submenu'); 12123 12124 $parentSelector 12125 .find('> .sub-menu') 12126 .css('max-height', $maxSubMenuHeight); 12127 12128 // Add height to open parents. 12129 if ($that.parents('ul').length > 0) { 12130 12131 $that.parents('ul:not(.sf-menu)').each(function () { 12132 $(this).css('max-height'); 12133 $(this).css('max-height', parseInt($(this).height() + parseInt($(this).css('padding-top')) * 2 + $maxSubMenuHeight) + 'px'); 12134 }); 12135 } 12136 12137 12138 }, 50); 12139 } 12140 12141 return false; 12142 12143 }); 12144 12145 // Start open for current page items. 12146 if($('#header-outer[data-format="left-header"] nav .sf-menu > .current-menu-ancestor.menu-item-has-children > ul > li.current-menu-item').length > 0) { 12147 12148 if( lh_dropdown_func === 'separate-dropdown-parent-link' ) { 12149 $('#header-outer[data-format="left-header"] nav .sf-menu > .current-menu-ancestor.menu-item-has-children > a .sf-sub-indicator').trigger('click'); 12150 } else { 12151 $('#header-outer[data-format="left-header"] nav .sf-menu > .current-menu-ancestor.menu-item-has-children > a').trigger('click'); 12152 } 12153 12154 } 12155 12156 12157 } 12158 12159 12160 12161 12162 12163 12164 12165 12166 /** 12167 * DLMenu - plugin used for submenus in off canvas menu. 12168 * 12169 * @since 6.0 12170 */ 12171 $.DLMenu = function (options, element) { 12172 this.$el = $(element); 12173 this._init(options); 12174 }; 12175 12176 // the options 12177 $.DLMenu.defaults = { 12178 // classes for the animation effects 12179 animationClasses: { 12180 classin: 'dl-animate-in-1', 12181 classout: 'dl-animate-out-1' 12182 }, 12183 onLevelClick: function () { 12184 return false; 12185 }, 12186 onLinkClick: function () { 12187 return false; 12188 } 12189 }; 12190 12191 $.DLMenu.prototype = { 12192 _init: function (options) { 12193 12194 // options 12195 this.options = $.extend(true, {}, $.DLMenu.defaults, options); 12196 this._config(); 12197 12198 var animEndEventNames = { 12199 'WebkitAnimation': 'webkitAnimationEnd', 12200 'OAnimation': 'oAnimationEnd', 12201 'msAnimation': 'MSAnimationEnd', 12202 'animation': 'animationend' 12203 }, 12204 transEndEventNames = { 12205 'WebkitTransition': 'webkitTransitionEnd', 12206 'MozTransition': 'transitionend', 12207 'OTransition': 'oTransitionEnd', 12208 'msTransition': 'MSTransitionEnd', 12209 'transition': 'transitionend' 12210 }; 12211 // animation end event name 12212 this.animEndEventName = animEndEventNames['animation'] + '.menu'; 12213 // transition end event name 12214 this.transEndEventName = transEndEventNames['transition'] + '.menu', 12215 // support for css animations and css transitions 12216 this.supportAnimations = true, 12217 this.supportTransitions = true; 12218 this._initEvents(); 12219 12220 }, 12221 _config: function () { 12222 this.open = false; 12223 this.$trigger = this.$el.children('.trigger'); 12224 this.$menu = this.$el.children('ul.menu'); 12225 this.$menuitems = this.$menu.find('li:not(.back) > a'); 12226 12227 this.$el.find('ul.sub-menu') 12228 .prepend('<li class="back"><a href="#"> ' + $offCanvasEl.attr('data-back-txt') + ' </a></li>'); 12229 12230 this.$back = this.$menu.find('li.back'); 12231 }, 12232 _initEvents: function () { 12233 12234 var self = this; 12235 12236 this.$trigger.on('click.menu', function () { 12237 12238 if (self.open) { 12239 self._closeMenu(); 12240 } else { 12241 self._openMenu(); 12242 } 12243 return false; 12244 12245 }); 12246 12247 this.$menuitems.on('click.menu', function (event) { 12248 12249 12250 var $item = $(this).parent('li'), 12251 $submenu = $item.children('ul.sub-menu'); 12252 12253 $('.fullscreen-alt .off-canvas-menu-container .clip-wrap, .fullscreen-alt .off-canvas-menu-container .clip-wrap span').css('transition-duration', '0s'); 12254 12255 if ($submenu.length > 0) { 12256 12257 var $flyin = $submenu.clone().css('opacity', 0).insertAfter(self.$menu), 12258 onAnimationEndFn = function () { 12259 self.$menu.off(self.animEndEventName).removeClass(self.options.animationClasses.classout).addClass('subview'); 12260 $item.addClass('subviewopen').parents('.subviewopen:first').removeClass('subviewopen').addClass('subview'); 12261 $flyin.remove(); 12262 setTimeout(function () { 12263 $('.off-canvas-menu-container .menu > li').removeClass('no-pointer-events'); 12264 $('.off-canvas-menu-container .clip-wrap, .off-canvas-menu-container .clip-wrap span').css('transition-duration', '.45s'); 12265 }, 300); 12266 12267 }; 12268 12269 setTimeout(function () { 12270 $flyin.addClass(self.options.animationClasses.classin); 12271 self.$menu.addClass(self.options.animationClasses.classout); 12272 if (self.supportAnimations) { 12273 self.$menu.on(self.animEndEventName, onAnimationEndFn); 12274 } else { 12275 onAnimationEndFn.call(); 12276 } 12277 12278 self.options.onLevelClick($item, $item.children('a:first').text()); 12279 });
12280 12281 12282 $item.parents('.menu-wrap').css('height', $item.parents('.off-canvas-menu-container').find('.menuwrapper .menu').height()).transition({ 12283 'height': $flyin.height() 12284 }, 500, 'easeInOutQuad'); 12285 12286 setTimeout(OCM_overflowState,600); 12287 12288 return false; 12289 12290 } else { 12291 12292 self.options.onLinkClick($item.find('> a'), event); 12293 } 12294 12295 OCM_close($item); 12296 12297 }); 12298 12299 12300 12301 this.$back.on('click.menu', function () { 12302 12303 var $this = $(this), 12304 $submenu = $this.parents('ul.sub-menu:first'), 12305 $item = $submenu.parent(), 12306 $flyin = $submenu.clone().insertAfter(self.$menu); 12307 12308 var onAnimationEndFn = function () { 12309 self.$menu.off(self.animEndEventName).removeClass(self.options.animationClasses.classin); 12310 $flyin.remove(); 12311 }; 12312 12313 setTimeout(function () { 12314 $flyin.addClass(self.options.animationClasses.classout); 12315 self.$menu.addClass(self.options.animationClasses.classin); 12316 if (self.supportAnimations) { 12317 self.$menu.on(self.animEndEventName, onAnimationEndFn); 12318 } else { 12319 onAnimationEndFn.call(); 12320 } 12321 12322 $item.removeClass('subviewopen'); 12323 12324 var $subview = $this.parents('.subview:first'); 12325 if ($subview.is('li')) { 12326 $subview.addClass('subviewopen'); 12327 } 12328 $subview.removeClass('subview'); 12329 }); 12330 12331 12332 12333 setTimeout(function () { 12334 $item.parents('.menu-wrap').transition({ 12335 'height': $item.parent().height() 12336 }, 500, 'easeInOutQuad'); 12337 setTimeout(OCM_overflowState,600); 12338 }, 50); 12339 12340 12341 return false; 12342 12343 }); 12344 12345 }, 12346 closeMenu: function () { 12347 if (this.open) { 12348 this._closeMenu(); 12349 } 12350 }, 12351 _closeMenu: function () { 12352 var self = this, 12353 onTransitionEndFn = function () { 12354 self.$menu.off(self.transEndEventName); 12355 self._resetMenu(); 12356 }; 12357 12358 this.$menu.removeClass('menuopen'); 12359 this.$menu.addClass('menu-toggle'); 12360 this.$trigger.removeClass('active'); 12361 12362 if (this.supportTransitions) { 12363 this.$menu.on(this.transEndEventName, onTransitionEndFn); 12364 } else { 12365 onTransitionEndFn.call(); 12366 } 12367 12368 this.open = false; 12369 }, 12370 openMenu: function () { 12371 if (!this.open) { 12372 this._openMenu(); 12373 } 12374 }, 12375 _openMenu: function () { 12376 var self = this; 12377 $body.off('click').on('click.menu', function () { 12378 self._closeMenu(); 12379 }); 12380 this.$menu.addClass('menuopen menu-toggle').on(this.transEndEventName, function () { 12381 $(this).removeClass('menu-toggle'); 12382 }); 12383 this.$trigger.addClass('active'); 12384 this.open = true; 12385 }, 12386 _resetMenu: function () { 12387 this.$menu.removeClass('subview'); 12388 this.$menuitems.removeClass('subview subviewopen'); 12389 } 12390 }; 12391 12392 var logError = function (message) { 12393 if (window.console) { 12394 window.console.error(message); 12395 } 12396 }; 12397 12398 $.fn.dlmenu = function (options) { 12399 if (typeof options === 'string') { 12400 var args = Array.prototype.slice.call(arguments, 1); 12401 this.each(function () { 12402 var instance = $.data(this, 'menu'); 12403 if (!instance) { 12404 logError("cannot call methods on menu prior to initialization; " + 12405 "attempted to call method '" + options + "'"); 12406 return; 12407 } 12408 if (!$.isFunction(instance[options]) || options.charAt(0) === "_") { 12409 logError("no such method '" + options + "' for menu instance"); 12410 return; 12411 } 12412 instance[options].apply(instance, args); 12413 }); 12414 } else { 12415 this.each(function () { 12416 var instance = $.data(this, 'menu'); 12417 if (instance) { 12418 instance._init(); 12419 } else { 12420 instance = $.data(this, 'menu', new $.DLMenu(options, this)); 12421 } 12422 }); 12423 } 12424 return this; 12425 }; 12426 12427 12428 /** 12429 * Initialize DL menu. 12430 * 12431 * @since 6.0 12432 */ 12433 function fullscreenMenuInit() { 12434 12435 $('#slide-out-widget-area .off-canvas-menu-container .menu').wrap('<div class="menu-wrap menuwrapper" />'); 12436 $('#slide-out-widget-area .off-canvas-menu-container .menu').addClass('menuopen'); 12437 12438 var $ocmAnimationClassNum = ($('#slide-out-widget-area.fullscreen-alt').length > 0) ? '4' : '5'; 12439 $('#slide-out-widget-area .off-canvas-menu-container .menu-wrap').dlmenu({ 12440 animationClasses: { 12441 classin: 'dl-animate-in-' + $ocmAnimationClassNum, 12442 classout: 'dl-animate-out-' + $ocmAnimationClassNum 12443 } 12444 });
12445 12446 } 12447 12448 12449 12450 12451 12452 12453 12454 12455 12456 /** 12457 * Set the page header height when using "slide down" theme option effect. 12458 * 12459 * @since 2.0 12460 */ 12461 function pageHeaderSlideInHeight() { 12462 12463 var pageHeaderHeight = parseInt($pageHeaderBG.height()); 12464 $('body[data-aie="slide-down"] #page-header-wrap:not(.fullscreen-header):not([data-responsive="true"])').css('height', pageHeaderHeight + 'px'); 12465 12466 } 12467 12468 12469 /** 12470 * Fired after page header image has loaded. 12471 * 12472 * @since 2.0 12473 */ 12474 function pageHeaderAfterLoad() { 12475 12476 //fade in header 12477 if ($('#ajax-content-wrap').length == 0 || !$body.hasClass('ajax-loaded')) { 12478 $('#page-header-bg[data-parallax="1"]').animate({ 12479 'opacity': 1 12480 }, 350, 'easeInCubic'); 12481 } else if ($('#ajax-content-wrap').length == 1) { 12482 $('#page-header-bg[data-parallax="1"]').css({ 12483 'opacity': 1 12484 }); 12485 } 12486 12487 $('#page-header-bg[data-parallax="1"] .nectar-particles').append('<div class="fade-out" />'); 12488 12489 } 12490 12491 12492 12493 /** 12494 * Page header unload event. 12495 * 12496 * @since 2.0 12497 */ 12498 function pageHeaderUnload() { 12499 12500 if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1 || navigator.userAgent.match(/(iPod|iPhone|iPad)/)) { 12501 window.onunload = function () { 12502 12503 pageHeaderInit(); 12504 12505 $('#page-header-bg[data-parallax="1"] .span_6').css({ 12506 'opacity': 1 12507 }); 12508 12509 }; 12510 } 12511 12512 } 12513 12514 12515 /** 12516 * Page header initialization. 12517 * 12518 * @since 2.0 12519 */ 12520 function pageHeaderInit() { 12521 12522 var pageHeaderState = { 12523 inView: true 12524 } 12525 12526 var $pageHeaderInnerEl = $('#page-header-bg .span_6 .inner-wrap'); 12527 var $pageHeaderCanvasEl = $('#page-header-bg #canvas'); 12528 12529 if ($('#page-header-bg[data-parallax="1"]').length > 0) { 12530 12531 // Fade in 12532 var img = new Image(), 12533 pageHeaderHeight = parseInt($pageHeaderBG.height()), 12534 headerSpaceHeight = $('#header-space').height(), 12535 globalTopSectionHeight = ($('.nectar-global-section.after-nav').length > 0) ? $('.nectar-global-section.after-nav').height() : 0, 12536 $initialImgCheck = extractUrl($('#page-header-bg[data-parallax="1"]').css('background-image')); 12537 12538 if ($initialImgCheck && $initialImgCheck.indexOf('.') !== -1) { 12539 img.onload = function () { 12540 pageHeaderAfterLoad(); 12541 }; 12542 12543 img.src = extractUrl($('#page-header-bg[data-parallax="1"]').css('background-image')); 12544 12545 } else { 12546 pageHeaderAfterLoad(); 12547 } 12548 12549 12550 if ($('body[data-hhun="1"]').length > 0 && !$('#header-outer[data-remove-fixed="1"]').length > 0) { 12551 $headerOuterEl.addClass('parallax-contained'); 12552 } 12553 12554 // Calculate on scroll. 12555 if( nectarDOMInfo.winW > 1000 ) { 12556 parallaxPageHeaderCalc(); 12557 } 12558 window.addEventListener('scroll', function () { 12559 if( nectarDOMInfo.winW > 1000 ) { 12560 window.requestAnimationFrame(parallaxPageHeaderCalc); 12561 } 12562 }, false); 12563 12564 } 12565 12566 var $pt_timeout = ($('body[data-ajax-transitions="true"]').length > 0 && $('#page-header-bg[data-animate-in-effect="slide-down"]').length > 0) ? 350 : 0; 12567 12568 if ($pageHeaderBG.length > 0) { 12569 12570 // Slide in height effect. 12571 setTimeout(function () { 12572 pageHeaderSlideInHeight(); 12573 }, $pt_timeout); 12574 12575 $('#page-header-bg[data-animate-in-effect="fade-in"]').addClass('loaded'); 12576 12577 // Using bg classname. 12578 var $initialImgCheckAscend = extractUrl($pageHeaderBG.css('background-image')); 12579 if ($initialImgCheckAscend && $initialImgCheckAscend.indexOf('.') !== -1) { 12580 $pageHeaderBG.addClass('has-bg'); 12581 } 12582 12583 // Resize slide in height. 12584 $window.on('smartresize',pageHeaderSlideInHeight); 12585 12586 } 12587 12588 12589 function parallaxPageHeaderCalc() { 12590 12591 var $multiplier = 0.15; 12592 12593 if (nectarDOMInfo.winW >= 1000 && 12594 navigator.userAgent.match(/iPad/i) == null && 12595 nectarState.materialOffCanvasOpen != true ) { 12596 12597 // Calc parallax. 12598 if (pageHeaderState.inView == true) { 12599 12600 $pageHeaderInnerEl.css({ 12601 'transform': 'translateY(' + nectarDOMInfo.scrollTop * $multiplier + 'px)', 12602 'opacity': 1 - (nectarDOMInfo.scrollTop / ((globalTopSectionHeight + pageHeaderHeight)*.7)) 12603 });
12604 12605 if( $pageHeaderCanvasEl ) { 12606 $pageHeaderCanvasEl.css({ 12607 'transform': 'translateY(' + nectarDOMInfo.scrollTop * $multiplier*2 + 'px)' 12608 }); 12609 } 12610 12611 } 12612 12613 // Hide elements to allow other parallax sections to work in webkit browsers. 12614 if ((nectarDOMInfo.scrollTop / (pageHeaderHeight + headerSpaceHeight + nectarDOMInfo.adminBarHeight)) > 1) { 12615 pageHeaderState.inView = false; 12616 $('.nectar-particles, #page-header-bg .fade-out').css('visibility', 'hidden').addClass('out-of-sight'); 12617 $('#page-header-bg').addClass('out-of-sight'); 12618 } 12619 else { 12620 pageHeaderState.inView = true; 12621 $('#page-header-bg, .nectar-particles, #page-header-bg .fade-out').css('visibility', 'visible').removeClass('out-of-sight'); 12622 } 12623 12624 } 12625 12626 } 12627 12628 if ($pageHeaderBG.length > 0) { 12629 12630 // Bind unload event 12631 pageHeaderUnload(); 12632 12633 // Initialize text effects. 12634 if( $('.nectar-box-roll').length == 0 ) { 12635 pageHeaderTextEffectInit(); 12636 } 12637 12638 } 12639 12640 } 12641 12642 12643 12644 12645 12646 12647 12648 /** 12649 * Page header text effect markup creation. 12650 * 12651 * @since 6.0 12652 */ 12653 function pageHeaderTextEffectMarkup() { 12654 12655 $pageHeaderBG.each(function () { 12656 12657 if ($(this).attr('data-text-effect') == 'rotate_in') { 12658 12659 var $topHeading = 'none'; 12660 12661 if ($(this).find('.span_6 h1').length > 0) { 12662 $topHeading = 'h1'; 12663 } 12664 12665 if ($topHeading != 'none') { 12666 12667 var $selector = ($(this).find('.nectar-particles').length > 0) ? '.inner-wrap.shape-1' : '.span_6'; 12668 12669 $(this).find($selector).find($topHeading).addClass('top-heading').contents().filter(function () { 12670 return this.nodeType === 3 && typeof this.data != 'undefined' && this.data.replace(/\s+/, ""); 12671 }).wrap('<span class="wraped"></span>'); 12672 12673 $(this).find($selector).find('.wraped').each(function () { 12674 12675 var textNode = $(this), 12676 text = textNode.text().split(' '), 12677 replace = ''; 12678 12679 $.each(text, function (index, value) { 12680 if (value.replace(/\s+/, "")) { 12681 replace += '<span class="wraped"><span>' + value + '</span></span> '; 12682 } 12683 }); 12684 12685 textNode.replaceWith($(replace)); 12686 12687 });
12688 12689 } 12690 12691 } 12692 12693 }); 12694 12695 } 12696 12697 12698 /** 12699 * Page header text effect animation. 12700 * 12701 * @since 6.0 12702 */ 12703 function pageHeaderTextEffect() { 12704 12705 if ($('#page-header-bg .nectar-particles').length == 0 && $('#page-header-bg[data-text-effect="none"]').length == 0 || 12706 $('.nectar-box-roll').length > 0 && $('#page-header-bg .nectar-particles').length == 0) { 12707 12708 var $selector = ($('.nectar-box-roll').length == 0) ? '#page-header-bg .span_6' : '.nectar-box-roll .overlaid-content .span_6'; 12709 12710 $($selector).find('.wraped').each(function (i) { 12711 $(this).find('span').delay(i * 370).transition({ 12712 rotateX: '0', 12713 'opacity': 1, 12714 y: 0 12715 }, 400, 'easeOutQuad'); 12716 }); 12717 12718 setTimeout(function () { 12719 12720 $($selector).find('.inner-wrap > *:not(.top-heading)').each(function (i) { 12721 $(this).delay(i * 370).transition({ 12722 rotateX: '0', 12723 'opacity': 1, 12724 y: 0 12725 }, 650, 'easeOutQuad'); 12726 }); 12727 12728 $('.scroll-down-wrap, .scroll-down-wrap .section-down-arrow').removeClass('hidden'); 12729 12730 }, $($selector).find('.wraped').length * 370); 12731 } 12732 12733 } 12734 12735 12736 /** 12737 * Page header text effect initialization. 12738 * 12739 * @since 6.0 12740 */ 12741 function pageHeaderTextEffectInit() { 12742 12743 pageHeaderTextEffectMarkup(); 12744 12745 var $effectTimeout = ($loadingScreenEl.length > 0) ? 800 : 0; 12746 12747 if ($('#page-header-bg .nectar-video-wrap video').length == 0) { 12748 setTimeout(pageHeaderTextEffect, $effectTimeout); 12749 } 12750 12751 } 12752 12753 12754 12755 12756 12757 12758 12759 /** 12760 * Permanent transparent header effect. 12761 * 12762 * @since 6.0 12763 */ 12764 function midnightInit() { 12765 12766 if ($('#header-outer[data-permanent-transparent="1"]').length > 0 && 12767 $('body[data-bg-header="true"]').length > 0) { 12768 12769 12770 // Pages that set no midnight coloring. 12771 if ($('.container-wrap div[data-midnight]').length == 0) { 12772 $('.container-wrap').attr('data-midnight', 'dark'); 12773 } 12774 12775 //// Cache midnight compat divs. 12776 var $midnightCompatArr = []; 12777 $('div[data-midnight]').each(function () { 12778 12779 if ($(this).attr('data-midnight') == 'light' && $(this).parents('.pum-content').length == 0 || 12780 $(this).attr('data-midnight') == 'dark' && $(this).parents('.pum-content').length == 0) { 12781 12782 if( $(this).is('#page-header-bg') && $(this).parents('#page-header-wrap[data-midnight]').length > 0 ) { 12783 // skip. 12784 } else { 12785 $midnightCompatArr.push($(this)); 12786 } 12787 12788 } 12789 12790 }); 12791 12792 12793 if ($midnightCompatArr.length > 0) { 12794 12795 $.each($midnightCompatArr, function (k, v) { 12796 12797 if (v.attr('data-midnight') == 'light' || v.attr('data-midnight') == 'dark') { 12798 12799 var $that = v; 12800 var waypoint = new Waypoint({ 12801 element: $that, 12802 handler: function (direction) { 12803 12804 12805 if ($('body.material-ocm-open').length > 0 || $that.css('display') == 'none' ) { 12806 return; 12807 } 12808 12809 12810 var $textColor; 12811 12812 if (direction == 'down') { 12813 $textColor = ($that.attr('data-midnight') == 'light') ? '' : 'dark-slide'; 12814 $headerOuterEl.removeClass('dark-slide').addClass($textColor); 12815 12816 } else { 12817 12818 var $prevMidItem; 12819 12820 if (k - 1 >= 0) { 12821 $prevMidItem = k - 1; 12822 } else { 12823 $prevMidItem = k; 12824 } 12825 12826 $textColor = ($midnightCompatArr[$prevMidItem].attr('data-midnight') == 'light') ? '' : 'dark-slide'; 12827 $headerOuterEl.removeClass('dark-slide').addClass($textColor); 12828 12829 } 12830 12831 }, 12832 offset: $headerOuterEl.height() 12833 12834 }); 12835 12836 } 12837 12838 }); 12839 12840 } 12841 12842 } 12843 12844 12845 } 12846 12847 12848 12849 12850 /** 12851 * Box roll header effect initialization. 12852 * 12853 * @since 6.0 12854 */ 12855 function nectarBoxRollInit() { 12856 if ($('.nectar-box-roll').length > 0 && typeof NectarBoxRoll !== 'undefined') { 12857 12858 pageHeaderTextEffectInit(); 12859 12860 // listen for emits. 12861 $(window).on('nectar-box-roll-scroll-disabled', function() { 12862 nectarState.preventScroll = true; 12863 });
12864 $(window).on('nectar-box-roll-scroll-enabled', function() { 12865 nectarState.preventScroll = false; 12866 }); 12867 12868 nectarBoxRoll = new NectarBoxRoll(nectarDOMInfo, waypoints, midnightInit, pageLoadHash, resizeVideoToCover); 12869 12870 } 12871 } 12872 12873 12874 12875 12876 /** 12877 * Create all waypoints. 12878 * 12879 * @since 6.0 12880 */ 12881 function waypoints() { 12882 rowBGAnimations(); 12883 columnBGAnimations(); 12884 colAndImgAnimations(); 12885 progressBars(); 12886 dividers(); 12887 iconList(); 12888 animatedTitles(); 12889 highlightedText(); 12890 imageWithHotspots(); 12891 clientsFadeIn(); 12892 splitLineHeadings(); 12893 svgAnimations(); 12894 milestoneInit(); 12895 nectarFancyUlInit(); 12896 owl_carousel_animate(); 12897 headerRowColorInheritInit(); 12898 morphingOutlines(); 12899 animatedColBorders(); 12900 wooProductCarouselAnimations(); 12901 foodMenuItems(); 12902 vcWaypoints(); 12903 NectarPostGridWaypoint(); 12904 nectarRotatingWordsInit(); 12905 } 12906 12907 12908 12909 /** 12910 * Salient page builder elements initialization. 12911 * 12912 * @since 10.5 12913 */ 12914 function salientPageBuilderElInit() { 12915 flexsliderInit(); 12916 flickityLazyInit(); 12917 setTimeout(flickityInit, 100); 12918 twentytwentyInit(); 12919 standardCarouselInit(); 12920 productCarouselInit(); 12921 clientsCarouselInit(); 12922 carouselfGrabbingClass(); 12923 setTimeout(tabbedInit, 60); 12924 accordionInit(); 12925 accordionClickEvents(); 12926 largeIconHover(); 12927 nectarIconMatchColoring(); 12928 coloredButtons(); 12929 ctaLinkBG(); 12930 teamMemberFullscreen(); 12931 flipBoxInit(); 12932 owlCarouselInit(); 12933 mouseParallaxInit(); 12934 ulCheckmarks(); 12935 nectarFancyUlIcons(); 12936 nectarFancyBoxHover(); 12937 nectarVideoLightbox(); 12938 nectarKeyframeAssist(); 12939 morphingOutlinesInit(); 12940 nectarPostGridInit(); 12941 cascadingImageInit(); 12942 imageWithHotspotEvents(); 12943 pricingTableHeight(); 12944 pageSubmenuInit(); 12945 nectarLiquidBGs(); 12946 nectarTestimonialSliders(); 12947 nectarTestimonialSlidersEvents(); 12948 recentPostsTitleOnlyEqualHeight(); 12949 recentPostsInit(); 12950 parallaxItemHoverEffect(); 12951 fsProjectSliderInit(); 12952 postMouseEvents(); 12953 masonryPortfolioInit(); 12954 masonryBlogInit(); 12955 portfolioCustomColoring(); 12956 searchResultMasonryInit(); 12957 stickySidebarInit(); 12958 portfolioSidebarFollow(); 12959 splitLineHeadingInit(); 12960 var stickyEls = new NectarStickyEls(); 12961 } 12962 12963 12964 12965 12966 /***************** WooCommerce *****************/ 12967 12968 /** 12969 * Woo filter toggle 12970 * 12971 * @since 13.0 12972 */ 12973 function NectarWooCommerceFilters() { 12974 12975 this.$toggleBtn = $('.nectar-shop-filters .nectar-shop-filter-trigger'); 12976 this.$sidebar = $('#sidebar'); 12977 this.sidebarPos = (this.$sidebar.hasClass('col_last')) ? 'right' : 'left'; 12978 12979 this.state = { 12980 open: (this.getLS()) ? this.getLS() : 'true' 12981 }; 12982 12983 this.setup(); 12984 this.events(); 12985 } 12986 12987 NectarWooCommerceFilters.prototype.events = function() { 12988 12989 this.$toggleBtn.on('click', this.toggle.bind(this)); 12990 this.$sidebar.find('.nectar-close-btn-wrap').on('click', this.mobileToggle.bind(this)); 12991 $(window).on('smartresize', this.mobileToggleResize.bind(this)); 12992 12993 }; 12994 12995 NectarWooCommerceFilters.prototype.mobileToggleResize = function() { 12996 12997 if( this.$sidebar.hasClass('open') && nectarDOMInfo.winW > 999 ) { 12998 this.$sidebar.removeClass('open'); 12999 this.$sidebar.find('.nectar-close-btn-wrap').removeClass('open'); 13000 $('.container-wrap').css('z-index','11'); 13001 } 13002 13003 }; 13004 13005 NectarWooCommerceFilters.prototype.mobileToggle = function() { 13006 13007 if( this.$sidebar.hasClass('open') ) { 13008 this.$sidebar.removeClass('open'); 13009 this.$sidebar.find('.nectar-close-btn-wrap').removeClass('open'); 13010 $('.container-wrap').css('z-index','11'); 13011 } else { 13012 $('.container-wrap').css('z-index','10000'); 13013 this.$sidebar.addClass('open'); 13014 this.$sidebar.find('.nectar-close-btn-wrap').addClass('open'); 13015 } 13016 13017 return false; 13018 13019 }; 13020 13021 NectarWooCommerceFilters.prototype.toggle = function() { 13022 13023 // Mobile. 13024 if( nectarDOMInfo.winW < 1000 ) { 13025 this.mobileToggle(); 13026 return false; 13027 } 13028 13029 var visibility = ''; 13030 13031 // Close.
13032 if( this.state.open == 'true' ) { 13033 13034 // Handle state. 13035 this.state.open = 'false'; 13036 visibility = 'false'; 13037 13038 // Layout change. 13039 this.$toggleBtn.find('.hide').hide(); 13040 this.$toggleBtn.find('.show').show(); 13041 13042 this.$toggleBtn.find('.top-line, .bottom-line').css({ 13043 'transform': 'translateX(0)' 13044 }); 13045 13046 if( this.sidebarPos == 'left' ) { 13047 this.$sidebar.css({ 13048 'margin-right' : '-25%', 13049 'opacity': '0' 13050 }); 13051 } else { 13052 this.$sidebar.css({ 13053 'margin-left': '-25%', 13054 'opacity': '0' 13055 }); 13056 } 13057 13058 this.$sidebar.find('> .inner').css({ 13059 'transform': (this.sidebarPos == 'left') ? 'translateX(-100%)' : 'translateX(100%)', 13060 }); 13061 13062 } 13063 // Open. 13064 else { 13065 13066 // Handle state. 13067 this.state.open = 'true'; 13068 visibility = 'true'; 13069 13070 // Layout change. 13071 this.$toggleBtn.find('.show').hide(); 13072 this.$toggleBtn.find('.hide').show(); 13073 13074 this.$toggleBtn.find('.top-line').css({ 13075 'transform': 'translateX(10px)' 13076 }); 13077 this.$toggleBtn.find('.bottom-line').css({ 13078 'transform': 'translateX(-10px)' 13079 }); 13080 13081 if( this.sidebarPos == 'left' ) { 13082 this.$sidebar.css({ 13083 'margin-right' : '0', 13084 'opacity': '1' 13085 }); 13086 } else { 13087 this.$sidebar.css({ 13088 'margin-left' : '0', 13089 'opacity': '1' 13090 }); 13091 } 13092 13093 this.$sidebar.find('> .inner').css({ 13094 'transform': 'translateX(0)' 13095 }); 13096 13097 } 13098 13099 // Trigger event. 13100 setTimeout(function(){ 13101 $(window).trigger('nectar-product-filters-layout'); 13102 },425); 13103 13104 13105 // Store in LS. 13106 if( typeof(Storage) !== "undefined" ) { 13107 localStorage.setItem("nectar_product_filters_vis", visibility); 13108 } 13109 13110 return false; 13111 13112 }; 13113 13114 NectarWooCommerceFilters.prototype.setup = function() { 13115 13116 // Start filters expanded on mobile. 13117 this.$sidebar.find('.widget.woocommerce') 13118 .addClass('open-filter') 13119 .find('ul') 13120 .css({ 13121 'display':'block' 13122 }); 13123 13124 // Mobile active filters. 13125 if( $('.nectar-active-product-filters').length > 0 ) { 13126 var $filtersHTML = $('.nectar-active-product-filters').clone(); 13127 this.$sidebar.find('> .inner').prepend($filtersHTML); 13128 } 13129 13130 }; 13131 13132 NectarWooCommerceFilters.prototype.getLS = function() { 13133 13134 if( typeof(Storage) !== "undefined" ) { 13135 return localStorage.getItem("nectar_product_filters_vis"); 13136 } 13137 13138 return null; 13139 13140 }; 13141 13142 13143 13144 13145 /** 13146 * Handle Woo quantity button functionality 13147 * 13148 * @since 13.0 13149 */ 13150 function wooQauntityBtns() { 13151 var quantityButtons = new NectarWooCommerceQuantity(); 13152 } 13153 13154 function NectarWooCommerceQuantity() { 13155 13156 this.$qty = ''; 13157 this.step = 1; 13158 this.ajaxTimeout = ''; 13159 this.ajaxTimeoutDur = 500; 13160 13161 this.state = { 13162 max: 100000, 13163 min: 0, 13164 currentVal: 1, 13165 key: 0, 13166 removeFlag: false 13167 }; 13168 13169 this.events(); 13170 13171 } 13172 13173 NectarWooCommerceQuantity.prototype.updateState = function(el) { 13174 13175 // Get key. 13176 var key = 0; 13177 13178 if( true === this.checkMiniCart(this.$qty) ) { 13179 var matches = this.$qty.attr('name').match(/cart\[(\w+)\]/); 13180 key = matches[1]; 13181 } 13182 13183 // Store current. 13184 var currentVal = parseFloat(this.$qty.val()); 13185 13186 if (!currentVal || currentVal === '' || currentVal === 'NaN') { 13187 currentVal = 0; 13188 } 13189 13190 // Max/Min vals. 13191 var max = parseFloat(this.$qty.attr('max')); 13192 var min = parseFloat(this.$qty.attr('min')); 13193 13194 if (max === '' || max === 'NaN' || isNaN(max) ) { 13195 max = ''; 13196 } 13197 13198 if (min === '' || min === 'NaN' || isNaN(min) ) { 13199 min = 0; 13200 } 13201 13202 // Push to state. 13203 this.state = { 13204 currentVal: currentVal, 13205 max: max, 13206 min: min, 13207 key: key 13208 }; 13209 13210 }; 13211 13212 NectarWooCommerceQuantity.prototype.events = function() { 13213 13214 var that = this; 13215 13216 $('body').on('click', '.quantity .plus', function() { 13217 that.$qty = $(this).closest('.quantity').find('.qty'); 13218 that.updateState(); 13219 that.increment($(this)); 13220 });
13221 13222 $('body').on('click', '.quantity .minus', function() { 13223 that.$qty = $(this).closest('.quantity').find('.qty'); 13224 that.updateState(); 13225 that.decrement($(this)); 13226 }); 13227 13228 $('body').on('keyup', '.woocommerce-mini-cart .quantity .qty', function(e) { 13229 that.$qty = $(this); 13230 13231 that.updateState(); 13232 13233 // Max value. 13234 if( that.state.max && that.$qty.val() > that.state.max ) { 13235 that.$qty.val(that.state.max); 13236 } 13237 13238 // Check if item should be removed. 13239 if (that.state.min && (that.state.min == that.state.currentVal || that.state.currentVal < that.state.min)) { 13240 that.state.removeFlag = true; 13241 } 13242 13243 $(this).trigger('change'); 13244 13245 }); 13246 13247 $('body').on('change', '.woocommerce-mini-cart .quantity .qty', function(e) { 13248 13249 if( !e.originalEvent && true === that.checkMiniCart(that.$qty) ) { 13250 that.updateCart(that.$qty.val()); 13251 } 13252 13253 }); 13254 13255 }; 13256 13257 NectarWooCommerceQuantity.prototype.increment = function() { 13258 13259 if (this.state.max && (this.state.max == this.state.currentVal || this.state.currentVal > this.state.max)) { 13260 this.$qty.val(this.state.max); 13261 } else { 13262 this.$qty.val(this.state.currentVal + parseFloat(this.step)); 13263 } 13264 13265 this.$qty.trigger('change'); 13266 13267 }; 13268 13269 NectarWooCommerceQuantity.prototype.decrement = function() { 13270 13271 if (this.state.min && (this.state.min == this.state.currentVal || this.state.currentVal < this.state.min)) { 13272 this.$qty.val(0); 13273 this.state.removeFlag = true; 13274 13275 } else if (this.state.currentVal > 0) { 13276 this.$qty.val(this.state.currentVal - parseFloat(this.step)); 13277 } 13278 13279 this.$qty.trigger('change'); 13280 13281 }; 13282 13283 NectarWooCommerceQuantity.prototype.checkMiniCart = function(el) { 13284 return ( el.parents('.woocommerce-mini-cart').length > 0 ) ? true : false; 13285 }; 13286 13287 NectarWooCommerceQuantity.prototype.updateCart = function(val) { 13288 13289 var that = this; 13290 13291 // Debounce a little to prevent too many requests when clicking a lot 13292 clearTimeout(this.ajaxTimeout); 13293 13294 this.ajaxTimeout = setTimeout(function() { 13295 13296 that.$qty.closest( '.widget_shopping_cart_content' ).addClass('loading'); 13297 that.$qty.closest( '.woocommerce-mini-cart-item' ).addClass('blockUI').addClass('blockOverlay'); 13298 13299 $.ajax({
13300 type: 'POST', 13301 url: window.nectarLove.ajaxurl, 13302 data: { 13303 action: "nectar_minicart_update_quantity", 13304 quantity: val, 13305 item_key: that.state.key 13306 }, 13307 cache: false, 13308 success: function (response) { 13309 if( response ) { 13310 13311 that.$qty.closest( '.widget_shopping_cart_content' ).removeClass('loading'); 13312 that.$qty.closest( '.woocommerce-mini-cart-item' ).removeClass('blockUI').removeClass('blockOverlay'); 13313 13314 // Update subtotal. 13315 var $subtotal = that.$qty.closest( '.widget_shopping_cart_content' ).find('.woocommerce-mini-cart__total'); 13316 $subtotal.find('.woocommerce-Price-amount').remove(); 13317 $subtotal.append(response.subtotal); 13318 13319 // Does the item need to be removed? 13320 if( that.state.removeFlag === true ) { 13321 that.$qty.closest( '.woocommerce-mini-cart-item' ).remove(); 13322 that.state.removeFlag = false; 13323 $( document.body ).trigger( 'updated_wc_div' ); 13324 } 13325 13326 // Update cart count. 13327 if( $('#header-outer a.cart-contents .cart-wrap span').length > 0 ) { 13328 $('#header-outer a.cart-contents .cart-wrap span').text(response.item_count); 13329 } 13330 13331 } 13332 13333 13334 } 13335 13336 }); 13337 13338 }, this.ajaxTimeoutDur); 13339 13340 }; 13341 13342 13343 /** 13344 * WooCommerce Single Product AJAX Add to Cart. 13345 * 13346 * @since 13.0 13347 */ 13348 function NectarWooCommerceCartAJAX() { 13349 13350 this.state = { 13351 processing: false, 13352 productID: false, 13353 type: 'regular' 13354 }; 13355 13356 this.events(); 13357 } 13358 13359 NectarWooCommerceCartAJAX.prototype.events = function() { 13360 $('body').on('submit', 'form.cart', this.addToCartAJAX.bind(this)); 13361 }; 13362 13363 NectarWooCommerceCartAJAX.prototype.addNotices = function(notices) { 13364 13365 var that = this; 13366 13367 var $noticeParent = $('.nectar-slide-in-cart.style_slide_in_click .widget_shopping_cart_content') 13368 13369 $.each(notices, function(k,item) { 13370 $noticeParent.prepend('<div class="nectar-notice">'+item.notice+'</div>'); 13371 }); 13372 13373 // Remove. 13374 setTimeout(function(){ 13375 $noticeParent.find('.nectar-notice').slideUp(function(){ 13376 $(this).remove(); 13377 }); 13378 },6000); 13379 13380 }; 13381 13382 NectarWooCommerceCartAJAX.prototype.addToCartAJAX = function(e) { 13383 13384 var that = this; 13385 13386 var $wooForm = $(e.currentTarget); 13387 13388 // External or redirect active. 13389 if( $wooForm.closest('.product').hasClass('product-type-external') || (wc_add_to_cart_params && wc_add_to_cart_params.cart_redirect_after_add === 'yes') ) { 13390 return; 13391 } 13392 13393 e.preventDefault(); 13394 13395 // If already submitted 13396 if( that.state.processing == true ) { 13397 return; 13398 } 13399 13400 that.state.processing = true; 13401 that.state.productID = false; 13402 13403 // Store type 13404 that.state.type = 'regular'; 13405 if( $wooForm.parents('.nectar-quick-view-box').length > 0 ) { 13406 that.state.type = 'quickview'; 13407 } 13408 13409 // Gather info to pass. 13410 var $parentProduct = $wooForm.closest('.product'); 13411 var $addToCartBtn = $wooForm.find('button.single_add_to_cart_button'); 13412 var $formData = $wooForm.serializeArray(); 13413 var regID = 0; 13414 13415 // Try and get ID from parent. 13416 if( $parentProduct.is('[id*="product-"]') ) { 13417 regID = $parentProduct.attr('id').match(/\d+/); 13418 13419 if(regID && regID[0]) { 13420 that.state.productID = regID[0]; 13421 } 13422 } 13423 // Fallback to ID from submit. 13424 if( that.state.productID === false && $addToCartBtn.length > 0 ) { 13425 regID = $addToCartBtn.val().match(/\d+/); 13426 13427 if(regID && regID[0]) { 13428 that.state.productID = regID[0]; 13429 } 13430 } 13431 13432 // No ID found, bail out. 13433 if( that.state.productID === false ) { 13434 console.log('Error: no product ID found.'); 13435 return; 13436 } 13437 13438 // Add Loading. 13439 if( that.state.type === 'quickview' ) { 13440 $addToCartBtn = $('.single_add_to_cart_button_wrap .single_add_to_cart_button'); 13441 } 13442 13443 $addToCartBtn.prepend('<div class="loading-wrap"><div class="loading" /></div></div>'); 13444 setTimeout(function(){ 13445 $addToCartBtn.addClass('processing'); 13446 },50); 13447 13448 // Must be formatted like this to use add-to-cart key for WooCommerce to trigger AJAX. 13449 $formData.push({ 13450 name: 'action', 13451 value: 'nectar_ajax_add_to_cart' 13452 }, { 13453 name: 'add-to-cart', 13454 value: that.state.productID 13455 });
13456 13457 $.ajax({ 13458 type: 'POST', 13459 url: window.nectarLove.ajaxurl, 13460 data: $formData, 13461 cache: false, 13462 success: function (response) { 13463 13464 setTimeout(function(){ 13465 that.state.processing = false; 13466 $addToCartBtn.removeClass('processing'); 13467 $addToCartBtn.find('.loading-wrap').remove(); 13468 }, 300); 13469 13470 if( response && response.fragments ) { 13471 13472 // Update content. 13473 $('body').trigger( 'added_to_cart', [response.fragments, response.cart_hash] ); 13474 13475 // Check for/Output errors. 13476 if( response.notices && response.notices.length > 0 ) { 13477 setTimeout(function(){ 13478 that.addNotices(response.notices); 13479 },100); 13480 } 13481 13482 // Close quickview. 13483 if( that.state.type === 'quickview' ) { 13484 $('.nectar-quick-view-box .close').trigger('click'); 13485 } 13486 13487 } 13488 13489 } // end success. 13490 13491 }); // end ajax. 13492 13493 }; 13494 13495 13496 /** 13497 * WooCommerce events. 13498 * 13499 * @since 10.5 13500 */ 13501 function wooCommerceEvents() { 13502 13503 var wooCartTimeout; 13504 13505 // Notification. 13506 $body.on('click', '.product .add_to_cart_button', function () { 13507 13508 var $productHeading = ($(this).parents('li').find('h2').length > 0) ? 'h2' : 'h3', 13509 productToAdd = $(this).parents('li').find($productHeading).text(); 13510 13511 $('#header-outer .cart-notification span.item-name').html(productToAdd); 13512 13513 }); 13514 13515 // Notification hover. 13516 $body.on('mouseenter', '#header-outer .cart-notification', function () { 13517 13518 $(this).hide(); 13519 13520 $('#header-outer .widget_shopping_cart') 13521 .addClass('open') 13522 .stop(true, true) 13523 .show(); 13524 13525 $('#header-outer .cart_list') 13526 .stop(true, true) 13527 .show(); 13528 13529 clearTimeout(wooCartTimeout); 13530 13531 }); 13532 13533 13534 // Cart dropdown. 13535 var $headerCartSelector = '#header-outer .nectar-woo-cart'; 13536 13537 if ($($headerCartSelector).length > 0) { 13538 13539 $($headerCartSelector).hoverIntent(function () { 13540 13541 $('#header-outer .widget_shopping_cart') 13542 .addClass('open') 13543 .stop(true, true) 13544 .show(); 13545 13546 $('#header-outer .cart_list') 13547 .stop(true, true) 13548 .show(); 13549 13550 clearTimeout(wooCartTimeout); 13551 13552 $('#header-outer .cart-notification').hide(); 13553 13554 }); 13555 } 13556 13557 13558 $body.on('mouseleave', $headerCartSelector, function () { 13559 var $that = $(this); 13560 setTimeout(function () { 13561 if (!$that.is(':hover')) { 13562 $('#header-outer .widget_shopping_cart') 13563 .removeClass('open') 13564 .stop(true, true) 13565 .fadeOut(300); 13566 13567 $('#header-outer .cart_list') 13568 .stop(true, true) 13569 .fadeOut(300); 13570 } 13571 }, 200); 13572 }); 13573 13574 if ($('#header-outer[data-cart="false"]').length == 0) { 13575 13576 $body.on('added_to_cart', shopping_cart_dropdown_show); 13577 $body.on('added_to_cart', shopping_cart_dropdown); 13578 13579 } 13580 13581 function shopping_cart_dropdown() { 13582 13583 if (!$('.widget_shopping_cart .widget_shopping_cart_content .cart_list .empty').length && 13584 $('.widget_shopping_cart .widget_shopping_cart_content .cart_list').length > 0) { 13585 13586 $('.cart-menu-wrap').addClass('has_products'); 13587 $('header#top nav > ul, #search-outer #search #close a, header#top .span_9 >.slide-out-widget-area-toggle').addClass('product_added'); 13588 13589 if (!$('.cart-menu-wrap').hasClass('static')) { 13590 $('.cart-menu-wrap, #mobile-cart-link').addClass('first-load'); 13591 } 13592 13593 13594 } 13595 13596 } 13597 13598 13599 function shopping_cart_dropdown_show(e) { 13600 13601 clearTimeout(wooCartTimeout); 13602 13603 if (!$('.widget_shopping_cart .widget_shopping_cart_content .cart_list .empty').length && 13604 $('.widget_shopping_cart .widget_shopping_cart_content .cart_list').length > 0 && 13605 typeof e.type != 'undefined') { 13606 13607 // Standalone woocommerce add to cart buttons. 13608 if ($('#header-outer .cart-notification .item-name').length > 0 && 13609 $('#header-outer .cart-notification .item-name').text().length == 0) { 13610 return; 13611 } 13612 13613 // Before cart has slide in. 13614 if (!$('#header-outer .cart-menu-wrap').hasClass('has_products')) { 13615 13616 setTimeout(function () { 13617 $('#header-outer .cart-notification').fadeIn(400); 13618 }, 400); 13619 13620 } else if (!$('#header-outer .cart-notification').is(':visible')) { 13621 $('#header-outer .cart-notification').fadeIn(400); 13622 } else { 13623 $('#header-outer .cart-notification').show(); 13624 } 13625 13626 $('body #header-outer [data-cart-style="slide_in_click"] .cart-menu-wrap').trigger('click'); 13627 13628 13629 wooCartTimeout = setTimeout(hideCart, 2700); 13630 13631 } 13632 } 13633 13634 function hideCart() { 13635 $('#header-outer .cart-notification').stop(true, true).fadeOut(); 13636 } 13637 13638 function checkForWooItems() { 13639 13640 var checkForCartItems = setInterval(shopping_cart_dropdown, 250); 13641 setTimeout(function () { 13642 clearInterval(checkForCartItems); 13643 }, 4500); 13644 13645 } 13646 13647 13648 if ($('#header-outer[data-cart="false"]').length == 0) { 13649 checkForWooItems();
13650 } 13651 13652 function nectarAccountPageTabs() { 13653 13654 // Not on account page. 13655 if ($('body.woocommerce-account #customer_login').length == 0) { 13656 return; 13657 } 13658 13659 // Create HTML. 13660 $('.woocommerce-account .woocommerce > #customer_login').prepend('<div class="nectar-form-controls" />'); 13661 13662 $('.woocommerce-account .woocommerce > #customer_login > div:not(.nectar-form-controls)').each(function () { 13663 var $title = $(this).find('> h2').text(); 13664 $('#customer_login .nectar-form-controls').append('<div class="control">' + $title + '</div>'); 13665 }); 13666 13667 // Click event. 13668 $('.woocommerce-account .woocommerce > #customer_login .nectar-form-controls .control').on('click', function () { 13669 13670 $('.woocommerce-account .woocommerce > #customer_login .nectar-form-controls .control').removeClass('active'); 13671 $(this).addClass('active'); 13672 13673 var formIndex = $(this).index() + 1; 13674 $('#customer_login div[class*="u-column"]').hide(); 13675 $('#customer_login div[class*="u-column"].col-' + formIndex).show(); 13676 13677 setTimeout(function () { 13678 $('#customer_login div[class*="u-column"]').removeClass('visible'); 13679 $('#customer_login div[class*="u-column"].col-' + formIndex).addClass('visible'); 13680 }, 30); 13681 13682 }); 13683 13684 // Starting. 13685 $('.woocommerce-account .woocommerce > #customer_login .nectar-form-controls .control:nth-child(1)').trigger('click'); 13686 13687 } 13688 13689 nectarAccountPageTabs(); 13690 13691 var bindTextOnHoverMobile = ( $('.products[data-rm-m-hover="1"]').length > 0 && nectarDOMInfo.usingMobileBrowser ) ? false : true; 13692 13693 // Text on hover effect. 13694 if(bindTextOnHoverMobile) { 13695 $body.on('mouseover', '.text_on_hover .product-wrap, .text_on_hover > a:first-child', function () { 13696 $(this).parent().addClass('hovered'); 13697 }); 13698 13699 $body.on('mouseout', '.text_on_hover .product-wrap, .text_on_hover > a:first-child', function () { 13700 $(this).parent().removeClass('hovered'); 13701 }); 13702 } 13703 13704 13705 // Material/fancy parallax hover effect zindex. 13706 if ($('.material.product').length > 0 || 13707 $('.minimal.product').length > 0 || 13708 $('.nectar-fancy-box[data-style="parallax_hover"]').length > 0 || 13709 $('.nectar-category-grid[data-shadow-hover="yes"]').length > 0 || 13710 $('.nectar-post-grid[data-shadow-hover="yes"]').length > 0) { 13711 13712 var $productZindex = 101; 13713 13714 $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 () { 13715 $productZindex++; 13716 $(this).css('z-index', $productZindex + 1); 13717 }); 13718 13719 $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 () { 13720 13721 var $that = $(this); 13722 setTimeout(function () { 13723 if (!$that.is(':hover')) { 13724 $that.css('z-index', 100); 13725 } 13726 }, 350); 13727 }); 13728 13729 if( window.nectarOptions && window.nectarOptions.woo_minimal_product_effect && window.nectarOptions.woo_minimal_product_effect === 'default' ) { 13730 $body.on('mouseenter', '.minimal.product', function () { 13731 $productZindex++; 13732 $(this).css('z-index', $productZindex + 1); 13733 }); 13734 13735 $body.on('mouseleave', '.minimal.product', function () { 13736 13737 var $that = $(this); 13738 setTimeout(function () { 13739 if (!$that.is(':hover')) { 13740 $that.css('z-index', 100); 13741 } 13742 }, 350); 13743 }); 13744 } 13745 13746 // Reset to stop zindex from getting too high. 13747 setInterval(function () { 13748 if ($('.nectar-fancy-box[data-style="parallax_hover"]:hover').length > 0 || 13749 $('.minimal.product:hover').length > 0) { 13750 return; 13751 } 13752 13753 $('.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); 13754 $productZindex = 101; 13755 }, 10000); 13756 13757 } 13758 13759 function minimalProductHover() { 13760 13761 // Add icons. 13762 $('.products .classic .product-wrap .add_to_cart_button').wrapInner('<span />'); 13763 $('.products .classic .product-wrap .add_to_cart_button').prepend('<i class="normal icon-salient-cart"></i>'); 13764 13765 // Bind hover. 13766 var bindMobileHover = ( $('.products[data-rm-m-hover="1"]').length > 0 && nectarDOMInfo.usingMobileBrowser ) ? false : true; 13767 13768 if( bindMobileHover && window.nectarOptions && window.nectarOptions.woo_minimal_product_effect && window.nectarOptions.woo_minimal_product_effect === 'default' ) { 13769 13770 $body.on('mouseover', '.products .minimal.product', function () { 13771 minimalProductCalc($(this)); 13772 });
13773 13774 $body.on('mouseleave', '.products .minimal.product', function () { 13775 $(this).find('.background-color-expand').css({ 13776 'transform': 'scale(1, 1) translateY(0) translateZ(0px)' 13777 }); 13778 }); 13779 13780 } 13781 13782 // Starting trigger mouse over. 13783 $('.products .minimal.product').each(function () { 13784 if ($(this).is(':hover')) { 13785 $(this).trigger('mouseover'); 13786 } 13787 }); 13788 13789 } 13790 13791 13792 13793 function minimalProductCalc(el) { 13794 13795 var expansionAmtX = 40, 13796 expansionAmtY = expansionAmtX, 13797 translateYAmt = 0; 13798 13799 var $item = el, 13800 $itemWidth = $item.width(), 13801 $itemHeight = $item.height(), 13802 $wChange = (parseInt($itemWidth) + expansionAmtX) / parseInt($itemWidth), 13803 $hChange = (parseInt($itemHeight) + expansionAmtY) / parseInt($itemHeight); 13804 13805 $item.addClass('hover-bound'); 13806 13807 $item.find('.background-color-expand').css({ 13808 'transform': 'scale(' + $wChange + ',' + $hChange + ') translateY('+translateYAmt+'px) translateZ(0px)' 13809 }); 13810 13811 } 13812 13813 minimalProductHover(); 13814 13815 13816 13817 // Mobile widget filters. 13818 $('.woocommerce #sidebar .widget.woocommerce').each(function () { 13819 13820 // Skip widgets without any titles. 13821 if ($(this).find('> h4').length == 0) { 13822 $(this).addClass('no-widget-title'); 13823 } 13824 13825 }); 13826 13827 $body.on('click', '#sidebar .widget.woocommerce:not(.widget_price_filter) h4', function () { 13828 13829 if(window.nectarOptions && window.nectarOptions.woo_sidebar_toggles !== 'false') { 13830 13831 if ($window.width() < 1000 ) { 13832 13833 if ($(this).parent().is('.widget_product_tag_cloud')) { 13834 $(this).parent().find('> div').slideToggle(); 13835 } 13836 if ($(this).parent().is('.woocommerce-widget-layered-nav') && $(this).parent().find('> .woocommerce-widget-layered-nav-dropdown').length > 0) { 13837 $(this).parent().find('> .woocommerce-widget-layered-nav-dropdown').slideToggle(); 13838 } 13839 13840 $(this).parent().find('> ul').slideToggle(); 13841 13842 $(this).parent().toggleClass('open-filter'); 13843 } 13844 13845 } 13846 13847 }); 13848 13849 13850 // Slide in cart event. 13851 $body.on('mouseenter', '#header-outer [data-cart-style="slide_in"] .cart-menu-wrap', openRightCartHover); 13852 13853 $body.on('mouseenter', '.nectar-slide-in-cart', function () { 13854 $(this).addClass('mouse-accessed'); 13855 }); 13856 13857 13858 function openRightCartHover() { 13859 13860 if ($('.nectar-slide-in-cart ul.cart_list li:not(.empty)').length > 0) { 13861 13862 $('.nectar-slide-in-cart').addClass('open'); 13863 $window.on('mousemove.rightCartOffsetCheck', closeCartCheck); 13864 13865 } 13866 } 13867 13868 function closeCartCheck(e) { 13869 13870 var $windowWidth = $window.width(); 13871 if (e.clientX < $windowWidth - 370 - $bodyBorderWidth && $('.nectar-slide-in-cart').hasClass('mouse-accessed')) { 13872 13873 $window.off('mousemove.rightCartOffsetCheck', closeCartCheck); 13874 13875 $('.nectar-slide-in-cart').removeClass('open').removeClass('mouse-accessed'); 13876 13877 } 13878 13879 } 13880 13881 // Slide in click cart. 13882 var wooBgOverlayTimeout; 13883 13884 $body.on('click', '#header-outer [data-cart-style="slide_in_click"] .cart-menu-wrap, #mobile-cart-link[data-cart-style="slide_in_click"]', openRightCart); 13885 13886 function openRightCart() { 13887 if( $body.is('.woocommerce-checkout') || $body.is('.woocommerce-cart') ) { 13888 return true; 13889 } 13890 13891 $('.nectar-slide-in-cart, .nectar-slide-in-cart-bg').addClass('open'); 13892 $('.nectar-slide-in-cart-bg').addClass('revealed'); 13893 clearTimeout(wooBgOverlayTimeout); 13894 13895 // YITH ajax filters compat. 13896 $('.style_slide_in_click div.quantity').each(function(){ 13897 if( $(this).find('.minus').length > 1 ) { 13898 $(this).find('.minus').first().remove(); 13899 } 13900 if( $(this).find('.plus').length > 1 ) { 13901 $(this).find('.plus').first().remove(); 13902 } 13903 }); 13904 13905 return false; 13906 } 13907 13908 $body.on('click', '.nectar-slide-in-cart.style_slide_in_click .close-cart, .nectar-slide-in-cart-bg', closeRightCart); 13909 13910 function closeRightCart() { 13911 13912 $('.nectar-slide-in-cart, .nectar-slide-in-cart-bg').removeClass('open'); 13913 13914 wooBgOverlayTimeout = setTimeout(function() { 13915 $('.nectar-slide-in-cart-bg').removeClass('revealed'); 13916 },400); 13917 13918 return false; 13919 } 13920 13921 // Add quantity functionality. 13922 wooQauntityBtns(); 13923 13924 // AJAX add to cart. 13925 if( window.nectarOptions && window.nectarOptions.ajax_add_to_cart === '1' ) { 13926 var ajaxAddToCart = new NectarWooCommerceCartAJAX(); 13927 } 13928 13929 if( window.nectarOptions && window.nectarOptions.woo_product_filter_toggle === '1' && $body.is('.archive.woocommerce') ) { 13930 var nectarProductFilters = new NectarWooCommerceFilters(); 13931 } 13932 13933 // Third party. 13934 // YITH Ajax filters. 13935 $(document).on( 'yith-wcan-ajax-filtered', nectarLazyImageLoading ); 13936 13937 13938 } 13939 13940 13941 13942 /** 13943 * Modern quick search. 13944 * 13945 * @since 13.0 13946 */ 13947 function NectarQuickSearch() { 13948 13949 this.$el = $('#search-outer #search .container #s'); 13950 this.$container = ''; 13951 this.$parent = ''; 13952 this.$searchEl = $('#search-outer'); 13953 this.request = ''; 13954 this.timeout = ''; 13955 this.setup(); 13956 this.events(); 13957 13958 this.state = { 13959 requesting: false, 13960 open: false, 13961 prevResults: '' 13962 } 13963 13964 this.minChars = 2; 13965 13966 } 13967 13968 13969 NectarQuickSearch.prototype.setup = function() { 13970
13971 this.$container = $('<div class="inner"></div>'); 13972 $('#search-outer').append($('<div class="nectar-ajax-search-results"><div class="container"></div></div>')); 13973 this.$parent = $('#search-outer .nectar-ajax-search-results'); 13974 $('#search-outer .nectar-ajax-search-results .container').append(this.$container); 13975 13976 }; 13977 13978 NectarQuickSearch.prototype.events = function() { 13979 13980 var that = this; 13981 13982 this.throttled = throttle(this.getResults.bind(this),350); 13983 this.$el.on('keyup', this.keyHandle.bind(this) ); 13984 13985 $(window).on('resize', this.resize.bind(this)); 13986 $(window).on('nectar-search-close', function() { 13987 that.resetHeight(); 13988 that.requestCheck(); 13989 }); 13990 13991 }; 13992 13993 NectarQuickSearch.prototype.keyHandle = function(e) { 13994 13995 // Verify Key. 13996 var keysToSkip = [16,91,32,37,39,17]; 13997 13998 if( keysToSkip.indexOf(e.keyCode) != -1 ) { 13999 return; 14000 } 14001 14002 this.throttled(); 14003 this.debouncedSearch(); 14004 14005 }; 14006 14007 NectarQuickSearch.prototype.debouncedSearch = function() { 14008 14009 var that = this; 14010 14011 clearTimeout(this.timeout); 14012 this.timeout = setTimeout(function(){ 14013 if(that.state.requesting) { 14014 return; 14015 } 14016 that.getResults(); 14017 },400); 14018 14019 }; 14020 14021 14022 NectarQuickSearch.prototype.resize = function() { 14023 14024 this.$parent.css({ 14025 'max-height': '' 14026 }); 14027 14028 if( this.state.open === true ) { 14029 this.$parent.css({ 14030 'max-height': parseInt(this.$container.outerHeight()) + 'px' 14031 }); 14032 } 14033 14034 }; 14035 14036 NectarQuickSearch.prototype.resetHeight = function() { 14037 14038 var that = this; 14039 14040 this.$parent.css({ 14041 'max-height': '' 14042 }); 14043 14044 setTimeout(function(){ 14045 $headerOuterEl.removeClass('results-shown'); 14046 },400); 14047 14048 this.state.prevResults = ''; 14049 this.state.open = false; 14050 }; 14051 14052 14053 NectarQuickSearch.prototype.requestCheck = function() { 14054 14055 if( this.state.requesting === true ) { 14056 this.request.abort(); 14057 this.state.requesting = false; 14058 } 14059 14060 }; 14061 14062 NectarQuickSearch.prototype.getResults = function() { 14063 14064 var that = this; 14065 var val = this.$el.val(); 14066 14067 // Deleted all chars / too few chars. 14068 if( val.length == 0 || val.length < this.minChars ) { 14069 $headerOuterEl.removeClass('results-shown'); 14070 this.requestCheck(); 14071 this.resetHeight(); 14072 return; 14073 } 14074 14075 this.request = $.ajax({ 14076 type: 'POST', 14077 url: window.nectarLove.ajaxurl, 14078 data: { 14079 action: "nectar_ajax_ext_search_results", 14080 search: val 14081 }, 14082 cache: false, 14083 success: function (response) { 14084 14085 that.state.requesting = false; 14086 14087 // No results. 14088 if( !response ) { 14089 that.resetHeight(); 14090 } 14091 14092 if( response && response.content && response.content !== that.state.prevResults && that.$searchEl.hasClass('material-open') ) { 14093 14094 that.$container.html(response.content); 14095 14096 that.$parent.css({ 14097 'max-height': parseInt(that.$container.outerHeight()) + 'px' 14098 }); 14099 14100 setTimeout(function(){ 14101 $headerOuterEl.addClass('results-shown'); 14102 },200); 14103 14104 // Desktop animation 14105 if( nectarDOMInfo.winW >= 1000 && !$headerOuterEl.hasClass('results-shown') ) { 14106 14107 that.$container.find('.product, .search-post-item').css({ 14108 'opacity': '0', 14109 'transform': 'translateY(25px)', 14110 'transition': 'none' 14111 }); 14112 14113 setTimeout(function(){ 14114 that.$container.find('.product, .search-post-item').css({ 14115 '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)' 14116 }); 14117 },50); 14118 14119 14120 that.$container.find('.product, .search-post-item').each(function(i) { 14121 var $that = $(this); 14122 setTimeout(function(){ 14123 $that.css({ 14124 'opacity': '1', 14125 'transform': 'translateY(0)' 14126 }) 14127 }, 50 + (i*60)); 14128 });
14129 14130 } 14131 14132 that.state.open = true; 14133 that.state.prevResults = response.content; 14134 14135 } 14136 14137 } 14138 14139 }); 14140 14141 this.state.requesting = true; 14142 14143 }; 14144 14145 14146 /** 14147 * Search in navigation functionality. 14148 * 14149 * @since 10.5 14150 */ 14151 14152 function navigationSearchInit() { 14153 14154 // Init quick search. 14155 var quickSearch = false; 14156 if( window.nectarOptions && window.nectarOptions.quick_search && window.nectarOptions.quick_search === 'true' ) { 14157 quickSearch = new NectarQuickSearch(); 14158 } 14159 14160 var $placeholder = ($('#search-outer #search input[type=text][data-placeholder]').length > 0) ? $('#search-outer #search input[type=text]').attr('data-placeholder') : ''; 14161 14162 // Material skin add search BG markup. 14163 if ($body.hasClass('material') && $('#header-outer .bg-color-stripe').length == 0) { 14164 $headerOuterEl.append('<div class="bg-color-stripe" />'); 14165 } 14166 14167 // Prevent jumping on click. 14168 $body.on('click', '#search-btn a', function () { 14169 return false; 14170 }); 14171 14172 // Open search on mouseup. 14173 $body.on('click', '#search-btn a:not(.inactive), #header-outer .mobile-search', function () { 14174 14175 if ($(this).hasClass('open-search')) { 14176 return false; 14177 } 14178 14179 // Close menu on original skin. 14180 if( $body.hasClass('original') && $('.slide-out-widget-area-toggle.mobile-icon a.open').length > 0 ) { 14181 $('.slide-out-widget-area-toggle.mobile-icon a') 14182 .addClass('non-human-allowed') 14183 .trigger('click'); 14184 14185 setTimeout(function () { 14186 $('.slide-out-widget-area-toggle.mobile-icon a').removeClass('non-human-allowed'); 14187 }, 100); 14188 } 14189 14190 if ($body.hasClass('ascend') || 14191 $('body[data-header-format="left-header"]').length > 0 && $('body.material').length == 0) { 14192 14193 // Ascend theme skin. 14194 $('#search-outer > #search form, #search-outer #search .span_12 span, #search-outer #search #close').css('opacity', 0); 14195 14196 $('#search-outer > #search form').css('transform', 'translateY(-30px)'); 14197 $('#search-outer #search .span_12 span').css('transform', 'translateY(20px)'); 14198 14199 $('#search-outer').show(); 14200 $('#search-outer').stop().transition({ 14201 scale: '1,0', 14202 'opacity': 1 14203 }, 0).transition({ 14204 scale: '1,1' 14205 }, 700, 'cubic-bezier(0.2, 1, 0.3, 1)'); 14206 14207 $('#search-outer > #search form').delay(350).transition({ 14208 'opacity': 1, 14209 'transform': 'translateY(0)' 14210 }, 700, 'cubic-bezier(0.2, 1, 0.3, 1)'); 14211 14212 $('#search-outer #search #close').delay(500).transition({ 14213 'opacity': 1 14214 }, 700, 'cubic-bezier(0.2, 1, 0.3, 1)'); 14215 14216 14217 $('#search-outer #search .span_12 span').delay(450).transition({ 14218 'opacity': 1, 14219 'transform': 'translateY(0)' 14220 }, 700, 'cubic-bezier(0.2, 1, 0.3, 1)'); 14221 14222 } 14223 14224 else if (!$body.hasClass('material')) { 14225 // Original theme skin. 14226 $('#search-outer').stop(true).fadeIn(600, 'easeOutExpo'); 14227 } 14228 else { 14229 14230 // Material theme skin. 14231 $('#header-outer[data-transparent-header="true"] .bg-color-stripe').css('transition', ''); 14232 $('#search-outer, #ajax-content-wrap').addClass('material-open'); 14233 nectarState.materialSearchOpen = true; 14234 $headerOuterEl.addClass('material-search-open'); 14235 $('#fp-nav').addClass('material-ocm-open'); 14236 14237 $(window).trigger('nectar-search-open'); 14238 14239 } 14240 14241 14242 setTimeout(function () { 14243 14244 $('#search input[type=text]').trigger('focus'); 14245 14246 if ($('#search input[type=text]').val() == $placeholder) { 14247 $('#search input[type=text]').setCursorPosition(0); 14248 } 14249 14250 }, 300); 14251 14252 14253 $(this).toggleClass('open-search'); 14254 14255 // Close slide out widget area. 14256 $('.slide-out-widget-area-toggle a:not(#toggle-nav).open:not(.animating)').trigger('click'); 14257 14258 return false; 14259 14260 }); 14261 14262 // Handle the placeholder value. 14263 $('body:not(.material)').on('keydown', '#search input[type=text]', function () { 14264 if ($(this).val() == $placeholder) { 14265 $(this).val(''); 14266 } 14267 });
14268 14269 $('body:not(.material)').on('keyup', '#search input[type=text]', function () { 14270 if ($(this).val().length == 0 ) { 14271 $(this).val($placeholder); 14272 $(this).setCursorPosition(0); 14273 } 14274 }); 14275 14276 14277 // Close search btn event. 14278 $body.on('click', '#close', function () { 14279 closeSearch(); 14280 $searchButtonEl.removeClass('open-search'); 14281 $('#header-outer .mobile-search').removeClass('open-search'); 14282 return false; 14283 }); 14284 14285 // Original and Ascend skin close search when clicking off. 14286 $('body:not(.material)').on('blur', '#search-box input[type=text]', function () { 14287 closeSearch(); 14288 $searchButtonEl.removeClass('open-search'); 14289 $('#header-outer .mobile-search').removeClass('open-search'); 14290 }); 14291 14292 14293 // Material skin close when clicking off the search. 14294 $('body.material').on('click', '#ajax-content-wrap', function (e) { 14295 if (e.originalEvent !== undefined) { 14296 closeSearch(); 14297 $searchButtonEl.removeClass('open-search'); 14298 $('#header-outer .mobile-search').removeClass('open-search'); 14299 14300 } 14301 }); 14302 14303 // Material skin close on esc button event. 14304 if ($('body.material').length > 0) { 14305 $(document).on('keyup', function (e) { 14306 14307 if (e.keyCode == 27) { 14308 closeSearch(); 14309 $searchButtonEl.removeClass('open-search'); 14310 14311 // Close ocm material 14312 if ($('.ocm-effect-wrap.material-ocm-open').length > 0) { 14313 $('.slide-out-widget-area-toggle.material-open a').trigger('click'); 14314 } 14315 } 14316 14317 }); 14318 } 14319 14320 14321 14322 // Called to hide the search bar. 14323 function closeSearch() { 14324 14325 if ($body.hasClass('ascend') || $('body[data-header-format="left-header"]').length > 0 && $('body.material').length == 0) { 14326 $('#search-outer').stop().transition({ 14327 'opacity': 0 14328 }, 300, 'cubic-bezier(0.2, 1, 0.3, 1)'); 14329 $searchButtonEl.addClass('inactive'); 14330 setTimeout(function () { 14331 $('#search-outer').hide(); 14332 $searchButtonEl.removeClass('inactive'); 14333 }, 300); 14334 } else if ($('body.material').length == 0) { 14335 $('#search-outer').stop(true).fadeOut(450, 'easeOutExpo'); 14336 } 14337 14338 if ($body.hasClass('material')) { 14339 14340 $(window).trigger('nectar-search-close'); 14341 14342 var closeTimeoutDur = ($headerOuterEl.hasClass('results-shown')) ? 800 : 400; 14343 setTimeout(function(){ 14344 $('#search-outer #s').val(''); 14345 },closeTimeoutDur); 14346 14347 $('#ajax-content-wrap').removeClass('material-open'); 14348 nectarState.materialSearchOpen = false; 14349 $headerOuterEl.removeClass('material-search-open'); 14350 $('#search-outer').removeClass('material-open'); 14351 $('#fp-nav').removeClass('material-ocm-open'); 14352 } 14353 14354 } 14355 14356 } 14357 14358 14359 14360 14361 14362 14363 /** 14364 * Header layout "Centered header bottom bar" functionality. 14365 * 14366 * @since 9.0 14367 */ 14368 function centeredNavBottomBarReposition() { 14369 14370 var $headerOuter = $headerOuterEl, 14371 $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'), 14372 $headerSpan3 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_3'), 14373 $secondaryHeader = $headerSecondaryEl, 14374 $headerBtns = $headerSpan3.find('nav >ul.buttons'), 14375 $navLogoMargin = parseInt($('body.material #header-outer').attr('data-padding')), 14376 $navLogoHeight = parseInt($('body.material #header-outer').attr('data-logo-height')), 14377 $separatorExtra = parseInt($headerSpan3.css('margin-bottom')), 14378 $triggerCondition = $navLogoMargin + $separatorExtra + $navLogoHeight + parseInt(nectarDOMInfo.secondaryHeaderHeight); 14379 14380 if ($secondaryHeader.length > 0) { 14381 14382 if ($('#header-outer[data-remove-fixed="1"]').length == 0 && $('#header-outer[data-condense="true"]').length > 0) { 14383 14384 setTimeout(function () { 14385 if( $headerSecondaryEl.css('display') != 'none' ) { 14386 nectarDOMInfo.secondaryHeaderHeight = $headerSecondaryEl.outerHeight(); 14387 } 14388 14389 }, 50); 14390 } 14391 14392 } 14393 14394 // Helper to determine if custom mobile breakpoint is active. 14395 function condenseCustomBreakPointHelper() { 14396 14397 var $withinCustomBreakpoint = mobileBreakPointCheck(); 14398 14399 // Adding class to prevent logo from hiding when opening OCM 14400 if ( $withinCustomBreakpoint ) { 14401 $headerOuterEl.addClass('within-custom-breakpoint'); 14402 } else { 14403 $headerOuterEl.removeClass('within-custom-breakpoint'); 14404 } 14405 } 14406 14407 14408 // Bind events if "Condense Header On Scroll" effect is enabled. 14409 if ($('#header-outer[data-condense="true"]').length > 0) { 14410 14411 $window.on('scroll.centeredNavCondense', centeredNavBottomFixed_Scroll); 14412 $window.trigger('scroll'); 14413 14414 $window.on('resize', function(){ 14415 if(nectarDOMInfo.winW < 1000 || mobileBreakPointCheck() ) { 14416 $headerOuter.addClass('force-condense-remove'); 14417 $window.off('scroll.centeredNavCondense'); 14418 } 14419 });
14420 14421 $window.on('smartresize', function() { 14422 14423 condenseCustomBreakPointHelper(); 14424 14425 if(nectarDOMInfo.winW >= 1000 && false == mobileBreakPointCheck() ) { 14426 14427 // Coming from mobile. 14428 if($headerOuter.hasClass('force-condense-remove')) { 14429 14430 // Remove condense effect. 14431 centeredNavBottomFixed_Scroll(); 14432 $headerOuter.removeClass('force-condense-remove'); 14433 14434 // See if the condense effect needs to be reapplied. 14435 setTimeout(function() { 14436 14437 if(nectarDOMInfo.scrollTop >= $triggerCondition) { 14438 $headerOuter.addClass('force-condense'); 14439 centeredNavBottomFixed_Scroll(); 14440 $headerOuter.removeClass('force-condense'); 14441 } 14442 // Bind scroll event. 14443 $window.on('scroll.centeredNavCondense', centeredNavBottomFixed_Scroll); 14444 },200); 14445 14446 } 14447 } 14448 14449 }); 14450 14451 condenseCustomBreakPointHelper(); 14452 14453 } 14454 14455 14456 14457 function centeredNavBottomFixed_Scroll() { 14458 14459 // Bypass calculating. 14460 if (nectarDOMInfo.winW < 1000 || 14461 $('body.page-template-template-no-header').length > 0 || 14462 $('body.page-template-template-no-header-footer').length > 0 || 14463 $('body.material-ocm-open').length > 0 || 14464 $('#header-outer[data-has-menu="true"][data-format="centered-menu-bottom-bar"] .span_9').css('display') == 'none' || 14465 $('#header-outer[data-has-menu="true"][data-format="centered-menu-bottom-bar"] .span_9 > nav').css('display') == 'none') { 14466 return; 14467 } 14468 14469 $bodyBorderTop = ($bodyBorderTop.length > 0 && nectarDOMInfo.secondaryHeaderHeight > 0) ? $bodyBorderTop.height() : 0; 14470 14471 // Add condense effect. 14472 if ($headerOuter.hasClass('force-condense') || !$headerOuter.hasClass('fixed-menu') && nectarDOMInfo.scrollTop >= $triggerCondition) { 14473 14474 var amountToMove = (parseInt($headerSpan9.position().top) - $navLogoMargin - parseInt(nectarDOMInfo.adminBarHeight)) + parseInt(nectarDOMInfo.secondaryHeaderHeight) - $bodyBorderTop; 14475 14476 // Megamenu removes transparency option 14477 if ($('#header-outer[data-megamenu-rt="1"]').length > 0 && $('#header-outer .megamenu').length > 0 && $('#header-outer[data-transparent-header="true"]').length > 0) { 14478 $headerOuterEl.removeClass('no-transition'); 14479 } 14480 14481 $headerOuter.addClass('fixed-menu').removeClass('transparent').css({ 14482 'top': '-' + amountToMove + 'px', 14483 'position': 'fixed' 14484 }); 14485 14486 if( !$headerOuter.is('[data-menu-bottom-bar-align="left"]') ) { 14487 14488 var $headerNavBarOffset = ($('header#top .span_9 nav > ul').length > 0) ? $('header#top .span_9 nav > ul').offset().top : 0; 14489 var $headerButtonsOffset = ($headerBtns.find('li:first-child > *').length > 0) ? $headerBtns.find('li:first-child > *').offset().top : 0; 14490 var $headerButtonsHeight = ($headerSpan9.find('.sf-menu > li > a').length > 0) ? (20 - parseInt($headerSpan9.find('.sf-menu > li > a').height())) / 2 : 2; 14491 14492 $headerBtns.css('transform', 'translateY(' + Math.ceil(parseInt($headerNavBarOffset) - parseInt($headerButtonsOffset) - $headerButtonsHeight) + 'px)'); 14493 $headerBtns.find('.nectar-woo-cart').css('height', $headerOuter.height() + parseInt($headerOuter.css('top')) - parseInt(nectarDOMInfo.adminBarHeight)); 14494 } 14495 14496 } 14497 14498 // Remove condense effect. 14499 else if ($headerOuter.hasClass('force-condense-remove') || $headerOuter.hasClass('fixed-menu') && nectarDOMInfo.scrollTop < $triggerCondition ) { 14500 14501 $headerOuter.removeClass('fixed-menu').css({ 14502 'top': '0', 14503 'position': 'absolute' 14504 }); 14505 14506 $headerBtns.css('transform', 'translateY(0px)'); 14507 $headerBtns.find('.nectar-woo-cart').css('height', ''); 14508 14509 if ($('#header-outer.transparent').length == 0) { 14510 14511 if ($('#header-outer[data-megamenu-rt="1"]').length > 0 && 14512 $('#header-outer .megamenu').length > 0) { 14513 $headerOuterEl.removeClass('no-transition'); 14514 } 14515 14516 if ($('#header-outer[data-megamenu-rt="1"]').length > 0 && 14517 $('#header-outer[data-transparent-header="true"]').length > 0 && 14518 $('#header-outer .megamenu').length > 0) { 14519 14520 if ($headerOuterEl.attr('data-transparent-header') == 'true' && 14521 $('.nectar-box-roll').length == 0 && 14522 $('.megamenu.sfHover:not(.width-75):not(.width-50)').length == 0) { 14523 14524 $headerOuterEl.addClass('transparent'); 14525 $headerOuterEl.removeClass('no-transition'); 14526 14527 } 14528 else if ($headerOuterEl.attr('data-transparent-header') == 'true' && 14529 $('.nectar-box-roll').length == 0 && 14530 $('.megamenu.sfHover').length > 0) { 14531 14532 $headerOuterEl.addClass('no-transition'); 14533 } 14534 14535 } 14536 14537 else { 14538 if ($headerOuterEl.attr('data-transparent-header') == 'true' && $('.nectar-box-roll').length == 0) { 14539 $headerOuterEl.addClass('transparent'); 14540 } 14541 } 14542 14543 } // endif transparent header conditional. 14544 14545 14546 }
14546 // End Remove condense effect. 14547 14548 } // End centeredNavBottomFixed_Scroll. 14549 14550 14551 14552 } 14553 14554 14555 14556 14557 /** 14558 * Header layout "Centered header bottom bar" initialization. 14559 * 14560 * @since 10.5 14561 */ 14562 function centeredNavBottomBarInit() { 14563 14564 if ($('#header-outer[data-format="centered-menu-bottom-bar"]').length > 0) { 14565 centeredNavBottomBarReposition(); 14566 } 14567 14568 } 14569 14570 14571 14572 14573 14574 /** 14575 * Header layout "Centered logo between menu". 14576 * 14577 * Splits the main navigation menu into two sections placed on each side of logo. 14578 * 14579 * @since 8.0 14580 */ 14581 function centeredLogoMargins() { 14582 14583 if (nectarDOMInfo.winW > 1000) { 14584 14585 var $navItemLength = $('#header-outer[data-format="centered-logo-between-menu"] #top nav > .sf-menu:not(.buttons) > li').length; 14586 14587 if ($('#header-outer #social-in-menu').length > 0) { 14588 $navItemLength--; 14589 } 14590 14591 var $centerLogoWidth, 14592 $extraMenuSpace; 14593 14594 if ($('#header-outer #top .row .col.span_3 #logo img:visible').length == 0) { 14595 $centerLogoWidth = parseInt($('#header-outer #top .row .col.span_3').width()); 14596 } else { 14597 $centerLogoWidth = parseInt($('#header-outer #top .row .col.span_3 img:visible').width()); 14598 } 14599 14600 if ($('#header-outer[data-lhe="animated_underline"]').length > 0) { 14601 $extraMenuSpace = parseInt($('header#top nav > ul > li:first-child > a').css('margin-right')); 14602 } else { 14603 $extraMenuSpace = parseInt($('header#top nav > ul > li:first-child > a').css('padding-right')); 14604 } 14605 14606 if ($extraMenuSpace > 30) { 14607 $extraMenuSpace += 45; 14608 } else if ($extraMenuSpace > 20) { 14609 $extraMenuSpace += 40; 14610 } else { 14611 $extraMenuSpace += 30; 14612 } 14613 14614 if (!$body.hasClass('rtl')) { 14615 $('#header-outer[data-format="centered-logo-between-menu"] #top nav > .sf-menu:not(.buttons) > li:nth-child(' + Math.floor($navItemLength / 2) + ')').css({ 14616 'margin-right': ($centerLogoWidth + $extraMenuSpace) + 'px' 14617 }).addClass('menu-item-with-margin'); 14618 } else { 14619 $('#header-outer[data-format="centered-logo-between-menu"] #top nav > .sf-menu:not(.buttons) > li:nth-child(' + Math.floor($navItemLength / 2) + ')').css({ 14620 'margin-left': ($centerLogoWidth + $extraMenuSpace) + 'px' 14621 }).addClass('menu-item-with-margin'); 14622 } 14623 14624 var $leftMenuWidth = 0; 14625 var $rightMenuWidth = 0; 14626 14627 $('#header-outer[data-format="centered-logo-between-menu"] #top nav > .sf-menu:not(.buttons) > li:not(#social-in-menu)').each(function (i) { 14628 if (i + 1 <= Math.floor($navItemLength / 2)) { 14629 $leftMenuWidth += $(this).width(); 14630 } else { 14631 $rightMenuWidth += $(this).width(); 14632 } 14633 14634 }); 14635 14636 var $menuDiff = Math.abs($rightMenuWidth - $leftMenuWidth); 14637 14638 if ($leftMenuWidth > $rightMenuWidth || ($body.hasClass('rtl') && $leftMenuWidth < $rightMenuWidth) ) { 14639 $('#header-outer #top .row > .col.span_9').css('padding-right', $menuDiff); 14640 } else { 14641 $('#header-outer #top .row > .col.span_9').css('padding-left', $menuDiff); 14642 } 14643 14644 $('#header-outer[data-format="centered-logo-between-menu"] nav').css('visibility', 'visible'); 14645 14646 } 14647 14648 else if ($('#header-outer[data-format="centered-logo-between-menu"]').length > 0 && nectarDOMInfo.winW < 1000) { 14649 $('#header-outer .row > .col.span_9').css({ 14650 'padding-right': '0', 14651 'padding-left': '0' 14652 }); 14653 } 14654 14655 } 14656 14657 14658 /** 14659 * Header layout "Centered logo between menu" initialization. 14660 * 14661 * @since 10.5 14662 */ 14663 function centeredLogoHeaderInit() { 14664 14665 if($('#header-outer[data-format="centered-logo-between-menu"]').length > 0) { 14666 14667 if(!usingLogoImage) { 14668 centeredLogoMargins(); 14669 } 14670 else if(usingLogoImage && $('#header-outer[data-format="centered-logo-between-menu"]').length > 0 && $('header#top #logo img:first[src]').length > 0) { 14671 14672 //fadein img on load 14673 var tempLogoImg = new Image(); 14674 tempLogoImg.src = $('header#top #logo img:first').attr('src'); 14675 14676 tempLogoImg.onload = function() { 14677 centeredLogoMargins(); 14678 }; 14679 14680 } 14681 14682 // Resize event. 14683 $window.on('smartresize', centeredLogoMargins); 14684 14685 } 14686 14687 } 14688 14689 14690 14691 14692 14693 14694 14695 14696 /** 14697 * Handle basic items before initializing effects. 14698 * 14699 * @since 10.5 14700 */ 14701 function headerNavPreInit() { 14702 14703 // Deactivate hide header until needed effect on mobile. 14704 if (nectarDOMInfo.usingMobileBrowser && $('#header-outer[data-remove-fixed="1"]').length == 0) { 14705 $body.attr('data-hhun', '0'); 14706 } 14707 14708 // Page fullscreen rows does not need permanent transparent. 14709 if ($('#nectar_fullscreen_rows').length > 0) { 14710 ($headerOuterEl.attr('data-permanent-transparent', 'false')); 14711 } 14712 14713 // Set mobile header height. 14714 if (nectarDOMInfo.usingMobileBrowser && $('#header-outer[data-mobile-fixed="1"]').length > 0 && 14715 $('#header-outer[data-transparent-header="true"]').length == 0) { 14716 $('#header-space').css('height', $headerOuterEl.outerHeight()); 14717 } 14718 14719 } 14720 14721 14722 14723 14724 14725 14726 /** 14727 * Hide header until needed. 14728 * 14729 * Used when "Header Hide Until Needed" is active. 14730 * 14731 * @since 10.5 14732 */ 14733 var hhunState = { 14734 timeoutQueued: false, 14735 visible: true 14736 } 14737 function hhunHeaderEffect() { 14738 14739 var previousScroll = 0, // previous scroll position 14740 menuOffset = ( headerTransparent == false && $('#page-header-bg[data-
14740parallax="1"]').length > 0 ) ? 200 : 60, // height of menu (once scroll passed it, menu is hidden) 14741 hideShowOffset = 3, // scrolling value after which triggers hide/show menu 14742 stickyPageSubmenu = ( $('.page-submenu[data-sticky="true"]').length > 0 ) ? true : false, 14743 bodyOffsetHeight = document.body.offsetHeight; 14744 14745 function getBodyHeight() { 14746 if( nectarDOMInfo.winW > 999 && nectarState.materialOffCanvasOpen != true ) { 14747 bodyOffsetHeight = document.body.offsetHeight; 14748 } 14749 } 14750 // Periodically update the body height. 14751 setInterval(getBodyHeight, 1500); 14752 14753 // Called in RAF loop to calculate the header visibility. 14754 function hhunCalcs() { 14755 14756 $headerOuterEl.addClass('detached'); 14757 14758 var currentScroll = nectarDOMInfo.scrollTop, // Gets current scroll position 14759 scrollDifference = Math.abs(currentScroll - previousScroll); // Calculates how fast user is scrolling 14760 14761 // Stop scrolling while animated anchors / box roll 14762 if ( nectarState.animatedScrolling == true && $('#header-outer.detached').length > 0 || nectarState.preventScroll == true ) { 14763 14764 if (nectarDOMInfo.winW > 999) { 14765 14766 if (currentScroll > menuOffset) { 14767 14768 // Remove transparent when clicking anchor from the top 14769 if( nectarState.animatedScrolling == true && headerTransparent == true && nectarState.permanentTransHeader == false ) { 14770 $headerOuterEl.removeClass('transparent').addClass('scrolling'); 14771 } 14772 14773 // Still keep scroll tracking to continue hiding menu. 14774 previousScroll = nectarDOMInfo.scrollTop; 14775 currentScroll = nectarDOMInfo.scrollTop; 14776 14777 } 14778 14779 requestAnimationFrame(hhunCalcs); 14780 return; 14781 } 14782 } 14783 14784 // Stop when material ocm or material search is open 14785 if ( nectarState.materialOffCanvasOpen == true || nectarState.materialSearchOpen == true ) { 14786 if (nectarDOMInfo.winW > 999) { 14787 14788 // Still handle transparency when scrolling with material search open. 14789 if( nectarState.materialSearchOpen == true && headerTransparent == true) { 14790 14791 if( nectarState.permanentTransHeader == false && currentScroll > menuOffset ) { 14792 $headerOuterEl.removeClass('transparent').addClass('scrolling'); 14793 } else { 14794 $headerOuterEl.addClass('transparent').removeClass('scrolling'); 14795 } 14796 14797 } 14798 14799 requestAnimationFrame(hhunCalcs); 14800 return; 14801 } 14802 } 14803 14804 // Stop on mobile if not using sticky option 14805 if (headerMobileFixed == false && nectarDOMInfo.winW < 1000) { 14806 $headerOuterEl.removeClass('detached').removeClass('scrolling'); 14807 return; 14808 } 14809 14810 14811 if (!$headerOuterEl.hasClass('side-widget-open') && !$('#header-outer .slide-out-widget-area-toggle a').hasClass('animating')) { 14812 14813 var heightToAdjust; 14814 14815 // Remove transparent and body border margin 14816 if (currentScroll > 1) { 14817 14818 // Handle secondary header 14819 if ($headerSecondaryEl.length > 0) { 14820 if (currentScroll > menuOffset) { 14821 $headerSecondaryEl.addClass('hide-up'); 14822 $headerOuterEl.css('transform', 'translateY(-' + nectarDOMInfo.secondaryHeaderHeight + 'px)'); 14823 } else { 14824 $headerSecondaryEl.removeClass('hide-up'); 14825 $headerOuterEl.css('transform', '0px)'); 14826 } 14827 } 14828 14829 } 14830 14831 // Scrolled past menu 14832 if (currentScroll > menuOffset) { 14833 14834 // Handle transparency 14835 if ( nectarState.permanentTransHeader == false ) { 14836 14837 if( hhunState.timeoutQueued == false ) { 14838 setTimeout(function() { 14839 $headerOuterEl.removeClass('transparent'); 14840 $headerOuterEl.addClass('scrolling'); 14841 hhunState.timeoutQueued = false; 14842 },400); 14843 } 14844 hhunState.timeoutQueued = true; 14845 14846 } 14847 14848 // Scrolled past detach point add class to fix menu 14849 if (!$headerOuterEl.hasClass('detached')) { 14850 14851 $headerOuterEl 14852 .addClass('detached') 14853 .removeClass('parallax-contained'); 14854 } 14855 14856 $headerOuterEl.removeClass('no-transition'); 14857 14858 14859 // Scrolling faster than hideShowOffset hide/show menu 14860 if (scrollDifference >= hideShowOffset) { 14861 14862 if (currentScroll > previousScroll) { 14863 14864 // Hide menu 14865 if (!$headerOuterEl.hasClass('invisible')) { 14866 14867 $headerOuterEl 14868 .addClass('invisible') 14869 .removeClass('at-top'); 14870 14871 // Close submenus 14872 if ($(".sf-menu").length > 0 && $().superfish) { 14873 $(".sf-menu").superfish('hide'); 14874 $('header#top nav > ul.sf-menu > li.menu-item-over').removeClass('menu-item-over'); 14875 } 14876 14877 } 14878 14879 if( stickyPageSubmenu == true ) { 14880 $('.page-submenu.stuck') 14881 .css('transform', 'translateY(0px)') 14882 .addClass('header-not-visible'); 14883 } 14884 14885 } else { 14886 14887 // Show menu 14888 if ($headerOuterEl.hasClass('invisible')) { 14889 $headerOuterEl.removeClass('invisible'); 14890 } 14891 14892 // Page submenu adjust 14893 if( stickyPageSubmenu == true ) { 14894 14895 heightToAdjust = $headerOuterEl.outerHeight(); 14896 14897 if( $headerSecondaryEl.length > 0) { 14898 heightToAdjust -= nectarDOMInfo.secondaryHeaderHeight; 14899 } 14900 14901 if ($bodyBorderTop.length > 0 && $('body.mobile').length == 0) { 14902 14903 $bodyBorderSizeToRemove = ($bodyBorderHeaderColorMatch) ? $bodyBorderTop.height() : 0; 14904 14905 $('.page-submenu.stuck') 14906 .css('transform', 'translateY(' + (heightToAdjust - $bodyBorderSizeToRemove) + 'px)') 14907 .removeClass('header-not-visible'); 14908 14909 } else { 14910 $('.page-submenu.stuck') 14911 .css('transform', 'translateY(' + heightToAdjust + 'px)') 14912 .removeClass('header-not-visible'); 14913 } 14914 14915 } // End sticky page sub conditional. 14916 14917 } 14918 14919 } 14920 14921 } 14922 else { 14923 // At top of document. 14924 var $topDetachNum = ($('#header-outer[data-using-secondary="1"]').length > 0) ? 32 : 0; 14925 if ($bodyBorderTop.length > 0) { 14926 $topDetachNum = ($('#header-outer[data-using-secondary="1"]').length > 0) ? 32 + $bodyBorderTop.height() : $bodyBorderTop.height(); 14927 } 14928 14929 if (currentScroll <= $topDetachNum) { 14930 14931 $headerOuterEl 14932 .addClass('at-top') 14933 .removeClass('invisible') 14934 .removeClass('scrolling'); 14935 14936 // Megamenu removes transparent. 14937 if ($('#header-outer[data-megamenu-rt="1"]').length > 0 && 14938 headerTransparent == true && 14939 $('#header-outer .megamenu').length > 0) { 14940 14941 if ($('.nectar-box-roll').length == 0 && 14942 $('.megamenu.sfHover:not(.width-75):not(.width-50)').length == 0) { 14943 14944 $headerOuterEl 14945 .addClass('transparent') 14946 .css('transform', 'translateY(0)') 14947 .removeClass('no-transition'); 14948 14949 } else if ($('.nectar-box-roll').length > 0) { 14950 14951 $headerOuterEl 14952 .css('transform', 'translateY(0)') 14953 .addClass('at-top-before-box'); 14954 } 14955 14956 } else { 14957 14958 if (headerTransparent == true && 14959 $('.nectar-box-roll').length == 0) { 14960 14961 $headerOuterEl 14962 .addClass('transparent') 14963 .css('transform', 'translateY(0)'); 14964 14965 } else if ($('.nectar-box-roll').length > 0) { 14966 14967 $headerOuterEl 14968 .css('transform', 'translateY(0)') 14969 .addClass('at-top-before-box'); 14970 } 14971 } 14972
14973 if ($('#page-header-bg[data-parallax="1"]').length > 0) { 14974 14975 $headerOuterEl 14976 .addClass('parallax-contained') 14977 .css('transform', 'translateY(0)'); 14978 } 14979 14980 } 14981 14982 } 14983 14984 // At the bottom of document - show menu 14985 if ((nectarDOMInfo.winH + nectarDOMInfo.scrollTop) >= bodyOffsetHeight) { 14986 14987 $headerOuterEl.removeClass('invisible'); 14988 14989 // Page submenu adjust 14990 if( stickyPageSubmenu == true ) { 14991 14992 heightToAdjust = $headerOuterEl.outerHeight(); 14993 if( $headerSecondaryEl.length > 0) { 14994 heightToAdjust -= nectarDOMInfo.secondaryHeaderHeight; 14995 } 14996 14997 if ($bodyBorderTop.length > 0 && $('body.mobile').length == 0) { 14998 14999 $bodyBorderSizeToRemove = ($bodyBorderHeaderColorMatch) ? $bodyBorderTop.height() : 0; 15000 $('.page-submenu.stuck') 15001 .css('transform', 'translateY(' + (heightToAdjust - $bodyBorderSizeToRemove) + 'px)') 15002 .removeClass('header-not-visible'); 15003 } else { 15004 15005 $('.page-submenu.stuck') 15006 .css('transform', 'translateY(' + heightToAdjust + 'px)') 15007 .removeClass('header-not-visible'); 15008 } 15009 15010 } // End sticky page submenu conditional. 15011 15012 } 15013 15014 } 15015 15016 // Keep track of current scroll position 15017 previousScroll = currentScroll; 15018 15019 if (nectarDOMInfo.winW > 999) { 15020 requestAnimationFrame(hhunCalcs); 15021 } 15022 15023 } 15024 15025 // Start the animation loop. 15026 hhunCalcs(); 15027 15028 } 15029 15030 15031 15032 /** 15033 * Shrink the header navigation size. 15034 * 15035 * Used when "Header Resize On Scroll" is active. 15036 * 15037 * @since 1.0 15038 */ 15039 function smallNav() { 15040 15041 var $offset = nectarDOMInfo.scrollTop, 15042 $windowWidth = nectarDOMInfo.winW, 15043 $scrollTriggerOffset = 30; 15044 15045 if( headerTransparent == true ) { 15046 $scrollTriggerOffset = 0; 15047 } 15048 15049 if ($offset > $scrollTriggerOffset && $windowWidth >= 1000 && $('body.material-ocm-open').length == 0) { 15050 15051 15052 // Going to small when material search is closing, it must be closed immediately 15053 if ($body.is('.material')) { 15054 15055 if ($('#search-outer.material-open').length == 0) { 15056 $('#header-outer[data-transparent-header="true"] .bg-color-stripe').css('transition', 'none'); 15057 } 15058 15059 // Secondary header 15060 if ($headerSecondaryEl.length > 0) { 15061 $headerSecondaryEl.addClass('hide-up'); 15062 $headerOuterEl.css('transform', 'translateY(-' + nectarDOMInfo.secondaryHeaderHeight + 'px)'); 15063 } 15064 15065 } 15066 15067 if ($('#header-outer[data-megamenu-rt="1"]').length > 0 && 15068 $('#header-outer[data-transparent-header="true"]').length > 0 && 15069 $('#header-outer .megamenu').length > 0) { 15070 15071 if ($headerOuterEl.attr('data-transparent-header') == 'true' && 15072 $('#header-outer.side-widget-open').length == 0 && 15073 $('#header-outer[data-permanent-transparent="1"]').length == 0 && 15074 $('.megamenu.sfHover:not(.width-75):not(.width-50)').length == 0) { 15075 $headerOuterEl.removeClass('transparent'); 15076 $headerOuterEl.removeClass('no-transition'); 15077 } 15078 15079 } else { 15080 15081 if ($headerOuterEl.attr('data-transparent-header') == 'true' && 15082 $('#header-outer.side-widget-open').length == 0 && 15083 $('#header-outer[data-permanent-transparent="1"]').length == 0) { 15084 $headerOuterEl.removeClass('transparent'); 15085 } 15086 15087 } 15088 15089 // Centered logo between menu. 15090 $('#header-outer:not(.small-nav) header#top nav > ul > li.menu-item-with-margin').stop(true, true).animate({ 15091 'margin-right': (parseInt($('header#top nav > ul > li.menu-item-with-margin').css('margin-right')) - parseInt(logoShrinkNum) * 3) + 'px' 15092 }, { 15093 queue: false, 15094 duration: 250, 15095 easing: 'easeOutCubic' 15096 }); 15097 15098 // Add small nav class. 15099 $('#header-outer, #search-outer').addClass('small-nav'); 15100 15101 // Body border full width side padding 15102 if ($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 && 15103 $bodyBorderTop.length > 0 && 15104 $bodyBorderHeaderColorMatch == true) { 15105 15106 $('#header-outer[data-full-width="true"] header > .container').stop(true, true).animate({ 15107 'padding': '0' 15108 }, { 15109 queue: false, 15110 duration: 250, 15111 easing: 'easeOutCubic' 15112 });
15113 15114 } 15115 15116 15117 // Box roll effect 15118 if ($('.nectar-box-roll').length > 0 && $('#header-outer[data-permanent-transparent="1"]').length == 0) { 15119 $('#ajax-content-wrap').animate({ 15120 'margin-top': (Math.floor(($logoHeight - logoShrinkNum) + (headerPadding * 2) / 1.8 + nectarDOMInfo.adminBarHeight + nectarDOMInfo.secondaryHeaderHeight)) 15121 }, { 15122 queue: false, 15123 duration: 250, 15124 easing: 'easeOutCubic' 15125 }); 15126 } 15127 15128 $window.off('scroll.headerResizeEffect', smallNav); 15129 $window.on('scroll.headerResizeEffect', bigNav); 15130 15131 // Dark slider coloring border 15132 $('#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'); 15133 $('#header-outer[data-transparent-header="true"] .cart-menu').css('transition', 'none'); 15134 setTimeout(function () { 15135 $('#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'); 15136 $('#header-outer[data-transparent-header="true"] .cart-menu').css('transition', 'border-color 0.30s ease'); 15137 }, 300); 15138 15139 } 15140 15141 } 15142 15143 15144 /** 15145 * Return header navigation size to full. 15146 * 15147 * Used when "Header Resize On Scroll" is active. 15148 * 15149 * @since 1.0 15150 */ 15151 function bigNav() { 15152 15153 var $offset = nectarDOMInfo.scrollTop, 15154 $windowWidth = nectarDOMInfo.winW, 15155 $scrollTriggerOffset = 30; 15156 15157 if ($body.is('.material-ocm-open')) { 15158 return false; 15159 } 15160 15161 if( headerTransparent == true ) { 15162 $scrollTriggerOffset = 0; 15163 } 15164 15165 if ($offset <= $scrollTriggerOffset && $windowWidth >= 1000 || $('.small-nav').length > 0 && $('#ajax-content-wrap.no-scroll').length > 0) { 15166 15167 $('#header-outer, #search-outer').removeClass('small-nav'); 15168 15169 if ($('#header-outer[data-megamenu-rt="1"]').length > 0 && 15170 $('#header-outer[data-transparent-header="true"]').length > 0 && 15171 $('#header-outer .megamenu').length > 0) { 15172 15173 if ($headerOuterEl.attr('data-transparent-header') == 'true' && 15174 $('.nectar-box-roll').length == 0 && 15175 $('.megamenu.sfHover:not(.width-75):not(.width-50)').length == 0) { 15176 15177 $headerOuterEl.addClass('transparent'); 15178 $headerOuterEl.removeClass('no-transition'); 15179 } 15180 15181 } else { 15182 15183 if ($headerOuterEl.attr('data-transparent-header') == 'true' && $('.nectar-box-roll').length == 0) { 15184 $headerOuterEl.addClass('transparent'); 15185 } 15186 15187 } 15188 15189 // Body border full width side padding 15190 if ($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 && 15191 $bodyBorderTop.length > 0 && 15192 $bodyBorderHeaderColorMatch == true) { 15193 15194 $('#header-outer[data-full-width="true"] header > .container').stop(true, true).animate({ 15195 'padding': '0 28px' 15196 }, { 15197 queue: false, 15198 duration: 250, 15199 easing: 'easeOutCubic' 15200 }); 15201 15202 } 15203 15204 // centered logo between menu. 15205 $('header#top nav > ul > li.menu-item-with-margin').stop(true, true).animate({ 15206 'margin-right': (parseInt($('header#top nav > ul > li.menu-item-with-margin').css('margin-right')) + parseInt(logoShrinkNum) * 3) + 'px' 15207 }, { 15208 queue: false, 15209 duration: 150, 15210 easing: 'easeOutCubic' 15211 }); 15212 15213 15214 // Secondary header 15215 if ($headerSecondaryEl.length > 0) { 15216 15217 $headerSecondaryEl.removeClass('hide-up'); 15218 $headerOuterEl 15219 .removeClass('hide-up') 15220 .css('transform', 'translateY(0%)'); 15221 15222 } 15223 15224 // Box roll 15225 if ($('.nectar-box-roll').length > 0 && $('#header-outer[data-permanent-transparent="1"]').length == 0) { 15226 $('#ajax-content-wrap').animate({ 15227 'margin-top': (Math.floor(($logoHeight) + (headerPadding * 2) + nectarDOMInfo.adminBarHeight + nectarDOMInfo.secondaryHeaderHeight)) 15228 }, { 15229 queue: false, 15230 duration: 250, 15231 easing: 'easeOutCubic' 15232 });
15233 } 15234 15235 $window.off('scroll.headerResizeEffect', bigNav); 15236 $window.on('scroll.headerResizeEffect', smallNav); 15237 15238 // Dark slider coloring border 15239 $('#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'); 15240 $('#header-outer[data-transparent-header="true"] .cart-menu').css('transition', 'none'); 15241 setTimeout(function () { 15242 $('#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'); 15243 $('#header-outer[data-transparent-header="true"] .cart-menu').css('transition', 'border-color 0.30s ease'); 15244 }, 300); 15245 } 15246 15247 } 15248 15249 15250 15251 /** 15252 * Default scroll event to handle transparency/secondary header when no header effects are enabled. 15253 * 15254 * @since 4.0 15255 */ 15256 function opaqueCheck() { 15257 15258 // The condense header effect will bypass this unless in the custom mobile breakpoint (which is defined in theme options). 15259 if ($('#header-outer[data-format="centered-menu-bottom-bar"][data-condense="true"]').length > 0 && !$headerOuterEl.hasClass('within-custom-breakpoint') ) { 15260 return; 15261 } 15262 15263 if (nectarDOMInfo.scrollTop > 0) { 15264 15265 if ($('body.material').length > 0) { 15266 $headerOuterEl.addClass('scrolled-down'); 15267 15268 // Secondary header 15269 if ($headerSecondaryEl.length > 0 && nectarDOMInfo.winW > 1000) { 15270 $headerSecondaryEl.addClass('hide-up'); 15271 $headerOuterEl.css('transform', 'translateY(-' + nectarDOMInfo.secondaryHeaderHeight + 'px)'); 15272 } 15273 } 15274 15275 if ($headerOuterEl.attr('data-transparent-header') == 'true' && $('#header-outer[data-permanent-transparent="1"]').length == 0) { 15276 $headerOuterEl.removeClass('transparent').addClass('scrolled-down'); 15277 } 15278 15279 // Switch event to watch. 15280 $window.off('scroll.headerResizeEffectOpaque', opaqueCheck); 15281 $window.on('scroll.headerResizeEffectOpaque', transparentCheck); 15282 } 15283 } 15284 15285 15286 /** 15287 * Default scroll event to handle transparency/secondary header when no header effects are enabled. 15288 * 15289 * @since 4.0 15290 */ 15291 function transparentCheck() { 15292 15293 // The condense header effect will bypass this unless in the custom mobile breakpoint (which is defined in theme options). 15294 if ($('#header-outer[data-format="centered-menu-bottom-bar"][data-condense="true"]').length > 0 && !$headerOuterEl.hasClass('within-custom-breakpoint') ) { 15295 return; 15296 } 15297 15298 if (nectarDOMInfo.scrollTop == 0 && $('body.material-ocm-open').length == 0) { 15299 15300 if ($('#header-outer[data-megamenu-rt="1"]').length > 0 && 15301 $('#header-outer[data-transparent-header="true"]').length > 0 && 15302 $('#header-outer .megamenu').length > 0) { 15303 15304 if ($headerOuterEl.attr('data-transparent-header') == 'true' && $('.megamenu.sfHover:not(.width-75):not(.width-50)').length == 0) { 15305 15306 $headerOuterEl 15307 .addClass('transparent') 15308 .removeClass('scrolled-down'); 15309 15310 $headerOuterEl.removeClass('no-transition'); 15311 15312 } else if ($headerOuterEl.attr('data-transparent-header') == 'true') { 15313 15314 $headerOuterEl.removeClass('scrolled-down'); 15315 } 15316 15317 } else { 15318 15319 if ($headerOuterEl.attr('data-transparent-header') == 'true') { 15320 $headerOuterEl 15321 .addClass('transparent') 15322 .removeClass('scrolled-down'); 15323 } 15324 15325 } 15326 15327 if ($('body.material').length > 0) { 15328 $headerOuterEl.removeClass('scrolled-down'); 15329 15330 // Secondary header 15331 if ($headerSecondaryEl.length > 0 && nectarDOMInfo.winW > 1000) { 15332 15333 $headerSecondaryEl.removeClass('hide-up'); 15334 $headerOuterEl 15335 .removeClass('hide-up') 15336 .css('transform', 'translateY(0%)'); 15337 } 15338 } 15339 15340 // Switch event to watch. 15341 $window.off('scroll.headerResizeEffectOpaque', transparentCheck); 15342 $window.on('scroll.headerResizeEffectOpaque', opaqueCheck); 15343 } 15344 15345 } 15346 15347 15348 15349 15350 /** 15351 * Mobile header event for handling transparency/secondary header. 15352 * 15353 * @since 10.5 15354 * @see bindScrollEffectsMobile 15355 */ 15356 function mobileHeaderRAF() { 15357 15358 if ( nectarState.materialOffCanvasOpen == true ) { 15359 requestAnimationFrame(mobileHeaderRAF); 15360 return; 15361 } 15362 // Scrolled down. 15363 if (nectarDOMInfo.scrollTop > 5 ) { 15364 15365 if( nectarState.mobileHeader != 'scrolled' ) { 15366 15367 if ( nectarState.permanentTransHeader == false ) { 15368 $headerOuterEl.removeClass('transparent'); 15369 } 15370 15371 if (nectarDOMInfo.secondaryHeaderHeight > 0) { 15372 $headerSecondaryEl.addClass('hide-up'); 15373 $headerOuterEl.css('transform', 'translateY(-' + nectarDOMInfo.secondaryHeaderHeight + 'px)').addClass('hidden-secondary'); 15374 } else { 15375 $headerOuterEl.removeClass('hidden-secondary'); 15376 } 15377 15378 $headerOuterEl.addClass('scrolled-down'); 15379 15380 // Update state. 15381 nectarState.mobileHeader = 'scrolled'; 15382 } 15383 15384 } 15385 // At top. 15386 else { 15387 15388 if( nectarState.mobileHeader != 'at-top' ) { 15389 15390 if ($headerOuterEl.attr('data-transparent-header') == 'true') { 15391 $headerOuterEl.addClass('transparent'); 15392 } 15393 15394 if (nectarDOMInfo.secondaryHeaderHeight > 0) { 15395 $headerSecondaryEl.removeClass('hide-up'); 15396 $headerOuterEl.css('transform', 'translateY(0px)'); 15397 } 15398 $headerOuterEl.removeClass('hidden-secondary').removeClass('scrolled-down'); 15399 15400 // Update state. 15401 nectarState.mobileHeader = 'at-top'; 15402 } 15403 15404 } 15405 15406 if (nectarDOMInfo.winW < 1000) { 15407 requestAnimationFrame(mobileHeaderRAF); 15408 } 15409 } 15410 15411 15412 15413 /** 15414 * Bind mobile header scroll effects. 15415 * 15416 * @since 10.5 15417 * @see headerNavScrollInit 15418 */ 15419 function bindScrollEffectsMobile() { 15420 15421 if (nectarDOMInfo.winW > 999) { 15422 return; 15423 } 15424 15425 // Reset state. 15426 nectarState.mobileHeader = ''; 15427 15428 // Unbind desktop effects. 15429 $window.off('scroll.headerResizeEffect'); 15430 $window.off('scroll.headerResizeEffectOpaque'); 15431 15432 // Remove HHUN classes. 15433 $headerOuterEl 15434 .removeClass('scrolled-down') 15435 .removeClass('detached') 15436 .removeClass('invisible') 15437 .removeClass('at-top') 15438 .css('transform', 'none'); 15439 15440 // Handle mobile transparent class. 15441 if ($('#header-outer[data-mobile-fixed="1"]').length > 0) { 15442 requestAnimationFrame(mobileHeaderRAF); 15443 } else if ($headerOuterEl.attr('data-transparent-header') == 'true') { 15444 $headerOuterEl.addClass('transparent'); 15445 } 15446 15447 $window.off('smartresize.nectarNavScrollEffects'); 15448 $window.on('smartresize.nectarNavScrollEffects', bindScrollEffectsDesktop); 15449 15450 } 15451 15452 /** 15453 * Bind deaktop header scroll effects. 15454 * 15455 * @since 10.5 15456 * @see headerNavScrollInit 15457 */ 15458 function bindScrollEffectsDesktop() { 15459 15460 if (nectarDOMInfo.winW < 1000) { 15461 return; 15462 } 15463 15464 if (headerResize == true && headerHideUntilNeeded != '1') { 15465 15466 $window.off('scroll.headerResizeEffect'); 15467 15468 if ($('#nectar_fullscreen_rows').length == 0) { 15469 $window.on('scroll.headerResizeEffect', smallNav); 15470 } else if ($('#nectar_fullscreen_rows[data-mobile-disable="on"]').length > 0 && nectarDOMInfo.usingMobileBrowser) { 15471 $window.on('scroll.headerResizeEffect', smallNav); 15472 } 15473 15474 } else if (headerHideUntilNeeded != '1') { 15475 15476 $window.off('scroll.headerResizeEffectOpaque'); 15477 $window.on('scroll.headerResizeEffectOpaque', opaqueCheck); 15478 15479 }
15479 else if (headerHideUntilNeeded == '1') { 15480 15481 15482 if ($('.nectar-box-roll').length > 0) { 15483 $headerOuterEl.addClass('at-top-before-box'); 15484 } 15485 15486 // Don't trigger for header remove stickiness. 15487 if ($('#header-outer[data-remove-fixed="1"]').length == 0) { 15488 hhunHeaderEffect(); 15489 } 15490 15491 } //end if hhun 15492 15493 // Condense header effect coming from mobile. 15494 if ($('#header-outer[data-format="centered-menu-bottom-bar"][data-condense="true"]').length > 0 ) { 15495 15496 if( $headerSecondaryEl.length > 0 ) { 15497 // Remove transform. 15498 $headerOuterEl.css('transform',''); 15499 } 15500 15501 if ( nectarDOMInfo.scrollTop > 200 && !$headerOuterEl.hasClass('fixed-menu') ) { 15502 $headerOuterEl.addClass('fixed-menu'); 15503 } 15504 15505 } 15506 15507 // Only bind mobile if applicable. 15508 15509 $window.off('smartresize.nectarNavScrollEffects'); 15510 $window.on('smartresize.nectarNavScrollEffects', bindScrollEffectsMobile); 15511 15512 } 15513 15514 15515 15516 /** 15517 * Header Navigation scroll events initialization. 15518 * 15519 * @since 10.5 15520 */ 15521 function headerNavScrollInit() { 15522 15523 // Remove transparent class if page loaded further down. 15524 if ($('#header-outer[data-remove-fixed="1"]').length == 0 && nectarDOMInfo.winW > 1000) { 15525 if ( $(window).scrollTop() != 0 && $('#header-outer.transparent[data-permanent-transparent="false"]').length == 1) { 15526 $headerOuterEl.removeClass('transparent'); 15527 } 15528 } 15529 15530 // Permanent transparent header. 15531 if ($('#nectar_fullscreen_rows').length == 0 && $('.nectar-box-roll').length == 0) { 15532 midnightInit(); 15533 } 15534 15535 // Determine which events to bind at start. 15536 if (nectarDOMInfo.winW < 1000 && $('.nectar-box-roll').length == 0) { 15537 bindScrollEffectsMobile(); 15538 $window.on('smartresize.nectarNavScrollEffects', bindScrollEffectsMobile); 15539 } else { 15540 bindScrollEffectsDesktop(); 15541 $window.on('smartresize.nectarNavScrollEffects', bindScrollEffectsDesktop); 15542 } 15543 15544 } 15545 15546 15547 15548 15549 15550 15551 /** 15552 * Set the header space div height. 15553 * 15554 * @since 10.5 15555 */ 15556 function headerSpace() { 15557 15558 if ($('.mobile').length > 0) { 15559 15560 if (nectarDOMInfo.winH < nectarDOMInfo.winW && nectarDOMInfo.winW > 1000) { 15561 if ($('#header-outer.small-nav').length == 0) { 15562 $('#header-space').css('height', $headerOuterEl.outerHeight()); 15563 } 15564 } else { 15565 $('#header-space').css('height', $headerOuterEl.outerHeight()); 15566 } 15567 15568 } else { 15569 15570 if ($('.nectar-parallax-scene.first-section').length == 0) { 15571 15572 var headerPadding2 = headerPadding - headerPadding / 1.8; 15573 var $headerHeight = ($('#header-outer[data-header-resize="1"]').length > 0 && $('.small-nav').length > 0) ? $headerOuterEl.outerHeight() + (parseInt(logoShrinkNum) + headerPadding2 * 2) : $headerOuterEl.outerHeight(); 15574 15575 // Is the calculation greater than the margin of error? 15576 if( Math.abs($headerHeight - $('#header-space').height()) > 7) { 15577 $('#header-space').css('height', $headerHeight); 15578 } 15579 15580 15581 } 15582 15583 } 15584 15585 } 15586 15587 15588 15589 /** 15590 * Handle header nav distance away from top to account for admin bar. 15591 * 15592 * @since 10.5 15593 */ 15594 15595 function headerNavOffsetInit() { 15596 15597 var lastPosition = -1; 15598 var $headerScrollTop = nectarDOMInfo.scrollTop; 15599 15600 // Verify scroll pos has changed before calculating. 15601 function headerOffsetAdjust() { 15602 15603 if ( $body.hasClass('compose-mode') ) { 15604 return; 15605 } 15606 15607 $headerScrollTop = nectarDOMInfo.scrollTop; 15608 15609 if (lastPosition == $headerScrollTop) { 15610 requestAnimationFrame(headerOffsetAdjust); 15611 return false; 15612 } else { 15613 lastPosition = $headerScrollTop; 15614 } 15615 15616 headerOffsetAdjustCalc(); 15617 requestAnimationFrame(headerOffsetAdjust); 15618 15619 } 15620 15621 // Called when scrolling occurs. 15622 function headerOffsetAdjustCalc() { 15623 15624 var $eleHeight = 0; 15625 15626 // Mobile. 15627 if (nectarDOMInfo.winW < 1000 || 15628 (condenseHeaderLayout == true && $('#header-outer .span_9').css('display') == 'none') || 15629 (condenseHeaderLayout == true && $('#header-outer .span_9 > nav').css('display') == 'none')) { 15630 15631 $eleHeight = 0; 15632 var $endOffset = ($wpAdminBar.css('position') == 'fixed') ? $wpAdminBar.height() : 0; 15633 15634 $eleHeight += nectarDOMInfo.adminBarHeight; 15635 15636 if ($eleHeight - $headerScrollTop > $endOffset) { 15637 $headerOuterEl.css('top', $eleHeight - $headerScrollTop + 'px'); 15638 } else { 15639 $headerOuterEl.css('top', $endOffset); 15640 } 15641 15642 } 15643 // Desktop 15644 else { 15645 if ( condenseHeaderLayout == false ) { 15646 15647 $eleHeight = 0; 15648 15649 if( !$headerOuterEl.is('[data-remove-fixed="1"]') ) { 15650 $eleHeight += nectarDOMInfo.adminBarHeight; 15651 } 15652 $headerOuterEl.css('top', $eleHeight + 'px'); 15653 } 15654 } 15655 15656 } 15657 15658 // Bind event and begin if needed. 15659 if ($('#header-outer[data-mobile-fixed="1"]').length > 0 && $wpAdminBar.length > 0) { 15660 15661 if ($('#nectar_fullscreen_rows').length == 0) { 15662 requestAnimationFrame(headerOffsetAdjust); 15663 } else if ($('#nectar_fullscreen_rows').length > 0 && nectarDOMInfo.usingMobileBrowser) { 15664 requestAnimationFrame(headerOffsetAdjust); 15665 } 15666 15667 $window.on('smartresize', headerOffsetAdjustCalc); 15668 15669 } 15670 15671 } 15672 15673 15674 15675 15676 15677 15678 15679 /** 15680 * Calculate the minimum body height when using the footer reveal effect or material OCM 15681 * 15682 * @since 7.0 15683 */ 15684 function footerRevealCalcs() { 15685 15686 var $headerNavSpace = 0; 15687 var pageHeaderHeight = 0; 15688 15689 if( $headerOuterEl.is('[data-logo-height]') && $headerOuterEl.is('[data-padding]') ) { 15690 15691 if( !$headerOuterEl.hasClass('transparent') ) { 15692 15693 if( $headerOuterEl.find('#logo.no-image').length > 0 ) { 15694 $headerNavSpace = ( headerLayoutFormat == 'left-header' && nectarDOMInfo.winW > 1000) ? 0 : parseInt($headerOuterEl.find('#logo.no-image').height()) + (parseInt($headerOuterEl.attr('data-padding')*2)); 15695 } else { 15696 $headerNavSpace = ( headerLayoutFormat == 'left-header' && nectarDOMInfo.winW > 1000) ? 0 : parseInt($headerOuterEl.attr('data-logo-height')) + (parseInt($headerOuterEl.attr('data-padding')*2)); 15697 } 15698 15699 } 15700 15701 } else { 15702 $headerNavSpace = ( headerLayoutFormat == 'left-header' && nectarDOMInfo.winW > 1000) ? 0 : $headerOuterEl.outerHeight(); 15703 } 15704 15705 if( $pageHeaderBG.length > 0 ) { 15706 pageHeaderHeight += $pageHeaderBG.height(); 15707 } 15708 if( $('.page-header-no-bg').length > 0 ) { 15709 pageHeaderHeight += $('.page-header-no-bg').height(); 15710 } 15711 15712 if (nectarDOMInfo.winH - nectarDOMInfo.adminBarHeight - $headerNavSpace - nectarDOMInfo.footerOuterHeight - 1 - pageHeaderHeight > 0) { 15713 15714 var $resizeExtra = ($('body:not(.material) #header-outer[data-header-resize="1"]').length > 0) ? 55 : 0; 15715 15716 $('body[data-footer-reveal="1"]:not(.nectar_using_pfsr) .container-wrap').css({ 15717 'margin-bottom': nectarDOMInfo.footerOuterHeight 15718 });
15719 15720 $('.container-wrap').css({ 15721 'min-height': nectarDOMInfo.winH - nectarDOMInfo.adminBarHeight - $headerNavSpace - nectarDOMInfo.footerOuterHeight - pageHeaderHeight + $resizeExtra 15722 }); 15723 15724 } else { 15725 $('body[data-footer-reveal="1"]:not(.nectar_using_pfsr) .container-wrap').css({ 15726 'margin-bottom': nectarDOMInfo.footerOuterHeight 15727 }); 15728 } 15729 15730 if (nectarDOMInfo.winW < 1000) { 15731 $footerOuterEl.attr('data-midnight', 'light'); 15732 } 15733 else { 15734 $footerOuterEl.removeAttr('data-midnight'); 15735 } 15736 } 15737 15738 15739 /** 15740 * Initialize footer reveal and bind event 15741 * 15742 * @since 10.5 15743 */ 15744 function footerRevealInit() { 15745 15746 if ($('body[data-footer-reveal="1"]').length > 0 || $('body.material[data-slide-out-widget-area-style="slide-out-from-right"]').length > 0) { 15747 15748 setTimeout(footerRevealCalcs, 60); 15749 footerRevealCalcs(); 15750 15751 $window.on('resize', footerRevealCalcs); 15752 15753 if ($('body[data-footer-reveal="1"][data-footer-reveal-shadow="large_2"]').length > 0) { 15754 $('.container-wrap').css({ 15755 boxShadow: '0 70px 110px -30px ' + $footerOuterEl.css('backgroundColor') 15756 }); 15757 } 15758 15759 } 15760 15761 } 15762 15763 15764 15765 15766 15767 /** 15768 * Switch header navigation BG color to match row BG color that is passes. 15769 * 15770 * Only called when using "Header Inherit Row Color" option. 15771 * 15772 * @since 5.0 15773 */ 15774 function headerRowColorInheritInit() { 15775 15776 if ($('body[data-header-inherit-rc="true"]').length > 0 && $('.mobile').length == 0 && $('#header-outer[data-transparent-header="true"]').length > 0 ) { 15777 15778 var headerOffset = $logoHeight / 2 + headerPadding + nectarDOMInfo.adminBarHeight; 15779 15780 if( $('#header-outer[data-permanent-transparent="1"]').length == 0 ) { 15781 headerOffset = ($logoHeight - logoShrinkNum) + Math.ceil((headerPadding * 2) / 1.8) + nectarDOMInfo.adminBarHeight; 15782 } 15783 15784 $('.main-content > .row > .wpb_row').each(function () { 15785 15786 var $that = $(this); 15787 var $textColor; 15788 15789 var waypoint = new Waypoint({ 15790 element: $that, 15791 handler: function (direction) { 15792 15793 //User is scrolling down. 15794 if (direction == 'down') { 15795 15796 if ($that.find('.row-bg.using-bg-color').length > 0) { 15797 15798 $textColor = ($that.find('> .col.span_12.light').length > 0) ? 'light-text' : 'dark-text'; 15799 15800 $headerOuterEl 15801 .css('background-color', $that.find('.row-bg').css('background-color')) 15802 .removeClass('light-text') 15803 .removeClass('dark-text') 15804 .addClass($textColor); 15805 15806 $headerOuterEl.attr('data-current-row-bg-color', $that.find('.row-bg').css('background-color')); 15807 $('body.material #header-outer .bg-color-stripe').css('background-color', $that.find('.row-bg').css('background-color')); 15808 15809 } else { 15810 15811 $headerOuterEl 15812 .css('background-color', $headerOuterEl.attr('data-user-set-bg')) 15813 .removeClass('light-text') 15814 .removeClass('dark-text'); 15815 15816 $headerOuterEl.attr('data-current-row-bg-color', $headerOuterEl.attr('data-user-set-bg')); 15817 $('body.material #header-outer .bg-color-stripe').css('background-color', ''); 15818 15819 } 15820 15821 } 15822 15823 //User is scrolling up. 15824 else { 15825 15826 if ($that.prev('div.wpb_row').find('.row-bg.using-bg-color').length > 0) { 15827 15828 $textColor = ($that.prev('div.wpb_row').find('> .col.span_12.light').length > 0) ? 'light-text' : 'dark-text'; 15829 15830 $headerOuterEl 15831 .css('background-color', $that.prev('div.wpb_row').find('.row-bg').css('background-color')) 15832 .removeClass('light-text') 15833 .removeClass('dark-text') 15834 .addClass($textColor); 15835 15836 $headerOuterEl.attr('data-current-row-bg-color', $that.prev('div.wpb_row').find('.row-bg').css('background-color')); 15837 $('body.material #header-outer .bg-color-stripe').css('background-color', $that.prev('div.wpb_row').find('.row-bg').css('background-color')); 15838 15839 } else { 15840 15841 $headerOuterEl 15842 .css('background-color', $headerOuterEl.attr('data-user-set-bg')) 15843 .removeClass('light-text') 15844 .removeClass('dark-text'); 15845 15846 $headerOuterEl.attr('data-current-row-bg-color', $headerOuterEl.attr('data-user-set-bg')); 15847 $('body.material #header-outer .bg-color-stripe').css('background-color', ''); 15848 15849 } 15850 15851 } 15852 15853 }, 15854 offset: headerOffset 15855 15856 }); // End of waypoint bind. 15857 15858 }); // End of loop through rows. 15859 15860 } 15861 15862 } 15863 15864 15865 15866 /** 15867 * Page submenu sticky functionality 15868 * 15869 * @since 10.5.2 15870 */ 15871 15872 function stickyPageSubmenuInit() { 15873 15874 var $ = window.jQuery, 15875 Waypoint = window.Waypoint, 15876 $offsetHeight = calcHeaderNavHeight(), 15877 $headerHeight = calcHeaderNavHeight(); 15878 15879 $window.on('smartresize', function () { 15880 15881 $offsetHeight = calcHeaderNavHeight(); 15882 15883 if ($wpAdminBar.length > 0 && 15884 $wpAdminBar.css('position') == 'fixed') { 15885 $offsetHeight += $wpAdminBar.height(); 15886 } 15887 15888 if ($bodyBorderTop.length > 0 && 15889 $window.width() > 1000 && 15890 $('body[data-hhun="1"]').length > 0) { 15891 $offsetHeight += $bodyBorderTop.height(); 15892 } 15893 15894 // Recalc for resizing (same as stuck/unstuck logic below) 15895 if ($('.page-submenu.stuck').length > 0) { 15896 15897 $('.page-submenu.stuck') 15898 .addClass('no-trans') 15899 .css('top', $offsetHeight) 15900 .css('transform', 'translateY(0)').addClass('stuck'); 15901 15902 setTimeout(function () { 15903 $('.page-submenu.stuck').removeClass('no-trans'); 15904 }, 50); 15905 15906 $('.page-submenu.stuck') 15907 .parents('.wpb_row') 15908 .css('z-index', 10000); 15909 15910 // Boxed layout 15911 if ($('#boxed').length > 0) { 15912 15913 var $negMargin = ($window.width() > 1000) ? $('.container-wrap').width() * 0.04 : 39; 15914 15915 $('.page-submenu.stuck').css({ 15916 'margin-left': '-' + $negMargin + 'px', 15917 'width': $('.container-wrap').width() 15918 });
15919 15920 } 15921 15922 } else { 15923 15924 $('.page-submenu.stuck') 15925 .css('top', '0') 15926 .removeClass('stuck'); 15927 15928 $('.page-submenu.stuck') 15929 .parents('.wpb_row') 15930 .css('z-index', 'auto'); 15931 15932 if ($('#boxed').length > 0) { 15933 $('.page-submenu.stuck').css({ 15934 'margin-left': '0px', 15935 'width': '100%' 15936 }); 15937 } 15938 15939 } 15940 15941 }); 15942 15943 /* http://imakewebthings.com/waypoints/shortcuts/sticky-elements */ 15944 function Sticky(options) { 15945 this.options = $.extend({}, Waypoint.defaults, Sticky.defaults, options); 15946 this.element = this.options.element; 15947 this.$element = $(this.element); 15948 this.createWrapper(); 15949 this.topLevel = ($(this.element).parents('.top-level').length > 0) ? true : false; 15950 this.createWaypoint(); 15951 } 15952 15953 /* Private */ 15954 Sticky.prototype.createWaypoint = function () { 15955 15956 var originalHandler = this.options.handler; 15957 15958 $offsetHeight = calcHeaderNavHeight(); 15959 15960 // top level hhun 15961 if( this.topLevel && $('body[data-hhun="1"] #header-outer.detached:not(.invisible)').length > 0) { 15962 $offsetHeight += 1; 15963 this.$element.css({ 15964 'margin-top': '-1px', 15965 }); 15966 } 15967 15968 if ($wpAdminBar.length > 0 && $wpAdminBar.css('position') == 'fixed') { 15969 $offsetHeight += $wpAdminBar.height(); 15970 } 15971 15972 if ($bodyBorderTop.length > 0 && $window.width() > 1000 && $('body[data-hhun="1"]').length > 0) { 15973 $offsetHeight += $bodyBorderTop.height(); 15974 } 15975 15976 this.waypoint = new Waypoint($.extend({}, this.options, { 15977 element: this.wrapper, 15978 handler: $.proxy(function (direction) { 15979 var shouldBeStuck = this.options.direction.indexOf(direction) > -1; 15980 var wrapperHeight = shouldBeStuck ? this.$element.outerHeight(true) : ''; 15981 15982 this.$wrapper.height(wrapperHeight); 15983 if (shouldBeStuck) { 15984 15985 // top level hhun 15986 var transformAmt = 0; 15987 if( this.topLevel && $('body[data-hhun="1"] #header-outer.detached:not(.invisible)').length > 0) { 15988 15989 // Page submenu adjust 15990 var heightToAdjust = $headerOuterEl.outerHeight(); 15991 var $bodyBorderSizeToRemove = 0; 15992 15993 if( $headerSecondaryEl.length > 0) { 15994 heightToAdjust -= nectarDOMInfo.secondaryHeaderHeight; 15995 } 15996 15997 if ($bodyBorderTop.length > 0 && $('body.mobile').length == 0) { 15998 $bodyBorderSizeToRemove = ($bodyBorderHeaderColorMatch) ? $bodyBorderTop.height() : 0; 15999 } 16000 16001 transformAmt = heightToAdjust - $bodyBorderSizeToRemove; 16002 16003 } 16004 16005 this.$element 16006 .addClass('no-trans') 16007 .css('top', $offsetHeight) 16008 .css('transform', 'translateY('+transformAmt+'px)') 16009 .addClass('stuck'); 16010 16011 var $that = this; 16012 16013 setTimeout(function () { 16014 $that.$element.removeClass('no-trans'); 16015 }, 50); 16016 16017 this.$element.parents('.wpb_row').css('z-index', 10000); 16018 16019 //boxed 16020 if ($('#boxed').length > 0) { 16021 var $negMargin = ($window.width() > 1000) ? $('.container-wrap').width() * 0.04 : 39; 16022 this.$element.css({ 16023 'margin-left': '-' + $negMargin + 'px', 16024 'width': $('.container-wrap').width() 16025 }); 16026 } 16027 16028 } else { 16029 this.$element.css('top', '0').removeClass('stuck'); 16030 16031 if ($('#boxed').length > 0) this.$element.css({ 16032 'margin-left': '0px', 16033 'width': '100%' 16034 }); 16035 } 16036 16037 if (originalHandler) { 16038 originalHandler.call(this, direction); 16039 } 16040 }, this), 16041 offset: $offsetHeight 16042 })); 16043 16044 var $that = this; 16045 16046 16047 setInterval(function () { 16048 16049 if ($('body[data-hhun="1"] #header-outer.detached:not(.invisible)').length > 0) { 16050 16051 var heightToAdjust = $headerOuterEl.outerHeight(); 16052 16053 if( $headerSecondaryEl.length > 0) { 16054 heightToAdjust -= nectarDOMInfo.secondaryHeaderHeight; 16055 } 16056 16057 $that.waypoint.options.offset = $offsetHeight + heightToAdjust; 16058 } 16059 else { 16060 $that.waypoint.options.offset = $offsetHeight; 16061 } 16062 16063 Waypoint.refreshAll(); 16064 16065 }, 100); 16066 16067 16068 }; 16069 16070 /* Private */ 16071 Sticky.prototype.createWrapper = function () { 16072 if (this.options.wrapper) { 16073 this.$element.wrap(this.options.wrapper); 16074 } 16075 this.$wrapper = this.$element.parent(); 16076 this.wrapper = this.$wrapper[0]; 16077 }; 16078 16079 /* Public */ 16080 Sticky.prototype.destroy = function () { 16081 16082 if (this.$element.parent()[0] === this.wrapper) { 16083 this.waypoint.destroy(); 16084 this.$element.removeClass(this.options.stuckClass); 16085 if (this.options.wrapper) { 16086 this.$element.unwrap(); 16087 } 16088 } 16089 16090 }; 16091 16092 Sticky.defaults = { 16093 wrapper: '<div class="sticky-wrapper" />', 16094 stuckClass: 'stuck', 16095 direction: 'down right' 16096 }; 16097
16098 Waypoint.Sticky = Sticky; 16099 16100 } 16101 16102 16103 16104 /** 16105 * Page submenu page builder element. 16106 * 16107 * @since 10.5 16108 */ 16109 16110 function pageSubmenuInit() { 16111 16112 if ($('.page-submenu[data-sticky="true"]').length > 0 && $('#nectar_fullscreen_rows').length == 0) { 16113 16114 stickyPageSubmenuInit(); 16115 16116 // Remove outside of column setups 16117 if ($('.page-submenu').parents('.span_12').find('> .wpb_column').length > 1) { 16118 16119 var pageMenu = $('.page-submenu').clone(), 16120 pageMenuParentRow = $('.page-submenu').parents('.wpb_row'); 16121 16122 $('.page-submenu').remove(); 16123 pageMenuParentRow.before(pageMenu); 16124 } 16125 16126 var sticky = new Waypoint.Sticky({ 16127 element: $('.page-submenu[data-sticky="true"]')[0] 16128 }); 16129 16130 } 16131 16132 // Adjust to be higher. 16133 if ($('#nectar_fullscreen_rows').length == 0) { 16134 16135 $('.page-submenu') 16136 .parents('.wpb_row') 16137 .css('z-index', 10000); 16138 } 16139 16140 // Bind events. 16141 $('.page-submenu .mobile-menu-link').on('click', function () { 16142 16143 $(this).parents('.page-submenu') 16144 .find('ul') 16145 .stop(true) 16146 .slideToggle(350); 16147 16148 return false; 16149 16150 }); 16151 16152 $('.page-submenu ul li a').on('click', function () { 16153 16154 if ($('body.mobile').length > 0) { 16155 $(this).parents('.page-submenu') 16156 .find('ul') 16157 .stop(true) 16158 .slideToggle(350); 16159 } 16160 16161 }); 16162 16163 } 16164 16165 16166 16167 16168 /** 16169 * Page builder full height row option. 16170 * 16171 * @since 8.0 16172 */ 16173 16174 function vcFullHeightRow() { 16175 16176 var $element = $(".vc_row-o-full-height:first"); 16177 if ($element.length) { 16178 16179 var windowHeight, offsetTop, fullHeight; 16180 windowHeight = $window.height(); 16181 16182 $(".vc_row-o-full-height").each(function () { 16183 16184 offsetTop = $(this).offset().top; 16185 16186 if (offsetTop < windowHeight && 16187 $(this).hasClass('top-level') && 16188 !nectarDOMInfo.usingFrontEndEditor) { 16189 16190 fullHeight = 100 - offsetTop / (windowHeight / 100); 16191 $(this).css("min-height", fullHeight + "vh"); 16192 $(this).find('> .col.span_12').css("min-height", fullHeight + "vh"); 16193 16194 } else { 16195 16196 $(this).css("min-height", windowHeight); 16197 $(this).find('> .col.span_12').css("min-height", windowHeight); 16198 16199 } 16200 16201 }); 16202 16203 } 16204 16205 } 16206 16207 16208 /** 16209 * Page builder full height row init. 16210 * 16211 * @since 10.5 16212 */ 16213 16214 function vcFullHeightRowInit() { 16215 16216 if( $('.vc_row-o-full-height').length > 0 ) { 16217 vcFullHeightRow(); 16218 $window.on('smartresize', vcFullHeightRow); 16219 } 16220 16221 } 16222 16223 16224 /** 16225 * Page builder equal height row IE helper. 16226 * 16227 * @since 8.0 16228 */ 16229 function fixIeFlexbox() { 16230 var ua = window.navigator.userAgent, 16231 msie = ua.indexOf("MSIE "); 16232 (msie > 0 || navigator.userAgent.match(/Trident.*rv\:11\./)) && $(".vc_row-o-full-height").each(function () { 16233 "flex" === $(this).find('> .span_12').css("display") && $(this).wrap('<div class="vc_ie-flexbox-fixer"></div>') 16234 }); 16235 16236 if( msie > 0 || navigator.userAgent.match(/Trident.*rv\:11\./)) { 16237 fixIE11Images(); 16238 $(window).on('resize',fixIE11Images); 16239 } 16240 16241 } 16242 16243 /** 16244 * Fix the IE11 bug with max-width 100% on imgs 16245 * 16246 * @since 11.0 16247 */ 16248 function fixIE11Images() { 16249 16250 $('.img-with-aniamtion-wrap img.img-with-animation').each(function() { 16251 16252 if( $(this).parents('.tabbed').length == 0 && $(this).parents('.toggle').length == 0 ) { 16253 16254 var $parentWrap = $(this).parents('.img-with-aniamtion-wrap'); 16255 $parentWrap.css({ 16256 'height' : '' 16257 }); 16258 var height = $(this).height(); 16259 16260 $parentWrap.css({ 16261 'height' : height 16262 }); 16263 16264 } 16265 16266 }); 16267 16268 } 16269 16270 16271 16272 16273 16274 16275 16276 16277 16278 /** 16279 * Recent post height 16280 * 16281 * @since 10.5 16282 */ 16283 function recentPostsTitleOnlyEqualHeight() { 16284 16285 function recentPostHeight() { 16286 16287 $('.blog-recent[data-style="title_only"]').each(function () { 16288 16289 if ($(this).find('> .col').length > 1) { 16290 return false; 16291 } 16292 var $parentsSeletor = $(this).parent().parent().parent(); 16293 16294 if ($parentsSeletor.hasClass('vc_col-sm-3') || 16295 $parentsSeletor.hasClass('vc_col-sm-4') || 16296 $parentsSeletor.hasClass('vc_col-sm-6') || 16297 $parentsSeletor.hasClass('vc_col-sm-8') || 16298 $parentsSeletor.hasClass('vc_col-sm-9')) { 16299 16300 if ($('body.mobile').length == 0 && $(this).next('div').length == 0) { 16301 var tallestColumn = 0; 16302 16303 $(this).find('> .col').css('padding', '50px 20px'); 16304 16305 $(this).parents('.span_12').find(' > .wpb_column').each(function () { 16306 16307 if( Math.floor($(this).height()) > tallestColumn ) { 16308 tallestColumn = Math.floor($(this).height()); 16309 } 16310 16311 });
16312 16313 if (Math.floor($(this).find('> .col').outerHeight(true)) < Math.floor($(this).parents('.wpb_row').height()) - 1) { 16314 $(this).find('> .col').css('padding-top', (tallestColumn - $(this).find('> .col').height()) / 2 + 'px'); 16315 $(this).find('> .col').css('padding-bottom', (tallestColumn - $(this).find('> .col').height()) / 2 + 'px'); 16316 } 16317 16318 } else { 16319 $(this).find('> .col').css('padding', '50px 20px'); 16320 } 16321 } 16322 }); 16323 16324 } 16325 16326 // Set heights. 16327 if( $('.blog-recent[data-style="title_only"]').length > 0 ) { 16328 recentPostHeight(); 16329 $window.on('smartresize',recentPostHeight); 16330 } 16331 16332 } 16333 16334 16335 16336 16337 16338 /** 16339 * Helper to calculate recent post slider height 16340 * 16341 * @since 7.0 16342 */ 16343 function recentPostSliderHeight() { 16344 16345 $('.nectar-recent-posts-slider').each(function () { 16346 16347 var $minHeight = 250, 16348 $definedHeight = parseInt($(this).attr('data-height')), 16349 dif = ($('body[data-ext-responsive="true"]').length > 0) ? $window.width() / 1400 : $window.width() / 1100, 16350 $sliderSelectors = $(this).find('.nectar-recent-post-slide, .flickity-viewport'); 16351 16352 if (nectarDOMInfo.winW > 1000 && $('#boxed').length == 0) { 16353 16354 if ($(this).parents('.full-width-content').length == 0) { 16355 16356 if ($('body[data-ext-responsive="true"]').length > 0 && nectarDOMInfo.winW >= 1400) { 16357 $sliderSelectors.css('height', Math.ceil($definedHeight)); 16358 } else if ($('body[data-ext-responsive="true"]').length == 0 && nectarDOMInfo.winW >= 1100) { 16359 $sliderSelectors.css('height', Math.ceil($definedHeight)); 16360 } else { 16361 $sliderSelectors.css('height', Math.ceil($definedHeight * dif)); 16362 } 16363 16364 } else { 16365 $sliderSelectors.css('height', Math.ceil($definedHeight * dif)); 16366 } 16367 16368 } else { 16369 16370 // Column sliders 16371 var $parentCol = ($(this).parents('.wpb_column').length > 0) ? $(this).parents('.wpb_column') : $(this).parents('.col'); 16372 16373 if ($parentCol.length == 0) { 16374 $parentCol = $('.main-content'); 16375 } 16376 16377 if (!$parentCol.hasClass('vc_span12') && 16378 !$parentCol.hasClass('main-content') && 16379 !$parentCol.hasClass('span_12') && 16380 !$parentCol.hasClass('vc_col-sm-12')) { 16381 16382 var $parentColWidth = sliderColumnDesktopWidth($parentCol), 16383 $aspectRatio = $definedHeight / $parentColWidth; 16384 16385 // Min height 16386 if ($aspectRatio * $parentCol.width() <= $minHeight) { 16387 $sliderSelectors.css('height', $minHeight); 16388 } else { 16389 $sliderSelectors.css('height', $aspectRatio * $parentCol.width()); 16390 } 16391 16392 } 16393 16394 // Regular 16395 else { 16396 16397 // Min height 16398 if ($definedHeight * dif <= $minHeight) { 16399 $sliderSelectors.css('height', $minHeight); 16400 } else { 16401 $sliderSelectors.css('height', Math.ceil($definedHeight * dif)); 16402 } 16403 16404 } 16405 16406 } 16407 16408 }); 16409 16410 } 16411 16412 16413 function sliderColumnDesktopWidth(parentCol) { 16414 16415 var $parentColWidth = 1100, 16416 $columnNumberParsed = $(parentCol).attr('class').match(/\d+/); 16417 16418 if ($columnNumberParsed == '2') { 16419 $parentColWidth = 170 16420 } else if ($columnNumberParsed == '3') { 16421 $parentColWidth = 260 16422 } else if ($columnNumberParsed == '4') { 16423 $parentColWidth = 340 16424 } else if ($columnNumberParsed == '6') { 16425 $parentColWidth = 530 16426 } else if ($columnNumberParsed == '8') { 16427 $parentColWidth = 700 16428 } else if ($columnNumberParsed == '9') { 16429 $parentColWidth = 805 16430 } else if ($columnNumberParsed == '10') { 16431 $parentColWidth = 916.3 16432 } else if ($columnNumberParsed == '12') { 16433 $parentColWidth = 1100 16434 } 16435 16436 return $parentColWidth; 16437 } 16438 16439 16440 /** 16441 * Spit text into separate lines to animate in 16442 * 16443 * @since 7.0 16444 */ 16445 16446 function splitLineText() { 16447 $('.nectar-recent-posts-single_featured.multiple_featured').each(function () { 16448 16449 var $slideClass = ($(this).find('.project-slides').length > 0) ? '.project-slide' : '.nectar-recent-post-slide', 16450 $slideInfoClass = ($(this).find('.project-slides').length > 0) ? '.project-info h1' : '.inner-wrap h2 a'; 16451 16452 $(this).find($slideClass).each(function () { 16453 16454 $(this).find($slideInfoClass).each(function () { 16455 16456 var textArr = $(this).text(); 16457 textArr = textArr.trim(); 16458 textArr = textArr.split(' '); 16459 16460 $(this)[0].innerHTML = ''; 16461 16462 for (var i = 0; i < textArr.length; i++) { 16463 $(this)[0].innerHTML += '<span>' + textArr[i] + '</span> '; 16464 } 16465 16466 });
16467 16468 $(this).find($slideInfoClass + ' > span').wrapInner('<span class="inner" />'); 16469 16470 }); 16471 16472 }); 16473 16474 } 16475 16476 16477 /** 16478 * Spit text into separate lines to animate in 16479 * 16480 * @since 7.0 16481 */ 16482 16483 function splitLineHeadingMarkup() { 16484 16485 $('.nectar-split-heading[data-animation-type="line-reveal-by-space"]').each(function () { 16486 16487 var animatedClass = ( $(this).hasClass('animated-in') ) ? ' animated' : ''; 16488 16489 $(this).find('> *').each(function () { 16490 16491 var textArr = $(this).text(); 16492 textArr = textArr.trim(); 16493 textArr = textArr.split(' '); 16494 16495 $(this)[0].innerHTML = ''; 16496 16497 for (var i = 0; i < textArr.length; i++) { 16498 $(this)[0].innerHTML += '<span><span class="inner'+animatedClass+'">' + textArr[i] + '</span></span> '; 16499 } 16500 16501 }); 16502 16503 $(this).addClass('markup-generated'); 16504 16505 }); 16506 16507 $('.nectar-split-heading[data-animation-type="letter-fade-reveal"]').each(function () { 16508 16509 16510 $(this).find('> *').each(function () { 16511 16512 var textArr = $(this).text(); 16513 textArr = textArr.trim(); 16514 textArr = textArr.split(' '); 16515 16516 $(this)[0].innerHTML = ''; 16517 16518 for (var i = 0; i < textArr.length; i++) { 16519 $(this)[0].innerHTML += '<span>' + textArr[i] + '</span> '; 16520 } 16521 16522 }); 16523 16524 16525 $(this).find('span').each(function () { 16526 16527 var $this = $(this); 16528 var textArr = $(this).text().split(''); 16529 16530 $this.empty(); 16531 16532 $.each(textArr, function (i, el) { 16533 $this.append("<span>" + el + "</span"); 16534 }); 16535 16536 }); 16537 16538 $(this).addClass('markup-generated'); 16539 16540 }); 16541 16542 } 16543 16544 function splitLineHeadingInit() { 16545 16546 if( $('.nectar-split-heading[data-animation-type="line-reveal-by-space"]').length > 0 || $('.nectar-split-heading[data-animation-type="letter-fade-reveal"]').length > 0 ) { 16547 // Generate markup. 16548 splitLineHeadingMarkup(); 16549 } 16550 16551 } 16552 16553 16554 /** 16555 * Create recent post sliders 16556 * 16557 * @since 7.0 16558 */ 16559 function recentPostsFlickityInit() { 16560 16561 16562 if ($('.nectar-recent-posts-slider-inner').length > 0) { 16563 16564 var $rpFGroupCells = ($('.nectar-recent-posts-slider_multiple_visible').length > 0) ? '90%' : false; 16565 16566 var $rpF = $('.nectar-recent-posts-slider-inner').flickity({ 16567 contain: true, 16568 groupCells: $rpFGroupCells, 16569 draggable: true, 16570 lazyLoad: false, 16571 imagesLoaded: true, 16572 percentPosition: true, 16573 prevNextButtons: false, 16574 pageDots: true, 16575 resize: true, 16576 setGallerySize: true, 16577 wrapAround: true, 16578 accessibility: false 16579 }); 16580 16581 setTimeout(function () { 16582 $('.nectar-recent-posts-slider-inner').addClass('loaded'); 16583 }, 1150); 16584 var flkty = $rpF.data('flickity'); 16585 16586 $rpF.on('dragStart.flickity', function () { 16587 $('.flickity-viewport').addClass('is-moving'); 16588 }); 16589 16590 $rpF.on('dragEnd.flickity', function () { 16591 $('.flickity-viewport').removeClass('is-moving'); 16592 }); 16593 16594 var $dragTimeout; 16595 16596 $rpF.on('select.flickity', function () { 16597 16598 $('.flickity-viewport').addClass('no-hover'); 16599 clearTimeout($dragTimeout); 16600 $dragTimeout = setTimeout(function () { 16601 $('.flickity-viewport').removeClass('no-hover'); 16602 }, 400); 16603 16604 }); 16605 16606 recentPostSliderHeight(); 16607 $window.on('resize', recentPostSliderHeight); 16608 16609 if (!nectarDOMInfo.usingMobileBrowser && !nectarDOMInfo.usingFrontEndEditor) { 16610 $window.on('resize', recentPostSliderParallaxMargins); 16611 } 16612 16613 16614 } 16615 16616 16617 16618 // Multiple featured controls 16619 function multipleLargeFeaturedInit() { 16620 $('.nectar-recent-posts-single_featured.multiple_featured').each(function (sliderIndex) { 16621 16622 if ($(this).find('> .normal-container').length > 0) { 16623 $(this).find('> .normal-container').remove(); 16624 } 16625 16626 $(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>'); 16627 var $that = $(this); 16628 var tallestFeaturedSlide = 0; 16629 var $slideClickTimeout; 16630 16631 // Store instance 16632 $nectarCustomSliderRotate[sliderIndex] = { 16633 autorotate: '' 16634 }; 16635 16636 $(this).find('.nectar-recent-post-slide').each(function (i) { 16637 16638 if ($(this).find('.recent-post-container').height() > tallestFeaturedSlide) { 16639 $(this).siblings().removeClass('tallest'); 16640 $(this).addClass('tallest'); 16641 tallestFeaturedSlide = $(this).find('.recent-post-container').height(); 16642 } 16643 16644 var $activeClass = (i == 0 && $(this).parents('.nectar-recent-posts-single_featured.multiple_featured[data-autorotate="none"]').length > 0) ? 'class="active"' : ''; 16645 $that.find('.controls').append('<li ' + $activeClass + '><span class="title">' + $(this).find('h2').text() + '</span></li>'); 16646 });
16647 16648 $(this).addClass('js-loaded'); 16649 16650 16651 // Click event 16652 $(this).find('.controls li').on('click', function (e) { 16653 16654 if ($(this).hasClass('active')) { 16655 return; 16656 } 16657 16658 if (e.originalEvent !== undefined) { 16659 $(this).parent().find('.active').addClass('trans-out'); 16660 } 16661 16662 var $index = $(this).index(), 16663 $oldIndex = $(this).parent().find('.active').index(), 16664 $that = $(this); 16665 16666 clearTimeout($slideClickTimeout); 16667 16668 $(this).siblings().removeClass('active'); 16669 $(this).addClass('active'); 16670 16671 $slideClickTimeout = setTimeout(function () { 16672 16673 $that.parents('.multiple_featured') 16674 .find('.nectar-recent-post-slide:not(:eq(' + $index + '))') 16675 .css('opacity', '0') 16676 .removeClass('active'); 16677 16678 $that.parent() 16679 .find('.trans-out') 16680 .removeClass('trans-out'); 16681 16682 }, 300); 16683 16684 $that.parents('.multiple_featured') 16685 .find('.nectar-recent-post-slide:not(:eq(' + $index + '))') 16686 .css('z-index', '10'); 16687 16688 $that.parents('.multiple_featured') 16689 .find('.nectar-recent-post-slide:eq(' + $oldIndex + ')') 16690 .css('z-index', '15'); 16691 16692 $(this).parents('.multiple_featured').find('.nectar-recent-post-slide').eq($index).css({ 16693 'opacity': '1', 16694 'z-index': '20' 16695 }).addClass('active'); 16696 16697 if ($(this).parents('.multiple_featured').attr('data-autorotate') != 'none') { 16698 nectarCustomSliderResetRotate($that.parents('.nectar-recent-posts-single_featured.multiple_featured'), sliderIndex); 16699 } 16700 }); 16701 16702 16703 // Autorotate 16704 $that = $(this); 16705 16706 if ($(this).attr('data-autorotate').length > 0 && 16707 $(this).attr('data-autorotate') != 'none' && 16708 $('body.vc_editor').length == 0) { 16709 16710 setTimeout(function () { 16711 var slide_interval = (parseInt($that.attr('data-autorotate')) < 100) ? 4000 : parseInt($that.attr('data-autorotate')); 16712 16713 $nectarCustomSliderRotate[sliderIndex].autorotate = setInterval(function () { 16714 nectarCustomSliderRotate($that) 16715 }, slide_interval); 16716 16717 // Set first active class 16718 $that 16719 .find('.controls > li:first-child') 16720 .addClass('active'); 16721 16722 }, 30); 16723 16724 } 16725 16726 }); 16727 16728 splitLineText(); 16729 $window.on('resize', splitLineText); 16730 16731 } 16732 16733 multipleLargeFeaturedInit(); 16734 16735 } 16736 16737 16738 16739 /** 16740 * Default recent post slider parallax RAF loop. 16741 * 16742 * @since 7.0 16743 */ 16744 function recentPostSliderParallax() { 16745 16746 $('.nectar-recent-posts-slider').each(function () { 16747 16748 var $offset = parseInt($(this).find('.flickity-slider').position().left), 16749 $slides = $(this).find('.nectar-recent-post-slide'), 16750 $slideLength = $slides.length, 16751 $slideWidth = $slides.width(), 16752 $lastChildIndex = $(this).find('.nectar-recent-post-slide:last-child').index(), 16753 $slideFirstChildBG = $(this).find('.nectar-recent-post-slide:first-child .nectar-recent-post-bg'), 16754 $slideLastChildBG = $(this).find('.nectar-recent-post-slide:last-child .nectar-recent-post-bg'); 16755 16756 // First going to last 16757 if ($offset >= -3) { 16758 $slideLastChildBG.css('margin-left', parseInt(Math.ceil($slideWidth / 3.5)) + 'px'); 16759 } else { 16760 $slideLastChildBG.css('margin-left', '-' + parseInt(Math.ceil($slideWidth / 3.5 * $lastChildIndex)) + 'px'); 16761 } 16762 16763 // Last going to first 16764 if (Math.abs($offset) >= ($slideLength - 1) * $slideWidth) { 16765 $slideFirstChildBG.css('margin-left', '-' + parseInt(Math.ceil(($slideWidth / 3.5) * $slideLength)) + 'px'); 16766 } else { 16767 $slideFirstChildBG.css('margin-left', '0px'); 16768 } 16769 16770 $(this) 16771 .find('.nectar-recent-post-bg') 16772 .css('transform', 'translateX(' + Math.ceil($(this).find('.flickity-slider').position().left / -3.5) + 'px)'); 16773 16774 }); 16775 16776 requestAnimationFrame(recentPostSliderParallax); 16777 16778 } 16779 16780 /** 16781 * Default recent post slider margin calculations. 16782 * 16783 * @since 7.0 16784 */ 16785 function recentPostSliderParallaxMargins() { 16786 16787 $('.nectar-recent-posts-slider').each(function () { 16788 16789 var $slideWidth = $(this).find('.nectar-recent-post-slide').width(); 16790 16791 $(this).find('.nectar-recent-post-slide').each(function (i) { 16792 $(this).find('.nectar-recent-post-bg').css('margin-left', '-' + parseInt(Math.ceil($slideWidth / 3.5) * i) + 'px'); 16793 });
16794 16795 }); 16796 16797 } 16798 16799 16800 16801 /** 16802 * Initialize all recent post elements. 16803 * 16804 * @since 7.0 16805 */ 16806 function recentPostsInit() { 16807 16808 // Start flickity based sliders. 16809 recentPostsFlickityInit(); 16810 16811 16812 // Classic enhanced specific 16813 $('.blog-recent[data-style="classic_enhanced_alt"] .inner-wrap').each(function () { 16814 $(this).find('.post-featured-img').each(function () { 16815 var $src = $(this).find('img').attr('src'); 16816 $(this).css('background-image', 'url(' + $src + ')'); 16817 }); 16818 }); 16819 16820 $('.blog-recent[data-style="classic_enhanced"]').each(function () { 16821 if ($(this).find('.inner-wrap.has-post-thumbnail').length == 0) { 16822 $(this).addClass('no-thumbs'); 16823 } 16824 }); 16825 16826 // Regular recent posts slider. 16827 if (!nectarDOMInfo.usingMobileBrowser) { 16828 if ($('.nectar-recent-posts-slider').length > 0 && !nectarDOMInfo.usingFrontEndEditor) { 16829 window.requestAnimationFrame(recentPostSliderParallax); 16830 } 16831 } 16832 16833 if (!nectarDOMInfo.usingMobileBrowser && !nectarDOMInfo.usingFrontEndEditor) { 16834 recentPostSliderParallaxMargins(); 16835 } 16836 16837 } 16838 16839 16840 16841 16842 /** 16843 * Parallax on mousemove effect 16844 * 16845 * @since 10.5 16846 */ 16847 function parallaxItemHoverEffect() { 16848 16849 //change sizer pos 16850 $('.style-5').each(function () { 16851 $(this) 16852 .find('.sizer') 16853 .insertBefore($(this).find('.parallaxImg')); 16854 }); 16855 16856 // Set parent zindex 16857 $('.style-5') 16858 .parents('.wpb_row') 16859 .css('z-index', '100'); 16860 16861 var d = document, 16862 bd = d.getElementsByTagName('body')[0], 16863 win = window, 16864 imgs = d.querySelectorAll('.parallaxImg'), 16865 totalImgs = imgs.length, 16866 supportsTouch = 'ontouchstart' in win || navigator.msMaxTouchPoints, 16867 lazyLoadedItems = false; 16868 16869 if (totalImgs <= 0) { 16870 return; 16871 } 16872 16873 // Build HTML 16874 for (var l = 0; l < totalImgs; l++) { 16875 16876 var thisImg = imgs[l], 16877 layerElems = thisImg.querySelectorAll('.parallaxImg-layer'), 16878 totalLayerElems = layerElems.length; 16879 16880 if (totalLayerElems <= 0) { 16881 continue; 16882 } 16883 16884 while (thisImg.firstChild) { 16885 thisImg.removeChild(thisImg.firstChild); 16886 } 16887 16888 var lastMove = 0; 16889 16890 //throttle performance old browsers 16891 var eventThrottle = 80; 16892 if ( navigator.userAgent.indexOf("Chrome") > -1 && navigator.userAgent.indexOf("Edge/") < 1 ) { 16893 eventThrottle = 1; 16894 $('html').addClass('cssreflections'); 16895 } else { 16896 $body.addClass('cssreflections'); 16897 } 16898 16899 var containerHTML = d.createElement('div'), 16900 shineHTML = d.createElement('div'), 16901 shadowHTML = d.createElement('div'), 16902 layersHTML = d.createElement('div'), 16903 layers = []; 16904 16905 thisImg.id = 'parallaxImg__' + l; 16906 containerHTML.className = 'parallaxImg-container'; 16907 shadowHTML.className = 'parallaxImg-shadow'; 16908 layersHTML.className = 'parallaxImg-layers'; 16909 16910 for (var i = 0; i < totalLayerElems; i++) { 16911 16912 var layer = d.createElement('div'), 16913 layerInner = d.createElement('div'), 16914 imgSrc = layerElems[i].getAttribute('data-img'); 16915 16916 $(layer).html($(layerElems[i]).html()); 16917 layer.className = 'parallaxImg-rendered-layer'; 16918 layer.setAttribute('data-layer', i); 16919 16920 if (i == 0 && $(thisImg).parents('.wpb_gallery').length == 0) { 16921 layerInner.className = 'bg-img'; 16922 16923 if( $(thisImg).parents('.nectar-fancy-box').length > 0 ) { 16924 layerInner.setAttribute('data-nectar-img-src', imgSrc); 16925 lazyLoadedItems = true; 16926 } else { 16927 layerInner.style.backgroundImage = 'url(' + imgSrc + ')'; 16928 } 16929 layer.appendChild(layerInner); 16930 } 16931 layersHTML.appendChild(layer); 16932 16933 layers.push(layer); 16934 } 16935 16936 16937 containerHTML.appendChild(layersHTML); 16938 thisImg.appendChild(containerHTML); 16939 $(thisImg).wrap('<div class="parallaxImg-wrap" />'); 16940 if (!(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1)) { 16941 $(thisImg).parent().append(shadowHTML); 16942 } 16943 16944 if (supportsTouch && $('body.using-mobile-browser').length > 0) { 16945 // Stop processing. 16946 } else { 16947 (function (_thisImg, _layers, _totalLayers, _shine) { 16948 $(thisImg).parents('.style-5').on('mousemove', function (e) { 16949 16950 var parentEl = $(this); 16951 var parallaxContainer = parentEl.find('.parallaxImg-container'); 16952 var parallaxShad = parentEl.find('.parallaxImg-shadow'); 16953 16954 var now = Date.now(); 16955 16956 var usingGallery = ($(_thisImg).parents('.wpb_gallery').length > 0) ? true : false; 16957 16958 if (now > lastMove + eventThrottle) { 16959 lastMove = now; 16960 window.requestAnimationFrame(function () { 16961 processMovement(e, false, _thisImg, _layers, _totalLayers, _shine, parentEl, parallaxContainer, parallaxShad, usingGallery); 16962 });
16963 } 16964 16965 16966 }); 16967 $(thisImg).parents('.style-5').on('mouseenter', function (e) { 16968 processEnter(e, _thisImg, _layers, _totalLayers, _shine); 16969 }); 16970 $(thisImg).parents('.style-5').on('mouseleave', function (e) { 16971 processExit(e, _thisImg, _layers, _totalLayers, _shine); 16972 }); 16973 })(thisImg, layers, totalLayerElems, shineHTML); 16974 } 16975 16976 // Set the depths 16977 (function (_thisImg, _layers, _totalLayers, _shine) { 16978 depths(false, _thisImg, _layers, _totalLayers, _shine); 16979 window.addEventListener('resize', function () { 16980 depths(false, _thisImg, _layers, _totalLayers, _shine); 16981 }); 16982 })(thisImg, layers, totalLayerElems, shineHTML); 16983 } 16984 16985 if( lazyLoadedItems ) { 16986 nectarLazyImageLoading(); 16987 } 16988 16989 function processMovement(e, touchEnabled, elem, layers, totalLayers, shine, parentEl, parallaxContainer, parallaxShad, usingGal) { 16990 16991 // Stop raf if exit already called 16992 if (!$(elem.firstChild).hasClass('over')) { 16993 processExit(e, elem, layers, totalLayers, shine); 16994 return false 16995 } 16996 16997 // Set up multipliers 16998 var yMult = 0.03; 16999 var xMult = 0.063; 17000 17001 var scaleAmount = '1.03'; 17002 var offsetAmount = '-10'; 17003 var usingMasonrySize = false; 17004 17005 if ($(elem).parents('.col.wide').length > 0) { 17006 yMult = 0.03; 17007 xMult = 0.063; 17008 usingMasonrySize = true; 17009 } else if ($(elem).parents('.col.regular').length > 0 || $(elem).parents('.wpb_gallery').length > 0) { 17010 yMult = 0.045; 17011 xMult = 0.045; 17012 } else if ($(elem).parents('.col.tall').length > 0) { 17013 yMult = 0.05; 17014 xMult = 0.015; 17015 usingMasonrySize = true; 17016 } else if ($(elem).parents('.col.wide_tall').length > 0) { 17017 yMult = 0.04; 17018 xMult = 0.04; 17019 usingMasonrySize = true; 17020 } else if (parentEl.hasClass('nectar-fancy-box')) { 17021 yMult = 0.045; 17022 xMult = 0.022; 17023 scaleAmount = '1.06'; 17024 offsetAmount = '-2'; 17025 } else { 17026 yMult = 0.045; 17027 xMult = 0.075; 17028 } 17029 17030 var bdst = nectarDOMInfo.scrollTop, 17031 bdsl = 0, 17032 pageX = (touchEnabled) ? e.touches[0].pageX : e.pageX, 17033 pageY = (touchEnabled) ? e.touches[0].pageY : e.pageY, 17034 offsets = elem.getBoundingClientRect(), 17035 w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth, 17036 h = elem.clientHeight || elem.offsetHeight || elem.scrollHeight, 17037 wMultiple = 320 / w, 17038 offsetX = 0.52 - (pageX - offsets.left - bdsl) / w, 17039 offsetY = 0.52 - (pageY - offsets.top - bdst) / h, 17040 dy = (pageY - offsets.top - bdst) - h / 2, 17041 dx = (pageX - offsets.left - bdsl) - w / 2, 17042 yRotate = (offsetX - dx) * (yMult * wMultiple), 17043 xRotate = (dy - offsetY) * (xMult * wMultiple); 17044 17045 var imgCSS; 17046 17047 if (usingGal == true) { 17048 imgCSS = ' perspective(' + w * 3 + 'px) rotateX(' + -xRotate * 1.9 + 'deg) rotateY(' + -yRotate * 1.3 + 'deg)'; 17049 } else { 17050 17051 if (usingMasonrySize == false) { 17052 imgCSS = ' perspective(' + w * 3 + 'px) rotateX(' + xRotate + 'deg) rotateY(' + yRotate + 'deg) translateY(' + offsetY * offsetAmount + 'px) translateX(' + offsetX * offsetAmount + 'px) scale(' + scaleAmount + ')'; 17053 } else { 17054 imgCSS = ' perspective(' + w * 3 + 'px) rotateX(' + xRotate + 'deg) rotateY(' + yRotate + 'deg) translateY(' + offsetY * -10 + 'px) translateX(' + offsetX * -10 + 'px) scale(1.013)'; 17055 } 17056 17057 } 17058 17059 17060 // Container transform 17061 parallaxContainer.css('transform', imgCSS); 17062 17063 if (!(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1)) { 17064 parallaxShad.css('transform', imgCSS); 17065 } 17066 17067 17068 } 17069 17070 17071 function processEnter(e, elem) { 17072 17073 elem.firstChild.className += ' over'; 17074 elem.className += ' over'; 17075 17076 $(elem).addClass('transition'); 17077 17078 if ($(elem).parents('.wpb_gallery').length > 0) { 17079 setTimeout(function () { 17080 $(elem).removeClass('transition'); 17081 }, 450); 17082 } else { 17083 setTimeout(function () { 17084 $(elem).removeClass('transition'); 17085 }, 200); 17086 } 17087 17088 } 17089 17090 17091 function processExit(e, elem) { 17092 17093 var w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth; 17094 var container = elem.firstChild; 17095 17096 container.className = container.className.replace(' over', ''); 17097 elem.className = elem.className.replace(' over', ''); 17098 $(container).css('transform', 'perspective(' + w * 3 + 'px) rotateX(0deg) rotateY(0deg) translateZ(0)'); 17099 $(elem).parents('.parallaxImg-wrap').find('.parallaxImg-shadow').css('transform', 'perspective(' + w * 3 + 'px) rotateX(0deg) rotateY(0deg) translateZ(0)'); 17100 17101 $(elem).addClass('transition'); 17102 setTimeout(function () { 17103 $(elem).removeClass('transition'); 17104 }, 200); 17105 17106 } 17107 17108 17109 function depths(touchEnabled, elem, layers, totalLayers) { 17110 17111 var w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth; 17112 var container = elem.firstChild; 17113 17114 // Set z 17115 for (var ly = 0; ly < totalLayers; ly++) { 17116 if (ly == 0) { 17117 $(layers[ly]).css('transform', 'translateZ(0px)'); 17118 } 17119 else { 17120 $(layers[ly]).css('transform', 'translateZ(' + (w * 3) / 27 * (ly * 1.1) + 'px) '); 17121 } 17122 17123 } 17124 17125 totalLayers = totalLayers + 3; 17126 17127 // Set perspective from beginning 17128 $(container).css('transform', 'perspective(' + w * 3 + 'px)'); 17129 17130 } 17131 17132 } 17133 17134 17135 /** 17136 * Fancy Box 17137 * 17138 * @since 11.0 17139 */ 17140 function nectarFancyBoxHover() { 17141 17142 if( $('.nectar-fancy-box[data-style="hover_desc"]').length == 0 ) { 17143 return false; 17144 } 17145 17146 var $hoverContentHeight = 0; 17147 17148 $('body').on('mouseenter touchstart','.nectar-fancy-box[data-style="hover_desc"]', function() { 17149 $hoverContentHeight = parseInt($(this).find('.hover-content').outerHeight(true)); 17150 $(this).addClass('hovered'); 17151 $(this).find('.heading-wrap').css('transform','translateY(-'+ $hoverContentHeight +'px)'); 17152 });
17153 17154 $('body').on('mouseleave touchend','.nectar-fancy-box[data-style="hover_desc"]', function() { 17155 $(this).removeClass('hovered'); 17156 $(this).find('.heading-wrap').css('transform','translateY(0)'); 17157 }); 17158 17159 } 17160 17161 17162 17163 /** 17164 * Mouse Follow Icon 17165 * 17166 * @since 11.0 17167 */ 17168 function NectarMouseFollowIcon(el,iconSelector) { 17169 17170 this.$el = el; 17171 this.$iconEl = this.$el.find(iconSelector); 17172 17173 this.elX = 0; 17174 this.elY = 0; 17175 17176 this.initialX = this.$el.width() / 2; 17177 this.initialY = this.$el.height() / 2; 17178 17179 this.elX = 0; 17180 this.elY = 0; 17181 17182 this.lastScroll = 0; 17183 this.scrollAdjust = 0; 17184 17185 this.lastX = this.initialX; 17186 this.lastY = this.initialY; 17187 this.activeFollow = false; 17188 17189 this.percentage = 0.13; 17190 this.percentageTimeout; 17191 17192 $window.on('resize', this.resizeEvent.bind(this)); 17193 this.mouseEvents(); 17194 this.rafLoop(); 17195 17196 } 17197 17198 NectarMouseFollowIcon.prototype.resizeEvent = function() { 17199 this.initialX = this.$el.width() / 2; 17200 this.initialY = this.$el.height() / 2; 17201 }; 17202 17203 NectarMouseFollowIcon.prototype.mouseEvents = function() { 17204 17205 var that = this; 17206 17207 that.$el.on('mouseenter', function(e) { 17208 17209 that.activeFollow = true; 17210 17211 that.elX = e.offsetX; 17212 that.elY = e.offsetY; 17213 17214 that.lastScroll = 0; 17215 17216 clearTimeout(that.percentageTimeout); 17217 that.percentageTimeout = setTimeout(function(){ 17218 that.percentage = 0.2; 17219 },700); 17220 }); 17221 17222 that.$el.on('mouseleave', function() { 17223 17224 that.activeFollow = false; 17225 that.lastScroll = 0; 17226 17227 clearTimeout(that.percentageTimeout); 17228 that.percentage = 0.13; 17229 }); 17230 17231 that.$el.on('mousemove', function(e){ 17232 that.elX = e.offsetX; 17233 that.elY = e.offsetY; 17234 that.lastScroll = 0; 17235 }); 17236 17237 $(window).on('scroll',function() { 17238 if( that.activeFollow == true && that.lastScroll == 0) { 17239 that.lastScroll = nectarDOMInfo.scrollTop; 17240 } 17241 }); 17242 17243 }; 17244 17245 17246 NectarMouseFollowIcon.prototype.rafLoop = function() { 17247 17248 if( this.activeFollow == true ) { 17249 17250 this.scrollAdjust = ( this.lastScroll > 0 ) ? nectarDOMInfo.scrollTop - this.lastScroll : 0; 17251 17252 this.lastY = linearInterpolate(this.lastY, this.elY + this.scrollAdjust, this.percentage); 17253 this.lastX = linearInterpolate(this.lastX, this.elX, this.percentage); 17254 } else { 17255 this.lastY = linearInterpolate(this.lastY, this.initialY, 0.13); 17256 this.lastX = linearInterpolate(this.lastX, this.initialX, 0.13); 17257 } 17258 17259 this.$iconEl.css({ 17260 'transform': 'translateX(' + this.lastX + 'px) translateY(' + this.lastY + 'px)' 17261 }); 17262 17263 requestAnimationFrame(this.rafLoop.bind(this)); 17264 17265 }; 17266 17267 17268 17269 17270 /** 17271 * Video Lightbox 17272 * 17273 * @since 11.0 17274 */ 17275 function nectarVideoLightbox() { 17276 17277 iconMouseFollowArr = []; 17278 17279 // Parent hover relationship. 17280 $body.on('mouseenter','.nectar_video_lightbox[data-parent-hover="1"]', function() { 17281 var $parentRow = $(this).parents('.wpb_row'); 17282 $parentRow.find('> .row-bg-wrap .row-bg, > .nectar-video-wrap .nectar-video-inner').addClass('transition'); 17283 $parentRow.find('> .row-bg-wrap .row-bg, > .nectar-video-wrap .nectar-video-inner').css({ 17284 'transform' : 'scale(1.08)' 17285 }); 17286 }); 17287 17288 $body.on('mouseleave','.nectar_video_lightbox[data-parent-hover="1"]', function() { 17289 var $parentRow = $(this).parents('.wpb_row'); 17290 $parentRow.find('> .row-bg-wrap .row-bg, > .nectar-video-wrap .nectar-video-inner').css({ 17291 'transform' : 'scale(1)' 17292 }); 17293 }); 17294 17295 // Mouse Indicator. 17296 $('.nectar-video-box').each(function(i){ 17297 17298 if( $(this).find('.play_button_mouse_follow') ) { 17299 17300 var $that = $(this); 17301 17302 $(this).imagesLoaded(function () { 17303 17304 // Follow mouse. 17305 if( !nectarDOMInfo.usingMobileBrowser ) { 17306 iconMouseFollowArr[i] = new NectarMouseFollowIcon($that, '.play_button_mouse_follow'); 17307 } 17308 17309 // Initial setup. 17310 var $playColor = ( $that.is('[data-mouse-icon-color]') && $that.attr('data-mouse-icon-color').length > 0 ) ? $that.attr('data-mouse-icon-color') : '#000'; 17311 17312 if( $that.is('[data-mouse-style="solid_color"]') ) { 17313 17314 $that.find('.play_button_mouse_follow').css({ 17315 'background-color': $playColor 17316 });
17317 } 17318 17319 $that.find('.play_button_mouse_follow').addClass('visible'); 17320 17321 }); 17322 17323 } 17324 17325 }); 17326 17327 } 17328 17329 17330 17331 /** 17332 * Salient slider rotation 17333 * 17334 * @since 10.5 17335 */ 17336 function nectarCustomSliderRotate(slider) { 17337 17338 if ($('body.vc_editor').length > 0) { 17339 return; 17340 } 17341 17342 var $controlSelector = (slider.find('.project-slides').length > 0) ? '.dot-nav > span' : '.controls > li', 17343 $controlSelectorInd = (slider.find('.project-slides').length > 0) ? 'span' : ' li', 17344 $slideLength = slider.find($controlSelector).length, 17345 $currentSlide = slider.find($controlSelector + '.active').index(); 17346 17347 if ($currentSlide + 1 == $slideLength) { 17348 slider.find($controlSelector + ':first-child').trigger('click'); 17349 } else { 17350 slider.find($controlSelector + '.active').next($controlSelectorInd).trigger('click'); 17351 } 17352 } 17353 17354 17355 /** 17356 * Salient slider rotation reset 17357 * 17358 * @since 10.5 17359 */ 17360 function nectarCustomSliderResetRotate(slider, index) { 17361 clearInterval($nectarCustomSliderRotate[index].autorotate); 17362 17363 // Reinit autorotate 17364 if (slider.attr('data-autorotate').length > 0) { 17365 var slide_interval = (parseInt(slider.attr('data-autorotate')) < 100) ? 4000 : parseInt(slider.attr('data-autorotate')); 17366 $nectarCustomSliderRotate[index].autorotate = setInterval(function () { 17367 nectarCustomSliderRotate(slider) 17368 }, slide_interval); 17369 } 17370 } 17371 17372 17373 17374 /** 17375 * Fullscreen recent project slider 17376 * 17377 * @since 10.5 17378 */ 17379 function fsProjectSliderInit() { 17380 17381 $fsProjectSliderArr = []; 17382 17383 if (typeof SalientRecentProjectsFullScreen === 'undefined') { 17384 return; 17385 } 17386 17387 $('.nectar_fullscreen_zoom_recent_projects').each(function (i) { 17388 $fsProjectSliderArr[i] = new SalientRecentProjectsFullScreen($(this)); 17389 }); 17390 17391 } 17392 17393 17394 17395 17396 17397 /** 17398 * Portfolio single template sticky sidebar 17399 * 17400 * @since 6.0 17401 */ 17402 function portfolioSidebarFollow() { 17403 17404 var sidebarFollow = $('.single-portfolio #sidebar').attr('data-follow-on-scroll'); 17405 17406 if ($('body.single-portfolio').length == 0 || $('#sidebar[data-follow-on-scroll]').length == 0) { 17407 return; 17408 } 17409 17410 sidebarFollow = $('.single-portfolio #sidebar').attr('data-follow-on-scroll'); 17411 17412 if (sidebarFollow == 1 && 17413 !$body.hasClass('mobile') && 17414 parseInt($('#sidebar').height()) + 50 <= parseInt($('.post-area').height())) { 17415 17416 //padding from top of screen 17417 var $ssExtraTopSpace = 50; 17418 17419 if ($('#header-outer[data-remove-fixed="0"]').length > 0 && 17420 $('body[data-hhun="1"]').length == 0) { 17421 17422 $ssExtraTopSpace += $headerOuterEl.outerHeight(); 17423 17424 // Resize effect 17425 if ($('#header-outer[data-shrink-num][data-header-resize="1"]').length > 0) { 17426 var headerPadding2 = parseInt($headerOuterEl.attr('data-padding')) - parseInt($headerOuterEl.attr('data-padding')) / 1.8; 17427 $ssExtraTopSpace -= logoShrinkNum; 17428 $ssExtraTopSpace -= headerPadding2; 17429 } 17430 17431 // Condense 17432 if ($('body.mobile').length == 0 && $('#header-outer[data-condense="true"]').length > 0) { 17433 17434 var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'); 17435 17436 $ssExtraTopSpace = 50; 17437 $ssExtraTopSpace += $headerOuterEl.height() - (parseInt($headerSpan9.position().top) - parseInt($('#header-outer #logo').css('margin-top'))) - parseInt(nectarDOMInfo.secondaryHeaderHeight); 17438 } 17439 17440 } 17441 17442 if ($wpAdminBar.length > 0) { 17443 $ssExtraTopSpace += $wpAdminBar.outerHeight(); 17444 } 17445 17446 17447 $('.single-portfolio #sidebar').theiaStickySidebar({ 17448 additionalMarginTop: $ssExtraTopSpace, 17449 updateSidebarHeight: false 17450 }); 17451 17452 17453 } 17454 17455 } 17456 17457 17458 17459 17460 17461 /** 17462 * Infinite scroll pagination 17463 * 17464 * @since 6.0 17465 */ 17466 function infiniteScrollInit() { 17467 17468 if ($('.infinite_scroll').length > 0) { 17469 17470 // Portfolio 17471 $('.portfolio-items.infinite_scroll').infinitescroll({ 17472 navSelector: "div#pagination", 17473 nextSelector: "div#pagination a:first", 17474 itemSelector: ".portfolio-items.infinite_scroll .element", 17475 finishedMsg: "<em>Congratulations, you've reached the end of the internet.</em>", 17476 msgText: " ", 17477 }, function (newElements) { 17478 17479 17480 var $container = $('.portfolio-items.infinite_scroll:not(.carousel)'), 17481 $newElems = $(newElements).css('opacity', 0); 17482 17483 // Ensure that images load before adding to masonry layout 17484 $newElems.imagesLoaded(function () { 17485 17486 $(newElements).css('opacity', 1); 17487 17488 $container.isotope('appended', $(newElements)); 17489 17490 $(newElements).find('.work-item').addClass('ajax-loaded'); 17491 $(newElements).addClass('ajax-loaded'); 17492
17493 // Show elems now they're ready 17494 $(newElements).find('.work-meta, .nectar-love-wrap').css({ 17495 'opacity': 1 17496 }); 17497 17498 // Keep current filtering 17499 if ($('.portfolio-filters-inline').length > 0 || $('.portfolio-filters').length > 0) { 17500 17501 var selector; 17502 17503 if ($('.portfolio-filters-inline').length > 0) { 17504 selector = $('.portfolio-filters-inline a.active').attr('data-filter'); 17505 } else { 17506 selector = $('.portfolio-filters a.active').attr('data-filter'); 17507 } 17508 17509 $('.portfolio-filters-inline a.active').attr('data-filter'); 17510 $container.isotope({ 17511 filter: selector 17512 }); 17513 } 17514 17515 // Set width 17516 for (var i = 0; i < $portfolio_containers.length; i++) { 17517 $portfolio_containers[i].reLayout(); 17518 } 17519 17520 if ($(newElements).find('.work-item.style-5').length > 0) { 17521 parallaxItemHoverEffect(); 17522 } 17523 17524 if ($(newElements).find('.inner-wrap').attr('data-animation') == 'none') { 17525 $('.portfolio-items .col .inner-wrap').removeClass('animated'); 17526 } else { 17527 17528 for (var i = 0; i < $portfolio_containers.length; i++) { 17529 $portfolio_containers[i].masonryZindex(); 17530 $portfolio_containers[i].portfolioAccentColor(); 17531 } 17532 17533 $(newElements).each(function () { 17534 17535 var $portfolioOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '90%'; 17536 17537 // Not already visible 17538 var $that = $(this); 17539 var waypoint = new Waypoint({ 17540 element: $that, 17541 handler: function () { 17542 17543 var $portfolioAnimationDelay = ($that.is('[data-masonry-type="photography"].masonry-items')) ? 85 : 115; 17544 17545 setTimeout(function () { 17546 $that.addClass("animated-in"); 17547 }, $portfolioAnimationDelay * $that.attr('data-delay-amount')); 17548 17549 17550 waypoint.destroy(); 17551 }, 17552 offset: $portfolioOffsetPos 17553 17554 }); 17555 17556 17557 }); 17558 } 17559 17560 17561 // Lightbox reinit. 17562 $('.portfolio-items').each(function () { 17563 var $unique_id = uniqueIdGenerate(); 17564 $(this).find('a[rel^="prettyPhoto"], a.pretty_photo').attr('rel', 'prettyPhoto[' + $unique_id + '_gal]').removeClass('pretty_photo'); 17565 });
17566 17567 17568 $('.portfolio-items').each(function () { 17569 var $unique_id = uniqueIdGenerate(); 17570 $(this).find('a[data-fancybox^="group_"]').attr('data-fancybox', 'group_' + $unique_id); 17571 }); 17572 17573 lightBoxInit(); 17574 17575 setTimeout(function () { 17576 17577 for (var i = 0; i < $portfolio_containers.length; i++) { 17578 $portfolio_containers[i].masonryZindex(); 17579 $portfolio_containers[i].reLayout(); 17580 $portfolio_containers[i].isotopeCatSelection(); 17581 } 17582 $(newElements).removeClass('ajax-loaded'); 17583 }, 700); 17584 17585 parallaxRowsBGCals(); 17586 17587 }); 17588 17589 17590 }); 17591 17592 // Blog 17593 $('.post-area.infinite_scroll .posts-container').infinitescroll({ 17594 navSelector: "div#pagination", 17595 nextSelector: "div#pagination a:first", 17596 itemSelector: ".post-area.infinite_scroll .posts-container .post", 17597 finishedMsg: "<em>Congratulations, you've reached the end of the internet.</em>", 17598 msgText: " " 17599 }, function (newElements) { 17600 17601 if($(newElements).find('[data-nectar-img-src]').length > 0) { 17602 nectarLazyImageLoading(); 17603 } 17604 17605 // Only trigger recalc of waypoints and elements if needed. 17606 if ($('.masonry.classic').length > 0 || 17607 $('.post-area:not(.masonry):not(.featured_img_left)').length > 0 || 17608 $('.post-area.standard-minimal').length > 0) { 17609 17610 // Gallery. 17611 flexsliderInit(); 17612 17613 // Media players. 17614 if ($().mediaelementplayer) { 17615 $(newElements).find('.wp-audio-shortcode, .wp-video-shortcode').mediaelementplayer(); 17616 } 17617 17618 // Lightbox. 17619 lightBoxInit(); 17620 17621 // Carousels. 17622 if ($('.carousel').length > 0) { 17623 standardCarouselInit(); 17624 clientsCarouselInit(); 17625 } 17626 17627 // Waypoints. 17628 waypoints(); 17629 17630 // Testimonial slider. 17631 $('.testimonial_slider').animate({ 17632 'opacity': '1' 17633 }, 800); 17634 nectarTestimonialSliders(); 17635 nectarTestimonialSlidersEvents(); 17636 17637 setTimeout(function () { 17638 responsiveVideoIframesInit(); 17639 responsiveVideoIframes(); 17640 $window.trigger('resize'); 17641 }, 500); 17642 17643 17644 parallaxRowsBGCals(); 17645 17646 $window.trigger('resize'); 17647 17648 } // Non meta overlaid style. 17649 else { 17650 parallaxRowsBGCals(); 17651 17652 $window.trigger('resize'); 17653 } 17654 17655 // Trigger Masonry as a callback. 17656 var $container = $('.infinite_scroll .posts-container'); 17657 if ($container.parent().hasClass('masonry')) { 17658 17659 $(newElements).addClass('masonry-blog-item'); 17660 17661 17662 } //if masonry. 17663 17664 17665 // Loading effect. 17666 17667 //// hide new items while they are loading. 17668 var $newElems = $(newElements); 17669 //// ensure that images load before adding to masonry layout. 17670 17671 if ($newElems.find('img').length == 0) { 17672 $newElems = $('body'); 17673 } 17674 17675 $newElems.imagesLoaded(function () { 17676 17677 if ($container.parent().hasClass('masonry') && 17678 !$container.parent().hasClass('auto_meta_overlaid_spaced')) { 17679 $container.isotope('appended', $(newElements)); 17680 } 17681 17682 for (var i = 0; i < $nectarMasonryBlogs.length; i++) { 17683 $nectarMasonryBlogs[i].flickityBlogInit(); 17684 } 17685 17686 $(newElements).addClass('ajax-loaded');
17687 // Show elems now they're ready. 17688 17689 // Classic enhanced specific 17690 if ($container.parent().hasClass('classic_enhanced')) { 17691 $container.find('.large_featured.has-post-thumbnail.ajax-loaded .post-featured-img, .wide_tall.has-post-thumbnail.ajax-loaded .post-featured-img').each(function () { 17692 var $src = $(this).find('img').attr('src'); 17693 $(this).css('background-image', 'url(' + $src + ')'); 17694 }); 17695 17696 $container.find('.large_featured.ajax-loaded .nectar-flickity, .wide_tall.ajax-loaded .nectar-flickity').each(function () { 17697 17698 $(this).find('.cell').each(function () { 17699 var $src = $(this).find('img').attr('src'); 17700 $(this).css('background-image', 'url(' + $src + ')'); 17701 }); 17702 17703 }); 17704 } 17705 17706 17707 if ($(newElements).parents('.posts-container').attr('data-animation') == 'none') { 17708 $(newElements).find('.inner-wrap').removeClass('animated'); 17709 } else { 17710 17711 for (var i = 0; i < $nectarMasonryBlogs.length; i++) { 17712 $nectarMasonryBlogs[i].blogMasonryZindex(); 17713 } 17714 17715 $(newElements).each(function () { 17716 17717 var $that = $(this); 17718 var waypoint = new Waypoint({ 17719 17720 element: $that, 17721 handler: function () { 17722 17723 setTimeout(function () { 17724 $that.addClass("animated-in"); 17725 }, 80 * $that.attr('data-delay-amount')); 17726 17727 waypoint.destroy(); 17728 }, 17729 offset: '90%' 17730 17731 }); 17732 17733 17734 }); 17735 } 17736 17737 setTimeout(function () { 17738 $(newElements).removeClass('ajax-loaded'); 17739 }, 700); 17740 17741 17742 }); 17743 17744 17745 }); 17746 17747 } 17748 17749 } 17750 17751 17752 17753 17754 17755 17756 /** 17757 * Scroll to top scroll bind. 17758 * 17759 * @since 2.0 17760 */ 17761 function toTopBind() { 17762 17763 if ($('#to-top').length > 0 && $window.width() > 1020 || 17764 $('#to-top').length > 0 && $('#to-top.mobile-enabled').length > 0) { 17765 17766 if (nectarDOMInfo.scrollTop > 350) { 17767 $window.on('scroll', hideToTop); 17768 } else { 17769 $window.on('scroll', showToTop); 17770 } 17771 } 17772 17773 } 17774 17775 /** 17776 * Scroll to top show. 17777 * 17778 * @since 2.0 17779 */ 17780 function showToTop() { 17781 17782 if (nectarDOMInfo.scrollTop > 350 && !$offCanvasEl.is('.fullscreen.open') ) { 17783 17784 $('#to-top').stop().transition({ 17785 'transform': 'translateY(-50%)' 17786 }, 350, 'easeInOutCubic'); 17787 17788 $window.off('scroll', showToTop); 17789 $window.on('scroll', hideToTop); 17790 } 17791 17792 } 17793 17794 17795 /** 17796 * Scroll to top hide. 17797 * 17798 * @since 2.0 17799 */ 17800 function hideToTop() { 17801 17802 if (nectarDOMInfo.scrollTop < 350 || $offCanvasEl.is('.fullscreen.open') ) { 17803 17804 var $animationTiming = ($('#slide-out-widget-area.fullscreen.open').length > 0) ? 1150 : 350; 17805 17806 $('#to-top').stop().transition({ 17807 'transform': 'translateY(105%)' 17808 }, $animationTiming, 'easeInOutQuint'); 17809 17810 $window.off('scroll', hideToTop); 17811 $window.on('scroll', showToTop); 17812 17813 } 17814 } 17815 17816 17817 /** 17818 * Scroll to top initialization. 17819 * 17820 * @since 10.5 17821 */ 17822 function scrollToTopInit() { 17823 17824 // Show/hide based on scroll pos 17825 if ($('.nectar-social.fixed').length == 0) { 17826 toTopBind(); 17827 } 17828 17829 17830 // Rounded style 17831 if ($('body[data-button-style*="rounded"]').length > 0) { 17832 var $clone = $('#to-top .fa-angle-up').clone(); 17833 $clone.addClass('top-icon'); 17834 $('#to-top').prepend($clone); 17835 } 17836 17837 // Scroll up click event 17838 $body.on('click', '#to-top, a[href="#top"]', function () { 17839 $('body,html').stop().animate({ 17840 scrollTop: 0 17841 }, 800, 'easeOutQuad', function () { 17842 if ($('.nectar-box-roll').length > 0) { 17843 $body.trigger('mousewheel', [1, 0, 0]); 17844 } 17845 }); 17846 return false; 17847 }); 17848 17849 } 17850 17851 17852 17853 17854 17855 17856 17857 17858 17859 /** 17860 * Scrollspy plugin initialization. 17861 * 17862 * @since 5.0 17863 */ 17864 function scrollSpyInit() { 17865 17866 var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $window.width() > 1000) ? 0 : $headerOuterEl.outerHeight(); 17867 17868 if ($('.page-template-template-no-header-footer').length > 0 || $('.page-template-template-no-header').length > 0) { 17869 $headerNavSpace = 0; 17870 } 17871 17872 // Track whether scrollspy is really needed. 17873 var hashLinksFound = false; 17874 17875 //prevent jump to top on empty items 17876 $('header#top .sf-menu li a[href="#"]').on('click', function (e) { 17877 e.preventDefault(); 17878 });
17879 17880 if ($('#nectar_fullscreen_rows').length == 0 || $nectarFullPage.$usingFullScreenRows == false) { 17881 17882 $('a.nectar-next-section').each(function () { 17883 17884 if ($(this).parents('.wpb_row:not(.inner_row)').length > 0) { 17885 17886 var $parentRow = $(this).parents('.wpb_row:not(.inner_row)'); 17887 17888 if ($parentRow.next('.wpb_row[id]:not(.inner_row)').length > 0) { 17889 17890 var $nextRowID = $parentRow.next('.wpb_row[id]:not(.inner_row)').attr('id'); 17891 $(this).attr('href', '#' + $nextRowID); 17892 hashLinksFound = true; 17893 } 17894 17895 } 17896 17897 }); 17898 } 17899 17900 else if ($().fullpage) { 17901 $('a.nectar-next-section').on('click', function () { 17902 $.fn.fullpage.moveSectionDown(); 17903 return false; 17904 }); 17905 } 17906 17907 17908 // Links in off canvas menu. 17909 if ($('#slide-out-widget-area .off-canvas-menu-container').length > 0) { 17910 $('#slide-out-widget-area .off-canvas-menu-container').find("a[href*='" + location.pathname + "']").each(function () { 17911 17912 var $href = $(this).attr('href'); 17913 17914 // Regular animated anchors. 17915 if ($href != '#' && 17916 $href.indexOf("#") != -1 && 17917 $href.substr($href.indexOf("#")) !== '#' && 17918 $('div' + $href.substr($href.indexOf("#"))).length > 0) { 17919 17920 $(this).attr('href', $href.substr($href.indexOf("#"))); 17921 17922 $(this).parent() 17923 .removeClass('current_page_item') 17924 .removeClass('current-menu-item'); 17925 17926 } 17927 17928 // Fullpage is a little different. 17929 if ($('div[data-fullscreen-anchor-id="' + $href.substr($href.indexOf("#") + 1) + '"]').length > 0) { 17930 17931 $(this).parent() 17932 .removeClass('current_page_item') 17933 .removeClass('current-menu-item'); 17934 17935 } 17936 17937 }); 17938 } 17939 17940 // Links in header navigation. 17941 $("#header-outer").find("a[href*='" + location.pathname + "']").each(function () { 17942 17943 var $href = $(this).attr('href'); 17944 17945 // Regular animated anchors 17946 if ($href.indexOf("#") != -1 && 17947 $href.substr($href.indexOf("#")) !== '#' && 17948 $('div' + $href.substr($href.indexOf("#"))).length > 0) { 17949 17950 $(this).attr('href', $href.substr($href.indexOf("#"))); 17951 $(this).parent() 17952 .removeClass('current_page_item') 17953 .removeClass('current-menu-item'); 17954 17955 } 17956 17957 // Fullpage is a little different 17958 if ($('div[data-fullscreen-anchor-id="' + $href.substr($href.indexOf("#") + 1) + '"]').length > 0) { 17959 17960 $(this).parent() 17961 .removeClass('current_page_item') 17962 .removeClass('current-menu-item'); 17963 17964 } 17965 17966 }); 17967 17968 // Hash links in menu? 17969 if( $("#header-outer").length > 0 ) { 17970 $("#header-outer").find("a[href*='#']:not([href='#'])").each(function() { 17971 if( $(this).attr('href') !== '#' && 17972 $(this).attr('href') !== '#searchbox' && 17973 $(this).attr('href') !== '#sidewidgetarea') { 17974 hashLinksFound = true; 17975 } 17976 }); 17977 } 17978 17979 if( $("#slide-out-widget-area .off-canvas-menu-container").length > 0 ) { 17980 $("#slide-out-widget-area .off-canvas-menu-container").find("a[href*='#']:not([href='#'])").each(function() { 17981 if( $(this).attr('href') !== '#' ) { 17982 hashLinksFound = true; 17983 } 17984 }); 17985 } 17986 17987 // Init scrollspy. 17988 var targetList = []; 17989 if( hashLinksFound == true ) { 17990 targetList.push('#header-outer nav'); 17991 } 17992 if( $('.page-submenu[data-sticky="true"] a[href*="#"]').length > 0 ) { 17993 targetList.push('.page-submenu[data-sticky="true"]'); 17994 } 17995 17996 if( targetList.length > 0 ) { 17997 targetList.forEach(function(tar, i) { 17998 var $el = (i == 0) ? $body : $(window); 17999 $el.scrollspy({ 18000 target: tar, 18001 offset: $headerNavSpace + nectarDOMInfo.adminBarHeight + 40 18002 }); 18003 }); 18004 } 18005 18006 } 18007 18008 18009 18010 18011 /** 18012 * Called to scroll to hash link on page load 18013 * 18014 * @since 5.0 18015 */ 18016 function pageLoadHash() { 18017 18018 var $hash = window.location.hash; 18019 18020 if( $hash && $hash.length > 0 ) { 18021 $hash = $hash.replace(/<|>/g,''); 18022 } 18023 18024 var $hashSubstrng = ($hash && $hash.length > 0) ? $hash.substring(1, $hash.length) : 0, 18025 headerPadding2 = headerPadding - headerPadding / 1.8, 18026 $hasSlashLength = 0; 18027 18028 18029 // If the hash has slashes 18030 if ($hashSubstrng) { 18031 $hasSlashLength = $hashSubstrng.split("/"); 18032 $hasSlashLength = $hasSlashLength.length; 18033 } 18034 18035 if ($hashSubstrng && $hasSlashLength > 1) { 18036 $hashSubstrng = $hashSubstrng.replace(/\//g, ""); 18037 $hash = $hash.replace(/\//g, ""); 18038 } 18039 18040 if ($hash && $('.main-content').find($hash).length > 0 || 18041 $hash && $('.main-content').find('[data-fullscreen-anchor-id="' + $hashSubstrng + '"]').length > 0) { 18042 18043 var $hashObj = ($('.main-content').find($hash).length > 0) ? $('.main-content').find($hash) : $('.main-content').find('[data-fullscreen-anchor-id="' + $hashSubstrng + '"]'), 18044 $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $window.width() > 1000) ? 0 : $('#header-space').outerHeight(); 18045 18046 if ($('.page-template-template-no-header-footer').length > 0 || $('.page-template-template-no-header').length > 0) { 18047 $headerNavSpace = 0; 18048 } 18049 18050 var $timeoutVar = 100; 18051 18052 if ($('.nectar-box-roll').length > 0 && $('.container-wrap.bottomBoxOut').length > 0) { 18053 nectarBoxRoll.boxRoll(null, -1); 18054 $timeoutVar = 2050; 18055 } 18056 18057 setTimeout(function () { 18058 18059 var $scrollTopDistance; 18060 18061 if ($('body[data-permanent-transparent="1"]').length == 0) { 18062 18063 if (!$body.hasClass('mobile')) { 18064 var $resize = ($('#header-outer[data-header-resize="0"]').length > 0) ? 0 : parseInt(logoShrinkNum) + headerPadding2 * 2; 18065 if ($('#header-outer[data-remove-fixed="1"]').length > 0) { 18066 $headerNavSpace = 0; 18067 } 18068 $scrollTopDistance = $hashObj.offset().top - parseInt($headerNavSpace) + $resize + 3 - nectarDOMInfo.adminBarHeight; 18069 18070 18071 // Condense 18072 if ($('body.mobile').length == 0 && 18073 $('#header-outer[data-condense="true"]').length > 0 && 18074 $('body.page-template-template-no-header').length === 0 && 18075 $('body.page-template-template-no-header-footer').length === 0) { 18076 18077 var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'), 18078 $headerHeightStored = $headerOuterEl.height(),
18079 $headerHeightCondensed = $headerHeightStored - (parseInt($headerSpan9.height()) + parseInt($('#header-outer #logo').css('margin-top'))); 18080 18081 $scrollTopDistance = $hashObj.offset().top - parseInt($headerNavSpace) + $headerHeightCondensed - nectarDOMInfo.adminBarHeight; 18082 } 18083 18084 } else { 18085 $scrollTopDistance = ($('#header-outer[data-mobile-fixed="1"]').length > 0) ? $hashObj.offset().top + 2 - $headerNavSpace + nectarDOMInfo.adminBarHeight : $hashObj.offset().top - nectarDOMInfo.adminBarHeight + 1; 18086 } 18087 18088 } else { 18089 $scrollTopDistance = $hashObj.offset().top - nectarDOMInfo.adminBarHeight + 1; 18090 } 18091 18092 if ($('body[data-hhun="1"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length == 0) { 18093 18094 // Alter offset 18095 if ($('#header-outer.detached').length == 0) { 18096 $scrollTopDistance = $scrollTopDistance + $headerNavSpace; 18097 } 18098 } 18099 18100 var $pageSubMenu = ($('.page-submenu[data-sticky="true"]').length > 0) ? $('.page-submenu').height() : 0; 18101 var $headerSecondary; 18102 18103 if ($('body.material').length > 0 && 18104 $headerSecondaryEl.length > 0 && 18105 $('body[data-hhun="1"]').length == 0 && 18106 $('#header-outer[data-remove-fixed="1"]').length == 0 && 18107 !$body.hasClass('mobile')) { 18108 18109 $headerSecondary = $headerSecondaryEl.height(); 18110 18111 } else { 18112 $headerSecondary = 0; 18113 } 18114 18115 nectar_scrollToY($scrollTopDistance - $pageSubMenu + $headerSecondary, 700, 'easeInOutQuint'); 18116 18117 }, $timeoutVar); 18118 } 18119 } 18120 18121 18122 /** 18123 * Initialize page load hash functionality 18124 * 18125 * @since 10.5 18126 */ 18127 function pageLoadHashInit() { 18128 18129 if ($('body[data-animated-anchors="true"]').length > 0) { 18130 if ($('.nectar-box-roll').length == 0 && $('#nectar_fullscreen_rows').length == 0) { 18131 18132 // Inside tabs 18133 if (typeof nectarGetQueryParam['tab'] != 'undefined') { 18134 setTimeout(function () { 18135 pageLoadHash(); 18136 }, 800); 18137 } 18138 // Regular 18139 else { 18140 pageLoadHash(); 18141 } 18142 18143 } 18144 18145 if ($('#nectar_fullscreen_rows[data-mobile-disable="on"]').length > 0 && $('.nectar-box-roll').length == 0 && 18146 nectarDOMInfo.usingMobileBrowser) { 18147 pageLoadHash(); 18148 } 18149 18150 } 18151 18152 } 18153 18154 18155 /** 18156 * Animated anchor link theme option. 18157 * 18158 * @since 10.5 18159 */ 18160 function animatedAnchorLinks() { 18161 18162 if ($('body[data-animated-anchors="true"]').length > 0 || 18163 $('.single-product [data-gallery-style="left_thumb_sticky"]').length > 0) { 18164 18165 var headerPadding2 = headerPadding - headerPadding / 1.8; 18166 18167 setTimeout(scrollSpyInit, 200); 18168 18169 var $animatedScrollingTimeout; 18170 18171 $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) { 18172 18173 var triggerAnimatedScroll = true; 18174 var $hash = $(this).prop("hash"); 18175 18176 if( !$(this).hasClass('nectar-next-section') && headerHideUntilNeeded == '1' ) { 18177 $body.addClass('animated-scrolling'); 18178 nectarState.animatedScrolling = true; 18179 } 18180 18181 clearTimeout($animatedScrollingTimeout); 18182 18183 $animatedScrollingTimeout = setTimeout(function () { 18184 $body.removeClass('animated-scrolling'); 18185 nectarState.animatedScrolling = false; 18186 }, 850); 18187 18188 var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $window.width() > 1000) ? 0 : $('#header-space').outerHeight(); 18189 18190 if ($('.page-template-template-no-header-footer').length > 0 || 18191 $('.page-template-template-no-header').length > 0 || 18192 $('#header-space').length == 0 ) { 18193 $headerNavSpace = 0; 18194 } 18195 18196 // Delay full page anchors until material right OCM closes 18197 if ( $nectarFullPage.$usingFullScreenRows != false && 18198 $('#nectar_fullscreen_rows[data-anchors="on"]').length > 0 && 18199 $hash && $hash != '' && $hash != '#top' &&
18200 $('body.material[data-slide-out-widget-area-style="slide-out-from-right"].material-ocm-open').length > 0) { 18201 18202 e.preventDefault(); 18203 18204 if (!$(this).hasClass('skip-hash')) { 18205 if (history.pushState) { 18206 history.pushState(null, null, $hash); 18207 } else { 18208 location.hash = $hash; 18209 } 18210 18211 } 18212 18213 setTimeout(function() { 18214 $(window).trigger('hashchange'); 18215 },800); 18216 18217 } 18218 18219 18220 if ($hash && $body.find($hash).length > 0 && $hash != '#top' && $hash != '' && $(this).attr('href').indexOf(window.location.href.split("#")[0]) !== -1 || 18221 $(this).is('[href^="#"]') && $hash != '' && $body.find($hash).length > 0 && $hash != '#top') { 18222 18223 //update hash 18224 if (!$(this).hasClass('skip-hash')) { 18225 if (history.pushState) { 18226 history.pushState(null, null, $hash); 18227 } else { 18228 location.hash = $hash; 18229 } 18230 } 18231 18232 if ($(this).parents('ul').length > 0) { 18233 18234 $(this) 18235 .parents('ul') 18236 .find('li') 18237 .removeClass('current-menu-item'); 18238 } 18239 18240 // Side widget area click 18241 if ($(this).parents('#slide-out-widget-area').length > 0) { 18242 18243 if ($('body.material[data-slide-out-widget-area-style="slide-out-from-right"].material-ocm-open').length > 0) { 18244 18245 $('body > .slide_out_area_close') 18246 .addClass('non-human-allowed') 18247 .trigger('click'); 18248 18249 // Scroll 18250 var $clickedLinkStore = $(this); 18251 18252 triggerAnimatedScroll = false; 18253 18254 setTimeout(function () { 18255 $clickedLinkStore.trigger('click'); 18256 }, 1000); 18257 18258 } else { 18259 $('#slide-out-widget-area .slide_out_area_close') 18260 .addClass('non-human-allowed') 18261 .trigger('click'); 18262 } 18263 18264 setTimeout(function () { 18265 if ($('body.material[data-slide-out-widget-area-style="slide-out-from-right"]').length > 0) { 18266 $('body > .slide_out_area_close').removeClass('non-human-allowed'); 18267 18268 } else { 18269 $('#slide-out-widget-area .slide_out_area_close').removeClass('non-human-allowed'); 18270 } 18271 }, 100); 18272 } 18273 18274 // Mobile menu click 18275 if ( $(this).parents('#mobile-menu').length > 0 ) { 18276 $('.slide-out-widget-area-toggle.mobile-icon a') 18277 .addClass('non-human-allowed') 18278 .trigger('click'); 18279 18280 setTimeout(function () { 18281 $('.slide-out-widget-area-toggle.mobile-icon a').removeClass('non-human-allowed'); 18282 }, 100); 18283 } 18284 18285 var $mobileMenuHeight = ($(this).parents('#mobile-menu').length > 0) ? $(this).parents('#mobile-menu').height() : null; 18286 var $timeoutVar = 1; 18287 var $that = $(this); 18288 18289 if ($('.nectar-box-roll').length > 0 && $('.container-wrap.bottomBoxOut').length > 0) { 18290 nectarBoxRoll.boxRoll(null, -1); 18291 $timeoutVar = 2050; 18292 } 18293 18294 18295 setTimeout(function () { 18296 18297 var $scrollTopDistance; 18298 18299 // Scrolling 18300 if ($('body[data-permanent-transparent="1"]').length == 0) { 18301 18302 if (!$body.hasClass('mobile')) { 18303 var $resize = ($('#header-outer[data-header-resize="0"]').length > 0) ? 0 : parseInt(logoShrinkNum) + headerPadding2 * 2; 18304 if ($('#header-outer[data-remove-fixed="1"]').length > 0) { 18305 $headerNavSpace = 0; 18306 } 18307 18308 $scrollTopDistance = $($hash).offset().top - $mobileMenuHeight - parseInt($headerNavSpace) + $resize + 3 - nectarDOMInfo.adminBarHeight; 18309 18310 // Condense 18311 if ($('body.mobile').length == 0 && 18312 $('body.page-template-template-no-header').length === 0 && 18313 $('body.page-template-template-no-header-footer').length === 0 && 18314 $('#header-outer[data-condense="true"]').length > 0) { 18315 18316 var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'), 18317 $headerHeightStored = $headerOuterEl.height(),
18318 $headerHeightCondensed = $headerHeightStored - (parseInt($headerSpan9.height()) + parseInt($('#header-outer #logo').css('margin-top'))); 18319 $scrollTopDistance = $($hash).offset().top - parseInt($headerNavSpace) + $headerHeightCondensed - nectarDOMInfo.adminBarHeight; 18320 18321 18322 } 18323 18324 18325 } else { 18326 $scrollTopDistance = ($('#header-outer[data-mobile-fixed="1"]').length > 0) ? $($hash).offset().top + 2 - $headerNavSpace + nectarDOMInfo.adminBarHeight : $($hash).offset().top - $mobileMenuHeight - nectarDOMInfo.adminBarHeight + 1; 18327 } 18328 18329 } else { 18330 $scrollTopDistance = $($hash).offset().top - nectarDOMInfo.adminBarHeight + 1; 18331 } 18332 18333 if ($('body[data-hhun="1"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length == 0) { 18334 18335 // Alter offset 18336 if ($('#header-outer.detached').length == 0 || $that.parents('.page-submenu[data-sticky="true"]').length > 0) { 18337 $scrollTopDistance = $scrollTopDistance + $headerNavSpace; 18338 } 18339 18340 // Hide top header 18341 if ($that.parents('.page-submenu[data-sticky="true"]').length > 0) { 18342 18343 $('#header-outer.detached').addClass('invisible'); 18344 $('.page-submenu') 18345 .addClass('header-not-visible') 18346 .css('transform', 'translateY(0px)'); 18347 18348 } 18349 } 18350 18351 var $pageSubMenu = ($that.parents('.page-submenu[data-sticky="true"]').length > 0) ? $that.parents('.page-submenu').height() : 0; 18352 var $headerSecondary; 18353 18354 if ($('body.material').length > 0 && 18355 $headerSecondaryEl.length > 0 && 18356 $('body[data-hhun="1"]').length == 0 && 18357 $('#header-outer[data-remove-fixed="1"]').length == 0 && 18358 !$body.hasClass('mobile')) { 18359 18360 $headerSecondary = $headerSecondaryEl.height(); 18361 18362 } else { 18363 18364 if($('body[data-hhun="1"]').length > 0 && 18365 $headerSecondaryEl.length > 0 && 18366 !$body.hasClass('mobile') && 18367 $('#header-outer[data-remove-fixed="1"]').length == 0) { 18368 $headerSecondary = $headerSecondaryEl.height(); 18369 } else { 18370 $headerSecondary = 0; 18371 } 18372 18373 } 18374 18375 18376 if( triggerAnimatedScroll ) { 18377 nectar_scrollToY($scrollTopDistance - $pageSubMenu + $headerSecondary, 700, 'easeInOutQuint'); 18378 } 18379 18380 18381 }, $timeoutVar); 18382 18383 e.preventDefault(); 18384 18385 } 18386 18387 if ($hash == '#top') { 18388 // Side widget area click 18389 if ($(this).parents('#slide-out-widget-area').length > 0) { 18390 $('#slide-out-widget-area .slide_out_area_close').trigger('click'); 18391 } 18392 } 18393 18394 }); 18395 18396 18397 } 18398 18399 } 18400 18401 18402 18403 18404 18405 18406 /** 18407 * Search results masonry layout. 18408 * 18409 * @since 10.0 18410 */ 18411 function searchResultMasonry() { 18412 18413 var $searchContainer = $('#search-results'), 18414 $dividerNum = ($searchContainer.is('[data-layout="masonry-no-sidebar"]')) ? 4 : 3; 18415 18416 $searchContainer.imagesLoaded(function () { 18417 18418 $searchContainer.isotope({ 18419 itemSelector: '.result', 18420 layoutMode: 'packery', 18421 packery: { 18422 gutter: 0 18423 } 18424 }); 18425 18426 $searchContainer 18427 .find('article') 18428 .css('opacity', '1'); 18429 18430 }); 18431 18432 $window.on('resize', function () { 18433 18434 $searchContainer.isotope({ 18435 layoutMode: 'packery', 18436 packery: { 18437 gutter: 0 18438 } 18439 }); 18440 }); 18441 18442 } 18443 18444 18445 /** 18446 * Search results masonry layout initialization. 18447 * 18448 * @since 10.5 18449 */ 18450 function searchResultMasonryInit() { 18451 if ($('body.search-results').length > 0 && 18452 $('#search-results article').length > 0 && 18453 $('#search-results[data-layout="list-no-sidebar"]').length == 0 && 18454 $('#search-results[data-layout="list-with-sidebar"]').length == 0) { 18455 searchResultMasonry(); 18456 } 18457 } 18458 18459 18460 18461 18462 /** 18463 * Custom colors for portfolio grid elements. 18464 * 18465 * @since 10.5 18466 */ 18467 function portfolioCustomColoring() { 18468 18469 //portfolio colors 18470 if ($('.portfolio-items .col .style-3-alt').length > 0 || 18471 $('.portfolio-items .col .style-3').length > 0 || 18472 $('.portfolio-items .col .style-2').length > 0 || 18473 $('.portfolio-items .col .style-5').length > 0) { 18474 18475 var portfolioColorCss = ''; 18476 18477 $('.portfolio-items .col').each(function () { 18478 18479 var $titleColor = $(this).attr('data-title-color'), 18480 $subTitleColor = $(this).attr('data-subtitle-color'); 18481 18482 if ($titleColor.length > 0) { 18483 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; } '; 18484 portfolioColorCss += ' .portfolio-items[data-ps="8"] .col[data-title-color="' + $titleColor + '"] .line { background-color: ' + $titleColor + '; }'; 18485 portfolioColorCss += '.portfolio-items[data-ps="8"] .col[data-title-color="' + $titleColor + '"] .next-arrow line { stroke: ' + $titleColor + '; } '; 18486 } 18487 if ($subTitleColor.length > 0) { 18488 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; } '; 18489 } 18490 18491 });
18492 18493 //style 18494 nectarCreateStyle(portfolioColorCss, 'nectar-portfolio-colors'); 18495 18496 } 18497 18498 } 18499 18500 18501 18502 18503 /** 18504 * Single post pagination/recent post mouse events 18505 * 18506 * @since 10.5 18507 */ 18508 function postMouseEvents() { 18509 18510 18511 $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 () { 18512 $(this).parents('.grav-wrap') 18513 .find('img') 18514 .addClass('hovered'); 18515 }); 18516 18517 $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 () { 18518 $(this).parents('.grav-wrap') 18519 .find('img') 18520 .removeClass('hovered'); 18521 }); 18522 18523 $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 () { 18524 $(this).addClass('mouse-leaving'); 18525 }); 18526 18527 } 18528 18529 18530 18531 18532 /** 18533 * Masonry portfolio initialization. 18534 * 18535 * @since 10.5 18536 */ 18537 function masonryPortfolioInit() { 18538 18539 $portfolio_containers = []; 18540 18541 var portfolioElCount = 0; 18542 18543 $('.portfolio-items:not(.carousel)').each(function(i) { 18544 18545 if( $(this).parents('.wpb_gallery').length > 0 && $(this).find('.nectar-lazy').length > 0 ) { 18546 18547 $(this).find('.col').each(function(i) { 18548 $(this).delay(90*i).queue(function(next){ 18549 $(this).addClass("animated-in"); 18550 next(); 18551 });
18552 }); 18553 18554 return true; 18555 } 18556 18557 $(this).attr('instance', i); 18558 $(this).parent().parent().find('div[class^=portfolio-filters]').attr('instance', i); 18559 18560 if (typeof SalientPortfolio !== 'undefined') { 18561 $portfolio_containers[portfolioElCount] = new SalientPortfolio($(this), fullWidthContentColumns); 18562 portfolioElCount++; 18563 } 18564 18565 }); 18566 18567 } 18568 18569 18570 18571 18572 /** 18573 * Perspective load in styling. 18574 * 18575 * @since 8.0 18576 */ 18577 function updatePerspectiveOrigin() { 18578 18579 if( nectarDOMInfo.winW > 690 ) { 18580 $('.posts-container[data-load-animation="perspective"]').css('perspective-origin', '50% ' + (nectarDOMInfo.scrollTop + nectarDOMInfo.winH) + 'px'); 18581 } 18582 requestAnimationFrame(updatePerspectiveOrigin); 18583 18584 } 18585 18586 18587 /** 18588 * Perspective load in styling. 18589 * 18590 * @since 8.0 18591 */ 18592 function updatePerspectiveOriginInit() { 18593 18594 if ($('.posts-container[data-load-animation="perspective"]').length > 0) { 18595 requestAnimationFrame(updatePerspectiveOrigin); 18596 } 18597 18598 } 18599 18600 18601 18602 /** 18603 * Blog load in animation. 18604 * 18605 * @since 3.0 18606 */ 18607 function blogLoadIn(post_container) { 18608 18609 if (post_container.attr('data-load-animation') == 'none') { 18610 18611 post_container 18612 .find('.inner-wrap') 18613 .removeClass('animated'); 18614 18615 } else { 18616 18617 post_container.find('article').each(function (i) { 18618 18619 // Loaded visible 18620 if ($(this).visible(true)) { 18621 18622 $(this).delay(110 * i).queue(function (next) { 18623 $(this).addClass("animated-in"); 18624 next(); 18625 });
18626 18627 18628 } else { 18629 18630 // Not already visible 18631 var $that = $(this); 18632 var waypoint = new Waypoint({ 18633 18634 element: $that, 18635 handler: function () { 18636 18637 setTimeout(function () { 18638 $that.addClass("animated-in"); 18639 }, 80 * $that.attr('data-delay-amount')); 18640 18641 waypoint.destroy(); 18642 }, 18643 offset: '90%' 18644 18645 }); 18646 } 18647 18648 }); 18649 18650 } 18651 18652 } 18653 18654 18655 /** 18656 * Masonry blog initialization. 18657 * 18658 * @since 10.5 18659 */ 18660 function masonryBlogInit() { 18661 18662 $nectarMasonryBlogs = []; 18663 18664 $('.posts-container').each(function (i) { 18665 18666 if ($(this).parent().hasClass('masonry') && !$(this).parent().hasClass('auto_meta_overlaid_spaced')) { 18667 18668 if (typeof NectarMasonryBlog == 'undefined') { 18669 return; 18670 } 18671 18672 $nectarMasonryBlogs[i] = new NectarMasonryBlog($(this), fullWidthSections, blogLoadIn); 18673 18674 } else { 18675 18676 blogLoadIn($(this)); 18677 18678 } 18679 18680 }); 18681 } 18682 18683 18684 18685 /** 18686 * Sticky Sidebar initialization. 18687 * 18688 * @since 10.5 18689 */ 18690 function stickySidebarInit() { 18691 18692 if (!$().theiaStickySidebar || nectarDOMInfo.usingMobileBrowser && nectarDOMInfo.winW < 1000 ) { 18693 return; 18694 } 18695 18696 var stickySelectors = '#sidebar[data-nectar-ss="true"], #sidebar[data-nectar-ss="1"], .nectar-scrolling-tabs .scrolling-tab-nav'; 18697 if( window.nectarOptions && window.nectarOptions.woo_sticky_sidebar && window.nectarOptions.woo_sticky_sidebar === '1' ) { 18698 stickySelectors += ', .woocommerce.archive #sidebar'; 18699 } 18700 18701 $(stickySelectors).each(function () { 18702 18703 // Padding from top of screen 18704 var $ssExtraTopSpace = 50; 18705 18706 if ($('#header-outer[data-remove-fixed="0"]').length > 0 && 18707 $('body[data-hhun="1"]').length == 0 && 18708 $('#header-outer[data-format="left-header"]').length == 0) { 18709 18710 $ssExtraTopSpace += $headerOuterEl.outerHeight(); 18711 18712 // Resize effect 18713 if ($('#header-outer[data-shrink-num][data-header-resize="1"]').length > 0) { 18714 var headerPadding2 = parseInt($headerOuterEl.attr('data-padding')) - parseInt($headerOuterEl.attr('data-padding')) / 1.8; 18715 $ssExtraTopSpace -= logoShrinkNum; 18716 $ssExtraTopSpace -= headerPadding2; 18717 } 18718 18719 // Condense 18720 if ($('body.mobile').length == 0 && $('#header-outer[data-condense="true"]').length > 0) { 18721 18722 var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'); 18723 $ssExtraTopSpace = 50; 18724 $ssExtraTopSpace += $headerOuterEl.height() - (parseInt($headerSpan9.position().top) - parseInt($('#header-outer #logo').css('margin-top'))) - parseInt(nectarDOMInfo.secondaryHeaderHeight); 18725 } 18726 18727 } 18728 18729 if ($wpAdminBar.length > 0) { 18730 $ssExtraTopSpace += $wpAdminBar.outerHeight(); 18731 } 18732 18733 18734 if ($(this).parents('.wpb_widgetised_column').length > 0) { 18735 18736 if ($('body.vc_editor').length > 0) { 18737 // Skip processing. 18738 } else { 18739 $(this).parents('.wpb_column').theiaStickySidebar({ 18740 additionalMarginTop: $ssExtraTopSpace, 18741 updateSidebarHeight: false 18742 });
18743 } 18744 18745 } else { 18746 $(this).theiaStickySidebar({ 18747 additionalMarginTop: $ssExtraTopSpace, 18748 updateSidebarHeight: false 18749 }); 18750 } 18751 18752 }); 18753 } 18754 18755 18756 18757 18758 18759 /** 18760 * Section down arrow animated link 18761 * 18762 * @since 10.5 18763 */ 18764 function sectionDownArrowEvent() { 18765 18766 var headerPadding2 = headerPadding - headerPadding / 1.8; 18767 18768 $body.on('click', '.section-down-arrow, .scroll-down-wrap > .minimal-arrow', function () { 18769 18770 if ($(this).parents('.nectar-box-roll').length > 0) { 18771 return false; 18772 } 18773 18774 var $currentSection = $(this).parents('#page-header-bg'), 18775 $topDistance = $currentSection.height(), 18776 $offset = ($currentSection.parents('.first-section').length == 0 || $('body[data-transparent-header="false"]').length > 0) ? $currentSection.offset().top : 0, 18777 $bodyBorderSize = ($bodyBorderTop.length > 0 && $window.width() > 1000) ? $bodyBorderTop.height() : 0, 18778 $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0) ? 0 : $('#header-space').height(), 18779 $materialSecondary = 0; 18780 18781 if ($('body.material').length > 0 && $headerSecondaryEl.length > 0) { 18782 $materialSecondary = $headerSecondaryEl.height(); 18783 } 18784 18785 if ($('body[data-permanent-transparent="1"]').length == 0) { 18786 18787 // Regular 18788 if (!$body.hasClass('mobile')) { 18789 18790 if ($('body[data-hhun="1"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length == 0) { 18791 18792 nectar_scrollToY(parseInt($topDistance) + $offset + 2 - $bodyBorderSize * 2, 700, 'easeInOutQuint'); 18793 18794 } else { 18795 18796 var $resize = ($('#header-outer[data-header-resize="0"]').length > 0) ? 0 : parseInt(logoShrinkNum) + headerPadding2 * 2; 18797 if ($('#header-outer[data-remove-fixed="1"]').length > 0) { 18798 $headerNavSpace = 0; 18799 $offset = 0; 18800 } 18801 18802 // Condense 18803 if ($('body.mobile').length == 0 && $('#header-outer[data-condense="true"]').length > 0) { 18804 var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'); 18805 $headerNavSpace = $headerOuterEl.height() - (parseInt($headerSpan9.position().top) - parseInt($('#header-outer #logo').css('margin-top'))) - parseInt(nectarDOMInfo.secondaryHeaderHeight); 18806 } 18807 18808 nectar_scrollToY(parseInt($topDistance - $headerNavSpace) + $resize + 3 + $offset + $materialSecondary, 700, 'easeInOutQuint'); 18809 18810 } 18811 18812 } else { 18813 18814 var $scrollPos; 18815 18816 if($('#header-outer[data-mobile-fixed="1"]').length > 0) { 18817 $scrollPos = parseInt($topDistance) - $headerNavSpace + parseInt($currentSection.offset().top) + 2; 18818 } else { 18819 $scrollPos = parseInt($topDistance) + parseInt($currentSection.offset().top) + 2; 18820 } 18821 18822 nectar_scrollToY($scrollPos - $bodyBorderSize * 2, 700, 'easeInOutQuint'); 18823 18824 } 18825 18826 } else { 18827 // Permanent transparent 18828 nectar_scrollToY(parseInt($topDistance) + parseInt($currentSection.offset().top) + 2 - $bodyBorderSize * 2, 700, 'easeInOutQuint'); 18829 18830 } 18831 return false; 18832 }); 18833 18834 } 18835 18836 18837 18838 18839 18840 /** 18841 * Displace filter column/row BG effect - fullpage 18842 * 18843 * @since 10.5 18844 */ 18845 function nectarLiquidBGFP() { 18846 18847 $('.nectar-liquid-bg').removeClass('animated-in'); 18848 18849 for (var k = 0; k < $liquidBG_EL.length; k++) { 18850 18851 if ($liquidBG_EL[k].animationType == 'displace-filter-fade' && $($liquidBG_EL[k].canvasContainer).parents('.fp-section.active').length > 0) { 18852 18853 //add bg to container 18854 if ($($liquidBG_EL[k].canvasContainer).find('.image-added-to-stage').length == 0) { 18855 $liquidBG_EL[k].imgContainer.addChild($liquidBG_EL[k].bg); 18856 } 18857 18858 $($liquidBG_EL[k].canvasContainer) 18859 .find('.nectar-liquid-bg') 18860 .addClass('image-added-to-stage'); 18861 18862 $liquidBG_EL[k].animateProps($liquidBG_EL[k]); 18863 18864 } 18865 } 18866 } 18867 18868 18869 /** 18870 * Page Full Screen Rows 18871 * 18872 * @since 10.5 18873 */ 18874 function nectarFullPageInit() { 18875 18876 if ($('#nectar_fullscreen_rows').length > 0 && $().fullpage) { 18877 18878 $fullscreenSelector = (window.vc_iframe) ? '.vc_element.vc_vc_row.active ' : '.wpb_row.active '; 18879 18880 var $disableFPonMobile = ($('#nectar_fullscreen_rows[data-mobile-disable]').length > 0) ? $('#nectar_fullscreen_rows').attr('data-mobile-disable') : 'off'; 18881 if( !nectarDOMInfo.usingMobileBrowser ) { 18882 $disableFPonMobile = 'off'; 18883 }
18884 // Support for mobile animation theme option. 18885 if( $disableFPonMobile != 'on' ) { 18886 $fullscreenMarkupBool = true; 18887 } else { 18888 $fullscreenSelector = ''; 18889 } 18890 18891 $nectarFullPage = new NectarFullScreenRows(waypoints, $mouseParallaxScenes, nectarLiquidBGFP, nectarDOMInfo, responsiveTooltips, $standAnimatedColTimeout, $svgIcons); 18892 18893 } 18894 18895 } 18896 18897 18898 18899 18900 /** 18901 * Cross browser adjustments. 18902 * 18903 * @since 1.0 18904 */ 18905 function crossBrowserAdjust() { 18906 18907 // Add specific class if on device for better tablet tracking. 18908 if (nectarDOMInfo.usingMobileBrowser) { 18909 $body.addClass('using-mobile-browser'); 18910 } 18911 18912 // Add class for old IE. 18913 var ua = window.navigator.userAgent; 18914 var msie = ua.indexOf("Edge/"); 18915 if (msie > 0) { 18916 $body.addClass('msie'); 18917 } 18918 18919 // For users updating to 8 with a custom, old header template file 18920 if ($('html.js').length == 0) { 18921 $('html').removeClass('no-js').addClass('js'); 18922 } 18923 18924 //remove br's from code tag 18925 $('code').find('br').remove(); 18926 18927 // Contact form 7. 18928 $('.wpcf7-form p:has(input[type=submit])').css('padding-bottom', '0px'); 18929 18930 $('.full-width-content .wpcf7-submit').on('click', function () { 18931 setTimeout(function () { 18932 fullWidthContentColumns(); 18933 }, 1000); 18934 setTimeout(function () { 18935 fullWidthContentColumns(); 18936 }, 2000); 18937 }); 18938 18939 // Gravity form inside fw content row 18940 $('.gform_body').on('click', function () { 18941 setTimeout(function () { 18942 fullWidthContentColumns(); 18943 }, 200); 18944 }); 18945 18946 // Popup Maker. 18947 $('.pum.pum-theme-salient-page-builder-optimized button.pum-close').wrapInner('<span />'); 18948 18949 // pum inside fspr 18950 if ($('#nectar_fullscreen_rows').length > 0 && 18951 $('.pum-container .pum-content > .wpb_row .full-page-inner > .container > .span_12').length > 0) { 18952 $('.pum-container .pum-content > .wpb_row .full-page-inner > .container > .span_12').unwrap(); 18953 } 18954 18955 // Blog bottom padding 18956 if ($('.single .blog_next_prev_buttons').length > 0) { 18957 $('.container-wrap').css('padding-bottom', 0); 18958 } 18959 18960 // Remove margin on last cols inside of full width sections 18961 $('.full-width-section').each(function () { 18962 $(this).find('> .span_12 > div.col_last').last().css('margin-bottom', '0'); 18963 }); 18964 18965 // Remove boxed style from full width content 18966 $('.full-width-content .col.boxed').removeClass('boxed'); 18967 18968 // Neg marg z-index adjust 18969 $('.wpb_column.neg-marg').parents('.wpb_row').css('z-index', '110'); 18970 18971 // Using full width section shortcode with WPBakery columns. 18972 $('.wpb_row.legacy').each(function(){ 18973 if( $(this).find('.wpb_column').length > 0 ) { 18974 $(this).removeClass('legacy'); 18975 } 18976 }); 18977 18978 } 18979 18980 18981 18982 18983 //vc col mobile fixes 18984 function vcMobileColumns() { 18985 18986 $('.wpb_row').each(function () { 18987 if (typeof $(this).find('.span_12').offset() != 'undefined') { 18988 18989 $(this).find('[class*="vc_col-"]').each(function () { 18990 18991 var $firstChildOffset = $(this).parents('.span_12').offset().left; 18992 18993 $(this).removeClass('no-left-margin'); 18994 18995 if ($(this).offset().left < $firstChildOffset + 27) { 18996 $(this).addClass('no-left-margin'); 18997 } else { 18998 $(this).removeClass('no-left-margin'); 18999 } 19000 });
19001 } 19002 }); 19003 } 19004 19005 function vcMobileColumnsInit() { 19006 19007 var $winDOMWidth = nectarDOMInfo.winW, 19008 $winDOMHeight = nectarDOMInfo.winH, 19009 $orientChangeTrack = 0; 19010 19011 // Only needed in legacy column setups. 19012 if( $body.is('[data-flex-cols="true"]') ) { 19013 return; 19014 } 19015 19016 if ($('[class*="vc_col-xs-"], [class*="vc_col-md-"], [class*="vc_col-lg-"]').length > 0) { 19017 19018 // Trigger immediately. 19019 vcMobileColumns(); 19020 19021 // Resize. 19022 if( !nectarDOMInfo.usingMobileBrowser ) { 19023 // Bind normally for desktop. 19024 $window.on('resize',vcMobileColumns); 19025 } 19026 else { 19027 19028 // For mobile make sure the orientation has changed. 19029 window.addEventListener("orientationchange", function () { 19030 $orientChangeTrack = 1; 19031 }); 19032 19033 $window.on('resize', function () { 19034 19035 if (($window.width() != $winDOMWidth && $window.height != $winDOMHeight) || $orientChangeTrack === 1) { 19036 19037 vcMobileColumns(); 19038 19039 // Store the current window dimensions. 19040 $winDOMWidth = nectarDOMInfo.winW; 19041 $winDOMHeight = nectarDOMInfo.winH; 19042 19043 // Reset orientation change tracker. 19044 $orientChangeTrack = 0; 19045 } 19046 19047 }); 19048 19049 19050 } // end mobile only. 19051 19052 } // endif vc offset cols found. 19053 19054 19055 } 19056 19057 19058 19059 19060 /** 19061 * Select2 plugin initialization. 19062 * 19063 * @since 5.0 19064 */ 19065 function select2Init() { 19066 19067 $('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 () { 19068 19069 // Prevent search from triggering on small devices. 19070 var $minimumToSearch = ( nectarDOMInfo.winW > 690 ) ? 7 : 200; 19071 19072 // Skip search class 19073 if( $(this).hasClass('skip-select2-search') || $(this).parents('.skip-select2-search').length > 0 ) { 19074 $minimumToSearch = 1000; 19075 } 19076 19077 if ($(this).parents('#buddypress').length == 0) { 19078 19079 var woo_product_dropdown_style = (window.nectarOptions && window.nectarOptions.woo_product_variable_select ) ? window.nectarOptions.woo_product_variable_select : 'default'; 19080 19081 // Default. 19082 var select2OptionsObj = { 19083 minimumResultsForSearch: $minimumToSearch, 19084 width: '100%' 19085 }; 19086 19087 // Inline scenario els 19088 if( woo_product_dropdown_style == 'underline' || 19089 $(this).parents('.woocommerce-ordering').length > 0 ) { 19090 19091 select2OptionsObj = { 19092 minimumResultsForSearch: $minimumToSearch, 19093 dropdownParent: $(this).parent(), 19094 dropdownAutoWidth: true 19095 }; 19096 19097 } 19098 19099 $(this).select2(select2OptionsObj); 19100 19101 } 19102 19103 }); 19104 } 19105 19106 19107 /** 19108 * Fancy select styling theme option. 19109 * 19110 * @since 10.5 19111 */ 19112 function fancySelectStyling() { 19113 19114 if ( $('body[data-fancy-form-rcs="1"]').length > 0 ) { 19115 19116 $('select:not(.comment-form-rating #rating)').each(function () { 19117 19118 var $selector; 19119 19120 //cf7 19121 if ($(this).parents('.wpcf7-form-control-wrap').length > 0) { 19122 19123 //select 2 already initialized 19124 if ($(this).parents('.wpcf7-form-control-wrap').find('.select2-container').length > 0) { 19125 $selector = $($(this).prev('.select2-container')); 19126 } else { 19127 $selector = $(this); 19128 } 19129 19130 //if label is found 19131 if ($selector.parents('.wpcf7-form-control-wrap').parent().find('label').length == 1) { 19132 $selector.parents('.wpcf7-form-control-wrap').parent().wrapInner('<div class="fancy-select-wrap" />'); 19133 } else { 19134 //default wrap 19135 $selector.wrap('<div class="fancy-select-wrap" />'); 19136 } 19137 } 19138 //default 19139 else { 19140 19141 //select 2 already initialized 19142 if ($(this).prev('.select2-container').length > 0) { 19143 $selector = $(this).prev('.select2-container'); 19144 } else { 19145 $selector = $(this); 19146 } 19147 19148 if ($(this).parents('#buddypress').length == 0 && $(this).parents('.widget_categories').length == 0) { 19149 //if label is found 19150 if ($selector.prev('label').length == 1) { 19151 $selector.prev('label').andSelf().wrapAll('<div class="fancy-select-wrap" />'); 19152 } else if ($selector.next('label').length == 1) { 19153 $selector.next('label').andSelf().wrapAll('<div class="fancy-select-wrap" />'); 19154 } else { 19155 //default wrap 19156 $selector.wrap('<div class="fancy-select-wrap" />'); 19157 } 19158 } 19159 19160 } 19161 });
19162 19163 select2Init(); 19164 19165 } 19166 19167 } 19168 19169 19170 19171 19172 19173 /** 19174 * Back/Forward Safari cache assist. 19175 * 19176 * @since 10.5 19177 */ 19178 function bfCacheAssist() { 19179 19180 //Back/forward cache OCM close 19181 if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1 || 19182 navigator.userAgent.match(/(iPod|iPhone|iPad)/)) { 19183 19184 window.onpageshow = function (event) { 19185 19186 if (event.persisted) { 19187 19188 // Play video BGs 19189 $('.nectar-video-wrap, .nectar-slider-wrap .swiper-slide .video-wrap').each(function () { 19190 19191 if ($(this).find('video').length > 0) { 19192 $(this).find('video')[0].play(); 19193 } 19194 19195 }); 19196 19197 19198 // Close mobile nav 19199 19200 //// Material Skin. 19201 if ($('body.material-ocm-open').length > 0) { 19202 $('body > .slide_out_area_close').addClass('non-human-allowed').trigger('click'); 19203 19204 setTimeout(function () { 19205 $('body > .slide_out_area_close').removeClass('non-human-allowed'); 19206 }, 100); 19207 19208 } else if ($('#slide-out-widget-area.slide-out-from-right-hover.open').length > 0 && navigator.userAgent.match(/(iPod|iPhone|iPad)/)) { 19209 OCM_mobileSlideOutRightHoverCloseCheck(); 19210 } 19211 // Others 19212 else if ($('#slide-out-widget-area.fullscreen.open').length > 0 || 19213 $('#slide-out-widget-area.fullscreen-alt.open').length > 0 || 19214 $('#slide-out-widget-area.slide-out-from-right.open').length > 0) { 19215 19216 $('#slide-out-widget-area .slide_out_area_close').addClass('non-human-allowed'); 19217 $('.slide-out-widget-area-toggle:not(.std-menu) a.open') 19218 .addClass('non-human-allowed') 19219 .trigger('click'); 19220 19221 setTimeout(function () { 19222 $('#slide-out-widget-area .slide_out_area_close').removeClass('non-human-allowed'); 19223 }, 100); 19224 19225 } 19226 19227 } // Loaded from bf cache 19228 19229 }; // onpage show 19230 19231 } 19232 19233 } 19234 19235 19236 19237 19238 19239 19240 /*-------------------------------------------------------------------------*/ 19241 /* WPBakery Frontend Editor 19242 /*-------------------------------------------------------------------------*/ 19243 19244 /** 19245 * Control adjustments 19246 * 19247 * @since 10.0 19248 */ 19249 function addRowCtrls() { 19250 19251 //remove padding for rows with only fullwidth ns 19252 $('.wpb_row').removeClass('only-ns'); 19253 19254 $('.nectar-slider-wrap[data-full-width="true"], .page-submenu, .portfolio-items[data-col-num="elastic"]:not(.fullwidth-constrained), .blog-fullwidth-wrap') 19255 .parents('.wpb_row') 19256 .addClass('only-ns'); 19257 19258 //padding when column contains item that could get lost under column controls 19259 $('body.vc_editor.compose-mode .wpb_row .vc_vc_column > .wpb_column > .vc_column-inner').each(function() { 19260 19261 if ($(this).find('> .vc_element-container > div').length > 0) { 19262 19263 if ($(this).find('> .vc_element-container > div:first-child').is('.vc_vc_row_inner')) { 19264 $(this).find('> .vc_element-container > div:first-child').addClass('first-inner-row-el'); 19265 } else { 19266 $(this).find('> .vc_element-container > div:first-child').removeClass('first-inner-row-el'); 19267 } 19268 19269 } 19270 19271 }); 19272 19273 } //addRowCtrl end 19274 19275 19276 /** 19277 * Convert front end padding 19278 * 19279 * Needed when the flexbox grid is not active due to 19280 * different markup in front end page builder view. 19281 * 19282 * @since 10.0 19283 */ 19284 function convertFrontEndPadding() { 19285 19286 $('.vc_element > .wpb_column[class*="padding-"][class*="-percent"]').each(function() { 19287 19288 var $elPaddingPercent = 4; 19289 19290 var elclassName = this.className.match(/padding-\d+/); 19291 if (elclassName) { 19292 $elPaddingPercent = elclassName[0].match(/\d+/); 19293 if ($elPaddingPercent) { 19294 $elPaddingPercent = $elPaddingPercent[0] / 100; 19295 } else { 19296 $elPaddingPercent = 0; 19297 } 19298 } 19299 19300 if ($elPaddingPercent) { 19301 var $parentRowWidth = $(this).parents('.span_12').width(); 19302 19303 if ($(this).is('[data-padding-pos="all"]')) { 19304 $(this).css('padding', $parentRowWidth * $elPaddingPercent); 19305 } else if ($(this).is('[data-padding-pos="top"]')) { 19306 $(this).css('padding-top', $parentRowWidth * $elPaddingPercent); 19307 } else if ($(this).is('[data-padding-pos="bottom"]')) { 19308 $(this).css('padding-bottom', $parentRowWidth * $elPaddingPercent); 19309 } else if ($(this).is('[data-padding-pos="left"]')) { 19310 $(this).css('padding-left', $parentRowWidth * $elPaddingPercent); 19311 } else if ($(this).is('[data-padding-pos="right"]')) { 19312 $(this).css('padding-right', $parentRowWidth * $elPaddingPercent); 19313 } else if ($(this).is('[data-padding-pos="top-bottom"]')) { 19314 $(this).css({ 19315 'padding-top': $parentRowWidth * $elPaddingPercent, 19316 'padding-bottom': $parentRowWidth * $elPaddingPercent, 19317 });
19318 } else if ($(this).is('[data-padding-pos="top-right"]')) { 19319 $(this).css({ 19320 'padding-top': $parentRowWidth * $elPaddingPercent, 19321 'padding-right': $parentRowWidth * $elPaddingPercent, 19322 }); 19323 } else if ($(this).is('[data-padding-pos="bottom-right"]')) { 19324 $(this).css({ 19325 'padding-right': $parentRowWidth * $elPaddingPercent, 19326 'padding-bottom': $parentRowWidth * $elPaddingPercent, 19327 }); 19328 } else if ($(this).is('[data-padding-pos="bottom-left"]')) { 19329 $(this).css({ 19330 'padding-left': $parentRowWidth * $elPaddingPercent, 19331 'padding-bottom': $parentRowWidth * $elPaddingPercent, 19332 }); 19333 } else if ($(this).is('[data-padding-pos="left-right"]')) { 19334 $(this).css({ 19335 'padding-left': $parentRowWidth * $elPaddingPercent, 19336 'padding-right': $parentRowWidth * $elPaddingPercent, 19337 }); 19338 } 19339 } 19340 19341 }); 19342 19343 $('.wpb_row[class*="vc_custom_"]').each(function() { 19344 19345 $(this).parent().addClass('no-bottom-margin'); 19346 19347 }); 19348 19349 } 19350 19351 19352 /** 19353 * WPBakery Front end editor integration 19354 * 19355 * @since 10.0 19356 */ 19357 function wpBakeryFrontendInit() { 19358 19359 // Set up controls/column padding. 19360 setTimeout(function() { 19361 19362 if ($('body.compose-mode').length > 0) { 19363 $('.container-wrap').addClass('visible-editor-controls'); 19364 } 19365 19366 if (nectarDOMInfo.usingFrontEndEditor) { 19367 addRowCtrls(); 19368 19369 if( !$body.is('[data-flex-cols="true"]') ) { 19370 convertFrontEndPadding(); 19371 $window.on('smartresize',convertFrontEndPadding); 19372 } 19373 19374 } 19375 19376 }, 200); 19377 19378 // Bind reload event 19379 $window.on('vc_reload', function() { 19380 19381 addRowCtrls(); 19382 columnBGColors(); 19383 coloredButtons(); 19384 twentytwentyInit(); 19385 parallaxRowsBGCals(); 19386 flexsliderInit(); 19387 accordionInit(); 19388 ulCheckmarks(); 19389 nectarFancyUlIcons(); 19390 nectarFancyBoxHover(); 19391 oneFourthClasses(); 19392 carouselfGrabbingClass(); 19393 nectarPostGridInit(); 19394 splitLineHeadingInit(); 19395 nectarVideoLightbox(); 19396 nectarKeyframeAssist(); 19397 nectarLazyImageLoading(); 19398 19399 if ($('.carousel').length > 0) { 19400 standardCarouselInit(); 19401 clientsCarouselInit(); 19402 carouselHeightCalcs(); 19403 } 19404 19405 if ($('.owl-carousel').length > 0) { 19406 $('.owl-carousel').each(function() { 19407 $(this).trigger('destroy.owl.carousel').removeClass('owl-loaded'); 19408 $(this).find('.owl-stage-outer .owl-stage > *').unwrap(); 19409 $(this).find('.owl-stage-outer > *').unwrap(); 19410 $(this).find('.owl-item > *').unwrap(); 19411 $(this).find('.owl-dots').remove(); 19412 $(this).find('.owl-nav').remove(); 19413 }); 19414 owlCarouselInit(); 19415 } 19416 19417 if ($('.nectar_cascading_images').length > 0) { 19418 imagesLoaded($('.nectar_cascading_images'), function() { 19419 cascadingImageBGSizing(); 19420 }); 19421 } 19422 19423 fullWidthSections(); 19424 fwsClasses(); 19425 recentPostsInit(); 19426 fullWidthRowPaddingAdjust(); 19427 19428 /*flickity carousels*/ 19429 if ($flickitySliders.length > 0) { 19430 for (var i = 0; i < $flickitySliders.length; i++) { 19431 19432 $flickitySliders[i].reloadCells(); 19433 $flickitySliders[i].off('scroll.flickity'); 19434 $flickitySliders[i].off('dragStart.flickity'); 19435 $flickitySliders[i].off('dragEnd.flickity'); 19436 19437 } 19438 } 19439 19440 flickityLazyInit(); 19441 19442 setTimeout(function() { 19443 19444 flickityInit(); 19445 if ($flickitySliders.length > 0) { 19446 for (var i = 0; i < $flickitySliders.length; i++) { 19447 $flickitySliders[i].reloadCells(); 19448 $flickitySliders[i].resize(); 19449 } 19450 } 19451 19452 }, 100); 19453 19454 /*flickity product carousels*/ 19455 if ($wooFlickityCarousels.length > 0) { 19456 for (var i = 0; i < $wooFlickityCarousels.length; i++) { 19457 19458 $wooFlickityCarousels[i].flickity('reloadCells'); 19459 $wooFlickityCarousels[i].off('scroll.flickity'); 19460 $wooFlickityCarousels[i].off('dragStart.flickity'); 19461 $wooFlickityCarousels[i].off('dragEnd.flickity'); 19462 19463 } 19464 } 19465 19466 setTimeout(function() { 19467 19468 if ($('.nectar-woo-flickity').length > 0) { 19469 productCarouselInit(); 19470 } 19471 if ($wooFlickityCarousels.length > 0) { 19472 for (var i = 0; i < $wooFlickityCarousels.length; i++) { 19473 $wooFlickityCarousels[i].flickity('reloadCells'); 19474 $wooFlickityCarousels[i].flickity('resize'); 19475 } 19476 } 19477 19478 }, 100); 19479 19480 nectarTestimonialSliders(); 19481 19482 for (var i = 0; i < $testimonialSliders.length; i++) { 19483 19484 if ($testimonialSliders[i].type == 'multiple_visible' || 19485 $testimonialSliders[i].type == 'multiple_visible_minimal') { 19486 19487 $testimonialSliders[i].flickityEl.flickity('reloadCells'); 19488 $testimonialSliders[i].flickityEl.off('select.flickity'); 19489 nectarTestimonialSliders(); 19490 $testimonialSliders[i].flickityEl.resize(); 19491 } 19492 19493 $testimonialSliders[i].testimonialSliderHeight(); 19494 } 19495 nectarTestimonialSlidersEvents(); 19496 19497 pricingTableHeight(); 19498 nectarIconMatchColoring(); 19499 lightBoxInit(); 19500 imageWithHotspotEvents(); 19501 largeIconHover(); 19502 nectarBoxRollInit(); 19503 midnightInit(); 19504 responsiveVideoIframesInit(); 19505 responsiveVideoIframes(); 19506 fullWidthContentColumns(); 19507 setTimeout(fullWidthContentColumns, 1000); 19508 videoBGInit(); 19509 vcFullHeightRowInit(); 19510 $window.off('scroll.parallaxSections').off('resize.parallaxSections'); 19511 parallaxScrollInit(); 19512 masonryBlogInit(); 19513 masonryPortfolioInit(); 19514 19515 if ($portfolio_containers.length > 0) { 19516 for (var i = 0; i < $portfolio_containers.length; i++) { 19517 $portfolio_containers[i].portfolioAccentColor(); 19518 } 19519 } 19520 19521 parallaxItemHoverEffect(); 19522 fsProjectSliderInit(); 19523 19524 setTimeout(function() { 19525 if ($('.nectar_fullscreen_zoom_recent_projects').length > 0) { 19526 19527 if ($fsProjectSliderArr.length > 0) { 19528 for (var i = 0; i < $fsProjectSliderArr.length; i++) { 19529 $fsProjectSliderArr[i].sliderCalcs(); 19530 } 19531 } 19532 19533 } 19534 }, 300); 19535 19536 $window.unbind('.infscr'); 19537 infiniteScrollInit();
19538 mouseParallaxInit(); 19539 19540 //play video BGs 19541 $('.nectar-video-wrap').each(function() { 19542 if ($(this).find('video').length > 0) { 19543 $(this).find('video').css('visibility', 'visible'); 19544 } 19545 }); 19546 19547 //tablet inherits small desktop 19548 $('.wpb_column[data-t-w-inherits]').each(function() { 19549 if ($(this).is('[data-t-w-inherits="small_desktop"]')) { 19550 $(this).parent().addClass('inherits-s-desktop-col'); 19551 } else { 19552 $(this).parent().removeClass('inherits-s-desktop-col'); 19553 } 19554 }); 19555 19556 //full screen page rows 19557 if ($('#nectar_fullscreen_rows').length > 0) { 19558 19559 if ($('#nectar_fullscreen_rows > .vc_element').length == 0) { 19560 $('#nectar_fullscreen_rows').prepend('<div class="vc_element empty_placeholder" />'); 19561 } 19562 19563 19564 if ($('#nectar_fullscreen_rows > .vc_element:not(.empty_placeholder)').length > 0) { 19565 $('#nectar_fullscreen_rows >.vc_element.empty_placeholder').remove(); 19566 } 19567 19568 19569 $.fn.fullpage.destroy('all'); 19570 nectarFullPageInit(); 19571 19572 //keep tooltip active status 19573 var nectarFPOffsets = [{ 19574 el: '', 19575 offset: 0 19576 }]; 19577 19578 ////create list of offsets 19579 $('#nectar_fullscreen_rows > div.vc_element').each(function(i) { 19580 nectarFPOffsets[i] = { 19581 el: $(this), 19582 offset: $(this).offset().top 19583 }; 19584 }); 19585 19586 19587 ////start active on that index 19588 19589 //move back to first section when all have been deleted but one 19590 if ($('#nectar_fullscreen_rows > div.vc_element').length === 1) { 19591 $('#nectar_fullscreen_rows').css({ 19592 'transform': 'translate3d(0,0,0)' 19593 });
19594 } 19595 19596 $body.scrollTo(0, 0); 19597 19598 19599 } else { 19600 19601 //remove container wrap padding/margin when needded 19602 if ($('body .main-content > .row > .vc_element:first > .wpb_row[class*="full-width-"]').length > 0 || 19603 $('body .main-content > .row > .vc_element:first .nectar-slider-wrap[data-full-width="true"]').length > 0) { 19604 $('.container-wrap').css({ 19605 'padding-top': '0', 19606 'margin-top': '0' 19607 }); 19608 } else { 19609 $('.container-wrap').css({ 19610 'padding-top': '40px' 19611 }); 19612 } 19613 19614 } 19615 19616 //reset svg icon arr 19617 $svgIcons = []; 19618 $('.svg-icon-holder') 19619 .removeClass('animated-in') 19620 .removeClass('bound'); 19621 19622 19623 //gmap 19624 if ($('.vc_nectar_gmap').length > 0) { 19625 19626 setTimeout(function() { 19627 19628 if (typeof google === 'object' && typeof google.maps === 'object') { 19629 window.mapAPI_Loaded(); 19630 } else { 19631 19632 if (window.nectarLove.mapApiKey.length > 0) { 19633 $.getScript('https://maps.google.com/maps/api/js?sensor=false&key=' + window.nectarLove.mapApiKey + '&callback=mapAPI_Loaded'); 19634 } 19635 } 19636 19637 }, 100); 19638 } 19639 19640 19641 stickySidebarInit(); 19642 19643 19644 if (typeof window.Waypoint != 'undefined') { 19645 Waypoint.destroyAll(); 19646 waypoints(); 19647 } 19648 19649 }); 19650 19651 } 19652 19653 19654 19655 19656 19657 19658 19659 19660 /** 19661 * Page transitions and waypoint triggering 19662 * 19663 * @since 10.5 19664 */ 19665 function pageTransitionInit() { 19666 19667 var mobileDisabledCondition = false; 19668 19669 if( $('body[data-ajax-transitions="true"]').length > 0 && 19670 $('#ajax-loading-screen[data-disable-mobile="1"]').length > 0 && 19671 nectarDOMInfo.winW < 1000 ) { 19672 19673 mobileDisabledCondition = true; 19674 19675 } 19676 19677 if ($('body[data-ajax-transitions="true"]').length > 0 && $('#ajax-loading-screen[data-method="standard"]').length > 0 && mobileDisabledCondition == false) { 19678 19679 $('html').addClass('page-trans-loaded'); 19680 19681 // Fade loading animation 19682 if ($('#ajax-loading-screen[data-effect="standard"]').length > 0) { 19683 19684 if ($('.nectar-particles').length == 0) { 19685 19686 $loadingScreenEl.transition({ 19687 'opacity': 0 19688 }, 500, function () { 19689 $(this).css({ 19690 'display': 'none' 19691 }); 19692 });
19693 $('#ajax-loading-screen .loading-icon').transition({ 19694 'opacity': 0 19695 }, 500); 19696 19697 } 19698 19699 // Bind waypoints after loading screen has left 19700 if ($('.nectar-box-roll').length == 0) { 19701 setTimeout(function () { 19702 waypoints(); 19703 }, 550); 19704 } 19705 19706 } 19707 19708 // Swipe loading animation 19709 else { 19710 19711 if ($('#ajax-loading-screen[data-effect*="horizontal_swipe"]').length > 0) { 19712 setTimeout(function () { 19713 $loadingScreenEl.addClass('loaded'); 19714 }, 60); 19715 } 19716 19717 if ($('#page-header-wrap #page-header-bg[data-animate-in-effect="zoom-out"] .nectar-video-wrap').length == 0) { 19718 setTimeout(function () { 19719 $('#ajax-loading-screen:not(.loaded)').addClass('loaded'); 19720 setTimeout(function () { 19721 $loadingScreenEl.addClass('hidden'); 19722 }, 1000); 19723 }, 150); 19724 } 19725 19726 19727 // Bind waypoints after loading screen has left 19728 if ($('.nectar-box-roll').length == 0 && $('#ajax-loading-screen[data-effect*="horizontal_swipe"]').length > 0) { 19729 setTimeout(function () { 19730 waypoints(); 19731 }, 750); 19732 } else if ($('.nectar-box-roll').length == 0) setTimeout(function () { 19733 waypoints(); 19734 }, 350); 19735 19736 } 19737 19738 19739 // Safari back/prev fix 19740 if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1 || 19741 navigator.userAgent.match(/(iPod|iPhone|iPad)/)) { 19742 19743 window.onunload = function () { 19744 19745 $('#ajax-loading-screen').stop().transition({ 19746 'opacity': 0 19747 }, 800, function () { 19748 $(this).css({ 19749 'display': 'none' 19750 }); 19751 });
19752 $('#ajax-loading-screen .loading-icon').transition({ 19753 'opacity': 0 19754 }, 600); 19755 }; 19756 window.onpageshow = function (event) { 19757 19758 if (event.persisted) { 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 } 19772 19773 }; 19774 19775 } 19776 19777 else if (navigator.userAgent.indexOf('Firefox') != -1) { 19778 window.onunload = function () {}; 19779 } 19780 19781 19782 // Remove excess loading images if using page transitions. 19783 $('.portfolio-loading, .nectar-slider-loading .loading-icon').remove(); 19784 19785 19786 if ($('#ajax-loading-screen[data-disable-fade-on-click="1"]').length == 0) { 19787 19788 if ($('body.using-mobile-browser #ajax-loading-screen[data-method="standard"][data-disable-mobile="1"]').length == 0) { 19789 19790 var ignore_onbeforeunload = false; 19791 $('a[href^="mailto"], a[href^="tel"], .woocommerce-order-downloads a[class*="downloads-file"], .wpdm-cta.download-l
19791ink a[data-downloadurl], .nectar-ignore-beforeunload a').on('click', function () { 19792 ignore_onbeforeunload = true; 19793 }); 19794 window.addEventListener('beforeunload', function () { 19795 19796 if (!ignore_onbeforeunload) { 19797 $loadingScreenEl.addClass('set-to-fade'); 19798 transitionPage(); 19799 } 19800 ignore_onbeforeunload = false; 19801 }); 19802 } 19803 19804 } 19805 19806 } 19807 19808 // No page transitions 19809 else { 19810 19811 // Mobile disabled. 19812 if( mobileDisabledCondition == true ) { 19813 $loadingScreenEl.css({ 19814 'opacity': '0', 19815 'display': 'none' 19816 }).addClass('loaded').addClass('hidden'); 19817 } 19818 19819 if ($('.nectar-box-roll').length == 0 && !nectarDOMInfo.usingFrontEndEditor) { 19820 19821 // Waypoints. 19822 setTimeout(function () { 19823 waypoints(); 19824 }, 80); 19825 19826 } 19827 19828 } 19829 19830 19831 function transitionPage() { 19832 19833 if ($('#ajax-loading-screen[data-effect*="horizontal_swipe"]').length > 0) { 19834 $loadingScreenEl.removeClass('loaded'); 19835 $loadingScreenEl.addClass('in-from-right'); 19836 19837 setTimeout(function () { 19838 $loadingScreenEl.addClass('loaded'); 19839 }, 30); 19840 19841 } 19842 else { 19843 if ($('#ajax-loading-screen[data-effect="center_mask_reveal"]').length > 0) { 19844 $loadingScreenEl.css('opacity', '0').css('display', 'block').transition({ 19845 'opacity': '1' 19846 }, 450); 19847 } else { 19848 $loadingScreenEl.show().transition({ 19849 'opacity': '1' 19850 }, 450); 19851 } 19852 } 19853 19854 } 19855 19856 } 19857 19858 19859 19860 // Document ready event - starting everything up. 19861 jQuery(document).ready(function ($) { 19862 19863 // Initialize Nectar DOM helper. 19864 nectarDOMInfo.init(); 19865 19866 // Priority calls 19867 nectarBoxRollInit(); 19868 nectarFullPageInit(); 19869 nectarLazyImageLoading(); 19870 19871 // Header navigation. 19872 initSF(); 19873 navigationSearchInit(); 19874 centeredNavBottomBarInit(); 19875 centeredLogoHeaderInit(); 19876 headerNavPreInit(); 19877 headerNavScrollInit(); 19878 headerNavOffsetInit(); 19879 19880 // Page builder elements. 19881 salientPageBuilderElInit(); 19882 19883 // Column related. 19884 columnBGColors(); 19885 vcMobileColumnsInit(); 19886 19887 // Row related. 19888 fullWidthSections(); 19889 fwsClasses(); 19890 fwCarouselLinkFix(); 19891 fullWidthSectionsPreInit(); 19892 firstFWSection(); 19893 parallaxScrollInit(); 19894 parallaxRowsBGCals(); 19895 fullWidthRowPaddingAdjust(); 19896 fullWidthContentColumns(); 19897 oneFourthClasses(); 19898 fixIeFlexbox(); 19899 vcFullHeightRowInit(); 19900 19901 // Media. 19902 lightBoxInit(); 19903 audioVideoVis(); 19904 responsiveVideoIframesInit(); 19905 responsiveVideoIframes(); 19906 videoBGInit(); 19907 blogSingle(); 19908 19909 19910 // Off canvas navigation. 19911 mobileNavMegamenuCorrect(); 19912 materialSkinOCM_Init(); 19913 OCM_dropdownMarkup(); 19914 OCM_dropdownIconPos(); 19915 clickToggleSubmenus(); 19916 OCM_init(); 19917 19918 19919 // Page header 19920 pageHeaderInit(); 19921 19922 // Footer. 19923 footerRevealInit(); 19924 19925 // Third party. 19926 wooCommerceEvents(); 19927 fancySelectStyling(); 19928 19929 // Scrolling 19930 infiniteScrollInit(); 19931 scrollToTopInit(); 19932 animatedAnchorLinks(); 19933 updatePerspectiveOriginInit(); 19934 sectionDownArrowEvent(); 19935 19936 // Cross browser assist. 19937 crossBrowserAdjust(); 19938 bfCacheAssist(); 19939 19940 // Front end editing. 19941 wpBakeryFrontendInit(); 19942 19943 // Page transitions and waypoint activation. 19944 pageTransitionInit(); 19945 19946 19947 19948 // Main Debounced Resize Event. 19949 $window.off('smartresize.srInit'); 19950 $window.on('smartresize.srInit', smartResizeInit); 19951 19952 // Main Resize Event. 19953 $window.off('resize.srInit'); 19954 $window.on('resize.srInit', resizeInit); 19955 19956 // Orientation change. 19957 window.addEventListener("orientationchange", orientationChangeInit); 19958 19959 // Window Load Event. 19960 $window.on('load', function () { 19961 19962 // Set header space. 19963 if ( $(window).scrollTop() == 0 ) { 19964 headerSpace(); 19965 } 19966 19967 $('video').css('visibility', 'visible'); 19968 19969 // Scroll to anchor 19970 pageLoadHashInit(); 19971 19972 // Row/Column related. 19973 fullWidthContentColumns();
19974 parallaxRowsBGCals(); 19975 19976 // Video BG 19977 resizeVideoToCover(); 19978 19979 }); 19980 19981 19982 }); 19983 19984 19985 19986}(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.