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( $that.find('[data-nectar-img-src]').length > 0 ) { 843 844 var waypoint = new Waypoint({ 845 element: $that, 846 handler: function () { 847 848 $that.find('[data-nectar-img-src]').each(function() { 849 850 var entry = $(this)[0]; 851 var imgSrc = entry.getAttribute('data-nectar-img-src'); 852 entry.style.backgroundImage = "url('" + imgSrc + "')"; 853 entry.classList.add('loaded'); 854 }); 855 856 waypoint.destroy(); 857 }, 858 offset: '95%' 859 860 }); 861 862 } 863 864 // Simple Slider Parallax 865 if( $(this).hasClass('nectar-simple-slider') && $(this).is('[data-parallax="true"]') ) { 866 867 var slides = $(this).find('.cell'); 868 var j = i; 869 870 // limit time between slide changes when wrapping. 871 if( $wrapAround === true ) { 872 $that.find('.flickity-prev-next-button').on('click', function () { 873 $that.addClass('disabled-nav'); 874 setTimeout(function(){ 875 $that.removeClass('disabled-nav'); 876 },500); 877 }); 878 } 879 880 881 // parallax effect. 882 $flickitySliders[i].on('scroll', function () { 883 884 $.each( $flickitySliders[i].slides, function(i,slide) { 885 886 var imageBG = slides[i].querySelector('.bg-layer'); 887 var content = slides[i].querySelector('.inner'); 888 889 var flkty = $flickitySliders[j]; 890 var x = 0; 891 892 if( 0 === i ) { 893 x = Math.abs( flkty.x ) > flkty.slidesWidth ? ( flkty.slidesWidth + flkty.x + flkty.slides[flkty.slides.length - 1 ].outerWidth + slide.target ) : ( slide.target + flkty.x ); 894 } else if( i === flkty.slides.length - 1 ) { 895 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 ); 896 } else { 897 x = slide.target + flkty.x; 898 } 899 900 imageBG.style.transform = 'translate3d(' + x * ( -1 / 2 ) + 'px,0,0)'; 901 content.style.transform = 'translate3d(' + x * ( -1 / 4 ) + 'px,0,0)'; 902 903 }); 904 }); 905 } 906 907 // Simple Slider Pagination 908 if( $(this).hasClass('nectar-simple-slider') && true == $paginationBool ) { 909 910 $(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>'); 911 912 if( $flickity_stored_autoplay ) { 913 $(this).find('.flickity-page-dots li circle.time').css('transition', 'stroke-dashoffset '+ (parseInt($flickity_stored_autoplay) + 100) +'ms linear, stroke 0.2s ease'); 914 915 $(this).find('.flickity-page-dots li:first').addClass('no-trans'); 916 setTimeout(function() { 917 $that.find('.flickity-page-dots li:first').removeClass('no-trans'); 918 },60); 919 920 $flickitySliders[i].on('select', function (event) { 921 $flickitySliders[i].playPlayer(); 922 }); 923 924 $flickitySliders[i].on('dragEnd', function (event) { 925 $flickitySliders[i].playPlayer(); 926 $that.find('.flickity-page-dots .is-selected').removeClass('no-trans'); 927 }); 928 929 $flickitySliders[i].on('dragStart', function (event) { 930 $that.find('.flickity-page-dots .is-selected').addClass('no-trans'); 931 });
932 933 } 934 935 } 936 937 // Visualized total controls 938 if( $(this).is('[data-controls="touch_total"]') ) { 939 940 // Create markup. 941 if( $(this).find('.visualized-total').length == 0 ) { 942 if( $(this).parents('.full-width-content').length > 0 && $(this).parents('.vc_col-sm-12').length > 0 ) { 943 $(this).append('<div class="container normal-container"><div class="visualized-total"><span></span></div></div>'); 944 } else { 945 $(this).append('<div class="visualized-total"><span></span></div>'); 946 } 947 } 948 949 950 // Init drag indicator. 951 if( !nectarDOMInfo.usingMobileBrowser ) { 952 953 flickityDragArr[i] = new NectarIconMouseFollow($(this),'horizontal-movement'); 954 955 $flickitySliders[i].on('dragMove', function (event, pointer) { 956 nectarDOMInfo.clientY = pointer.clientY; 957 nectarDOMInfo.clientX = pointer.clientX; 958 }); 959 960 $flickitySliders[i].on('pointerDown', function (event, pointer) { 961 $('.nectar-drag-indicator').addClass('pointer-down'); 962 }); 963 $flickitySliders[i].on('pointerUp', function (event, pointer) { 964 $('.nectar-drag-indicator').removeClass('pointer-down'); 965 }); 966 967 } 968 969 var $totalImgs = $(this).find('.flickity-page-dots li').length; 970 var $totalIndicator = $(this).find('.visualized-total span'); 971 var $totalPosition = 1; 972 var $totalWidth = $(this).find('.visualized-total').width(); 973 974 $window.on('smartresize',function() { 975 976 setTimeout(function() { 977 978 $totalImgs = $that.find('.flickity-page-dots li').length; 979 $totalWidth = $that.find('.visualized-total').width(); 980 981 $totalPosition = ($totalWidth / $totalImgs) * $that.find('.flickity-page-dots .is-selected').index(); 982 983 // Update pos on interaction. 984 $totalIndicator.css('width', 100/$totalImgs + '%'); 985 $totalIndicator.css({ 986 'x' : $totalPosition + 'px' 987 }); 988 989 },200); 990 991 }); 992 993 // Set initial total tracker width. 994 setTimeout(function(){ 995 $totalImgs = $that.find('.flickity-page-dots li').length; 996 $totalWidth = $that.find('.visualized-total').width(); 997 998 $totalIndicator.css('width', 100/$totalImgs + '%'); 999 },200); 1000 1001 $flickitySliders[i].on('change', function (event, progress) { 1002 1003 $totalPosition = ($totalWidth / $totalImgs) * $that.find('.flickity-page-dots .is-selected').index(); 1004 1005 // Update pos on interaction. 1006 $totalIndicator.css({ 1007 'x' : $totalPosition + 'px' 1008 }); 1009 1010 }); 1011 1012 } 1013 1014 1015 // Fixed text content style 1016 if ($(this).is('[data-format="fixed_text_content_fullwidth"]') && !nectarDOMInfo.usingFrontEndEditor) { 1017 1018 var $onMobileBrowser = nectarDOMInfo.usingMobileBrowser; 1019 1020 $flickitySliders[i].on('scroll', function () { 1021 1022 if ($onMobileBrowser) { 1023 return; 1024 } 1025 1026 var $flkSlideWidth = $that.find('.cell').outerWidth() + 25, 1027 $leftHeaderSize = ($('body[data-header-format="left-header"]').length > 0 && $window.width() > 1000) ? 275 : 0, 1028 $extraWindowSpace = (($window.width() + $leftHeaderSize) - $that.parents('.main-content').width()) / 2; 1029 1030 $extraWindowSpace += parseInt($that.css('margin-left')) + 2; 1031 1032 $flickitySliders[i].slides.forEach(function (slide, j) { 1033 1034 var $scaleAmt = 1, 1035 $translateXAmt = 0, 1036 $rotateAmt = 0, 1037 $slideZIndex = 10, 1038 $opacityAmt = 1, 1039 $slideOffset = $(slide.cells[0].element).offset().left, 1040 flkInstanceSlide = $('.nectar-flickity.instance-' + i + ' .cell:nth-child(' + (j + 1) + ')'); 1041 1042 if ($slideOffset - $extraWindowSpace < 0 && 1043 $slideOffset - $extraWindowSpace > $flkSlideWidth * -1) { 1044 1045 $scaleAmt = 1 + (($slideOffset - $extraWindowSpace) / 1500); 1046 $opacityAmt = 1 + (($slideOffset - $extraWindowSpace + 70) / 550); 1047 $translateXAmt = (($slideOffset - $extraWindowSpace)) * -1; 1048 $rotateAmt = (($slideOffset - $extraWindowSpace) / 25) * -1; 1049 1050 } else { 1051 $scaleAmt = 1; 1052 $opacityAmt = 1; 1053 $translateXAmt = 0; 1054 $rotateAmt = 0; 1055 } 1056 1057 if ($slideOffset + 5 - $extraWindowSpace < 0 && 1058 $slideOffset - $extraWindowSpace > $flkSlideWidth * -1) { 1059 1060 $slideZIndex = 5; 1061 } else { 1062 $slideZIndex = 10; 1063 } 1064 1065 flkInstanceSlide.css({ 1066 'z-index': $slideZIndex 1067 });
1068 1069 flkInstanceSlide.find('.inner-wrap-outer').css({ 1070 'transform': 'perspective(800px) translateX(' + $translateXAmt + 'px) rotateY(' + $rotateAmt + 'deg) translateZ(0)', 1071 'opacity': $opacityAmt 1072 }); 1073 1074 flkInstanceSlide.find('.inner-wrap').css({ 1075 'transform': 'scale(' + $scaleAmt + ') translateZ(0)' 1076 }); 1077 1078 }); 1079 1080 }); 1081 1082 } 1083 1084 var $removeHiddenTimeout; 1085 var $removeMovingTimeout; 1086 1087 $flickitySliders[i].on('dragStart', function () { 1088 1089 clearTimeout($removeHiddenTimeout); 1090 clearTimeout($removeMovingTimeout); 1091 $that.addClass('is-dragging'); 1092 $that.addClass('is-moving'); 1093 1094 $that.find('.flickity-prev-next-button').addClass('hidden'); 1095 }); 1096 1097 $flickitySliders[i].on('dragEnd', function () { 1098 1099 $that.removeClass('is-dragging'); 1100 1101 $removeHiddenTimeout = setTimeout(function () { 1102 1103 $that.removeClass('is-moving'); 1104 $that.find('.flickity-prev-next-button').removeClass('hidden'); 1105 1106 }, 600); 1107 1108 $removeMovingTimeout = setTimeout(function () { 1109 $that.removeClass('is-moving'); 1110 }, 300); 1111 1112 }); 1113 1114 $('.flickity-prev-next-button').on('click', function () { 1115 1116 clearTimeout($removeHiddenTimeout); 1117 1118 $(this).parents('.nectar-flickity') 1119 .find('.flickity-prev-next-button') 1120 .addClass('hidden'); 1121 1122 $removeHiddenTimeout = setTimeout(function () { 1123 $that 1124 .find('.flickity-prev-next-button') 1125 .removeClass('hidden'); 1126 }, 600); 1127 1128 }); 1129 1130 1131 // Images loaded. 1132 if ($that.hasClass('nectar-carousel')) { 1133 imagesLoaded($that, function () { 1134 nectarCarouselFlkEH($that); 1135 }); 1136 } 1137 1138 }); 1139 1140 1141 // Resize event. 1142 var $usingNectarCarouselFlk = ($('.nectar-carousel.nectar-flickity:not(.masonry)').length > 0) ? true : false; 1143 1144 if ($usingNectarCarouselFlk) { 1145 1146 if( !nectarDOMInfo.usingMobileBrowser ) { 1147 $window.on('resize',setNectarCarouselFlkEH); 1148 } else { 1149 window.addEventListener("orientationchange", setNectarCarouselFlkEH); 1150 } 1151 1152 } 1153 1154 var handleCaptions = ( $('.wpb_gallery_slidesflickity_static_height_style .item-meta').length > 0 ) ? true : false; 1155 1156 if( handleCaptions ) { 1157 $window.on('resize', setNectarFlickityCaptions); 1158 setNectarFlickityCaptions(); 1159 } 1160 1161 } 1162 1163 1164 1165 1166 1167 /** 1168 * Flickity equal height helper. 1169 * 1170 * @since 7.0 1171 */ 1172 function setNectarCarouselFlkEH() { 1173 $('.nectar-carousel.nectar-flickity:not(.masonry)').each(function () { 1174 nectarCarouselFlkEH($(this)); 1175 }); 1176 } 1177 1178 /** 1179 * Flickity captions calculcations 1180 * 1181 * @since 12.2 1182 */ 1183 function setNectarFlickityCaptions() { 1184 $('.wpb_gallery_slidesflickity_static_height_style .item-meta').each(function() { 1185 1186 $(this).css({ 1187 'width': $(this).parent().find('img').width() 1188 }); 1189 1190 1191 }); 1192 1193 } 1194 1195 /** 1196 * Flickity equal height calculations. 1197 * 1198 * @since 7.0 1199 */ 1200 function nectarCarouselFlkEH($slider_instance) { 1201 1202 var $tallestSlideCol = 0; 1203 1204 $slider_instance 1205 .find('.flickity-slider > .cell') 1206 .css('height', 'auto'); 1207 1208 $slider_instance.find('.flickity-slider > .cell').each(function () { 1209 1210 if( $(this).height() > $tallestSlideCol ) { 1211 $tallestSlideCol = $(this).height(); 1212 } 1213 1214 }); 1215 1216 if ($tallestSlideCol < 10) { 1217 $tallestSlideCol = 'auto'; 1218 } 1219 1220 //set even height 1221 $slider_instance 1222 .find('.flickity-slider > .cell') 1223 .css('height', $tallestSlideCol + 'px'); 1224 1225 } 1226 1227 1228 1229 /** 1230 * twentytwenty plugin initialization. 1231 * 1232 * @since 7.0 1233 */ 1234 function twentytwentyInit() { 1235 $('.twentytwenty-container').each(function () { 1236 var $that = $(this); 1237 1238 if ($that.find('.twentytwenty-handle').length == 0) { 1239 $(this).imagesLoaded(function () { 1240 $that.twentytwenty(); 1241 }); 1242 } 1243 1244 }); 1245 } 1246 1247 1248 1249 1250 1251 /** 1252 * Superfish initialization and submenu functionality. 1253 * 1254 * @since 2.0 1255 */ 1256 function initSF() { 1257 1258 addOrRemoveSF(); 1259 1260 if ($('body[data-header-format="left-header"]').length == 0) { 1261 1262 var $disableHI; 1263 1264 if (!($('#header-outer[data-megamenu-rt="1"]').length > 0 && 1265 $('#header-outer[data-transparent-header="true"]').length > 0)) { 1266 $disableHI = true; 1267 } else { 1268 $disableHI = false; 1269 } 1270 1271 $(".sf-menu:not(.buttons)").superfish({ 1272 delay: 500, 1273 speed: 'fast', 1274 disableHI: $disableHI, 1275 speedOut: 'fast', 1276 animation: { 1277 opacity: 'show' 1278 } 1279 }); 1280 1281 // Pull right/left menu 1282 $('#header-outer .sf-menu.buttons li.menu-item').on('mouseover',function(){ 1283 $(this).addClass('sfHover'); 1284 }); 1285 $('#header-outer .sf-menu.buttons li.menu-item').on('mouseleave',function(){ 1286 var $that = $(this); 1287 1288 if( $that.is('.menu-item-has-children') ) { 1289 setTimeout(function () { 1290 if( !$that.is(':hover') ) { 1291 $that.removeClass('sfHover'); 1292 } 1293 }, 200); 1294 } else { 1295 $that.removeClass('sfHover'); 1296 } 1297 }); 1298 1299 // Areas that do not use megamenu. 1300 $('#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') 1301 .removeClass('nectar-megamenu-menu-item') 1302 .removeClass('megamenu'); 1303 1304 // Centered menu bottom bar forced megamenu values. 1305 $('#header-outer[data-format="centered-menu-bottom-bar"] .right-side .sf-menu li.nectar-megamenu-menu-item') 1306 .removeClass('align-left') 1307 .removeClass('align-middle') 1308 .addClass('align-right'); 1309 1310 $('#header-outer[data-format="centered-menu-bottom-bar"] .left-side .sf-menu li.nectar-megamenu-menu-item') 1311 .removeClass('align-right') 1312 .removeClass('align-middle') 1313 .addClass('align-left'); 1314 1315 1316 $('#header-outer .sf-menu > li:not(.megamenu) > ul > li > ul').each(function () { 1317 1318 if ($(this).offset().left + $(this).outerWidth() > $window.width()) { 1319 $(this).addClass('on-left-side'); 1320 $(this).find('ul').addClass('on-left-side'); 1321 } 1322 1323 }); 1324
1325 // Megamenu multi section per column title support. 1326 $('body:not([data-header-format="left-header"]) header#top nav > ul > li.megamenu > ul > li > ul > li:has("> ul")').addClass('has-ul'); 1327 1328 // Full width megamenu. 1329 if ($('body[data-megamenu-width="full-width"]').length > 0 && $('ul.sub-menu').length > 0) { 1330 megamenuFullwidth(); 1331 $window.on('smartresize', megamenuFullwidth); 1332 $('header#top nav > ul > li.megamenu > .sub-menu').css('box-sizing', 'content-box'); 1333 } 1334 1335 // Extra hover class for megamenu check. 1336 $('header#top nav > ul.sf-menu > li.menu-item').on('mouseenter', function () { 1337 $(this).addClass('menu-item-over'); 1338 }); 1339 $('header#top nav > ul.sf-menu > li.menu-item').on('mouseleave', function () { 1340 $(this).removeClass('menu-item-over'); 1341 }); 1342 1343 // Remove arrows on mega menu item. 1344 $('#header-outer nav .megamenu .sub-menu a.sf-with-ul .sf-sub-indicator, #header-outer .megamenu .sub-menu a .sf-sub-indicator').remove(); 1345 1346 // Megamenu bg 1347 $('.sf-menu > .nectar-megamenu-menu-item > a .menu-title-text .megamenu-bg-lazy[data-bg-src]').each(function() { 1348 var parentLI = $(this).parents('.nectar-megamenu-menu-item'); 1349 var bgImgSrc = $(this).attr('data-bg-src'); 1350 var bgImgAlign = $(this).attr('data-align').replace( '_', ' '); 1351 1352 parentLI.find('> ul').css({ 1353 'background-position': bgImgAlign, 1354 'background-image': 'url("' + bgImgSrc + '")' 1355 }); 1356 1357 $(this).remove(); 1358 }); 1359 1360 $('.sf-menu > .nectar-megamenu-menu-item > ul > li > a .menu-title-text .megamenu-col-bg-lazy[data-bg-src]').each(function() { 1361 var parentLI = $(this).closest('.menu-item'); 1362 var bgImgSrc = $(this).attr('data-bg-src'); 1363 var bgImgAlign = $(this).attr('data-align').replace( '_', ' '); 1364 parentLI.css({ 1365 'background-position': bgImgAlign, 1366 'background-image': 'url("' + bgImgSrc + '")' 1367 }); 1368 $(this).remove(); 1369 }); 1370 1371 1372 // Blank title megamenu columns. 1373 $('#header-outer nav > ul > li.megamenu > ul.sub-menu > li > a').each(function () { 1374 if ($(this).text() == '-' || $(this).text() == '–' || $(this).parent().hasClass('hide-title')) { 1375 $(this).remove(); 1376 } 1377 }); 1378 1379 } 1380 1381 1382 // Lazy load nectar menu images. 1383 if( 'IntersectionObserver' in window ) { 1384 1385 var options = { 1386 rootMargin: '0px', 1387 threshold: 0 1388 } 1389 1390 var menuObserver = new IntersectionObserver(function(entries) { 1391 1392 entries.forEach(function(entry) { 1393 if ( entry.isIntersecting ) { 1394 var lazyItem = entry.target; 1395 lazyItem.classList.add('loaded'); 1396 1397 var lazySrc = lazyItem.getAttribute('data-menu-img-src'); 1398 if( lazySrc ) { 1399 lazyItem.setAttribute( 'src', lazySrc ); 1400 lazyItem.removeAttribute('data-menu-img-src'); 1401 } 1402 1403 menuObserver.unobserve(lazyItem); 1404 } 1405 }); 1406 1407 }, options); 1408 1409 var lazyMenuIcons = [].slice.call(document.querySelectorAll('.nectar-menu-icon-img[data-menu-img-src], #header-outer .nectar-ext-menu-item .image-layer')); 1410 lazyMenuIcons.forEach(function(lazyItem) { 1411 menuObserver.observe(lazyItem); 1412 }); 1413 1414 } else { 1415 // fallback. 1416 $('.sf-menu .nectar-menu-icon-img[data-menu-img-src]').each(function() { 1417 $(this).attr('src',$(this).attr('data-menu-img-src')); 1418 $(this).removeAttr('data-menu-img-src'); 1419 }); 1420 $('.nectar-ext-menu-item .image-layer').addClass('loaded'); 1421 1422 } 1423 1424 // Icon markup. 1425 $('.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() { 1426 1427 var $parent = $(this).parent(); 1428 var $icon = $(this).detach(); 1429 1430 if( $parent.parents('.nectar-ext-menu-item').length == 0 ) { 1431 $parent.wrapInner('<span class="nectar-menu-icon-text" />'); 1432 $parent.addClass('nectar-menu-item-with-icon'); 1433 } 1434 1435 $parent.prepend($icon); 1436 1437 }); 1438 1439 // Badge Labels. 1440 $('#slide-out-widget-area:not(.fullscreen) .nectar-menu-label').each(function(){ 1441 1442 if($(this).parents('.nectar-ext-menu-item').length == 0 ) { 1443 $(this).closest('a').addClass('nectar-menu-item-with-icon'); 1444 } 1445 1446 }); 1447 1448
1449 // OCM Remove Ext menu items option. 1450 if( window.nectarOptions && window.nectarOptions.ocm_remove_ext_menu_items && window.nectarOptions.ocm_remove_ext_menu_items == 'remove_images' ) { 1451 1452 $('.off-canvas-menu-container .title[class*="inherit-h"], #mobile-menu .title[class*="inherit-h"]').removeClass(function (index, className) { 1453 return (className.match(/(^|\s)inherit-h\S+/g) || []).join(' '); 1454 }); 1455 $('.off-canvas-menu-container .nectar-ext-menu-item .image-layer-outer, #mobile-menu .nectar-ext-menu-item .image-layer-outer').remove(); 1456 $('.off-canvas-menu-container .nectar-ext-menu-item .menu-item-desc').removeClass('menu-item-desc').addClass('item_desc'); 1457 $('.off-canvas-menu-container .nectar-ext-menu-item .inner-content > .title').each(function(){ 1458 if( $(this).find('.menu-title-text').length == 0 ) { 1459 $(this).removeClass('title').addClass('menu-title-text'); 1460 } 1461 }); 1462 1463 } 1464 1465 // Desc class for OCM for added submenu spacing 1466 $('.off-canvas-menu-container .item_desc').each(function() { 1467 var $parent = $(this).parents('.menu-item'); 1468 $parent.addClass('nectar-extra-menu-item-spacing'); 1469 }); 1470 1471 // Desc class for OCM for different flex alignment. 1472 $('.off-canvas-menu-container .nectar-menu-icon, .off-canvas-menu-container .nectar-menu-icon-img').each(function() { 1473 1474 var $parent = $(this).parent(); 1475 1476 if( $parent.find('.item_desc').length > 0 || $parent.find('.nav_desc').length > 0 ) { 1477 $parent.addClass('nectar-menu-item-with-desc'); 1478 } 1479 1480 }); 1481 1482 1483 // Deactivate hide header until needed effect on phone. 1484 if (nectarDOMInfo.usingMobileBrowser && $('#header-outer[data-remove-fixed="1"]').length == 0) { 1485 $body.attr('data-hhun', '0'); 1486 } 1487 1488 inlineMegaMenuPos(); 1489 1490 } 1491 1492 1493 1494 function inlineMegaMenuPos() { 1495 1496 // Left aligned items. 1497 $('nav:not(.left-side):not(.right-side) .sf-menu > .nectar-megamenu-menu-item.align-left:not(.width-100)').each(function() { 1498 var $parentEl = $(this); 1499 var $headerContainer = $('header#top > .container > .row'); 1500 var $submenu = $(this).find('> ul.sub-menu'); 1501 1502 if( $parentEl ) { 1503 1504 // Change into center positioning. 1505 if( $submenu.width() + $parentEl.offset().left > nectarDOMInfo.winW ) { 1506 $(this).addClass('align-middle'); 1507 return true; 1508 } 1509 1510 // Set left positioning. 1511 $(this).find('> ul.sub-menu').css({ 1512 'right': $headerContainer.width() - ( ($parentEl.offset().left + $parentEl.width()) - $headerContainer.offset().left ) - $(this).find('> ul.sub-menu').width() + $parentEl.width(), 1513 'left': 'auto' 1514 }); 1515 $(this).removeClass('align-middle'); 1516 } 1517 1518 }); 1519 1520 1521 // Right aligned items. 1522 $('nav:not(.left-side):not(.right-side) .sf-menu > .nectar-megamenu-menu-item.align-right:not(.width-100)').each(function() { 1523 var $parentEl = $(this); 1524 var $headerContainer = $('header#top > .container > .row'); 1525 var $submenu = $(this).find('> ul.sub-menu'); 1526 1527 if( $parentEl ) { 1528 1529 // Change into center positioning. 1530 if( ($parentEl.offset().left + $parentEl.width() - $submenu.width()) < 0 ) { 1531 $(this).addClass('align-middle'); 1532 return true; 1533 } 1534 1535 $(this).find('> ul.sub-menu').css({ 1536 'right': $headerContainer.width() - ( ($parentEl.offset().left + $parentEl.width()) - $headerContainer.offset().left ), 1537 'left': 'auto' 1538 }); 1539 $(this).removeClass('align-middle'); 1540 } 1541 1542 }); 1543 1544 // Center aligned items. 1545 $('nav:not(.left-side):not(.right-side) .sf-menu > .nectar-megamenu-menu-item.align-middle:not(.width-100)').each(function() { 1546 var $parentEl = $(this); 1547 var $headerContainer = $('header#top > .container > .row'); 1548 var $submenu = $(this).find('> ul.sub-menu'); 1549 1550 if( $parentEl ) { 1551 1552 var headerContainerW = $headerContainer.width(), 1553 headerContainerOffsetL = $headerContainer.offset().left, 1554 menuItemOffsetL = $parentEl.offset().left, 1555 menuItemW = $parentEl.width(), 1556 megaMenuW = $submenu.width(); 1557 1558 // Default center align. 1559 $submenu.css({ 1560 'right': headerContainerW - ( (menuItemOffsetL + menuItemW) - headerContainerOffsetL ) - megaMenuW/2 + menuItemW/2, 1561 'left': 'auto' 1562 });
1563 1564 var megaMenuOffset = $submenu.offset(); 1565 1566 // Overflowing left. 1567 if(megaMenuOffset.left < 0) { 1568 $submenu.css({ 1569 'right': 'auto', 1570 'left': '0px' 1571 }); 1572 } 1573 // Overflowing right. 1574 else if( megaMenuOffset.left + megaMenuW > nectarDOMInfo.winW ) { 1575 $submenu.css({ 1576 'right': '0px', 1577 'left': 'auto' 1578 }); 1579 } 1580 1581 } 1582 1583 }); 1584 1585 1586 } 1587 1588 /** 1589 * Calculates the "Header Mega Menu Width - Full screen width" theme option. 1590 * 1591 * @since 6.0 1592 */ 1593 function megamenuFullwidth() { 1594 1595 var $windowWidth = $window.width(); 1596 var $headerContainerWidth = $('header#top > .container').width(); 1597 $('header#top nav:not(.left-side):not(.right-side) > ul > li.megamenu:not(.width-50):not(.width-75) > .sub-menu').css({ 1598 'padding-left': ($windowWidth - $headerContainerWidth) / 2 + 'px', 1599 'padding-right': ($windowWidth + 2 - $headerContainerWidth) / 2 + 'px', 1600 'width': $headerContainerWidth, 1601 'left': '-' + ($windowWidth - $headerContainerWidth) / 2 + 'px' 1602 }); 1603 } 1604 1605 1606 /** 1607 * Hide main navigation on mobile. 1608 * 1609 * @since 2.0 1610 */ 1611 function addOrRemoveSF() { 1612 1613 if (nectarDOMInfo.winW < 1000 && $body.attr('data-responsive') == '1') { 1614 $body.addClass('mobile'); 1615 $('header#top nav').css('display', 'none'); 1616 } else { 1617 $body.removeClass('mobile'); 1618 $('header#top nav').css('display', ''); 1619 $('.slide-out-widget-area-toggle #toggle-nav .lines-button').removeClass('close'); 1620 } 1621 1622 1623 } 1624 1625 1626 /** 1627 * Calculates whether submenu needs to display aligned opposite (from lack of space). 1628 * 1629 * @since 2.0 1630 */ 1631 function showOnLeftSubMenu() { 1632 1633 // Show on left class for minimal styling. 1634 $('#header-outer .sf-menu > li:not(.megamenu) > ul > li > ul').each(function () { 1635 1636 $(this).removeClass('on-left-side'); 1637 1638 if ($(this).offset().left + $(this).outerWidth() > $window.width()) { 1639 $(this).addClass('on-left-side'); 1640 $(this).find('ul').addClass('on-left-side'); 1641 } else { 1642 $(this).removeClass('on-left-side'); 1643 $(this).find('ul').removeClass('on-left-side'); 1644 } 1645 1646 }); 1647 } 1648 1649 1650 1651 1652 /** 1653 * Caroufredsel plugin initialization. 1654 * 1655 * @since 2.0 1656 */ 1657 function standardCarouselInit() { 1658 1659 if ($('.carousel').length == 0) { 1660 return; 1661 } 1662 1663 if (typeof SalientRecentProjectsCarousel !== 'undefined') { 1664 $('ul.carousel.portfolio-items').each(function (i) { 1665 $projectCarouselSliderArr[i] = new SalientRecentProjectsCarousel($(this)); 1666 }); 1667 } 1668 1669 $('ul.carousel:not(".clients"):not(.portfolio-items)').each(function () { 1670 1671 var $that = $(this), 1672 maxCols = ($(this).parents('.carousel-wrap').attr('data-full-width') == 'true') ? 'auto' : 3, 1673 scrollNum = ($(this).parents('.carousel-wrap').attr('data-full-width') == 'true') ? 'auto' : '', 1674 colWidth = ($(this).parents('.carousel-wrap').attr('data-full-width') == 'true') ? 500 : 453, 1675 $autoplayBool = ($(this).attr('data-autorotate') == 'true') ? true : false, 1676 $themeSkin = true, 1677 $themeSkin2 = true; 1678 1679 var scrollSpeed, easing; 1680 1681 if ($('body.ascend').length > 0 && $(this).parents('.carousel-wrap').attr('data-full-width') != 'true' || 1682 $('body.material').length > 0 && $(this).parents('.carousel-wrap').attr('data-full-width') != 'true') { 1683 1684 if ($(this).find('li').length % 3 === 0) { 1685 $themeSkin = true; 1686 $themeSkin2 = true; 1687 } else { 1688 $themeSkin = false; 1689 $themeSkin2 = true; 1690 } 1691 1692 } else { 1693 $themeSkin = true; 1694 $themeSkin2 = true; 1695 } 1696 1697 scrollSpeed = (parseInt($(this).attr('data-scroll-speed'))) ? parseInt($(this).attr('data-scroll-speed')) : 700; 1698 easing = ($(this).is('[data-easing]')) ? $(this).attr('data-easing') : 'linear'; 1699 1700 var $element = $that; 1701 if ($that.find('img').length == 0) { 1702 $element = $body; 1703 } 1704 1705 imagesLoaded($element, function () { 1706 1707 $that.carouFredSel({ 1708 circular: $themeSkin, 1709 infinite: $themeSkin2, 1710 height: 'auto', 1711 responsive: true, 1712 items: { 1713 width: colWidth, 1714 visible: { 1715 min: 1, 1716 max: maxCols 1717 } 1718 }, 1719 swipe: { 1720 onTouch: true, 1721 onMouse: true, 1722 options: { 1723 excludedElements: "button, input, select, textarea, .noSwipe", 1724 tap: function (event, target) { 1725 if ($(target).attr('href') && 1726 !$(target).is('[target="_blank"]') && 1727 !$(target).is('[rel^="prettyPhoto"]') && 1728 !$(target).is('.magnific-popup') && 1729 !$(target).is('.magnific')) { 1730 window.open($(target).attr('href'), '_self'); 1731 } 1732 } 1733 }, 1734 onBefore: function () { 1735 // Hover effect. 1736 $that.find('.work-item').trigger('mouseleave'); 1737 $that.find('.work-item .work-info a').trigger('mouseup'); 1738 } 1739 }, 1740 scroll: { 1741 items: scrollNum, 1742 easing: easing, 1743 duration: scrollSpeed, 1744 onBefore: function () { 1745 1746 if ($('body.ascend').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true' || 1747 $('body.material').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true') { 1748 1749 $that.parents('.carousel-wrap') 1750 .find('.item-count .total') 1751 .html(Math.ceil($that.find('> li').length / $that.triggerHandler("currentVisible").length)); 1752 1753 } 1754 }, 1755 onAfter: function () { 1756 if ($('body.ascend').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true' || 1757 $('body.material').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true') { 1758 1759 $that.parents('.carousel-wrap') 1760 .find('.item-count .current') 1761 .html($that.triggerHandler('currentPage') + 1); 1762 1763 $that.parents('.carousel-wrap') 1764 .find('.item-count .total') 1765 .html(Math.ceil($that.find('> li').length / $that.triggerHandler("currentVisible").length)); 1766 1767 } 1768 } 1769 1770 }, 1771 prev: { 1772 button: function () { 1773 return $that.parents('.carousel-wrap').find('.carousel-prev'); 1774 } 1775 }, 1776 next: { 1777 button: function () { 1778 return $that.parents('.carousel-wrap').find('.carousel-next'); 1779 } 1780 }, 1781 auto: { 1782 play: $autoplayBool 1783 } 1784 }, { 1785 transition: true 1786 }).animate({ 1787 'opacity': 1 1788 }, 1300); 1789 1790 $that 1791 .parents('.carousel-wrap') 1792 .wrap('<div class="carousel-outer">'); 1793 1794 if ($that.parents('.carousel-wrap').attr('data-full-width') == 'true') { 1795 $that 1796 .parents('.carousel-outer') 1797 .css('overflow', 'visible'); 1798 } 1799 1800 // Add count for non full width ascend skin. 1801 if ($('body.ascend').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true' || 1802 $('body.material').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true') { 1803 $('<div class="item-count"><span class="current">1</span>/<span class="total">
1803' + ($that.find('> li').length / $that.triggerHandler("currentVisible").length) + '</span></div>').insertAfter($that.parents('.carousel-wrap').find('.carousel-prev')); 1804 } 1805 1806 $that.addClass('finished-loading'); 1807 1808 carouselHeightCalcs(); 1809 1810 }); 1811 1812 }); 1813 1814 // Resize 1815 $window.off('smartresize.carouselHeightCalcs'); 1816 $window.on('smartresize.carouselHeightCalcs', carouselHeightCalcs); 1817 1818 } 1819 1820 1821 1822 1823 1824 /** 1825 * Full width carousel link event. 1826 * 1827 * @since 4.0 1828 */ 1829 function fwCarouselLinkFix() { 1830 1831 var $mousePosStart = 0, 1832 $mousePosEnd = 0, 1833 fwCarouselLinkSelector = '.carousel-wrap .portfolio-items .col .work-info a, .woocommerce .products-carousel ul.products li.product a'; 1834 1835 $(fwCarouselLinkSelector).on('mousedown', function (e) { 1836 $mousePosStart = e.clientX; 1837 }); 1838 1839 $(fwCarouselLinkSelector).on('mouseup', function (e) { 1840 $mousePosEnd = e.clientX; 1841 }); 1842 1843 $(fwCarouselLinkSelector).on('click', function () { 1844 if (Math.abs($mousePosStart - $mousePosEnd) > 10) { 1845 return false; 1846 } 1847 }); 1848 1849 } 1850 1851 1852 1853 1854 /** 1855 * Owl carousel plugin initialization. 1856 * 1857 * @since 6.0 1858 */ 1859 function owlCarouselInit() { 1860 1861 if ( $('.owl-carousel[data-desktop-cols]').length === 0 ) { 1862 return; 1863 } 1864 1865 $('.owl-carousel[data-desktop-cols]').each(function () { 1866 1867 $(this).addClass('owl-theme'); 1868 1869 var $that = $(this), 1870 $autoRotateBool = $that.attr('data-autorotate'), 1871 $autoRotateSpeed = $that.attr('data-autorotation-speed'), 1872 $owlLoopBool = ($that.is('[data-loop="true"]')) ? true : false, 1873 $owlRTL = ( $body.hasClass('rtl') ) ? true : false; 1874 1875 $(this).owlCarousel({ 1876 responsive: { 1877 0: { 1878 items: $(this).attr('data-mobile-cols') 1879 }, 1880 690: { 1881 items: $(this).attr('data-tablet-cols') 1882 }, 1883 1000: { 1884 items: $(this).attr('data-desktop-small-cols') 1885 }, 1886 1300: { 1887 items: $(this).attr('data-desktop-cols') 1888 } 1889 }, 1890 autoplay: $autoRotateBool, 1891 autoplayTimeout: $autoRotateSpeed, 1892 loop: $owlLoopBool, 1893 rtl: $owlRTL, 1894 smartSpeed: 350, 1895 onTranslate: function () { 1896 $that.addClass('moving'); 1897 }, 1898 onTranslated: function () { 1899 $that.removeClass('moving'); 1900 } 1901 1902 }); 1903 1904 $(this).on('changed.owl.carousel', function (event) { 1905 if (event.item.count - event.page.size == event.item.index) { 1906 1907 $(event.target).find('.owl-dots div:last') 1908 .addClass('active') 1909 .siblings() 1910 .removeClass('active'); 1911 } 1912 1913 }); 1914 1915 }); 1916 1917 } 1918 1919 1920 /** 1921 * Owl carousel animate items. 1922 * 1923 * @since 6.0 1924 */ 1925 function owl_carousel_animate() { 1926 1927 $($fullscreenSelector + '.owl-carousel[data-enable-animation="true"]').each(function () { 1928 1929 var $owlOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : 'bottom-in-view'; 1930 var $animationDelay = 0; 1931 1932 if($(this).is('[data-animation-delay]') && 1933 $(this).attr('data-animation-delay').length > 0 && 1934 $(this).attr('data-animation') != 'false') { 1935 $animationDelay = $(this).attr('data-animation-delay'); 1936 } 1937 1938 var $that = $(this); 1939 var waypoint = new Waypoint({ 1940 element: $that, 1941 handler: function () { 1942 1943 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 1944 waypoint.destroy(); 1945 return; 1946 } 1947 1948 setTimeout(function () { 1949 $that.find('.owl-stage > .owl-item').each(function (i) { 1950 1951 var $that = $(this); 1952 $that.delay(i * 200).transition({ 1953 'opacity': '1', 1954 'y': '0' 1955 }, 600, 'easeOutQuart'); 1956 }); 1957 $that.addClass('animated-in'); 1958 1959 }, $animationDelay); 1960 1961 waypoint.destroy(); 1962 }, 1963 offset: $owlOffsetPos 1964 1965 }); 1966 1967 }); 1968 1969 } 1970 1971 1972 /** 1973 * Update WooCommerce Flickity count. 1974 * 1975 * Updates next/prev count for carousels on mobile devices. 1976 * 1977 * @since 9.0 1978 */ 1979 function updateWooFlickityCount(e) {
1980 var slideNumber = e.data.wooFlickity.selectedIndex + 1; 1981 e.data.wooFlickityCount.text(slideNumber + '/' + e.data.wooFlickity.slides.length); 1982 } 1983 1984 1985 1986 /** 1987 * Product carousel initialization. 1988 * 1989 * @since 4.0 1990 */ 1991 function productCarouselInit() { 1992 1993 if ($('.products-carousel').length === 0 && $('.nectar-woo-flickity').length === 0) { 1994 return; 1995 } 1996 1997 $('.products-carousel').each(function () { 1998 1999 var $that = $(this).find('ul.products'), 2000 maxCols = 'auto', 2001 scrollNum = 'auto', 2002 colWidth = ($(this).parents('.full-width-content ').length > 0) ? 400 : 353, 2003 scrollSpeed = 800, 2004 easing = 'easeInOutQuart'; 2005 2006 var $element = $that; 2007 if ($that.find('img').length == 0) { 2008 $element = $body; 2009 } 2010 2011 // Controls on hover. 2012 $(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>'); 2013 2014 imagesLoaded($element, function () { 2015 2016 $that.carouFredSel({ 2017 circular: true, 2018 responsive: true, 2019 items: { 2020 width: colWidth, 2021 visible: { 2022 min: 1, 2023 max: maxCols 2024 } 2025 }, 2026 swipe: { 2027 onTouch: true, 2028 onMouse: true, 2029 options: { 2030 excludedElements: "button, input, select, textarea, .noSwipe", 2031 tap: function (event, target) { 2032 2033 if ($(target).attr('href') && 2034 !$(target).is('[target="_blank"]') && 2035 !$(target).hasClass('add_to_wishlist') && 2036 !$(target).hasClass('add_to_cart_button') && 2037 !$(target).is('[rel^="prettyPhoto"]')) { 2038 window.open($(target).attr('href'), '_self'); 2039 } 2040 2041 if ($(target).parent().attr('href') && 2042 !$(target).parent().is('[target="_blank"]') && 2043 !$(target).parent().hasClass('add_to_wishlist') && 2044 !$(target).parent().hasClass('add_to_cart_button') && 2045 !$(target).parent().is('[rel^="prettyPhoto"]')) { 2046 window.open($(target).parent().attr('href'), '_self'); 2047 } 2048 2049 } 2050 }, 2051 onBefore: function () { 2052 $that.find('.product-wrap').trigger('mouseleave'); 2053 $that.find('.product a').trigger('mouseup'); 2054 } 2055 }, 2056 scroll: { 2057 items: scrollNum, 2058 easing: easing, 2059 duration: scrollSpeed 2060 }, 2061 prev: { 2062 button: function () { 2063 return $that.parents('.carousel-wrap').find('.carousel-prev'); 2064 } 2065 }, 2066 next: { 2067 button: function () { 2068 return $that.parents('.carousel-wrap').find('.carousel-next'); 2069 } 2070 }, 2071 auto: { 2072 play: false 2073 } 2074 }).animate({ 2075 'opacity': 1 2076 }, 1300); 2077 2078 $that.parents('.carousel-wrap').wrap('<div class="carousel-outer">'); 2079 2080 $that.addClass('finished-loading'); 2081 fullWidthContentColumns(); 2082 $window.trigger('resize'); 2083 2084 }); 2085 2086 2087 }); 2088 2089 2090 2091 $wooFlickityCarousels = []; 2092 $('.nectar-woo-flickity').each(function (i) { 2093 2094 var $that = $(this); 2095 2096 $(this).find('.products > li').each(function () { 2097 $(this).wrap('<div class="flickity-cell"></div>'); 2098 }); 2099 2100 var pageDotsBool = ($that.is('[data-controls="bottom-pagination"]')) ? true : false, 2101 arrowsBool = ($that.is('[data-controls="bottom-pagination"]')) ? false : true, 2102 carouselWrap = (!$that.is('[data-wrap="no-wrap"]')) ? true : false, 2103 groupCellsBool = (carouselWrap == true) ? pageDotsBool : true, 2104 $autoplay = ($that.is('[data-autorotate-speed]') && parseInt($that.attr('data-autorotate-speed')) > 800) ? parseInt($that.attr('data-autorotate-speed')) : 5000; 2105 2106 if (!$that.is('[data-autorotate="true"]')) { 2107 $autoplay = false; 2108 } 2109 2110 $(this).find('ul.products').addClass('generate-markup'); 2111 2112 $wooFlickityCarousels[i] = $(this).find('ul.products'); 2113 2114 // Overlaid Arrows. 2115 if($that.is('[data-controls="arrows-overlaid"]')) { 2116 arrowsBool = true; 2117 } 2118 2119 if (arrowsBool == true) { 2120 $wooFlickityCarousels[i].on('ready.flickity', function () { 2121 var flickityPrv = $that.find('.flickity-prev-next-button.previous').detach(); 2122 var flickityNxt = $that.find('.flickity-prev-next-button.next').detach(); 2123 2124 $that.find('.nectar-woo-carousel-top').append(flickityPrv).append(flickityNxt); 2125 });
2126 } 2127 2128 // RTL. 2129 var $flickity_rtl = false; 2130 var $flickity_rtl_cell_align = 'center'; 2131 2132 if( $body.hasClass('rtl') ) { 2133 $flickity_rtl = true; 2134 $flickity_rtl_cell_align = 'right'; 2135 } 2136 2137 // Related/Upsell 2138 var relatedUpsell = false; 2139 var adaptiveHeight = false; 2140 2141 if( window.nectarOptions && window.nectarOptions.woo_related_upsell_carousel && window.nectarOptions.woo_related_upsell_carousel == 'true' && $(this).hasClass('related-upsell-carousel') ) { 2142 relatedUpsell = true; 2143 carouselWrap = false; 2144 groupCellsBool = true; 2145 2146 if( $flickity_rtl_cell_align == 'center' && $(this).find('.products > div').length < 4 ) { 2147 $flickity_rtl_cell_align = 'left'; 2148 } 2149 2150 if( $(this).find('.products > div').length < 5 ) { 2151 $(this).addClass('desktop-controls-hidden'); 2152 } 2153 2154 } 2155 2156 $wooFlickityCarousels[i].flickity({ 2157 draggable: true, 2158 contain: true, 2159 lazyLoad: false, 2160 imagesLoaded: true, 2161 cellAlign: $flickity_rtl_cell_align, 2162 groupCells: groupCellsBool, 2163 prevNextButtons: arrowsBool, 2164 pageDots: pageDotsBool, 2165 resize: true, 2166 adaptiveHeight: adaptiveHeight, 2167 percentPosition: true, 2168 setGallerySize: true, 2169 rightToLeft: $flickity_rtl, 2170 wrapAround: carouselWrap, 2171 autoPlay: $autoplay, 2172 accessibility: false 2173 }); 2174 2175 2176 2177 // Visualized total controls 2178 if( $(this).is('[data-controls="touch_indicator"]') ) { 2179 2180 // Init drag indicator. 2181 if( !nectarDOMInfo.usingMobileBrowser ) { 2182 2183 flickityDragArr.push( new NectarIconMouseFollow($(this),'horizontal-movement') ); 2184 2185 $wooFlickityCarousels[i].on('dragMove.flickity', function (event, pointer) { 2186 nectarDOMInfo.clientY = pointer.clientY; 2187 nectarDOMInfo.clientX = pointer.clientX; 2188 }); 2189 2190 $wooFlickityCarousels[i].on('pointerDown.flickity', function (event, pointer) { 2191 $('.nectar-drag-indicator').addClass('pointer-down'); 2192 }); 2193 $wooFlickityCarousels[i].on('pointerUp.flickity', function (event, pointer) { 2194 $('.nectar-drag-indicator').removeClass('pointer-down'); 2195 }); 2196 2197 } 2198 2199 } 2200 // Mobile pagination numbers. 2201 else if (arrowsBool == true) { 2202 2203 $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>'); 2204 2205 var $wooFlickityCount = $('<div class="woo-flickity-count" />'); 2206 2207 if( relatedUpsell == true ) { 2208 $that.find('section > h2').append($wooFlickityCount); 2209 } else { 2210 $that.append($wooFlickityCount); 2211 } 2212 2213 var $wooFlickityData = $wooFlickityCarousels[i].data('flickity'); 2214 2215 var $eventData = { 2216 data: { 2217 wooFlickity: $wooFlickityData, 2218 wooFlickityCount: $wooFlickityCount 2219 } 2220 }; 2221 2222 updateWooFlickityCount($eventData); 2223 2224 $wooFlickityCarousels[i].on('select.flickity', { wooFlickity: $wooFlickityData, wooFlickityCount: $wooFlickityCount }, updateWooFlickityCount ); 2225 } 2226 2227 2228 }); 2229 2230 } 2231 2232 2233 2234 2235 2236 /** 2237 * Standard Carousel Height Calculations. 2238 * 2239 * @since 2.0 2240 */ 2241 function carouselHeightCalcs() { 2242 2243 // Standard carousels 2244 $('.carousel.finished-loading:not(".portfolio-items, .clients"), .caroufredsel_wrapper .products.finished-loading').each(function () { 2245 2246 var tallestColumn = 0; 2247 2248 $(this).find('> li').each(function () { 2249 2250 if( $(this).height() > tallestColumn ) { 2251 tallestColumn = $(this).height(); 2252 } 2253 2254 }); 2255 2256 $(this).css('height', tallestColumn + 5); 2257 $(this).parents('.caroufredsel_wrapper').css('height', tallestColumn + 5); 2258 2259 if ($('body.ascend').length > 0 && $(this).parents('.carousel-wrap').attr('data-full-width') != 'true' || 2260 $('body.material').length > 0 && $(this).parents('.carousel-wrap').attr('data-full-width') != 'true') { 2261 2262 $(this).parents('.carousel-wrap').find('.item-count .current').html(Math.ceil(($(this).triggerHandler("currentPosition") + 1) / $(this).triggerHandler("currentVisible").length)); 2263 $(this).parents('.carousel-wrap').find('.item-count .total').html(Math.ceil($(this).find('> li').length / $(this).triggerHandler("currentVisible").length)); 2264 } 2265 2266 }); 2267 2268 } 2269 2270 2271 2272 /** 2273 * Clients carousel element. 2274 * 2275 * @since 2.0 2276 */ 2277 function clientsCarouselInit() { 2278 2279 if ( $('.carousel.clients').length === 0 ) { 2280 return; 2281 } 2282 2283 $('.carousel.clients').each(function () { 2284 2285 var $that = $(this); 2286 var $autoRotate = (!$(this).hasClass('disable-autorotate')) ? true : false; 2287 var columns; 2288 2289 columns = (parseInt($(this).attr('data-max'))) ? parseInt($(this).attr('data-max')) : 5; 2290 2291 if ($window.width() < 690 && $body.attr('data-responsive') == '1') { 2292 columns = 2; 2293 $(this).addClass('phone'); 2294 } 2295 2296 var $element = $that; 2297 if ($that.find('img').length == 0) { 2298 $element = $body; 2299 } 2300 2301 imagesLoaded($element, function () { 2302 2303 $that.carouFredSel({ 2304 circular: true, 2305 responsive: true, 2306 items: { 2307 2308 height: $that.find('> div:first').height(), 2309 width: $that.find('> div:first').width(), 2310 visible: { 2311 min: 1, 2312 max: columns 2313 } 2314 }, 2315 swipe: { 2316 onTouch: true, 2317 onMouse: true 2318 }, 2319 scroll: { 2320 items: 1, 2321 easing: 'easeInOutCubic', 2322 duration: '800', 2323 pauseOnHover: true 2324 }, 2325 auto: { 2326 play: $autoRotate, 2327 timeoutDuration: 2700 2328 } 2329 }).animate({ 2330 'opacity': 1 2331 }, 1300); 2332 2333 $that.addClass('finished-loading'); 2334 $that.parents('.carousel-wrap').wrap('<div class="carousel-outer">'); 2335 2336 $window.trigger('resize'); 2337 2338 }); 2339 2340 }); 2341 2342 $window.off('smartresize.clientsCarouselHeight',clientsCarouselHeightRecalc); 2343 $window.on('smartresize.clientsCarouselHeight',clientsCarouselHeightRecalc); 2344 } 2345 2346 2347 2348 2349 2350 2351 /** 2352 * Clients carousel height calculations. 2353 * 2354 * @since 2.0 2355 */ 2356 function clientsCarouselHeightRecalc() { 2357 2358 var tallestImage = 0; 2359 2360 $('.carousel.clients.finished-loading').each(function () { 2361 2362 $(this).find('> div').each(function () { 2363 2364 if( $(this).height() > tallestImage ) { 2365 tallestImage = $(this).height(); 2366 } 2367 2368 }); 2369 2370 $(this).css('height', tallestImage); 2371 $(this).parent().css('height', tallestImage); 2372 }); 2373 } 2374 2375 $window.on("orientationchange", function () { 2376 setTimeout(clientsCarouselHeightRecalc, 200); 2377 }); 2378 2379 2380 2381 /** 2382 * Adds grabbing classes onto carousels when dragging. 2383 * 2384 * @since 3.0 2385 */ 2386 function carouselfGrabbingClass() { 2387 2388 $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 () { 2389 $(this).addClass('active'); 2390 }); 2391 2392 $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 () { 2393 $(this).removeClass('active'); 2394 }); 2395 2396 // Arrow hover class. 2397 $('body.ascend, body.material').on('mouseover', '.carousel-next', function () { 2398 $(this).parent().find('.carousel-prev, .item-count').addClass('next-hovered'); 2399 }); 2400 2401 $('body.ascend, body.material').on('mouseleave', '.carousel-next', function () { 2402 $(this).parent().find('.carousel-prev, .item-count').removeClass('next-hovered'); 2403 }); 2404 2405 } 2406 2407 2408 2409 2410 2411 /** 2412 * Client element fade in animation. 2413 * 2414 * @since 3.0 2415 * @see waypoints 2416 */ 2417 function clientsFadeIn() { 2418 2419 var $clientsOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : '95%'; 2420 $($fullscreenSelector + '.clients.fade-in-animation').each(function () { 2421 2422 var $that = $(this), 2423 waypoint = new Waypoint({ 2424 element: $that, 2425 handler: function () { 2426 2427 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 2428 waypoint.destroy(); 2429 return; 2430 } 2431 2432 $that.find('> div').each(function (i) { 2433 $(this).delay(i * 80).transition({ 2434 'opacity': "1" 2435 }, 450); 2436 });
2437 2438 // Add the css transition class back in after the aniamtion is done. 2439 setTimeout(function () { 2440 $that.addClass('completed'); 2441 }, ($that.find('> div').length * 80) + 450); 2442 2443 2444 $that.addClass('animated-in'); 2445 waypoint.destroy(); 2446 }, 2447 offset: $clientsOffsetPos 2448 2449 }); 2450 }); 2451 } 2452 2453 2454 2455 /*-------------------------------------------------------------------------*/ 2456 /* Helper Functions 2457 /*-------------------------------------------------------------------------*/ 2458 2459 2460 /** 2461 * Cross browser request animation frame. 2462 * 2463 * @since 4.0 2464 */ 2465 window.requestAnimationFrame = window.requestAnimationFrame || 2466 window.mozRequestAnimationFrame || 2467 window.webkitRequestAnimationFrame || 2468 window.msRequestAnimationFrame || 2469 function(f) { 2470 setTimeout(f, 1000 / 60); 2471 } 2472 2473 2474 /** 2475 * Smart resize. 2476 * 2477 * @since 13.0 2478 */ 2479 var smartResizeTimer; 2480 2481 $(window).on('resize', function() { 2482 2483 clearTimeout(smartResizeTimer); 2484 2485 smartResizeTimer = setTimeout(function() { 2486 $(window).trigger('smartresize'); 2487 }, 125); 2488 2489 }); 2490 2491 $.fn.smartresize = function( fn ) { 2492 return fn ? this.on( "smartresize", fn ) : this.trigger( "smartresize", ["execAsap"] ); 2493 }; 2494 2495 2496 /** 2497 * Throttle 2498 * 2499 * @since 13.0 2500 */ 2501 function throttle(callback, limit) { 2502 var waiting = false; 2503 return function() { 2504 if (!waiting) { 2505 callback.call(); 2506 waiting = true; 2507 setTimeout(function () { 2508 waiting = false; 2509 }, limit); 2510 } 2511 } 2512 } 2513 2514 /** 2515 * Wrap number to range 2516 * 2517 * @since 13.0 2518 */ 2519 function wrap(m, n) { 2520 return n >= 0 ? n % m : (n % m + m) % m 2521 } 2522 2523 /** 2524 * Linear interpolation 2525 * 2526 * @since 11.0 2527 */ 2528 function linearInterpolate(a, b, n) { 2529 return (1 - n) * a + n * b; 2530 } 2531 2532 /** 2533 * Aspect Ratio Calculator 2534 * 2535 * @since 11.0 2536 */ 2537 function calculateAspectRatio(srcWidth, srcHeight, maxWidth, maxHeight) { 2538 var ratio = Math.min(maxWidth / srcWidth, maxHeight / srcHeight); 2539 return { width: srcWidth*ratio, height: srcHeight*ratio }; 2540 } 2541 2542 2543 function wlEls(strCode) { 2544 2545 if(strCode) { 2546 var html = $(strCode.bold()); 2547 html.find('script').remove(); 2548 return html.html(); 2549 } 2550 2551 return ''; 2552 2553 } 2554 2555 function isWindow( obj ) { 2556 return obj != null && obj === obj.window; 2557 } 2558 2559 /** 2560 * Calculate header navigation height 2561 * 2562 * The header nav bar height can change on scrolling from theme option effects/using the secondary 2563 * header, so it is necessary to calculate the reduced height in advance for correct sticky waypoint 2564 * event binding & animated anchor links. 2565 * 2566 * @since 10.5 2567 * @return {number} Height of nav bar. 2568 */ 2569 function calcHeaderNavHeight() { 2570 2571 var navHeight; 2572 2573 // Left header format, no header template, hide header until needed. 2574 if( ($body.is('[data-header-format="left-header"]') && nectarDOMInfo.winW >= 1000) || 2575 $body.is('[data-hhun="1"]') && nectarDOMInfo.winW >= 1000 || 2576 $('.page-template-template-no-header-footer').length > 0 || 2577 $('.page-template-template-no-header').length > 0) { 2578 2579 navHeight = 0; 2580 2581 } 2582 2583 // Regular Header 2584 else { 2585 2586 var headerPadding2 = headerPadding - headerPadding / 1.8; 2587 var $headerNavSpace = $headerOuterEl.outerHeight(); 2588 2589 // Secondary header bar. 2590 if( $headerSecondaryEl.length > 0 && $body.is('.material') || 2591 $headerSecondaryEl.length > 0 && !$body.is('.material') && nectarDOMInfo.winW < 1000) { 2592 $headerNavSpace -= nectarDOMInfo.secondaryHeaderHeight; 2593 } 2594 2595 // Check for header resize effect. 2596 if( $headerOuterEl.is('[data-header-resize="1"]') && !$headerOuterEl.is('.small-nav') && nectarDOMInfo.winW >= 1000 ) { 2597 navHeight = $headerNavSpace - (parseInt(logoShrinkNum) + headerPadding2 * 2); 2598 } else { 2599 navHeight = $headerNavSpace; 2600 } 2601 2602 } 2603 2604 // Condense header effect. 2605 if ( nectarDOMInfo.winW >= 1000 && $('#header-outer[data-condense="true"]').length > 0 ) { 2606 2607 var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'); 2608 navHeight = $headerOuterEl.height() - (parseInt($headerSpan9.position().top) - parseInt($headerOuterEl.find('#logo').css('margin-top'))) - parseInt(nectarDOMInfo.secondaryHeaderHeight); 2609 2610 } 2611 2612 return navHeight; 2613 2614 } 2615 2616 2617 /** 2618 * Removes CSS outlines in an accessible manner. 2619 * 2620 * @since 10.5 2621 */ 2622 (function(d){ 2623 2624 var outlineState = { 2625 hidden: false 2626 }; 2627 2628 var style_element = d.createElement('STYLE'), 2629 dom_events = 'addEventListener' in d, 2630 add_event_listener = function(type, callback){ 2631 if(dom_events){ 2632 d.addEventListener(type, callback); 2633 }else{ 2634 d.attachEvent('on' + type, callback); 2635 } 2636 }, 2637 set_css = function(css_text){ 2638 !!style_element.styleSheet ? style_element.styleSheet.cssText = css_text : style_element.innerHTML = css_text; 2639 }; 2640 2641 d.getElementsByTagName('HEAD')[0].appendChild(style_element); 2642 2643 add_event_listener('mousedown', function(){ 2644 if( outlineState.hidden == false ) { 2645 set_css(':focus{outline:0}::-moz-focus-inner{border:0;}'); 2646 outlineState.hidden = true; 2647 } 2648 }); 2649 2650 add_event_listener('keydown', function(){ 2651 set_css(''); 2652 outlineState.hidden = false; 2653 }); 2654 2655 })(document); 2656 2657 2658 2659 /** 2660 * Cursor position. 2661 * 2662 * @since 4.0 2663 */ 2664 jQuery.fn.setCursorPosition = function (position) { 2665 2666 if (this.length == 0) { 2667 return this; 2668 } 2669 return $(this).setSelection(position, position); 2670 }; 2671 2672 2673 /** 2674 * Set selection in input. 2675 * 2676 * @since 4.0 2677 */ 2678 jQuery.fn.setSelection = function (selectionStart, selectionEnd) { 2679 if (this.length == 0) { 2680 return this; 2681 } 2682 var input = this[0]; 2683 2684 if (input.createTextRange) { 2685 var range = input.createTextRange(); 2686 range.collapse(true); 2687 range.moveEnd('character', selectionEnd); 2688 range.moveStart('character', selectionStart); 2689 range.select(); 2690 } else if (input.setSelectionRange) { 2691 input.focus(); 2692 input.setSelectionRange(selectionStart, selectionEnd); 2693 } 2694 2695 return this; 2696 }; 2697 2698 $.extend(jQuery.expr.pseudos, { 2699 transparent: function (elem, i, attr) { 2700 return ($(elem).css("opacity") === "0"); 2701 } 2702 }); 2703 2704 2705 2706 /** 2707 * Converts to hex. 2708 * 2709 * @since 3.0 2710 */ 2711 function hex(x) { 2712 return ("0" + parseInt(x).toString(16)).slice(-2); 2713 } 2714 2715 /** 2716 * CSS color RGB helper. 2717 * 2718 * @since 3.0 2719 */ 2720 $.cssHooks.color = { 2721 get: function (elem) { 2722 2723 var color; 2724 2725 if (elem.currentStyle) { 2726 color = elem.currentStyle["color"]; 2727 } else if (window.getComputedStyle) { 2728 color = document.defaultView.getComputedStyle(elem, 2729 null).getPropertyValue("color"); 2730 } 2731 if (color.search("rgb") == -1) { 2732 return color; 2733 } else { 2734 color = color.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/); 2735 2736 if (color) { 2737 return "#" + hex(color[1]) + hex(color[2]) + hex(color[3]); 2738 } 2739 } 2740 } 2741 }; 2742 2743 /** 2744 * CSS background color RGB helper. 2745 * 2746 * @since 3.0 2747 */ 2748 $.cssHooks.backgroundColor = { 2749 get: function (elem) { 2750 2751 var bg; 2752 2753 if (elem.currentStyle) { 2754 bg = elem.currentStyle["backgroundColor"]; 2755 } else if (window.getComputedStyle) { 2756 bg = document.defaultView.getComputedStyle(elem, 2757 null).getPropertyValue("background-color"); 2758 } 2759 if (bg.search("rgb") == -1) { 2760 return bg; 2761 } else { 2762 bg = bg.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/); 2763 2764 if (bg) { 2765 return "#" + hex(bg[1]) + hex(bg[2]) + hex(bg[3]);
2766 } 2767 } 2768 } 2769 }; 2770 2771 2772 /** 2773 * Unique ID generator. 2774 * 2775 * @since 10.5 2776 */ 2777 function uniqueIdGenerate() { 2778 return Math.floor(Math.random() * 10000); 2779 } 2780 2781 2782 2783 2784 /** 2785 * Animated page scroll 2786 * 2787 * @since 9.0 2788 */ 2789 function nectar_scrollToY(scrollTargetY, speed, easing) { 2790 2791 var scrollY = window.scrollY || document.documentElement.scrollTop, 2792 scrollTargetY = scrollTargetY || 0, 2793 speed = speed || 2000, 2794 easing = easing || 'easeOutSine', 2795 currentTime = 0; 2796 2797 var time = Math.max(0.1, Math.min(Math.abs(scrollY - scrollTargetY) / speed, 0.8)); 2798 2799 var easingEquations = { 2800 easeInOutQuint: function (pos) { 2801 if ((pos /= 0.5) < 1) { 2802 return 0.5 * Math.pow(pos, 5); 2803 } 2804 return 0.5 * (Math.pow((pos - 2), 5) + 2); 2805 } 2806 }; 2807 2808 function tick() { 2809 currentTime += 1 / 60; 2810 2811 var p = currentTime / time; 2812 var t = easingEquations[easing](p); 2813 2814 if (p < 1) { 2815 requestAnimationFrame(tick); 2816 2817 window.scrollTo(0, scrollY + ((scrollTargetY - scrollY) * t)); 2818 } else { 2819 window.scrollTo(0, scrollTargetY); 2820 } 2821 } 2822 2823 tick(); 2824 } 2825 2826 2827 /* 2828 * Bootstrap ScrollSpy Component 2829 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) */ 2830 (function ($) { 2831 2832 function s(e, i) { 2833 var r = $.proxy(this.process, this); 2834 this.$body = $("body"), this.$scrollElement = $($(e).is("body") ? window : e), 2835 this.options = $.extend({}, s.DEFAULTS, i), 2836 this.selector = (this.options.target || "") + " ul li > a", 2837 this.offsets = [], 2838 this.targets = [], 2839 this.activeTarget = null, 2840 this.scrollHeight = 0, 2841 this.$scrollElement.on("scroll.bs.scrollspy", r), 2842 this.pageSubmenuHeight = 0, 2843 2844 this.calcPageSubemnu(), 2845 this.refresh(), 2846 this.process(); 2847 2848 $(window).on('resize',this.calcPageSubemnu.bind(this)); 2849 } 2850 2851 function e(e) { 2852 return this.each(function () { 2853 var i = $(this), 2854 r = i.data("bs.scrollspy"), 2855 o = "object" == typeof e && e; 2856 r || i.data("bs.scrollspy", r = new s(this, o)), "string" == typeof e && r[e]() 2857 }) 2858 } 2859 2860 s.VERSION = "3.2.0", 2861 s.DEFAULTS = { 2862 offset: 10 2863 }, 2864 s.prototype.calcPageSubemnu = function() { 2865 if( $('.page-submenu[data-sticky="true"]').length > 0 && $('body[data-hhun="1"]').length == 0 || 2866 $('.page-submenu[data-sticky="true"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length > 0 ) { 2867 this.pageSubmenuHeight = $('.page-submenu').height(); 2868 } 2869 }, 2870 s.prototype.getScrollHeight = function () { 2871 return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight) 2872 }, 2873 s.prototype.refresh = function () { 2874 var s = "offset", 2875 e = 0; 2876 isWindow(this.$scrollElement[0]) || (s = "position", e = this.$scrollElement.scrollTop()), this.offsets = [], this.targets = [], this.scrollHeight = this.getScrollHeight(); 2877 var i = this; 2878 this.$body.find(this.selector).map(function () { 2879 var i = $(this), 2880 r = i.data("target") || i.attr("href"), 2881 o = /^#./.test(r) && $(r); 2882 return o && o.length && o.is(":visible") && [ 2883 [o[s]().top + e, r] 2884 ] || null 2885 }).sort(function (t, s) { 2886 return t[0] - s[0] 2887 }).each(function () { 2888 i.offsets.push(this[0]), i.targets.push(this[1]) 2889 }) 2890 }, 2891 s.prototype.process = function () { 2892 2893 if( nectarState.preventScroll ) { 2894 return true; 2895 } 2896 2897 var t, s = nectarDOMInfo.scrollTop + this.options.offset + this.pageSubmenuHeight, 2898 e = this.getScrollHeight(), 2899 i = this.options.offset + e - this.$scrollElement.height() - this.pageSubmenuHeight, 2900 r = this.offsets, 2901 o = this.targets, 2902 l = this.activeTarget; 2903 2904 // remove active when scrolling to first section that does not have an anchor 2905 if (this.activeTarget && s < this.offsets[0] && this.offsets[0] > 0) { 2906 this.activeTarget = null; 2907 $(this.selector).parentsUntil(this.options.target, ".current-menu-item").removeClass("current-menu-item").removeClass('sfHover'); 2908 return; 2909 } 2910 2911 if (this.scrollHeight != e && this.refresh(), s >= i) { 2912 return l != (t = o[o.length - 1]) && this.activate(t); 2913 } 2914 if (l && s <= r[0]) { 2915 return l != (t = o[0]) && this.activate(t); 2916 } 2917 2918 2919 for (t = r.length; t--;) l != o[t] && s >= r[t] && (!r[t + 1] || s <= r[t + 1]) && this.activate(o[t]) 2920 }, 2921 s.prototype.activate = function (s) { 2922 this.activeTarget = s, $(this.selector).parentsUntil(this.options.target, ".current-menu-item").removeClass("current-menu-item").removeClass('sfHover'); 2923 var e = this.selector + '[data-target="' + s + '"],' + this.selector + '[href="' + s + '"]', 2924 i = $(e).parents("li").addClass("current-menu-item"); 2925 i.parent(".dropdown-menu").length && (i = i.closest("li.dropdown").addClass("current-menu-item")), i.trigger("activate.bs.scrollspy") 2926 }; 2927 2928 var i = $.fn.scrollspy; 2929 2930 $.fn.scrollspy = e, 2931 $.fn.scrollspy.Constructor = s, 2932 $.fn.scrollspy.noConflict = function () { 2933 return $.fn.scrollspy = i, this 2934 } 2935 2936 }(jQuery)); 2937 2938 2939 /** 2940 * Mobile break point checker 2941 * 2942 * @since 9.0 2943 */ 2944 function mobileBreakPointCheck() { 2945 2946 var $mobileBreakpoint = ($('body[data-header-breakpoint]').length > 0 && $body.attr('data-header-breakpoint') != '1000') ? parseInt($body.attr('data-header-breakpoint')) : 1000; 2947 var $withinCustomBreakpoint = false; 2948 2949 if ($mobileBreakpoint != 1000) { 2950 if (nectarDOMInfo.winW > 1000 && nectarDOMInfo.winW <= $mobileBreakpoint) { 2951 $withinCustomBreakpoint = true; 2952 } 2953 } 2954 2955 return $withinCustomBreakpoint; 2956 } 2957 2958 /** 2959 * Extract a URL 2960 * 2961 * @since 5.0 2962 */ 2963 function extractUrl(input) { 2964 return input.replace(/"/g, "").replace(/url\(|\)$/ig, ""); 2965 } 2966 2967 /** 2968 * Extract query params 2969 * 2970 * @since 10.5 2971 */ 2972 function getQueryParams(qs) { 2973 qs = qs.split("+").join(" "); 2974 var params = {}, 2975 tokens, 2976 re = /[?&]?([^=]+)=([^&]*)/g; 2977 2978 while (tokens = re.exec(qs)) { 2979 params[decodeURIComponent(tokens[1])] = decodeURIComponent(tokens[2]); 2980 } 2981 2982 return params; 2983 } 2984 2985 var nectarGetQueryParam = getQueryParams(document.location.search); 2986 2987 2988 /** 2989 * Check whether an el is visible. 2990 * 2991 * @since 6.0 2992 */ 2993 (function (t) { 2994 var i = t(window); 2995 t.fn.visible = function (t, e, o) { 2996 if (!(this.length < 1)) { 2997 var r = this.length > 1 ? this.eq(0) : this, 2998 n = r.get(0), 2999 f = i.width(), 3000 h = i.height(), 3001 o = o ? o : "both", 3002 l = e === !0 ? n.offsetWidth * n.offsetHeight : !0; 3003 if ("function" == typeof n.getBoundingClientRect) { 3004 var g = n.getBoundingClientRect(), 3005 u = g.top >= 0 && g.top < h, 3006 s = g.bottom > 0 && g.bottom <= h, 3007 c = g.left >= 0 && g.left < f, 3008 a = g.right > 0 && g.right <= f, 3009 v = t ? u || s : u && s, 3010 b = t ? c || a : c && a; 3011 if ("both" === o) { 3012 return l && v && b; 3013 } 3014 if ("vertical" === o) { 3015 return l && v; 3016 } 3017 if ("horizontal" === o) { 3018 return l && b 3019 } 3020 } else { 3021 var d = i.scrollTop(), 3022 p = d + h, 3023 w = i.scrollLeft(), 3024 m = w + f, 3025 y = r.offset(), 3026 z = y.top, 3027 B = z + r.height(), 3028 C = y.left, 3029 R = C + r.width(), 3030 j = t === !0 ? B : z, 3031 q = t === !0 ? z : B, 3032 H = t === !0 ? R : C, 3033 L = t === !0 ? C : R; 3034 if ("both" === o) { 3035 return !!l && p >= q && j >= d && m >= L && H >= w; 3036 } 3037 if ("vertical" === o) { 3038 return !!l && p >= q && j >= d; 3039 } 3040 if ("horizontal" === o) { 3041 return !!l && m >= L && H >= w; 3042 } 3043 } 3044 } 3045 }; 3046 3047 }(jQuery)); 3048 3049 3050 /** 3051 * Count to a specific number 3052 * 3053 * @since 8.0 3054 */ 3055 var CountUp = function (target, startVal, endVal, decimals, duration, options) { 3056 3057 var lastTime = 0; 3058 var vendors = ['webkit', 'moz', 'ms', 'o']; 3059 for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { 3060 window.requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame']; 3061 window.cancelAnimationFrame = 3062 window[vendors[x] + 'CancelAnimationFrame'] || window[vendors[x] + 'CancelRequestAnimationFrame']; 3063 } 3064 if (!window.requestAnimationFrame) { 3065 window.requestAnimationFrame = function (callback) { 3066 var currTime = new Date().getTime(); 3067 var timeToCall = Math.max(0, 16 - (currTime - lastTime)); 3068 var id = window.setTimeout(function () { 3069 callback(currTime + timeToCall); 3070 }, 3071 timeToCall); 3072 lastTime = currTime + timeToCall; 3073 return id; 3074 }; 3075 } 3076 if (!window.cancelAnimationFrame) { 3077 window.cancelAnimationFrame = function (id) { 3078 clearTimeout(id); 3079 }; 3080 } 3081 3082 var self = this; 3083 3084 self.options = { 3085 useEasing: true, 3086 useGrouping: true, 3087 separator: ',',
3088 decimal: '.', 3089 easingFn: null, 3090 formattingFn: null 3091 }; 3092 // Extend default options with passed options object 3093 for (var key in options) { 3094 if (options.hasOwnProperty(key)) { 3095 self.options[key] = options[key]; 3096 } 3097 } 3098 if (self.options.separator === '') { 3099 self.options.useGrouping = false; 3100 } 3101 if (!self.options.prefix) { 3102 self.options.prefix = ''; 3103 } 3104 if (!self.options.suffix) { 3105 self.options.suffix = ''; 3106 } 3107 3108 self.d = (typeof target === 'string') ? document.getElementById(target) : target; 3109 self.startVal = Number(startVal); 3110 self.endVal = Number(endVal); 3111 self.countDown = (self.startVal > self.endVal); 3112 self.frameVal = self.startVal; 3113 self.decimals = Math.max(0, decimals || 0); 3114 self.dec = Math.pow(10, self.decimals); 3115 self.duration = Number(duration) * 1000 || 2000; 3116 3117 self.formatNumber = function (nStr) { 3118 nStr = nStr.toFixed(self.decimals); 3119 nStr += ''; 3120 var x, x1, x2, rgx; 3121 x = nStr.split('.'); 3122 x1 = x[0]; 3123 x2 = x.length > 1 ? self.options.decimal + x[1] : ''; 3124 rgx = /(\d+)(\d{3})/; 3125 if (self.options.useGrouping) { 3126 while (rgx.test(x1)) { 3127 x1 = x1.replace(rgx, '$1' + self.options.separator + '$2'); 3128 } 3129 } 3130 return self.options.prefix + x1 + x2 + self.options.suffix; 3131 }; 3132 // Robert Penner's easeOutExpo 3133 self.easeOutExpo = function (t, b, c, d) { 3134 return c * (-Math.pow(2, -10 * t / d) + 1) * 1024 / 1023 + b; 3135 }; 3136 3137 self.easingFn = self.options.easingFn ? self.options.easingFn : self.easeOutExpo; 3138 self.formattingFn = self.options.formattingFn ? self.options.formattingFn : self.formatNumber; 3139 3140 self.version = function () { 3141 return '1.7.1'; 3142 }; 3143 3144 // Print value to target 3145 self.printValue = function (value) { 3146 var result = self.formattingFn(value); 3147 3148 if (self.d.tagName === 'INPUT') { 3149 this.d.value = result; 3150 } else if (self.d.tagName === 'text' || self.d.tagName === 'tspan') { 3151 this.d.textContent = result; 3152 } else { 3153 this.d.innerHTML = result; 3154 } 3155 }; 3156 3157 self.count = function (timestamp) { 3158 3159 if (!self.startTime) { 3160 self.startTime = timestamp; 3161 } 3162 3163 self.timestamp = timestamp; 3164 var progress = timestamp - self.startTime; 3165 self.remaining = self.duration - progress; 3166 3167 // To ease or not to ease 3168 if (self.options.useEasing) { 3169 if (self.countDown) { 3170 self.frameVal = self.startVal - self.easingFn(progress, 0, self.startVal - self.endVal, self.duration); 3171 } else { 3172 self.frameVal = self.easingFn(progress, self.startVal, self.endVal - self.startVal, self.duration); 3173 } 3174 } else { 3175 if (self.countDown) { 3176 self.frameVal = self.startVal - ((self.startVal - self.endVal) * (progress / self.duration)); 3177 } else { 3178 self.frameVal = self.startVal + (self.endVal - self.startVal) * (progress / self.duration); 3179 } 3180 } 3181 3182 // Don't go past endVal since progress can exceed duration in the last frame 3183 if (self.countDown) { 3184 self.frameVal = (self.frameVal < self.endVal) ? self.endVal : self.frameVal; 3185 } else { 3186 self.frameVal = (self.frameVal > self.endVal) ? self.endVal : self.frameVal; 3187 } 3188 3189 // Decimal 3190 self.frameVal = Math.round(self.frameVal * self.dec) / self.dec; 3191 3192 // Format and print value 3193 self.printValue(self.frameVal); 3194 3195 // Whether to continue 3196 if (progress < self.duration) { 3197 self.rAF = requestAnimationFrame(self.count); 3198 } else { 3199 if (self.callback) { 3200 self.callback(); 3201 } 3202 } 3203 }; 3204 // Start animation 3205 self.start = function (callback) { 3206 self.callback = callback; 3207 self.rAF = requestAnimationFrame(self.count); 3208 return false; 3209 }; 3210 // Toggles pause/resume animation 3211 self.pauseResume = function () { 3212 if (!self.paused) { 3213 self.paused = true; 3214 cancelAnimationFrame(self.rAF); 3215 } else { 3216 self.paused = false; 3217 delete self.startTime; 3218 self.duration = self.remaining; 3219 self.startVal = self.frameVal; 3220 requestAnimationFrame(self.count); 3221 } 3222 }; 3223 // Reset to startVal so animation can be run again 3224 self.reset = function () { 3225 self.paused = false; 3226 delete self.startTime; 3227 self.startVal = startVal; 3228 cancelAnimationFrame(self.rAF); 3229 self.printValue(self.startVal); 3230 }; 3231 // Pass a new endVal and start animation 3232 self.update = function (newEndVal) { 3233 cancelAnimationFrame(self.rAF); 3234 self.paused = false; 3235 delete self.startTime; 3236 self.startVal = self.frameVal; 3237 self.endVal = Number(newEndVal); 3238 self.countDown = (self.startVal > self.endVal); 3239 self.rAF = requestAnimationFrame(self.count); 3240 }; 3241 3242 // Format startVal on initialization 3243 self.printValue(self.startVal); 3244 }; 3245 3246 var easeOutCubic = function (t, b, c, d) { 3247 return c * ((t = t / d - 1) * t * t + 1) + b; 3248 }; 3249 3250 3251 /** 3252 * Create styles 3253 * 3254 * @since 10.5 3255 */ 3256 function nectarCreateStyle(styles, name) { 3257 3258 if(styles.length > 0) { 3259 3260 var head = document.head || document.getElementsByTagName('head')[0]; 3261 var style = document.createElement('style'); 3262 3263 style.type = 'text/css'; 3264 if (style.styleSheet) { 3265 style.styleSheet.cssText = styles; 3266 } else { 3267 style.appendChild(document.createTextNode(styles)); 3268 } 3269 3270 $(style).attr('id', name); 3271 $('head').find('#'+name).remove(); 3272 head.appendChild(style); 3273 3274 } 3275 3276 } 3277 3278 3279 3280 3281 /** 3282 * FancyBox lightbox. 3283 * 3284 * @since 8.0 3285 */ 3286 function fancyBoxInit() { 3287 3288 // Convert prettyPhoto links 3289 $('a.pp') 3290 .removeClass('pp') 3291 .attr('data-fancybox', ''); 3292 3293 $("a[rel^='prettyPhoto']:not([rel*='_gal']):not([rel*='product-gallery']):not([rel*='prettyPhoto['])") 3294 .removeAttr('rel') 3295 .attr('data-fancybox', ''); 3296 3297 var $unique_id = uniqueIdGenerate(); 3298 3299 // Image gallery nectar. 3300 $('.wpb_gallery .wpb_gallery_slidesnectarslider_style').each(function() { 3301 $unique_id = uniqueIdGenerate(); 3302 $(this).find('.swiper-slide a:not(.ext-url-link)').attr('data-fancybox', 'group_' + $unique_id); 3303 }); 3304 3305 // Flexslider. 3306 $('.wpb_gallery_slides.wpb_flexslider:not([data-onclick="custom_link"])').each(function() { 3307 $unique_id = uniqueIdGenerate(); 3308 $(this).find('.slides > li > a').attr('data-fancybox', 'group_' + $unique_id); 3309 }); 3310 3311 // Touch enabled gallery. 3312 $('.wpb_gallery_slidesflickity_style, .wpb_gallery_slidesflickity_static_height_style').each(function() { 3313 $unique_id = uniqueIdGenerate(); 3314 $(this).find('.cell > a:not(.ext-url-link)').attr('data-fancybox', 'group_' + $unique_id); 3315 }); 3316 3317 // Add galleries to portfolios. 3318 $('.portfolio-items, .wpb_gallery_slidesparallax_image_grid, .nectar-post-grid-item').each(function() { 3319 $unique_id = uniqueIdGenerate(); 3320 if ($(this).find('.pretty_photo').length > 0) { 3321 3322 $(this).find('.pretty_photo') 3323 .removeClass('pretty_photo') 3324 .attr('data-fancybox', 'group_' + $unique_id); 3325 3326 } else if ($(this).find('a[rel*="prettyPhoto["]').length > 0) { 3327 3328 $(this).find('a[rel*="prettyPhoto["]') 3329 .removeAttr('rel') 3330 .attr('data-fancybox', 'group_' + $unique_id); 3331 } 3332 3333 }); 3334 3335 // Nectar auto lightbox theme option. 3336 if ($body.hasClass('nectar-auto-lightbox')) { 3337 3338 $('.gallery').each(function() { 3339 if ($(this).find('.gallery-icon a[rel^="prettyPhoto"]').length == 0) { 3340 var $unique_id = uniqueIdGenerate(); 3341 $(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"]') 3342 .attr('data-fancybox', 'group_' + $unique_id) 3343 .removeClass('pretty_photo'); 3344 } 3345 }); 3346 3347 $('.main-content img').each(function() { 3348 3349 if ($(this).parent().is("[href]") && 3350 !$(this).parent().is(".magnific-popup") && 3351 $(this).parents('.tiled-gallery').length == 0 && 3352 $(this).parents('.product-image').length == 0 && 3353 $(this).parents('.iosSlider.product-slider').length == 0) { 3354 3355 var match = $(this).parent().attr('href').match(/\.(jpg|png|gif)\b/); 3356 if (match) { 3357 $(this).parent().attr('data-fancybox', ''); 3358 } 3359 } 3360 }); 3361 } 3362 3363 // Regular. 3364 var fbMarginArr = ($('body.admin-bar').length > 0) ? [60, 100] : [60, 100]; 3365 if (nectarDOMInfo.winW < 1000) { 3366 fbMarginArr = [0, 0]; 3367 } 3368 $("[data-fancybox]").fancybox({ 3369 animationEffect: "zoom-in-out", 3370 animationDuration: 350, 3371 buttons: [ 3372 'fullScreen', 3373 'zoom', 3374 'close' 3375 ], 3376 margin: fbMarginArr, 3377 backFocus: false, 3378 loop: true, 3379 caption: function() { 3380 return $(this).attr('title'); 3381 }, 3382 hash: false, 3383 beforeLoad: function(instance) { 3384 3385 if (typeof instance.current.src !== 'string') { 3386 $.fancybox.close(true); 3387 } 3388 3389 }, 3390 mobile: { 3391 margin: 0 3392 } 3393 }); 3394 } 3395 3396 /** 3397 * Magnific lightbox. 3398 * 3399 * @since 6.0 3400 */ 3401 function magnificInit() { 3402 3403 // Convert old pp links 3404 $('a.pp') 3405 .removeClass('pp') 3406 .addClass('magnific-popup'); 3407 3408 $("a[rel^='prettyPhoto']:not([rel*='_gal']):not([rel*='product-gallery']):not([rel*='prettyPhoto['])") 3409 .removeAttr('rel') 3410 .addClass('magnific-popup'); 3411 3412 // Image gallery nectar. 3413 $('.wpb_gallery .wpb_gallery_slidesnectarslider_style').each(function() { 3414 $(this).find('.swiper-slide a:not(.ext-url-link)').addClass('pretty_photo'); 3415 }); 3416 3417 // Flexslider. 3418 $('.wpb_gallery_slides.wpb_flexslider:not([data-onclick="custom_link"])').each(function() { 3419 $(this).find('.slides > li > a').addClass('pretty_photo'); 3420 }); 3421 3422 // Touch enabled gallery. 3423 $('.wpb_gallery_slidesflickity_style, .wpb_gallery_slidesflickity_static_height_style').each(function() { 3424 $(this).find('.cell > a:not(.ext-url-link)').addClass('pretty_photo'); 3425 }); 3426 3427 // Add galleries to portfolios. 3428 $('.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() { 3429 3430 if ($(this).find('.pretty_photo').length > 0) { 3431 3432 $(this) 3433 .find('.pretty_photo') 3434 .removeClass('pretty_photo') 3435 .addClass('gallery') 3436 .addClass('magnific'); 3437 3438 } else if ($(this).find('a[rel*="prettyPhoto["]').length > 0) { 3439 3440 $(this) 3441 .find('a[rel*="prettyPhoto["]') 3442 .removeAttr('rel') 3443 .addClass('gallery') 3444 .addClass('magnific'); 3445 } 3446 3447 }); 3448 3449 $("a[data-rel='prettyPhoto[product-gallery]']").each(function() { 3450 $(this) 3451 .removeAttr('data-rel') 3452 .addClass('magnific') 3453 .addClass('gallery'); 3454 }); 3455 3456 // Nectar auto lightbox theme option. 3457 if ($body.hasClass('nectar-auto-lightbox')) { 3458 $('.gallery').each(function() { 3459 if ($(this).find('.gallery-icon a[rel^="prettyPhoto"]').length == 0) { 3460 3461 $(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"]') 3462 .addClass('magnific') 3463 .addClass('gallery') 3464 .removeClass('pretty_photo'); 3465 } 3466 }); 3467 3468 $('.main-content img').each(function() { 3469 3470 if ($(this).parent().is("[href]") && 3471 !$(this).parent().is(".magnific-popup") && 3472 $(this).parents('.tiled-gallery').length == 0 && 3473 $(this).parents('.product-image').length == 0 && 3474 $(this).parents('.iosSlider.product-slider').length == 0) { 3475 3476 var match = $(this).parent().attr('href').match(/\.(jpg|png|gif)\b/); 3477 if (match) { 3478 3479 $(this).parent() 3480 .addClass('magnific-popup') 3481 .addClass('image-link'); 3482 } 3483 } 3484 3485 }); 3486 3487 } 3488 3489 3490 // Regular. 3491 $('a.magnific-popup:not(.gallery):not(.nectar_video_lightbox)').magnificPopup({ 3492 type: 'image', 3493 callbacks: { 3494 imageLoadComplete: function() { 3495 var $that = this; 3496 setTimeout(function() { 3497 $that.wrap.addClass('mfp-image-loaded'); 3498 }, 10); 3499 }, 3500 beforeOpen: function() { 3501 this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim'); 3502 }, 3503 open: function() { 3504 3505 $.magnificPopup.instance.next = function() { 3506 var $that = this; 3507 3508 this.wrap.removeClass('mfp-image-loaded'); 3509 setTimeout(function() { 3510 $.magnificPopup.proto.next.call($that); 3511 }, 100); 3512 }; 3513 3514 $.magnificPopup.instance.prev = function() { 3515 var $that = this; 3516 3517 this.wrap.removeClass('mfp-image-loaded'); 3518 setTimeout(function() { 3519 $.magnificPopup.proto.prev.call($that); 3520 }, 100); 3521 }; 3522 3523 } 3524 },
3525 fixedContentPos: false, 3526 mainClass: 'mfp-zoom-in', 3527 removalDelay: 400 3528 }); 3529 3530 // Video. 3531 $('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({ 3532 type: 'iframe', 3533 fixedContentPos: false, 3534 mainClass: 'mfp-zoom-in', 3535 removalDelay: 400 3536 }); 3537 3538 3539 // Galleries. 3540 $('a.magnific.gallery').each(function() { 3541 3542 var $parentRow = ($(this).closest('.wpb_column').length > 0) ? $(this).closest('.wpb_column') : $(this).parents('.row'); 3543 3544 if ($parentRow.length > 0 && !$parentRow.hasClass('lightbox-col')) { 3545 3546 $parentRow.magnificPopup({ 3547 type: 'image', 3548 delegate: 'a.magnific', 3549 mainClass: 'mfp-zoom-in', 3550 fixedContentPos: false, 3551 callbacks: { 3552 3553 elementParse: function(item) { 3554 3555 if ($(item.el).is('[href]') && $(item.el).attr('href').indexOf('iframe=true') != -1 || 3556 $(item.el).is('[href]') && $(item.el).attr('href').indexOf('https://www.youtube.com/watch') != -1) { 3557 item.type = 'iframe'; 3558 } else if ($(item.el).is('[href]') && $(item.el).attr('href').indexOf('video-popup-') != -1) { 3559 item.type = 'inline'; 3560 } else { 3561 item.type = 'image'; 3562 } 3563 }, 3564 3565 imageLoadComplete: function() { 3566 var $that = this; 3567 setTimeout(function() { 3568 $that.wrap.addClass('mfp-image-loaded'); 3569 }, 10); 3570 }, 3571 3572 beforeOpen: function() { 3573 this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim'); 3574 }, 3575 3576 open: function() { 3577 3578 // Self hosted video. 3579 if ($(this.content).find('.mejs-video video').length > 0 && $().mediaelementplayer) { 3580 $(this.content).find('.mejs-video video')[0].player.remove(); 3581 3582 var $that = this; 3583 setTimeout(function() { 3584 $($that.content).find('video').mediaelementplayer(); 3585 $($that.content).find('.mejs-video video')[0].player.play(); 3586 }, 50); 3587 3588 } 3589 3590 $.magnificPopup.instance.next = function() { 3591 var $that = this; 3592 3593 this.wrap.removeClass('mfp-image-loaded'); 3594 setTimeout(function() { 3595 $.magnificPopup.proto.next.call($that); 3596 3597 // Self hosted video. 3598 if ($($that.content).find('.mejs-video video').length > 0) { 3599 $($that.content).find('.mejs-video video')[0].play(); 3600 } 3601 3602 }, 100); 3603 }; 3604 3605 $.magnificPopup.instance.prev = function() { 3606 var $that = this; 3607 3608 this.wrap.removeClass('mfp-image-loaded'); 3609 setTimeout(function() { 3610 $.magnificPopup.proto.prev.call($that); 3611 3612 // Self hosted video. 3613 if ($($that.content).find('.mejs-video video').length > 0) { 3614 $($that.content).find('.mejs-video video')[0].play(); 3615 } 3616 }, 100); 3617 }; 3618 3619 }, 3620 3621 close: function() { 3622 // Self hosted video. 3623 if ($(this.content).find('.mejs-video video').length > 0) { 3624 $(this.content).find('.mejs-video video')[0].load(); 3625 } 3626 } 3627 }, 3628 removalDelay: 400, 3629 gallery: { 3630 enabled: true 3631 } 3632 }); 3633 3634 $parentRow.addClass('lightbox-col'); 3635 } 3636 3637 }); 3638 3639 } 3640 3641 3642 /** 3643 * Lightbox initialization. 3644 * 3645 * Determines which lightbox to use based on theme option. 3646 * 3647 * @since 8.0 3648 */ 3649 function lightBoxInit() { 3650 3651 setTimeout(function(){ 3652 if ($('body[data-ls="magnific"]').length > 0 || $('body[data-ls="pretty_photo"]').length > 0) { 3653 magnificInit(); 3654 } else if ($('body[data-ls="fancybox"]').length > 0) { 3655 fancyBoxInit(); 3656 } 3657 },100); 3658 3659 } 3660 3661 3662 /** 3663 * WPBakery page builder standard animations. 3664 * 3665 * @since 7.0 3666 * @see waypoints 3667 */ 3668 function vcWaypoints() { 3669 3670 $($fullscreenSelector + ' .wpb_animate_when_almost_visible').each(function () { 3671 3672 var $that = $(this), 3673 $vcOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : '90%', 3674 waypoint = new Waypoint({ 3675 element: $that, 3676 handler: function () { 3677 3678 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated')) { 3679 waypoint.destroy(); 3680 return; 3681 } 3682 3683 $that.addClass("animated"); 3684 $that.addClass("wpb_start_animation"); 3685 waypoint.destroy(); 3686 3687 if ($that.is('.nectar-button') && $('body[data-button-style*="rounded_shadow"]').length > 0) { 3688 setTimeout(function () { 3689 $that.removeClass('wpb_start_animation'); 3690 }, 1100); 3691 } 3692 3693 }, 3694 offset: $vcOffsetPos 3695 3696 }); 3697 3698 }); 3699 } 3700 3701 3702 /** 3703 * Nectar Rotating Words Title 3704 * 3705 * @since 13.0 3706 */ 3707 function NectarRotatingWords(el,dur) { 3708 3709 this.$el = el; 3710 this.duration = dur; 3711 3712 this.interval = ''; 3713 this.words = []; 3714 3715 this.state = { 3716 activeIndex: 0, 3717 sequenceStarted: 0, 3718 visible: false 3719 }; 3720 3721 this.setup(); 3722 3723 } 3724 3725 NectarRotatingWords.prototype.setup = function() { 3726 3727 var that = this; 3728 3729 this.$el.find('.dynamic-words > span').each(function(i) { 3730 that.words[i] = $(this); 3731 }); 3732 3733 // In View. 3734 this.viewportTracking(); 3735 3736 // Waypoint. 3737 if( this.$el.hasClass('element_stagger_words') ) { 3738 this.staggerWaypoint(); 3739 $(window).on('nectar-waypoints-reinit nectar-tab-changed', this.staggerWaypoint.bind(this)); 3740 } 3741 else { 3742 // Start sequence immediately. 3743 clearInterval(this.interval); 3744 3745 this.interval = setInterval(this.sequence.bind(this), this.duration); 3746 } 3747 3748 if( !nectarDOMInfo.usingMobileBrowser ) { 3749 $(window).on('resize', this.calcWidth.bind(this)); 3750 } else { 3751 window.addEventListener("orientationchange", this.calcWidth.bind(this)); 3752 } 3753 3754 }; 3755 3756 NectarRotatingWords.prototype.viewportTracking = function() { 3757 3758 var that = this; 3759 3760 if( 'IntersectionObserver' in window ) { 3761 3762 var options = { 3763 rootMargin: '0px', 3764 threshold: 0 3765 } 3766 3767 this.observer = new IntersectionObserver(function(entries) { 3768
3769 entries.forEach(function(entry) { 3770 if ( entry.isIntersecting ) { 3771 that.state.visible = true; 3772 } else { 3773 that.state.visible = false; 3774 } 3775 }); 3776 3777 }, options); 3778 3779 this.observer.observe(this.$el[0]); 3780 3781 3782 } else { 3783 // fallback. 3784 this.state.visible = true; 3785 } 3786 3787 } 3788 3789 NectarRotatingWords.prototype.calcWidth = function() { 3790 3791 var that = this; 3792 var storedWidth = this.$el.find('.dynamic-words').width(); 3793 3794 this.$el.find('.dynamic-words').css({ 'width': '' }); 3795 3796 var width = this.words[this.state.activeIndex].find('span').width(); 3797 3798 this.$el.find('.dynamic-words').css({ 3799 'width': storedWidth 3800 }); 3801 3802 setTimeout(function(){ 3803 that.$el.find('.dynamic-words').css({ 3804 'width': width 3805 }); 3806 },30); 3807 3808 } 3809 3810 NectarRotatingWords.prototype.sequence = function() { 3811 3812 if( this.$el.find('.dynamic-words > span').length < 2 || this.state.visible == false ) { 3813 return true; 3814 } 3815 3816 this.state.activeIndex = wrap( this.words.length, this.state.activeIndex + 1 ); 3817 3818 this.calcWidth(); 3819 3820 this.$el.find('.dynamic-words > span').removeClass('active'); 3821 3822 this.words[this.state.activeIndex].addClass('active'); 3823 3824 }; 3825 3826 NectarRotatingWords.prototype.staggerWaypoint = function() { 3827 3828 var that = this; 3829 3830 if( $fullscreenMarkupBool == true && this.$el.parents('.active').length == 0 ) { 3831 return true; 3832 } 3833 3834 // Generate Markup 3835 var animatedClass = ( $(this).hasClass('animated-in') ) ? ' animated' : ''; 3836 3837 this.$el.find('.beginning-text, .ending-text').each(function () { 3838 3839 var textArr = $(this).text(); 3840 textArr = textArr.trim(); 3841 textArr = textArr.split(' '); 3842 3843 $(this)[0].innerHTML = ''; 3844 3845 for (var i = 0; i < textArr.length; i++) { 3846 $(this)[0].innerHTML += '<span class="text-wrap"><span class="inner'+animatedClass+'">' + textArr[i] + '</span></span> '; 3847 } 3848 3849 }); 3850 3851 if( this.$el.hasClass('animated-in') ) { 3852 this.$el.find('.beginning-text .inner, .ending-text .inner').css({ 3853 'transform': 'translateY(0)' 3854 }); 3855 } 3856 3857 this.$el.addClass('markup-generated'); 3858 3859 // Waypoint. 3860 var offsetPos = ($fullscreenMarkupBool == true) ? '500%' : 'bottom-in-view'; 3861 3862 var $that = this.$el; 3863 var $delay = ( $that.is('[data-delay]') ) ? parseInt($that.attr('data-delay')) : 0; 3864 3865 var waypoint = new Waypoint({ 3866 element: $that, 3867 handler: function () { 3868 3869 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 3870 waypoint.destroy(); 3871 return; 3872 } 3873 3874 if (!bypassAnimations || $('body[data-responsive="0"]').length > 0) { 3875 3876 var $animationDurationCap; 3877 3878 setTimeout(function() { 3879 3880 var stagger = 0; 3881 stagger = 500 / $that.find('.text-wrap').length; 3882 stagger = Math.min(Math.max(stagger, 15), 50); // Clamp val 3883 3884 $animationDurationCap = (parseInt($animationDuration) < 1100) ? $animationDuration : '1100'; 3885 3886 var i = 0; 3887 $that.find('.text-wrap').each(function () { 3888 3889 var spanEl = $(this); 3890 3891 if( $(this).parents('.dynamic-words').length > 0 && !$(this).hasClass('active') ) { 3892 // hidden words in sequence. 3893 spanEl.find('> span').css({ 3894 'transform': 'translate3d(0,0,0)' 3895 }); 3896 return true; 3897 } 3898 3899 // visible words. 3900 setTimeout(function(){ 3901 spanEl.find('> span').css({ 3902 'transform': 'translate3d(0,0,0)' 3903 }); 3904 }, i * stagger); 3905 3906 i++; 3907 3908 });
3909 3910 $that.addClass('animated-in'); 3911 3912 }, $delay); 3913 3914 } 3915 3916 3917 // start sequence. 3918 if( that.state.sequenceStarted != true ) { 3919 clearInterval(that.interval); 3920 that.interval = setInterval(that.sequence.bind(that), that.duration); 3921 } 3922 3923 that.state.sequenceStarted = true; 3924 3925 waypoint.destroy(); 3926 }, 3927 offset: offsetPos 3928 }); 3929 3930 3931 } 3932 3933 3934 function nectarRotatingWordsInit() { 3935 3936 var rotatingTitles = []; 3937 3938 $('.nectar-rotating-words-title').each(function(i) { 3939 var duration = parseInt($(this).attr('data-rotation')); 3940 rotatingTitles[i] = new NectarRotatingWords($(this), duration); 3941 }); 3942 3943 } 3944 3945 3946 /** 3947 * Milestone element initialization. 3948 * 3949 * @since 4.0 3950 * @see waypoints 3951 */ 3952 function milestoneInit() { 3953 3954 $('.nectar-milestone').each(function () { 3955 3956 // Symbol 3957 if ($(this).is('[data-symbol]')) { 3958 3959 if ($(this).find('.symbol-wrap').length == 0) { 3960 3961 if ($(this).attr('data-symbol-pos') == 'before') { 3962 $(this) 3963 .find('.number') 3964 .prepend('<div class="symbol-wrap"><span class="symbol">' + $(this).attr('data-symbol') + '</span></div>'); 3965 } else { 3966 $(this) 3967 .find('.number') 3968 .append('<div class="symbol-wrap"><span class="symbol">' + $(this).attr('data-symbol') + '</span></div>'); 3969 } 3970 } 3971 3972 var $symbol_size; 3973 3974 if ($(this).attr('data-symbol-size') == $(this).find('.number').attr('data-number-size') && $(this).attr('data-symbol-alignment') == 'superscript') { 3975 $symbol_size = 32; 3976 } else { 3977 $symbol_size = parseInt($(this).attr('data-symbol-size')); 3978 } 3979 3980 $(this).find('.symbol-wrap').css({ 3981 'font-size': $symbol_size + 'px', 3982 'line-height': $symbol_size + 'px' 3983 }); 3984 } 3985 3986 $(this).find('.number').css({ 3987 'font-size': $(this).find('.number').attr('data-number-size') + 'px', 3988 'line-height': $(this).find('.number').attr('data-number-size') + 'px' 3989 }); 3990 }); 3991 3992 if (!bypassAnimations && $('.nectar-milestone').length > 0 || $body.hasClass('rtl') && $('.nectar-milestone').length > 0) { 3993 3994 // Blur effect 3995 var $blurCssString = ''; 3996 $($fullscreenSelector + '.nectar-milestone.motion_blur').each(function (i) { 3997 3998 $(this).removeClass(function (index, className) { 3999 return (className.match(/(^|\s)instance-\S+/g) || []).join(' '); 4000 }); 4001 4002 $(this).addClass('instance-' + i); 4003 4004 var $currentColor = $(this).find('.number').css('color'), 4005 colorInt = parseInt($currentColor.substring(1), 16); 4006 4007 var R = (colorInt & 0xFF0000) >> 16, 4008 G = (colorInt & 0x00FF00) >> 8, 4009 B = (colorInt & 0x0000FF) >> 0; 4010 4011 var $rgbaColorStart = 'rgba(' + R + ',' + G + ',' + B + ',0.2)', 4012 $rgbaColorEnd = 'rgba(' + R + ',' + G + ',' + B + ',1)', 4013 $numberSize = parseInt($(this).find('.number').attr('data-number-size')); 4014 4015 $blurCssString += '@keyframes motion-blur-number-' + i + ' { ' + 4016 ' 0% { ' + 4017 'opacity: 0;' + 4018 'color: ' + $rgbaColorStart + '; ' + 4019 '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 + '; ' + 4020 'transform: translateZ(0px) translateY(-100%); ' + 4021 '-webkit-transform: translateZ(0px) translateY(-100%); ' + 4022 '} ' + 4023 '33% { opacity: 1 }' + 4024 '100% { ' + 4025 'color: ' + $rgbaColorEnd + '; ' + 4026 'text-shadow: none; ' + 4027 'transform: translateZ(0px) translateY(0px); ' + 4028 '-webkit-transform: translateZ(0px) translateY(0px); ' + 4029 '} ' + 4030 '} ' + 4031 '@-webkit-keyframes motion-blur-number-' + i + ' { ' + 4032 ' 0% { ' + 4033 'opacity: 0;' + 4034 'color: ' + $rgbaColorStart + '; ' + 4035 '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 + '; ' + 4036 'transform: translateZ(0px) translateY(-100%); ' + 4037 '-webkit-transform: translateZ(0px) translateY(-100%); ' + 4038 '} ' + 4039 '33% { opacity: 1 }' + 4040 '100% { ' + 4041 'color: ' + $rgbaColorEnd + '; ' + 4042 'text-shadow: none; ' + 4043 'transform: translateZ(0px) translateY(0px); ' + 4044 '-webkit-transform: translateZ(0px) translateY(0px); ' + 4045 '} ' + 4046 '} ' + 4047 '.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 + '; } '; 4048 4049 if( $nectarFullPage.$usingFullScreenRows != false || $(this).find('.number > span').length == 0 ) { 4050 4051 // Separate each character into spans 4052 var $symbol = $(this).find('.symbol-wrap').clone(); 4053 $(this).find('.symbol-wrap').remove(); 4054 4055 var characters = $(this).find('.number').text().split(""); 4056 var $this = $(this).find('.number'); 4057 4058 $this.empty(); 4059 $.each(characters, function (i, el) { 4060 $this.append("<span>" + el + "</span"); 4061 });
4062 4063 // Handle symbol 4064 if ($(this).has('[data-symbol]')) { 4065 if ($(this).attr('data-symbol-pos') == 'after') { 4066 $this.append($symbol); 4067 } else { 4068 $this.prepend($symbol); 4069 } 4070 } 4071 4072 } // already made markup 4073 4074 }); 4075 4076 // Style 4077 nectarCreateStyle($blurCssString, 'milestone-blur'); 4078 4079 // Activate 4080 milestoneWaypoint(); 4081 4082 } 4083 4084 } 4085 4086 4087 /** 4088 * Milestone animation 4089 * 4090 * @since 4.0 4091 */ 4092 function milestoneWaypoint() { 4093 4094 $($fullscreenSelector + '.nectar-milestone').each(function () { 4095 4096 // Animation 4097 var $offset = ($fullscreenMarkupBool == true) ? '250%' : '98%'; 4098 4099 if( nectarDOMInfo.usingMobileBrowser && $offset == '98%') { 4100 $offset = '110%'; 4101 } 4102 4103 var $that = $(this), 4104 waypoint = new Waypoint({ 4105 element: $that, 4106 handler: function () { 4107 4108 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 4109 waypoint.destroy(); 4110 return; 4111 } 4112 4113 var $endNum = parseInt($that.find('.number span:not(.symbol)').text().replace(/,/g, '')); 4114 4115 if (!$that.hasClass('motion_blur')) { 4116 4117 var countOptions = { 4118 easingFn: easeOutCubic 4119 }; 4120 var $countEle = $that.find('.number span:not(.symbol)')[0]; 4121 var numAnim = new CountUp($countEle, 0, $endNum, 0, 2.2, countOptions); 4122 numAnim.start(); 4123 4124 } else { 4125 $that.find('span').each(function (i) { 4126 var $that = $(this); 4127 setTimeout(function () { 4128 $that.addClass('in-sight'); 4129 }, 200 * i); 4130 }); 4131 } 4132 4133 4134 $that.addClass('animated-in'); 4135 waypoint.destroy(); 4136 }, 4137 offset: $offset 4138 4139 }); 4140 4141 }); 4142 } 4143 4144 4145 4146 /** 4147 * Tabbed element change section event. 4148 * 4149 * @since 10.5 4150 */ 4151 function tabbedChangeSection(clickedTab) { 4152 4153 var $id = clickedTab.parents('li').index() + 1; 4154 var $frontEndEditorTabDiv = ($('body.vc_editor').length > 0) ? '> .wpb_tab ' : ''; 4155 4156 if (!clickedTab.hasClass('active-tab') && !clickedTab.hasClass('loading')) { 4157 4158 clickedTab.parents('ul') 4159 .find('a') 4160 .removeClass('active-tab'); 4161 4162 clickedTab 4163 .addClass('active-tab'); 4164 4165 clickedTab.parents('.tabbed').find('> div:not(.clear)' + $frontEndEditorTabDiv).css({ 4166 'visibility': 'hidden', 4167 'position': 'absolute', 4168 'opacity': '0', 4169 'left': '-9999px', 4170 'display': 'none' 4171 }).removeClass('visible-tab'); 4172 4173 if ($('body.vc_editor').length > 0) { 4174 4175 var $data_m_id = (clickedTab.parent().is('[data-m-id]')) ? clickedTab.parent().attr('data-m-id') : ''; 4176 4177 clickedTab.parents('.tabbed').find('> div[data-model-id="' + $data_m_id + '"]' + $frontEndEditorTabDiv).css({ 4178 'visibility': 'visible', 4179 'position': 'relative', 4180 'left': '0', 4181 'display': 'block' 4182 }).stop().transition({ 4183 'opacity': 1 4184 }, 400).addClass('visible-tab'); 4185 4186 if( !$body.is('[data-flex-cols="true"]') ) { 4187 convertFrontEndPadding(); 4188 } 4189 4190 } else { 4191 clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ')' + $frontEndEditorTabDiv).css({ 4192 'visibility': 'visible', 4193 'position': 'relative', 4194 'left': '0', 4195 'display': 'block' 4196 }).stop().transition({ 4197 'opacity': 1 4198 }, 400).addClass('visible-tab'); 4199 } 4200 4201 if (clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ') .iframe-embed').length > 0 || 4202 clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ') .portfolio-items').length > 0) { 4203 setTimeout(function () { 4204 $window.trigger('resize'); 4205 }, 10); 4206 } 4207 } 4208 4209 // Waypoint checking 4210 if ($tabbedClickCount != 0) { 4211 4212 var $currentVisTab = clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ')' + $frontEndEditorTabDiv); 4213 4214 if ($currentVisTab.find('.nectar-progress-bar').length > 0) { 4215 progressBars(); 4216 } 4217 if ($currentVisTab.find('.divider-small-border [data-animate="yes"]').length > 0 || 4218 $currentVisTab.find('.divider-border [data-animate="yes"]').length > 0) { 4219 dividers(); 4220 } 4221 if ($currentVisTab.find('img.img-with-animation').length > 0 || 4222 $currentVisTab.find('.col.has-animation').length > 0 || 4223 $currentVisTab.find('.nectar_cascading_images').length > 0 || 4224 $currentVisTab.find('.wpb_column.has-animation').length > 0) { 4225 colAndImgAnimations();
4226 cascadingImageBGSizing(); 4227 } 4228 if ($currentVisTab.find('.parallax-layer').length > 0) { 4229 parallaxRowsBGCals(); 4230 for(var i=0; i < parallaxItemsArr.length; i++ ) { 4231 parallaxItemsArr[i].resize(); 4232 } 4233 } 4234 if ($currentVisTab.find('.nectar-milestone').length > 0) { 4235 milestoneWaypoint(); 4236 } 4237 if ($currentVisTab.find('.nectar_image_with_hotspots[data-animation="true"]').length > 0) { 4238 imageWithHotspots(); 4239 setTimeout(function(){ 4240 $window.trigger('resize'); 4241 },100); 4242 } 4243 if ($currentVisTab.find('.nectar-fancy-ul').length > 0) { 4244 nectarFancyUlInit(); 4245 } 4246 if ($currentVisTab.find('.nectar-split-heading').length > 0) { 4247 splitLineHeadings(); 4248 } 4249 if ($currentVisTab.find('.wpb_column[data-border-animation="true"]').length > 0) { 4250 animatedColBorders(); 4251 } 4252 if ($currentVisTab.find('.wpb_animate_when_almost_visible').length > 0) { 4253 vcWaypoints(); 4254 } 4255 if ($currentVisTab.find('.nectar-animated-title').length > 0) { 4256 animatedTitles(); 4257 } 4258 if ($currentVisTab.find('.nectar-highlighted-text').length > 0) { 4259 highlightedText(); 4260 } 4261 if ($currentVisTab.find('.nectar_food_menu_item').length > 0) { 4262 foodMenuItems(); 4263 } 4264 if ($currentVisTab.find('.nectar-post-grid:not([data-animation="none"])').length > 0) { 4265 NectarPostGridWaypoint(); 4266 } 4267 4268 if (clickedTab.parents('.wpb_row').length > 0) { 4269 4270 if ($currentVisTab.find('.vc_pie_chart').length > 0 || 4271 $currentVisTab.find('.wp-video-shortcode').length > 0 || 4272 $currentVisTab.find('.post-area.masonry .posts-container').length > 0 || 4273 $currentVisTab.find('.twentytwenty-container').length > 0 || 4274 clickedTab.parents('#nectar_fullscreen_rows[data-content-overflow="scrollbar"]').length > 0 || 4275 clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ')').find('.wpb_gallery').length > 0 || 4276 clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ')').find('.swiper-container').length > 0 || 4277 clickedTab.parents('.wpb_row').next().hasClass('parallax_section')) { 4278 $window.trigger('resize'); 4279 } 4280 4281 if ($currentVisTab.find('.nectar-flickity').length > 0 && typeof Flickity != 'undefined') { 4282 var tabbedFlkty = Flickity.data(clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ')').find('.nectar-flickity')[0]); 4283 tabbedFlkty.resize(); 4284 } 4285 4286 if ($currentVisTab.find('.nectar-woo-flickity').length > 0 && typeof Flickity != 'undefined') { 4287 var wootabbedFlkty = Flickity.data(clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ')').find('.nectar-woo-flickity > ul')[0]); 4288 wootabbedFlkty.resize(); 4289 $(window).trigger('nectar-product-filters-layout'); 4290 } 4291 4292 } 4293 4294 //SVG icons 4295 $currentVisTab.find('.svg-icon-holder').each(function (i) { 4296 4297 var $that = $(this); 4298 4299 setTimeout(function () { 4300 4301 var $animationDelay = 0; 4302 4303 if($that.is('[data-animation-delay]') && 4304 $that.attr('data-animation-delay').length > 0 && 4305 $that.attr('data-animation') != 'false') { 4306 $animationDelay = $that.attr('data-animation-delay'); 4307 } 4308 4309 clearTimeout($animatedSVGIconTimeout[i]); 4310 4311 if ($that.attr('data-animation') == 'false') { 4312 $that.css('opacity', '1'); 4313 $svgIcons[$that.find('svg').attr('id').slice(-1)].finish(); 4314 } else { 4315 4316 $svgIcons[$that.find('svg').attr('id').slice(-1)].reset(); 4317 $animatedSVGIconTimeout[i] = setTimeout(function () { 4318 $svgIcons[$that.find('svg').attr('id').slice(-1)].play(); 4319 }, $animationDelay); 4320 4321 } 4322 }, 150); 4323 }); 4324 4325 } 4326 4327 // Fix columns inside tabs 4328 clickedTab.parents('.tabbed').find('.wpb_row').each(function () { 4329 if (typeof $(this).find('[class*="vc_col-"]').first().offset() != 'undefined') { 4330 4331 var $firstChildOffset = $(this).find('[class*="vc_col-"]').first().offset().left; 4332 4333 $(this).find('[class*="vc_col-"]').each(function () { 4334 $(this).removeClass('no-left-margin'); 4335 if ($(this).offset().left < $firstChildOffset + 15) { 4336 $(this).addClass('no-left-margin'); 4337 } else { 4338 $(this).removeClass('no-left-margin'); 4339 } 4340 });
4341 } 4342 4343 }); 4344 4345 $tabbedClickCount++; 4346 4347 // Magic line 4348 if (clickedTab.parent().parent().find('.magic-line').length > 0) { 4349 magicLineCalc(clickedTab); 4350 } 4351 4352 $(window).trigger('nectar-tab-changed'); 4353 4354 } 4355 4356 4357 /** 4358 * Tabbed element magic line - used for style "Minimal alt" 4359 * 4360 * @since 7.0 4361 */ 4362 function magicLineCalc($ele) { 4363 4364 var el, leftPos, ratio; 4365 4366 el = $ele.parent(); 4367 if (el.length) { 4368 leftPos = el.position().left; 4369 ratio = el.width(); 4370 } else { 4371 leftPos = ratio = 0; 4372 } 4373 4374 4375 $ele.parent().parent() 4376 .find('.magic-line') 4377 .css('transform', 'translateX(' + leftPos + 'px) scaleX(' + ratio + ')'); 4378 } 4379 4380 4381 /** 4382 * Tabbed element deep linking. 4383 * 4384 * @since 3.0 4385 */ 4386 function tabbbedDeepLinking() { 4387 4388 if (typeof nectarGetQueryParam['tab'] != 'undefined') { 4389 4390 $('.wpb_tabs_nav').each(function () { 4391 4392 $(this).find('li').each(function () { 4393 4394 var $currentText = $(this).find('a').clone(), 4395 $getText = nectarGetQueryParam['tab'], 4396 $that = $(this); 4397 4398 $currentText.find('svg').remove(); 4399 $currentText = $currentText.text(); 4400 $currentText = $currentText.replace(/\s+/g, '-').toLowerCase(); 4401 4402 // SVG icons. 4403 if( $currentText.length > 0 && $currentText.substring(0,1) === '-' ) { 4404 $currentText = $currentText.substring(1); 4405 } 4406 4407 $getText = $getText.replace(/\s+/g, '-').replace(/</g, '<').replace(/"/g, '"').toLowerCase(); 4408 4409 if ($currentText == $getText) { 4410 4411 $(this).find('a').trigger('click'); 4412 4413 setTimeout(function () { 4414 $that.find('a').trigger('click'); 4415 }, 501); 4416 } 4417 4418 }); 4419 4420 }); 4421 4422 } 4423 4424 } 4425 4426 4427 4428 /** 4429 * Tabbed element initialization. 4430 * 4431 * @since 3.0 4432 */ 4433 function tabbedInit() { 4434 4435 // Click event. 4436 $body.on('click', '.tabbed > ul li:not(.cta-button) a', function(e){ 4437 4438 tabbedChangeSection($(this)); 4439 4440 // Mobile scroll to. 4441 if (e.originalEvent !== undefined && nectarDOMInfo.winW < 1000 && $nectarFullPage.$usingFullScreenRows == false) { 4442 4443 // Ensure that it would be needed. 4444 var $tabbedNav = $(this).closest('.tabbed').find('> ul'); 4445 4446 if( $tabbedNav.height() > 350 ) { 4447 4448 var $scrollTopDistance = $tabbedNav.offset().top + $tabbedNav.height() - nectarDOMInfo.adminBarHeight; 4449 4450 if( $('#header-outer[data-mobile-fixed="1"]').length > 0 ) { 4451 $scrollTopDistance = $tabbedNav.offset().top + $tabbedNav.height() - $headerOuterEl.outerHeight() - nectarDOMInfo.adminBarHeight 4452 } 4453 4454 nectar_scrollToY($scrollTopDistance, 700, 'easeInOutQuint'); 4455 } 4456 4457 } 4458 4459 return false; 4460 }); 4461 4462 // Custom user def anchor click event helper. 4463 $('a[class*="nectar-tab-trigger"]').on('click', function(e) { 4464 4465 // verify the link is setup correct. 4466 if( !$(this).is('[href*="#"]') || $(this).attr('href').length < 1 ) { 4467 return true; 4468 } 4469 4470 var clickedTrigger = $(this).attr('href'); 4471 clickedTrigger = clickedTrigger.substr(1); 4472 clickedTrigger = clickedTrigger.replace(/\s+/g, '-').replace(/</g, '<').replace(/"/g, '"').toLowerCase(); 4473 4474 $('.wpb_tabs_nav').each(function () { 4475 4476 $(this).find('li').each(function () { 4477 4478 var $currentText = $(this).find('a').clone(); 4479 4480 $currentText.find('svg').remove(); 4481 $currentText = $currentText.text(); 4482 $currentText = $currentText.replace(/\s+/g, '-').toLowerCase(); 4483 4484 // SVG icons. 4485 if( $currentText.length > 0 && $currentText.substring(0,1) === '-' ) { 4486 $currentText = $currentText.substring(1); 4487 } 4488 4489 // trigger. 4490 if ($currentText == clickedTrigger) { 4491 $(this).find('a').trigger('click'); 4492 } 4493 4494 }); 4495 4496 }); 4497 4498 e.preventDefault(); 4499 4500 }); 4501 4502 4503 $('.tabbed').each(function () { 4504 4505 var $that; 4506 4507 // Handle icons 4508 $(this).find('.wpb_tab').each(function (i) { 4509 4510 if ($(this).is('[data-tab-icon]') && $(this).attr('data-tab-icon').length > 0) { 4511 4512 $(this) 4513 .parents('.tabbed') 4514 .addClass('using-icons'); 4515 4516 $(this) 4517 .parents('.tabbed') 4518 .find('.wpb_tabs_nav li:nth-child(' + (i + 1) + ') > a') 4519 .prepend('<i class="' + $(this).attr("data-tab-icon") + '"></i>'); 4520 4521 } 4522 4523 // SVG icons 4524 if ($(this).find('.im-icon-wrap.tab-icon').length > 0) { 4525 4526 var $svg_icon_markup = $(this).find('.im-icon-wrap.tab-icon').detach(); 4527 $(this).parents('.tabbed') 4528 .find('.wpb_tabs_nav li:nth-child(' + (i + 1) + ') > a') 4529 .prepend($svg_icon_markup); 4530 } 4531 4532 }); 4533 4534 4535 $(this).find('> ul li:first-child a').trigger('click'); 4536 4537 $that = $(this); 4538 4539 // Minimal alt effect 4540 setTimeout(function () { 4541 if ($that.is('[data-style="minimal_alt"]')) { 4542 $that.find('> ul').append('<li class="magic-line" />'); 4543 magicLineCalc($that.find('> ul > li:first-child > a')); 4544 } 4545 }, 100); 4546 4547 4548 }); 4549 4550 // Minimal alt resize event. 4551 if ( $('.tabbed[data-style="minimal_alt"]').length > 0 ) { 4552 $window.on('smartresize',function(){ 4553 4554 $('.tabbed[data-style="minimal_alt"]').each(function(){ 4555 4556 if( $(this).find('a.active-tab').length > 0 ) { 4557 magicLineCalc( $(this).find('a.active-tab') ); 4558 } 4559 4560 });
4561 4562 4563 }); 4564 4565 } 4566 4567 4568 tabbbedDeepLinking(); 4569 4570 // Vertical scrolling 4571 $('.nectar-scrolling-tabs').each(function(i) { 4572 if(!nectarDOMInfo.usingFrontEndEditor) { 4573 $verticalScrollingTabs[i] = new VerticalScrollingTabs($(this)); 4574 } 4575 }); 4576 4577 // Tab change event. 4578 $(window).on('nectar-tab-changed', wooProductCarouselAnimations); 4579 4580 4581 } 4582 4583 4584 /** 4585 * Vertical Scrolling Tabs 4586 * 4587 * @since 12.0 4588 */ 4589 4590 function VerticalScrollingTabs(el) { 4591 4592 this.$el = el; 4593 this.$tabContent = el.find('.scrolling-tab-content'); 4594 this.$lineEl = el.find('.scrolling-tab-nav .line'); 4595 this.observer = null; 4596 4597 this.domSetup(); 4598 this.highlightObserve(); 4599 // Sticky handled in NectarStickyEls(); 4600 4601 } 4602 4603 VerticalScrollingTabs.prototype.domSetup = function() { 4604 4605 var that = this; 4606 var href = ''; 4607 4608 4609 // Icons 4610 this.$el.find('.wpb_tab').each(function (i) { 4611 4612 if ($(this).is('[data-tab-icon]') && $(this).attr('data-tab-icon').length > 0) { 4613 that.$el.addClass('using-icons'); 4614 4615 href = that.$el.find('.wpb_tabs_nav li:nth-child(' + (i + 1) + ') a').attr('href'); 4616 4617 that.$el 4618 .find('.wpb_tabs_nav li:nth-child(' + (i + 1) + ')') 4619 .addClass('has-icon') 4620 .prepend('<a class="skip-hash" href="'+href+'"><i class="' + $(this).attr("data-tab-icon") + '"></i></a>'); 4621 } 4622 4623 // SVG icons 4624 if ($(this).find('.im-icon-wrap.tab-icon').length > 0) { 4625 4626 href = that.$el.find('.wpb_tabs_nav li:nth-child(' + (i + 1) + ') a').attr('href'); 4627 4628 var $svg_icon_markup = $(this).find('.im-icon-wrap.tab-icon').detach(); 4629 that.$el 4630 .find('.wpb_tabs_nav li:nth-child(' + (i + 1) + ')') 4631 .addClass('has-icon') 4632 .prepend('<a class="skip-hash svg-icon-link" href="'+href+'"></a>'); 4633 4634 that.$el.find('.wpb_tabs_nav li:nth-child(' + (i + 1) + ') .svg-icon-link').append($svg_icon_markup); 4635 4636 } 4637 4638 }); 4639 4640 4641 // First active 4642 this.$el.find('.scrolling-tab-nav .menu-item:first').addClass('active'); 4643 this.lineAnimation(); 4644 4645 // Only tab 4646 if( this.$el.find('.scrolling-tab-nav .menu-item').length == 1 ) { 4647 this.$el.find('.scrolling-tab-nav').addClass('single-tab'); 4648 } 4649 4650 var $tabContent = this.$el.find('.scrolling-tab-content'); 4651 4652 this.$el.find('.scrolling-tab-nav .menu-item').each(function(i) { 4653 4654 i = i+1; 4655 var $tab = $tabContent.find('> div:nth-child('+i+')'); 4656 4657 // Add titles to mobile 4658 var $title = $(this).html(); 4659 $tab.prepend('<div class="scrolling-tab-mobile-title"><div class="inner">' + wlEls($title) + '</div></div>'); 4660 $tab.find('.scrolling-tab-mobile-title a').contents().unwrap(); 4661 4662 // Create normal anchor relation. 4663 if( $tab ) { 4664 var id = $(this).find('a').attr('href'); 4665 id = id.substr(1); 4666 $tab.find('> .scrolling-tab-mobile-title').attr('id',id); 4667 $tab.removeAttr('id'); 4668 } 4669 4670 }); 4671 4672 this.$el.addClass('initalized'); 4673 4674 }; 4675 4676 VerticalScrollingTabs.prototype.highlightObserve = function() { 4677 4678 var that = this; 4679 4680 if( !(nectarDOMInfo.usingMobileBrowser && nectarDOMInfo.winW < 1000) ) { 4681 4682 if( 'IntersectionObserver' in window ) { 4683 4684 var rMarign = ($headerOuterEl.is('[data-remove-fixed="1"]')) ? '100px 0px 0px 0px' : '5px 0px 0px 0px'; 4685 4686 var options = { 4687 rootMargin: rMarign, 4688 threshold: 1 4689 } 4690 4691 this.observer = new IntersectionObserver(function(entries) { 4692 4693 entries.forEach(function(entry) { 4694 4695 var href = '#' + $(entry.target).attr('id'); 4696 var $menuItem = that.$el.find('.scrolling-tab-nav a[href="'+href+'"]'); 4697 4698 if (entry.isIntersecting && entry.intersectionRatio >= 1) { 4699 4700 $menuItem.parents('.menu-item').addClass('visible'); 4701 4702 } else { 4703 $menuItem.parents('.menu-item').removeClass('visible'); 4704 } 4705 4706 // Highlight 4707 var $firstVisLink = that.$el.find('.scrolling-tab-nav .menu-item.visible:first'); 4708 4709 // a link is visible 4710 if( $firstVisLink.length > 0 ) { 4711 that.$el.find('.scrolling-tab-nav .menu-item').removeClass('active'); 4712 $firstVisLink.addClass('active'); 4713 that.lineAnimation(); 4714 } 4715 4716 4717 });
4718 4719 }, options); 4720 4721 // Observe each section. 4722 this.$tabContent.find('> div > .scrolling-tab-mobile-title[id]').each(function() { 4723 that.observer.observe($(this)[0]); 4724 }); 4725 4726 } // if intersection observer. 4727 4728 } // don't trigger on mobile. 4729 4730 }; 4731 4732 VerticalScrollingTabs.prototype.lineAnimation = function() { 4733 4734 var activeItem = this.$el.find('.scrolling-tab-nav .active'); 4735 4736 if( activeItem.length == 0 ) { 4737 return; 4738 } 4739 4740 var itemOffset = parseInt(activeItem.position().top); 4741 var itemHeight = parseInt(activeItem.height()); 4742 4743 this.$lineEl.css({ 4744 'max-height': itemHeight + 'px', 4745 'transform' : 'translate3d(0px, '+itemOffset+'px, 0px)' 4746 }); 4747 4748 }; 4749 4750 4751 4752 4753 4754 4755 4756 4757 /** 4758 * Toggle Panels element deep linking. 4759 * 4760 * @since 3.0 4761 */ 4762 function accordionDeepLinking() { 4763 4764 if (typeof nectarGetQueryParam['toggle'] != 'undefined') { 4765 $('.toggles').each(function () { 4766 4767 $(this).find('.toggle').each(function () { 4768 var $currentText = $(this).find('h3 a').clone(); 4769 var $getText = nectarGetQueryParam['toggle']; 4770 4771 $($currentText).find('i').remove(); 4772 $currentText = $currentText.text(); 4773 $currentText = $currentText.replace(/\s+/g, '-').toLowerCase(); 4774 $getText = $getText.replace(/\s+/g, '-').replace(/</g, '<').replace(/"/g, '"').toLowerCase(); 4775 4776 if ($currentText == $getText) { 4777 $(this).find('h3 a').trigger('click'); 4778 } 4779 }); 4780 }); 4781 } 4782 4783 } 4784 4785 4786 4787 4788 function accordionSizing() { 4789 4790 $('.toggles').each(function(){ 4791 4792 var openToggle = $(this).find('.toggle.open'); 4793 4794 if( openToggle.length > 0 ) { 4795 4796 openToggle.each(function() { 4797 var openToggleInner = $(this).find('> div')[0]; 4798 openToggleInner.style.maxHeight = openToggleInner.scrollHeight + "px"; 4799 }); 4800 4801 } 4802 4803 4804 }); 4805 4806 } 4807 4808 /** 4809 * Toggle Panels element initialization. 4810 * 4811 * @since 3.0 4812 */ 4813 function accordionInit() { 4814 4815 setTimeout(function() { 4816 4817 $('.toggles.accordion:not([data-starting="closed"])').each(function () { 4818 4819 // Legacy. 4820 if( $(this).find('.toggle[data-inner-wrap="true"]').length == 0 ) { 4821 $(this).find('> .toggle').first().addClass('open').find('> div').show(); 4822 } else if(!nectarDOMInfo.usingFrontEndEditor) { 4823 var $firstToggle = $(this).find('> .toggle').first(); 4824 $firstToggle.addClass('open'); 4825 $firstToggle.find('> div')[0].style.maxHeight = $firstToggle.find('> div')[0].scrollHeight + "px"; 4826 } 4827 4828 $(this).find('> .toggle').first().find('a:not(.nectar-button) i').attr('class', 'fa fa-minus-circle'); 4829 4830 }); 4831 4832 setTimeout(accordionDeepLinking,300); 4833 4834 }, 60); 4835 4836 if( $('.toggle[data-inner-wrap="true"]').length > 0 ) { 4837 $window.on('smartresize', accordionSizing); 4838 } 4839 4840 } 4841 4842 function accordionClickEvents() { 4843 4844 4845 $body.on('click', '.toggle h3 a', function () { 4846 4847 // Regular toggle click event 4848 if (!$(this).parents('.toggles').hasClass('accordion')) { 4849 4850 // Legacy. 4851 if( $(this).parents('.toggle[data-inner-wrap="true"]').length == 0 ) { 4852 4853 $(this).parents('.toggle') 4854 .find('> div') 4855 .slideToggle(300); 4856 4857 } else { 4858 4859 var parentEl = $(this).parents('.toggle').find('> div')[0]; 4860 4861 if (parentEl.style.maxHeight) { 4862 parentEl.style.maxHeight = null; 4863 } else { 4864 parentEl.style.maxHeight = parentEl.scrollHeight + "px"; 4865 } 4866 4867 } 4868 4869 4870 $(this).parents('.toggle') 4871 .toggleClass('open'); 4872 4873 // Switch icon 4874 if ($(this).parents('.toggle').hasClass('open')) { 4875 $(this) 4876 .find('i') 4877 .attr('class', 'fa fa-minus-circle'); 4878 } else { 4879 $(this) 4880 .find('i') 4881 .attr('class', 'fa fa-plus-circle'); 4882 } 4883 4884 if ($(this).parents('.toggle').find('> div .iframe-embed').length > 0 && 4885 $(this).parents('.toggle').find('> div iframe.iframe-embed').height() == '0') { 4886 responsiveVideoIframes(); 4887 } 4888 4889 // toggles which contain images 4890 if( $(this).parents('.toggle').find('> div img').length > 0 && 4891 $(this).parents('.toggle').is('[data-inner-wrap="true"]') ) { 4892 4893 for(var j=1; j<10; j++ ) { 4894 setTimeout(accordionSizing, j*100); 4895 } 4896 } 4897 4898 if ($(this).parents('.full-width-content').length > 0) { 4899 setTimeout(function () { 4900 fullWidthContentColumns(); 4901 }, 300); 4902 } 4903 4904 if ($('#nectar_fullscreen_rows').length > 0) { 4905 setTimeout(function () { 4906 $window.trigger('smartresize'); 4907 }, 300); 4908 } 4909 return false; 4910 } 4911 }); 4912 4913 // Accordion click event 4914 $body.on('click', '.toggles.accordion .toggle h3 a', function (e) { 4915 4916 if ($(this).parents('.toggle').hasClass('open')) { 4917 return false; 4918 } 4919 4920 var $t; 4921 var $parentToggles = $(this).parents('.toggles'); 4922 var $parentToggle = $(this).parents('.toggle'); 4923 4924 4925 // Legacy. 4926 if( $(this).parents('.toggle[data-inner-wrap="true"]').length == 0 ) { 4927 4928 $parentToggles.find('.toggle > div').slideUp(300); 4929 $parentToggles.find('.toggle h3 a i').attr('class', 'fa fa-plus-circle'); 4930 $parentToggles.find('.toggle').removeClass('open'); 4931 $parentToggle.find('> div').slideDown(300); 4932 $parentToggle.addClass('open'); 4933 4934 } else { 4935 4936 // Mobile scroll to. 4937 if (e.originalEvent !== undefined && 4938 nectarDOMInfo.winW < 1000 && 4939 $parentToggles.find('.toggle.open').length > 0 && 4940 $nectarFullPage.$usingFullScreenRows == false) { 4941 4942 var $openToggle = $parentToggles.find('.toggle.open'); 4943 4944 setTimeout(function(){ 4945 var $scrollTopDistance = $parentToggle.offset().top - nectarDOMInfo.adminBarHeight; 4946 4947 if( $('#header-outer[data-mobile-fixed="1"]').length > 0 ) { 4948 $scrollTopDistance = $parentToggle.offset().top - $headerOuterEl.outerHeight() - nectarDOMInfo.adminBarHeight 4949 } 4950 4951 nectar_scrollToY($scrollTopDistance, 500, 'easeInOutQuint'); 4952 },50); 4953 4954 } 4955 4956 4957 var parentEl = $parentToggle.find('> div')[0]; 4958 4959 $parentToggles.find('.toggle > div').each(function(){ 4960 $(this)[0].style.maxHeight = null; 4961 });
4962 4963 $parentToggles.find('.toggle h3 a i').attr('class', 'fa fa-plus-circle'); 4964 $parentToggles.find('.toggle').removeClass('open'); 4965 4966 parentEl.style.maxHeight = parentEl.scrollHeight + "px"; 4967 4968 $parentToggle.addClass('open'); 4969 4970 } 4971 4972 4973 // Switch icon 4974 if ($parentToggle.hasClass('open')) { 4975 $(this).find('i').attr('class', 'fa fa-minus-circle'); 4976 } else { 4977 $(this).find('i').attr('class', 'fa fa-plus-circle'); 4978 } 4979 4980 if ($(this).parents('.full-width-content').length > 0) { 4981 clearTimeout($t); 4982 $t = setTimeout(function () { 4983 fullWidthContentColumns(); 4984 }, 400); 4985 } 4986 if ($('#nectar_fullscreen_rows').length > 0) { 4987 clearTimeout($t); 4988 $t = setTimeout(function () { 4989 $window.trigger('smartresize'); 4990 }, 400); 4991 } 4992 4993 return false; 4994 4995 }); 4996 4997 } 4998 4999 5000 /** 5001 * Sticky elements powered by CSS. 5002 * 5003 * @since 12.2 5004 */ 5005 function NectarStickyEls() { 5006 this.selectors = '.nectar-sticky-pos'; 5007 5008 if($(this.selectors).length === 0) { 5009 return; 5010 } 5011 5012 this.topOffset = 0; 5013 this.topOffsetCushion = 60; 5014 this.calcTopOffset(); 5015 this.resizeEvent(); 5016 $window.on('resize', this.resizeEvent.bind(this)); 5017 } 5018 5019 NectarStickyEls.prototype.calcTopOffset = function() { 5020 5021 if ($('.page-template-template-no-header-footer').length > 0 || 5022 $('.page-template-template-no-header').length > 0 || 5023 $('#header-outer[data-remove-fixed="1"]').length > 0 || 5024 $('body[data-header-format="left-header"]').length > 0 ) { 5025 this.topOffset = 0; 5026 } else { 5027 5028 var $headerNavSpace = $('#header-space').outerHeight(); 5029 var resize = 0; 5030 5031 // Resize effect. 5032 if( $('#header-outer[data-header-resize="1"]').length > 0 ) { 5033 var headerPadding = parseInt($headerOuterEl.attr('data-padding')) - parseInt($headerOuterEl.attr('data-padding')) / 1.8; 5034 resize = parseInt(logoShrinkNum) + headerPadding * 2; 5035 } 5036 5037 this.topOffset = parseInt($headerNavSpace) + resize + nectarDOMInfo.adminBarHeight; 5038 5039 // Condense effect. 5040 if ($('#header-outer[data-condense="true"]').length > 0) { 5041 5042 var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'), 5043 $headerHeightStored = $headerOuterEl.height(),
5044 $headerHeightCondensed = $headerHeightStored - (parseInt($headerSpan9.height()) + parseInt($('#header-outer #logo').css('margin-top'))); 5045 5046 this.topOffset = parseInt($headerNavSpace) + $headerHeightCondensed - nectarDOMInfo.adminBarHeight; 5047 5048 } 5049 5050 } 5051 5052 this.topOffset += this.topOffsetCushion; 5053 5054 5055 }; 5056 5057 NectarStickyEls.prototype.resizeEvent = function() { 5058 5059 if( nectarDOMInfo.winW > 1000 ) { 5060 5061 this.calcTopOffset(); 5062 5063 $(this.selectors).css({ 5064 'position':'sticky', 5065 'top': this.topOffset 5066 }); 5067 } else { 5068 $(this.selectors).css({ 5069 'position': '', 5070 'top': '' 5071 }); 5072 } 5073 5074 }; 5075 5076 5077 /** 5078 * Color hex to rgb 5079 * 5080 * @since 3.0 5081 */ 5082 function shadeColor(hex, lum) { 5083 5084 // Validate hex string 5085 hex = String(hex).replace(/[^0-9a-f]/gi, ''); 5086 if (hex.length < 6) { 5087 hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2]; 5088 } 5089 lum = lum || 0; 5090 5091 // Convert to decimal and change luminosity 5092 var rgb = "#", 5093 c, i; 5094 for (i = 0; i < 3; i++) { 5095 c = parseInt(hex.substr(i * 2, 2), 16); 5096 c = Math.round(Math.min(Math.max(0, c + (c * lum)), 255)).toString(16); 5097 rgb += ("00" + c).substr(c.length); 5098 } 5099 5100 return rgb; 5101 } 5102 5103 /** 5104 * Jumbo size 3D nectar button. 5105 * 5106 * @since 3.0 5107 */ 5108 function createExtraJumboSize() { 5109 5110 $('.nectar-3d-transparent-button').each(function () { 5111 5112 if ($(this).css('visibility') != 'visible') { 5113 return; 5114 } 5115 5116 var $that = $(this), 5117 $size = $that.attr('data-size'), 5118 $padding = 0; 5119 5120 var $vert_height_divider = 1.7; 5121 5122 if ($size == 'extra_jumbo') { 5123 5124 var $font_size; 5125 5126 if (nectarDOMInfo.winW < 1000 && nectarDOMInfo.winW > 690) { 5127 $padding = 64; 5128 $font_size = 34; 5129 $that.find('.back-3d rect').attr('stroke-width', '12'); 5130 $vert_height_divider = 1.7; 5131 } else if (nectarDOMInfo.winW <= 690) { 5132 $padding = 46; 5133 $font_size = 16; 5134 $that.find('.back-3d rect').attr('stroke-width', '10'); 5135 $vert_height_divider = 1.7; 5136 } else { 5137 $padding = 100; 5138 $font_size = 64; 5139 $that.find('.back-3d rect').attr('stroke-width', '20'); 5140 $vert_height_divider = 1.6; 5141 } 5142 5143 5144 $that.find('svg text').attr('font-size', $font_size); 5145 5146 var $boundingRect = $(this).find('.back-3d .button-text')[0].getBoundingClientRect(), 5147 $text_width = $boundingRect.width, 5148 $text_height = $font_size * 1.5; 5149 5150 $that.css({ 5151 'width': ($text_width + $padding * 1.5) + 'px', 5152 'height': ($text_height + $padding) + 'px' 5153 }); 5154 5155 $that.find('> a').css({ 5156 'height': ($text_height + $padding) + 'px' 5157 }); 5158 5159 $that.find('.back-3d svg, .front-3d svg').css({ 5160 'width': ($text_width + $padding * 1.5) + 'px', 5161 'height': ($text_height + $padding) + 'px' 5162 }).attr('viewBox', '0 0 ' + ($text_width + $padding * 1.5) + ' ' + ($text_height + $padding)); 5163 5164 $that.find('svg text').attr('transform', 'matrix(1 0 0 1 ' + ($text_width + $padding * 1.6) / 2 + ' ' + (($text_height + $padding) / $vert_height_divider) + ')'); 5165 $that.find('.front-3d ').css('transform-origin', '50% 50% -' + ($text_height + $padding) / 2 + 'px'); 5166 $that.find('.back-3d').css('transform-origin', '50% 50% -' + ($text_height + $padding) / 2 + 'px'); 5167 5168 } 5169 5170 }); 5171 5172 } 5173 5174 5175 /** 5176 * Nectar Button custom coloring 5177 * 5178 * @since 3.0 5179 */ 5180 function coloredButtons() { 5181 5182 $('.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 () { 5183 5184 var $usingMaterialSkin = ($('body.material[data-button-style^="rounded"]').length > 0) ? true : false; 5185 $(this).css('visibility', 'visible'); 5186 5187 if ($(this).hasClass('see-through-3') && $(this).attr('data-color-override') == 'false') { 5188 return true; 5189 } 5190 5191 var $color; 5192 var $that; 5193 5194 if ($(this).attr('data-color-override') != 'false') { 5195 $color = $(this).attr('data-color-override'); 5196 } else { 5197
5198 if ($(this).parents('.dark').length > 0) { 5199 $color = '#000000'; 5200 } else { 5201 $color = '#ffffff'; 5202 } 5203 5204 } 5205 5206 if (!$(this).hasClass('see-through-3')) { 5207 $(this).css('color', $color); 5208 } 5209 5210 $(this).find('i').css('color', $color); 5211 5212 var colorInt = parseInt($color.substring(1), 16); 5213 var $hoverColor = ($(this).has('[data-hover-color-override]')) ? $(this).attr('data-hover-color-override') : 'no-override'; 5214 var $hoverTextColor = ($(this).has('[data-hover-text-color-override]')) ? $(this).attr('data-hover-text-color-override') : '#fff'; 5215 5216 var R = (colorInt & 0xFF0000) >> 16; 5217 var G = (colorInt & 0x00FF00) >> 8; 5218 var B = (colorInt & 0x0000FF) >> 0; 5219 5220 var $opacityStr = ($(this).hasClass('see-through-3')) ? '1' : '0.75'; 5221 5222 $(this).css('border-color', 'rgba(' + R + ',' + G + ',' + B + ',' + $opacityStr + ')'); 5223 5224 // Material theme skin buttons w/ icons starting 5225 if ($usingMaterialSkin) { 5226 $(this).find('i').css({ 5227 'background-color': 'rgba(' + R + ',' + G + ',' + B + ',1)', 5228 'box-shadow': '0px 8px 15px rgba(' + R + ',' + G + ',' + B + ',0.24)' 5229 }); 5230 } 5231 5232 if ($(this).hasClass('see-through')) { 5233 5234 $that = $(this); 5235 5236 $(this).on('mouseenter touchstart', function () { 5237 $that.css('border-color', 'rgba(' + R + ',' + G + ',' + B + ',1)'); 5238 }); 5239 5240 $(this).on('mouseleave touchtouchend', function () { 5241 $that.css('border-color', 'rgba(' + R + ',' + G + ',' + B + ',1)'); 5242 $opacityStr = ($(this).hasClass('see-through-3')) ? '1' : '0.75'; 5243 $that.css('border-color', 'rgba(' + R + ',' + G + ',' + B + ',' + $opacityStr + ')'); 5244 }); 5245 5246 } else { 5247 5248 $(this).find('i').css('color', $hoverTextColor); 5249 5250 if ($hoverColor != 'no-override') { 5251 5252 $that = $(this); 5253 5254 $(this).on('mouseenter touchstart', function () { 5255 5256 $that.css({ 5257 'border-color': $hoverColor, 5258 'background-color': $hoverColor, 5259 'color': $hoverTextColor 5260 });
5261 5262 // Material buttons w/ icons over 5263 if ($usingMaterialSkin) { 5264 $that.find('i').css({ 5265 'background-color': '', 5266 'box-shadow': '' 5267 }); 5268 } 5269 }); 5270 5271 $(this).on('mouseleave touchtouchend', function () { 5272 5273 $opacityStr = ($(this).hasClass('see-through-3')) ? '1' : '0.75'; 5274 5275 if ($usingMaterialSkin) { 5276 $that.find('i').css({ 5277 'background-color': 'rgba(' + R + ',' + G + ',' + B + ',1)', 5278 'box-shadow': '0px 8px 15px rgba(' + R + ',' + G + ',' + B + ',0.24)' 5279 }); 5280 } 5281 5282 if (!$that.hasClass('see-through-3')) { 5283 $that.css({ 5284 'border-color': 'rgba(' + R + ',' + G + ',' + B + ',' + $opacityStr + ')', 5285 'background-color': 'transparent', 5286 'color': $color 5287 }); 5288 } else { 5289 $that.css({ 5290 'border-color': 'rgba(' + R + ',' + G + ',' + B + ',' + $opacityStr + ')', 5291 'background-color': 'transparent' 5292 }); 5293 } 5294 5295 }); 5296 5297 } else { 5298 5299 $that = $(this); 5300 5301 $(this).on('mouseenter touchstart', function () { 5302 5303 $that.css({ 5304 'border-color': $hoverColor, 5305 'color': $hoverTextColor 5306 });
5307 5308 }); 5309 5310 $(this).on('mouseleave touchtouchend', function () { 5311 5312 $opacityStr = ($that.hasClass('see-through-3')) ? '1' : '0.75'; 5313 $that.css({ 5314 'border-color': 'rgba(' + R + ',' + G + ',' + B + ',' + $opacityStr + ')', 5315 'color': $hoverTextColor 5316 }); 5317 5318 }); 5319 5320 } 5321 } 5322 }); 5323 5324 $('.nectar-button:not(.see-through):not(.see-through-2):not(.see-through-3)[data-color-override]').each(function () { 5325 5326 $(this).css('visibility', 'visible'); 5327 5328 if ($(this).attr('data-color-override') != 'false') { 5329 5330 var $color = $(this).attr('data-color-override'); 5331 5332 $(this) 5333 .removeClass('accent-color') 5334 .removeClass('extra-color-1') 5335 .removeClass('extra-color-2') 5336 .removeClass('extra-color-3') 5337 .css('background-color', $color); 5338 } 5339 5340 }); 5341 5342 5343 // Solid color tilt 5344 if ($('.swiper-slide .solid_color_2').length > 0 || $('.tilt-button-inner').length > 0) { 5345 5346 var $tiltButtonCssString = ''; 5347 var $color; 5348 5349 $('.swiper-slide .solid_color_2 a').each(function (i) { 5350 5351 $(this).addClass('instance-' + i); 5352 5353 if ($(this).attr('data-color-override') != 'false') { 5354 $color = $(this).attr('data-color-override'); 5355 } else { 5356 if ($(this).parents('.dark').length > 0) { 5357 $color = '#000000'; 5358 } 5359 else { 5360 $color = '#ffffff'; 5361 } 5362 } 5363 5364 $(this).css('color', $color); 5365 $(this).find('i').css('color', $color); 5366 5367 var $currentColor = $(this).css('background-color'), 5368 $topColor = shadeColor($currentColor, 0.13), 5369 $bottomColor = shadeColor($currentColor, -0.15); 5370 5371 $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 + '; } '; 5372 5373 }); 5374 5375 5376 $('.tilt-button-wrap a').each(function (i) { 5377 5378 $(this).addClass('instance-' + i); 5379 5380 var $currentColor = $(this).css('background-color'); 5381 var $color; 5382 5383 if ($(this).attr('data-color-override') != 'false') { 5384 $color = $(this).attr('data-color-override'); 5385 $(this).css('background-color', $color); 5386 $currentColor = $color; 5387 } 5388 5389 var $topColor = shadeColor($currentColor, 0.13), 5390 $bottomColor = shadeColor($currentColor, -0.15); 5391 5392 $tiltButtonCssString += '.tilt-button-wrap a.instance-' + i + ':after { background-color: ' + $topColor + '; }' + ' .tilt-button-wrap a.instance-' + i + ':before { background-color: ' + $bottomColor + '; } '; 5393 5394 }); 5395 5396 // Style 5397 nectarCreateStyle($tiltButtonCssString, 'tilt-button'); 5398 5399 } 5400 5401 5402 // Transparent 3D 5403 if ($('.nectar-3d-transparent-button').length > 0) { 5404 5405 var $3dTransButtonCssString = ''; 5406 $('.nectar-3d-transparent-button').each(function (i) { 5407 5408 var $that = $(this), 5409 $size = $that.attr('data-size'), 5410 $padding = 0, 5411 v1 = 1.5, 5412 v2 = 1.65, 5413 $font_size; 5414 5415 // Size 5416 if ($size == 'large') { 5417 $padding = 46; 5418 $font_size = 16; 5419 v1 = 1.5; 5420 v2 = 1.7; 5421 } else if ($size == 'medium') { 5422 $padding = 30; 5423 $font_size = 16; 5424 } else if ($size == 'small') { 5425 $padding = 20; 5426 $font_size = 12; 5427 } else if ($size == 'jumbo') { 5428 $padding = 54; 5429 $font_size = 24; 5430 v1 = 1.5; 5431 v2 = 1.68; 5432 } else if ($size == 'extra_jumbo') { 5433 $padding = 100; 5434 $font_size = 64; 5435 v1 = 1.6; 5436 v2 = 1.6; 5437 } 5438 5439 $that.find('svg text').attr('font-size', $font_size); 5440 5441 var $boundingRect = $(this).find('.back-3d .button-text')[0].getBoundingClientRect(), 5442 $text_width = $boundingRect.width, 5443 $text_height = $font_size * 1.5; 5444 5445 $that.css({ 5446 'width': ($text_width + $padding * 1.5) + 'px', 5447 'height': ($text_height + $padding) + 'px' 5448 });
5449 5450 $that.find('> a').css({ 5451 'height': ($text_height + $padding) + 'px' 5452 }); 5453 5454 $that.find('.back-3d svg, .front-3d svg').css({ 5455 'width': ($text_width + $padding * 1.5) + 'px', 5456 'height': ($text_height + $padding) + 'px' 5457 }).attr('viewBox', '0 0 ' + ($text_width + $padding * 1.5) + ' ' + ($text_height + $padding)); 5458 5459 $that.find('svg text').attr('transform', 'matrix(1 0 0 1 ' + ($text_width + $padding * v1) / 2 + ' ' + (($text_height + $padding) / v2) + ')'); 5460 $that.find('.front-3d, .back-3d').css('transform-origin', '50% 50% -' + ($text_height + $padding) / 2 + 'px'); 5461 5462 // Mask 5463 $(this).find('.front-3d svg > rect').attr('id', 'masked-rect-id-' + i); 5464 $(this).find('.front-3d defs mask').attr('id', 'button-text-mask-' + i); 5465 5466 $that.css('visibility', 'visible'); 5467 $3dTransButtonCssString += '#masked-rect-id-' + i + ' { mask: url(#button-text-mask-' + i + '); -webkit-mask: url(#button-text-mask-' + i + ')} '; 5468 5469 }); 5470 5471 // Extra jumbo resize 5472 createExtraJumboSize(); 5473 $window.on('smartresize', createExtraJumboSize); 5474 5475 // Style 5476 nectarCreateStyle($3dTransButtonCssString, 'nectar-td-button'); 5477 5478 } 5479 5480 // Gradient btn init 5481 setTimeout(function () { 5482 $('.nectar-button[class*="color-gradient"] .start').removeClass('loading'); 5483 }, 150); 5484 // No grad for ff 5485 if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1 || 5486 navigator.userAgent.indexOf("MSIE ") > -1 || 5487 navigator.userAgent.match(/Trident\/7\./)) { 5488 $('.nectar-button[class*="color-gradient"] .start').addClass('no-text-grad'); 5489 } 5490 } 5491 5492 5493 5494 5495 /** 5496 * Shortcode icon large style 5497 * 5498 * @since 1.0 5499 */ 5500 function largeIconHover() { 5501 $('.icon-3x').each(function () { 5502 $(this).closest('.col').on('mouseenter', function () { 5503 $(this).find('.icon-3x').addClass('hovered'); 5504 }); 5505 5506 $(this).closest('.col').on('mouseleave', function () { 5507 $(this).find('.icon-3x').removeClass('hovered'); 5508 }); 5509 }); 5510 5511 if (navigator.userAgent.indexOf("MSIE ") > -1 || navigator.userAgent.match(/Trident\/7\./)) { 5512 $('[class^="icon-"][class*="color-gradient"], .nectar_icon_wrap[data-color*="extra-color-gradient"] .nectar_icon, .nectar-gradient-text').addClass('no-grad'); 5513 } 5514 } 5515 5516 5517 5518 /** 5519 * Team member element - fullscreen style. 5520 * 5521 * @since 7.0 5522 */ 5523 function teamMemberFullscreen() { 5524 5525 if ( $('.team-member').length === 0 ) { 5526 return; 5527 } 5528 5529 // Open click event 5530 $body.on('click', '.team-member[data-style="bio_fullscreen"], .team-member[data-style="bio_fullscreen_alt"]', function () { 5531 5532 if ($('.nectar_team_member_overlay').length > 0) { 5533 return; 5534 } 5535 5536 var $usingBoxedClass = ($('body > #boxed').length > 0) ? 'in-boxed' : '', 5537 $teamMemberMeta = $(this).find('.nectar_team_bio').html(), 5538 $teamMemberTitle = ($(this).is('[data-style="bio_fullscreen_alt"]')) ? $(this).find('.team-meta h5').text() : $(this).find('.team-meta p').text(), 5539 $teamMemberImg = ($(this).find('.nectar_team_bio_img[data-img-src]').length > 0) ? $(this).find('.nectar_team_bio_img').attr('data-img-src') : '', 5540 $teamMemberStyle = ($(this).is('[data-style="bio_fullscreen_alt"]')) ? 'bio-fullscreen-alt' : 'bio-fullscreen', 5541 $teamName = ''; 5542 5543 if($(this).is('[data-style="bio_fullscreen_alt"]')) { 5544 $teamName = '<div class="title">' + $teamMemberTitle + '</div><h2>' + $(this).find('.team-meta h3').text() + '</h2>'; 5545 } else { 5546 $teamName = '<h2>' + $(this).find('.team-meta h3').text() + '</h2><div class="title">' + $teamMemberTitle + '</div>'; 5547 } 5548 5549 $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>'); 5550 5551 if ($teamMemberImg.length > 0) { 5552
5553 // Fade in img on load 5554 var teamTmpImg = new Image(); 5555 teamTmpImg.src = $teamMemberImg; 5556 teamTmpImg.onload = function () { 5557 $('.nectar_team_member_overlay .team_member_image').css('opacity', '1'); 5558 }; 5559 $('.nectar_team_member_overlay .team_member_image').css({ 5560 'background-image': 'url("' + $teamMemberImg + '")' 5561 }); 5562 } 5563 5564 var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $window.width() > 1000) ? 0 : $headerOuterEl.height(); 5565 $('.nectar_team_member_overlay .inner-wrap').css({ 5566 'padding-top': $headerNavSpace 5567 }); 5568 5569 // No-scroll class - ios ready 5570 if ($('.using-mobile-browser').length > 0) { 5571 $('body,html').addClass('nectar-no-scrolling'); 5572 } 5573 5574 teamFullscreenResize(); 5575 5576 // Transition in 5577 $('.nectar_team_member_overlay') 5578 .addClass('open') 5579 .addClass('animating'); 5580 5581 setTimeout(function () { 5582 $('.nectar_team_member_close').addClass('visible'); 5583 $('.nectar_team_member_overlay').removeClass('animating'); 5584 }, 500); 5585 5586 if ($('.team-member[data-style="bio_fullscreen"]').length > 0 && nectarDOMInfo.usingMobileBrowser) { 5587 $('.nectar_team_member_overlay').addClass('on-mobile'); 5588 } 5589 5590 }); 5591 5592 // Close click event 5593 $body.on('click', '.nectar_team_member_overlay', function () { 5594 5595 if (!$(this).hasClass('animating')) { 5596 5597 $('.nectar_team_member_overlay').removeClass('open'); 5598 $('.nectar_team_member_close').removeClass('visible'); 5599 5600 if ($('.using-mobile-browser').length > 0) { 5601 $('body,html').removeClass('nectar-no-scrolling'); 5602 } 5603 5604 setTimeout(function () { 5605 5606 $('.nectar_team_member_overlay, .nectar_team_member_close').remove(); 5607 5608 }, 820); 5609 } 5610 }); 5611 5612 if ($('.team-member[data-style="bio_fullscreen"]').length > 0 || $('.team-member[data-style="bio_fullscreen_alt"]').length > 0) { 5613 $window.on('resize', teamFullscreenResize); 5614 if( !nectarDOMInfo.usingMobileBrowser ) { 5615 var closeIndicator = new NectarIconMouseFollow('','close-indicator'); 5616 } 5617 5618 } 5619 5620 } 5621 5622 5623 /** 5624 * Team member element fullscreen resize event. 5625 * 5626 * @since 7.0 5627 */ 5628 function teamFullscreenResize() { 5629 var $leftHeaderSize = ($('body[data-header-format="left-header"]').length > 0 && $window.width() > 1000) ? 275 : 0; 5630 $('.nectar_team_member_overlay').css({ 5631 'width': $window.width() - $leftHeaderSize, 5632 'left': $leftHeaderSize 5633 }); 5634 } 5635 5636 5637 /** 5638 * WPBakery column element BG hover 5639 * 5640 * @since 5.0 5641 */ 5642 function columnBGColors() { 5643 5644 var $columnColorCSS = ''; 5645 5646 $('.wpb_column').each(function (i) { 5647 5648 $(this).removeClass(function (index, className) { 5649 return (className.match(/(^|\s)instance-\S+/g) || []).join(' '); 5650 }); 5651 5652 if( $(this).attr('data-has-bg-color') == 'true' || $(this).is('[data-hover-bg^="#"]') ) { 5653 $(this).addClass('instance-' + i); 5654 } 5655 5656 5657 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 ' : ''; 5658 var $innerWrapSelector = ( $(this).find($innerSelector + ' > .column-bg-overlay-wrap').length > 0 ) ? '> .column-bg-overlay-wrap ' : ''; 5659 5660 // BG color 5661 if ($(this).attr('data-has-bg-color') == 'true') { 5662 $columnColorCSS += '.wpb_column.instance-' + i + $innerSelector + $innerWrapSelector + ' > .column-bg-overlay { background-color:' + $(this).attr('data-bg-color') + '; opacity: ' + $(this).attr('data-bg-opacity') + '; }'; 5663 } 5664 5665 // Hover bg color 5666 if ($(this).is('[data-hover-bg^="#"]')) { 5667 $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; }'; 5668 } 5669 });
5670 5671 // Style 5672 nectarCreateStyle($columnColorCSS, 'column-bg-colors'); 5673 5674 } 5675 5676 5677 5678 /** 5679 * Displace filter column/row BG effect 5680 * 5681 * @since 10.5 5682 */ 5683 function nectarLiquidBGs() { 5684 $liquidBG_EL = []; 5685 5686 if (typeof NectarLiquid == 'undefined' || nectarDOMInfo.usingFrontEndEditor) { 5687 return; 5688 } 5689 5690 $('.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) { 5691 5692 var $that_el = $(this); 5693 var $type; 5694 var $el_type; 5695 5696 if ($(this).is('.row-bg')) { 5697 $type = $(this).parents('.row-bg-wrap').attr('data-bg-animation'); 5698 $el_type = 'row'; 5699 } 5700 else if ($(this).is('.column-image-bg')) { 5701 $type = $(this).parents('.column-image-bg-wrap').attr('data-bg-animation'); 5702 $el_type = 'col'; 5703 } 5704 5705 $liquidBG_EL[i] = new NectarLiquid($that_el, $type, $el_type); 5706 5707 }); 5708 } 5709 5710 5711 5712 /** 5713 * Morphing outline element creation. 5714 * 5715 * @since 5.0 5716 */ 5717 function morphingOutlines() { 5718 5719 if ($('.morphing-outline').length > 0) { 5720 5721 var $morphingOutlineCSS = '', 5722 $frontEndEditorMOSelector = ($('body.vc_editor').length > 0) ? '' : '>'; 5723 5724 $('.morphing-outline').each(function (i) { 5725 5726 $(this).removeClass(function (index, className) { 5727 return (className.match(/(^|\s)instance-\S+/g) || []).join(' '); 5728 }); 5729 5730 $(this).addClass('instance-' + i).css({ 5731 'visibility': 'visible' 5732 }); 5733 5734 var $width = $(this).find('.inner').width(), 5735 $height = $(this).find('.inner').height(), 5736 $border = parseInt($(this).attr("data-border-thickness")), 5737 $hover = ($('body[data-button-style*="rounded"]').length > 0) ? ':hover' : '', 5738 $hover2 = ($('body[data-button-style*="rounded"]').length > 0) ? '' : ':hover'; 5739 5740 $morphingOutlineCSS += 'body .morphing-outline.instance-' + i + ' .inner > * { color: ' + $(this).attr("data-starting-color") + '; } '; 5741 $morphingOutlineCSS += 'body .morphing-outline.instance-' + i + ' .inner:after { border-width:' + $(this).attr("data-border-thickness") + 'px ; border-color: ' + $(this).attr("data-starting-color") + '; } '; 5742 5743 $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") + '; } '; 5744 $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") + '; } '; 5745 5746 // Padding calcs 5747 $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}'; 5748 $morphingOutlineCSS += '.morphing-outline.instance-' + i + ' { padding: ' + (30 + ($width + 80 + $border * 2 - $height) / 2 - $border) + 'px 50px}'; 5749 $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 }'; 5750 5751 $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 }'; 5752 5753 // Hover 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 { padding: 50px 50px}'; 5755 $morphingOutlineCSS += 'body .wpb_column' + $hover + ' > .wpb_wrapper ' + $frontEndEditorMOSelector + ' .morphing-outline.instance-' + i + ' .inner:after, body .wpb_column' + $hover + ' > .vc_column-inner > .wpb_wrapper ' + $frontEndEditorMOSelector + ' .morphing-outline.instance-' + i + ' .inner:after { top: -' + parseInt(50 + $border) + 'px }'; 5756 5757 });
5758 5759 // Style 5760 nectarCreateStyle($morphingOutlineCSS, 'morphing-outlines'); 5761 5762 } 5763 5764 } 5765 5766 5767 /** 5768 * Morphing outline element initialization. 5769 * 5770 * @since 5.0 5771 */ 5772 function morphingOutlinesInit() { 5773 5774 if($('.morphing-outline').length > 0) { 5775 5776 // Create style. 5777 setTimeout(morphingOutlines, 100); 5778 setTimeout(fullWidthContentColumns, 125); 5779 5780 // Handle resize. 5781 $window.on('smartresize', morphingOutlines); 5782 5783 } 5784 5785 } 5786 5787 5788 5789 /** 5790 * SVG icon element animations 5791 * 5792 * @since 6.0 5793 * @see waypoints 5794 */ 5795 function svgAnimations() { 5796 5797 var $svgOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : 'bottom-in-view'; 5798 5799 if ($svgIcons.length == 0) { 5800 5801 $('.svg-icon-holder:not(.animated-in)').has('svg').each(function (i) { 5802 5803 var $that = $(this); 5804 5805 if (bypassAnimations) { 5806 $that.attr('data-animation', 'false'); 5807 } 5808 // Size 5809 $that.find('svg').css({ 5810 'height': parseInt($that.attr('data-size')) + 'px', 5811 'width': parseInt($that.attr('data-size')) + 'px' 5812 }); 5813 5814 // Animation 5815 $(this).find('svg').attr('id', 'nectar-svg-animation-instance-' + i); 5816 5817 var $animationSpeed = ($that.is('[data-animation-speed]') && $that.attr('data-animation-speed').length > 0) ? $that.attr('data-animation-speed') : 200; 5818 5819 if ($that.attr('data-animation') == 'false') { 5820 $animationSpeed = 1; 5821 $that.css('opacity', '1'); 5822 } 5823 5824 if (!$that.hasClass('bound')) { 5825 $svgIcons[i] = new Vivus($that.find('svg').attr('id'), { 5826 type: 'delayed', 5827 pathTimingFunction: Vivus.EASE_OUT, 5828 animTimingFunction: Vivus.LINEAR, 5829 duration: $animationSpeed, 5830 onReady: svgInit 5831 });
5832 } 5833 5834 if ($animationSpeed !== 1) { 5835 5836 var waypoint = new Waypoint({ 5837 element: $that, 5838 handler: function () { 5839 if ($that.hasClass('animated-in')) { 5840 waypoint.destroy(); 5841 return; 5842 } 5843 5844 checkIfReady(); 5845 $that.addClass('animated-in'); 5846 waypoint.destroy(); 5847 }, 5848 offset: $svgOffsetPos 5849 5850 }); 5851 5852 } else { 5853 checkIfReady(); 5854 } 5855 5856 function checkIfReady() { 5857 5858 var $animationDelay = 0; 5859 5860 if($that.is('[data-animation-delay]') && 5861 $that.attr('data-animation-delay').length > 0 && 5862 $that.attr('data-animation') != 'false') { 5863 $animationDelay = $that.attr('data-animation-delay'); 5864 } 5865 5866 var $iconID = $that.find('svg').attr('id').replace(/[^0-9]/g, ''); 5867 5868 if ($svgIcons[$iconID].isReady == true) { 5869 setTimeout(function () { 5870 $that.css('opacity', '1'); 5871 $svgIcons[$iconID].reset().play(); 5872 }, $animationDelay); 5873 } else { 5874 setTimeout(checkIfReady, 50); 5875 } 5876 } 5877 5878 function svgInit() { 5879 5880 //set size 5881 $that.css({ 5882 'height': parseInt($that.attr('data-size')) + 'px', 5883 'width': parseInt($that.attr('data-size')) + 'px' 5884 });
5885 5886 } 5887 5888 $that.addClass('bound'); 5889 5890 }); 5891 5892 5893 // SVG in equal height column resize 5894 if ($('.vc_row-o-equal-height .svg-icon-holder[data-animation="true"]').length > 0 && 5895 $('#nectar_fullscreen_rows').length == 0) { 5896 5897 $window.on('smartresize', function () { 5898 clearTimeout($svgResizeTimeout); 5899 $svgResizeTimeout = setTimeout(function () { 5900 5901 if ($svgIcons.length > 0) { 5902 $('.svg-icon-holder.animated-in').each(function () { 5903 5904 $(this).css('opacity', '1'); 5905 if ($(this).is('[id]')) { 5906 var $iconID = $(this).attr('id').replace(/[^0-9]/g, ''); 5907 $svgIcons[$iconID].finish(); 5908 } 5909 5910 }); 5911 } 5912 5913 }, 300); 5914 5915 }); 5916 5917 } 5918 5919 } 5920 5921 // After svg animated icons initalized 5922 else { 5923 $('.svg-icon-holder').addClass('animated-in').css('opacity', '1'); 5924 } 5925 5926 // Full vc row support 5927 $('#nectar_fullscreen_rows .svg-icon-holder.animated-in').has('svg').each(function (i) { 5928 5929 var $animationDelay = 0; 5930 5931 if($(this).is('[data-animation-delay]') && 5932 $(this).attr('data-animation-delay').length > 0 && 5933 $(this).attr('data-animation') != 'false') { 5934 $animationDelay = $(this).attr('data-animation-delay'); 5935 } 5936 5937 var $that = $(this); 5938 5939 var $iconID = $that.find('svg').attr('id').replace(/[^0-9]/g, ''); 5940 5941 clearTimeout($animatedSVGIconTimeout[i]); 5942 5943 if ($that.attr('data-animation') == 'false') { 5944 5945 $that.css('opacity', '1'); 5946 $svgIcons[$iconID].finish(); 5947 5948 } else { 5949 5950 if ($(this).parents('.active').length > 0 || 5951 $(this).parents('#footer-outer').length > 0 || 5952 $('body.mobile').length > 0) { 5953 5954 $svgIcons[$iconID].reset(); 5955 $animatedSVGIconTimeout[i] = setTimeout(function () { 5956 $svgIcons[$iconID].play(); 5957 }, $animationDelay); 5958 5959 } else { 5960 $svgIcons[$iconID].reset().stop(); 5961 } 5962 } 5963 }); 5964 5965 } 5966 5967 5968 5969 /** 5970 * Fancy unordered list element initialization. 5971 * 5972 * @since 4.0 5973 * @see waypoints 5974 */ 5975 function nectarFancyUlInit() { 5976 5977 $($fullscreenSelector + '.nectar-fancy-ul').each(function () { 5978 5979 var $animation = $(this).attr('data-animation'), 5980 $animationDelay = 0; 5981 5982 if($(this).is('[data-animation-delay]') && 5983 $(this).attr('data-animation-delay').length > 0 && 5984 $(this).attr('data-animation') != 'false') { 5985 $animationDelay = $(this).attr('data-animation-delay'); 5986 } 5987 5988 if ($animation == 'true') { 5989 5990 var $that = $(this), 5991 waypoint = new Waypoint({ 5992 element: $that, 5993 handler: function () { 5994 5995 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 5996 waypoint.destroy(); 5997 return; 5998 } 5999 6000 setTimeout(function () { 6001 $that.find('li').each(function (i) { 6002 var $that = $(this); 6003 $that.delay(i * 220).transition({ 6004 'opacity': '1', 6005 'left': '0' 6006 }, 220, 'easeOutCubic'); 6007 }); 6008 }, $animationDelay); 6009 6010 $that.addClass('animated-in'); 6011 waypoint.destroy(); 6012 }, 6013 offset: 'bottom-in-view' 6014 6015 }); 6016 6017 } 6018 6019 }); 6020 6021 } 6022 6023 6024 /** 6025 * Fancy unordered list element icons. 6026 * 6027 * @since 11.0 6028 */ 6029 function nectarFancyUlIcons() { 6030 6031 $('.nectar-fancy-ul:not([data-list-icon="dot"]):not([data-list-icon="none"])').each(function () { 6032 6033 var $icon = $(this).attr('data-list-icon'), 6034 $color = $(this).attr('data-color'); 6035 6036 $(this).find('li').each(function () { 6037 $(this).find('> i').remove(); 6038 $(this).prepend('<i class="icon-default-style ' + $icon + ' ' + $color + '"></i> '); 6039 }); 6040 6041 }); 6042 6043 } 6044 6045 6046 /** 6047 * Flipbox element height calculations. 6048 * 6049 * @since 7.0 6050 */ 6051 function flipBoxHeights() { 6052 6053 $('.nectar-flip-box').each(function () { 6054
6055 var $flipBoxMinHeight = parseInt($(this).attr('data-min-height')), 6056 $flipBoxHeight = $(this).find('.flip-box-front .inner').height(); 6057 6058 if ($(this).find('.flip-box-back .inner').height() > $(this).find('.flip-box-front .inner').height()) { 6059 $flipBoxHeight = $(this).find('.flip-box-back .inner').height(); 6060 } 6061 6062 if ($flipBoxHeight >= $flipBoxMinHeight - 80) { 6063 $(this).find('> div').css('height', $flipBoxHeight + 80); 6064 } else { 6065 $(this).find('> div').css('height', 'auto'); 6066 } 6067 6068 // Safari needs 3D translate. 6069 if ($(this).parent().hasClass('wpb_wrapper')) { 6070 $(this).parent().css('transform', 'translateZ(0)'); 6071 } 6072 6073 }); 6074 } 6075 6076 6077 6078 6079 /** 6080 * Flipbox element events. 6081 * 6082 * @since 7.0 6083 */ 6084 function flipBoxInit() { 6085 6086 if( $('.nectar-flip-box').length > 0 ) { 6087 6088 // Mobile gets click. 6089 if (nectarDOMInfo.usingMobileBrowser) { 6090 $body.on('click', '.nectar-flip-box', function () { 6091 $(this).toggleClass('flipped'); 6092 }); 6093 } 6094 6095 flipBoxHeights(); 6096 6097 // Handle resize. 6098 $window.on('smartresize', flipBoxHeights); 6099 } 6100 6101 } 6102 6103 6104 6105 6106 /** 6107 * Runs before other full width section calculations. 6108 * 6109 * @since 4.0 6110 */ 6111 function fullWidthSectionsPreInit() { 6112 6113 // Nectar Slider force full width parent row when using full width element option. 6114 $('.wpb_row .vc_col-sm-12 .nectar-slider-wrap[data-full-width="true"]').each(function () { 6115 if ($(this).parents('.wpb_row.full-width-section').length == 0 && $(this).parents('.wpb_row.full-width-content').length == 0) { 6116 $(this).parents('.wpb_row').addClass('full-width-section'); 6117 } 6118 }); 6119 6120 // Handle percent row padding values when using the boxed theme option. 6121 if( !nectarDOMInfo.usingMobileBrowser && $('body[data-boxed-style="1"]').length > 0 && $('#boxed').length > 0 ) { 6122 fullWidthRowPaddingAdjustCalcBoxed(); 6123 } 6124 6125 } 6126 6127 6128 6129 /** 6130 * Full width calculations for legacy items. 6131 * 6132 * @since 4.0 6133 */ 6134 function fullWidthSections() { 6135 6136 var $windowInnerWidth = nectarDOMInfo.winW, 6137 $bodyBorderWidth = ($('.body-border-right').length > 0 && $windowInnerWidth > 1000) ? parseInt($('.body-border-right').width()) * 2 : 0, 6138 $container_width = ($('.container-wrap').length > 0) ? parseInt($('.container-wrap').outerWidth()) : $window.width(), 6139 $extended_padding = ($('body[data-ext-padding]').length > 0) ? parseInt($('body').attr('data-ext-padding'))*2 : 180; 6140 6141 var $windowWidth, 6142 $justOutOfSight, 6143 $mainContentWidth; 6144 6145 if ($('#boxed').length == 1) { 6146 $justOutOfSight = ((parseInt($('.container-wrap').width()) - parseInt($('.main-content').width())) / 2) + 4; 6147 } else { 6148 6149 // Ext responsive mode is on - add the extra padding into the calcs 6150 var $extResponsivePadding = ($('body[data-ext-responsive="true"]').length > 0 && $windowInnerWidth >= 1000) ? $extended_padding : 0; 6151 6152 if ($container_width - $bodyBorderWidth <= parseInt($('.main-content').css('max-width'))) { 6153 $windowWidth = parseInt($('.main-content').css('max-width')); 6154 } else { 6155 $windowWidth = $container_width - $bodyBorderWidth; 6156 } 6157 6158 6159 var $contentWidth = parseInt($('.main-content').css('max-width')); 6160 6161 // Single post fullwidth 6162 if ($('body.single-post[data-ext-responsive="true"]').length > 0 && $('.container-wrap.no-sidebar').length > 0) { 6163 $contentWidth = $('.post-area').width(); 6164 $extResponsivePadding = 0; 6165 } 6166 6167 $justOutOfSight = Math.ceil((($windowWidth + $extResponsivePadding - $contentWidth) / 2)); 6168 } 6169 6170 6171 $('.carousel-outer').has('.carousel-wrap[data-full-width="true"]').css('overflow', 'visible'); 6172 6173 $('.carousel-wrap[data-full-width="true"], .portfolio-items[data-col-num="elastic"]:not(.fullwidth-constrained), #boxed .full-width-content').each(function () { 6174 6175 var $leftHeaderSize = ($('#header-outer[data-format="left-header"]').length > 0 && $windowInnerWidth >= 1000) ? parseInt($('#header-outer[data-format="left-header"]').width()) : 0; 6176 var $bodyBorderWidth = ($('.body-border-right').length > 0 && $windowInnerWidth > 1000) ? (parseInt($('.body-border-right').width()) * 2) - 2 : 0; 6177 6178 // Single post fullwidth. 6179 if ($('#boxed').length == 1) { 6180 6181 $mainContentWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').width()) : parseInt($(this).parents('.container').width()); 6182 6183 if ($('body.single-post[data-ext-responsive="true"]').length > 0 && $('.container-wrap.no-sidebar').length > 0 && $(this).parents('.post-area').length > 0) { 6184 $contentWidth = $('.post-area').width(); 6185 $extResponsivePadding = 0; 6186 $windowWidth = $container_width - $bodyBorderWidth;
6187 $justOutOfSight = Math.ceil((($windowWidth + $extResponsivePadding - $contentWidth) / 2)); 6188 } else { 6189 if ($(this).parents('.page-submenu').length > 0) { 6190 $justOutOfSight = ((parseInt($('.container-wrap').width()) - $mainContentWidth) / 2); 6191 } 6192 else { 6193 $justOutOfSight = ((parseInt($('.container-wrap').width()) - $mainContentWidth) / 2) + 4; 6194 } 6195 } 6196 } else { 6197 6198 if ($('body.single-post[data-ext-responsive="true"]').length > 0 && $('.container-wrap.no-sidebar').length > 0 && $(this).parents('.post-area').length > 0) { 6199 6200 $contentWidth = $('.post-area').width(); 6201 $extResponsivePadding = 0; 6202 $windowWidth = $container_width - $bodyBorderWidth; 6203 6204 } else { 6205 6206 var $mainContentMaxWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').css('max-width')) : parseInt($(this).parents('.container').css('max-width')); 6207 6208 if ($container_width - $bodyBorderWidth <= $mainContentMaxWidth) { 6209 $windowWidth = $mainContentMaxWidth; 6210 } 6211 6212 $contentWidth = $mainContentMaxWidth; 6213 $extResponsivePadding = ($('body[data-ext-responsive="true"]').length > 0 && nectarDOMInfo.winW >= 1000) ? $extended_padding : 0; 6214 6215 if ($leftHeaderSize > 0) { 6216 $extResponsivePadding = ($('body[data-ext-responsive="true"]').length > 0 && nectarDOMInfo.winW >= 1000) ? 120 : 0; 6217 } 6218 6219 } 6220 6221 $justOutOfSight = Math.ceil((($windowWidth + $extResponsivePadding - $contentWidth) / 2)); 6222 } 6223 6224 var $extraSpace = 0; 6225 if ($(this).hasClass('carousel-wrap')) { 6226 $extraSpace = 1; 6227 } 6228 if ($(this).hasClass('portfolio-items')) { 6229 $extraSpace = 5; 6230 } 6231 6232 var $carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight * 2) : $container_width - $bodyBorderWidth + $extraSpace; 6233 6234 // When using gutter on portfolio don't add extra space 6235 if ($('#boxed').length == 0 && $(this).hasClass('portfolio-items') && $(this).is('[data-gutter*="px"]') && $(this).attr('data-gutter').length > 0 && $(this).attr('data-gutter') != 'none') { 6236 if ($container_width > 1000) { 6237 $carouselWidth = $container_width - $bodyBorderWidth + 3; 6238 } 6239 else { 6240 $carouselWidth = $container_width - $bodyBorderWidth; 6241 } 6242 } 6243 6244 if ($(this).parent().hasClass('default-style')) { 6245 6246 $mainContentWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').width()) : parseInt($(this).parents('.container').width()); 6247 6248 if ($('#boxed').length != 0) { 6249 $carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight * 2) : $container_width + $extraSpace; 6250 } else { 6251 $carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight * 2) : ($container_width - $bodyBorderWidth) - (($container_width - $bodyBorderWidth) * 0.025) + $extraSpace; 6252 $windowWidth = ($container_width - $bodyBorderWidth <= $mainContentWidth) ? $mainContentWidth : ($container_width - $bodyBorderWidth) - (($container_width - $bodyBorderWidth) * 0.025); 6253 $justOutOfSight = Math.ceil((($windowWidth - $mainContentWidth) / 2)); 6254 } 6255 6256 } 6257 6258 else if ($(this).parent().hasClass('spaced')) { 6259 6260 $mainContentWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').width()) : parseInt($(this).parents('.container').width()); 6261 6262 if ($('#boxed').length != 0) { 6263 $carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight * 2) - ($container_width * 0.02) : $container_width + $extraSpace; 6264 } else { 6265 $carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight * 2) : ($container_width - $bodyBorderWidth) - Math.ceil(($container_width - $bodyBorderWidth) * 0.02) + $extraSpace; 6266 var $windowWidth2 = ($container_width - $bodyBorderWidth <= $mainContentWidth) ? $mainContentWidth : ($container_width - $bodyBorderWidth) - (($container_width - $bodyBorderWidth) * 0.02);
6267 $justOutOfSight = Math.ceil((($windowWidth2 - $mainContentWidth) / 2) + 2); 6268 } 6269 } 6270 6271 // Make sure the element/row is capable of going full width. 6272 if (!$(this).parents('.span_9').length > 0 && 6273 !$(this).parent().hasClass('span_3') && 6274 $(this).parent().attr('id') != 'sidebar-inner' && 6275 !$(this).find('.nectar-carousel-flickity-fixed-content').length > 0 && 6276 $(this).parent().attr('id') != 'portfolio-extra' ) { 6277 6278 // Escape if inside woocoommerce page and not using applicable layout 6279 if ($('.single-product').length > 0 && 6280 $(this).parents('#tab-description').length > 0 && 6281 $(this).parents('.full-width-tabs').length == 0) { 6282 6283 $(this).css({ 6284 'visibility': 'visible' 6285 }); 6286 6287 } else { 6288 // Portfolio. 6289 if ($(this).hasClass('portfolio-items')) { 6290 6291 if( $(this).parents('.full-width-content').length == 0 ) { 6292 6293 $(this).css({ 6294 'margin-left': -$justOutOfSight, 6295 'left': 0, 6296 'width': $carouselWidth, 6297 'visibility': 'visible' 6298 }); 6299 6300 } 6301 6302 } else { 6303 6304 // Fullscreen page rows left. 6305 if ($('#nectar_fullscreen_rows').length > 0 && $(this).hasClass('wpb_row')) { 6306 6307 $(this).css({ 6308 'margin-left': -$justOutOfSight, 6309 'width': $carouselWidth, 6310 'visibility': 'visible' 6311 }); 6312 6313 } else { 6314 // Regular rows. 6315 if( $(this).parents('.full-width-content').length == 0 ) { 6316 $(this).css({ 6317 'left': 0, 6318 'margin-left': -$justOutOfSight, 6319 'width': $carouselWidth, 6320 'visibility': 'visible' 6321 }); 6322 } 6323 } 6324 6325 } 6326 6327 } 6328 } 6329 6330 else if ($(this).parent().attr('id') == 'portfolio-extra' && $('#full_width_portfolio').length != 0) { 6331 6332 if( !$(this).find('.nectar-carousel-flickity-fixed-content').length > 0 ) { 6333 $(this).css({ 6334 'left': 0, 6335 'margin-left': -$justOutOfSight, 6336 'width': $carouselWidth, 6337 'visibility': 'visible' 6338 });
6339 } 6340 6341 } else { 6342 6343 $(this).css({ 6344 'margin-left': 0, 6345 'width': 'auto', 6346 'left': '0', 6347 'visibility': 'visible' 6348 }); 6349 } 6350 6351 }); 6352 6353 } 6354 6355 6356 6357 /** 6358 * First full width row on page 6359 * 6360 * @since 4.0 6361 */ 6362 function firstFWSection() { 6363 6364 $('.full-width-section.wpb_row, .full-width-content.wpb_row').each(function () { 6365 6366 if (!$(this).parent().hasClass('span_9') && 6367 !$(this).parent().hasClass('span_3') && 6368 $(this).parent().attr('id') != 'sidebar-inner') { 6369 6370 if ($(this).parents('#portfolio-extra').length > 0 && $('#full_width_portfolio').length == 0) { 6371 return false; 6372 } 6373 6374 if ($(this).index() == '0' && 6375 $pageHeaderBG.length == 0 && 6376 $('.page-header-no-bg').length == 0 && 6377 $('.project-title').length == 0 && 6378 $('body.single').length == 0 && 6379 $('.project-title').length == 0) { 6380 6381 $(this).addClass('first-section'); 6382 6383 var $that = $(this); 6384 setTimeout(function () { 6385 $that.addClass('loaded'); 6386 }, 50); 6387 6388 } 6389 6390 } 6391 6392 }); 6393 6394 } 6395 6396 6397 6398 /** 6399 * Parallax Scrolling 6400 * 6401 * @since 13.0 6402 */ 6403 function NectarParallaxScroll(el, parallaxElClass, speed, type) { 6404 6405 this.$el = el; 6406 this.$parallaxEl = this.$el.find(parallaxElClass); 6407 this.firstSection = false; 6408 this.type = type; 6409 this.speed = speed; 6410 this.storedWinH = nectarDOMInfo.winH; 6411 6412 this.setup(); 6413 this.resize(); 6414 this.update(); 6415 6416 } 6417 6418 NectarParallaxScroll.prototype.setup = function() { 6419 6420 var that = this; 6421 6422 // Page Header. 6423 if( this.$el.parents('#page-header-bg').length > 0 ) { 6424 this.type = 'page-header'; 6425 } 6426 6427 // Is the element in the first row on the page? 6428 if(this.$el.parents('.top-level').length > 0 && this.$el.parents('.parallax_slider_outer').length > 0 || 6429 this.$el.parents('.top-level').length > 0 && this.$el.hasClass('nectar-simple-slider') || 6430 this.$el.parents('.top-level').length > 0 && this.$el.hasClass('nectar-recent-posts-single_featured') || 6431 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)') || 6432 this.$el.is('.wpb_row.top-level') || 6433 this.type == 'page-header' || 6434 $('.wpb_row').length == 0) { 6435 this.firstSection = true; 6436 } 6437 6438 //// Nectar Slider. 6439 if($('.wpb_row').length == 0 && 6440 this.$el.parents('.parallax_slider_outer').length > 0 && 6441 this.$el.is('[data-full-width="true"]') || 6442 ($('#portfolio-extra').length > 0 && 6443 this.$el.parents('.parallax_slider_outer').length > 0 && 6444 this.$el.parents('.wpb_row').length > 0 && 6445 this.$el.parents('.wpb_row').index() == '0')) { 6446 this.firstSection = true; 6447 } 6448 //// Disable first section calcs when using FE editor. 6449 if (nectarDOMInfo.usingFrontEndEditor && this.type != 'page-header') { 6450 this.firstSection = false; 6451 } 6452 6453 // Init class. 6454 this.$parallaxEl.addClass('translate'); 6455 6456 // Need to periodically check height/offset. 6457 setInterval(function() { 6458 6459 if( nectarState.materialOffCanvasOpen != true ) { 6460 that.offsetTop = that.$el.offset().top; 6461 that.height = that.$el.outerHeight(true); 6462 } 6463 6464 }, 800); 6465 6466 $(window).on('nectar-column-animation-start',this.checkColumnAnimation.bind(this)); 6467 6468 // Bind events. 6469 $(window).on('resize load', this.resize.bind(this)); 6470 window.addEventListener("orientationchange", this.orientationChange.bind(this)); 6471 }; 6472 6473 NectarParallaxScroll.prototype.checkColumnAnimation = function() { 6474 if( this.$parallaxEl.parents('.col.has-animation.triggered-animation:not(.animated-in)').length > 0 ) { 6475 this.realtimeOffsetUpdate(); 6476 } 6477 }; 6478 6479 NectarParallaxScroll.prototype.realtimeOffsetUpdate = function() { 6480 // Triggered when a column animation is active. 6481 var that = this; 6482 6483 var realTimeOffset = setInterval(function() { 6484 if( nectarState.materialOffCanvasOpen != true ) { 6485 that.offsetTop = that.$el.offset().top; 6486 that.height = that.$el.outerHeight(true); 6487 } 6488 },30); 6489 6490 setTimeout(function(){ 6491 clearInterval(realTimeOffset); 6492 },2000); 6493 6494 } 6495 6496 NectarParallaxScroll.prototype.resize = function() { 6497 6498 this.offsetTop = this.$el.offset().top; 6499 this.height = this.$el.outerHeight(true); 6500 6501 if( !nectarDOMInfo.usingMobileBrowser ) { 6502 this.storedWinH = nectarDOMInfo.winH; 6503 } 6504 6505 }; 6506 6507 NectarParallaxScroll.prototype.orientationChange = function() { 6508 6509 if( nectarDOMInfo.usingMobileBrowser ) { 6510 this.offsetTop = this.$el.offset().top; 6511 this.height = this.$el.outerHeight(true); 6512 this.storedWinH = nectarDOMInfo.winH; 6513 } 6514 6515 }; 6516 6517 6518 NectarParallaxScroll.prototype.update = function() { 6519 6520 // Outside of viewport. 6521 if(this.offsetTop + this.height < nectarDOMInfo.scrollTop || 6522 this.offsetTop > nectarDOMInfo.scrollTop + nectarDOMInfo.winH || 6523 nectarState.materialOffCanvasOpen == true) { 6524
6525 for(var i = 0; i < this.$parallaxEl.length; i++) { 6526 this.$parallaxEl[i].style.willChange = 'auto'; 6527 } 6528 6529 requestAnimationFrame(this.update.bind(this)); 6530 return; 6531 } 6532 6533 for(var i = 0; i < this.$parallaxEl.length; i++) { 6534 6535 if( this.firstSection === true ) { 6536 this.$parallaxEl[i].style.transform = 'translate3d(0, ' + parseInt(nectarDOMInfo.scrollTop * this.speed) + 'px, 0)'; 6537 } 6538 else { 6539 this.$parallaxEl[i].style.transform = 'translate3d(0, ' + parseInt(((this.storedWinH + nectarDOMInfo.scrollTop - this.offsetTop) * this.speed)) + 'px, 0) scale(1.005)'; 6540 } 6541 this.$parallaxEl[i].style.willChange = 'transform'; 6542 } 6543 6544 requestAnimationFrame(this.update.bind(this)); 6545 }; 6546 6547 6548 6549 /** 6550 * Parallax scroll speed helper. 6551 * 6552 * @since 4.0 6553 */ 6554 function parallaxSrollSpeed(speedString) { 6555 6556 var speed; 6557 switch (speedString) { 6558 case 'slow': 6559 speed = 0.6; 6560 break; 6561 case 'medium': 6562 speed = 0.4; 6563 break; 6564 case 'medium_fast': 6565 speed = 0.28; 6566 break; 6567 case 'fast': 6568 speed = 0.20; 6569 break; 6570 case 'very_subtle': 6571 speed = 0.12; 6572 break; 6573 } 6574 6575 return speed; 6576 } 6577 6578 6579 /** 6580 * Parallax scroll initialization. 6581 * 6582 * @since 4.0 6583 */ 6584 function parallaxScrollInit() { 6585 6586 if (nectarDOMInfo.usingMobileBrowser && $('body[data-remove-m-parallax="1"]').length > 0) { 6587 return; 6588 } 6589 6590 parallaxRowsBGCals(); 6591 6592 var parallaxItemCount = 0; 6593 6594 $('.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() { 6595 6596 6597 // Generic. 6598 if( $(this).is('[data-n-parallax-bg][data-parallax-speed]') ) { 6599 parallaxItemsArr[parallaxItemCount] = new NectarParallaxScroll($(this), '.parallax-layer', parallaxSrollSpeed($(this).attr('data-parallax-speed')), 'regular'); 6600 parallaxItemCount++; 6601 } 6602 else { 6603 6604 if ( $(this).find('[data-parallax-speed="fixed"]').length == 0) { 6605 6606 // Slider. 6607 if ( $(this).hasClass('nectar-slider-wrap') ) { 6608 parallaxItemsArr[parallaxItemCount] = new NectarParallaxScroll($(this), '.video-wrap, .image-bg', 0.25, 'nectar-slider'); 6609 } 6610 // Page Header. 6611 else if( $(this).hasClass('page-header-bg-image-wrap') ) { 6612 parallaxItemsArr[parallaxItemCount] = new NectarParallaxScroll($(this), '.page-header-bg-image', 0.25, 'page-header'); 6613 } 6614 else if( $(this).hasClass('nectar-video-wrap') && $(this).parents('#page-header-bg').length > 0 ) { 6615 parallaxItemsArr[parallaxItemCount] = new NectarParallaxScroll($(this), '.nectar-video-bg', 0.25, 'page-header'); 6616 } 6617 // All Others. 6618 else { 6619 parallaxItemsArr[parallaxItemCount] = new NectarParallaxScroll($(this), '.row-bg.using-image', parallaxSrollSpeed($(this).find('.row-bg').attr('data-parallax-speed')), 'regular'); 6620 } 6621 6622 parallaxItemCount++; 6623 6624 } 6625 6626 } 6627 6628 $(this).addClass('nectar-parallax-enabled'); 6629 6630 }); 6631 6632 $('.woocommerce-tabs .wc-tabs li').on('click', function(){ 6633 setTimeout(parallaxRowsBGCals,100); 6634 }); 6635 6636 6637 } 6638 6639 6640 6641 /** 6642 * Parallax row background height calculations. 6643 * 6644 * @since 6.0 6645 */ 6646 function parallaxRowsBGCals() { 6647 6648 if (nectarDOMInfo.usingMobileBrowser && $('body[data-remove-m-parallax="1"]').length > 0) { 6649 return; 6650 } 6651 6652 $('.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 () { 6653 6654 var $non_page_builder_slider; 6655 6656 if( $(this).parents('.wpb_tab:not(.visible-tab)').length > 0 || $(this).parents('.wc-tab').length > 0 && $(this).parents('.wc-tab').css('display') !== 'block' ) { 6657 return true; 6658 } 6659 6660 if ($(this).find('.row-bg').length == 0 && 6661 $(this).find('.page-header-bg-image').length > 0 ) { 6662 //skip processing. 6663 } 6664 else if ($(this).find('.row-bg').length == 0 && 6665 $(this).find('.image-bg').length > 0) { 6666 6667 $non_page_builder_slider = false; 6668 6669 // First nectar slider shortcode without page builder 6670 if ($('.wpb_row').length == 0 && 6671 $(this).parents('.nectar-slider-wrap[data-full-width="true"]').length > 0 && 6672 $(this).parents('.parallax_slider_outer').length > 0 && 6673 $(this).parents('.parallax_slider_outer').index() == '1') { 6674 $non_page_builder_slider = true; 6675 } 6676 6677 // Portfolio first 6678 if ($('#portfolio-extra').length > 0 && 6679 $(this).parents('.wpb_row').length > 0 && 6680 $(this).parents('.parallax_slider_outer').length > 0 && 6681 $(this).parents('.wpb_row').index() == '0') { 6682 $non_page_builder_slider = true; 6683 } 6684 6685 // Set heights. 6686 if ($(this).parents('.top-level').length > 0 && !nectarDOMInfo.usingFrontEndEditor || 6687 $non_page_builder_slider && !nectarDOMInfo.usingFrontEndEditor) { 6688 6689 $(this).find('.image-bg').css({ 6690 'height': Math.ceil($(this).parent().offset().top * 0.25) + $(this).outerHeight(true) 6691 });
6692 } else { 6693 $(this).find('.image-bg').css({ 6694 'height': Math.ceil($window.height() * 0.25) + $(this).outerHeight(true) 6695 }); 6696 } 6697 6698 } 6699 6700 // Video backgrounds. 6701 else if ($(this).find('.row-bg').length == 0 && $(this).find('.video-wrap').length > 0) { 6702 6703 $non_page_builder_slider = false; 6704 // First nectar slider shortcode without page builder 6705 if ($('.wpb_row').length == 0 && 6706 $(this).parents('.nectar-slider-wrap[data-full-width="true"]').length > 0 && 6707 $(this).parents('.parallax_slider_outer').length > 0 && 6708 $(this).parents('.parallax_slider_outer').index() == '1') { 6709 $non_page_builder_slider = true; 6710 } 6711 // Portfolio first 6712 if ($('#portfolio-extra').length > 0 && 6713 $(this).parents('.wpb_row').length > 0 && 6714 $(this).parents('.parallax_slider_outer').length > 0 && 6715 $(this).parents('.wpb_row').index() == '0') { 6716 $non_page_builder_slider = true; 6717 } 6718 6719 // Set heights. 6720 if ($(this).parents('.top-level').length > 0 && !nectarDOMInfo.usingFrontEndEditor || 6721 $non_page_builder_slider && !nectarDOMInfo.usingFrontEndEditor) { 6722 6723 $(this).find('.video-wrap').css({ 6724 'height': Math.ceil($(this).parent().offset().top * 0.25) + $(this).outerHeight(true) 6725 });
6726 } 6727 6728 else { 6729 $(this).find('.video-wrap').css({ 6730 'height': Math.ceil($window.height() * 0.25) + $(this).outerHeight(true) 6731 }); 6732 } 6733 6734 var vid = $(this).find('.video-wrap video'), 6735 vid_w_orig = 1280, 6736 vid_h_orig = 720; 6737 6738 // Get the parent element size 6739 var container_w = vid.parent().width(), 6740 container_h = vid.parent().height(), 6741 scale_w = container_w / vid_w_orig, 6742 scale_h = container_h / vid_h_orig; 6743 6744 var scale = scale_w > scale_h ? scale_w : scale_h; 6745 6746 // Scale the video. 6747 vid.width(scale * vid_w_orig); 6748 vid.height(scale * vid_h_orig); 6749 6750 } else { 6751 6752 // Top Level Special elements, Recent posts/ Simple Slider. 6753 if ($(this).is('.nectar-recent-posts-single_featured') && 6754 $(this).parents('.top-level').length > 0 && 6755 !nectarDOMInfo.usingFrontEndEditor) { 6756 //skip processing. 6757 } 6758 else if ($(this).is('.nectar-simple-slider') && 6759 $(this).parents('.top-level').length > 0 && 6760 !nectarDOMInfo.usingFrontEndEditor) { 6761 //skip processing. 6762 } 6763 else if($(this).is('.column-image-bg-wrap') && 6764 $(this).parents('.top-level').length > 0 && 6765 $(this).parent().parent().is('.vc_col-sm-12:not(.child_column)')) { 6766 //skip processing. 6767 } 6768 // Regular. 6769 else if (!$(this).hasClass('top-level') || nectarDOMInfo.usingFrontEndEditor || $(this).find('.parallax-layer').length > 0) { 6770 6771 var classSelector = '.row-bg'; 6772 var parallaxSpeed = $(this).find('.row-bg').attr('data-parallax-speed'); 6773 6774 if( $(this).find('.parallax-layer').length > 0 ) { 6775 classSelector = '.parallax-layer'; 6776 parallaxSpeed = $(this).attr('data-parallax-speed'); 6777 } 6778 6779 var $ifFast = ($(this).find(classSelector + '[data-parallax-speed="fast"]').length > 0) ? 60 : 0; 6780 $(this).find(classSelector).css({ 6781 'height': Math.ceil($window.height() * parallaxSrollSpeed(parallaxSpeed) ) + $(this).outerHeight(true) + $ifFast 6782 });
6783 6784 6785 } 6786 6787 } 6788 6789 }); 6790 6791 } 6792 6793 6794 /** 6795 * Class names added for specific full width section rows at top 6796 * 6797 * @since 3.0 6798 */ 6799 function fwsClasses() { 6800 6801 $('.wpb_wrapper > .nectar-slider-wrap[data-full-width="true"]').each(function () { 6802 if (!$(this).parent().hasClass('span_9') && !$(this).parent().hasClass('span_3') && $(this).parent().attr('id') != 'sidebar-inner') { 6803 if ($(this).parents('.wpb_row').index() == '0') { 6804 $(this).addClass('first-nectar-slider'); 6805 } 6806 } 6807 }); 6808 6809 var $contentElementsNum = ($('#portfolio-extra').length == 0) ? $('.main-content > .row > *').length : $('.main-content > .row #portfolio-extra > *').length; 6810 6811 if ($('#portfolio-extra').length == 0) { 6812 $contentElementsNum = ($('.main-content > .row > .wpb_row').length > 0) ? $('.main-content > .row > .wpb_row').length : $('.main-content > .row > *').length; 6813 } else { 6814 $contentElementsNum = $('.main-content > .row #portfolio-extra > *').length; 6815 } 6816 6817 $('.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 () { 6818 6819 if( $(this).parents('.nectar-global-section.before-footer').length > 0 ) { 6820 return true; 6821 } 6822 6823 6824 if (!$(this).parent().hasClass('span_9') && !$(this).parent().hasClass('span_3') && $(this).parent().attr('id') != 'sidebar-inner') { 6825 6826 if ($(this).parents('.wpb_row').length > 0) { 6827 6828 if ($(this).parents('#portfolio-extra').length > 0 && 6829 $('#full_width_portfolio').length == 0) { 6830 return false; 6831 } 6832 6833 ////first 6834 if ($(this).parents('.wpb_row').index() == '0' && $pageHeaderBG.length != 0) { 6835 //skip processing. 6836 } 6837 else if ($(this).parents('.wpb_row').index() == '0' && 6838 $pageHeaderBG.length == 0 && $('.page-header-no-bg').length == 0 && 6839 $('.project-title').length == 0 && $(this).parents('.wpb_row').index() == '0' && 6840 $('.project-title').length == 0 && $('body[data-bg-header="true"]').length == 0) { 6841 6842 if ($('.single').length == 0) { 6843 $('.container-wrap').css('padding-top', '0px'); 6844 } else { 6845 $(this).addClass('first-section'); 6846 } 6847 6848 } 6849 6850 // Check if it's also last (i.e. the only fws) 6851 if ($(this).parents('.wpb_row').index() == $contentElementsNum - 1 && $('#respond').length == 0) { 6852 if ($(this).attr('id') != 'portfolio-filters-inline') { 6853 $('.container-wrap').css('padding-bottom', '0px'); 6854 $('#call-to-action .triangle').remove(); 6855 } 6856 } 6857 6858 } else { 6859 6860 if ($(this).parents('#portfolio-extra').length > 0 && $('#full_width_portfolio').length == 0) { 6861 return false; 6862 } 6863 6864 if ($(this).find('.portfolio-filters-inline').length == 0 && $(this).attr('id') != 'post-area') { 6865 6866 ////first 6867 if ($(this).index() == '0' && $pageHeaderBG.length != 0) { 6868 //skip processing. 6869 } 6870 else if ($(this).index() == '0' && $pageHeaderBG.length == 0 && 6871 $(this).index() == '0' && $('.page-header-no-bg').length == 0 && 6872 $(this).index() == '0' && !$(this).hasClass('blog_next_prev_buttons') && 6873 !$(this).hasClass('nectar-shop-outer') && $(this).parents('.pum-container').length == 0) { 6874 6875 if ($('body[data-header-resize="0"]').length == 1 && $('.single').length == 0 || $('body.material').length > 0 && $('.single').length == 0) { 6876 6877 if (!$('body.blog .blog-fullwidth-wrap > .masonry:not(.meta-overlaid)').length > 0) { 6878 $('.container-wrap').css('padding-top', '0px'); 6879 } 6880 6881 } 6882 6883 else { 6884 $(this).addClass('first-section'); 6885 } 6886 6887 } 6888 6889 //check if it's also last (i.e. the only fws) 6890 if ($(this).index() == $contentElementsNum - 1 && $('#respond').length == 0 && $('body.woocommerce-checkout').length == 0) { 6891 $('.container-wrap').css('padding-bottom', '0px'); 6892 $('.bottom_controls').css('margin-top', '0px'); 6893 $('#call-to-action .triangle').remove(); 6894 } 6895 6896 } 6897 } 6898 } 6899 6900 });
6901 6902 6903 $('#portfolio-extra > .nectar-slider-wrap[data-full-width="true"], .portfolio-wrap').each(function () { 6904 //check if it's last 6905 if ($(this).index() == $contentElementsNum - 1 && $('#commentform').length == 0 && $('#pagination').length == 0) { 6906 if (parseInt($('.container-wrap').css('padding-bottom')) > 0) { 6907 $(this).css('margin-bottom', '-40px'); 6908 } 6909 $('#call-to-action .triangle').remove(); 6910 } 6911 }); 6912 6913 6914 $('.portfolio-filters').each(function () { 6915 ////first 6916 if ($(this).index() == '0' && $pageHeaderBG.length != 0 || $(this).index() == '0') { 6917 $(this).addClass('first-section nder-page-header'); 6918 } else if ($(this).index() == '0' && $pageHeaderBG.length == 0 || $(this).index() == '0') { 6919 $(this).css({ 6920 'margin-top': '0px' 6921 }).addClass('first-section'); 6922 } 6923 }); 6924 6925 6926 $('.portfolio-filters-inline').each(function () { 6927 ////first 6928 if ($(this).parents('.wpb_row').length > 0) { 6929 //skip processing. 6930 } else { 6931 if ($(this).index() == '0' && $pageHeaderBG.length != 0 || $(this).index() == '0') { 6932 $(this).addClass('first-section nder-page-header'); 6933 } else if ($(this).index() == '0' && $pageHeaderBG.length == 0 || $(this).index() == '0') { 6934 6935 $(this).css({ 6936 'margin-top': '-30px', 6937 'padding-top': '50px' 6938 }).addClass('first-section'); 6939 6940 } 6941 } 6942 6943 }); 6944 6945 6946 } 6947 6948 6949 6950 6951 /** 6952 * Full width row padding adjust calculations. 6953 * 6954 * @since 3.0 6955 */ 6956 function fullWidthRowPaddingAdjustCalc() { 6957 6958 if ($('#boxed').length == 0) { 6959 6960 $('.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 () { 6961 6962 var $windowHeight = $window.width(), 6963 $topPadding = ($(this).attr('data-top-percent')) ? $(this).attr('data-top-percent') : 'skip', 6964 $bottomPadding = ($(this).attr('data-bottom-percent')) ? $(this).attr('data-bottom-percent') : 'skip'; 6965 6966 //top 6967 if ($topPadding != 'skip') { 6968 $(this).css('padding-top', $windowHeight * (parseInt($topPadding) / 100)); 6969 } 6970 6971 //bottom 6972 if ($bottomPadding != 'skip') { 6973 $(this).css('padding-bottom', $windowHeight * (parseInt($bottomPadding) / 100)); 6974 } 6975 6976 }); 6977 } 6978 } 6979 6980 /** 6981 * Full width row padding adjust calculations for boxed theme option. 6982 * 6983 * @since 11.0.4 6984 */ 6985 function fullWidthRowPaddingAdjustCalcBoxed() { 6986 6987 if ($('#boxed').length > 0) { 6988 6989 $('.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 () { 6990 6991 var $topPadding = ($(this).attr('data-top-percent')) ? $(this).attr('data-top-percent') : 'skip', 6992 $bottomPadding = ($(this).attr('data-bottom-percent')) ? $(this).attr('data-bottom-percent') : 'skip'; 6993 6994 //top 6995 if ($topPadding != 'skip') { 6996 $(this).css('padding-top', $topPadding); 6997 } 6998 6999 //bottom 7000 if ($bottomPadding != 'skip') { 7001 $(this).css('padding-bottom', $bottomPadding); 7002 } 7003 7004 }); 7005 } 7006 7007 } 7008 7009 7010 /** 7011 * Full width row padding adjust initialization 7012 * 7013 * @since 10.5 7014 */ 7015 function fullWidthRowPaddingAdjust() { 7016 7017 if (nectarDOMInfo.usingMobileBrowser) { 7018 fullWidthRowPaddingAdjustCalc(); 7019 } 7020 7021 $window.on('resize', fullWidthRowPaddingAdjustCalc); 7022 7023 } 7024 7025 7026 7027 7028 /** 7029 * Full width content row auto equal height cols. 7030 * 7031 * @since 4.0 7032 */ 7033 function fullWidthContentColumns() { 7034 7035 var $frontEndEditorElDiv = ($('body.vc_editor').length > 0) ? '.vc_element > ' : ''; 7036 7037 $('.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 () { 7038 7039 // Only set the height if more than one column 7040 if ($(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col').length > 1) { 7041 7042 var tallestColumn = 0;
7043 var $columnInnerHeight = 0; 7044 var $column_inner_selector; 7045 7046 $(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col').each(function () { 7047 7048 $column_inner_selector = ($(this).find('> .vc_column-inner > .wpb_wrapper').length > 0) ? '.vc_column-inner' : '.column-inner-wrap > .column-inner'; 7049 7050 var $padding = ( $body.is('[data-flex-cols="true"]') ) ? parseInt($(this).find('> .vc_column-inner').css('padding-top')) : parseInt($(this).css('padding-top')); 7051 var $frontEndEditorElPadding = ($frontEndEditorElDiv.length > 2 && $(this).find('> .vc_column-inner').length > 0) ? parseInt($(this).find('> .vc_column-inner').css('padding-top')) : 0; 7052 7053 if( $(this).find('> ' + $column_inner_selector + ' > .wpb_wrapper').height() + ($padding * 2) + $frontEndEditorElPadding > tallestColumn ) { 7054 tallestColumn = $(this).find('> ' + $column_inner_selector + ' > .wpb_wrapper').height() + ($padding * 2) + $frontEndEditorElPadding; 7055 } 7056 7057 }); 7058 7059 $(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col').each(function () { 7060 7061 $column_inner_selector = ($(this).find('> .vc_column-inner > .wpb_wrapper').length > 0) ? '.vc_column-inner' : '.column-inner-wrap > .column-inner'; 7062 7063 // Columns with content 7064 if ($(this).find('> ' + $column_inner_selector + ' > .wpb_wrapper > *').length > 0) { 7065 7066 // Added in 7.6 to fix equal height columns 7067 if ($frontEndEditorElDiv.length < 2 && !$(this).parent().parent().hasClass('vc_row-o-equal-height')) { 7068 $(this).css('height', tallestColumn); 7069 7070 if( $body.is('[data-flex-cols="true"]') ) { 7071 $(this).find('> .vc_column-inner').css('height', tallestColumn); 7072 } 7073 7074 } else if ($frontEndEditorElDiv.length > 2 && !$(this).parent().parent().parent().hasClass('vc_row-o-equal-height')) { 7075 $(this).css('height', tallestColumn); 7076 7077 if( $body.is('[data-flex-cols="true"]') ) { 7078 $(this).find('> .vc_column-inner').css('height', tallestColumn); 7079 } 7080 7081 } 7082 } 7083 7084 // Empty columns 7085 else { 7086 if ($(this).is('[data-using-bg="true"]')) { 7087 7088 $(this).css('min-height', tallestColumn); 7089 7090 if( $body.is('[data-flex-cols="true"]') ) { 7091 $(this).find('> .vc_column-inner').css('min-height', tallestColumn); 7092 } 7093 7094 if ($(this).is('[data-animation*="reveal"]')) { 7095 $(this).find('.column-inner') 7096 .css('min-height', tallestColumn); 7097 } 7098 7099 } 7100 } 7101 7102 }); 7103 7104 // Nested column height 7105 if (nectarDOMInfo.winW < 1000) { 7106 $(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col .wpb_row .col').css('min-height', '0px'); 7107 } 7108 7109 // Vertically center 7110 if ($(this).hasClass('vertically-align-columns') && 7111 nectarDOMInfo.winW > 1000 && 7112 !$(this).hasClass('vc_row-o-equal-height')) { 7113 7114 // Parent columns 7115 $(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col').each(function () { 7116 7117 $column_inner_selector = ($(this).find('> .vc_column-inner > .wpb_wrapper').length > 0) ? '.vc_column-inner' : '.column-inner-wrap > .column-inner'; 7118
7119 $columnInnerHeight = $(this).find('> ' + $column_inner_selector + ' > .wpb_wrapper').height(); 7120 7121 var $marginCalc = ($(this).height() / 2) - ($columnInnerHeight / 2); 7122 7123 if ($marginCalc <= 0) { 7124 $marginCalc = 0; 7125 } 7126 7127 $(this).find('> ' + $column_inner_selector + ' > .wpb_wrapper') 7128 .css('margin-top', $marginCalc) 7129 .css('margin-bottom', $marginCalc); 7130 7131 }); 7132 7133 7134 } 7135 7136 } 7137 7138 }); 7139 7140 7141 if( $('body[data-flex-cols="true"]').length == 0 ) { 7142 7143 // Equal height columns in container type with reveal columns 7144 $('.main-content > .row > .wpb_row:not(.full-width-content).vc_row-o-equal-height').each(function () { 7145 if ($(this).find('>.span_12 > ' + $frontEndEditorElDiv + ' .wpb_column[data-animation*="reveal"]').length > 0) { 7146 7147 var tallestColumn = 0; 7148 7149 $(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col').each(function () { 7150 7151 var $padding = parseInt($(this).find('> .column-inner-wrap > .column-inner').css('padding-top')); 7152 7153 if( $(this).find('> .column-inner-wrap > .column-inner').height() + ($padding * 2) > tallestColumn ) { 7154 tallestColumn = $(this).find('> .column-inner-wrap > .column-inner').height() + ($padding * 2); 7155 } 7156 7157 });
7158 7159 $(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col').each(function () { 7160 7161 // Columns with content 7162 if ($(this).find('> .column-inner-wrap > .column-inner .wpb_wrapper > *').length > 0) { 7163 $(this).find('> .column-inner-wrap').css('height', tallestColumn); 7164 } 7165 // Empty columns 7166 else { 7167 $(this).css('min-height', tallestColumn); 7168 if ($(this).is('[data-animation*="reveal"]')) { 7169 $(this).find('.column-inner').css('min-height', tallestColumn); 7170 } 7171 } 7172 }); 7173 7174 } 7175 }); 7176 7177 // Using equal height option, top/bottom padding % needs to be convered into px for cross browser (flex bug) 7178 $('.wpb_row.vc_row-o-equal-height>.span_12> ' + $frontEndEditorElDiv + '.wpb_column[class*="padding-"][data-padding-pos="all"]').each(function () { 7179 if ($(this).parents('.tabbed').length == 0) { 7180 $(this).css({ 7181 'padding-top': $(this).css('padding-left'), 7182 'padding-bottom': $(this).css('padding-left') 7183 });
7184 } 7185 }); 7186 7187 } // endif; Not using modern grid system. 7188 7189 } 7190 7191 7192 7193 7194 /** 7195 * Mouse parallax row option. 7196 * 7197 * @since 4.0 7198 */ 7199 function mouseParallaxInit() { 7200 7201 $('.wpb_row:has(.nectar-parallax-scene)').each(function (i) { 7202 7203 var $strength = parseInt($(this).find('.nectar-parallax-scene').attr('data-scene-strength')); 7204 7205 $mouseParallaxScenes[i] = $(this).find('.nectar-parallax-scene').parallax({ 7206 scalarX: $strength, 7207 scalarY: $strength 7208 }); 7209 7210 // Wait until the images in the scene have loaded. 7211 var images = $(this).find('.nectar-parallax-scene li'); 7212 7213 $.each(images, function () { 7214 if ($(this).find('div').length > 0) { 7215 var el = $(this).find('div'), 7216 image = el.css('background-image').replace(/"/g, '').replace(/url\(|\)$/ig, ''); 7217 if (image && image !== '' && image !== 'none') { 7218 images = images.add($('<img>').attr('src', image)); 7219 } 7220 } 7221 }); 7222 7223 }); 7224 7225 } 7226 7227 7228 7229 7230 /** 7231 * Add checkmark icons to unorder list with checkmark class. 7232 * 7233 * @since 2.0 7234 */ 7235 function ulCheckmarks() { 7236 $('ul.checks li').each(function () { 7237 if ($(this).find('i.fa-check-circle').length == 0) { 7238 $(this).prepend('<i class="fa fa-check-circle"></i>'); 7239 } 7240 }); 7241 } 7242 7243 7244 7245 /** 7246 * Allow CTA element BG color to also act as a link. 7247 * 7248 * @since 11.0 7249 */ 7250 function ctaLinkBG() { 7251 7252 $body.on('click','.nectar-cta[data-using-bg="true"]:not([data-style="material"]) .link_wrap', function(e) { 7253 if( !$(e.target).is('a') ) { 7254 $(this).find('a.link_text')[0].click(); 7255 } 7256 }); 7257 7258 } 7259 7260 7261 7262 /** 7263 * Add CSS default animation classes through JS to 7264 * avoid inital animation on page load. 7265 * 7266 * @since 11.0 7267 */ 7268 function nectarKeyframeAssist() { 7269 7270 $('.nectar-cta[data-style="arrow-animation"]').addClass('loaded'); 7271 7272 } 7273 7274 7275 7276 7277 /** 7278 * Page builder row background layer animations. 7279 * 7280 * @since 9.0 7281 * @see waypoints 7282 */ 7283 function rowBGAnimations() { 7284 7285 var $rowBGAnimationsOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : '93%'; 7286 var $rowBGAnimationsRevealOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : '97%'; 7287 var $rowBGOffset; 7288 7289 $($fullscreenSelector + '.row-bg-wrap[data-bg-animation]:not([data-bg-animation="none"]) .row-bg').each(function () { 7290 7291 var $animation = $(this).parents('.row-bg-wrap').attr('data-bg-animation'); 7292 7293 if( $animation != 'zoom-out-reveal' && $animation.indexOf('reveal-from-') == -1 ) { 7294 $rowBGOffset = $rowBGAnimationsOffsetPos; 7295 } else { 7296 $rowBGOffset = $rowBGAnimationsRevealOffsetPos; 7297 } 7298 7299 if( !$(this).hasClass('using-image') && $(this).parents('.nectar-scrolling-text').length == 0 ) { 7300 7301 if( $animation != 'zoom-out-reveal' && $animation.indexOf('reveal-from-') == -1 ) { 7302 return; 7303 } 7304 7305 } 7306 7307 7308 var $that = $(this); 7309 var waypoint = new Waypoint({ 7310 element: $that.parents('.row-bg-wrap'), 7311 handler: function () { 7312 7313 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 7314 waypoint.destroy(); 7315 return; 7316 } 7317 7318 $that.parents('.inner-wrap').addClass('animated-in'); 7319 7320 if( $animation == 'zoom-out-reveal' || $animation.indexOf('reveal-from-') > -1 || $that.parents('.nectar-scrolling-text').length > 0 ) { 7321 $that.parents('.row-bg-wrap').addClass('animated-in'); 7322 } 7323 7324 waypoint.destroy(); 7325 }, 7326 offset: $rowBGOffset 7327 }); 7328 7329 }); 7330 7331 } 7332 7333 7334 /** 7335 * Page builder column background layer animations. 7336 * 7337 * @since 9.0 7338 * @see waypoints 7339 */ 7340 function columnBGAnimations() { 7341 7342 var $colBGAnimationsOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : '93%'; 7343 var $colBGAnimationsRevealOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : '80%'; 7344 var $colBGOffset; 7345 7346 $($fullscreenSelector + '.column-image-bg-wrap[data-bg-animation]:not([data-bg-animation="none"]):not([data-bg-animation*="displace-filter"]) .column-image-bg').each(function () { 7347 7348 var $animation = $(this).parents('.column-image-bg-wrap').attr('data-bg-animation'); 7349 7350 if( $animation != 'zoom-out-reveal' && $animation.indexOf('reveal-from-') == -1 ) { 7351 $colBGOffset = $colBGAnimationsOffsetPos; 7352 } else { 7353 7354 if( $animation == 'ro-reveal-from-bottom' && $fullscreenMarkupBool == false ) { 7355 $colBGOffset = '95%'; 7356 } else if( $animation == 'ro-reveal-from-top' && $fullscreenMarkupBool == false ) { 7357 $colBGOffset = '65%'; 7358 } else { 7359 $colBGOffset = $colBGAnimationsRevealOffsetPos; 7360 } 7361 } 7362 7363 var $that = $(this); 7364 7365 var waypoint = new Waypoint({ 7366 element: $that.parents('.column-image-bg-wrap'), 7367 handler: function () { 7368 7369 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 7370 waypoint.destroy(); 7371 return; 7372 } 7373 7374 $that.parents('.inner-wrap').addClass('animated-in'); 7375 if( $animation == 'zoom-out-reveal' || $animation.indexOf('reveal-from-') > -1 ) { 7376 $that.parents('.column-image-bg-wrap').addClass('animated-in'); 7377 $that.parents('.column-image-bg-wrap').siblings('.column-bg-overlay-wrap').addClass('animated-in'); 7378 $that.parents('.vc_column-inner').addClass('revealed-bg'); 7379 } 7380 waypoint.destroy(); 7381 }, 7382 offset: $colBGOffset 7383 });
7384 7385 }); 7386 7387 // Zoom out reveal with BG color only 7388 $($fullscreenSelector + '.column-bg-overlay-wrap[data-bg-animation]').each(function () { 7389 7390 $colBGOffset = $colBGAnimationsRevealOffsetPos; 7391 7392 var $that = $(this); 7393 var $animation = $(this).attr('data-bg-animation'); 7394 7395 if( $animation == 'zoom-out-reveal' || $animation.indexOf('reveal-from-') > 0 ) { 7396 7397 if( $that.parent().find('.column-image-bg-wrap').length == 0 ) { 7398 7399 var waypoint = new Waypoint({ 7400 element: $that, 7401 handler: function () { 7402 7403 if ( $that.hasClass('animated-in') ) { 7404 waypoint.destroy(); 7405 return; 7406 } 7407 7408 $that.addClass('animated-in'); 7409 $that.parents('.vc_column-inner').addClass('revealed-bg'); 7410 waypoint.destroy(); 7411 7412 }, 7413 offset: $colBGOffset 7414 }); 7415 7416 } 7417 7418 } 7419 7420 }); 7421 7422 } 7423 7424 7425 7426 /** 7427 * Page builder column and image animations. 7428 * 7429 * @since 4.0 7430 * @see waypoints 7431 */ 7432 function colAndImgAnimations() { 7433 7434 var $colAndImgOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : '88%'; 7435 var $cascadingOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : '70%'; 7436 var $colAndImgRevealOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : '70%'; 7437 7438 $($fullscreenSelector + '.img-with-animation').each(function () { 7439 7440 var $that = $(this); 7441 7442 var $animationType = ($that.is('[data-animation]')) ? $that.attr('data-animation') : 'fade-in'; 7443 7444 // reveal images alters offset 7445 if( $animationType == 'ro-reveal-from-right' && $colAndImgOffsetPos == '88%' || 7446 $animationType == 'ro-reveal-from-left' && $colAndImgOffsetPos == '88%' ) { 7447 $colAndImgOffsetPos = '75%'; 7448 } 7449 7450 // initiate waypoint. 7451 var waypoint = new Waypoint({ 7452 element: $that, 7453 handler: function () { 7454 7455 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 7456 waypoint.destroy(); 7457 return; 7458 } 7459 7460 if (!bypassAnimations || $('body[data-responsive="0"]').length > 0) { 7461 7462 var $delay = ($that.is('[data-delay]')) ? $that.attr('data-delay') : 0; 7463 var $elToAnimate = ($that.parents('.hover-wrap').length > 0) ? $that.parents('.hover-wrap') : $that; 7464 7465 7466 if ($animationType == 'fade-in-from-left' || $animationType == 'fade-in-from-right') { 7467 7468 $elToAnimate.delay($delay).transition({ 7469 'opacity': 1, 7470 'x': '0px' 7471 }, $animationDuration, $animationEasing); 7472 7473 } else if ($animationType == 'fade-in-from-bottom') { 7474 7475 $elToAnimate.delay($delay).transition({ 7476 'opacity': 1, 7477 'y': '0px' 7478 }, $animationDuration, $animationEasing); 7479 7480 } else if ($animationType == 'fade-in') { 7481 7482 $elToAnimate.delay($delay).transition({ 7483 'opacity': 1 7484 }, $animationDuration, $animationEasing); 7485 7486 } else if ($animationType == 'grow-in') { 7487 7488 setTimeout(function () { 7489 $elToAnimate.transition({ 7490 scale: 1, 7491 'opacity': 1 7492 }, $animationDuration, $animationEasing); 7493 }, $delay); 7494 7495 } else if ($animationType == 'flip-in') { 7496 7497 setTimeout(function () { 7498 $elToAnimate.transition({ 7499 rotateY: 0, 7500 'opacity': 1 7501 }, $animationDuration, $animationEasing); 7502 }, $delay); 7503 7504 } else if ($animationType == 'flip-in-vertical') { 7505 7506 setTimeout(function () { 7507 $elToAnimate.transition({ 7508 rotateX: 0, 7509 'opacity': 1 7510 }, $animationDuration, $animationEasing); 7511 }, $delay); 7512 7513 } 7514 else if ($animationType == 'ro-reveal-from-left' || 7515 $animationType == 'ro-reveal-from-right' || 7516 $animationType == 'ro-reveal-from-bottom' || 7517 $animationType == 'ro-reveal-from-top') { 7518 $that.parents('.img-with-aniamtion-wrap').addClass('animated-in'); 7519 } 7520 7521 $that.addClass('animated-in'); 7522 7523 } 7524 7525 waypoint.destroy(); 7526 7527 }, 7528 offset: $colAndImgOffsetPos 7529 });
7530 7531 7532 7533 }); 7534 7535 7536 $($fullscreenSelector + '.nectar_cascading_images').each(function () { 7537 7538 var $that = $(this); 7539 var $animationDelay = ($(this).is('[data-animation-timing]')) ? $(this).attr('data-animation-timing') : 175; 7540 $animationDelay = parseInt($animationDelay); 7541 7542 var waypoint = new Waypoint({ 7543 element: $that, 7544 handler: function () { 7545 7546 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 7547 waypoint.destroy(); 7548 return; 7549 } 7550 7551 if (!bypassAnimations || $('body[data-responsive="0"]').length > 0) { 7552 7553 $that.find('.cascading-image').each(function (i) { 7554 7555 var $that2 = $(this); 7556 7557 if ($that2.attr('data-animation') == 'flip-in' || $that2.attr('data-animation') == 'flip-in-vertical') { 7558 setTimeout(function () { 7559 $that2.find('.inner-wrap').css({ 7560 'opacity': 1, 7561 'transform': 'rotate(0deg) translateZ(0px)' 7562 }); 7563 }, i * $animationDelay); 7564 } else if( $that2.attr('data-animation') == 'grow-in-reveal' ) { 7565 setTimeout(function () { 7566 $that2.find('.inner-wrap').css({ 7567 'opacity': 1, 7568 'transform': 'translateX(0px) translateY(0px) scale(1,1) translateZ(0px)' 7569 }); 7570 $that2.find('.inner-wrap img').css({ 7571 'transform': 'translateX(0px) translateY(0px) scale(1,1) translateZ(0px)' 7572 }); 7573 }, i * $animationDelay); 7574 } 7575 else { 7576 setTimeout(function () { 7577 $that2.find('.inner-wrap').css({ 7578 'opacity': 1, 7579 'transform': 'translateX(0px) translateY(0px) scale(1,1) translateZ(0px)' 7580 }); 7581 }, i * $animationDelay); 7582 } 7583 7584 7585 }); 7586 7587 $that.addClass('animated-in'); 7588 7589 } 7590 7591 waypoint.destroy(); 7592 7593 }, 7594 offset: $cascadingOffsetPos 7595 }); 7596 7597 }); 7598 7599 7600 $($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) { 7601 7602 var $that = $(this); 7603 7604 var waypoint = new Waypoint({ 7605 element: $that, 7606 handler: function () { 7607 7608 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 7609 waypoint.destroy(); 7610 return; 7611 } 7612 7613 if (!bypassAnimations || $('body[data-responsive="0"]').length > 0) { 7614 7615 $that.addClass('triggered-animation'); 7616 $(window).trigger('nectar-column-animation-start'); 7617 7618 var $delay = $that.attr('data-delay'); 7619 7620 if ($that.attr('data-animation') == 'fade-in-from-left' || $that.attr('data-animation') == 'fade-in-from-right') { 7621 7622 $standAnimatedColTimeout[i] = setTimeout(function () { 7623 $that.transition({ 7624 'opacity': 1, 7625 'x': '0px' 7626 }, $animationDuration, $animationEasing); 7627 }, $delay); 7628 7629 } else if ($that.attr('data-animation') == 'fade-in-from-bottom') { 7630 7631 $standAnimatedColTimeout[i] = setTimeout(function () { 7632 $that.transition({ 7633 'opacity': 1, 7634 'y': '0px' 7635 }, $animationDuration, $animationEasing); 7636 }, $delay); 7637 7638 } else if ($that.attr('data-animation') == 'fade-in') { 7639 7640 $standAnimatedColTimeout[i] = setTimeout(function () { 7641 $that.transition({ 7642 'opacity': 1 7643 }, $animationDuration, $animationEasing); 7644 }, $delay); 7645 7646 } else if ($that.attr('data-animation') == 'grow-in' || $that.attr('data-animation') == 'zoom-out') { 7647 7648 $standAnimatedColTimeout[i] = setTimeout(function () { 7649 $that.transition({ 7650 scale: 1, 7651 'opacity': 1 7652 }, $animationDuration, $animationEasing); 7653 }, $delay); 7654 7655 } else if ($that.attr('data-animation') == 'flip-in') { 7656 7657 $standAnimatedColTimeout[i] = setTimeout(function () { 7658 $that.transition({ 7659 rotateY: '0', 7660 'opacity': 1 7661 }, $animationDuration, $animationEasing); 7662 }, $delay); 7663 7664 } else if ($that.attr('data-animation') == 'flip-in-vertical') { 7665 7666 $standAnimatedColTimeout[i] = setTimeout(function () { 7667 $that.transition({ 7668 rotateX: '0', 7669 y: '0', 7670 'opacity': 1 7671 }, $animationDuration, $animationEasing); 7672 }, $delay); 7673 7674 } else if ($that.attr('data-animation') == 'slight-twist') { 7675 7676 $standAnimatedColTimeout[i] = setTimeout(function () { 7677 anime({ 7678 targets: $that[0], 7679 rotateY: [20, 0], 7680 rotateZ: [-4, 0], 7681 opacity: 1, 7682 easing: $animationEasing, 7683 duration: $animationDuration 7684 });
7685 }, $delay); 7686 7687 } 7688 7689 //boxed column hover fix 7690 if ($that.hasClass('boxed')) { 7691 $that.addClass('no-pointer-events'); 7692 setTimeout(function () { 7693 $that.removeClass('no-pointer-events'); 7694 }, parseInt($animationDuration) + parseInt($delay) + 30); 7695 } 7696 7697 if ($that.find('.nectar-post-grid-wrap[data-style="mouse_follow_image"]')) { 7698 setTimeout(function() { 7699 $that[0].style.transform = 'none'; 7700 }, parseInt($animationDuration) + parseInt($delay) + 30 ); 7701 } 7702 7703 $that.addClass('animated-in'); 7704 7705 } 7706 7707 waypoint.destroy(); 7708 }, 7709 offset: $colAndImgOffsetPos 7710 }); 7711 7712 }); 7713 7714 7715 $($fullscreenSelector + '.wpb_column.has-animation[data-animation*="reveal"]').each(function () { 7716 7717 var $that = $(this), 7718 waypoint = new Waypoint({ 7719 element: $that, 7720 handler: function () { 7721 7722 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 7723 waypoint.destroy(); 7724 return; 7725 } 7726 7727 var $delay = $that.attr('data-delay'); 7728 7729 if (!bypassAnimations || $('body[data-responsive="0"]').length > 0) { 7730 7731 var $columnInnerSelector = ( $that.find('> .vc_column-inner').length > 0 ) ? true : false; 7732 7733 if ($that.attr('data-animation') == 'reveal-from-bottom' || $that.attr('data-animation') == 'reveal-from-top') { 7734 7735 setTimeout(function () { 7736 7737 if ($that.hasClass('animated-in')) { 7738 7739 if( $columnInnerSelector == true ) { 7740 7741 // Modern. 7742 $that.find('> .vc_column-inner').transition({ 7743 'y': 0 7744 }, $animationDuration, $animationEasing ); 7745 7746 } else { 7747 7748 // Legacy. 7749 $that.find('.column-inner-wrap, .column-inner').transition({ 7750 'y': 0 7751 }, $animationDuration, $animationEasing, function () { 7752 $that.find('.column-inner-wrap, .column-inner').addClass('no-transform'); 7753 }); 7754 } 7755 7756 } 7757 7758 }, $delay); 7759 7760 } else if ($that.attr('data-animation') == 'reveal-from-right' || $that.attr('data-animation') == 'reveal-from-left') { 7761 setTimeout(function () { 7762 if ($that.hasClass('animated-in')) { 7763 7764 if( $columnInnerSelector == true ) { 7765 7766 // Modern. 7767 $that.find('> .vc_column-inner').transition({ 7768 'x': 0 7769 }, $animationDuration, $animationEasing); 7770 7771 7772 } else { 7773 // Legacy. 7774 $that.find('.column-inner-wrap, .column-inner').transition({ 7775 'x': 0 7776 }, $animationDuration, $animationEasing, function () { 7777 $that.find('.column-inner-wrap, .column-inner').addClass('no-transform'); 7778 }); 7779 7780 } 7781 7782 7783 } 7784 }, $delay); 7785 } 7786 7787 $that.addClass('animated-in'); 7788 7789 } 7790 7791 waypoint.destroy(); 7792 }, 7793 offset: $colAndImgRevealOffsetPos 7794 }); 7795 7796 }); 7797 7798 } 7799 7800 7801 7802 /** 7803 * Cascading images element sizing 7804 * 7805 * @since 6.0 7806 */ 7807 function cascadingImageBGSizing() { 7808 7809 $('.nectar_cascading_images').each(function () { 7810 7811 var forcedAspect = ( $(this).hasClass('forced-aspect') ) ? true : false; 7812 7813 //handle max width for cascading images in equal height columns 7814 if ($(this).parents('.vc_row-o-equal-height').length > 0 && $(this).parents('.wpb_column').length > 0) { 7815 $(this).css('max-width', $(this).parents('.wpb_column').width()); 7816 } 7817 7818 //set size for layers with no images 7819 $(this).find('.bg-color').each(function () { 7820 7821 if( forcedAspect == true && $(this).parents('.cascading-image').index() == 0 ) { 7822 return true; 7823 } 7824 7825 var $bgColorHeight = 0; 7826 var $bgColorWidth = 0; 7827 7828 if ($(this).parent().find('.img-wrap').length == 0) { 7829 7830 var $firstSibling = $(this).parents('.cascading-image').siblings('.cascading-image[data-has-img="true"]').first(); 7831 7832 $bgColorHeight = $firstSibling.find('.img-wrap').height(); 7833 $bgColorWidth = $firstSibling.find('.img-wrap').width(); 7834 7835 } else { 7836 $bgColorHeight = $(this).parent().find('.img-wrap').height(); 7837 $bgColorWidth = $(this).parent().find('.img-wrap').width(); 7838 } 7839 7840 $(this).css({ 7841 'height': $bgColorHeight, 7842 'width': $bgColorWidth 7843 }).addClass('calculated'); 7844 7845 });
7846 7847 }); 7848 7849 } 7850 7851 7852 7853 7854 /** 7855 * Cascading images element initialization. 7856 * 7857 * @since 10.5 7858 */ 7859 function cascadingImageInit() { 7860 7861 if ($('.nectar_cascading_images').length > 0) { 7862 7863 var cascadingParallax = []; 7864 7865 $('.nectar_cascading_images').each(function(i){ 7866 7867 imagesLoaded($(this), function (instance) { 7868 7869 // Create sizes. 7870 cascadingImageBGSizing(); 7871 7872 // Parallax scrolling. 7873 if( $(instance.elements[0]).is('[data-parallax="yes"]') && !nectarDOMInfo.usingMobileBrowser && $('#nectar_fullscreen_rows').length == 0 ) { 7874 cascadingParallax[i] = new CascadingParallax($(instance.elements[0]), $(instance.elements[0]).attr('data-parallax-intensity')); 7875 } 7876 7877 }); 7878 7879 }); 7880 7881 // BG Sizing Resize. 7882 $window.on('resize', cascadingImageBGSizing); 7883 7884 } 7885 7886 } 7887 7888 7889 7890 7891 function CascadingParallax(el, intensity) { 7892 7893 this.$element = el; 7894 this.inView = false; 7895 this.topLevel = false; 7896 this.lastY = 0; 7897 7898 this.layer1Parallax = ( this.$element.is('[data-layer-1-parallax="yes"]') ) ? true : false; 7899 7900 switch(intensity) { 7901 case 'subtle': 7902 this.intensity = 0.09; 7903 break; 7904 case 'medium': 7905 this.intensity = 0.15; 7906 break; 7907 case 'high': 7908 this.intensity = 0.25; 7909 break; 7910 } 7911 this.calculatePos(); 7912 this.trackView(); 7913 this.animate(); 7914 7915 if( $('.portfolio-filters').length > 0 || 7916 $('.portfolio-filters-inline').length > 0 ) { 7917 setInterval(this.calculatePos.bind(this),700); 7918 } 7919 7920 $window.on('resize', this.calculatePos.bind(this)); 7921 } 7922 7923 CascadingParallax.prototype.calculatePos = function() { 7924 this.offsetTop = this.$element.offset().top; 7925 this.height = this.$element.outerHeight(); 7926 this.vertCenter = nectarDOMInfo.winH/2 - this.height/2; 7927 }; 7928 7929 CascadingParallax.prototype.trackView = function() { 7930 7931 var that = this; 7932 7933 if( this.$element.parents('.top-level').length > 0 ) { 7934 this.topLevel = true; 7935 } 7936 7937 if( 'IntersectionObserver' in window ) { 7938 7939 var options = { 7940 rootMargin: '250px', 7941 } 7942 var observer = new IntersectionObserver(function(entries) { 7943 7944 entries.forEach(function(entry){ 7945 var isIntersecting = entry.isIntersecting; 7946 7947 if (isIntersecting) { 7948 that.inView = true; 7949 } else { 7950 that.inView = false; 7951 } 7952 }); 7953 7954 }, options); 7955 7956 observer.observe(this.$element[0]); 7957 7958 } 7959 7960 }; 7961 7962 CascadingParallax.prototype.animate = function() { 7963 7964 if( nectarState.materialOffCanvasOpen == true ) { 7965 window.requestAnimationFrame(this.animate.bind(this)); 7966 return; 7967 } 7968 7969 this.lastY = linearInterpolate(this.lastY, nectarDOMInfo.scrollTop, 0.2); 7970 7971 if( this.inView ) { 7972 7973 var that = this; 7974 7975 this.$element.find('.bg-layer').each(function(i) { 7976 7977 var $scale = $(this).data('scale'); 7978 7979 if( that.layer1Parallax ) { 7980 i = (i/1.5)+1; 7981 } 7982 7983 if( that.topLevel === true && nectarDOMInfo.winW > 1000) { 7984 $(this)[0].style.transform = 'translateY(' + -(that.lastY * that.intensity * i) + 'px) translateZ(0) scale(' + $scale + ')'; 7985 } else { 7986 $(this)[0].style.transform = 'translateY(' + -((that.lastY - that.offsetTop + that.vertCenter ) * that.intensity * i ) + 'px) translateZ(0) scale(' + $scale + ')'; 7987 } 7988 7989 }); 7990 } 7991 7992 window.requestAnimationFrame(this.animate.bind(this)); 7993 }; 7994 7995 7996 7997 7998 /** 7999 * Split line heading element initialization. 8000 * 8001 * @since 10.5 8002 * @see waypoints 8003 */ 8004 function splitLineHeadings() { 8005 8006 // Create waypoint. 8007 var $splitLineOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : 'bottom-in-view'; 8008 $($fullscreenSelector + '.nectar-split-heading').each(function () { 8009 8010 var $that = $(this); 8011 var $delay = ( $that.is('[data-animation-delay]') ) ? parseInt($that.attr('data-animation-delay')) : 0; 8012 8013 var waypoint = new Waypoint({ 8014 element: $that, 8015 handler: function () { 8016 8017 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 8018 waypoint.destroy(); 8019 return; 8020 } 8021 8022 if (!bypassAnimations || $('body[data-responsive="0"]').length > 0) { 8023 8024 var $animationDurationCap; 8025 8026 setTimeout(function() { 8027 8028 if( $that.is('[data-animation-type="line-reveal-by-space"]') ) { 8029 8030 var stagger = 0; 8031 if( $that.is('[data-stagger="true"]') ) { 8032 stagger = 500 / $that.find('> * > span').length; 8033 stagger = Math.min(Math.max(stagger, 15), 50); // Clamp val 8034 } 8035 8036 $animationDurationCap = (parseInt($animationDuration) < 1100) ? $animationDuration : '1100'; 8037 8038 if( $that.is('[data-m-rm-animation="true"]') && nectarDOMInfo.winW < 1000 ) { 8039 $that.find('> * > span .inner').css({ 8040 'transform' : 'translateY(0)' 8041 });
8042 } 8043 else { 8044 $that.find('> * > span').each(function (i) { 8045 8046 if( stagger == 0 ) { 8047 $(this).find('> .inner').delay(i * stagger).transition({ 8048 'y': '0px' 8049 }, $animationDurationCap, $animationEasing); 8050 } 8051 else { 8052 var spanEl = $(this); 8053 var $innerEl = spanEl.find('> .inner'); 8054 setTimeout(function(){ 8055 $innerEl[0].style.transform = 'translateY(0em)'; 8056 }, i * stagger); 8057 8058 } 8059 8060 }); 8061 } 8062 8063 } else if( $that.is('[data-animation-type="letter-fade-reveal"]') ) { 8064 8065 $animationDurationCap = (parseInt($animationDuration) < 1000) ? $animationDuration : '1000'; 8066 $that.find('> * > span span').each(function (i) { 8067 8068 $(this).delay(i * 8).transition({ 8069 'y': '0px', 8070 'opacity': '1' 8071 }, $animationDurationCap, $animationEasing); 8072 8073 }); 8074 8075 } else { 8076 $that.find('.heading-line').each(function (i) { 8077 8078 $(this).find('> div').delay(i * 70).transition({ 8079 'y': '0px' 8080 }, $animationDuration, $animationEasing); 8081 8082 }); 8083 } 8084 8085 $that.addClass('animated-in'); 8086 8087 }, $delay); 8088 8089 } 8090 8091 waypoint.destroy(); 8092 }, 8093 offset: $splitLineOffsetPos 8094 }); 8095 8096 }); 8097 } 8098 8099 8100 8101 /** 8102 * Progress bar element initialization. 8103 * 8104 * @since 3.0 8105 * @see waypoints 8106 */ 8107 8108 function progressBars() { 8109 8110 var $progressBarsOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : 'bottom-in-view'; 8111 var $progressSelector = ($('#nectar_fullscreen_rows[data-mobile-disable="on"]').length > 0 && nectarDOMInfo.usingMobileBrowser) ? '.nectar-progress-bar' : $fullscreenSelector + '.nectar-progress-bar'; 8112 8113 if( nectarDOMInfo.usingMobileBrowser && $progressBarsOffsetPos == 'bottom-in-view') { 8114 $progressBarsOffsetPos = '70%'; 8115 } 8116 8117 $($progressSelector).each(function () { 8118 8119 var $that = $(this); 8120 8121 var waypoint = new Waypoint({ 8122 element: $that, 8123 handler: function () { 8124 8125 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 8126 waypoint.destroy(); 8127 return; 8128 } 8129 8130 if ($progressBarsOffsetPos == '100%') { 8131 $that.find('.bar-wrap').css('opacity', '1'); 8132 } 8133 8134 8135 var percent = $that.find('span').attr('data-width'), 8136 $endNum = parseInt($that.find('span strong i').text()); 8137 8138 $that.find('span').transition({ 8139 'width': percent + '%' 8140 }, 800, 'easeInOutCubic'); 8141 8142 var countOptions = { 8143 useEasing: false 8144 }; 8145 var $countEle = $that.find('span strong i')[0]; 8146 var numAnim = new CountUp($countEle, 0, $endNum, 0, 1, countOptions); 8147 numAnim.start(); 8148 8149 $that.find('span strong').transition({ 8150 'opacity': 1 8151 }, 550, 'easeInCirc'); 8152 8153 ////100% progress bar 8154 if (percent == '100') { 8155 $that.find('span strong').addClass('full'); 8156 } 8157 8158 $that.addClass('completed'); 8159 8160 waypoint.destroy(); 8161 8162 }, 8163 offset: $progressBarsOffsetPos 8164 }); 8165 8166 }); 8167 8168 } 8169 8170 8171 8172 /** 8173 * Page builder column border animations. 8174 * 8175 * @since 8.0 8176 * @see waypoints 8177 */ 8178 function animatedColBorders() { 8179 8180 var $progressBarsOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : '75%'; 8181 $($fullscreenSelector + '.wpb_column[data-border-animation="true"]').each(function () { 8182 8183 var $that = $(this), 8184 waypoint = new Waypoint({ 8185 element: $that, 8186 handler: function () { 8187 8188 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 8189 waypoint.destroy(); 8190 return; 8191 } 8192 8193 var $borderDelay = ($that.attr('data-border-animation-delay').length > 0) ? parseInt($that.attr('data-border-animation-delay')) : 0; 8194 setTimeout(function () { 8195 $that.find('.border-wrap').addClass('animation'); 8196 $that.find('.border-wrap').addClass('completed'); 8197 }, $borderDelay); 8198 8199 waypoint.destroy(); 8200 8201 }, 8202 offset: $progressBarsOffsetPos 8203 });
8204 8205 }); 8206 } 8207 8208 8209 8210 /** 8211 * Food menu item element. 8212 * 8213 * @since 8.0 8214 * @see waypoints 8215 */ 8216 function foodMenuItems() { 8217 8218 var $foodItemOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : '80%'; 8219 $($fullscreenSelector + '.nectar_food_menu_item').parent().each(function () { 8220 8221 var $that = $(this), 8222 waypoint = new Waypoint({ 8223 element: $that, 8224 handler: function () { 8225 8226 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 8227 waypoint.destroy(); 8228 return; 8229 } 8230 8231 $that.find('.nectar_food_menu_item').each(function (i) { 8232 8233 var $that = $(this); 8234 8235 setTimeout(function () { 8236 $that.addClass('animated-in'); 8237 }, i * 150); 8238 8239 }); 8240 8241 waypoint.destroy(); 8242 8243 }, 8244 offset: $foodItemOffsetPos 8245 }); 8246 8247 }); 8248 } 8249 8250 8251 8252 /** 8253 * Divider element 8254 * 8255 * @since 3.0 8256 * @see waypoints 8257 */ 8258 function dividers() { 8259 8260 var $dividerOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : 'bottom-in-view'; 8261 8262 $($fullscreenSelector + '.divider-small-border[data-animate="yes"], ' + $fullscreenSelector + '.divider-border[data-animate="yes"]').each(function () { 8263 8264 var $lineDur = ($(this).hasClass('divider-small-border')) ? 1300 : 1500, 8265 $that = $(this), 8266 waypoint = new Waypoint({ 8267 element: $that, 8268 handler: function () { 8269 8270 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 8271 waypoint.destroy(); 8272 return; 8273 } 8274 8275 $that.each(function () { 8276 8277 $(this).css({ 8278 'transform': 'scale(0,1)', 8279 'visibility': 'visible' 8280 }); 8281 var $that = $(this); 8282 8283 $that.delay($that.attr('data-animation-delay')).transition({ 8284 'transform': 'scale(1, 1)' 8285 }, $lineDur, 'cubic-bezier(.18,1,.22,1)'); 8286 8287 });
8288 8289 $that.addClass('completed'); 8290 8291 waypoint.destroy(); 8292 8293 }, 8294 offset: $dividerOffsetPos 8295 }); 8296 8297 }); 8298 } 8299 8300 8301 8302 /** 8303 * Image with hotspots element hover event 8304 * 8305 * @since 7.0 8306 */ 8307 function hotSpotHoverBind() { 8308 8309 //add pulse animation 8310 $('.nectar_image_with_hotspots[data-hotspot-icon="numerical"]').each(function () { 8311 $(this).find('.nectar_hotspot_wrap').each(function (i) { 8312 var $that = $(this); 8313 setTimeout(function () { 8314 $that.find('.nectar_hotspot').addClass('pulse'); 8315 }, i * 300); 8316 }); 8317 }); 8318 8319 8320 var hotSpotHoverTimeout = []; 8321 8322 $('.nectar_image_with_hotspots:not([data-tooltip-func="click"]) .nectar_hotspot').each(function (i) { 8323 8324 hotSpotHoverTimeout[i] = ''; 8325 8326 $(this).on('mouseover', function () { 8327 clearTimeout(hotSpotHoverTimeout[i]); 8328 $(this).parent().css({ 8329 'z-index': '400', 8330 'height': 'auto', 8331 'width': 'auto' 8332 }); 8333 }); 8334 8335 $(this).on('mouseleave', function () { 8336 8337 var $that = $(this); 8338 $that.parent().css({ 8339 'z-index': 'auto' 8340 }); 8341 8342 hotSpotHoverTimeout[i] = setTimeout(function () { 8343 $that.parent().css({ 8344 'height': '30px', 8345 'width': '30px' 8346 });
8347 }, 300); 8348 8349 }); 8350 8351 }); 8352 8353 } 8354 8355 8356 8357 /** 8358 * Image with hotspots element responsive behavior. 8359 * 8360 * @since 7.0 8361 */ 8362 function responsiveTooltips() { 8363 8364 $('.nectar_image_with_hotspots').each(function () { 8365 8366 $(this).find('.nectar_hotspot_wrap').each(function () { 8367 8368 if (nectarDOMInfo.winW > 690) { 8369 8370 // Remove click if applicable 8371 if ($(this).parents('.nectar_image_with_hotspots[data-tooltip-func="hover"]').length > 0) { 8372 $(this).find('.nectar_hotspot').removeClass('click'); 8373 $(this).find('.nttip').removeClass('open'); 8374 } 8375 8376 $(this).find('.nttip .inner a.tipclose').remove(); 8377 $('.nttip').css('height', 'auto'); 8378 8379 // Reset for positioning 8380 $(this).css({ 8381 'width': 'auto', 8382 'height': 'auto' 8383 }); 8384 8385 $(this).find('.nttip') 8386 .removeClass('force-right') 8387 .removeClass('force-left') 8388 .removeClass('force-top') 8389 .css('width', 'auto'); 8390 8391 var $tipOffset = $(this).find('.nttip').offset(); 8392 8393 // Against right side 8394 if ($tipOffset.left > $(this).parents('.nectar_image_with_hotspots').width() - 200) { 8395 $(this).find('.nttip').css('width', '250px'); 8396 } 8397 else { 8398 $(this).find('.nttip').css('width', 'auto'); 8399 } 8400 8401 // Responsive 8402 if ($tipOffset.left < 0) { 8403 $(this).find('.nttip').addClass('force-right'); 8404 } 8405 else if ($tipOffset.left + $(this).find('.nttip').outerWidth(true) > nectarDOMInfo.winW) { 8406 $(this).find('.nttip').addClass('force-left').css('width', '250px'); 8407 } 8408 else if ($tipOffset.top + $(this).find('.nttip').height() + 35 > $window.height() && $('#nectar_fullscreen_rows').length > 0) { 8409 $(this).find('.nttip').addClass('force-top'); 8410 } 8411 8412 if ($(this).find('> .open').length == 0) { 8413 8414 $(this).css({ 8415 'width': '30px', 8416 'height': '30px' 8417 }); 8418 } 8419 8420 } else { 8421 8422 //fixed position 8423 $(this).find('.nttip') 8424 .removeClass('force-left') 8425 .removeClass('force-right') 8426 .removeClass('force-top'); 8427 8428 $(this).find('.nectar_hotspot').addClass('click'); 8429 8430 if ($(this).find('.nttip a.tipclose').length == 0) { 8431 $(this).find('.nttip .inner').append('<a href="#" class="tipclose"><span></span></a>'); 8432 } 8433 8434 // Change height of fixed 8435 $('.nttip').css('height', $window.height()); 8436 } 8437 }); 8438 }); 8439 8440 } 8441 8442 8443 /** 8444 * Image with hotspots events 8445 * 8446 * @since 10.5 8447 */ 8448 function imageWithHotspotEvents() { 8449 8450 if( $('.nectar_image_with_hotspots').length == 0 ) { 8451 return; 8452 } 8453 8454 // Hover 8455 hotSpotHoverBind(); 8456 8457 // Click 8458 $body.on('click', '.nectar_hotspot.click', function () { 8459 $(this).parents('.nectar_image_with_hotspots').find('.nttip').removeClass('open'); 8460 $(this).parent().find('.nttip').addClass('open'); 8461 8462 $(this).parents('.nectar_image_with_hotspots').find('.nectar_hotspot').removeClass('open'); 8463 $(this).parent().find('.nectar_hotspot').addClass('open'); 8464 8465 if (nectarDOMInfo.winW > 690) { 8466 $(this).parent().css({ 8467 'z-index': '120', 8468 'height': 'auto', 8469 'width': 'auto' 8470 }); 8471 8472 var $that = $(this); 8473 8474 setTimeout(function () { 8475 $that.parents('.nectar_image_with_hotspots').find('.nectar_hotspot_wrap').each(function () { 8476 8477 if ($(this).find('> .open').length == 0) { 8478 $(this).css({ 8479 'height': '30px', 8480 'width': '30px', 8481 'z-index': 'auto' 8482 }); 8483 } 8484 });
8485 }, 300); 8486 } 8487 8488 if (nectarDOMInfo.winW <= 690) { 8489 $(this).parents('.wpb_row, [class*="vc_col-"]').css('z-index', '200'); 8490 } 8491 8492 return false; 8493 }); 8494 8495 $body.on('click', '.nectar_hotspot.open', function () { 8496 $(this).parent().find('.nttip').removeClass('open'); 8497 $(this).parent().find('.nectar_hotspot').removeClass('open'); 8498 8499 $(this).parents('.wpb_row').css('z-index', 'auto'); 8500 8501 return false; 8502 }); 8503 8504 $body.on('click', '.nttip.open', function (e) { 8505 if (nectarDOMInfo.winW < 690) { 8506 8507 if( e.target && $(e.target).is('a') ) { 8508 return; 8509 } 8510 8511 $(this).parents('.nectar_image_with_hotspots').find('.nttip').removeClass('open'); 8512 $(this).parents('.nectar_image_with_hotspots').find('.nectar_hotspot').removeClass('open'); 8513 $(this).parents('.wpb_row').css('z-index', 'auto'); 8514 return false; 8515 } 8516 }); 8517 8518 8519 // Calculate on init. 8520 responsiveTooltips(); 8521 8522 // Resize event. 8523 $window.on('resize',responsiveTooltips); 8524 8525 } 8526 8527 8528 8529 /** 8530 * Image with hotspots initialization. 8531 * 8532 * @since 7.0 8533 * @see waypoints 8534 */ 8535 function imageWithHotspots() { 8536 8537 var $imageWithHotspotsOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : '50%'; 8538 8539 $($fullscreenSelector + '.nectar_image_with_hotspots[data-animation="true"]').each(function () { 8540 8541 var $that = $(this); 8542 var waypoint = new Waypoint({ 8543 element: $that, 8544 handler: function () { 8545 8546 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 8547 waypoint.destroy(); 8548 return; 8549 } 8550 8551 $that.addClass('completed'); 8552 $that.find('.nectar_hotspot_wrap').each(function (i) { 8553 var $that2 = $(this); 8554 var $extrai = ($that2.parents('.col.has-animation').length > 0) ? 1 : 0; 8555 setTimeout(function () { 8556 $that2.addClass('animated-in'); 8557 }, 175 * (i + $extrai)); 8558 });
8559 8560 waypoint.destroy(); 8561 8562 }, 8563 offset: $imageWithHotspotsOffsetPos 8564 }); 8565 8566 }); 8567 8568 8569 } 8570 8571 8572 /** 8573 * Nectar Lazy Loading 8574 * 8575 * @since 11.0 8576 */ 8577 function nectarLazyImageLoading() { 8578 8579 var lazyItems = [].slice.call(document.querySelectorAll('[data-nectar-img-src]')); 8580 8581 if ('IntersectionObserver' in window) { 8582 8583 var options = { 8584 rootMargin: '300px', 8585 } 8586 8587 nectarLazyImageSizing(); 8588 $window.off('resize.nectarLazySizing', nectarLazyImageSizing); 8589 $window.on('resize.nectarLazySizing', nectarLazyImageSizing); 8590 8591 var lazyItemObserver = new IntersectionObserver(function(entries) { 8592 8593 entries.forEach(function(entry) { 8594 if (entry.isIntersecting) { 8595 var lazyItem = entry.target; 8596 8597 var imgSrc = lazyItem.getAttribute('data-nectar-img-src'); 8598 8599 if( imgSrc ) { 8600 8601 // img tags. 8602 if( lazyItem.classList.contains('nectar-lazy') ) { 8603 lazyItem.addEventListener( 'load', function() { 8604 lazyItem.style.height = ""; 8605 lazyItem.style.width = ""; 8606 lazyItem.classList.add('loaded'); 8607 lazyItem.removeAttribute('data-nectar-img-src'); 8608 lazyItemObserver.unobserve(lazyItem); 8609 }); 8610 lazyItem.src = imgSrc; 8611 var srcset = lazyItem.getAttribute('data-nectar-img-srcset'); 8612 if( srcset ) { 8613 lazyItem.setAttribute( 'srcset', srcset ); 8614 lazyItem.removeAttribute('data-nectar-img-srcset'); 8615 } 8616 8617 lazyItem.parentNode.classList.add('img-loaded'); 8618 8619 } 8620 // BGs. 8621 else { 8622 lazyItem.style.backgroundImage = "url('" + imgSrc + "')"; 8623 lazyItem.classList.add('loaded'); 8624 lazyItem.removeAttribute('data-nectar-img-src'); 8625 lazyItemObserver.unobserve(lazyItem); 8626 } 8627 8628 } 8629 8630 } 8631 8632 }); 8633 8634 }, options); 8635 8636 lazyItems.forEach(function(lazyItem) { 8637 lazyItemObserver.observe(lazyItem); 8638 }); 8639 8640 } 8641 else { 8642 // load all the images when intersection observer is not supported. 8643 lazyItems.forEach(function(lazyItem) { 8644 8645 // img tags. 8646 if( lazyItem.classList.contains('nectar-lazy') ) { 8647 lazyItem.style.height = ""; 8648 lazyItem.style.width = ""; 8649 lazyItem.src = lazyItem.getAttribute('data-nectar-img-src'); 8650 var srcset = lazyItem.getAttribute('data-nectar-img-srcset'); 8651 if( srcset ) { 8652 lazyItem.setAttribute( 'srcset', srcset ); 8653 lazyItem.removeAttribute('data-nectar-img-srcset'); 8654 } 8655 8656 lazyItem.parentNode.classList.add('img-loaded'); 8657 lazyItem.classList.add('loaded'); 8658 lazyItem.removeAttribute('data-nectar-img-src'); 8659 } 8660 // BGs. 8661 else { 8662 lazyItem.style.backgroundImage = "url('" + lazyItem.getAttribute('data-nectar-img-src') + "')"; 8663 lazyItem.classList.add('loaded'); 8664 lazyItem.removeAttribute('data-nectar-img-src'); 8665 } 8666 8667 }); 8668 } 8669 8670 8671 } 8672 8673 8674 /** 8675 * Nectar lazy img size helper. 8676 * 8677 * @since 11.0 8678 */ 8679 8680 function nectarLazyImageSizing() { 8681 8682 $('img.nectar-lazy:not(.loaded)').each(function() { 8683 8684 // items to skip. 8685 if( $(this).hasClass('attachment-shop_thumbnail') || $(this).hasClass('attachment-woocommerce_thumbnail') ) { 8686 return true; 8687 } 8688 8689 $(this).css({ 8690 'height': '', 8691 'width' : '' 8692 }); 8693 8694 8695 var heightAttr = parseInt($(this).attr('height')); 8696 var widthAttr = parseInt($(this).attr('width')); 8697 8698 var width = ($(this).parents('.nectar_cascading_images').length > 0) ? $(this).parents('.bg-layer').width() : $(this).width(); 8699 8700 // Shadow img. 8701 if( $(this).parents('.img-with-aniamtion-wrap[data-shadow*="depth"]').length > 0 ) { 8702 width = $(this).parents('.img-with-aniamtion-wrap').width(); 8703 } 8704 8705 // Post grid.
8706 if( $(this).parents('.nectar-post-grid-item-bg-wrap-inner').length > 0 ) { 8707 width = $(this).parents('.nectar-post-grid-item-bg-wrap-inner').width(); 8708 } 8709 8710 var dimensions = calculateAspectRatio( widthAttr, heightAttr, width, 2000 ); 8711 8712 $(this).css({ 8713 'height': dimensions.height + 'px', 8714 'width' : dimensions.width + 'px' 8715 }); 8716 8717 }); 8718 8719 } 8720 8721 8722 /** 8723 * Nectar Post Grid Mouse Follow Init 8724 * 8725 * @since 11.0 8726 */ 8727 function nectarPostGridMouse() { 8728 8729 viewIndicatorArr = []; 8730 postGridImgMouseFollowArr = []; 8731 8732 if( !nectarDOMInfo.usingMobileBrowser ) { 8733 8734 $('.nectar-post-grid[data-indicator="yes"]').each(function(i) { 8735 viewIndicatorArr[i] = new NectarIconMouseFollow($(this),'view-indicator'); 8736 }); 8737 8738 $('.nectar-post-grid-wrap[data-style="mouse_follow_image"] .nectar-post-grid').each(function(i) { 8739 postGridImgMouseFollowArr[i] = new NectarIconMouseFollow($(this), 'post-grid-images'); 8740 }); 8741 8742 $('.nectar-category-grid[data-style="mouse_follow_image"]').each(function(i) { 8743 postGridImgMouseFollowArr[i] = new NectarIconMouseFollow($(this), 'post-grid-images'); 8744 }); 8745 8746 } 8747 8748 } 8749 8750 8751 8752 8753 8754 /** 8755 * Nectar Post Grid 8756 * 8757 * @since 11.0 8758 */ 8759 function nectarPostGridInit() { 8760 8761 $nectarPostGridArr = []; 8762 8763 // Mouse follow. 8764 nectarPostGridMouse(); 8765 8766 // Create grid instances. 8767 $('.nectar-post-grid-wrap').each(function(i) { 8768 $nectarPostGridArr[i] = new NectarPostGrid($(this)); 8769 }); 8770 8771 8772 } 8773 8774 8775 8776 function NectarPostGrid(el) { 8777 8778 this.el = el; 8779 this.currentPage = 0; 8780 this.activeFilter = 1; 8781 this.activeCatTotal = 0; 8782 this.settingsData = JSON.parse(this.el.attr('data-el-settings')); 8783 this.queryData = JSON.parse(this.el.attr('data-query')); 8784 this.sortable = this.el.find('.nectar-post-grid-filters').attr('data-sortable'); 8785 8786 this.initialMarkup(); 8787 this.clickEvents(); 8788 this.deepLinking(); 8789 this.lightboxGroups(); 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.clickEvents = function() { 8847 8848 // Sortable Mobile Toggle. 8849 this.el.find('.nectar-post-grid-filters h4').on('click', function(){ 8850 $(this).parent().find('div').toggleClass('visible'); 8851 $(this).toggleClass('visible'); 8852 });
8853 8854 // Sortable/Pagination. 8855 var settingsData = this.settingsData; 8856 var queryData = this.queryData; 8857 var instance = this; 8858 8859 this.el.find('.nectar-post-grid-filters a, .load-more-wrap .load-more').on('click', function() { 8860 8861 var $that = $(this); 8862 8863 // Filter active. 8864 if($that.parents('.nectar-post-grid-wrap.loading').length > 0 || $(this).hasClass('active') || $(this).hasClass('inactive') ) { 8865 return false; 8866 } 8867 8868 8869 if( $(this).parents('.nectar-post-grid-filters').length > 0 ) { 8870 // Filter specific. 8871 $that.parent().find('a').removeClass('active'); 8872 $that.addClass('active'); 8873 instance.currentPage = 0; 8874 instance.activeFilter = $that.index() + 1; 8875 } else { 8876 // Load More specific. 8877 instance.currentPage++; 8878 } 8879 8880 var $gridEl = $that.parents('.nectar-post-grid-wrap').find('.nectar-post-grid') 8881 var $pagination = settingsData.pagination; 8882 var $action = ($that.hasClass('load-more') && $pagination === 'load-more') ? 'load-more' : 'filter'; 8883 var $category = ''; 8884 var $custom_query = ''; 8885 8886 // Determine what category to load from. 8887 if( instance.sortable === 'yes' ) { 8888 $category = $that.parents('.nectar-post-grid-wrap').find('.nectar-post-grid-filters a.active').attr('data-filter'); 8889 $custom_query = $that.parents('.nectar-post-grid-wrap').find('.nectar-post-grid-filters a.active').attr('data-filter'); 8890 } else { 8891 8892 var skipAll = ( $that.parents('.nectar-post-grid-wrap').find('.nectar-post-grid-filters a').length > 1 ) ? ':not(.all-filter)' : ''; 8893 8894 $that.parents('.nectar-post-grid-wrap').find('.nectar-post-grid-filters a' + skipAll).each(function(){ 8895 $category += $(this).attr('data-filter') + ', '; 8896 $custom_query += $(this).attr('data-filter') + ', '; 8897 }); 8898 8899 $category = $category.substring(0, $category.length - 2); 8900 $custom_query = $custom_query.substring(0, $custom_query.length - 2); 8901 8902 } 8903 8904 8905 var $dataToPass = { 8906 action: 'nectar_get_post_grid_segment', 8907 post_type: queryData.post_type, 8908 cpt_name: queryData.cpt_name, 8909 custom_query_tax: $custom_query, 8910 category: $category, 8911 posts_per_page: queryData.posts_per_page, 8912 current_page: instance.currentPage, 8913 offset: queryData.offset, 8914 order: queryData.order, 8915 orderby: queryData.orderby, 8916 load_action: $action, 8917 settings: { 8918 pagination: $pagination, 8919 post_type: settingsData.post_type, 8920 image_size: settingsData.image_size, 8921 aspect_ratio_image_size: settingsData.aspect_ratio_image_size, 8922 card_bg_color: settingsData.card_bg_color, 8923 display_categories: settingsData.display_categories, 8924 display_excerpt: settingsData.display_excerpt, 8925 display_date: settingsData.display_date, 8926 color_overlay: settingsData.color_overlay, 8927 color_overlay_opacity: settingsData.color_overlay_opacity, 8928 color_overlay_hover_opacity: settingsData.color_overlay_hover_opacity, 8929 grid_style: settingsData.grid_style, 8930 heading_tag: settingsData.heading_tag, 8931 post_title_overlay: settingsData.post_title_overlay, 8932 enable_gallery_lightbox: settingsData.enable_gallery_lightbox 8933 } 8934 }; 8935 8936 $that.parents('.nectar-post-grid-wrap').addClass('loading'); 8937 8938 $.post(window.nectarLove.ajaxurl, $dataToPass, function (data) { 8939 8940 // Update markup. 8941 if( $action === 'load-more' ) { 8942 $gridEl.append(data); 8943 } else { 8944 $gridEl.html(data); 8945 } 8946 8947 // Load in animation. 8948 if( $gridEl.is('[data-animation="fade-in-from-bottom"]') ) { 8949 8950 $that.parents('.nectar-post-grid-wrap').removeClass('finished-animating'); 8951 8952 $gridEl.find('.nectar-post-grid-item:not(.animated-in)').each(function(i) { 8953 var $storedEl = $(this); 8954 setTimeout(function() { 8955 $storedEl.addClass('animated-in'); 8956 }, i * 90); 8957 8958 });
8959 8960 setTimeout(function(){ 8961 $that.parents('.nectar-post-grid-wrap').addClass('finished-animating'); 8962 }, 950); 8963 } 8964 8965 if( $pagination === 'load-more' ) { 8966 8967 instance.activeCatTotal = parseInt(instance.el.find('.nectar-post-grid-filters a:nth-child(' + instance.activeFilter + ')').attr('data-total-count')); 8968 8969 if( $gridEl.find('.nectar-post-grid-item').length >= instance.activeCatTotal ) { 8970 instance.el.find('.load-more-wrap').addClass('inactive'); 8971 } else { 8972 instance.el.find('.load-more-wrap').removeClass('inactive'); 8973 } 8974 8975 } 8976 8977 // Lightbox items. 8978 instance.lightboxGroups(); 8979 8980 $that.parents('.nectar-post-grid-wrap').removeClass('loading'); 8981 8982 // Resize. 8983 $window.trigger('resize'); 8984 8985 // Mouse follow. 8986 nectarPostGridMouse(); 8987 8988 }); // end POST 8989 8990 return false; 8991 8992 }); 8993 8994 // External project links 8995 if( this.el.hasClass('target-blank-external-urls') ) { 8996 this.el.find(".nectar-post-grid-item a[href*='http://']:not([href*='" + window.location.hostname + "'])").attr("target", "_blank"); 8997 this.el.find(".nectar-post-grid-item a[href*='https://']:not([href*='" + window.location.hostname + "'])").attr("target", "_blank"); 8998 } 8999 9000 9001 }; 9002 9003 NectarPostGrid.prototype.deepLinking = function() { 9004 9005 if (typeof nectarGetQueryParam['grid-filter'] != 'undefined') { 9006 9007 this.el.find('.nectar-post-grid-filters a').each(function () { 9008 9009 var $currentText = $(this).clone(), 9010 $getText = nectarGetQueryParam['grid-filter'], 9011 $that = $(this); 9012 9013 $currentText = $currentText.text(); 9014 $currentText = $currentText.replace(/\s+/g, '-').toLowerCase(); 9015 9016 if( $currentText.length > 0 && $currentText.substring(0,1) === '-' ) { 9017 $currentText = $currentText.substring(1); 9018 } 9019 9020 $getText = $getText.replace(/\s+/g, '-').replace(/</g, '<').replace(/"/g, '"').toLowerCase(); 9021 9022 // Switch to filter 9023 if ($currentText == $getText) { 9024 $(this).trigger('click'); 9025 } 9026 9027 }); 9028 9029 } 9030 9031 }; 9032 9033 9034 function NectarPostGridWaypoint() { 9035 9036 var postGridOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : '75%'; 9037 9038 $($fullscreenSelector + '.nectar-post-grid-wrap').each(function () { 9039 9040 var $that = $(this), 9041 waypoint = new Waypoint({ 9042 element: $that, 9043 handler: function () { 9044 9045 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 9046 waypoint.destroy(); 9047 return; 9048 } 9049 9050 $that.find('.nectar-post-grid-filters').addClass('animated-in'); 9051 $that.find('.nectar-post-grid-item').each(function(i) { 9052 9053 var $item = $(this); 9054 9055 setTimeout(function() { 9056 9057 $item.addClass('animated-in'); 9058 9059 }, i * 90); 9060 9061 });
9062 9063 setTimeout(function(){ 9064 $that.addClass('finished-animating'); 9065 }, 950); 9066 9067 9068 waypoint.destroy(); 9069 9070 }, 9071 offset: postGridOffsetPos 9072 }); 9073 9074 }); 9075 9076 } 9077 9078 9079 9080 /** 9081 * Animated title element initialization. 9082 * 9083 * @since 7.0 9084 * @see waypoints 9085 */ 9086 function animatedTitles() { 9087 9088 var $animatedTitlesOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : 'bottom-in-view'; 9089 9090 $($fullscreenSelector + '.nectar-animated-title').each(function () { 9091 9092 var $that = $(this), 9093 waypoint = new Waypoint({ 9094 element: $that, 9095 handler: function () { 9096 9097 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 9098 waypoint.destroy(); 9099 return; 9100 } 9101 9102 $that.addClass('completed'); 9103 9104 waypoint.destroy(); 9105 9106 }, 9107 offset: $animatedTitlesOffsetPos 9108 }); 9109 9110 }); 9111 } 9112 9113 9114 9115 9116 /** 9117 * Highlighted Text element initialization. 9118 * 9119 * @since 9.0 9120 * @see waypoints 9121 */ 9122 function highlightedText() { 9123 9124 var $highlightedTextOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : 'bottom-in-view'; 9125 9126 if( nectarDOMInfo.usingMobileBrowser && $highlightedTextOffsetPos == 'bottom-in-view' ) { 9127 $highlightedTextOffsetPos = '85%'; 9128 } 9129 9130 $($fullscreenSelector + '.nectar-highlighted-text').each(function (i) { 9131 9132 var $animationDelay = 0; 9133 9134 // convert italics to em. 9135 $(this).find('i').each(function(){ 9136 $(this).replaceWith(function(){ 9137 return $('<em />').append($(this).html()); 9138 }); 9139 }); 9140 9141 if($(this).is('[data-animation-delay]') && 9142 $(this).attr('data-animation-delay').length > 0 && 9143 $(this).attr('data-animation') != 'false') { 9144 $animationDelay = $(this).attr('data-animation-delay'); 9145 } 9146 9147 $(this).find('em:has(a)').addClass('has-link'); 9148 9149 if (bypassAnimations) { 9150 $(this).find('em').addClass('animated'); 9151 } 9152 9153 // Waypoint 9154 var $that = $(this); 9155 var waypoint = new Waypoint({ 9156 element: $that, 9157 handler: function () { 9158 9159 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated')) { 9160 waypoint.destroy(); 9161 return; 9162 } 9163 9164 setTimeout(function() { 9165 9166 $that.find('em').each(function (i) { 9167 var $highlighted_em = $(this); 9168 setTimeout(function () { 9169 $highlighted_em.addClass('animated'); 9170 }, i * 300); 9171 9172 }); 9173 9174 }, $animationDelay); 9175 9176 waypoint.destroy(); 9177 9178 }, 9179 offset: $highlightedTextOffsetPos 9180 }); 9181 9182 }); 9183 9184 } 9185 9186 9187 9188 /** 9189 * WooCommerce product carousel. 9190 * 9191 * @since 13.0 9192 * @see waypoints 9193 */ 9194 function wooProductCarouselAnimations() { 9195 9196 var $wooProductOffsetPos = ($fullscreenMarkupBool == true) ? '500%' : '75%'; 9197 9198 $($fullscreenSelector + '.nectar-woo-flickity[data-animation*="fade-in"]').each(function () { 9199 9200 var $that = $(this), 9201 waypoint = new Waypoint({ 9202 element: $that, 9203 handler: function () { 9204 9205 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 9206 waypoint.destroy(); 9207 return; 9208 } 9209 9210 $that.addClass('animated-in'); 9211 9212 $that.find('.flickity-cell').each(function (i) { 9213 var $el = $(this); 9214 9215 setTimeout(function(){ 9216 $el.css({ 9217 'transform': 'translate3d(0,0,0)', 9218 'opacity': '1' 9219 }); 9220 }, i * 100); 9221 });
9222 9223 waypoint.destroy(); 9224 9225 }, 9226 offset: $wooProductOffsetPos 9227 }); 9228 9229 }); 9230 } 9231 9232 9233 /** 9234 * Pricing table element height calculations. 9235 * 9236 * @since 2.0 9237 */ 9238 function pricingTableHeight() { 9239 9240 var $tallestCol; 9241 9242 $('.pricing-table[data-style="default"]').each(function () { 9243 $tallestCol = 0; 9244 9245 $(this).find('> div ul').each(function () { 9246 9247 if( $(this).height() > $tallestCol ) { 9248 $tallestCol = $(this).height(); 9249 } 9250 9251 }); 9252 9253 //safety net incase pricing tables height couldn't be determined 9254 if ($tallestCol == 0) { 9255 $tallestCol = 'auto'; 9256 } 9257 9258 //set even height 9259 $(this).find('> div ul').css('height', $tallestCol); 9260 9261 }); 9262 } 9263 9264 9265 9266 9267 /** 9268 * Testimonial slider element initialization. 9269 * 9270 * @since 10.5 9271 */ 9272 function nectarTestimonialSliders() { 9273 9274 $testimonialSliders = []; 9275 9276 if (typeof NectarTestimonialSlider == 'undefined') { 9277 return; 9278 } 9279 9280 $('.testimonial_slider').each(function (i) { 9281 9282 var $that_el = $(this), 9283 $type = ($(this).is('[data-style]')) ? $(this).attr('data-style') : 'none'; 9284 9285 $testimonialSliders[i] = new NectarTestimonialSlider($that_el, $type, resizeVideoToCover, fullWidthContentColumns); 9286 9287 9288 if ($(this).is('.disable-height-animation:not([data-style*="multiple_visible"])')) { 9289 $testimonialSliders[i].testimonialSliderHeight(); 9290 setTimeout($testimonialSliders[i].testimonialSliderHeight.bind($testimonialSliders[i]), 500); 9291 } 9292 9293 if ($(this).is('.testimonial_slider[data-style="multiple_visible_minimal"]')) { 9294 $testimonialSliders[i].testimonialSliderHeightMinimalMult(); 9295 setTimeout($testimonialSliders[i].testimonialSliderHeightMinimalMult.bind($testimonialSliders[i]), 500); 9296 } 9297 9298 }); 9299 9300 9301 } 9302 9303 9304 /** 9305 * Testimonial slider element resize binding. 9306 * 9307 * @since 10.5 9308 */ 9309 function nectarTestimonialSlidersEvents() { 9310 9311 $window.off('smartresize.nectarTestimonials'); 9312 $window.off('resize.nectarTestimonialsMin'); 9313 9314 if($testimonialSliders.length > 0) { 9315 $window.on('smartresize.nectarTestimonials',nectarTestimonialMainResize); 9316 } 9317 9318 if( $('.testimonial_slider[data-style="multiple_visible_minimal"]').length > 0 ) { 9319 $window.on('resize.nectarTestimonialsMin',nectarTestimonialMiniamlResize); 9320 } 9321 9322 } 9323 9324 function nectarTestimonialMainResize() { 9325 for (var i = 0; i < $testimonialSliders.length; i++) { 9326 $testimonialSliders[i].testimonialSliderHeight(); 9327 $testimonialSliders[i].testimonialHeightResize(); 9328 } 9329 } 9330 function nectarTestimonialMiniamlResize() { 9331 for (var i = 0; i < $testimonialSliders.length; i++) { 9332 $testimonialSliders[i].testimonialSliderHeightMinimalMult(); 9333 } 9334 } 9335 9336 9337 9338 /** 9339 * Icon list element initialization. 9340 * 9341 * @since 6.0 9342 * @see waypoints 9343 */ 9344 function iconList() { 9345 9346 var $iconListOffsetPos = ($fullscreenMarkupBool == true) ? '250%' : '75%'; 9347 9348 $($fullscreenSelector + '.nectar-icon-list[data-animate="true"]').each(function () { 9349 9350 var $that = $(this), 9351 waypoint = new Waypoint({ 9352 element: $that, 9353 handler: function () { 9354 9355 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 9356 waypoint.destroy(); 9357 return; 9358 } 9359 9360 $that.each(function () { 9361 9362 var $listItemAnimationDelay = ($that.is('[data-direction="horizontal"]')) ? 100 : 300; 9363 9364 $(this).find('.nectar-icon-list-item').each(function (i) { 9365 var $thatt = $(this); 9366 setTimeout(function () { 9367 $thatt.addClass('animated'); 9368 }, i * $listItemAnimationDelay); 9369 }); 9370 9371 });
9372 9373 $that.addClass('completed'); 9374 9375 waypoint.destroy(); 9376 9377 }, 9378 offset: $iconListOffsetPos 9379 }); 9380 9381 }); 9382 } 9383 9384 9385 9386 /** 9387 * Get the BG color of parent column/row. 9388 * 9389 * @since 6.0 9390 */ 9391 function narrowParentBGC(element) { 9392 9393 var narrowedBGC; 9394 9395 if (element.parents('.wpb_column[data-bg-color*="#"]').length > 0 && element.parents('.wpb_column[data-bg-opacity="1"]').length > 0) { 9396 narrowedBGC = element.parents('.wpb_column').attr('data-bg-color'); 9397 } 9398 else if (element.parents('.wpb_row').length > 0 && element.parents('.wpb_row').find('.row-bg.using-bg-color').length > 0 || 9399 element.parents('.wpb_row').length > 0 && element.parents('.wpb_row').find('.row-bg.using-bg-color-excluded').length > 0) { 9400 narrowedBGC = element.parents('.wpb_row').find('.row-bg').css('background-color'); 9401 } 9402 else { 9403 if ($('#nectar_fullscreen_rows').length > 0) { 9404 narrowedBGC = $('#nectar_fullscreen_rows > .wpb_row .full-page-inner-wrap').css('background-color'); 9405 } 9406 else { 9407 narrowedBGC = $('.container-wrap').css('background-color'); 9408 } 9409 } 9410 9411 return narrowedBGC; 9412 9413 } 9414 9415 9416 /** 9417 * Icon BG matching row BG 9418 * 9419 * @since 6.0 9420 */ 9421 function nectarIconMatchColoring() { 9422 9423 var nectarMatchingBGCss = ''; 9424 9425 // Icon list 9426 $('.nectar-icon-list[data-icon-style="border"], .nectar_icon_wrap[data-style="border-animation"][data-color*="extra-color-gradient-"]').each(function (i) { 9427 9428 var $bgColorToSet = narrowParentBGC($(this)); 9429 9430 if( $(this).hasClass('nectar-icon-list') ) { 9431 $(this).find('.list-icon-holder').css('background-color', $bgColorToSet); 9432 } 9433 else { 9434 9435 $(this).removeClass(function (index, className) { 9436 return (className.match(/(^|\s)instance-\S+/g) || []).join(' '); 9437 }); 9438 9439 $(this).addClass('instance-' + i); 9440 nectarMatchingBGCss += '.nectar_icon_wrap.instance-' + i + ' .nectar_icon:before { background-color: ' + $bgColorToSet + '!important; }'; 9441 } 9442 9443 }); 9444 9445 // Material gradient btns 9446 $('body.material .nectar-button.see-through[class*="m-extra-color-gradient"]').each(function (i) { 9447 9448 var $bgColorToSet = narrowParentBGC($(this)); 9449 9450 $(this).removeClass(function (index, className) { 9451 return (className.match(/(^|\s)instance-\S+/g) || []).join(' '); 9452 }); 9453 9454 $(this).addClass('instance-' + i); 9455 nectarMatchingBGCss += '.nectar-button.see-through.instance-' + i + ':after { background-color: ' + $bgColorToSet + '!important; }'; 9456 9457 }); 9458 9459 // Style 9460 nectarCreateStyle(nectarMatchingBGCss, 'nectaricon-color-match'); 9461 9462 } 9463 9464 9465 9466 9467 9468 /** 9469 * One fourth column classes. 9470 * 9471 * @since 2.0 9472 */ 9473 function oneFourthClasses() { 9474 9475 $('.col.span_3, .vc_span3, .vc_col-sm-3').each(function () { 9476 if (!$(this).is('[data-t-w-inherits="small_desktop"]')) { 9477 9478 var $currentDiv = $(this); 9479 var $nextDiv = $(this).next('div'); 9480 9481 if ($nextDiv.hasClass('span_3') && !$currentDiv.hasClass('one-fourths') || 9482 $nextDiv.hasClass('vc_span3') && !$currentDiv.hasClass('one-fourths') || 9483 $nextDiv.hasClass('vc_col-sm-3') && !$currentDiv.hasClass('one-fourths')) { 9484 $currentDiv.addClass('one-fourths clear-both'); 9485 $nextDiv.addClass('one-fourths right-edge'); 9486 } 9487 } 9488 }); 9489 9490 // Make empty second 1/2 half columns display right on iPad 9491 $('.span_12 .col.span_6').each(function () { 9492 if ($(this).next('div').hasClass('span_6') && $.trim($(this).next('div').html()).length == 0) { 9493 $(this).addClass('empty-second'); 9494 } 9495 }); 9496 9497 } 9498 9499 9500 9501 9502 /** 9503 * Responsive video iframes initialization. 9504 * 9505 * @since 3.0 9506 */ 9507 function responsiveVideoIframesInit() { 9508 9509 $('iframe').each(function () { 9510 9511 // Make sure the iframe has a src 9512 if (typeof $(this).attr('src') != 'undefined' && 9513 !$(this).hasClass('skip-nectar-video-size') && 9514 !$(this).hasClass('iframe-embed') && 9515 $(this).parents('.ult_modal').length == 0 && 9516 $(this).parents('.ls-slide').length == 0 &&
9517 $(this).parents('.woo-variation-product-gallery').length == 0 && 9518 $(this).parents('.esg-entry-media').length == 0 && 9519 $(this).parents('.wpb_video_widget.wpb_content_element').length == 0) { 9520 9521 if( $(this).parents('.woocommerce-product-gallery').length > 0 ) { 9522 if( !$(this).is('[width="100%"]') || !$(this).is('[height="100%"]') ) { 9523 return true; 9524 } 9525 } 9526 9527 var embedSrcLower = $(this).attr('src').toLowerCase(); 9528 9529 if (embedSrcLower.indexOf("youtube") >= 0 || 9530 embedSrcLower.indexOf("vimeo") >= 0 || 9531 embedSrcLower.indexOf("twitch.tv") >= 0 || 9532 embedSrcLower.indexOf("kickstarter") >= 0 || 9533 embedSrcLower.indexOf("embed-ssl.ted") >= 0 || 9534 embedSrcLower.indexOf("dailymotion") >= 0) { 9535 9536 $(this).addClass('iframe-embed'); 9537 9538 if ($(this).width() < $(this).parent().width()) { 9539 $(this) 9540 .attr('data-aspectRatio', $(this).height() / $(this).width()) 9541 .removeAttr('height') 9542 .removeAttr('width'); 9543 } else { 9544 $(this) 9545 .attr('data-aspectRatio', '0.56') 9546 .removeAttr('height') 9547 .removeAttr('width'); 9548 } 9549 9550 if ($(this).parents('.post-area.masonry.classic').length > 0) { 9551 $(this) 9552 .attr('data-aspectRatio', '0.56') 9553 .removeAttr('height') 9554 .removeAttr('width'); 9555 } 9556 9557 } 9558 9559 } 9560 9561 }); 9562 9563 } 9564 9565 9566 /** 9567 * Responsive video iframes. 9568 * 9569 * @since 3.0 9570 */ 9571 function responsiveVideoIframes() { 9572 9573 $('iframe[data-aspectRatio]').each(function () { 9574 9575 var $el = $(this), 9576 newWidth = $el.parent().width(); 9577 9578 // In nectar slider 9579 if ($(this).parents('.swiper-slide').length > 0) { 9580 if ($(this).is(':visible')) { 9581 $el 9582 .width(newWidth) 9583 .height(newWidth * $el.attr('data-aspectRatio')); 9584 } 9585 } 9586 // All others 9587 else { 9588 $el 9589 .width(newWidth) 9590 .height(newWidth * $el.attr('data-aspectRatio')); 9591 } 9592 9593 }); 9594 9595 } 9596 9597 9598 /** 9599 * Reveal the audio/video elements after the size has been calculated. 9600 * 9601 * @since 10.5 9602 */ 9603 function audioVideoVis() { 9604 9605 //unwrap post and portfolio videos 9606 $('.video-wrap iframe').unwrap(); 9607 $('#sidebar iframe[src]').unwrap(); 9608 9609 $('audio') 9610 .attr('width', '100%') 9611 .attr('height', '100%') 9612 .css('visibility', 'visible'); 9613 9614 $('video').css('visibility', 'visible'); 9615 9616 $('.wp-video').each(function () { 9617 var video = $(this).find('video').get(0); 9618 video.addEventListener('loadeddata', function () { 9619 $window.trigger('resize'); 9620 }, false); 9621 }); 9622 9623 //webkit video back button fix 9624 $('.main-content iframe[src]').each(function () { 9625 $(this).css({ 9626 'opacity': '1', 9627 'visibility': 'visible' 9628 }); 9629 }); 9630 9631 } 9632 9633 9634 9635 9636 9637 /** 9638 * Nectar video background size calculations 9639 * 9640 * @since 5.0 9641 */ 9642 function resizeVideoToCover() { 9643 9644 var vid_w_orig = 1280, 9645 vid_h_orig = 720, 9646 min_w = 1200; 9647 9648 $('.nectar-video-wrap').each(function () { 9649 9650 var $containerHeight, $containerWidth; 9651 9652 if ($(this).find('video').length == 0) { 9653 return; 9654 } 9655 9656 if ($(this).parents('#page-header-bg').length > 0) { 9657 9658 if ($('.container-wrap.auto-height').length > 0) { 9659 return false; 9660 } 9661 9662 $containerHeight = $(this).parents('#page-header-bg').outerHeight(); 9663 $containerWidth = $(this).parents('#page-header-bg').outerWidth(); 9664 } else { 9665 9666 if ($(this).hasClass('column-video')) { 9667 if( $body.is('[data-flex-cols="true"]') ) { 9668 $containerHeight = $(this).parents('.vc_column-inner').outerHeight(); 9669 $containerWidth = $(this).parents('.vc_column-inner').outerWidth(); 9670 } else { 9671 $containerHeight = $(this).parents('.wpb_column').outerHeight(); 9672 $containerWidth = $(this).parents('.wpb_column').outerWidth(); 9673 } 9674 } else { 9675 $containerHeight = $(this).parents('.wpb_row').outerHeight(); 9676 $containerWidth = ($(this).parents('.full-width-section').length > 0) ? nectarDOMInfo.winW : $(this).parents('.wpb_row').outerWidth(); 9677 } 9678 } 9679 9680 // Set the video viewport to the window size 9681 $(this).width($containerWidth);
9682 if ($(this).parents('#page-header-bg').length > 0) { 9683 $(this).height($containerHeight); 9684 } 9685 9686 // Use largest scale factor of horizontal/vertical 9687 var scale_h = $containerWidth / vid_w_orig, 9688 scale_v = ($containerHeight - $containerHeight) / vid_h_orig, 9689 scale = scale_h > scale_v ? scale_h : scale_v; 9690 9691 // Update minium width to never allow excess space 9692 min_w = 1280 / 720 * ($containerHeight + 40); 9693 9694 // Don't allow scaled width < minimum video width 9695 if (scale * vid_w_orig < min_w) { 9696 scale = min_w / vid_w_orig; 9697 } 9698 9699 // Now scale the video 9700 $(this).find('video, .mejs-overlay, .mejs-poster').width(Math.ceil(scale * vid_w_orig + 0)); 9701 $(this).find('video, .mejs-overlay, .mejs-poster').height(Math.ceil(scale * vid_h_orig + 0)); 9702 9703 // And center it by scrolling the video viewport 9704 $(this).scrollLeft(($(this).find('video').width() - $containerWidth) / 2); 9705 $(this).scrollTop(($(this).find('video').height() - ($containerHeight)) / 2); 9706 $(this).find('.mejs-overlay, .mejs-poster').scrollTop(($(this).find('video').height() - ($containerHeight)) / 2); 9707 9708 9709 // Align bottom 9710 if ($(this).attr('data-bg-alignment') == 'center bottom' || $(this).attr('data-bg-alignment') == 'bottom') { 9711 $(this).scrollTop(($(this).find('video').height() - ($containerHeight + 6))); 9712 } 9713 // Align top 9714 else if ($(this).attr('data-bg-alignment') == 'center top' || $(this).attr('data-bg-alignment') == 'top') { 9715 $(this).scrollTop(0); 9716 } 9717 9718 // Add loaded class 9719 $(this).addClass('position-loaded'); 9720 }); 9721 9722 } 9723 9724 9725 9726 /** 9727 * Nectar video background initialization. 9728 * 9729 * @since 5.0 9730 */ 9731 function videoBGInit() { 9732 9733 if ($('.nectar-video-wrap').length == 0 && $('.nectar-youtube-bg').length == 0) { 9734 return; 9735 } 9736 9737 setTimeout(function () { 9738 9739 resizeVideoToCover(); 9740 9741 // Resize 9742 $window.on('resize',resizeVideoToCover); 9743 9744 $('.video-color-overlay').each(function () { 9745 $(this).css('background-color', $(this).attr('data-color')); 9746 }); 9747 9748 $('.nectar-video-wrap').each(function () { 9749 9750 if ($(this).find('video').length == 0) { 9751 return; 9752 } 9753 9754 var $headerVideo = ($(this).parents('#page-header-bg').length > 0) ? true : false; 9755 var $that = $(this); 9756 var videoReady = setInterval(function () { 9757 9758 if ($that.find('video').get(0).readyState > 3) { 9759 9760 if (!nectarDOMInfo.usingMobileBrowser) { 9761 $that.transition({ 9762 'opacity': '1' 9763 }, 400); 9764 $that.find('video').transition({ 9765 'opacity': '1' 9766 }, 400); 9767 $that.parent().find('.video-color-overlay').transition({ 9768 'opacity': '0.7' 9769 }, 400); 9770 if ($headerVideo == true) { 9771 pageHeaderTextEffect(); 9772 } 9773 } 9774 9775 // Remove page loading screen 9776 $loadingScreenEl.addClass('loaded'); 9777 setTimeout(function () { 9778 $loadingScreenEl.addClass('hidden'); 9779 }, 1000); 9780 9781 9782 clearInterval(videoReady); 9783 } 9784 9785 }, 60); 9786 9787 if (nectarDOMInfo.usingMobileBrowser) { 9788 9789 if ($that.parents('.full-width-section').length > 0 && 9790 $that.parents('#nectar_fullscreen_rows').length == 0 && 9791 !$that.hasClass('column-video') ) { 9792 9793 $that.css('left', '50%'); 9794 } else { 9795 $that.css('left', '0px'); 9796 } 9797 9798 if ($headerVideo == true) { 9799 pageHeaderTextEffect(); 9800 } 9801 9802 $that.find('video')[0].onplay = function () { 9803 $that.transition({ 9804 'opacity': '1' 9805 }, 400); 9806 $that.find('video').transition({ 9807 'opacity': '1' 9808 }, 400); 9809 $that.parent().find('.video-color-overlay').transition({ 9810 'opacity': '0.7' 9811 }, 400); 9812 }; 9813 9814 } // end mobile only 9815 9816 }); 9817 }, 300); 9818 9819 9820 if (nectarDOMInfo.usingMobileBrowser) { 9821 9822 $('.nectar-video-wrap').each(function () { 9823 9824 if (!$(this).find('video').is('[muted]')) { 9825 9826 // Autoplay not supported unless muted 9827 $(this).parent().find('.mobile-video-image').show(); 9828 $(this).remove(); 9829 } 9830 9831 });
9832 9833 } 9834 9835 9836 $('.wpb_row:has(".nectar-video-wrap"):not(.fp-section)').each(function (i) { 9837 $(this).css('z-index', 100 + i); 9838 }); 9839 9840 9841 $(".vc_row").each(function () { 9842 var youtubeUrl, youtubeId, $row = jQuery(this); 9843 $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(); 9844 9845 // Remove yt url 9846 $row.find('.nectar-youtube-bg span').remove(); 9847 9848 if (!nectarDOMInfo.usingMobileBrowser) { 9849 $row.find('.nectar-video-wrap, .nectar-youtube-bg').css({ 9850 'opacity': '1', 9851 'width': '100%', 9852 'height': '100%' 9853 }); 9854 } 9855 $row.find('.video-color-overlay').transition({ 9856 'opacity': '0.7' 9857 }, 400); 9858 }); 9859 9860 9861 function nectarInsertYoutubeVideoAsBackground($element, youtubeId, counter) { 9862 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 () { 9863 nectarInsertYoutubeVideoAsBackground($element, youtubeId, counter++) 9864 }, 100); 9865 var $container = $element.prepend('<div class="vc_video-bg"><div class="inner"></div></div>').find(".inner"); 9866 new YT.Player($container[0], { 9867 width: "100%", 9868 height: "100%", 9869 videoId: youtubeId, 9870 playerVars: { 9871 playlist: youtubeId, 9872 iv_load_policy: 3, 9873 enablejsapi: 1, 9874 disablekb: 1, 9875 autoplay: 1, 9876 controls: 0, 9877 showinfo: 0, 9878 rel: 0, 9879 loop: 1 9880 }, 9881 events: { 9882 onReady: function (event) { 9883 event.target.mute().setLoop(!0); 9884 nectarResizeVideoBackground($element); 9885 } 9886 } 9887 }), nectarResizeVideoBackground($element), jQuery(window).on("resize", function () { 9888 nectarResizeVideoBackground($element); 9889 }); 9890 9891 setTimeout(function () { 9892 nectarResizeVideoBackground($element); 9893 }, 100); 9894 } 9895 9896 function nectarResizeVideoBackground($element) { 9897 var iframeW, iframeH, marginLeft, marginTop, containerW = $element.innerWidth(), 9898 containerH = $element.innerHeight(), 9899 ratio1 = 16, 9900 ratio2 = 9; 9901 ratio1 / ratio2 > containerW / containerH ? (iframeW = containerH * (ratio1 / ratio2), 9902 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", 9903 marginLeft = -Math.round((iframeW - containerW) / 2) + "px", iframeW += "px", iframeH += "px"), 9904 $element.find(".vc_video-bg iframe").css({ 9905 maxWidth: "1000%", 9906 marginLeft: marginLeft, 9907 marginTop: marginTop, 9908 width: iframeW, 9909 height: iframeH 9910 }); 9911 } 9912 9913 function nectarExtractYoutubeId(url) { 9914 9915 if ("undefined" == typeof url) { 9916 return !1; 9917 } 9918 9919 var id = url.match(/(?:https?:\/{2})?(?:w{3}\.)?youtu(?:be)?\.(?:com|be)(?:\/watch\?v=|\/)([^\s&]+)/); 9920 return null !== id ? id[1] : !1 9921 } 9922 9923 9924 } 9925 9926 9927 9928 9929 /** 9930 * Single Blog Posts 9931 * 9932 * @since 11.0 9933 */ 9934 function blogSingle() { 9935 9936 // Remove first gallery on post when using the gallery slider option. 9937 if( $body.hasClass('single-post') && $('.content-inner[data-has-gallery]').length > 0 ) { 9938 9939 9940 if($('.wp-block-gallery').length > 0) { 9941 // Gutenberg. 9942 $('.content-inner').find('.wp-block-gallery').each(function(i) { 9943 if(i !== 0) { 9944 $(this).css('display','flex'); 9945 } 9946 }); 9947 9948 } else { 9949 // Classic Editor. 9950 $('.content-inner').find('.gallery').each(function(i) { 9951 if(i !== 0) { 9952 $(this).css('display','block'); 9953 } 9954 });
9955 9956 } 9957 9958 } // If using gallery slider on single conditional end. 9959 9960 } 9961 9962 9963 9964 9965 9966 /*-------------------------------------------------------------------------*/ 9967 /* Header + Search 9968 /*-------------------------------------------------------------------------*/ 9969 9970 /** 9971 * Correct megamenus in mobile navigation. 9972 * 9973 * @since 8.0 9974 */ 9975 function mobileNavMegamenuCorrect() { 9976 9977 ////mobile megamenus without titles / nested groupings 9978 var $mobileNavSelector = ( $('#top #mobile-menu').length > 0 ) ? '#top #mobile-menu ' : '.off-canvas-menu-container.mobile-only '; 9979 9980 $($mobileNavSelector + '.menu-item > ul > li > a').each(function () { 9981 9982 if ($(this).text() == '-' || $(this).text() == '–' || $(this).parent().hasClass('hide-title') || $(this).find('> .remove-menu-item-title').length > 0 ) { 9983 9984 var $navLIs = $(this).parent().find('> ul > li').clone(); 9985 9986 // column has widget 9987 if( $(this).parent().find('> .widget-area-active').length > 0 ) { 9988 $(this).parent().find('> a').remove(); 9989 } else { 9990 9991 $(this).parent().find('ul').remove(); 9992 $(this).parent().parent().append($navLIs); 9993 $(this).parent().remove(); 9994 } 9995 9996 } 9997 }); 9998 9999 } 10000 10001 10002 10003 /** 10004 * Material theme skin off canvas menu initialization. 10005 * 10006 * @since 10.5 10007 */ 10008 function materialSkinOCM_Init() { 10009 10010 if ($('body.material[data-slide-out-widget-area-style="slide-out-from-right"]').length > 0) { 10011 OCM_materialWidth(); 10012 10013 if( $wpAdminBar.length > 0 ) { 10014 var $topToolBar = $wpAdminBar.detach(); 10015 $('.ocm-effect-wrap-inner').append($topToolBar); 10016 } 10017 10018 } 10019 10020 OCM_materialIconMarkup(); 10021 materialSkinTransition(); 10022 10023 $window.on('resize', OCM_materialSize); 10024 10025 } 10026 10027 10028 10029 10030 /** 10031 * Material theme skin transition helper 10032 * 10033 * @since 10.5 10034 */ 10035 function materialSkinTransition() { 10036 10037 if ($('body.material[data-header-search="true"]').length > 0 || 10038 $('body.material .ocm-effect-wrap').length > 0) { 10039 10040 var materialTransTO, 10041 allowMaterialResizeCalc = false, 10042 orientTrack = 0, 10043 $winDOMWidth = nectarDOMInfo.winW, 10044 $winDOMHeight = nectarDOMInfo.winH; 10045 10046 // For mobile make sure the orientation has changed. 10047 window.addEventListener("orientationchange", function () { 10048 orientTrack = 1; 10049 }); 10050 10051 // Resize. 10052 $window.on('resize', function () { 10053 10054 if( nectarDOMInfo.usingMobileBrowser ) { 10055 // Mobile. 10056 if (($window.width() != $winDOMWidth && $window.height != $winDOMHeight) || orientTrack === 1) { 10057 10058 // Store the current window dimensions. 10059 $winDOMWidth = nectarDOMInfo.winW; 10060 $winDOMHeight = nectarDOMInfo.winH; 10061 10062 // Reset orientation change tracker. 10063 orientTrack = 0; 10064 10065 // Set to allow. 10066 allowMaterialResizeCalc = true; 10067 10068 } 10069 } else { 10070 // Desktop always allows. 10071 allowMaterialResizeCalc = true; 10072 } 10073 10074 if(allowMaterialResizeCalc) { 10075 10076 clearTimeout(materialTransTO); 10077 10078 $('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') 10079 .addClass('no-material-transition'); 10080 10081 materialTransTO = setTimeout(function () { 10082 $('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') 10083 .removeClass('no-material-transition'); 10084 }, 250); 10085 10086 OCM_materialWidth(); 10087 10088 // Reset allow. 10089 allowMaterialResizeCalc = false; 10090 10091 } // endif for allow. 10092 10093 }); // end resize. 10094 10095 } 10096 10097 } 10098 10099 10100 10101 /** 10102 * Calculate off canvas menu slide out from right on hover 10103 * 10104 * @since 8.0 10105 */ 10106 function calculateHoverNavMinHeight() { 10107 10108 var $widgetHeights = 0; 10109 $('#slide-out-widget-area > .widget').each(function () { 10110 $widgetHeights += $(this).height(); 10111 });
10112 10113 var $menuHeight; 10114 10115 if(($offCanvasEl.height() - 25 - $('.bottom-meta-wrap').outerHeight(true) - $widgetHeights) > $('#slide-out-widget-area .off-canvas-menu-container:last-child').height()) { 10116 $menuHeight = $offCanvasEl.height() - 25 - $('.bottom-meta-wrap').outerHeight(true) - $widgetHeights; 10117 } else { 10118 $menuHeight = $('#slide-out-widget-area .off-canvas-menu-container:last-child').height(); 10119 } 10120 10121 $('#slide-out-widget-area .inner').css({ 10122 'height': 'auto', 10123 'min-height': $menuHeight 10124 }); 10125 10126 10127 } 10128 10129 10130 /** 10131 * Material theme skin off canvas menu width. 10132 * 10133 * @since 8.0 10134 */ 10135 function OCM_materialWidth() { 10136 10137 $('#slide-out-widget-area.slide-out-from-right').css({ 10138 'padding-top': $window.height() * 0.1, 10139 'padding-bottom': $window.height() * 0.1 10140 }); 10141 10142 OCM_overflowState(); 10143 } 10144 10145 10146 10147 /** 10148 * Material theme skin off canvas menu icon markup 10149 * 10150 * @since 8.0 10151 */ 10152 function OCM_materialIconMarkup() { 10153 10154 if ($('body.material').length > 0 && $('body[data-slide-out-widget-area-style="slide-out-from-right-hover"]').length == 0 ) { 10155 10156 if ($('body[data-slide-out-widget-area-style*="fullscreen"]').length == 0 && $('#mobile-menu').length == 0) { 10157 var $menuIconClone = $('header#top nav ul .slide-out-widget-area-toggle a > span > i').clone(); 10158 $menuIconClone.addClass('hover-effect'); 10159 $('header#top nav ul .slide-out-widget-area-toggle a > span').append($menuIconClone); 10160 10161 var $menuIconClone2 = $('header#top .slide-out-widget-area-toggle.mobile-icon a > span > i').clone(); 10162 $menuIconClone2.addClass('hover-effect'); 10163 $('header#top .slide-out-widget-area-toggle.mobile-icon a > span').append($menuIconClone2); 10164 } 10165 10166 $('body:not([data-slide-out-widget-area-style="slide-out-from-right"]) header#top .slide-out-widget-area-toggle a > span') 10167 .append($('<span class="close-wrap"> <span class="close-line close-line1"></span> <span class="close-line close-line2"></span> </span>')); 10168 10169 setTimeout(function(){ 10170 $('header#top .slide-out-widget-area-toggle a > span .close-wrap').addClass('loaded'); 10171 },200); 10172 10173 } 10174 10175 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 ) { 10176 $('#ajax-content-wrap > .slide-out-widget-area-toggle.slide-out-hover-icon-effect').insertAfter('.ocm-effect-wrap'); 10177 } 10178 10179 //move material skin default ocm 10180 if ($('body.material').length > 0 && 10181 $('body[data-slide-out-widget-area-style*="fullscreen"]').length == 0 && 10182 $('.ocm-effect-wrap').length > 0 ) { 10183 $('body.material #slide-out-widget-area.slide-out-from-right .slide_out_area_close').insertAfter('.ocm-effect-wrap'); 10184 $('#slide-out-widget-area-bg').insertAfter('.ocm-effect-wrap'); 10185 $offCanvasEl.insertAfter('.ocm-effect-wrap'); 10186 10187 } 10188 10189 } 10190 10191 10192 10193 /** 10194 * Material theme skin off canvas menu height 10195 * 10196 * @since 8.0 10197 */ 10198 function OCM_materialSize() { 10199 if ($('.ocm-effect-wrap.material-ocm-open').length > 0) { 10200 10201 $('.ocm-effect-wrap').css({ 10202 'height': $window.height() 10203 }); 10204 10205 $('.ocm-effect-wrap-inner').css({ 10206 'padding-top': nectarDOMInfo.adminBarHeight 10207 }); 10208 10209 } 10210 } 10211 10212 10213 10214 /** 10215 * Off canvas menu dropdown markup 10216 * 10217 * @since 8.0 10218 */ 10219 function OCM_dropdownMarkup() { 10220 var $nectar_ocm_dropdown_func = ($('#slide-out-widget-area[data-dropdown-func]').length > 0) ? $offCanvasEl.attr('data-dropdown-func') : 'default'; 10221 if ($nectar_ocm_dropdown_func == 'separate-dropdown-parent-link') { 10222 $('#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>'); 10223 } 10224 } 10225 10226 10227 10228 /** 10229 * Off canvas menu dropdown icon position. 10230 * 10231 * @since 8.0 10232 */ 10233 function OCM_dropdownIconPos() { 10234 10235 $('#slide-out-widget-area[class*="slide-out-from-right"] .off-canvas-menu-container li.menu-item-has-children').each(function () { 10236 $(this).find('.ocm-dropdown-arrow').css({ 10237 'top': $(this).find('a').height() / 2 10238 });
10239 }); 10240 $('#slide-out-widget-area.fullscreen-split .off-canvas-menu-container li.menu-item-has-children').each(function () { 10241 $(this).find('.ocm-dropdown-arrow').css({ 10242 'top': $(this).find('a').height() / 2 10243 }); 10244 }); 10245 10246 } 10247 10248 10249 10250 10251 /** 10252 * Off canvas menu overflow scrolling. 10253 * 10254 * @since 8.0 10255 */ 10256 function OCM_overflowState() { 10257 10258 //switch position of social media/extra info based on screen size 10259 if (nectarDOMInfo.winW < 1000 || 10260 $('body > #boxed').length > 0 || 10261 $('.ocm-effect-wrap-inner > #boxed').length > 0) { 10262 10263 $('#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'); 10264 $('#slide-out-widget-area.fullscreen .bottom-text, #slide-out-widget-area.fullscreen-alt .bottom-text').appendTo('#slide-out-widget-area .inner'); 10265 10266 } else { 10267 $('#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'); 10268 $('#slide-out-widget-area.fullscreen .bottom-text, #slide-out-widget-area.fullscreen-alt .bottom-text').appendTo('#slide-out-widget-area .inner-wrap'); 10269 } 10270 10271 10272 //close mobile only slide out widget area if switching back to desktop 10273 if ($('.slide-out-from-right.open .off-canvas-menu-container.mobile-only').length > 0 && $('body.mobile').length == 0) { 10274 $('#slide-out-widget-area .slide_out_area_close').trigger('click'); 10275 } 10276 10277 //sizing for dropdown 10278 OCM_dropdownIconPos(); 10279 10280 } 10281 10282 10283 10284 /** 10285 * Off canvas menu: slide out from right hover open. 10286 * 10287 * @since 10.5 10288 */ 10289 function OCM_slideOutRightHoverOpen() { 10290 10291 calculateHoverNavMinHeight(); 10292 10293 if ( nectarDOMInfo.usingMobileBrowser && $('#slide-out-widget-area.open').length > 0 ) { 10294 OCM_mobileSlideOutRightHoverCloseCheck(); 10295 return false; 10296 } 10297 10298 if( nectarDOMInfo.usingMobileBrowser ) { 10299 $('.slide-out-widget-area-toggle a').attr('aria-expanded','true'); 10300 $offCanvasBG.css({ 10301 'height': '100%', 10302 'width': '100%' 10303 }); 10304 } 10305 10306 $offCanvasEl.css({ 10307 'transform': 'translate3d(0,0,0)' 10308 }).addClass('open'); 10309 10310 var withinCustomBreakpoint = mobileBreakPointCheck(); 10311 if( nectarDOMInfo.winW < 1000 ) { 10312 withinCustomBreakpoint = true; 10313 } 10314 var alignmentPosition = (window.nectarOptions && window.nectarOptions.mobile_header_format && window.nectarOptions.mobile_header_format === 'centered-menu' && withinCustomBreakpoint) ? 'left' : 'right'; 10315 10316 // Icon effect 10317 // Set position 10318 if ($('header#top .container .span_9 > .slide-out-widget-area-toggle').length > 0) { 10319 10320 var $hIconEl = $('.slide-out-hover-icon-effect'), 10321 secondaryBarHeight = nectarDOMInfo.secondaryHeaderHeight; 10322 10323 var $nectarHamMenuPos; 10324 var $withinCustomBreakpoint = mobileBreakPointCheck(); 10325 if( $('#header-outer[data-format="centered-menu-bottom-bar"]').length > 0 ) { 10326 $withinCustomBreakpoint = false; 10327 } 10328 10329 if ($('body.mobile').length > 0 || $withinCustomBreakpoint) { 10330 10331 $hIconEl.css({ 10332 'top': $('header#top .span_9 > .slide-out-widget-area-toggle a').offset().top - nectarDOMInfo.scrollTop 10333 }); 10334 10335 if( alignmentPosition === 'left' ) { 10336 $hIconEl.css({ 10337 'left' : parseInt($('#header-outer header > .container').css('padding-right')) + 1, 10338 'right' : '' 10339 });
10340 } else { 10341 $hIconEl.css({ 10342 'right' : parseInt($('#header-outer header > .container').css('padding-right')) + 1, 10343 'left' : '' 10344 }); 10345 } 10346 10347 } else { 10348 10349 if ($bodyBorderHeaderColorMatch) { 10350 10351 var $extraCushion = ($('#header-outer[data-has-menu="false"]').length > 0) ? 2 : 1; 10352 $hIconEl.css({ 10353 'top': nectarDOMInfo.adminBarHeight + secondaryBarHeight + parseInt($('header#top nav >ul .slide-out-widget-area-toggle a').css('padding-top')), 10354 'right': 29 + $extraCushion 10355 }); 10356 10357 } else { 10358 10359 if ($('#header-outer[data-format="centered-menu-bottom-bar"]').length > 0) { 10360 $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(); 10361 10362 if( $('#top .span_3 .slide-out-widget-area-toggle.mobile-icon').css('display') == 'flex' ) { 10363 $nectarHamMenuPos = $('#top .span_3 .slide-out-widget-area-toggle.mobile-icon a').offset(); 10364 } 10365 10366 $hIconEl.css({ 10367 'top': parseInt($nectarHamMenuPos.top) - nectarDOMInfo.scrollTop, 10368 'right': parseInt($('#header-outer header >.container').css('padding-right')) + 2, 10369 'left': '' 10370 }); 10371 } else { 10372 10373 if( $body.hasClass('ascend') ) { 10374 $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(); 10375 } else { 10376 $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(); 10377 } 10378 10379 10380 if ($('#header-secondary-outer.hide-up').length > 0) { 10381 secondaryBarHeight = 0; 10382 } 10383 10384 $hIconEl.css({ 10385 'top': nectarDOMInfo.adminBarHeight + secondaryBarHeight + parseInt($nectarHamMenuPos.top), 10386 'right': parseInt($('#header-outer header >.container').css('padding-right')) + 2, 10387 'left': '' 10388 }); 10389 } 10390 10391 } // No body border color match. 10392 10393 } //Not on mobile. 10394 10395 } 10396 10397 ////Open 10398 $('.slide-out-hover-icon-effect .lines-button') 10399 .removeClass('no-delay') 10400 .addClass('unhidden-line'); 10401 10402 if ($('#header-outer[data-permanent-transparent="1"]').length == 0 && 10403 $('#nectar_fullscreen_rows').length == 0 && 10404 !nectarDOMInfo.usingFrontEndEditor && 10405 nectarDOMInfo.winW > 1000) { 10406 10407 if (!(nectarDOMInfo.scrollTop == 0 && $('#header-outer.transparent').length > 0)) { 10408 10409 if ($('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) { 10410 10411 $headerOuterEl.attr('data-transparent', 'true').addClass('no-bg-color').addClass('slide-out-hover'); 10412 $('#header-outer header, #header-outer > .cart-outer').addClass('all-hidden'); 10413 } 10414 10415 } 10416 10417 if ($('#header-outer[data-remove-fixed="1"]').length == 0 && $('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) { 10418 10419 if (headerResize == true) { 10420 10421 $window.off('scroll', bigNav); 10422 $window.off('scroll', smallNav); 10423 10424 } else { 10425 $window.off('scroll', opaqueCheck); 10426 $window.off('scroll', transparentCheck); 10427 } 10428 } 10429 10430 } 10431 10432 if (!nectarDOMInfo.usingMobileBrowser) { 10433 $window.on('mousemove.rightOffsetCheck', OCM_slideOutRightHoverCloseCheck); 10434 } else { 10435 return false; 10436 } 10437 10438 } 10439 10440 10441 /** 10442 * Off canvas menu: slide out from right hover close 10443 * 10444 * @since 10.5 10445 */ 10446 function OCM_slideOutRightHoverCloseCheck(e) { 10447 10448 var $windowWidth = $window.width(); 10449 var $ocmHoverWidth = $offCanvasEl.outerWidth(); 10450 var withinCustomBreakpoint = mobileBreakPointCheck(); 10451 if( nectarDOMInfo.winW < 1000 ) { 10452 withinCustomBreakpoint = true; 10453 } 10454 var alignmentPosition = (window.nectarOptions && window.nectarOptions.mobile_header_format && window.nectarOptions.mobile_header_format === 'centered-menu' && withinCustomBreakpoint) ? 'left' : 'right'; 10455 10456 var conditionalShow = false; 10457 if( alignmentPosition !== 'left') { 10458 conditionalShow = (e.clientX < $windowWidth - parseInt($ocmHoverWidth) - $bodyBorderWidth);
10459 } else { 10460 conditionalShow = (e.clientX > parseInt($ocmHoverWidth) + $bodyBorderWidth); 10461 } 10462 10463 10464 if (conditionalShow && $offCanvasEl.hasClass('mouse-accessed')) { 10465 10466 $offCanvasEl.removeClass('mouse-accessed'); 10467 $window.off('mousemove.rightOffsetCheck', OCM_slideOutRightHoverCloseCheck); 10468 10469 $offCanvasEl.css({ 10470 'transform': '' 10471 }).removeClass('open'); 10472 10473 $headerOuterEl.removeClass('style-slide-out-from-right'); 10474 10475 $('.slide-out-hover-icon-effect .lines-button') 10476 .removeClass('unhidden-line') 10477 .addClass('no-delay'); 10478 10479 if ($('#header-outer[data-permanent-transparent="1"]').length == 0) { 10480 10481 if ($('#header-outer[data-remove-fixed="1"]').length == 0 && $('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) { 10482 10483 if ($('body.mobile').length == 0) { 10484 $headerOuterEl.removeClass('no-bg-color'); 10485 $('#header-outer header, #header-outer > .cart-outer').removeClass('all-hidden'); 10486 } 10487 } 10488 10489 if ($('#header-outer[data-remove-fixed="1"]').length == 0 && $('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) { 10490 10491 if (headerResize == true) { 10492 10493 $window.off('scroll.headerResizeEffect'); 10494 10495 if (nectarDOMInfo.scrollTop == 0) { 10496 10497 $window.on('scroll.headerResizeEffect', smallNav); 10498 10499 if ($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 && 10500 $bodyBorderTop.length > 0 && 10501 $bodyBorderHeaderColorMatch == true && 10502 $('#header-outer.pseudo-data-transparent').length > 0) { 10503 10504 $('#header-outer[data-full-width="true"] header > .container').stop(true, true).animate({ 10505 'padding': '0' 10506 }, { 10507 queue: false, 10508 duration: 250, 10509 easing: 'easeOutCubic' 10510 }); 10511 10512 } 10513 } else { 10514 $window.on('scroll.headerResizeEffect', bigNav); 10515 } 10516 10517 } else { 10518 10519 $window.off('scroll.headerResizeEffectOpaque'); 10520 $window.on('scroll.headerResizeEffectOpaque', opaqueCheck); 10521 } 10522 } 10523 } 10524 } 10525 10526 } 10527 10528 10529 /** 10530 * Off canvas menu: mobile slide out from right hover close. 10531 * 10532 * @since 10.5 10533 */ 10534 function OCM_mobileSlideOutRightHoverCloseCheck() { 10535 10536 if(nectarDOMInfo.usingMobileBrowser) { 10537 $('.slide-out-widget-area-toggle a').attr('aria-expanded','false'); 10538 $offCanvasBG.css({ 10539 'height': '1px', 10540 'width': '1px' 10541 }); 10542 } 10543 10544 $offCanvasEl.css({ 10545 'transform': '' 10546 }).removeClass('open'); 10547 10548 $headerOuterEl.removeClass('style-slide-out-from-right'); 10549 10550 $('.slide-out-hover-icon-effect .lines-button') 10551 .removeClass('unhidden-line') 10552 .addClass('no-delay'); 10553 10554 if ($('#header-outer[data-permanent-transparent="1"]').length == 0) { 10555 10556 $headerOuterEl.removeClass('no-bg-color'); 10557 $('#header-outer header').removeClass('all-hidden'); 10558 10559 } 10560 10561 10562 if ($('#header-outer[data-remove-fixed="1"]').length == 0 && $('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) { 10563 10564 if (headerResize == true) { 10565 10566 $window.off('scroll.headerResizeEffect'); 10567 10568 if (nectarDOMInfo.scrollTop == 0) { 10569 10570 $window.on('scroll.headerResizeEffect', smallNav); 10571 10572 if ($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 && 10573 $bodyBorderTop.length > 0 && 10574 $bodyBorderHeaderColorMatch == true && 10575 $('#header-outer.pseudo-data-transparent').length > 0) { 10576 10577 $('#header-outer[data-full-width="true"] header > .container').stop(true, true).animate({ 10578 'padding': '0' 10579 }, { 10580 queue: false, 10581 duration: 250, 10582 easing: 'easeOutCubic' 10583 }); 10584 10585 } 10586 } 10587 10588 else { 10589 $window.on('scroll.headerResizeEffect', bigNav); 10590 } 10591 10592 } else { 10593 10594 $window.off('scroll.headerResizeEffectOpaque'); 10595 $window.on('scroll.headerResizeEffectOpaque', opaqueCheck); 10596 10597 } 10598 10599 } 10600 10601 } 10602 10603 10604 10605 /** 10606 * Off canvas menu: slide out from right hover initialization. 10607 * 10608 * @since 10.5 10609 */ 10610 function OCM_slideOutRightHoverInit() { 10611 10612 if ($('#ajax-content-wrap > .slide-out-widget-area-toggle').length == 0) { 10613 10614 //icon effect html creation 10615 var $iconInsertLocation = ( $('.slide-out-widget-area-toggle[data-custom-color="true"]').length > 0 ) ? '#slide-out-widget-area > div' : '#slide-out-widget-area'; 10616 10617 $('<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); 10618 10619 if ($('#header-outer[data-has-menu="true"]').length > 0 || 10620 $('body[data-header-search="true"]').length > 0 || 10621 $('.slide-out-widget-area-toggle a.using-label').length > 0 || 10622 $('.slide-out-widget-area-toggle[data-custom-color="true"]').length > 0 ) { 10623 $('.slide-out-widget-area-toggle').addClass('small'); 10624 } 10625 } 10626 10627 10628 //hover triggered 10629 if (!nectarDOMInfo.usingMobileBrowser) { 10630 $body.on('mouseenter', '#header-outer .slide-out-widget-area-toggle:not(.std-menu) a', OCM_slideOutRightHoverOpen); 10631 $offCanvasEl.on('mouseenter', function () { 10632 $(this).addClass('mouse-accessed'); 10633 });
10634 10635 } else { 10636 $body.on('click', '.slide-out-widget-area-toggle:not(.std-menu) a', OCM_slideOutRightHoverOpen); 10637 $body.on('click', '#slide-out-widget-area-bg', OCM_slideOutRightMobileClose); 10638 } 10639 10640 $window.on('smartresize', calculateHoverNavMinHeight); 10641 10642 10643 } 10644 10645 10646 /** 10647 * Off canvas menu: slide out from right close from body click on mobile. 10648 * 10649 * @since 12.2 10650 */ 10651 function OCM_slideOutRightMobileClose() { 10652 10653 if( $('.slide-out-from-right-hover.open').length > 0 ) { 10654 $('.slide-out-widget-area-toggle:not(.std-menu) a').first().addClass('non-human-allowed').trigger('click'); 10655 setTimeout(function () { 10656 $('.slide-out-widget-area-toggle:not(.std-menu) a').removeClass('non-human-allowed'); 10657 }, 100); 10658 } 10659 10660 } 10661 10662 10663 /** 10664 * Off canvas menu: slide out from right open. 10665 * 10666 * @since 10.5 10667 */ 10668 function OCM_slideOutRightOpen() { 10669 10670 var $slideOutAmount = ($bodyBorderTop.length > 0 && $('body.mobile').length == 0) ? $bodyBorderTop.height() : 0; 10671 10672 var withinCustomBreakpoint = mobileBreakPointCheck(); 10673 if( nectarDOMInfo.winW < 1000 ) { 10674 withinCustomBreakpoint = true; 10675 } 10676 var alignmentPosition = (window.nectarOptions && window.nectarOptions.mobile_header_format && window.nectarOptions.mobile_header_format === 'centered-menu' && withinCustomBreakpoint) ? 'left' : 'right'; 10677 10678 if ($('body.material').length == 0) { 10679 10680 // Calc height if used bottom meta. 10681 $('#slide-out-widget-area .inner').css({ 10682 'height': 'auto', 10683 'min-height': $offCanvasEl.height() - 25 - $('.bottom-meta-wrap').height() 10684 }); 10685 10686 // First item dropdown? 10687 if($('#slide-out-widget-area[data-dropdown-func="separate-dropdown-parent-link"] .inner > div:first-of-type > .menu > li:first-child').length > 0 && 10688 $('#slide-out-widget-area .inner > div:first-of-type > .menu > li:first-child').hasClass('menu-item-has-children')) { 10689 $('#slide-out-widget-area .inner > div:first-of-type').css({'margin-top':'50px'}); 10690 } 10691 10692 if ($('#boxed').length == 0) { 10693 10694 $('.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({ 10695 x: (alignmentPosition === 'left') ? '300px' : '-300px' 10696 }, 700, 'easeInOutCubic'); 10697 10698 var $withinCustomBreakpoint = mobileBreakPointCheck(); 10699 10700 if ($('#header-outer[data-format="centered-logo-between-menu"]').length == 0 || $withinCustomBreakpoint) { 10701 10702 if ($('#header-outer[data-transparency-option="1"]').length == 0 || 10703 ($('#header-outer[data-transparency-option="1"]').length > 0 && $('#header-outer[data-full-width="true"]').length == 0) || 10704 $('body.mobile').length > 0) { 10705 10706 $headerOuterEl.stop(true).css('transform', 'translateY(0)').transition({ 10707 x: (alignmentPosition === 'left') ? (300 + $slideOutAmount) + 'px' : '-' + (300 + $slideOutAmount) + 'px' 10708 }, 700, 'easeInOutCubic'); 10709 10710 } else { 10711 10712 $headerOuterEl.stop(true).css('transform', 'translateY(0)').transition({ 10713 x: (alignmentPosition === 'left') ? (300 + $slideOutAmount) + 'px' : '-' + (300 + $slideOutAmount) + 'px', 10714 'background-color': 'transparent', 10715 'border-bottom': '1px solid rgba(255,255,255,0.22)' 10716 }, 700, 'easeInOutCubic'); 10717 10718 } 10719 } else { 10720 $('#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({ 10721 x: (alignmentPosition === 'left') ? '300px' : '-300px' 10722 }, 700, 'easeInOutCubic'); 10723 } 10724 10725 } 10726 10727 $offCanvasEl.stop(true).transition({ 10728 x: (alignmentPosition === 'left') ? $slideOutAmount + 'px' : '-' + $slideOutAmount + 'px' 10729 }, 700, 'easeInOutCubic').addClass('open'); 10730 10731 10732 if ($('#boxed').length == 0) { 10733 10734 // Full width menu adjustments 10735 if ($('#header-outer[data-full-width="true"]').length > 0 && !$body.hasClass('mobile')) { 10736 $headerOuterEl.addClass('highzI'); 10737 $('#ascrail2000').addClass('z-index-adj'); 10738 10739 if ($('#header-outer[data-format="centered-logo-between-menu"]').length == 0) { 10740 10741 if ($bodyBorderWidth == 0) { 10742 $('header#top #logo').stop(true).transition({ 10743 x: (300 + $slideOutAmount) + 'px' //todo 10744 }, 700, 'easeInOutCubic'); 10745 } 10746 10747 } 10748 10749 $('header#top .slide-out-widget-area-toggle .lines-button:not(.legacy-double)').addClass('close'); 10750 10751 $('body #header-outer nav > ul > li > a').css({ 10752 'margin-bottom': '0' 10753 });
10754 10755 } 10756 10757 } 10758 10759 $headerOuterEl.addClass('style-slide-out-from-right'); 10760 10761 // Fade In BG Overlay 10762 $offCanvasBG.css({ 10763 'height': '100%', 10764 'width': '100%' 10765 }).stop(true).transition({ 10766 'opacity': 1 10767 }, 700, 'easeInOutCubic', function () { 10768 $('.slide-out-widget-area-toggle:not(.std-menu) > div > a').removeClass('animating'); 10769 }); 10770 10771 // Hide menu if no space 10772 if ($('#header-outer[data-format="centered-logo-between-menu"]').length == 0) { 10773 10774 var $logoWidth = ($('#logo img:visible').length > 0) ? $('#logo img:visible').width() : $('#logo').width(); 10775 10776 if ($('header#top nav > .sf-menu').offset().left - $logoWidth - 300 < 20) { 10777 $headerOuterEl.addClass('hidden-menu'); 10778 } 10779 10780 } else { 10781 $headerOuterEl.addClass('hidden-menu-items'); 10782 } 10783 10784 10785 if ($('#header-outer[data-remove-fixed="1"]').length == 0 && nectarDOMInfo.winW > 1000) { 10786 10787 if ($bodyBorderHeaderColorMatch == true && headerResize == true && $headerOuterEl.attr('data-transparent-header') == 'true') { 10788 10789 $headerOuterEl.stop(true).transition({ 10790 y: '0' 10791 }, 0).addClass('transparent').css('transition', 'transform'); 10792 10793 10794 $window.off('scroll', bigNav); 10795 $window.off('scroll', smallNav); 10796 10797 } else if ($bodyBorderHeaderColorMatch == true && $headerOuterEl.attr('data-transparent-header') == 'true') { 10798 10799 $headerOuterEl.addClass('transparent'); 10800 $window.off('scroll', opaqueCheck); 10801 $window.off('scroll', transparentCheck); 10802 10803 } 10804 } 10805 10806 } else if ($('body.material').length > 0) { 10807 10808 // Material theme skin slide out from right 10809 10810 //move ajax loading outside 10811 if ($loadingScreenEl.length > 0 && $('.ocm-effect-wrap #ajax-loading-screen').length > 0) { 10812 $loadingScreenEl.insertBefore('.ocm-effect-wrap'); 10813 } 10814 10815 // Hide secondary header when not at top with hhun 10816 if (nectarDOMInfo.scrollTop > 40) { 10817 $('body[data-hhun="1"] #header-secondary-outer').addClass('hidden'); 10818 } 10819 10820 setTimeout(function () { 10821 $('.slide-out-widget-area-toggle:not(.std-menu) > div > a').removeClass('animating'); 10822 }, 300); 10823 10824 $('#slide-out-widget-area, #slide-out-widget-area-bg, #header-outer .slide-out-widget-area-toggle').addClass('material-open'); 10825 10826 10827 // Handle bottom bar nav 10828 if ($('body:not(.mobile) #header-outer[data-format="centered-menu-bottom-bar"][data-condense="true"]').length > 0 && 10829 $('#header-outer[data-format="centered-menu-bottom-bar"] .span_9').css('display') != 'none') { 10830 10831 $('#header-outer:not(.fixed-menu)').css('top', nectarDOMInfo.adminBarHeight - nectarDOMInfo.scrollTop + 'px'); 10832 10833 if ($headerSecondaryEl.length > 0 && $('#header-outer.fixed-menu').length > 0) { 10834 $headerSecondaryEl.css('visibility', 'hidden'); 10835 } 10836 10837 } 10838 10839 $('#ajax-content-wrap').css({ 10840 'position': 'relative', 10841 'top': '-' + nectarDOMInfo.scrollTop + 'px' 10842 }); 10843 10844 $('.ocm-effect-wrap-inner').css({ 10845 'padding-top': nectarDOMInfo.adminBarHeight 10846 }); 10847 10848 $('#fp-nav').addClass('material-ocm-open'); 10849 10850 nectarState.materialOffCanvasOpen = true; 10851 $body.addClass('material-ocm-open'); 10852 $body.addClass('nectar-no-flex-height'); 10853 10854 $('.ocm-effect-wrap').css({ 10855 'height': nectarDOMInfo.winH 10856 }); 10857 10858 setTimeout(function () { 10859 $('.ocm-effect-wrap').addClass('material-ocm-open'); 10860 }, 40); 10861 10862 10863 $('body > .slide_out_area_close').addClass('follow-body'); 10864 10865 //icon effect 10866 $('#header-outer:not([data-format="left-header"]) header#top .slide-out-widget-area-toggle a').addClass('effect-shown'); 10867 10868 //handle hhun when at top 10869 $('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({ 10870 'transition': 'none', 10871 'transform': 'translateY(' + nectarDOMInfo.adminBarHeight + 'px)' 10872 });
10873 10874 10875 setTimeout(function () { 10876 $('body > .slide_out_area_close').addClass('material-ocm-open'); 10877 }, 350); 10878 10879 10880 } 10881 10882 } 10883 10884 10885 /** 10886 * Off canvas menu: slide out from right close. 10887 * 10888 * @since 10.5 10889 */ 10890 function OCM_slideOutRightClose() { 10891 10892 if ($('body.material').length == 0) { 10893 10894 var withinCustomBreakpoint = mobileBreakPointCheck(); 10895 if( nectarDOMInfo.winW < 1000 ) { 10896 withinCustomBreakpoint = true; 10897 } 10898 var alignmentPosition = (window.nectarOptions && window.nectarOptions.mobile_header_format && window.nectarOptions.mobile_header_format === 'centered-menu' && withinCustomBreakpoint) ? 'left' : 'right'; 10899 10900 $('.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({ 10901 x: '0px' 10902 }, 700, 'easeInOutCubic'); 10903 10904 if ($('#header-outer[data-transparency-option="1"]').length > 0 && $('#boxed').length == 0) { 10905 var $currentRowBG = ($('#header-outer[data-current-row-bg-color]').length > 0) ? $headerOuterEl.attr('data-current-row-bg-color') : $headerOuterEl.attr('data-user-set-bg'); 10906 $headerOuterEl.stop(true).transition({ 10907 x: '0px', 10908 'background-color': $currentRowBG 10909 }, 700, 'easeInOutCubic'); 10910 } else { 10911 $headerOuterEl.stop(true).transition({ 10912 x: '0px' 10913 }, 700, 'easeInOutCubic'); 10914 } 10915 10916 $offCanvasEl.stop(true).transition({ 10917 x: (alignmentPosition === 'left') ? '-301px' : '301px' 10918 }, 700, 'easeInOutCubic').removeClass('open'); 10919 10920 10921 if ($('#boxed').length == 0) { 10922 if ($('#header-outer[data-full-width="true"]').length > 0) { 10923 $headerOuterEl.removeClass('highzI'); 10924 $('header#top #logo').stop(true).transition({ 10925 x: '0px' 10926 }, 700, 'easeInOutCubic'); 10927 $('.lines-button').removeClass('close'); 10928 10929 } 10930 } 10931 10932 if ($('#header-outer[data-format="centered-logo-between-menu"]').length > 0) { 10933 $('#header-outer header#top nav > ul.buttons, #header-outer .cart-outer .cart-menu-wrap').stop(true).transition({ 10934 x: '0px' 10935 }, 700, 'easeInOutCubic'); 10936 } 10937 10938 //fade out overlay 10939 $offCanvasBG.stop(true).transition({ 10940 'opacity': 0 10941 }, 700, 'easeInOutCubic', function () { 10942 10943 $('.slide-out-widget-area-toggle a').removeClass('animating'); 10944 10945 $(this).css({ 10946 'height': '1px', 10947 'width': '1px' 10948 }); 10949 10950 if ($('#header-outer[data-remove-fixed="1"]').length == 0) { 10951 10952 //hide menu if transparent, user has scrolled down and hhun is on 10953 if ($headerOuterEl.hasClass('parallax-contained') && 10954 nectarDOMInfo.scrollTop > 0 && 10955 $('#header-outer[data-permanent-transparent="1"]').length == 0) { 10956 $headerOuterEl.removeClass('parallax-contained').addClass('detached').removeClass('transparent'); 10957 } 10958 else if (nectarDOMInfo.scrollTop == 0 && $('body[data-hhun="1"]').length > 0 && $('#page-header-bg[data-parallax="1"]').length > 0 || 10959 nectarDOMInfo.scrollTop == 0 && $('body[data-hhun="1"]').length > 0 && $('.parallax_slider_outer').length > 0) { 10960 10961 if ($('#header-outer[data-transparency-option="1"]').length > 0) { 10962 $headerOuterEl.addClass('transparent'); 10963 } 10964 10965 $headerOuterEl 10966 .addClass('parallax-contained') 10967 .removeClass('detached'); 10968 10969 } 10970 10971 } 10972 10973 //fix for fixed subpage menu 10974 $('.container-wrap').css('transform', 'none'); 10975 10976 }); 10977 10978 10979 $headerOuterEl.removeClass('style-slide-out-from-right'); 10980 10981 10982 if ($('#header-outer[data-remove-fixed="1"]').length == 0) { 10983 10984 if ($bodyBorderHeaderColorMatch == true && 10985 headerResize == true && 10986 nectarDOMInfo.winW > 1000) { 10987 10988 $window.off('scroll.headerResizeEffect'); 10989 if (nectarDOMInfo.scrollTop == 0) { 10990 10991 $window.on('scroll.headerResizeEffect', smallNav); 10992 10993 if ($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 && 10994 $bodyBorderTop.length > 0 && 10995 $bodyBorderHeaderColorMatch == true && 10996 $('#header-outer.pseudo-data-transparent').length > 0) { 10997 10998 $('#header-outer[data-full-width="true"] header > .container').stop(true, true).animate({ 10999 'padding': '0' 11000 }, { 11001 queue: false, 11002 duration: 250, 11003 easing: 'easeOutCubic' 11004 });
11005 11006 } 11007 } else { 11008 $window.on('scroll.headerResizeEffect', bigNav); 11009 } 11010 11011 if ($headerOuterEl.hasClass('pseudo-data-transparent')) { 11012 11013 $headerOuterEl.attr('data-transparent-header', 'false') 11014 .removeClass('pseudo-data-transparent') 11015 .removeClass('transparent'); 11016 } 11017 11018 $headerOuterEl.css('transition', 'transform'); 11019 11020 } else if ($bodyBorderHeaderColorMatch == true && nectarDOMInfo.winW > 1000) { 11021 11022 $window.off('scroll.headerResizeEffectOpaque'); 11023 $window.on('scroll.headerResizeEffectOpaque', opaqueCheck); 11024 11025 $headerOuterEl.css('transition', 'transform'); 11026 11027 if ($headerOuterEl.hasClass('pseudo-data-transparent')) { 11028 $headerOuterEl.attr('data-transparent-header', 'false') 11029 .removeClass('pseudo-data-transparent') 11030 .removeClass('transparent'); 11031 } 11032 } 11033 } 11034 } 11035 11036 else if ($('body.material').length > 0) { 11037 11038 //material 11039 $offCanvasEl.removeClass('open'); 11040 11041 $('#slide-out-widget-area, #slide-out-widget-area-bg, #header-outer .slide-out-widget-area-toggle').removeClass('material-open'); 11042 $('.ocm-effect-wrap, .ocm-effect-wrap-shadow, body > .slide_out_area_close, #fp-nav').removeClass('material-ocm-open'); 11043 11044 $('body > .slide_out_area_close').removeClass('follow-body'); 11045 11046 setTimeout(function () { 11047 $('.slide-out-widget-area-toggle a').removeClass('animating'); 11048 11049 $body.removeClass('material-ocm-open'); 11050 $body.removeClass('nectar-no-flex-height'); 11051 11052 $('.ocm-effect-wrap').css({ 11053 'height': '100%' 11054 }); 11055 11056 $('.ocm-effect-wrap-inner').css({ 11057 'padding-top': '0' 11058 }); 11059 11060 $window.scrollTop(Math.abs(parseInt($('#ajax-content-wrap').css('top')))); 11061 11062 $('#ajax-content-wrap').css({ 11063 'position': '', 11064 'top': '' 11065 }); 11066 11067 11068 //handle bottom bar nav 11069 if ($('#header-outer[data-format="centered-menu-bottom-bar"]').length > 0 && 11070 $('#header-outer[data-format="centered-menu-bottom-bar"] .span_9').css('display') != 'none' && 11071 $('body.mobile').length == 0) { 11072 11073 $('#header-outer:not(.fixed-menu)').css('top', ''); 11074 $headerSecondaryEl.css('visibility', ''); 11075 11076 } 11077 11078 //handle hhun when at top 11079 $('body[data-hhun="1"]:not(.no-scroll) #header-outer[data-permanent-transparent="false"]:not(.detached):not(.parallax-contained):not(.at-top-before-box)').css({ 11080 'transform': '' 11081 }); 11082 setTimeout(function () { 11083 $('body[data-hhun="1"]:not(.no-scroll) #header-outer[data-permanent-transparent="false"]:not(.detached):not(.parallax-contained):not(.at-top-before-box)').css({ 11084 'transition': '' 11085 });
11086 }, 30); 11087 11088 11089 $('body[data-hhun="1"] #header-secondary-outer.hidden').removeClass('hidden'); 11090 11091 nectarState.materialOffCanvasOpen = false; 11092 11093 }, 900); 11094 11095 setTimeout(function () { 11096 11097 //icon effect 11098 $('#header-outer:not([data-format="left-header"]) header#top .slide-out-widget-area-toggle a') 11099 .addClass('no-trans') 11100 .removeClass('effect-shown'); 11101 11102 }, 200); 11103 11104 setTimeout(function () { 11105 //icon 11106 $('#header-outer:not([data-format="left-header"]) header#top .slide-out-widget-area-toggle a').removeClass('no-trans'); 11107 }, 500); 11108 11109 } 11110 11111 } 11112 11113 11114 11115 11116 /** 11117 * Off canvas menu: fullscreen open. 11118 * 11119 * @since 10.5 11120 */ 11121 function OCM_fullscreenOpen() { 11122 11123 if ($('body.material').length > 0) { 11124 $('header#top .slide-out-widget-area-toggle a').addClass('menu-push-out'); 11125 } 11126 11127 // Scroll away from fixed reveal footer if shown (firefox bug with bluring over it) 11128 var $scrollDelay = 0; 11129 var $scrollDelay2 = 0; 11130 11131 if (nectarDOMInfo.scrollTop + $window.height() > $('.blurred-wrap').height() && $('#nectar_fullscreen_rows').length == 0) { 11132 $('body,html').stop().animate({ 11133 scrollTop: $('.blurred-wrap').height() - $window.height() 11134 }, 600, 'easeInOutCubic'); 11135 $scrollDelay = 550; 11136 $scrollDelay2 = 200; 11137 } 11138 11139 $('header#top .slide-out-widget-area-toggle:not(.std-menu) .lines-button:not(.legacy-double)').addClass('close'); 11140 setTimeout(function () { 11141 $('.blurred-wrap').addClass('blurred'); 11142 }, $scrollDelay); 11143 $('#slide-out-widget-area.fullscreen').show().addClass('open'); 11144 11145 if ($('.nectar-social.fixed').length == 0) { 11146 hideToTop(); 11147 } 11148 11149 // Remove box shadow incase at the top of the page with nectar box roll above 11150 $('.container-wrap').addClass('no-shadow'); 11151 $headerOuterEl.stop(true).css('transform', 'translateY(0)'); 11152 11153 setTimeout(function () { 11154 11155 $('.off-canvas-menu-container .menu > li').each(function (i) { 11156 $(this).delay(i * 50).transition({ 11157 y: 0, 11158 'opacity': 1 11159 }, 800, 'easeOutExpo'); 11160 }); 11161 11162 $('#slide-out-widget-area.fullscreen .widget').each(function (i) { 11163 $(this).delay(i * 100).transition({ 11164 y: 0, 11165 'opacity': 1 11166 }, 800, 'easeOutExpo'); 11167 }); 11168 }, 370 + $scrollDelay2); 11169 11170 setTimeout(function () { 11171 $('#slide-out-widget-area .off-canvas-social-links').addClass('line-shown'); 11172 11173 $('#slide-out-widget-area .off-canvas-social-links li').each(function (i) { 11174 $(this).delay(i * 50).transition({ 11175 'scale': 1 11176 }, 400, 'easeOutCubic'); 11177 }); 11178 11179 $('#slide-out-widget-area .bottom-text').transition({ 11180 'opacity': 0.7 11181 }, 400, 'easeOutCubic'); 11182 }, 750 + $scrollDelay2); 11183 11184 // Fade In BG Overlay 11185 setTimeout(function () { 11186 var $easing = ($('body.mobile').length > 0) ? 'easeOutCubic' : 'easeInOutQuint'; 11187 $offCanvasBG.css({ 11188 'height': '100%', 11189 'width': '100%' 11190 }).show().stop(true).transition({ 11191 'y': '0%' 11192 }, 920, $easing, function () { 11193 $('.slide-out-widget-area-toggle > div > a').removeClass('animating'); 11194 }); 11195 }, 50 + $scrollDelay2); 11196 11197 // Overflow state 11198 OCM_overflowState(); 11199 11200 if ($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && $('.container-wrap').hasClass('no-scroll')) { 11201 $('#ajax-content-wrap').addClass('at-content'); 11202 } 11203 11204 var headerOffset = $headerOuterEl.offset().top - nectarDOMInfo.scrollTop + nectarDOMInfo.secondaryHeaderHeight; 11205 11206 $('#slide-out-widget-area.fullscreen .inner-wrap').css('padding-top', ($headerOuterEl.outerHeight() + headerOffset)); 11207 11208 11209 } 11210 11211 11212 /** 11213 * Off canvas menu: fullscreen close. 11214 * 11215 * @since 10.5 11216 */ 11217 function OCM_fullscreenClose() { 11218 11219 if ($('body.material').length > 0) { 11220 setTimeout(function () { 11221 $('header#top .slide-out-widget-area-toggle a').removeClass('menu-push-out'); 11222 }, 350); 11223 } 11224 11225 $('.slide-out-widget-area-toggle:not(.std-menu) .lines-button:not(.legacy-double)').removeClass('close'); 11226 $('.blurred-wrap').removeClass('blurred'); 11227 $('#slide-out-widget-area.fullscreen').transition({ 11228 'opacity': 0 11229 }, 700, 'easeOutQuad', function () { 11230 $('#slide-out-widget-area.fullscreen').hide().css('opacity', '1'); 11231 }).removeClass('open'); 11232 $('#slide-out-widget-area.fullscreen .widget').transition({ 11233 'opacity': 0 11234 }, 700, 'easeOutQuad', function () { 11235 $(this).transition({ 11236 y: '110px' 11237 }, 0); 11238 });
11239 11240 setTimeout(function () { 11241 $('.off-canvas-menu-container .menu > li').transition({ 11242 y: '80px', 11243 'opacity': 0 11244 }, 0); 11245 $('#slide-out-widget-area .off-canvas-social-links li').transition({ 11246 'scale': 0 11247 }, 0); 11248 $('#slide-out-widget-area .off-canvas-social-links').removeClass('line-shown'); 11249 $('#slide-out-widget-area .bottom-text').transition({ 11250 'opacity': 0 11251 }, 0); 11252 11253 // Close submenu items 11254 $('#slide-out-widget-area .menuwrapper .menu').removeClass('subview'); 11255 $('#slide-out-widget-area .menuwrapper .menu li').removeClass('subview subviewopen'); 11256 $('#slide-out-widget-area.fullscreen .inner .menu-wrap').css('height', 'auto'); 11257 }, 800); 11258 11259 setTimeout(function () { 11260 if ($('.nectar-social.fixed').length == 0) { 11261 showToTop(); 11262 } 11263 $('.container-wrap').removeClass('no-shadow'); 11264 }, 500); 11265 11266 // Fade out overlay 11267 $offCanvasBG.stop(true).transition({ 11268 'opacity': 0 11269 }, 900, 'easeOutQuad', function () { 11270 11271 if ($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && $('.container-wrap').hasClass('no-scroll')) { 11272 $('#ajax-content-wrap').removeClass('at-content'); 11273 } 11274 if ($('.mobile #header-outer[data-permanent-transparent="false"]').length == 0) { 11275 $('#slide-out-widget-area.fullscreen .inner-wrap').css('padding-top', '0'); 11276 } 11277 11278 $('.slide-out-widget-area-toggle a').removeClass('animating'); 11279 11280 var $opacity = 0.4; 11281 11282 if ($offCanvasBG.hasClass('solid')) { 11283 $opacity = 1; 11284 } 11285 if ($offCanvasBG.hasClass('dark')) { 11286 $opacity = 0.93; 11287 } 11288 if ($offCanvasBG.hasClass('medium')) { 11289 $opacity = 0.6; 11290 } 11291 if ($offCanvasBG.hasClass('light')) { 11292 $opacity = 0.4; 11293 } 11294 $(this).css({ 11295 'height': '1px', 11296 'width': '1px', 11297 'opacity': $opacity 11298 }).transition({ 11299 y: '-100%' 11300 }, 0); 11301 }); 11302 11303 } 11304 11305 11306 /** 11307 * Off canvas menu: fullscreen alt open. 11308 * 11309 * @since 10.5 11310 */ 11311 function OCM_fullscreenAltOpen() { 11312 11313 var $ocm_fullscreen_class = ( $offCanvasEl.hasClass('fullscreen-alt') ) ? '.fullscreen-alt' : '.fullscreen-split'; 11314 11315 if ($('body.material').length > 0) { 11316 $('header#top .slide-out-widget-area-toggle a').addClass('menu-push-out'); 11317 } 11318 11319 $('header#top .slide-out-widget-area-toggle:not(.std-menu) .lines-button:not(.legacy-double)').addClass('close'); 11320 11321 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 11322 $('#slide-out-widget-area'+$ocm_fullscreen_class).show().addClass('open'); 11323 } else { 11324 $('#slide-out-widget-area'+$ocm_fullscreen_class).addClass('open').removeClass('hidden'); 11325 } 11326 11327 $offCanvasBG.addClass('open').removeClass('hidden'); 11328 11329 $('body > div[class*="body-border"]').css('z-index', '9995'); 11330 11331 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 11332 $('.off-canvas-menu-container .menu').transition({ 11333 y: '0px', 11334 'opacity': 1 11335 }, 0); 11336 } 11337 11338 if ($('.nectar-social.fixed').length == 0) { 11339 hideToTop(); 11340 } 11341 11342 if ($('#header-outer.transparent').length > 0) { 11343 11344 if ($bodyBorderTop.length > 0) { 11345 $('.admin-bar #slide-out-widget-area-bg'+$ocm_fullscreen_class).css({ 11346 'padding-top': ($bodyBorderTop.outerHeight(true) + 32) + 'px' 11347 }); 11348 $('body:not(.admin-bar) #slide-out-widget-area-bg'+$ocm_fullscreen_class).css({ 11349 'padding-top': ($bodyBorderTop.outerHeight(true)) + 'px' 11350 }); 11351 } 11352 } 11353 11354 // Set translateY to 0 in all cases 11355 $headerOuterEl.stop(true).css('transform', 'translateY(0)'); 11356 11357 if ($('#logo .starting-logo').length > 0 && 11358 $window.width() > 1000 && 11359 $('#header-outer[data-format="centered-menu-bottom-bar"].fixed-menu').length == 0 && 11360 $('body.material #header-outer[data-condense="true"]').length == 0 && 11361 $headerOuterEl.attr('data-transparent-header') == 'true' && 11362 !nectarDOMInfo.usingFrontEndEditor) { 11363 11364 $headerOuterEl.stop(true).css('transform', 'translateY(0)').addClass('transparent'); 11365 11366 } 11367 11368 $('.off-canvas-menu-container .clip-wrap').css('transition-duration', '0s'); 11369 11370 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 11371 11372 setTimeout(function () { 11373 11374 $('.off-canvas-menu-container .menu > li').each(function (i) { 11375 $(this).delay(i * 50).transition({ 11376 y: 0, 11377 'opacity': 1 11378 }, 750, 'easeOutCubic').addClass('no-pointer-events'); 11379 });
11380 11381 setTimeout(function () { 11382 $('.off-canvas-menu-container .menu > li').removeClass('no-pointer-events'); 11383 $('.off-canvas-menu-container .clip-wrap').css('transition-duration', '.45s'); 11384 }, 500); 11385 11386 $('#slide-out-widget-area.fullscreen-alt .widget').each(function (i) { 11387 $(this).delay(i * 100).transition({ 11388 y: 0, 11389 'opacity': 1 11390 }, 650, 'easeOutCubic'); 11391 }); 11392 11393 }, 200); 11394 11395 setTimeout(function () { 11396 $('#slide-out-widget-area .off-canvas-social-links').addClass('line-shown'); 11397 11398 $('#slide-out-widget-area .off-canvas-social-links li').css('opacity', '1').each(function (i) { 11399 $(this).delay(i * 50).transition({ 11400 'scale': 1 11401 }, 400, 'easeOutCubic'); 11402 }); 11403 $('#slide-out-widget-area .bottom-text').transition({ 11404 'opacity': 1 11405 }, 600, 'easeOutCubic'); 11406 }, 200); 11407 11408 } 11409 11410 // Fade In BG Overlay 11411 var $opacity = 0.4; 11412 11413 if ($offCanvasBG.hasClass('solid')) { 11414 $opacity = 1; 11415 } 11416 if ($offCanvasBG.hasClass('dark')) { 11417 $opacity = 0.97; 11418 } 11419 if ($offCanvasBG.hasClass('medium')) { 11420 $opacity = 0.6; 11421 } 11422 if ($offCanvasBG.hasClass('light')) { 11423 $opacity = 0.4; 11424 } 11425 $offCanvasBG.removeClass('no-transition'); 11426 11427 11428 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 11429 11430 $offCanvasBG.addClass('padding-removed').css({ 11431 'height': '100%', 11432 'width': '100%', 11433 'left': '0', 11434 'opacity': $opacity 11435 }); 11436 11437 // Overflow state 11438 OCM_overflowState(); 11439 11440 } 11441 11442 setTimeout(function () { 11443 $('.slide-out-widget-area-toggle > div > a').removeClass('animating'); 11444 }, 600); 11445 11446 11447 if ($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && 11448 $('.container-wrap').hasClass('no-scroll')) { 11449 $('#ajax-content-wrap').addClass('at-content'); 11450 } 11451 11452 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 11453 11454 var headerOffset = $headerOuterEl.offset().top - nectarDOMInfo.scrollTop + nectarDOMInfo.secondaryHeaderHeight; 11455 11456 $('#slide-out-widget-area'+$ocm_fullscreen_class+' .inner-wrap').css('padding-top', ($headerOuterEl.outerHeight() + headerOffset)); 11457 11458 } else { 11459 $('#slide-out-widget-area'+$ocm_fullscreen_class+' .inner-wrap').css('padding-top', $headerOuterEl.outerHeight()); 11460 } 11461 11462 } 11463 11464 11465 /** 11466 * Off canvas menu: fullscreen alt close. 11467 * 11468 * @since 10.5 11469 */ 11470 function OCM_fullscreenAltClose() { 11471 11472 var $ocm_fullscreen_class = ( $offCanvasEl.hasClass('fullscreen-alt') ) ? '.fullscreen-alt' : '.fullscreen-split'; 11473 11474 if ($('body.material').length > 0) { 11475 setTimeout(function () { 11476 $('header#top .slide-out-widget-area-toggle a').removeClass('menu-push-out'); 11477 }, 350); 11478 } 11479 11480 $('.slide-out-widget-area-toggle:not(.std-menu) .lines-button:not(.legacy-double)').removeClass('close'); 11481 11482 11483 $offCanvasBG.removeClass('open'); 11484 11485 if( $ocm_fullscreen_class === '.fullscreen-split' ) { 11486 setTimeout(function () { 11487 $offCanvasBG.addClass('hidden'); 11488 $('#slide-out-widget-area'+$ocm_fullscreen_class).addClass('hidden'); 11489 },600); 11490 } 11491 11492 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 11493 11494 $('.blurred-wrap').removeClass('blurred'); 11495 11496 $('#slide-out-widget-area.fullscreen-alt .widget').transition({ 11497 'opacity': 0 11498 }, 500, 'easeOutQuad', function () { 11499 $(this).transition({ 11500 y: '40px' 11501 }, 0); 11502 }); 11503 $('#slide-out-widget-area .bottom-text, #slide-out-widget-area .off-canvas-social-links li').transition({ 11504 'opacity': 0 11505 }, 250, 'easeOutQuad'); 11506 $('#slide-out-widget-area .off-canvas-social-links').removeClass('line-shown'); 11507 11508 $('.off-canvas-menu-container .menu').transition({ 11509 y: '-13px', 11510 'opacity': 0 11511 }, 400); 11512 11513 } 11514 11515 11516 setTimeout(function () { 11517 11518 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 11519 11520 $('.off-canvas-menu-container .menu > li').stop(true, true).transition({ 11521 y: '40px', 11522 'opacity': 0 11523 }, 0); 11524 $('#slide-out-widget-area .off-canvas-social-links li').transition({ 11525 'scale': 0 11526 }, 0); 11527 $('#slide-out-widget-area .off-canvas-social-links').removeClass('line-shown'); 11528 11529 // Close submenu items 11530 $('#slide-out-widget-area .menuwrapper .menu').removeClass('subview'); 11531 $('#slide-out-widget-area .menuwrapper .menu li').removeClass('subview subviewopen'); 11532 $('#slide-out-widget-area.fullscreen-alt .inner .menu-wrap').css('height', 'auto'); 11533 11534 $offCanvasBG.css({ 11535 'height': '1px', 11536 'width': '1px', 11537 'left': '-100%' 11538 });
11539 11540 } 11541 11542 if ($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && $('.container-wrap').hasClass('no-scroll')) { 11543 $('#ajax-content-wrap').removeClass('at-content'); 11544 } 11545 11546 if ($('.mobile #header-outer[data-permanent-transparent="false"]').length == 0) { 11547 $('#slide-out-widget-area'+$ocm_fullscreen_class+' .inner-wrap').css('padding-top', '0'); 11548 } 11549 11550 $('.slide-out-widget-area-toggle a').removeClass('animating'); 11551 11552 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 11553 $('#slide-out-widget-area'+$ocm_fullscreen_class).hide().removeClass('open'); 11554 } 11555 11556 }, 550); 11557 11558 if( $ocm_fullscreen_class === '.fullscreen-split' ) { 11559 $('#slide-out-widget-area'+$ocm_fullscreen_class).removeClass('open'); 11560 } 11561 11562 setTimeout(function () { 11563 if ($('.nectar-social.fixed').length == 0) { 11564 showToTop(); 11565 } 11566 }, 600); 11567 11568 // Fade out overlay 11569 setTimeout(function () { 11570 $offCanvasBG.removeClass('padding-removed'); 11571 }, 50); 11572 11573 11574 var borderDelay = ($bodyBorderHeaderColorMatch == true) ? 150 : 50; 11575 11576 setTimeout(function () { 11577 11578 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 11579 $offCanvasBG.stop(true).css({ 11580 'opacity': 0 11581 }); 11582 } 11583 if ($('#header-outer[data-transparent-header="true"]').length > 0) { 11584 $('body > div[class*="body-border"]').css('z-index', '10000'); 11585 } 11586 }, borderDelay); 11587 11588 setTimeout(function () { 11589 $('#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'); 11590 11591 if ($headerOuterEl.hasClass('pseudo-data-transparent')) { 11592 11593 $headerOuterEl.attr('data-transparent-header', 'false') 11594 .removeClass('pseudo-data-transparent') 11595 .removeClass('transparent'); 11596 } 11597 11598 }, 100); 11599 11600 } 11601 11602 11603 /** 11604 * Off canvas menu: simple dropdown open. 11605 * 11606 * @since 10.5 11607 */ 11608 function OCM_simpleDropdownOpen(classname) { 11609 11610 $('#mobile-menu').show(); 11611 11612 $('header#top').find('.'+classname+':not(.std-menu) .lines-button').addClass('close'); 11613 11614 if ($('body.material').length > 0) { 11615 $('header#top').find('.'+classname+' a').addClass('menu-push-out'); 11616 } 11617 11618 setTimeout(function () { 11619 $('header#top').find('.'+classname+' > div > a').removeClass('animating'); 11620 }, 100); 11621 11622 } 11623 11624 /** 11625 * Off canvas menu: simple dropdown close.
11626 * 11627 * @since 10.5 11628 */ 11629 function OCM_simpleDropdownClose(classname) { 11630 11631 $('#mobile-menu').hide(); 11632 11633 $('body').find('.'+classname+':not(.std-menu) .lines-button').removeClass('close'); 11634 11635 setTimeout(function () { 11636 if ($('body.material').length > 0) { 11637 $('header#top .'+classname+' a').removeClass('menu-push-out'); 11638 } 11639 $('body').find('.'+classname+' a').removeClass('animating'); 11640 }, 350); 11641 } 11642 11643 11644 /** 11645 * Off canvas menu: simple dropdown click events. 11646 * 11647 * @since 10.5 11648 */ 11649 function OCM_simpleStyleInit() { 11650 11651 if( $('#header-outer #mobile-menu').length == 0 ) { 11652 return; 11653 } 11654 11655 $('#header-outer #mobile-menu li.megamenu').removeClass('megamenu'); 11656 11657 // Add icons/markup. 11658 $('#header-outer #mobile-menu ul li a').each(function() { 11659 if( !$(this).hasClass('nectar-widget-link') && $(this).find('.nectar-ext-menu-item').length == 0 ) { 11660 $(this).wrapInner('<span></span>'); 11661 } 11662 }); 11663 11664 $('#header-outer #mobile-menu ul li').each(function(){ 11665 11666 if($(this).find('> ul').length > 0) { 11667 $(this).find('> a').append('<span class="sf-sub-indicator"><i class="fa fa-angle-down"></i></span>'); 11668 } 11669 11670 }); 11671 11672 // Click event. 11673 $('#header-outer #mobile-menu .sf-sub-indicator').on('click', function(){ 11674 11675 var $parentLI = $(this).parent().parent(); 11676 11677 $parentLI.toggleClass('current-open-item'); 11678 11679 // Open. 11680 if( $parentLI.hasClass('current-open-item') ) { 11681 $parentLI.find('> ul').show(); 11682 setTimeout(function(){ 11683 $parentLI.addClass('visible'); 11684 },30); 11685 } else { 11686 // Close. 11687 $parentLI.find('ul').hide(); 11688 // Ensure open children also close. 11689 $parentLI.find('li').removeClass('visible').removeClass('current-open-item'); 11690 $parentLI.removeClass('visible'); 11691 } 11692 11693 return false; 11694 11695 }); 11696 11697 // Resize event. 11698 $window.on('smartresize', function(){ 11699 11700 if( nectarDOMInfo.winW > 1000 && $('.slide-out-widget-area-toggle.mobile-icon a.open').length > 0 || 11701 nectarDOMInfo.winW > 1000 && $('.nectar-ocm-trigger-open.simple-mobile-menu a.open').length > 0) { 11702 11703 $('.slide-out-widget-area-toggle.mobile-icon a, .nectar-ocm-trigger-open.simple-mobile-menu a').addClass('non-human-allowed'); 11704 11705 11706 $('.slide-out-widget-area-toggle.mobile-icon a.open, .nectar-ocm-trigger-open.simple-mobile-menu a.open').trigger('click'); 11707 11708 setTimeout(function () { 11709 $('.slide-out-widget-area-toggle.mobile-icon a, .nectar-ocm-trigger-open.simple-mobile-menu a').removeClass('non-human-allowed'); 11710 }, 100); 11711 11712 } 11713 11714 }); 11715 11716 } 11717 11718 11719 /** 11720 * Off canvas menu click triggered styles initialization 11721 * 11722 * @since 10.5 11723 */ 11724 function OCM_clickTriggeredStylesInit() { 11725 11726 // Click triggered open bind. 11727 $body.on('click', '.slide-out-widget-area-toggle:not(.std-menu) a.closed:not(.animating), .nectar-ocm-trigger-open', function () { 11728 11729 if (nectarBoxRoll.animating == 'true' || $('.slide-out-from-right-hover').length > 0) { 11730 return false; 11731 } 11732 11733 $headerOuterEl.removeClass('no-transition'); 11734 11735 // Classic Mobile Direct Custom Link. 11736 if( $(this).hasClass('simple-mobile-menu')) { 11737 OCM_simpleDropdownOpen('simple-mobile-menu'); 11738 $(this).find('a').addClass('open'); 11739 return false; 11740 } 11741 11742 // Slide out from right. 11743 if ($offCanvasEl.hasClass('slide-out-from-right')) { 11744 OCM_slideOutRightOpen(); 11745 } 11746 // Fullscreen. 11747 else if ($offCanvasEl.hasClass('fullscreen')) { 11748 OCM_fullscreenOpen(); 11749 } 11750 // Fullscreen Alt. 11751 else if ($offCanvasEl.hasClass('fullscreen-alt') || $offCanvasEl.hasClass('fullscreen-split')) { 11752 OCM_fullscreenAltOpen(); 11753 } 11754 // Simple dropdown. 11755 else if( $('#header-outer #mobile-menu').length > 0 ) { 11756 OCM_simpleDropdownOpen('slide-out-widget-area-toggle'); 11757 } 11758 11759 11760 // Add open class 11761 if( $('#header-outer #mobile-menu').length == 0 ) { 11762 11763 $headerOuterEl 11764 .removeClass('side-widget-closed') 11765 .addClass('side-widget-open'); 11766 11767 11768 // Give header transparent state 11769 if ($('#header-outer[data-transparency-option="1"]').length > 0 && 11770 $('#boxed').length == 0 && 11771 $('#header-outer[data-full-width="true"]').length > 0 && 11772 !nectarDOMInfo.usingFrontEndEditor) { 11773
11774 if ($('body.material[data-slide-out-widget-area-style="slide-out-from-right"]').length == 0 && 11775 $('body.material #header-outer[data-condense="true"]').length == 0) { 11776 11777 $headerOuterEl.addClass('transparent'); 11778 11779 } 11780 11781 } 11782 11783 // Dark slide transparent nav 11784 if ($('#header-outer.dark-slide.transparent').length > 0 && 11785 $('#boxed').length == 0 && 11786 $('body.material-ocm-open').length == 0) { 11787 $headerOuterEl 11788 .removeClass('dark-slide') 11789 .addClass('temp-removed-dark-slide'); 11790 } 11791 11792 } // Not using simple OCM. 11793 11794 11795 $('.slide-out-widget-area-toggle:not(.simple-mobile-menu) > div > a') 11796 .removeClass('closed') 11797 .addClass('open') 11798 .attr('aria-expanded','true'); 11799 11800 $('.slide-out-widget-area-toggle:not(.simple-mobile-menu) > div > a').addClass('animating'); 11801 11802 return false; 11803 11804 }); 11805 11806 11807 11808 // Close event bind. 11809 $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) { 11810 11811 if (e.originalEvent == undefined && 11812 $('.slide_out_area_close.non-human-allowed').length == 0 && 11813 $('.slide-out-widget-area-toggle.mobile-icon a.non-human-allowed').length == 0) { 11814 return; 11815 } 11816 11817 if ($('.slide-out-widget-area-toggle:not(.std-menu) a.animating').length > 0) { 11818 return; 11819 } 11820 11821 $headerOuterEl.removeClass('no-transition'); 11822 11823 // Classic Mobile Direct Custom Link. 11824 if( $(this).parents('.simple-mobile-menu').length > 0 ) { 11825 OCM_simpleDropdownClose('simple-mobile-menu'); 11826 $(this).removeClass('open'); 11827 return false; 11828 } 11829 11830 $('.slide-out-widget-area-toggle:not(.std-menu):not(.simple-mobile-menu) a') 11831 .removeClass('open') 11832 .addClass('closed') 11833 .attr('aria-expanded','false'); 11834 11835 $('.slide-out-widget-area-toggle:not(.simple-mobile-menu):not(.std-menu) a') 11836 .addClass('animating'); 11837 11838 // Slide out from right. 11839 if ($offCanvasEl.hasClass('slide-out-from-right')) { 11840 OCM_slideOutRightClose(); 11841 } 11842 11843 // Fullscreen. 11844 else if ($offCanvasEl.hasClass('fullscreen')) { 11845 OCM_fullscreenClose(); 11846 } 11847 // Fullscreen alt. 11848 else if ($offCanvasEl.hasClass('fullscreen-alt') || $offCanvasEl.hasClass('fullscreen-split')) { 11849 OCM_fullscreenAltClose(); 11850 } 11851 // Simple dropdown. 11852 else if( $('#header-outer #mobile-menu').length > 0 ) { 11853 OCM_simpleDropdownClose('slide-out-widget-area-toggle'); 11854 } 11855 11856 if( $('#header-outer #mobile-menu').length == 0 ) { 11857 11858 // Dark slide transparent nav 11859 if ($('#header-outer.temp-removed-dark-slide.transparent').length > 0 && $('#boxed').length == 0) { 11860 $headerOuterEl 11861 .removeClass('temp-removed-dark-slide') 11862 .addClass('dark-slide'); 11863 } 11864 11865 // Remove header transparent state 11866 if ($('#header-outer[data-permanent-transparent="1"]').length == 0 && $('#slide-out-widget-area.fullscreen-alt').length == 0) { 11867 11868 if ($('.nectar-box-roll').length == 0) { 11869 if ($('#header-outer.small-nav').length > 0 || 11870 $('#header-outer.scrolled-down').length > 0) { 11871 $headerOuterEl.removeClass('transparent'); 11872 } 11873 } 11874 else { 11875 if ($('#header-outer.small-nav').length > 0 || 11876 $('#header-outer.scrolled-down').length > 0 || 11877 $('.container-wrap.auto-height').length > 0) { 11878 $headerOuterEl.removeClass('transparent'); 11879 } 11880 } 11881 11882 } 11883 11884 // Remove hidden menu 11885 $headerOuterEl.removeClass('hidden-menu'); 11886 11887 $headerOuterEl 11888 .removeClass('side-widget-open') 11889 .addClass('side-widget-closed'); 11890 11891 } // Not using simple OCM. 11892 11893 return false; 11894 11895 }); 11896 11897 } 11898 11899 11900 /** 11901 * Off canvas menu main initialization. 11902 * 11903 * @since 10.5 11904 */ 11905 function OCM_init() { 11906 11907 if ($('#slide-out-widget-area.slide-out-from-right-hover').length > 0) { 11908 OCM_slideOutRightHoverInit(); 11909 } else { 11910 OCM_clickTriggeredStylesInit(); 11911 OCM_simpleStyleInit(); 11912 } 11913 11914 11915 if ($('#slide-out-widget-area.fullscreen-split').length == 0 &&
11916 $('body.material[data-slide-out-widget-area-style*="slide-out-from-right"]').length == 0 && 11917 $('#slide-out-widget-area[data-dropdown-func="separate-dropdown-parent-link"]').length == 0) { 11918 11919 fullscreenMenuInit(); 11920 11921 } else if ($('body.using-mobile-browser[data-slide-out-widget-area-style="slide-out-from-right-hover"]').length > 0) { 11922 11923 // Close OCM on mobile when clicking anchor on same page 11924 $('body #slide-out-widget-area .inner .off-canvas-menu-container li a[href*="#"]').on('click', function () { 11925 if ($(this).attr('href') != '#') { 11926 OCM_close($(this).parent()); 11927 } 11928 11929 }); 11930 11931 } 11932 11933 // Page fullscreen row close OCM fullscreen/classic slide out from right 11934 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) ) { 11935 11936 $('body #slide-out-widget-area .inner .off-canvas-menu-container li a[href]').on('click', function () { 11937 11938 var $link_href = ($(this).is('[href*="#"]')) ? $(this).attr('href') : ''; 11939 if ($link_href != '#' && $('div[data-fullscreen-anchor-id="' + $link_href.substr($link_href.indexOf("#") + 1) + '"]').length > 0) { 11940 11941 setTimeout(function () { 11942 11943 $('#slide-out-widget-area .slide_out_area_close') 11944 .addClass('non-human-allowed') 11945 .trigger('click'); 11946 11947 }, 100); 11948 11949 setTimeout(function () { 11950 $('#slide-out-widget-area .slide_out_area_close').removeClass('non-human-allowed'); 11951 }, 150); 11952 11953 } 11954 11955 }); 11956 } 11957 11958 11959 // Submenu link hover fix 11960 $body.on('mouseover', '#slide-out-widget-area .off-canvas-menu-container .menuwrapper > .sub-menu li > a', function () { 11961 var $currentTxt = $(this).text(); 11962 $('.off-canvas-menu-container .menuwrapper .menu li > a').removeClass('hovered'); 11963 $('.off-canvas-menu-container .menuwrapper .menu li > a:contains(' + $currentTxt + ')').addClass('hovered'); 11964 }); 11965 11966 $body.on('mouseover', '.off-canvas-menu-container .menuwrapper .menu li > a', function () { 11967 $('.off-canvas-menu-container .menuwrapper .menu li > a').removeClass('hovered'); 11968 }); 11969 11970 11971 // Bind mousewheel. 11972 setTimeout(OCM_scrolling, 500); 11973 11974 // Handle mobile scrolling. 11975 if (nectarDOMInfo.usingMobileBrowser) { 11976 $offCanvasEl.addClass('mobile'); 11977 } 11978 11979 11980 } 11981 11982 11983 11984 11985 /** 11986 * Off canvas menu scrolling. 11987 * 11988 * @since 10.5 11989 */ 11990 function OCM_scrolling() { 11991 11992 $offCanvasEl.mousewheel(function (event, delta) { 11993 11994 this.scrollTop -= (event.deltaY * event.deltaFactor)/1.5; 11995 11996 event.preventDefault(); 11997 }); 11998 11999 } 12000 12001 12002 12003 /** 12004 * Off canvas menu close. 12005 * 12006 * @since 10.5 12007 */ 12008 function OCM_close(item) { 12009 12010 if ($('#slide-out-widget-area.open').length > 0) { 12011 12012 var $windowCurrentLocation = window.location.href.split("#")[0]; 12013 var $windowClickedLocation = item.find('> a').attr('href').split("#")[0]; 12014 12015 if ($windowCurrentLocation == $windowClickedLocation || item.find('a[href^="#"]').length > 0) { 12016 if (item.parents('.slide-out-from-right-hover').length > 0) { 12017 $('.slide-out-widget-area-toggle.slide-out-hover-icon-effect a').trigger('click'); 12018 } else { 12019 $('.slide-out-widget-area-toggle a').trigger('click'); 12020 } 12021 12022 } 12023 } 12024 12025 } 12026 12027 12028 12029 12030 /** 12031 * Click based submenus. 12032 * 12033 * Used by left header layout and off canvas menu. 12034 * 12035 * @since 10.5 12036 */ 12037 function clickToggleSubmenus() { 12038 12039 if (!$('#header-outer[data-format="left-header"]').length > 0 && 12040 !$('body.material[data-slide-out-widget-area-style*="slide-out-from-right"]').length > 0 && 12041 !$('#slide-out-widget-area.fullscreen-split').length > 0 && 12042 !$('#slide-out-widget-area[data-dropdown-func="separate-dropdown-parent-link"]').length > 0) { 12043 return; 12044 } 12045 12046 // Remove megamenu class. 12047 $('#header-outer[data-format="left-header"] nav li.megamenu').removeClass('nectar-megamenu-menu-item').removeClass('megamenu'); 12048 12049 var $ocm_link_selector; 12050 12051 if ($('#slide-out-widget-area[data-dropdown-func="separate-dropdown-parent-link"]').length > 0) { 12052 $ocm_link_selector = '#slide-out-widget-area .off-canvas-menu-container li.menu-item-has-children > .ocm-dropdown-arrow'; 12053 } else { 12054 $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'; 12055 } 12056 12057 var left_header_selector = '#header-outer[data-format="left-header"] nav li.menu-item-has-children > a'; 12058 var lh_dropdown_func = ( window.nectarOptions && window.nectarOptions.left_header_dropdown_func ) ? window.nectarOptions.left_header_dropdown_func : 'default'; 12059 if( lh_dropdown_func === 'separate-dropdown-parent-link' ) { 12060 left_header_selector = '#header-outer[data-format="left-header"] nav li.menu-item-has-children > a .sf-sub-indicator'; 12061 } 12062 12063 // Click event. 12064 $(left_header_selector + ', ' + $ocm_link_selector).on('click', function () { 12065 12066 var $parentSelector = $(this).parent(); 12067 if( lh_dropdown_func === 'separate-dropdown-parent-link' ) { 12068 $parentSelector = $(this).closest('.menu-item'); 12069 } 12070 12071 if ($parentSelector.hasClass('open-submenu')) { 12072 $parentSelector.find('.sub-menu').css({ 12073 'max-height': '0' 12074 });
12075 $parentSelector.removeClass('open-submenu'); 12076 } else { 12077 12078 // Get max height. 12079 var $that = $(this); 12080 var $maxSubMenuHeight; 12081 12082 $parentSelector 12083 .find('> .sub-menu') 12084 .addClass('no-trans'); 12085 12086 setTimeout(function () { 12087 12088 $parentSelector.find('> .sub-menu').css({ 12089 'max-height': 'none', 12090 'position': 'absolute', 12091 'visibility': 'hidden' 12092 }); 12093 12094 $maxSubMenuHeight = $parentSelector.find('> .sub-menu').height(); 12095 12096 $parentSelector 12097 .find('> .sub-menu') 12098 .removeClass('no-trans'); 12099 12100 $parentSelector.find('> .sub-menu').css({ 12101 'max-height': '0', 12102 'position': 'relative', 12103 'visibility': 'visible' 12104 }); 12105 12106 }, 25); 12107 12108 setTimeout(function () { 12109 12110 // Reset Max Height. 12111 $that.closest('ul') 12112 .find('li.menu-item-has-children') 12113 .removeClass('open-submenu'); 12114 12115 $that.closest('ul').find('li.menu-item-has-children > .sub-menu').css({ 12116 'max-height': '0' 12117 });
12118 12119 $parentSelector.addClass('open-submenu'); 12120 12121 $parentSelector 12122 .find('> .sub-menu') 12123 .css('max-height', $maxSubMenuHeight); 12124 12125 // Add height to open parents. 12126 if ($that.parents('ul').length > 0) { 12127 12128 $that.parents('ul:not(.sf-menu)').each(function () { 12129 $(this).css('max-height'); 12130 $(this).css('max-height', parseInt($(this).height() + parseInt($(this).css('padding-top')) * 2 + $maxSubMenuHeight) + 'px'); 12131 }); 12132 } 12133 12134 12135 }, 50); 12136 } 12137 12138 return false; 12139 12140 }); 12141 12142 // Start open for current page items. 12143 if($('#header-outer[data-format="left-header"] nav .sf-menu > .current-menu-ancestor.menu-item-has-children > ul > li.current-menu-item').length > 0) { 12144 12145 if( lh_dropdown_func === 'separate-dropdown-parent-link' ) { 12146 $('#header-outer[data-format="left-header"] nav .sf-menu > .current-menu-ancestor.menu-item-has-children > a .sf-sub-indicator').trigger('click'); 12147 } else { 12148 $('#header-outer[data-format="left-header"] nav .sf-menu > .current-menu-ancestor.menu-item-has-children > a').trigger('click'); 12149 } 12150 12151 } 12152 12153 12154 } 12155 12156 12157 12158 12159 12160 12161 12162 12163 /** 12164 * DLMenu - plugin used for submenus in off canvas menu. 12165 * 12166 * @since 6.0 12167 */ 12168 $.DLMenu = function (options, element) { 12169 this.$el = $(element); 12170 this._init(options); 12171 }; 12172 12173 // the options 12174 $.DLMenu.defaults = { 12175 // classes for the animation effects 12176 animationClasses: { 12177 classin: 'dl-animate-in-1', 12178 classout: 'dl-animate-out-1' 12179 }, 12180 onLevelClick: function () { 12181 return false; 12182 }, 12183 onLinkClick: function () { 12184 return false; 12185 } 12186 }; 12187 12188 $.DLMenu.prototype = { 12189 _init: function (options) { 12190 12191 // options 12192 this.options = $.extend(true, {}, $.DLMenu.defaults, options); 12193 this._config(); 12194 12195 var animEndEventNames = { 12196 'WebkitAnimation': 'webkitAnimationEnd', 12197 'OAnimation': 'oAnimationEnd', 12198 'msAnimation': 'MSAnimationEnd', 12199 'animation': 'animationend' 12200 }, 12201 transEndEventNames = { 12202 'WebkitTransition': 'webkitTransitionEnd', 12203 'MozTransition': 'transitionend', 12204 'OTransition': 'oTransitionEnd', 12205 'msTransition': 'MSTransitionEnd', 12206 'transition': 'transitionend' 12207 }; 12208 // animation end event name 12209 this.animEndEventName = animEndEventNames['animation'] + '.menu'; 12210 // transition end event name 12211 this.transEndEventName = transEndEventNames['transition'] + '.menu', 12212 // support for css animations and css transitions 12213 this.supportAnimations = true, 12214 this.supportTransitions = true; 12215 this._initEvents(); 12216 12217 }, 12218 _config: function () { 12219 this.open = false; 12220 this.$trigger = this.$el.children('.trigger'); 12221 this.$menu = this.$el.children('ul.menu'); 12222 this.$menuitems = this.$menu.find('li:not(.back) > a'); 12223 12224 this.$el.find('ul.sub-menu') 12225 .prepend('<li class="back"><a href="#"> ' + $offCanvasEl.attr('data-back-txt') + ' </a></li>'); 12226 12227 this.$back = this.$menu.find('li.back'); 12228 }, 12229 _initEvents: function () { 12230 12231 var self = this; 12232 12233 this.$trigger.on('click.menu', function () { 12234 12235 if (self.open) { 12236 self._closeMenu(); 12237 } else { 12238 self._openMenu(); 12239 } 12240 return false; 12241 12242 }); 12243 12244 this.$menuitems.on('click.menu', function (event) { 12245 12246 12247 var $item = $(this).parent('li'), 12248 $submenu = $item.children('ul.sub-menu'); 12249 12250 $('.fullscreen-alt .off-canvas-menu-container .clip-wrap, .fullscreen-alt .off-canvas-menu-container .clip-wrap span').css('transition-duration', '0s'); 12251 12252 if ($submenu.length > 0) { 12253 12254 var $flyin = $submenu.clone().css('opacity', 0).insertAfter(self.$menu), 12255 onAnimationEndFn = function () { 12256 self.$menu.off(self.animEndEventName).removeClass(self.options.animationClasses.classout).addClass('subview'); 12257 $item.addClass('subviewopen').parents('.subviewopen:first').removeClass('subviewopen').addClass('subview'); 12258 $flyin.remove(); 12259 setTimeout(function () { 12260 $('.off-canvas-menu-container .menu > li').removeClass('no-pointer-events'); 12261 $('.off-canvas-menu-container .clip-wrap, .off-canvas-menu-container .clip-wrap span').css('transition-duration', '.45s'); 12262 }, 300); 12263 12264 }; 12265 12266 setTimeout(function () { 12267 $flyin.addClass(self.options.animationClasses.classin); 12268 self.$menu.addClass(self.options.animationClasses.classout); 12269 if (self.supportAnimations) { 12270 self.$menu.on(self.animEndEventName, onAnimationEndFn); 12271 } else { 12272 onAnimationEndFn.call(); 12273 } 12274 12275 self.options.onLevelClick($item, $item.children('a:first').text()); 12276 });
12277 12278 12279 $item.parents('.menu-wrap').css('height', $item.parents('.off-canvas-menu-container').find('.menuwrapper .menu').height()).transition({ 12280 'height': $flyin.height() 12281 }, 500, 'easeInOutQuad'); 12282 12283 setTimeout(OCM_overflowState,600); 12284 12285 return false; 12286 12287 } else { 12288 12289 self.options.onLinkClick($item.find('> a'), event); 12290 } 12291 12292 OCM_close($item); 12293 12294 }); 12295 12296 12297 12298 this.$back.on('click.menu', function () { 12299 12300 var $this = $(this), 12301 $submenu = $this.parents('ul.sub-menu:first'), 12302 $item = $submenu.parent(), 12303 $flyin = $submenu.clone().insertAfter(self.$menu); 12304 12305 var onAnimationEndFn = function () { 12306 self.$menu.off(self.animEndEventName).removeClass(self.options.animationClasses.classin); 12307 $flyin.remove(); 12308 }; 12309 12310 setTimeout(function () { 12311 $flyin.addClass(self.options.animationClasses.classout); 12312 self.$menu.addClass(self.options.animationClasses.classin); 12313 if (self.supportAnimations) { 12314 self.$menu.on(self.animEndEventName, onAnimationEndFn); 12315 } else { 12316 onAnimationEndFn.call(); 12317 } 12318 12319 $item.removeClass('subviewopen'); 12320 12321 var $subview = $this.parents('.subview:first'); 12322 if ($subview.is('li')) { 12323 $subview.addClass('subviewopen'); 12324 } 12325 $subview.removeClass('subview'); 12326 }); 12327 12328 12329 12330 setTimeout(function () { 12331 $item.parents('.menu-wrap').transition({ 12332 'height': $item.parent().height() 12333 }, 500, 'easeInOutQuad'); 12334 setTimeout(OCM_overflowState,600); 12335 }, 50); 12336 12337 12338 return false; 12339 12340 }); 12341 12342 }, 12343 closeMenu: function () { 12344 if (this.open) { 12345 this._closeMenu(); 12346 } 12347 }, 12348 _closeMenu: function () { 12349 var self = this, 12350 onTransitionEndFn = function () { 12351 self.$menu.off(self.transEndEventName); 12352 self._resetMenu(); 12353 }; 12354 12355 this.$menu.removeClass('menuopen'); 12356 this.$menu.addClass('menu-toggle'); 12357 this.$trigger.removeClass('active'); 12358 12359 if (this.supportTransitions) { 12360 this.$menu.on(this.transEndEventName, onTransitionEndFn); 12361 } else { 12362 onTransitionEndFn.call(); 12363 } 12364 12365 this.open = false; 12366 }, 12367 openMenu: function () { 12368 if (!this.open) { 12369 this._openMenu(); 12370 } 12371 }, 12372 _openMenu: function () { 12373 var self = this; 12374 $body.off('click').on('click.menu', function () { 12375 self._closeMenu(); 12376 }); 12377 this.$menu.addClass('menuopen menu-toggle').on(this.transEndEventName, function () { 12378 $(this).removeClass('menu-toggle'); 12379 }); 12380 this.$trigger.addClass('active'); 12381 this.open = true; 12382 }, 12383 _resetMenu: function () { 12384 this.$menu.removeClass('subview'); 12385 this.$menuitems.removeClass('subview subviewopen'); 12386 } 12387 }; 12388 12389 var logError = function (message) { 12390 if (window.console) { 12391 window.console.error(message); 12392 } 12393 }; 12394 12395 $.fn.dlmenu = function (options) { 12396 if (typeof options === 'string') { 12397 var args = Array.prototype.slice.call(arguments, 1); 12398 this.each(function () { 12399 var instance = $.data(this, 'menu'); 12400 if (!instance) { 12401 logError("cannot call methods on menu prior to initialization; " + 12402 "attempted to call method '" + options + "'"); 12403 return; 12404 } 12405 if (!$.isFunction(instance[options]) || options.charAt(0) === "_") { 12406 logError("no such method '" + options + "' for menu instance"); 12407 return; 12408 } 12409 instance[options].apply(instance, args); 12410 }); 12411 } else { 12412 this.each(function () { 12413 var instance = $.data(this, 'menu'); 12414 if (instance) { 12415 instance._init(); 12416 } else { 12417 instance = $.data(this, 'menu', new $.DLMenu(options, this)); 12418 } 12419 }); 12420 } 12421 return this; 12422 }; 12423 12424 12425 /** 12426 * Initialize DL menu. 12427 * 12428 * @since 6.0 12429 */ 12430 function fullscreenMenuInit() { 12431 12432 $('#slide-out-widget-area .off-canvas-menu-container .menu').wrap('<div class="menu-wrap menuwrapper" />'); 12433 $('#slide-out-widget-area .off-canvas-menu-container .menu').addClass('menuopen'); 12434 12435 var $ocmAnimationClassNum = ($('#slide-out-widget-area.fullscreen-alt').length > 0) ? '4' : '5'; 12436 $('#slide-out-widget-area .off-canvas-menu-container .menu-wrap').dlmenu({ 12437 animationClasses: { 12438 classin: 'dl-animate-in-' + $ocmAnimationClassNum, 12439 classout: 'dl-animate-out-' + $ocmAnimationClassNum 12440 } 12441 });
12442 12443 } 12444 12445 12446 12447 12448 12449 12450 12451 12452 12453 /** 12454 * Set the page header height when using "slide down" theme option effect. 12455 * 12456 * @since 2.0 12457 */ 12458 function pageHeaderSlideInHeight() { 12459 12460 var pageHeaderHeight = parseInt($pageHeaderBG.height()); 12461 $('body[data-aie="slide-down"] #page-header-wrap:not(.fullscreen-header):not([data-responsive="true"])').css('height', pageHeaderHeight + 'px'); 12462 12463 } 12464 12465 12466 /** 12467 * Fired after page header image has loaded. 12468 * 12469 * @since 2.0 12470 */ 12471 function pageHeaderAfterLoad() { 12472 12473 //fade in header 12474 if ($('#ajax-content-wrap').length == 0 || !$body.hasClass('ajax-loaded')) { 12475 $('#page-header-bg[data-parallax="1"]').animate({ 12476 'opacity': 1 12477 }, 350, 'easeInCubic'); 12478 } else if ($('#ajax-content-wrap').length == 1) { 12479 $('#page-header-bg[data-parallax="1"]').css({ 12480 'opacity': 1 12481 }); 12482 } 12483 12484 $('#page-header-bg[data-parallax="1"] .nectar-particles').append('<div class="fade-out" />'); 12485 12486 } 12487 12488 12489 12490 /** 12491 * Page header unload event. 12492 * 12493 * @since 2.0 12494 */ 12495 function pageHeaderUnload() { 12496 12497 if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1 || navigator.userAgent.match(/(iPod|iPhone|iPad)/)) { 12498 window.onunload = function () { 12499 12500 pageHeaderInit(); 12501 12502 $('#page-header-bg[data-parallax="1"] .span_6').css({ 12503 'opacity': 1 12504 }); 12505 12506 }; 12507 } 12508 12509 } 12510 12511 12512 /** 12513 * Page header initialization. 12514 * 12515 * @since 2.0 12516 */ 12517 function pageHeaderInit() { 12518 12519 var pageHeaderState = { 12520 inView: true 12521 } 12522 12523 var $pageHeaderInnerEl = $('#page-header-bg .span_6 .inner-wrap'); 12524 var $pageHeaderCanvasEl = $('#page-header-bg #canvas'); 12525 12526 if ($('#page-header-bg[data-parallax="1"]').length > 0) { 12527 12528 // Fade in 12529 var img = new Image(), 12530 pageHeaderHeight = parseInt($pageHeaderBG.height()), 12531 headerSpaceHeight = $('#header-space').height(), 12532 globalTopSectionHeight = ($('.nectar-global-section.after-nav').length > 0) ? $('.nectar-global-section.after-nav').height() : 0, 12533 $initialImgCheck = extractUrl($('#page-header-bg[data-parallax="1"]').css('background-image')); 12534 12535 if ($initialImgCheck && $initialImgCheck.indexOf('.') !== -1) { 12536 img.onload = function () { 12537 pageHeaderAfterLoad(); 12538 }; 12539 12540 img.src = extractUrl($('#page-header-bg[data-parallax="1"]').css('background-image')); 12541 12542 } else { 12543 pageHeaderAfterLoad(); 12544 } 12545 12546 12547 if ($('body[data-hhun="1"]').length > 0 && !$('#header-outer[data-remove-fixed="1"]').length > 0) { 12548 $headerOuterEl.addClass('parallax-contained'); 12549 } 12550 12551 // Calculate on scroll. 12552 if( nectarDOMInfo.winW > 1000 ) { 12553 parallaxPageHeaderCalc(); 12554 } 12555 window.addEventListener('scroll', function () { 12556 if( nectarDOMInfo.winW > 1000 ) { 12557 window.requestAnimationFrame(parallaxPageHeaderCalc); 12558 } 12559 }, false); 12560 12561 } 12562 12563 var $pt_timeout = ($('body[data-ajax-transitions="true"]').length > 0 && $('#page-header-bg[data-animate-in-effect="slide-down"]').length > 0) ? 350 : 0; 12564 12565 if ($pageHeaderBG.length > 0) { 12566 12567 // Slide in height effect. 12568 setTimeout(function () { 12569 pageHeaderSlideInHeight(); 12570 }, $pt_timeout); 12571 12572 $('#page-header-bg[data-animate-in-effect="fade-in"]').addClass('loaded'); 12573 12574 // Using bg classname. 12575 var $initialImgCheckAscend = extractUrl($pageHeaderBG.css('background-image')); 12576 if ($initialImgCheckAscend && $initialImgCheckAscend.indexOf('.') !== -1) { 12577 $pageHeaderBG.addClass('has-bg'); 12578 } 12579 12580 // Resize slide in height. 12581 $window.on('smartresize',pageHeaderSlideInHeight); 12582 12583 } 12584 12585 12586 function parallaxPageHeaderCalc() { 12587 12588 var $multiplier = 0.15; 12589 12590 if (nectarDOMInfo.winW >= 1000 && 12591 navigator.userAgent.match(/iPad/i) == null && 12592 nectarState.materialOffCanvasOpen != true ) { 12593 12594 // Calc parallax. 12595 if (pageHeaderState.inView == true) { 12596 12597 $pageHeaderInnerEl.css({ 12598 'transform': 'translateY(' + nectarDOMInfo.scrollTop * $multiplier + 'px)', 12599 'opacity': 1 - (nectarDOMInfo.scrollTop / ((globalTopSectionHeight + pageHeaderHeight)*.7)) 12600 });
12601 12602 if( $pageHeaderCanvasEl ) { 12603 $pageHeaderCanvasEl.css({ 12604 'transform': 'translateY(' + nectarDOMInfo.scrollTop * $multiplier*2 + 'px)' 12605 }); 12606 } 12607 12608 } 12609 12610 // Hide elements to allow other parallax sections to work in webkit browsers. 12611 if ((nectarDOMInfo.scrollTop / (pageHeaderHeight + headerSpaceHeight + nectarDOMInfo.adminBarHeight)) > 1) { 12612 pageHeaderState.inView = false; 12613 $('.nectar-particles, #page-header-bg .fade-out').css('visibility', 'hidden').addClass('out-of-sight'); 12614 $('#page-header-bg').addClass('out-of-sight'); 12615 } 12616 else { 12617 pageHeaderState.inView = true; 12618 $('#page-header-bg, .nectar-particles, #page-header-bg .fade-out').css('visibility', 'visible').removeClass('out-of-sight'); 12619 } 12620 12621 } 12622 12623 } 12624 12625 if ($pageHeaderBG.length > 0) { 12626 12627 // Bind unload event 12628 pageHeaderUnload(); 12629 12630 // Initialize text effects. 12631 if( $('.nectar-box-roll').length == 0 ) { 12632 pageHeaderTextEffectInit(); 12633 } 12634 12635 } 12636 12637 } 12638 12639 12640 12641 12642 12643 12644 12645 /** 12646 * Page header text effect markup creation. 12647 * 12648 * @since 6.0 12649 */ 12650 function pageHeaderTextEffectMarkup() { 12651 12652 $pageHeaderBG.each(function () { 12653 12654 if ($(this).attr('data-text-effect') == 'rotate_in') { 12655 12656 var $topHeading = 'none'; 12657 12658 if ($(this).find('.span_6 h1').length > 0) { 12659 $topHeading = 'h1'; 12660 } 12661 12662 if ($topHeading != 'none') { 12663 12664 var $selector = ($(this).find('.nectar-particles').length > 0) ? '.inner-wrap.shape-1' : '.span_6'; 12665 12666 $(this).find($selector).find($topHeading).addClass('top-heading').contents().filter(function () { 12667 return this.nodeType === 3 && typeof this.data != 'undefined' && this.data.replace(/\s+/, ""); 12668 }).wrap('<span class="wraped"></span>'); 12669 12670 $(this).find($selector).find('.wraped').each(function () { 12671 12672 var textNode = $(this), 12673 text = textNode.text().split(' '), 12674 replace = ''; 12675 12676 $.each(text, function (index, value) { 12677 if (value.replace(/\s+/, "")) { 12678 replace += '<span class="wraped"><span>' + value + '</span></span> '; 12679 } 12680 }); 12681 12682 textNode.replaceWith($(replace)); 12683 12684 });
12685 12686 } 12687 12688 } 12689 12690 }); 12691 12692 } 12693 12694 12695 /** 12696 * Page header text effect animation. 12697 * 12698 * @since 6.0 12699 */ 12700 function pageHeaderTextEffect() { 12701 12702 if ($('#page-header-bg .nectar-particles').length == 0 && $('#page-header-bg[data-text-effect="none"]').length == 0 || 12703 $('.nectar-box-roll').length > 0 && $('#page-header-bg .nectar-particles').length == 0) { 12704 12705 var $selector = ($('.nectar-box-roll').length == 0) ? '#page-header-bg .span_6' : '.nectar-box-roll .overlaid-content .span_6'; 12706 12707 $($selector).find('.wraped').each(function (i) { 12708 $(this).find('span').delay(i * 370).transition({ 12709 rotateX: '0', 12710 'opacity': 1, 12711 y: 0 12712 }, 400, 'easeOutQuad'); 12713 }); 12714 12715 setTimeout(function () { 12716 12717 $($selector).find('.inner-wrap > *:not(.top-heading)').each(function (i) { 12718 $(this).delay(i * 370).transition({ 12719 rotateX: '0', 12720 'opacity': 1, 12721 y: 0 12722 }, 650, 'easeOutQuad'); 12723 }); 12724 12725 $('.scroll-down-wrap, .scroll-down-wrap .section-down-arrow').removeClass('hidden'); 12726 12727 }, $($selector).find('.wraped').length * 370); 12728 } 12729 12730 } 12731 12732 12733 /** 12734 * Page header text effect initialization. 12735 * 12736 * @since 6.0 12737 */ 12738 function pageHeaderTextEffectInit() { 12739 12740 pageHeaderTextEffectMarkup(); 12741 12742 var $effectTimeout = ($loadingScreenEl.length > 0) ? 800 : 0; 12743 12744 if ($('#page-header-bg .nectar-video-wrap video').length == 0) { 12745 setTimeout(pageHeaderTextEffect, $effectTimeout); 12746 } 12747 12748 } 12749 12750 12751 12752 12753 12754 12755 12756 /** 12757 * Permanent transparent header effect. 12758 * 12759 * @since 6.0 12760 */ 12761 function midnightInit() { 12762 12763 if ($('#header-outer[data-permanent-transparent="1"]').length > 0 && 12764 $('body[data-bg-header="true"]').length > 0) { 12765 12766 12767 // Pages that set no midnight coloring. 12768 if ($('.container-wrap div[data-midnight]').length == 0) { 12769 $('.container-wrap').attr('data-midnight', 'dark'); 12770 } 12771 12772 //// Cache midnight compat divs. 12773 var $midnightCompatArr = []; 12774 $('div[data-midnight]').each(function () { 12775 12776 if ($(this).attr('data-midnight') == 'light' && $(this).parents('.pum-content').length == 0 || 12777 $(this).attr('data-midnight') == 'dark' && $(this).parents('.pum-content').length == 0) { 12778 12779 if( $(this).is('#page-header-bg') && $(this).parents('#page-header-wrap[data-midnight]').length > 0 ) { 12780 // skip. 12781 } else { 12782 $midnightCompatArr.push($(this)); 12783 } 12784 12785 } 12786 12787 }); 12788 12789 12790 if ($midnightCompatArr.length > 0) { 12791 12792 $.each($midnightCompatArr, function (k, v) { 12793 12794 if (v.attr('data-midnight') == 'light' || v.attr('data-midnight') == 'dark') { 12795 12796 var $that = v; 12797 var waypoint = new Waypoint({ 12798 element: $that, 12799 handler: function (direction) { 12800 12801 12802 if ($('body.material-ocm-open').length > 0 || $that.css('display') == 'none' ) { 12803 return; 12804 } 12805 12806 12807 var $textColor; 12808 12809 if (direction == 'down') { 12810 $textColor = ($that.attr('data-midnight') == 'light') ? '' : 'dark-slide'; 12811 $headerOuterEl.removeClass('dark-slide').addClass($textColor); 12812 12813 } else { 12814 12815 var $prevMidItem; 12816 12817 if (k - 1 >= 0) { 12818 $prevMidItem = k - 1; 12819 } else { 12820 $prevMidItem = k; 12821 } 12822 12823 $textColor = ($midnightCompatArr[$prevMidItem].attr('data-midnight') == 'light') ? '' : 'dark-slide'; 12824 $headerOuterEl.removeClass('dark-slide').addClass($textColor); 12825 12826 } 12827 12828 }, 12829 offset: $headerOuterEl.height() 12830 12831 }); 12832 12833 } 12834 12835 }); 12836 12837 } 12838 12839 } 12840 12841 12842 } 12843 12844 12845 12846 12847 /** 12848 * Box roll header effect initialization. 12849 * 12850 * @since 6.0 12851 */ 12852 function nectarBoxRollInit() { 12853 if ($('.nectar-box-roll').length > 0 && typeof NectarBoxRoll !== 'undefined') { 12854 12855 pageHeaderTextEffectInit(); 12856 12857 // listen for emits. 12858 $(window).on('nectar-box-roll-scroll-disabled', function() { 12859 nectarState.preventScroll = true; 12860 });
12861 $(window).on('nectar-box-roll-scroll-enabled', function() { 12862 nectarState.preventScroll = false; 12863 }); 12864 12865 nectarBoxRoll = new NectarBoxRoll(nectarDOMInfo, waypoints, midnightInit, pageLoadHash, resizeVideoToCover); 12866 12867 } 12868 } 12869 12870 12871 12872 12873 /** 12874 * Create all waypoints. 12875 * 12876 * @since 6.0 12877 */ 12878 function waypoints() { 12879 rowBGAnimations(); 12880 columnBGAnimations(); 12881 colAndImgAnimations(); 12882 progressBars(); 12883 dividers(); 12884 iconList(); 12885 animatedTitles(); 12886 highlightedText(); 12887 imageWithHotspots(); 12888 clientsFadeIn(); 12889 splitLineHeadings(); 12890 svgAnimations(); 12891 milestoneInit(); 12892 nectarFancyUlInit(); 12893 owl_carousel_animate(); 12894 headerRowColorInheritInit(); 12895 morphingOutlines(); 12896 animatedColBorders(); 12897 wooProductCarouselAnimations(); 12898 foodMenuItems(); 12899 vcWaypoints(); 12900 NectarPostGridWaypoint(); 12901 nectarRotatingWordsInit(); 12902 } 12903 12904 12905 12906 /** 12907 * Salient page builder elements initialization. 12908 * 12909 * @since 10.5 12910 */ 12911 function salientPageBuilderElInit() { 12912 flexsliderInit(); 12913 flickityLazyInit(); 12914 setTimeout(flickityInit, 100); 12915 twentytwentyInit(); 12916 standardCarouselInit(); 12917 productCarouselInit(); 12918 clientsCarouselInit(); 12919 carouselfGrabbingClass(); 12920 setTimeout(tabbedInit, 60); 12921 accordionInit(); 12922 accordionClickEvents(); 12923 largeIconHover(); 12924 nectarIconMatchColoring(); 12925 coloredButtons(); 12926 ctaLinkBG(); 12927 teamMemberFullscreen(); 12928 flipBoxInit(); 12929 owlCarouselInit(); 12930 mouseParallaxInit(); 12931 ulCheckmarks(); 12932 nectarFancyUlIcons(); 12933 nectarFancyBoxHover(); 12934 nectarVideoLightbox(); 12935 nectarKeyframeAssist(); 12936 morphingOutlinesInit(); 12937 nectarPostGridInit(); 12938 cascadingImageInit(); 12939 imageWithHotspotEvents(); 12940 pricingTableHeight(); 12941 pageSubmenuInit(); 12942 nectarLiquidBGs(); 12943 nectarTestimonialSliders(); 12944 nectarTestimonialSlidersEvents(); 12945 recentPostsTitleOnlyEqualHeight(); 12946 recentPostsInit(); 12947 parallaxItemHoverEffect(); 12948 fsProjectSliderInit(); 12949 postMouseEvents(); 12950 masonryPortfolioInit(); 12951 masonryBlogInit(); 12952 portfolioCustomColoring(); 12953 searchResultMasonryInit(); 12954 stickySidebarInit(); 12955 portfolioSidebarFollow(); 12956 splitLineHeadingInit(); 12957 var stickyEls = new NectarStickyEls(); 12958 } 12959 12960 12961 12962 12963 /***************** WooCommerce *****************/ 12964 12965 /** 12966 * Woo filter toggle 12967 * 12968 * @since 13.0 12969 */ 12970 function NectarWooCommerceFilters() { 12971 12972 this.$toggleBtn = $('.nectar-shop-filters .nectar-shop-filter-trigger'); 12973 this.$sidebar = $('#sidebar'); 12974 this.sidebarPos = (this.$sidebar.hasClass('col_last')) ? 'right' : 'left'; 12975 12976 this.state = { 12977 open: (this.getLS()) ? this.getLS() : 'true' 12978 }; 12979 12980 this.setup(); 12981 this.events(); 12982 } 12983 12984 NectarWooCommerceFilters.prototype.events = function() { 12985 12986 this.$toggleBtn.on('click', this.toggle.bind(this)); 12987 this.$sidebar.find('.nectar-close-btn-wrap').on('click', this.mobileToggle.bind(this)); 12988 $(window).on('smartresize', this.mobileToggleResize.bind(this)); 12989 12990 }; 12991 12992 NectarWooCommerceFilters.prototype.mobileToggleResize = function() { 12993 12994 if( this.$sidebar.hasClass('open') && nectarDOMInfo.winW > 999 ) { 12995 this.$sidebar.removeClass('open'); 12996 this.$sidebar.find('.nectar-close-btn-wrap').removeClass('open'); 12997 $('.container-wrap').css('z-index','11'); 12998 } 12999 13000 }; 13001 13002 NectarWooCommerceFilters.prototype.mobileToggle = function() { 13003 13004 if( this.$sidebar.hasClass('open') ) { 13005 this.$sidebar.removeClass('open'); 13006 this.$sidebar.find('.nectar-close-btn-wrap').removeClass('open'); 13007 $('.container-wrap').css('z-index','11'); 13008 } else { 13009 $('.container-wrap').css('z-index','10000'); 13010 this.$sidebar.addClass('open'); 13011 this.$sidebar.find('.nectar-close-btn-wrap').addClass('open'); 13012 } 13013 13014 return false; 13015 13016 }; 13017 13018 NectarWooCommerceFilters.prototype.toggle = function() { 13019 13020 // Mobile. 13021 if( nectarDOMInfo.winW < 1000 ) { 13022 this.mobileToggle(); 13023 return false; 13024 } 13025 13026 var visibility = ''; 13027 13028 // Close.
13029 if( this.state.open == 'true' ) { 13030 13031 // Handle state. 13032 this.state.open = 'false'; 13033 visibility = 'false'; 13034 13035 // Layout change. 13036 this.$toggleBtn.find('.hide').hide(); 13037 this.$toggleBtn.find('.show').show(); 13038 13039 this.$toggleBtn.find('.top-line, .bottom-line').css({ 13040 'transform': 'translateX(0)' 13041 }); 13042 13043 if( this.sidebarPos == 'left' ) { 13044 this.$sidebar.css({ 13045 'margin-right' : '-25%', 13046 'opacity': '0' 13047 }); 13048 } else { 13049 this.$sidebar.css({ 13050 'margin-left': '-25%', 13051 'opacity': '0' 13052 }); 13053 } 13054 13055 this.$sidebar.find('> .inner').css({ 13056 'transform': (this.sidebarPos == 'left') ? 'translateX(-100%)' : 'translateX(100%)', 13057 }); 13058 13059 } 13060 // Open. 13061 else { 13062 13063 // Handle state. 13064 this.state.open = 'true'; 13065 visibility = 'true'; 13066 13067 // Layout change. 13068 this.$toggleBtn.find('.show').hide(); 13069 this.$toggleBtn.find('.hide').show(); 13070 13071 this.$toggleBtn.find('.top-line').css({ 13072 'transform': 'translateX(10px)' 13073 }); 13074 this.$toggleBtn.find('.bottom-line').css({ 13075 'transform': 'translateX(-10px)' 13076 }); 13077 13078 if( this.sidebarPos == 'left' ) { 13079 this.$sidebar.css({ 13080 'margin-right' : '0', 13081 'opacity': '1' 13082 }); 13083 } else { 13084 this.$sidebar.css({ 13085 'margin-left' : '0', 13086 'opacity': '1' 13087 }); 13088 } 13089 13090 this.$sidebar.find('> .inner').css({ 13091 'transform': 'translateX(0)' 13092 }); 13093 13094 } 13095 13096 // Trigger event. 13097 setTimeout(function(){ 13098 $(window).trigger('nectar-product-filters-layout'); 13099 },425); 13100 13101 13102 // Store in LS. 13103 if( typeof(Storage) !== "undefined" ) { 13104 localStorage.setItem("nectar_product_filters_vis", visibility); 13105 } 13106 13107 return false; 13108 13109 }; 13110 13111 NectarWooCommerceFilters.prototype.setup = function() { 13112 13113 // Start filters expanded on mobile. 13114 this.$sidebar.find('.widget.woocommerce') 13115 .addClass('open-filter') 13116 .find('ul') 13117 .css({ 13118 'display':'block' 13119 }); 13120 13121 // Mobile active filters. 13122 if( $('.nectar-active-product-filters').length > 0 ) { 13123 var $filtersHTML = $('.nectar-active-product-filters').clone(); 13124 this.$sidebar.find('> .inner').prepend($filtersHTML); 13125 } 13126 13127 }; 13128 13129 NectarWooCommerceFilters.prototype.getLS = function() { 13130 13131 if( typeof(Storage) !== "undefined" ) { 13132 return localStorage.getItem("nectar_product_filters_vis"); 13133 } 13134 13135 return null; 13136 13137 }; 13138 13139 13140 13141 13142 /** 13143 * Handle Woo quantity button functionality 13144 * 13145 * @since 13.0 13146 */ 13147 function wooQauntityBtns() { 13148 var quantityButtons = new NectarWooCommerceQuantity(); 13149 } 13150 13151 function NectarWooCommerceQuantity() { 13152 13153 this.$qty = ''; 13154 this.step = 1; 13155 this.ajaxTimeout = ''; 13156 this.ajaxTimeoutDur = 500; 13157 13158 this.state = { 13159 max: 100000, 13160 min: 0, 13161 currentVal: 1, 13162 key: 0, 13163 removeFlag: false 13164 }; 13165 13166 this.events(); 13167 13168 } 13169 13170 NectarWooCommerceQuantity.prototype.updateState = function(el) { 13171 13172 // Get key. 13173 var key = 0; 13174 13175 if( true === this.checkMiniCart(this.$qty) ) { 13176 var matches = this.$qty.attr('name').match(/cart\[(\w+)\]/); 13177 key = matches[1]; 13178 } 13179 13180 // Store current. 13181 var currentVal = parseFloat(this.$qty.val()); 13182 13183 if (!currentVal || currentVal === '' || currentVal === 'NaN') { 13184 currentVal = 0; 13185 } 13186 13187 // Max/Min vals. 13188 var max = parseFloat(this.$qty.attr('max')); 13189 var min = parseFloat(this.$qty.attr('min')); 13190 13191 if (max === '' || max === 'NaN' || isNaN(max) ) { 13192 max = ''; 13193 } 13194 13195 if (min === '' || min === 'NaN' || isNaN(min) ) { 13196 min = 0; 13197 } 13198 13199 // Push to state. 13200 this.state = { 13201 currentVal: currentVal, 13202 max: max, 13203 min: min, 13204 key: key 13205 }; 13206 13207 }; 13208 13209 NectarWooCommerceQuantity.prototype.events = function() { 13210 13211 var that = this; 13212 13213 $('body').on('click', '.quantity .plus', function() { 13214 that.$qty = $(this).closest('.quantity').find('.qty'); 13215 that.updateState(); 13216 that.increment($(this)); 13217 });
13218 13219 $('body').on('click', '.quantity .minus', function() { 13220 that.$qty = $(this).closest('.quantity').find('.qty'); 13221 that.updateState(); 13222 that.decrement($(this)); 13223 }); 13224 13225 $('body').on('keyup', '.woocommerce-mini-cart .quantity .qty', function(e) { 13226 that.$qty = $(this); 13227 13228 that.updateState(); 13229 13230 // Max value. 13231 if( that.state.max && that.$qty.val() > that.state.max ) { 13232 that.$qty.val(that.state.max); 13233 } 13234 13235 // Check if item should be removed. 13236 if (that.state.min && (that.state.min == that.state.currentVal || that.state.currentVal < that.state.min)) { 13237 that.state.removeFlag = true; 13238 } 13239 13240 $(this).trigger('change'); 13241 13242 }); 13243 13244 $('body').on('change', '.woocommerce-mini-cart .quantity .qty', function(e) { 13245 13246 if( !e.originalEvent && true === that.checkMiniCart(that.$qty) ) { 13247 that.updateCart(that.$qty.val()); 13248 } 13249 13250 }); 13251 13252 }; 13253 13254 NectarWooCommerceQuantity.prototype.increment = function() { 13255 13256 if (this.state.max && (this.state.max == this.state.currentVal || this.state.currentVal > this.state.max)) { 13257 this.$qty.val(this.state.max); 13258 } else { 13259 this.$qty.val(this.state.currentVal + parseFloat(this.step)); 13260 } 13261 13262 this.$qty.trigger('change'); 13263 13264 }; 13265 13266 NectarWooCommerceQuantity.prototype.decrement = function() { 13267 13268 if (this.state.min && (this.state.min == this.state.currentVal || this.state.currentVal < this.state.min)) { 13269 this.$qty.val(0); 13270 this.state.removeFlag = true; 13271 13272 } else if (this.state.currentVal > 0) { 13273 this.$qty.val(this.state.currentVal - parseFloat(this.step)); 13274 } 13275 13276 this.$qty.trigger('change'); 13277 13278 }; 13279 13280 NectarWooCommerceQuantity.prototype.checkMiniCart = function(el) { 13281 return ( el.parents('.woocommerce-mini-cart').length > 0 ) ? true : false; 13282 }; 13283 13284 NectarWooCommerceQuantity.prototype.updateCart = function(val) { 13285 13286 var that = this; 13287 13288 // Debounce a little to prevent too many requests when clicking a lot 13289 clearTimeout(this.ajaxTimeout); 13290 13291 this.ajaxTimeout = setTimeout(function() { 13292 13293 that.$qty.closest( '.widget_shopping_cart_content' ).addClass('loading'); 13294 that.$qty.closest( '.woocommerce-mini-cart-item' ).addClass('blockUI').addClass('blockOverlay'); 13295 13296 $.ajax({
13297 type: 'POST', 13298 url: window.nectarLove.ajaxurl, 13299 data: { 13300 action: "nectar_minicart_update_quantity", 13301 quantity: val, 13302 item_key: that.state.key 13303 }, 13304 cache: false, 13305 success: function (response) { 13306 if( response ) { 13307 13308 that.$qty.closest( '.widget_shopping_cart_content' ).removeClass('loading'); 13309 that.$qty.closest( '.woocommerce-mini-cart-item' ).removeClass('blockUI').removeClass('blockOverlay'); 13310 13311 // Update subtotal. 13312 var $subtotal = that.$qty.closest( '.widget_shopping_cart_content' ).find('.woocommerce-mini-cart__total'); 13313 $subtotal.find('.woocommerce-Price-amount').remove(); 13314 $subtotal.append(response.subtotal); 13315 13316 // Does the item need to be removed? 13317 if( that.state.removeFlag === true ) { 13318 that.$qty.closest( '.woocommerce-mini-cart-item' ).remove(); 13319 that.state.removeFlag = false; 13320 $( document.body ).trigger( 'updated_wc_div' ); 13321 } 13322 13323 // Update cart count. 13324 if( $('#header-outer a.cart-contents .cart-wrap span').length > 0 ) { 13325 $('#header-outer a.cart-contents .cart-wrap span').text(response.item_count); 13326 } 13327 13328 } 13329 13330 13331 } 13332 13333 }); 13334 13335 }, this.ajaxTimeoutDur); 13336 13337 }; 13338 13339 13340 /** 13341 * WooCommerce Single Product AJAX Add to Cart. 13342 * 13343 * @since 13.0 13344 */ 13345 function NectarWooCommerceCartAJAX() { 13346 13347 this.state = { 13348 processing: false, 13349 productID: false, 13350 type: 'regular' 13351 }; 13352 13353 this.events(); 13354 } 13355 13356 NectarWooCommerceCartAJAX.prototype.events = function() { 13357 $('body').on('submit', 'form.cart', this.addToCartAJAX.bind(this)); 13358 }; 13359 13360 NectarWooCommerceCartAJAX.prototype.addNotices = function(notices) { 13361 13362 var that = this; 13363 13364 var $noticeParent = $('.nectar-slide-in-cart.style_slide_in_click .widget_shopping_cart_content') 13365 13366 $.each(notices, function(k,item) { 13367 $noticeParent.prepend('<div class="nectar-notice">'+item.notice+'</div>'); 13368 }); 13369 13370 // Remove. 13371 setTimeout(function(){ 13372 $noticeParent.find('.nectar-notice').slideUp(function(){ 13373 $(this).remove(); 13374 }); 13375 },6000); 13376 13377 }; 13378 13379 NectarWooCommerceCartAJAX.prototype.addToCartAJAX = function(e) { 13380 13381 var that = this; 13382 13383 var $wooForm = $(e.currentTarget); 13384 13385 // External or redirect active. 13386 if( $wooForm.closest('.product').hasClass('product-type-external') || (wc_add_to_cart_params && wc_add_to_cart_params.cart_redirect_after_add === 'yes') ) { 13387 return; 13388 } 13389 13390 e.preventDefault(); 13391 13392 // If already submitted 13393 if( that.state.processing == true ) { 13394 return; 13395 } 13396 13397 that.state.processing = true; 13398 that.state.productID = false; 13399 13400 // Store type 13401 that.state.type = 'regular'; 13402 if( $wooForm.parents('.nectar-quick-view-box').length > 0 ) { 13403 that.state.type = 'quickview'; 13404 } 13405 13406 // Gather info to pass. 13407 var $parentProduct = $wooForm.closest('.product'); 13408 var $addToCartBtn = $wooForm.find('button.single_add_to_cart_button'); 13409 var $formData = $wooForm.serializeArray(); 13410 var regID = 0; 13411 13412 // Try and get ID from parent. 13413 if( $parentProduct.is('[id*="product-"]') ) { 13414 regID = $parentProduct.attr('id').match(/\d+/); 13415 13416 if(regID && regID[0]) { 13417 that.state.productID = regID[0]; 13418 } 13419 } 13420 // Fallback to ID from submit. 13421 if( that.state.productID === false && $addToCartBtn.length > 0 ) { 13422 regID = $addToCartBtn.val().match(/\d+/); 13423 13424 if(regID && regID[0]) { 13425 that.state.productID = regID[0]; 13426 } 13427 } 13428 13429 // No ID found, bail out. 13430 if( that.state.productID === false ) { 13431 console.log('Error: no product ID found.'); 13432 return; 13433 } 13434 13435 // Add Loading. 13436 if( that.state.type === 'quickview' ) { 13437 $addToCartBtn = $('.single_add_to_cart_button_wrap .single_add_to_cart_button'); 13438 } 13439 13440 $addToCartBtn.prepend('<div class="loading-wrap"><div class="loading" /></div></div>'); 13441 setTimeout(function(){ 13442 $addToCartBtn.addClass('processing'); 13443 },50); 13444 13445 // Must be formatted like this to use add-to-cart key for WooCommerce to trigger AJAX. 13446 $formData.push({ 13447 name: 'action', 13448 value: 'nectar_ajax_add_to_cart' 13449 }, { 13450 name: 'add-to-cart', 13451 value: that.state.productID 13452 });
13453 13454 $.ajax({ 13455 type: 'POST', 13456 url: window.nectarLove.ajaxurl, 13457 data: $formData, 13458 cache: false, 13459 success: function (response) { 13460 13461 setTimeout(function(){ 13462 that.state.processing = false; 13463 $addToCartBtn.removeClass('processing'); 13464 $addToCartBtn.find('.loading-wrap').remove(); 13465 }, 300); 13466 13467 if( response && response.fragments ) { 13468 13469 // Update content. 13470 $('body').trigger( 'added_to_cart', [response.fragments, response.cart_hash] ); 13471 13472 // Check for/Output errors. 13473 if( response.notices && response.notices.length > 0 ) { 13474 setTimeout(function(){ 13475 that.addNotices(response.notices); 13476 },100); 13477 } 13478 13479 // Close quickview. 13480 if( that.state.type === 'quickview' ) { 13481 $('.nectar-quick-view-box .close').trigger('click'); 13482 } 13483 13484 } 13485 13486 } // end success. 13487 13488 }); // end ajax. 13489 13490 }; 13491 13492 13493 /** 13494 * WooCommerce events. 13495 * 13496 * @since 10.5 13497 */ 13498 function wooCommerceEvents() { 13499 13500 var wooCartTimeout; 13501 13502 // Notification. 13503 $body.on('click', '.product .add_to_cart_button', function () { 13504 13505 var $productHeading = ($(this).parents('li').find('h2').length > 0) ? 'h2' : 'h3', 13506 productToAdd = $(this).parents('li').find($productHeading).text(); 13507 13508 $('#header-outer .cart-notification span.item-name').html(productToAdd); 13509 13510 }); 13511 13512 // Notification hover. 13513 $body.on('mouseenter', '#header-outer .cart-notification', function () { 13514 13515 $(this).hide(); 13516 13517 $('#header-outer .widget_shopping_cart') 13518 .addClass('open') 13519 .stop(true, true) 13520 .show(); 13521 13522 $('#header-outer .cart_list') 13523 .stop(true, true) 13524 .show(); 13525 13526 clearTimeout(wooCartTimeout); 13527 13528 }); 13529 13530 13531 // Cart dropdown. 13532 var $headerCartSelector = '#header-outer .nectar-woo-cart'; 13533 13534 if ($($headerCartSelector).length > 0) { 13535 13536 $($headerCartSelector).hoverIntent(function () { 13537 13538 $('#header-outer .widget_shopping_cart') 13539 .addClass('open') 13540 .stop(true, true) 13541 .show(); 13542 13543 $('#header-outer .cart_list') 13544 .stop(true, true) 13545 .show(); 13546 13547 clearTimeout(wooCartTimeout); 13548 13549 $('#header-outer .cart-notification').hide(); 13550 13551 }); 13552 } 13553 13554 13555 $body.on('mouseleave', $headerCartSelector, function () { 13556 var $that = $(this); 13557 setTimeout(function () { 13558 if (!$that.is(':hover')) { 13559 $('#header-outer .widget_shopping_cart') 13560 .removeClass('open') 13561 .stop(true, true) 13562 .fadeOut(300); 13563 13564 $('#header-outer .cart_list') 13565 .stop(true, true) 13566 .fadeOut(300); 13567 } 13568 }, 200); 13569 }); 13570 13571 if ($('#header-outer[data-cart="false"]').length == 0) { 13572 13573 $body.on('added_to_cart', shopping_cart_dropdown_show); 13574 $body.on('added_to_cart', shopping_cart_dropdown); 13575 13576 } 13577 13578 function shopping_cart_dropdown() { 13579 13580 if (!$('.widget_shopping_cart .widget_shopping_cart_content .cart_list .empty').length && 13581 $('.widget_shopping_cart .widget_shopping_cart_content .cart_list').length > 0) { 13582 13583 $('.cart-menu-wrap').addClass('has_products'); 13584 $('header#top nav > ul, #search-outer #search #close a, header#top .span_9 >.slide-out-widget-area-toggle').addClass('product_added'); 13585 13586 if (!$('.cart-menu-wrap').hasClass('static')) { 13587 $('.cart-menu-wrap, #mobile-cart-link').addClass('first-load'); 13588 } 13589 13590 13591 } 13592 13593 } 13594 13595 13596 function shopping_cart_dropdown_show(e) { 13597 13598 clearTimeout(wooCartTimeout); 13599 13600 if (!$('.widget_shopping_cart .widget_shopping_cart_content .cart_list .empty').length && 13601 $('.widget_shopping_cart .widget_shopping_cart_content .cart_list').length > 0 && 13602 typeof e.type != 'undefined') { 13603 13604 // Standalone woocommerce add to cart buttons. 13605 if ($('#header-outer .cart-notification .item-name').length > 0 && 13606 $('#header-outer .cart-notification .item-name').text().length == 0) { 13607 return; 13608 } 13609 13610 // Before cart has slide in. 13611 if (!$('#header-outer .cart-menu-wrap').hasClass('has_products')) { 13612 13613 setTimeout(function () { 13614 $('#header-outer .cart-notification').fadeIn(400); 13615 }, 400); 13616 13617 } else if (!$('#header-outer .cart-notification').is(':visible')) { 13618 $('#header-outer .cart-notification').fadeIn(400); 13619 } else { 13620 $('#header-outer .cart-notification').show(); 13621 } 13622 13623 $('body #header-outer [data-cart-style="slide_in_click"] .cart-menu-wrap').trigger('click'); 13624 13625 13626 wooCartTimeout = setTimeout(hideCart, 2700); 13627 13628 } 13629 } 13630 13631 function hideCart() { 13632 $('#header-outer .cart-notification').stop(true, true).fadeOut(); 13633 } 13634 13635 function checkForWooItems() { 13636 13637 var checkForCartItems = setInterval(shopping_cart_dropdown, 250); 13638 setTimeout(function () { 13639 clearInterval(checkForCartItems); 13640 }, 4500); 13641 13642 } 13643 13644 13645 if ($('#header-outer[data-cart="false"]').length == 0) { 13646 checkForWooItems();
13647 } 13648 13649 function nectarAccountPageTabs() { 13650 13651 // Not on account page. 13652 if ($('body.woocommerce-account #customer_login').length == 0) { 13653 return; 13654 } 13655 13656 // Create HTML. 13657 $('.woocommerce-account .woocommerce > #customer_login').prepend('<div class="nectar-form-controls" />'); 13658 13659 $('.woocommerce-account .woocommerce > #customer_login > div:not(.nectar-form-controls)').each(function () { 13660 var $title = $(this).find('> h2').text(); 13661 $('#customer_login .nectar-form-controls').append('<div class="control">' + $title + '</div>'); 13662 }); 13663 13664 // Click event. 13665 $('.woocommerce-account .woocommerce > #customer_login .nectar-form-controls .control').on('click', function () { 13666 13667 $('.woocommerce-account .woocommerce > #customer_login .nectar-form-controls .control').removeClass('active'); 13668 $(this).addClass('active'); 13669 13670 var formIndex = $(this).index() + 1; 13671 $('#customer_login div[class*="u-column"]').hide(); 13672 $('#customer_login div[class*="u-column"].col-' + formIndex).show(); 13673 13674 setTimeout(function () { 13675 $('#customer_login div[class*="u-column"]').removeClass('visible'); 13676 $('#customer_login div[class*="u-column"].col-' + formIndex).addClass('visible'); 13677 }, 30); 13678 13679 }); 13680 13681 // Starting. 13682 $('.woocommerce-account .woocommerce > #customer_login .nectar-form-controls .control:nth-child(1)').trigger('click'); 13683 13684 } 13685 13686 nectarAccountPageTabs(); 13687 13688 var bindTextOnHoverMobile = ( $('.products[data-rm-m-hover="1"]').length > 0 && nectarDOMInfo.usingMobileBrowser ) ? false : true; 13689 13690 // Text on hover effect. 13691 if(bindTextOnHoverMobile) { 13692 $body.on('mouseover', '.text_on_hover .product-wrap, .text_on_hover > a:first-child', function () { 13693 $(this).parent().addClass('hovered'); 13694 }); 13695 13696 $body.on('mouseout', '.text_on_hover .product-wrap, .text_on_hover > a:first-child', function () { 13697 $(this).parent().removeClass('hovered'); 13698 }); 13699 } 13700 13701 13702 // Material/fancy parallax hover effect zindex. 13703 if ($('.material.product').length > 0 || 13704 $('.minimal.product').length > 0 || 13705 $('.nectar-fancy-box[data-style="parallax_hover"]').length > 0 || 13706 $('.nectar-category-grid[data-shadow-hover="yes"]').length > 0 || 13707 $('.nectar-post-grid[data-shadow-hover="yes"]').length > 0) { 13708 13709 var $productZindex = 101; 13710 13711 $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 () { 13712 $productZindex++; 13713 $(this).css('z-index', $productZindex + 1); 13714 }); 13715 13716 $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 () { 13717 13718 var $that = $(this); 13719 setTimeout(function () { 13720 if (!$that.is(':hover')) { 13721 $that.css('z-index', 100); 13722 } 13723 }, 350); 13724 }); 13725 13726 if( window.nectarOptions && window.nectarOptions.woo_minimal_product_effect && window.nectarOptions.woo_minimal_product_effect === 'default' ) { 13727 $body.on('mouseenter', '.minimal.product', function () { 13728 $productZindex++; 13729 $(this).css('z-index', $productZindex + 1); 13730 }); 13731 13732 $body.on('mouseleave', '.minimal.product', function () { 13733 13734 var $that = $(this); 13735 setTimeout(function () { 13736 if (!$that.is(':hover')) { 13737 $that.css('z-index', 100); 13738 } 13739 }, 350); 13740 }); 13741 } 13742 13743 // Reset to stop zindex from getting too high. 13744 setInterval(function () { 13745 if ($('.nectar-fancy-box[data-style="parallax_hover"]:hover').length > 0 || 13746 $('.minimal.product:hover').length > 0) { 13747 return; 13748 } 13749 13750 $('.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); 13751 $productZindex = 101; 13752 }, 10000); 13753 13754 } 13755 13756 function minimalProductHover() { 13757 13758 // Add icons. 13759 $('.products .classic .product-wrap .add_to_cart_button').wrapInner('<span />'); 13760 $('.products .classic .product-wrap .add_to_cart_button').prepend('<i class="normal icon-salient-cart"></i>'); 13761 13762 // Bind hover. 13763 var bindMobileHover = ( $('.products[data-rm-m-hover="1"]').length > 0 && nectarDOMInfo.usingMobileBrowser ) ? false : true; 13764 13765 if( bindMobileHover && window.nectarOptions && window.nectarOptions.woo_minimal_product_effect && window.nectarOptions.woo_minimal_product_effect === 'default' ) { 13766 13767 $body.on('mouseover', '.products .minimal.product', function () { 13768 minimalProductCalc($(this)); 13769 });
13770 13771 $body.on('mouseleave', '.products .minimal.product', function () { 13772 $(this).find('.background-color-expand').css({ 13773 'transform': 'scale(1, 1) translateY(0) translateZ(0px)' 13774 }); 13775 }); 13776 13777 } 13778 13779 // Starting trigger mouse over. 13780 $('.products .minimal.product').each(function () { 13781 if ($(this).is(':hover')) { 13782 $(this).trigger('mouseover'); 13783 } 13784 }); 13785 13786 } 13787 13788 13789 13790 function minimalProductCalc(el) { 13791 13792 var expansionAmtX = 40, 13793 expansionAmtY = expansionAmtX, 13794 translateYAmt = 0; 13795 13796 var $item = el, 13797 $itemWidth = $item.width(), 13798 $itemHeight = $item.height(), 13799 $wChange = (parseInt($itemWidth) + expansionAmtX) / parseInt($itemWidth), 13800 $hChange = (parseInt($itemHeight) + expansionAmtY) / parseInt($itemHeight); 13801 13802 $item.addClass('hover-bound'); 13803 13804 $item.find('.background-color-expand').css({ 13805 'transform': 'scale(' + $wChange + ',' + $hChange + ') translateY('+translateYAmt+'px) translateZ(0px)' 13806 }); 13807 13808 } 13809 13810 minimalProductHover(); 13811 13812 13813 13814 // Mobile widget filters. 13815 $('.woocommerce #sidebar .widget.woocommerce').each(function () { 13816 13817 // Skip widgets without any titles. 13818 if ($(this).find('> h4').length == 0) { 13819 $(this).addClass('no-widget-title'); 13820 } 13821 13822 }); 13823 13824 $body.on('click', '#sidebar .widget.woocommerce:not(.widget_price_filter) h4', function () { 13825 13826 if(window.nectarOptions && window.nectarOptions.woo_sidebar_toggles !== 'false') { 13827 13828 if ($window.width() < 1000 ) { 13829 13830 if ($(this).parent().is('.widget_product_tag_cloud')) { 13831 $(this).parent().find('> div').slideToggle(); 13832 } 13833 if ($(this).parent().is('.woocommerce-widget-layered-nav') && $(this).parent().find('> .woocommerce-widget-layered-nav-dropdown').length > 0) { 13834 $(this).parent().find('> .woocommerce-widget-layered-nav-dropdown').slideToggle(); 13835 } 13836 13837 $(this).parent().find('> ul').slideToggle(); 13838 13839 $(this).parent().toggleClass('open-filter'); 13840 } 13841 13842 } 13843 13844 }); 13845 13846 13847 // Slide in cart event. 13848 $body.on('mouseenter', '#header-outer [data-cart-style="slide_in"] .cart-menu-wrap', openRightCartHover); 13849 13850 $body.on('mouseenter', '.nectar-slide-in-cart', function () { 13851 $(this).addClass('mouse-accessed'); 13852 }); 13853 13854 13855 function openRightCartHover() { 13856 13857 if ($('.nectar-slide-in-cart ul.cart_list li:not(.empty)').length > 0) { 13858 13859 $('.nectar-slide-in-cart').addClass('open'); 13860 $window.on('mousemove.rightCartOffsetCheck', closeCartCheck); 13861 13862 } 13863 } 13864 13865 function closeCartCheck(e) { 13866 13867 var $windowWidth = $window.width(); 13868 if (e.clientX < $windowWidth - 370 - $bodyBorderWidth && $('.nectar-slide-in-cart').hasClass('mouse-accessed')) { 13869 13870 $window.off('mousemove.rightCartOffsetCheck', closeCartCheck); 13871 13872 $('.nectar-slide-in-cart').removeClass('open').removeClass('mouse-accessed'); 13873 13874 } 13875 13876 } 13877 13878 // Slide in click cart. 13879 var wooBgOverlayTimeout; 13880 13881 $body.on('click', '#header-outer [data-cart-style="slide_in_click"] .cart-menu-wrap, #mobile-cart-link[data-cart-style="slide_in_click"]', openRightCart); 13882 13883 function openRightCart() { 13884 if( $body.is('.woocommerce-checkout') || $body.is('.woocommerce-cart') ) { 13885 return true; 13886 } 13887 13888 $('.nectar-slide-in-cart, .nectar-slide-in-cart-bg').addClass('open'); 13889 $('.nectar-slide-in-cart-bg').addClass('revealed'); 13890 clearTimeout(wooBgOverlayTimeout); 13891 13892 // YITH ajax filters compat. 13893 $('.style_slide_in_click div.quantity').each(function(){ 13894 if( $(this).find('.minus').length > 1 ) { 13895 $(this).find('.minus').first().remove(); 13896 } 13897 if( $(this).find('.plus').length > 1 ) { 13898 $(this).find('.plus').first().remove(); 13899 } 13900 }); 13901 13902 return false; 13903 } 13904 13905 $body.on('click', '.nectar-slide-in-cart.style_slide_in_click .close-cart, .nectar-slide-in-cart-bg', closeRightCart); 13906 13907 function closeRightCart() { 13908 13909 $('.nectar-slide-in-cart, .nectar-slide-in-cart-bg').removeClass('open'); 13910 13911 wooBgOverlayTimeout = setTimeout(function() { 13912 $('.nectar-slide-in-cart-bg').removeClass('revealed'); 13913 },400); 13914 13915 return false; 13916 } 13917 13918 // Add quantity functionality. 13919 wooQauntityBtns(); 13920 13921 // AJAX add to cart. 13922 if( window.nectarOptions && window.nectarOptions.ajax_add_to_cart === '1' ) { 13923 var ajaxAddToCart = new NectarWooCommerceCartAJAX(); 13924 } 13925 13926 if( window.nectarOptions && window.nectarOptions.woo_product_filter_toggle === '1' && $body.is('.archive.woocommerce') ) { 13927 var nectarProductFilters = new NectarWooCommerceFilters(); 13928 } 13929 13930 // Third party. 13931 // YITH Ajax filters. 13932 $(document).on( 'yith-wcan-ajax-filtered', nectarLazyImageLoading ); 13933 13934 13935 } 13936 13937 13938 13939 /** 13940 * Modern quick search. 13941 * 13942 * @since 13.0 13943 */ 13944 function NectarQuickSearch() { 13945 13946 this.$el = $('#search-outer #search .container #s'); 13947 this.$container = ''; 13948 this.$parent = ''; 13949 this.$searchEl = $('#search-outer'); 13950 this.request = ''; 13951 this.timeout = ''; 13952 this.setup(); 13953 this.events(); 13954 13955 this.state = { 13956 requesting: false, 13957 open: false, 13958 prevResults: '' 13959 } 13960 13961 this.minChars = 2; 13962 13963 } 13964 13965 13966 NectarQuickSearch.prototype.setup = function() { 13967
13968 this.$container = $('<div class="inner"></div>'); 13969 $('#search-outer').append($('<div class="nectar-ajax-search-results"><div class="container"></div></div>')); 13970 this.$parent = $('#search-outer .nectar-ajax-search-results'); 13971 $('#search-outer .nectar-ajax-search-results .container').append(this.$container); 13972 13973 }; 13974 13975 NectarQuickSearch.prototype.events = function() { 13976 13977 var that = this; 13978 13979 this.throttled = throttle(this.getResults.bind(this),350); 13980 this.$el.on('keyup', this.keyHandle.bind(this) ); 13981 13982 $(window).on('resize', this.resize.bind(this)); 13983 $(window).on('nectar-search-close', function() { 13984 that.resetHeight(); 13985 that.requestCheck(); 13986 }); 13987 13988 }; 13989 13990 NectarQuickSearch.prototype.keyHandle = function(e) { 13991 13992 // Verify Key. 13993 var keysToSkip = [16,91,32,37,39,17]; 13994 13995 if( keysToSkip.indexOf(e.keyCode) != -1 ) { 13996 return; 13997 } 13998 13999 this.throttled(); 14000 this.debouncedSearch(); 14001 14002 }; 14003 14004 NectarQuickSearch.prototype.debouncedSearch = function() { 14005 14006 var that = this; 14007 14008 clearTimeout(this.timeout); 14009 this.timeout = setTimeout(function(){ 14010 if(that.state.requesting) { 14011 return; 14012 } 14013 that.getResults(); 14014 },400); 14015 14016 }; 14017 14018 14019 NectarQuickSearch.prototype.resize = function() { 14020 14021 this.$parent.css({ 14022 'max-height': '' 14023 }); 14024 14025 if( this.state.open === true ) { 14026 this.$parent.css({ 14027 'max-height': parseInt(this.$container.outerHeight()) + 'px' 14028 }); 14029 } 14030 14031 }; 14032 14033 NectarQuickSearch.prototype.resetHeight = function() { 14034 14035 var that = this; 14036 14037 this.$parent.css({ 14038 'max-height': '' 14039 }); 14040 14041 setTimeout(function(){ 14042 $headerOuterEl.removeClass('results-shown'); 14043 },400); 14044 14045 this.state.prevResults = ''; 14046 this.state.open = false; 14047 }; 14048 14049 14050 NectarQuickSearch.prototype.requestCheck = function() { 14051 14052 if( this.state.requesting === true ) { 14053 this.request.abort(); 14054 this.state.requesting = false; 14055 } 14056 14057 }; 14058 14059 NectarQuickSearch.prototype.getResults = function() { 14060 14061 var that = this; 14062 var val = this.$el.val(); 14063 14064 // Deleted all chars / too few chars. 14065 if( val.length == 0 || val.length < this.minChars ) { 14066 $headerOuterEl.removeClass('results-shown'); 14067 this.requestCheck(); 14068 this.resetHeight(); 14069 return; 14070 } 14071 14072 this.request = $.ajax({ 14073 type: 'POST', 14074 url: window.nectarLove.ajaxurl, 14075 data: { 14076 action: "nectar_ajax_ext_search_results", 14077 search: val 14078 }, 14079 cache: false, 14080 success: function (response) { 14081 14082 that.state.requesting = false; 14083 14084 // No results. 14085 if( !response ) { 14086 that.resetHeight(); 14087 } 14088 14089 if( response && response.content && response.content !== that.state.prevResults && that.$searchEl.hasClass('material-open') ) { 14090 14091 that.$container.html(response.content); 14092 14093 that.$parent.css({ 14094 'max-height': parseInt(that.$container.outerHeight()) + 'px' 14095 }); 14096 14097 setTimeout(function(){ 14098 $headerOuterEl.addClass('results-shown'); 14099 },200); 14100 14101 // Desktop animation 14102 if( nectarDOMInfo.winW >= 1000 && !$headerOuterEl.hasClass('results-shown') ) { 14103 14104 that.$container.find('.product, .search-post-item').css({ 14105 'opacity': '0', 14106 'transform': 'translateY(25px)', 14107 'transition': 'none' 14108 }); 14109 14110 setTimeout(function(){ 14111 that.$container.find('.product, .search-post-item').css({ 14112 '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)' 14113 }); 14114 },50); 14115 14116 14117 that.$container.find('.product, .search-post-item').each(function(i) { 14118 var $that = $(this); 14119 setTimeout(function(){ 14120 $that.css({ 14121 'opacity': '1', 14122 'transform': 'translateY(0)' 14123 }) 14124 }, 50 + (i*60)); 14125 });
14126 14127 } 14128 14129 that.state.open = true; 14130 that.state.prevResults = response.content; 14131 14132 } 14133 14134 } 14135 14136 }); 14137 14138 this.state.requesting = true; 14139 14140 }; 14141 14142 14143 /** 14144 * Search in navigation functionality. 14145 * 14146 * @since 10.5 14147 */ 14148 14149 function navigationSearchInit() { 14150 14151 // Init quick search. 14152 var quickSearch = false; 14153 if( window.nectarOptions && window.nectarOptions.quick_search && window.nectarOptions.quick_search === 'true' ) { 14154 quickSearch = new NectarQuickSearch(); 14155 } 14156 14157 var $placeholder = ($('#search-outer #search input[type=text][data-placeholder]').length > 0) ? $('#search-outer #search input[type=text]').attr('data-placeholder') : ''; 14158 14159 // Material skin add search BG markup. 14160 if ($body.hasClass('material') && $('#header-outer .bg-color-stripe').length == 0) { 14161 $headerOuterEl.append('<div class="bg-color-stripe" />'); 14162 } 14163 14164 // Prevent jumping on click. 14165 $body.on('click', '#search-btn a', function () { 14166 return false; 14167 }); 14168 14169 // Open search on mouseup. 14170 $body.on('click', '#search-btn a:not(.inactive), #header-outer .mobile-search', function () { 14171 14172 if ($(this).hasClass('open-search')) { 14173 return false; 14174 } 14175 14176 // Close menu on original skin. 14177 if( $body.hasClass('original') && $('.slide-out-widget-area-toggle.mobile-icon a.open').length > 0 ) { 14178 $('.slide-out-widget-area-toggle.mobile-icon a') 14179 .addClass('non-human-allowed') 14180 .trigger('click'); 14181 14182 setTimeout(function () { 14183 $('.slide-out-widget-area-toggle.mobile-icon a').removeClass('non-human-allowed'); 14184 }, 100); 14185 } 14186 14187 if ($body.hasClass('ascend') || 14188 $('body[data-header-format="left-header"]').length > 0 && $('body.material').length == 0) { 14189 14190 // Ascend theme skin. 14191 $('#search-outer > #search form, #search-outer #search .span_12 span, #search-outer #search #close').css('opacity', 0); 14192 14193 $('#search-outer > #search form').css('transform', 'translateY(-30px)'); 14194 $('#search-outer #search .span_12 span').css('transform', 'translateY(20px)'); 14195 14196 $('#search-outer').show(); 14197 $('#search-outer').stop().transition({ 14198 scale: '1,0', 14199 'opacity': 1 14200 }, 0).transition({ 14201 scale: '1,1' 14202 }, 700, 'cubic-bezier(0.2, 1, 0.3, 1)'); 14203 14204 $('#search-outer > #search form').delay(350).transition({ 14205 'opacity': 1, 14206 'transform': 'translateY(0)' 14207 }, 700, 'cubic-bezier(0.2, 1, 0.3, 1)'); 14208 14209 $('#search-outer #search #close').delay(500).transition({ 14210 'opacity': 1 14211 }, 700, 'cubic-bezier(0.2, 1, 0.3, 1)'); 14212 14213 14214 $('#search-outer #search .span_12 span').delay(450).transition({ 14215 'opacity': 1, 14216 'transform': 'translateY(0)' 14217 }, 700, 'cubic-bezier(0.2, 1, 0.3, 1)'); 14218 14219 } 14220 14221 else if (!$body.hasClass('material')) { 14222 // Original theme skin. 14223 $('#search-outer').stop(true).fadeIn(600, 'easeOutExpo'); 14224 } 14225 else { 14226 14227 // Material theme skin. 14228 $('#header-outer[data-transparent-header="true"] .bg-color-stripe').css('transition', ''); 14229 $('#search-outer, #ajax-content-wrap').addClass('material-open'); 14230 nectarState.materialSearchOpen = true; 14231 $headerOuterEl.addClass('material-search-open'); 14232 $('#fp-nav').addClass('material-ocm-open'); 14233 14234 $(window).trigger('nectar-search-open'); 14235 14236 } 14237 14238 14239 setTimeout(function () { 14240 14241 $('#search input[type=text]').trigger('focus'); 14242 14243 if ($('#search input[type=text]').val() == $placeholder) { 14244 $('#search input[type=text]').setCursorPosition(0); 14245 } 14246 14247 }, 300); 14248 14249 14250 $(this).toggleClass('open-search'); 14251 14252 // Close slide out widget area. 14253 $('.slide-out-widget-area-toggle a:not(#toggle-nav).open:not(.animating)').trigger('click'); 14254 14255 return false; 14256 14257 }); 14258 14259 // Handle the placeholder value. 14260 $('body:not(.material)').on('keydown', '#search input[type=text]', function () { 14261 if ($(this).val() == $placeholder) { 14262 $(this).val(''); 14263 } 14264 });
14265 14266 $('body:not(.material)').on('keyup', '#search input[type=text]', function () { 14267 if ($(this).val().length == 0 ) { 14268 $(this).val($placeholder); 14269 $(this).setCursorPosition(0); 14270 } 14271 }); 14272 14273 14274 // Close search btn event. 14275 $body.on('click', '#close', function () { 14276 closeSearch(); 14277 $searchButtonEl.removeClass('open-search'); 14278 $('#header-outer .mobile-search').removeClass('open-search'); 14279 return false; 14280 }); 14281 14282 // Original and Ascend skin close search when clicking off. 14283 $('body:not(.material)').on('blur', '#search-box input[type=text]', function () { 14284 closeSearch(); 14285 $searchButtonEl.removeClass('open-search'); 14286 $('#header-outer .mobile-search').removeClass('open-search'); 14287 }); 14288 14289 14290 // Material skin close when clicking off the search. 14291 $('body.material').on('click', '#ajax-content-wrap', function (e) { 14292 if (e.originalEvent !== undefined) { 14293 closeSearch(); 14294 $searchButtonEl.removeClass('open-search'); 14295 $('#header-outer .mobile-search').removeClass('open-search'); 14296 14297 } 14298 }); 14299 14300 // Material skin close on esc button event. 14301 if ($('body.material').length > 0) { 14302 $(document).on('keyup', function (e) { 14303 14304 if (e.keyCode == 27) { 14305 closeSearch(); 14306 $searchButtonEl.removeClass('open-search'); 14307 14308 // Close ocm material 14309 if ($('.ocm-effect-wrap.material-ocm-open').length > 0) { 14310 $('.slide-out-widget-area-toggle.material-open a').trigger('click'); 14311 } 14312 } 14313 14314 }); 14315 } 14316 14317 14318 14319 // Called to hide the search bar. 14320 function closeSearch() { 14321 14322 if ($body.hasClass('ascend') || $('body[data-header-format="left-header"]').length > 0 && $('body.material').length == 0) { 14323 $('#search-outer').stop().transition({ 14324 'opacity': 0 14325 }, 300, 'cubic-bezier(0.2, 1, 0.3, 1)'); 14326 $searchButtonEl.addClass('inactive'); 14327 setTimeout(function () { 14328 $('#search-outer').hide(); 14329 $searchButtonEl.removeClass('inactive'); 14330 }, 300); 14331 } else if ($('body.material').length == 0) { 14332 $('#search-outer').stop(true).fadeOut(450, 'easeOutExpo'); 14333 } 14334 14335 if ($body.hasClass('material')) { 14336 14337 $(window).trigger('nectar-search-close'); 14338 14339 var closeTimeoutDur = ($headerOuterEl.hasClass('results-shown')) ? 800 : 400; 14340 setTimeout(function(){ 14341 $('#search-outer #s').val(''); 14342 },closeTimeoutDur); 14343 14344 $('#ajax-content-wrap').removeClass('material-open'); 14345 nectarState.materialSearchOpen = false; 14346 $headerOuterEl.removeClass('material-search-open'); 14347 $('#search-outer').removeClass('material-open'); 14348 $('#fp-nav').removeClass('material-ocm-open'); 14349 } 14350 14351 } 14352 14353 } 14354 14355 14356 14357 14358 14359 14360 /** 14361 * Header layout "Centered header bottom bar" functionality. 14362 * 14363 * @since 9.0 14364 */ 14365 function centeredNavBottomBarReposition() { 14366 14367 var $headerOuter = $headerOuterEl, 14368 $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'), 14369 $headerSpan3 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_3'), 14370 $secondaryHeader = $headerSecondaryEl, 14371 $headerBtns = $headerSpan3.find('nav >ul.buttons'), 14372 $navLogoMargin = parseInt($('body.material #header-outer').attr('data-padding')), 14373 $navLogoHeight = parseInt($('body.material #header-outer').attr('data-logo-height')), 14374 $separatorExtra = parseInt($headerSpan3.css('margin-bottom')), 14375 $triggerCondition = $navLogoMargin + $separatorExtra + $navLogoHeight + parseInt(nectarDOMInfo.secondaryHeaderHeight); 14376 14377 if ($secondaryHeader.length > 0) { 14378 14379 if ($('#header-outer[data-remove-fixed="1"]').length == 0 && $('#header-outer[data-condense="true"]').length > 0) { 14380 14381 setTimeout(function () { 14382 if( $headerSecondaryEl.css('display') != 'none' ) { 14383 nectarDOMInfo.secondaryHeaderHeight = $headerSecondaryEl.outerHeight(); 14384 } 14385 14386 }, 50); 14387 } 14388 14389 } 14390 14391 // Helper to determine if custom mobile breakpoint is active. 14392 function condenseCustomBreakPointHelper() { 14393 14394 var $withinCustomBreakpoint = mobileBreakPointCheck(); 14395 14396 // Adding class to prevent logo from hiding when opening OCM 14397 if ( $withinCustomBreakpoint ) { 14398 $headerOuterEl.addClass('within-custom-breakpoint'); 14399 } else { 14400 $headerOuterEl.removeClass('within-custom-breakpoint'); 14401 } 14402 } 14403 14404 14405 // Bind events if "Condense Header On Scroll" effect is enabled. 14406 if ($('#header-outer[data-condense="true"]').length > 0) { 14407 14408 $window.on('scroll.centeredNavCondense', centeredNavBottomFixed_Scroll); 14409 $window.trigger('scroll'); 14410 14411 $window.on('resize', function(){ 14412 if(nectarDOMInfo.winW < 1000 || mobileBreakPointCheck() ) { 14413 $headerOuter.addClass('force-condense-remove'); 14414 $window.off('scroll.centeredNavCondense'); 14415 } 14416 });
14417 14418 $window.on('smartresize', function() { 14419 14420 condenseCustomBreakPointHelper(); 14421 14422 if(nectarDOMInfo.winW >= 1000 && false == mobileBreakPointCheck() ) { 14423 14424 // Coming from mobile. 14425 if($headerOuter.hasClass('force-condense-remove')) { 14426 14427 // Remove condense effect. 14428 centeredNavBottomFixed_Scroll(); 14429 $headerOuter.removeClass('force-condense-remove'); 14430 14431 // See if the condense effect needs to be reapplied. 14432 setTimeout(function() { 14433 14434 if(nectarDOMInfo.scrollTop >= $triggerCondition) { 14435 $headerOuter.addClass('force-condense'); 14436 centeredNavBottomFixed_Scroll(); 14437 $headerOuter.removeClass('force-condense'); 14438 } 14439 // Bind scroll event. 14440 $window.on('scroll.centeredNavCondense', centeredNavBottomFixed_Scroll); 14441 },200); 14442 14443 } 14444 } 14445 14446 }); 14447 14448 condenseCustomBreakPointHelper(); 14449 14450 } 14451 14452 14453 14454 function centeredNavBottomFixed_Scroll() { 14455 14456 // Bypass calculating. 14457 if (nectarDOMInfo.winW < 1000 || 14458 $('body.page-template-template-no-header').length > 0 || 14459 $('body.page-template-template-no-header-footer').length > 0 || 14460 $('body.material-ocm-open').length > 0 || 14461 $('#header-outer[data-has-menu="true"][data-format="centered-menu-bottom-bar"] .span_9').css('display') == 'none' || 14462 $('#header-outer[data-has-menu="true"][data-format="centered-menu-bottom-bar"] .span_9 > nav').css('display') == 'none') { 14463 return; 14464 } 14465 14466 $bodyBorderTop = ($bodyBorderTop.length > 0 && nectarDOMInfo.secondaryHeaderHeight > 0) ? $bodyBorderTop.height() : 0; 14467 14468 // Add condense effect. 14469 if ($headerOuter.hasClass('force-condense') || !$headerOuter.hasClass('fixed-menu') && nectarDOMInfo.scrollTop >= $triggerCondition) { 14470 14471 var amountToMove = (parseInt($headerSpan9.position().top) - $navLogoMargin - parseInt(nectarDOMInfo.adminBarHeight)) + parseInt(nectarDOMInfo.secondaryHeaderHeight) - $bodyBorderTop; 14472 14473 // Megamenu removes transparency option 14474 if ($('#header-outer[data-megamenu-rt="1"]').length > 0 && $('#header-outer .megamenu').length > 0 && $('#header-outer[data-transparent-header="true"]').length > 0) { 14475 $headerOuterEl.removeClass('no-transition'); 14476 } 14477 14478 $headerOuter.addClass('fixed-menu').removeClass('transparent').css({ 14479 'top': '-' + amountToMove + 'px', 14480 'position': 'fixed' 14481 }); 14482 14483 if( !$headerOuter.is('[data-menu-bottom-bar-align="left"]') ) { 14484 14485 var $headerNavBarOffset = ($('header#top .span_9 nav > ul').length > 0) ? $('header#top .span_9 nav > ul').offset().top : 0; 14486 var $headerButtonsOffset = ($headerBtns.find('li:first-child > *').length > 0) ? $headerBtns.find('li:first-child > *').offset().top : 0; 14487 var $headerButtonsHeight = ($headerSpan9.find('.sf-menu > li > a').length > 0) ? (20 - parseInt($headerSpan9.find('.sf-menu > li > a').height())) / 2 : 2; 14488 14489 $headerBtns.css('transform', 'translateY(' + Math.ceil(parseInt($headerNavBarOffset) - parseInt($headerButtonsOffset) - $headerButtonsHeight) + 'px)'); 14490 $headerBtns.find('.nectar-woo-cart').css('height', $headerOuter.height() + parseInt($headerOuter.css('top')) - parseInt(nectarDOMInfo.adminBarHeight)); 14491 } 14492 14493 } 14494 14495 // Remove condense effect. 14496 else if ($headerOuter.hasClass('force-condense-remove') || $headerOuter.hasClass('fixed-menu') && nectarDOMInfo.scrollTop < $triggerCondition ) { 14497 14498 $headerOuter.removeClass('fixed-menu').css({ 14499 'top': '0', 14500 'position': 'absolute' 14501 }); 14502 14503 $headerBtns.css('transform', 'translateY(0px)'); 14504 $headerBtns.find('.nectar-woo-cart').css('height', ''); 14505 14506 if ($('#header-outer.transparent').length == 0) { 14507 14508 if ($('#header-outer[data-megamenu-rt="1"]').length > 0 && 14509 $('#header-outer .megamenu').length > 0) { 14510 $headerOuterEl.removeClass('no-transition'); 14511 } 14512 14513 if ($('#header-outer[data-megamenu-rt="1"]').length > 0 && 14514 $('#header-outer[data-transparent-header="true"]').length > 0 && 14515 $('#header-outer .megamenu').length > 0) { 14516 14517 if ($headerOuterEl.attr('data-transparent-header') == 'true' && 14518 $('.nectar-box-roll').length == 0 && 14519 $('.megamenu.sfHover:not(.width-75):not(.width-50)').length == 0) { 14520 14521 $headerOuterEl.addClass('transparent'); 14522 $headerOuterEl.removeClass('no-transition'); 14523 14524 } 14525 else if ($headerOuterEl.attr('data-transparent-header') == 'true' && 14526 $('.nectar-box-roll').length == 0 && 14527 $('.megamenu.sfHover').length > 0) { 14528 14529 $headerOuterEl.addClass('no-transition'); 14530 } 14531 14532 } 14533 14534 else { 14535 if ($headerOuterEl.attr('data-transparent-header') == 'true' && $('.nectar-box-roll').length == 0) { 14536 $headerOuterEl.addClass('transparent'); 14537 } 14538 } 14539 14540 } // endif transparent header conditional. 14541 14542 14543 }
14543 // End Remove condense effect. 14544 14545 } // End centeredNavBottomFixed_Scroll. 14546 14547 14548 14549 } 14550 14551 14552 14553 14554 /** 14555 * Header layout "Centered header bottom bar" initialization. 14556 * 14557 * @since 10.5 14558 */ 14559 function centeredNavBottomBarInit() { 14560 14561 if ($('#header-outer[data-format="centered-menu-bottom-bar"]').length > 0) { 14562 centeredNavBottomBarReposition(); 14563 } 14564 14565 } 14566 14567 14568 14569 14570 14571 /** 14572 * Header layout "Centered logo between menu". 14573 * 14574 * Splits the main navigation menu into two sections placed on each side of logo. 14575 * 14576 * @since 8.0 14577 */ 14578 function centeredLogoMargins() { 14579 14580 if (nectarDOMInfo.winW > 1000) { 14581 14582 var $navItemLength = $('#header-outer[data-format="centered-logo-between-menu"] #top nav > .sf-menu:not(.buttons) > li').length; 14583 14584 if ($('#header-outer #social-in-menu').length > 0) { 14585 $navItemLength--; 14586 } 14587 14588 var $centerLogoWidth, 14589 $extraMenuSpace; 14590 14591 if ($('#header-outer #top .row .col.span_3 #logo img:visible').length == 0) { 14592 $centerLogoWidth = parseInt($('#header-outer #top .row .col.span_3').width()); 14593 } else { 14594 $centerLogoWidth = parseInt($('#header-outer #top .row .col.span_3 img:visible').width()); 14595 } 14596 14597 if ($('#header-outer[data-lhe="animated_underline"]').length > 0) { 14598 $extraMenuSpace = parseInt($('header#top nav > ul > li:first-child > a').css('margin-right')); 14599 } else { 14600 $extraMenuSpace = parseInt($('header#top nav > ul > li:first-child > a').css('padding-right')); 14601 } 14602 14603 if ($extraMenuSpace > 30) { 14604 $extraMenuSpace += 45; 14605 } else if ($extraMenuSpace > 20) { 14606 $extraMenuSpace += 40; 14607 } else { 14608 $extraMenuSpace += 30; 14609 } 14610 14611 if (!$body.hasClass('rtl')) { 14612 $('#header-outer[data-format="centered-logo-between-menu"] #top nav > .sf-menu:not(.buttons) > li:nth-child(' + Math.floor($navItemLength / 2) + ')').css({ 14613 'margin-right': ($centerLogoWidth + $extraMenuSpace) + 'px' 14614 }).addClass('menu-item-with-margin'); 14615 } else { 14616 $('#header-outer[data-format="centered-logo-between-menu"] #top nav > .sf-menu:not(.buttons) > li:nth-child(' + Math.floor($navItemLength / 2) + ')').css({ 14617 'margin-left': ($centerLogoWidth + $extraMenuSpace) + 'px' 14618 }).addClass('menu-item-with-margin'); 14619 } 14620 14621 var $leftMenuWidth = 0; 14622 var $rightMenuWidth = 0; 14623 14624 $('#header-outer[data-format="centered-logo-between-menu"] #top nav > .sf-menu:not(.buttons) > li:not(#social-in-menu)').each(function (i) { 14625 if (i + 1 <= Math.floor($navItemLength / 2)) { 14626 $leftMenuWidth += $(this).width(); 14627 } else { 14628 $rightMenuWidth += $(this).width(); 14629 } 14630 14631 }); 14632 14633 var $menuDiff = Math.abs($rightMenuWidth - $leftMenuWidth); 14634 14635 if ($leftMenuWidth > $rightMenuWidth || ($body.hasClass('rtl') && $leftMenuWidth < $rightMenuWidth) ) { 14636 $('#header-outer #top .row > .col.span_9').css('padding-right', $menuDiff); 14637 } else { 14638 $('#header-outer #top .row > .col.span_9').css('padding-left', $menuDiff); 14639 } 14640 14641 $('#header-outer[data-format="centered-logo-between-menu"] nav').css('visibility', 'visible'); 14642 14643 } 14644 14645 else if ($('#header-outer[data-format="centered-logo-between-menu"]').length > 0 && nectarDOMInfo.winW < 1000) { 14646 $('#header-outer .row > .col.span_9').css({ 14647 'padding-right': '0', 14648 'padding-left': '0' 14649 }); 14650 } 14651 14652 } 14653 14654 14655 /** 14656 * Header layout "Centered logo between menu" initialization. 14657 * 14658 * @since 10.5 14659 */ 14660 function centeredLogoHeaderInit() { 14661 14662 if($('#header-outer[data-format="centered-logo-between-menu"]').length > 0) { 14663 14664 if(!usingLogoImage) { 14665 centeredLogoMargins(); 14666 } 14667 else if(usingLogoImage && $('#header-outer[data-format="centered-logo-between-menu"]').length > 0 && $('header#top #logo img:first[src]').length > 0) { 14668 14669 //fadein img on load 14670 var tempLogoImg = new Image(); 14671 tempLogoImg.src = $('header#top #logo img:first').attr('src'); 14672 14673 tempLogoImg.onload = function() { 14674 centeredLogoMargins(); 14675 }; 14676 14677 } 14678 14679 // Resize event. 14680 $window.on('smartresize', centeredLogoMargins); 14681 14682 } 14683 14684 } 14685 14686 14687 14688 14689 14690 14691 14692 14693 /** 14694 * Handle basic items before initializing effects. 14695 * 14696 * @since 10.5 14697 */ 14698 function headerNavPreInit() { 14699 14700 // Deactivate hide header until needed effect on mobile. 14701 if (nectarDOMInfo.usingMobileBrowser && $('#header-outer[data-remove-fixed="1"]').length == 0) { 14702 $body.attr('data-hhun', '0'); 14703 } 14704 14705 // Page fullscreen rows does not need permanent transparent. 14706 if ($('#nectar_fullscreen_rows').length > 0) { 14707 ($headerOuterEl.attr('data-permanent-transparent', 'false')); 14708 } 14709 14710 // Set mobile header height. 14711 if (nectarDOMInfo.usingMobileBrowser && $('#header-outer[data-mobile-fixed="1"]').length > 0 && 14712 $('#header-outer[data-transparent-header="true"]').length == 0) { 14713 $('#header-space').css('height', $headerOuterEl.outerHeight()); 14714 } 14715 14716 } 14717 14718 14719 14720 14721 14722 14723 /** 14724 * Hide header until needed. 14725 * 14726 * Used when "Header Hide Until Needed" is active. 14727 * 14728 * @since 10.5 14729 */ 14730 var hhunState = { 14731 timeoutQueued: false, 14732 visible: true 14733 } 14734 function hhunHeaderEffect() { 14735 14736 var previousScroll = 0, // previous scroll position 14737 menuOffset = ( headerTransparent == false && $('#page-header-bg[data-
14737parallax="1"]').length > 0 ) ? 200 : 60, // height of menu (once scroll passed it, menu is hidden) 14738 hideShowOffset = 3, // scrolling value after which triggers hide/show menu 14739 stickyPageSubmenu = ( $('.page-submenu[data-sticky="true"]').length > 0 ) ? true : false, 14740 bodyOffsetHeight = document.body.offsetHeight; 14741 14742 function getBodyHeight() { 14743 if( nectarDOMInfo.winW > 999 && nectarState.materialOffCanvasOpen != true ) { 14744 bodyOffsetHeight = document.body.offsetHeight; 14745 } 14746 } 14747 // Periodically update the body height. 14748 setInterval(getBodyHeight, 1500); 14749 14750 // Called in RAF loop to calculate the header visibility. 14751 function hhunCalcs() { 14752 14753 $headerOuterEl.addClass('detached'); 14754 14755 var currentScroll = nectarDOMInfo.scrollTop, // Gets current scroll position 14756 scrollDifference = Math.abs(currentScroll - previousScroll); // Calculates how fast user is scrolling 14757 14758 // Stop scrolling while animated anchors / box roll 14759 if ( nectarState.animatedScrolling == true && $('#header-outer.detached').length > 0 || nectarState.preventScroll == true ) { 14760 14761 if (nectarDOMInfo.winW > 999) { 14762 14763 if (currentScroll > menuOffset) { 14764 14765 // Remove transparent when clicking anchor from the top 14766 if( nectarState.animatedScrolling == true && headerTransparent == true && nectarState.permanentTransHeader == false ) { 14767 $headerOuterEl.removeClass('transparent').addClass('scrolling'); 14768 } 14769 14770 // Still keep scroll tracking to continue hiding menu. 14771 previousScroll = nectarDOMInfo.scrollTop; 14772 currentScroll = nectarDOMInfo.scrollTop; 14773 14774 } 14775 14776 requestAnimationFrame(hhunCalcs); 14777 return; 14778 } 14779 } 14780 14781 // Stop when material ocm or material search is open 14782 if ( nectarState.materialOffCanvasOpen == true || nectarState.materialSearchOpen == true ) { 14783 if (nectarDOMInfo.winW > 999) { 14784 14785 // Still handle transparency when scrolling with material search open. 14786 if( nectarState.materialSearchOpen == true && headerTransparent == true) { 14787 14788 if( nectarState.permanentTransHeader == false && currentScroll > menuOffset ) { 14789 $headerOuterEl.removeClass('transparent').addClass('scrolling'); 14790 } else { 14791 $headerOuterEl.addClass('transparent').removeClass('scrolling'); 14792 } 14793 14794 } 14795 14796 requestAnimationFrame(hhunCalcs); 14797 return; 14798 } 14799 } 14800 14801 // Stop on mobile if not using sticky option 14802 if (headerMobileFixed == false && nectarDOMInfo.winW < 1000) { 14803 $headerOuterEl.removeClass('detached').removeClass('scrolling'); 14804 return; 14805 } 14806 14807 14808 if (!$headerOuterEl.hasClass('side-widget-open') && !$('#header-outer .slide-out-widget-area-toggle a').hasClass('animating')) { 14809 14810 var heightToAdjust; 14811 14812 // Remove transparent and body border margin 14813 if (currentScroll > 1) { 14814 14815 // Handle secondary header 14816 if ($headerSecondaryEl.length > 0) { 14817 if (currentScroll > menuOffset) { 14818 $headerSecondaryEl.addClass('hide-up'); 14819 $headerOuterEl.css('transform', 'translateY(-' + nectarDOMInfo.secondaryHeaderHeight + 'px)'); 14820 } else { 14821 $headerSecondaryEl.removeClass('hide-up'); 14822 $headerOuterEl.css('transform', '0px)'); 14823 } 14824 } 14825 14826 } 14827 14828 // Scrolled past menu 14829 if (currentScroll > menuOffset) { 14830 14831 // Handle transparency 14832 if ( nectarState.permanentTransHeader == false ) { 14833 14834 if( hhunState.timeoutQueued == false ) { 14835 setTimeout(function() { 14836 $headerOuterEl.removeClass('transparent'); 14837 $headerOuterEl.addClass('scrolling'); 14838 hhunState.timeoutQueued = false; 14839 },400); 14840 } 14841 hhunState.timeoutQueued = true; 14842 14843 } 14844 14845 // Scrolled past detach point add class to fix menu 14846 if (!$headerOuterEl.hasClass('detached')) { 14847 14848 $headerOuterEl 14849 .addClass('detached') 14850 .removeClass('parallax-contained'); 14851 } 14852 14853 $headerOuterEl.removeClass('no-transition'); 14854 14855 14856 // Scrolling faster than hideShowOffset hide/show menu 14857 if (scrollDifference >= hideShowOffset) { 14858 14859 if (currentScroll > previousScroll) { 14860 14861 // Hide menu 14862 if (!$headerOuterEl.hasClass('invisible')) { 14863 14864 $headerOuterEl 14865 .addClass('invisible') 14866 .removeClass('at-top'); 14867 14868 // Close submenus 14869 if ($(".sf-menu").length > 0 && $().superfish) { 14870 $(".sf-menu").superfish('hide'); 14871 $('header#top nav > ul.sf-menu > li.menu-item-over').removeClass('menu-item-over'); 14872 } 14873 14874 } 14875 14876 if( stickyPageSubmenu == true ) { 14877 $('.page-submenu.stuck') 14878 .css('transform', 'translateY(0px)') 14879 .addClass('header-not-visible'); 14880 } 14881 14882 } else { 14883 14884 // Show menu 14885 if ($headerOuterEl.hasClass('invisible')) { 14886 $headerOuterEl.removeClass('invisible'); 14887 } 14888 14889 // Page submenu adjust 14890 if( stickyPageSubmenu == true ) { 14891 14892 heightToAdjust = $headerOuterEl.outerHeight(); 14893 14894 if( $headerSecondaryEl.length > 0) { 14895 heightToAdjust -= nectarDOMInfo.secondaryHeaderHeight; 14896 } 14897 14898 if ($bodyBorderTop.length > 0 && $('body.mobile').length == 0) { 14899 14900 $bodyBorderSizeToRemove = ($bodyBorderHeaderColorMatch) ? $bodyBorderTop.height() : 0; 14901 14902 $('.page-submenu.stuck') 14903 .css('transform', 'translateY(' + (heightToAdjust - $bodyBorderSizeToRemove) + 'px)') 14904 .removeClass('header-not-visible'); 14905 14906 } else { 14907 $('.page-submenu.stuck') 14908 .css('transform', 'translateY(' + heightToAdjust + 'px)') 14909 .removeClass('header-not-visible'); 14910 } 14911 14912 } // End sticky page sub conditional. 14913 14914 } 14915 14916 } 14917 14918 } 14919 else { 14920 // At top of document. 14921 var $topDetachNum = ($('#header-outer[data-using-secondary="1"]').length > 0) ? 32 : 0; 14922 if ($bodyBorderTop.length > 0) { 14923 $topDetachNum = ($('#header-outer[data-using-secondary="1"]').length > 0) ? 32 + $bodyBorderTop.height() : $bodyBorderTop.height(); 14924 } 14925 14926 if (currentScroll <= $topDetachNum) { 14927 14928 $headerOuterEl 14929 .addClass('at-top') 14930 .removeClass('invisible') 14931 .removeClass('scrolling'); 14932 14933 // Megamenu removes transparent. 14934 if ($('#header-outer[data-megamenu-rt="1"]').length > 0 && 14935 headerTransparent == true && 14936 $('#header-outer .megamenu').length > 0) { 14937 14938 if ($('.nectar-box-roll').length == 0 && 14939 $('.megamenu.sfHover:not(.width-75):not(.width-50)').length == 0) { 14940 14941 $headerOuterEl 14942 .addClass('transparent') 14943 .css('transform', 'translateY(0)') 14944 .removeClass('no-transition'); 14945 14946 } else if ($('.nectar-box-roll').length > 0) { 14947 14948 $headerOuterEl 14949 .css('transform', 'translateY(0)') 14950 .addClass('at-top-before-box'); 14951 } 14952 14953 } else { 14954 14955 if (headerTransparent == true && 14956 $('.nectar-box-roll').length == 0) { 14957 14958 $headerOuterEl 14959 .addClass('transparent') 14960 .css('transform', 'translateY(0)'); 14961 14962 } else if ($('.nectar-box-roll').length > 0) { 14963 14964 $headerOuterEl 14965 .css('transform', 'translateY(0)') 14966 .addClass('at-top-before-box'); 14967 } 14968 } 14969
14970 if ($('#page-header-bg[data-parallax="1"]').length > 0) { 14971 14972 $headerOuterEl 14973 .addClass('parallax-contained') 14974 .css('transform', 'translateY(0)'); 14975 } 14976 14977 } 14978 14979 } 14980 14981 // At the bottom of document - show menu 14982 if ((nectarDOMInfo.winH + nectarDOMInfo.scrollTop) >= bodyOffsetHeight) { 14983 14984 $headerOuterEl.removeClass('invisible'); 14985 14986 // Page submenu adjust 14987 if( stickyPageSubmenu == true ) { 14988 14989 heightToAdjust = $headerOuterEl.outerHeight(); 14990 if( $headerSecondaryEl.length > 0) { 14991 heightToAdjust -= nectarDOMInfo.secondaryHeaderHeight; 14992 } 14993 14994 if ($bodyBorderTop.length > 0 && $('body.mobile').length == 0) { 14995 14996 $bodyBorderSizeToRemove = ($bodyBorderHeaderColorMatch) ? $bodyBorderTop.height() : 0; 14997 $('.page-submenu.stuck') 14998 .css('transform', 'translateY(' + (heightToAdjust - $bodyBorderSizeToRemove) + 'px)') 14999 .removeClass('header-not-visible'); 15000 } else { 15001 15002 $('.page-submenu.stuck') 15003 .css('transform', 'translateY(' + heightToAdjust + 'px)') 15004 .removeClass('header-not-visible'); 15005 } 15006 15007 } // End sticky page submenu conditional. 15008 15009 } 15010 15011 } 15012 15013 // Keep track of current scroll position 15014 previousScroll = currentScroll; 15015 15016 if (nectarDOMInfo.winW > 999) { 15017 requestAnimationFrame(hhunCalcs); 15018 } 15019 15020 } 15021 15022 // Start the animation loop. 15023 hhunCalcs(); 15024 15025 } 15026 15027 15028 15029 /** 15030 * Shrink the header navigation size. 15031 * 15032 * Used when "Header Resize On Scroll" is active. 15033 * 15034 * @since 1.0 15035 */ 15036 function smallNav() { 15037 15038 var $offset = nectarDOMInfo.scrollTop, 15039 $windowWidth = nectarDOMInfo.winW, 15040 $scrollTriggerOffset = 30; 15041 15042 if( headerTransparent == true ) { 15043 $scrollTriggerOffset = 0; 15044 } 15045 15046 if ($offset > $scrollTriggerOffset && $windowWidth >= 1000 && $('body.material-ocm-open').length == 0) { 15047 15048 15049 // Going to small when material search is closing, it must be closed immediately 15050 if ($body.is('.material')) { 15051 15052 if ($('#search-outer.material-open').length == 0) { 15053 $('#header-outer[data-transparent-header="true"] .bg-color-stripe').css('transition', 'none'); 15054 } 15055 15056 // Secondary header 15057 if ($headerSecondaryEl.length > 0) { 15058 $headerSecondaryEl.addClass('hide-up'); 15059 $headerOuterEl.css('transform', 'translateY(-' + nectarDOMInfo.secondaryHeaderHeight + 'px)'); 15060 } 15061 15062 } 15063 15064 if ($('#header-outer[data-megamenu-rt="1"]').length > 0 && 15065 $('#header-outer[data-transparent-header="true"]').length > 0 && 15066 $('#header-outer .megamenu').length > 0) { 15067 15068 if ($headerOuterEl.attr('data-transparent-header') == 'true' && 15069 $('#header-outer.side-widget-open').length == 0 && 15070 $('#header-outer[data-permanent-transparent="1"]').length == 0 && 15071 $('.megamenu.sfHover:not(.width-75):not(.width-50)').length == 0) { 15072 $headerOuterEl.removeClass('transparent'); 15073 $headerOuterEl.removeClass('no-transition'); 15074 } 15075 15076 } else { 15077 15078 if ($headerOuterEl.attr('data-transparent-header') == 'true' && 15079 $('#header-outer.side-widget-open').length == 0 && 15080 $('#header-outer[data-permanent-transparent="1"]').length == 0) { 15081 $headerOuterEl.removeClass('transparent'); 15082 } 15083 15084 } 15085 15086 // Centered logo between menu. 15087 $('#header-outer:not(.small-nav) header#top nav > ul > li.menu-item-with-margin').stop(true, true).animate({ 15088 'margin-right': (parseInt($('header#top nav > ul > li.menu-item-with-margin').css('margin-right')) - parseInt(logoShrinkNum) * 3) + 'px' 15089 }, { 15090 queue: false, 15091 duration: 250, 15092 easing: 'easeOutCubic' 15093 }); 15094 15095 // Add small nav class. 15096 $('#header-outer, #search-outer').addClass('small-nav'); 15097 15098 // Body border full width side padding 15099 if ($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 && 15100 $bodyBorderTop.length > 0 && 15101 $bodyBorderHeaderColorMatch == true) { 15102 15103 $('#header-outer[data-full-width="true"] header > .container').stop(true, true).animate({ 15104 'padding': '0' 15105 }, { 15106 queue: false, 15107 duration: 250, 15108 easing: 'easeOutCubic' 15109 });
15110 15111 } 15112 15113 15114 // Box roll effect 15115 if ($('.nectar-box-roll').length > 0 && $('#header-outer[data-permanent-transparent="1"]').length == 0) { 15116 $('#ajax-content-wrap').animate({ 15117 'margin-top': (Math.floor(($logoHeight - logoShrinkNum) + (headerPadding * 2) / 1.8 + nectarDOMInfo.adminBarHeight + nectarDOMInfo.secondaryHeaderHeight)) 15118 }, { 15119 queue: false, 15120 duration: 250, 15121 easing: 'easeOutCubic' 15122 }); 15123 } 15124 15125 $window.off('scroll.headerResizeEffect', smallNav); 15126 $window.on('scroll.headerResizeEffect', bigNav); 15127 15128 // Dark slider coloring border 15129 $('#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'); 15130 $('#header-outer[data-transparent-header="true"] .cart-menu').css('transition', 'none'); 15131 setTimeout(function () { 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, border-color 0.30s ease, margin 0.25s ease-out'); 15133 $('#header-outer[data-transparent-header="true"] .cart-menu').css('transition', 'border-color 0.30s ease'); 15134 }, 300); 15135 15136 } 15137 15138 } 15139 15140 15141 /** 15142 * Return header navigation size to full. 15143 * 15144 * Used when "Header Resize On Scroll" is active. 15145 * 15146 * @since 1.0 15147 */ 15148 function bigNav() { 15149 15150 var $offset = nectarDOMInfo.scrollTop, 15151 $windowWidth = nectarDOMInfo.winW, 15152 $scrollTriggerOffset = 30; 15153 15154 if ($body.is('.material-ocm-open')) { 15155 return false; 15156 } 15157 15158 if( headerTransparent == true ) { 15159 $scrollTriggerOffset = 0; 15160 } 15161 15162 if ($offset <= $scrollTriggerOffset && $windowWidth >= 1000 || $('.small-nav').length > 0 && $('#ajax-content-wrap.no-scroll').length > 0) { 15163 15164 $('#header-outer, #search-outer').removeClass('small-nav'); 15165 15166 if ($('#header-outer[data-megamenu-rt="1"]').length > 0 && 15167 $('#header-outer[data-transparent-header="true"]').length > 0 && 15168 $('#header-outer .megamenu').length > 0) { 15169 15170 if ($headerOuterEl.attr('data-transparent-header') == 'true' && 15171 $('.nectar-box-roll').length == 0 && 15172 $('.megamenu.sfHover:not(.width-75):not(.width-50)').length == 0) { 15173 15174 $headerOuterEl.addClass('transparent'); 15175 $headerOuterEl.removeClass('no-transition'); 15176 } 15177 15178 } else { 15179 15180 if ($headerOuterEl.attr('data-transparent-header') == 'true' && $('.nectar-box-roll').length == 0) { 15181 $headerOuterEl.addClass('transparent'); 15182 } 15183 15184 } 15185 15186 // Body border full width side padding 15187 if ($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 && 15188 $bodyBorderTop.length > 0 && 15189 $bodyBorderHeaderColorMatch == true) { 15190 15191 $('#header-outer[data-full-width="true"] header > .container').stop(true, true).animate({ 15192 'padding': '0 28px' 15193 }, { 15194 queue: false, 15195 duration: 250, 15196 easing: 'easeOutCubic' 15197 }); 15198 15199 } 15200 15201 // centered logo between menu. 15202 $('header#top nav > ul > li.menu-item-with-margin').stop(true, true).animate({ 15203 'margin-right': (parseInt($('header#top nav > ul > li.menu-item-with-margin').css('margin-right')) + parseInt(logoShrinkNum) * 3) + 'px' 15204 }, { 15205 queue: false, 15206 duration: 150, 15207 easing: 'easeOutCubic' 15208 }); 15209 15210 15211 // Secondary header 15212 if ($headerSecondaryEl.length > 0) { 15213 15214 $headerSecondaryEl.removeClass('hide-up'); 15215 $headerOuterEl 15216 .removeClass('hide-up') 15217 .css('transform', 'translateY(0%)'); 15218 15219 } 15220 15221 // Box roll 15222 if ($('.nectar-box-roll').length > 0 && $('#header-outer[data-permanent-transparent="1"]').length == 0) { 15223 $('#ajax-content-wrap').animate({ 15224 'margin-top': (Math.floor(($logoHeight) + (headerPadding * 2) + nectarDOMInfo.adminBarHeight + nectarDOMInfo.secondaryHeaderHeight)) 15225 }, { 15226 queue: false, 15227 duration: 250, 15228 easing: 'easeOutCubic' 15229 });
15230 } 15231 15232 $window.off('scroll.headerResizeEffect', bigNav); 15233 $window.on('scroll.headerResizeEffect', smallNav); 15234 15235 // Dark slider coloring border 15236 $('#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'); 15237 $('#header-outer[data-transparent-header="true"] .cart-menu').css('transition', 'none'); 15238 setTimeout(function () { 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, border-color 0.30s ease, margin 0.25s ease-out'); 15240 $('#header-outer[data-transparent-header="true"] .cart-menu').css('transition', 'border-color 0.30s ease'); 15241 }, 300); 15242 } 15243 15244 } 15245 15246 15247 15248 /** 15249 * Default scroll event to handle transparency/secondary header when no header effects are enabled. 15250 * 15251 * @since 4.0 15252 */ 15253 function opaqueCheck() { 15254 15255 // The condense header effect will bypass this unless in the custom mobile breakpoint (which is defined in theme options). 15256 if ($('#header-outer[data-format="centered-menu-bottom-bar"][data-condense="true"]').length > 0 && !$headerOuterEl.hasClass('within-custom-breakpoint') ) { 15257 return; 15258 } 15259 15260 if (nectarDOMInfo.scrollTop > 0) { 15261 15262 if ($('body.material').length > 0) { 15263 $headerOuterEl.addClass('scrolled-down'); 15264 15265 // Secondary header 15266 if ($headerSecondaryEl.length > 0 && nectarDOMInfo.winW > 1000) { 15267 $headerSecondaryEl.addClass('hide-up'); 15268 $headerOuterEl.css('transform', 'translateY(-' + nectarDOMInfo.secondaryHeaderHeight + 'px)'); 15269 } 15270 } 15271 15272 if ($headerOuterEl.attr('data-transparent-header') == 'true' && $('#header-outer[data-permanent-transparent="1"]').length == 0) { 15273 $headerOuterEl.removeClass('transparent').addClass('scrolled-down'); 15274 } 15275 15276 // Switch event to watch. 15277 $window.off('scroll.headerResizeEffectOpaque', opaqueCheck); 15278 $window.on('scroll.headerResizeEffectOpaque', transparentCheck); 15279 } 15280 } 15281 15282 15283 /** 15284 * Default scroll event to handle transparency/secondary header when no header effects are enabled. 15285 * 15286 * @since 4.0 15287 */ 15288 function transparentCheck() { 15289 15290 // The condense header effect will bypass this unless in the custom mobile breakpoint (which is defined in theme options). 15291 if ($('#header-outer[data-format="centered-menu-bottom-bar"][data-condense="true"]').length > 0 && !$headerOuterEl.hasClass('within-custom-breakpoint') ) { 15292 return; 15293 } 15294 15295 if (nectarDOMInfo.scrollTop == 0 && $('body.material-ocm-open').length == 0) { 15296 15297 if ($('#header-outer[data-megamenu-rt="1"]').length > 0 && 15298 $('#header-outer[data-transparent-header="true"]').length > 0 && 15299 $('#header-outer .megamenu').length > 0) { 15300 15301 if ($headerOuterEl.attr('data-transparent-header') == 'true' && $('.megamenu.sfHover:not(.width-75):not(.width-50)').length == 0) { 15302 15303 $headerOuterEl 15304 .addClass('transparent') 15305 .removeClass('scrolled-down'); 15306 15307 $headerOuterEl.removeClass('no-transition'); 15308 15309 } else if ($headerOuterEl.attr('data-transparent-header') == 'true') { 15310 15311 $headerOuterEl.removeClass('scrolled-down'); 15312 } 15313 15314 } else { 15315 15316 if ($headerOuterEl.attr('data-transparent-header') == 'true') { 15317 $headerOuterEl 15318 .addClass('transparent') 15319 .removeClass('scrolled-down'); 15320 } 15321 15322 } 15323 15324 if ($('body.material').length > 0) { 15325 $headerOuterEl.removeClass('scrolled-down'); 15326 15327 // Secondary header 15328 if ($headerSecondaryEl.length > 0 && nectarDOMInfo.winW > 1000) { 15329 15330 $headerSecondaryEl.removeClass('hide-up'); 15331 $headerOuterEl 15332 .removeClass('hide-up') 15333 .css('transform', 'translateY(0%)'); 15334 } 15335 } 15336 15337 // Switch event to watch. 15338 $window.off('scroll.headerResizeEffectOpaque', transparentCheck); 15339 $window.on('scroll.headerResizeEffectOpaque', opaqueCheck); 15340 } 15341 15342 } 15343 15344 15345 15346 15347 /** 15348 * Mobile header event for handling transparency/secondary header. 15349 * 15350 * @since 10.5 15351 * @see bindScrollEffectsMobile 15352 */ 15353 function mobileHeaderRAF() { 15354 15355 if ( nectarState.materialOffCanvasOpen == true ) { 15356 requestAnimationFrame(mobileHeaderRAF); 15357 return; 15358 } 15359 // Scrolled down. 15360 if (nectarDOMInfo.scrollTop > 5 ) { 15361 15362 if( nectarState.mobileHeader != 'scrolled' ) { 15363 15364 if ( nectarState.permanentTransHeader == false ) { 15365 $headerOuterEl.removeClass('transparent'); 15366 } 15367 15368 if (nectarDOMInfo.secondaryHeaderHeight > 0) { 15369 $headerSecondaryEl.addClass('hide-up'); 15370 $headerOuterEl.css('transform', 'translateY(-' + nectarDOMInfo.secondaryHeaderHeight + 'px)').addClass('hidden-secondary'); 15371 } else { 15372 $headerOuterEl.removeClass('hidden-secondary'); 15373 } 15374 15375 $headerOuterEl.addClass('scrolled-down'); 15376 15377 // Update state. 15378 nectarState.mobileHeader = 'scrolled'; 15379 } 15380 15381 } 15382 // At top. 15383 else { 15384 15385 if( nectarState.mobileHeader != 'at-top' ) { 15386 15387 if ($headerOuterEl.attr('data-transparent-header') == 'true') { 15388 $headerOuterEl.addClass('transparent'); 15389 } 15390 15391 if (nectarDOMInfo.secondaryHeaderHeight > 0) { 15392 $headerSecondaryEl.removeClass('hide-up'); 15393 $headerOuterEl.css('transform', 'translateY(0px)'); 15394 } 15395 $headerOuterEl.removeClass('hidden-secondary').removeClass('scrolled-down'); 15396 15397 // Update state. 15398 nectarState.mobileHeader = 'at-top'; 15399 } 15400 15401 } 15402 15403 if (nectarDOMInfo.winW < 1000) { 15404 requestAnimationFrame(mobileHeaderRAF); 15405 } 15406 } 15407 15408 15409 15410 /** 15411 * Bind mobile header scroll effects. 15412 * 15413 * @since 10.5 15414 * @see headerNavScrollInit 15415 */ 15416 function bindScrollEffectsMobile() { 15417 15418 if (nectarDOMInfo.winW > 999) { 15419 return; 15420 } 15421 15422 // Reset state. 15423 nectarState.mobileHeader = ''; 15424 15425 // Unbind desktop effects. 15426 $window.off('scroll.headerResizeEffect'); 15427 $window.off('scroll.headerResizeEffectOpaque'); 15428 15429 // Remove HHUN classes. 15430 $headerOuterEl 15431 .removeClass('scrolled-down') 15432 .removeClass('detached') 15433 .removeClass('invisible') 15434 .removeClass('at-top') 15435 .css('transform', 'none'); 15436 15437 // Handle mobile transparent class. 15438 if ($('#header-outer[data-mobile-fixed="1"]').length > 0) { 15439 requestAnimationFrame(mobileHeaderRAF); 15440 } else if ($headerOuterEl.attr('data-transparent-header') == 'true') { 15441 $headerOuterEl.addClass('transparent'); 15442 } 15443 15444 $window.off('smartresize.nectarNavScrollEffects'); 15445 $window.on('smartresize.nectarNavScrollEffects', bindScrollEffectsDesktop); 15446 15447 } 15448 15449 /** 15450 * Bind deaktop header scroll effects. 15451 * 15452 * @since 10.5 15453 * @see headerNavScrollInit 15454 */ 15455 function bindScrollEffectsDesktop() { 15456 15457 if (nectarDOMInfo.winW < 1000) { 15458 return; 15459 } 15460 15461 if (headerResize == true && headerHideUntilNeeded != '1') { 15462 15463 $window.off('scroll.headerResizeEffect'); 15464 15465 if ($('#nectar_fullscreen_rows').length == 0) { 15466 $window.on('scroll.headerResizeEffect', smallNav); 15467 } else if ($('#nectar_fullscreen_rows[data-mobile-disable="on"]').length > 0 && nectarDOMInfo.usingMobileBrowser) { 15468 $window.on('scroll.headerResizeEffect', smallNav); 15469 } 15470 15471 } else if (headerHideUntilNeeded != '1') { 15472 15473 $window.off('scroll.headerResizeEffectOpaque'); 15474 $window.on('scroll.headerResizeEffectOpaque', opaqueCheck); 15475 15476 }
15476 else if (headerHideUntilNeeded == '1') { 15477 15478 15479 if ($('.nectar-box-roll').length > 0) { 15480 $headerOuterEl.addClass('at-top-before-box'); 15481 } 15482 15483 // Don't trigger for header remove stickiness. 15484 if ($('#header-outer[data-remove-fixed="1"]').length == 0) { 15485 hhunHeaderEffect(); 15486 } 15487 15488 } //end if hhun 15489 15490 // Condense header effect coming from mobile. 15491 if ($('#header-outer[data-format="centered-menu-bottom-bar"][data-condense="true"]').length > 0 ) { 15492 15493 if( $headerSecondaryEl.length > 0 ) { 15494 // Remove transform. 15495 $headerOuterEl.css('transform',''); 15496 } 15497 15498 if ( nectarDOMInfo.scrollTop > 200 && !$headerOuterEl.hasClass('fixed-menu') ) { 15499 $headerOuterEl.addClass('fixed-menu'); 15500 } 15501 15502 } 15503 15504 // Only bind mobile if applicable. 15505 15506 $window.off('smartresize.nectarNavScrollEffects'); 15507 $window.on('smartresize.nectarNavScrollEffects', bindScrollEffectsMobile); 15508 15509 } 15510 15511 15512 15513 /** 15514 * Header Navigation scroll events initialization. 15515 * 15516 * @since 10.5 15517 */ 15518 function headerNavScrollInit() { 15519 15520 // Remove transparent class if page loaded further down. 15521 if ($('#header-outer[data-remove-fixed="1"]').length == 0 && nectarDOMInfo.winW > 1000) { 15522 if ( $(window).scrollTop() != 0 && $('#header-outer.transparent[data-permanent-transparent="false"]').length == 1) { 15523 $headerOuterEl.removeClass('transparent'); 15524 } 15525 } 15526 15527 // Permanent transparent header. 15528 if ($('#nectar_fullscreen_rows').length == 0 && $('.nectar-box-roll').length == 0) { 15529 midnightInit(); 15530 } 15531 15532 // Determine which events to bind at start. 15533 if (nectarDOMInfo.winW < 1000 && $('.nectar-box-roll').length == 0) { 15534 bindScrollEffectsMobile(); 15535 $window.on('smartresize.nectarNavScrollEffects', bindScrollEffectsMobile); 15536 } else { 15537 bindScrollEffectsDesktop(); 15538 $window.on('smartresize.nectarNavScrollEffects', bindScrollEffectsDesktop); 15539 } 15540 15541 } 15542 15543 15544 15545 15546 15547 15548 /** 15549 * Set the header space div height. 15550 * 15551 * @since 10.5 15552 */ 15553 function headerSpace() { 15554 15555 if ($('.mobile').length > 0) { 15556 15557 if (nectarDOMInfo.winH < nectarDOMInfo.winW && nectarDOMInfo.winW > 1000) { 15558 if ($('#header-outer.small-nav').length == 0) { 15559 $('#header-space').css('height', $headerOuterEl.outerHeight()); 15560 } 15561 } else { 15562 $('#header-space').css('height', $headerOuterEl.outerHeight()); 15563 } 15564 15565 } else { 15566 15567 if ($('.nectar-parallax-scene.first-section').length == 0) { 15568 15569 var headerPadding2 = headerPadding - headerPadding / 1.8; 15570 var $headerHeight = ($('#header-outer[data-header-resize="1"]').length > 0 && $('.small-nav').length > 0) ? $headerOuterEl.outerHeight() + (parseInt(logoShrinkNum) + headerPadding2 * 2) : $headerOuterEl.outerHeight(); 15571 15572 // Is the calculation greater than the margin of error? 15573 if( Math.abs($headerHeight - $('#header-space').height()) > 7) { 15574 $('#header-space').css('height', $headerHeight); 15575 } 15576 15577 15578 } 15579 15580 } 15581 15582 } 15583 15584 15585 15586 /** 15587 * Handle header nav distance away from top to account for admin bar. 15588 * 15589 * @since 10.5 15590 */ 15591 15592 function headerNavOffsetInit() { 15593 15594 var lastPosition = -1; 15595 var $headerScrollTop = nectarDOMInfo.scrollTop; 15596 15597 // Verify scroll pos has changed before calculating. 15598 function headerOffsetAdjust() { 15599 15600 if ( $body.hasClass('compose-mode') ) { 15601 return; 15602 } 15603 15604 $headerScrollTop = nectarDOMInfo.scrollTop; 15605 15606 if (lastPosition == $headerScrollTop) { 15607 requestAnimationFrame(headerOffsetAdjust); 15608 return false; 15609 } else { 15610 lastPosition = $headerScrollTop; 15611 } 15612 15613 headerOffsetAdjustCalc(); 15614 requestAnimationFrame(headerOffsetAdjust); 15615 15616 } 15617 15618 // Called when scrolling occurs. 15619 function headerOffsetAdjustCalc() { 15620 15621 var $eleHeight = 0; 15622 15623 // Mobile. 15624 if (nectarDOMInfo.winW < 1000 || 15625 (condenseHeaderLayout == true && $('#header-outer .span_9').css('display') == 'none') || 15626 (condenseHeaderLayout == true && $('#header-outer .span_9 > nav').css('display') == 'none')) { 15627 15628 $eleHeight = 0; 15629 var $endOffset = ($wpAdminBar.css('position') == 'fixed') ? $wpAdminBar.height() : 0; 15630 15631 $eleHeight += nectarDOMInfo.adminBarHeight; 15632 15633 if ($eleHeight - $headerScrollTop > $endOffset) { 15634 $headerOuterEl.css('top', $eleHeight - $headerScrollTop + 'px'); 15635 } else { 15636 $headerOuterEl.css('top', $endOffset); 15637 } 15638 15639 } 15640 // Desktop 15641 else { 15642 if ( condenseHeaderLayout == false ) { 15643 15644 $eleHeight = 0; 15645 15646 if( !$headerOuterEl.is('[data-remove-fixed="1"]') ) { 15647 $eleHeight += nectarDOMInfo.adminBarHeight; 15648 } 15649 $headerOuterEl.css('top', $eleHeight + 'px'); 15650 } 15651 } 15652 15653 } 15654 15655 // Bind event and begin if needed. 15656 if ($('#header-outer[data-mobile-fixed="1"]').length > 0 && $wpAdminBar.length > 0) { 15657 15658 if ($('#nectar_fullscreen_rows').length == 0) { 15659 requestAnimationFrame(headerOffsetAdjust); 15660 } else if ($('#nectar_fullscreen_rows').length > 0 && nectarDOMInfo.usingMobileBrowser) { 15661 requestAnimationFrame(headerOffsetAdjust); 15662 } 15663 15664 $window.on('smartresize', headerOffsetAdjustCalc); 15665 15666 } 15667 15668 } 15669 15670 15671 15672 15673 15674 15675 15676 /** 15677 * Calculate the minimum body height when using the footer reveal effect or material OCM 15678 * 15679 * @since 7.0 15680 */ 15681 function footerRevealCalcs() { 15682 15683 var $headerNavSpace = 0; 15684 var pageHeaderHeight = 0; 15685 15686 if( $headerOuterEl.is('[data-logo-height]') && $headerOuterEl.is('[data-padding]') ) { 15687 15688 if( !$headerOuterEl.hasClass('transparent') ) { 15689 15690 if( $headerOuterEl.find('#logo.no-image').length > 0 ) { 15691 $headerNavSpace = ( headerLayoutFormat == 'left-header' && nectarDOMInfo.winW > 1000) ? 0 : parseInt($headerOuterEl.find('#logo.no-image').height()) + (parseInt($headerOuterEl.attr('data-padding')*2)); 15692 } else { 15693 $headerNavSpace = ( headerLayoutFormat == 'left-header' && nectarDOMInfo.winW > 1000) ? 0 : parseInt($headerOuterEl.attr('data-logo-height')) + (parseInt($headerOuterEl.attr('data-padding')*2)); 15694 } 15695 15696 } 15697 15698 } else { 15699 $headerNavSpace = ( headerLayoutFormat == 'left-header' && nectarDOMInfo.winW > 1000) ? 0 : $headerOuterEl.outerHeight(); 15700 } 15701 15702 if( $pageHeaderBG.length > 0 ) { 15703 pageHeaderHeight += $pageHeaderBG.height(); 15704 } 15705 if( $('.page-header-no-bg').length > 0 ) { 15706 pageHeaderHeight += $('.page-header-no-bg').height(); 15707 } 15708 15709 if (nectarDOMInfo.winH - nectarDOMInfo.adminBarHeight - $headerNavSpace - nectarDOMInfo.footerOuterHeight - 1 - pageHeaderHeight > 0) { 15710 15711 var $resizeExtra = ($('body:not(.material) #header-outer[data-header-resize="1"]').length > 0) ? 55 : 0; 15712 15713 $('body[data-footer-reveal="1"]:not(.nectar_using_pfsr) .container-wrap').css({ 15714 'margin-bottom': nectarDOMInfo.footerOuterHeight 15715 });
15716 15717 $('.container-wrap').css({ 15718 'min-height': nectarDOMInfo.winH - nectarDOMInfo.adminBarHeight - $headerNavSpace - nectarDOMInfo.footerOuterHeight - pageHeaderHeight + $resizeExtra 15719 }); 15720 15721 } else { 15722 $('body[data-footer-reveal="1"]:not(.nectar_using_pfsr) .container-wrap').css({ 15723 'margin-bottom': nectarDOMInfo.footerOuterHeight 15724 }); 15725 } 15726 15727 if (nectarDOMInfo.winW < 1000) { 15728 $footerOuterEl.attr('data-midnight', 'light'); 15729 } 15730 else { 15731 $footerOuterEl.removeAttr('data-midnight'); 15732 } 15733 } 15734 15735 15736 /** 15737 * Initialize footer reveal and bind event 15738 * 15739 * @since 10.5 15740 */ 15741 function footerRevealInit() { 15742 15743 if ($('body[data-footer-reveal="1"]').length > 0 || $('body.material[data-slide-out-widget-area-style="slide-out-from-right"]').length > 0) { 15744 15745 setTimeout(footerRevealCalcs, 60); 15746 footerRevealCalcs(); 15747 15748 $window.on('resize', footerRevealCalcs); 15749 15750 if ($('body[data-footer-reveal="1"][data-footer-reveal-shadow="large_2"]').length > 0) { 15751 $('.container-wrap').css({ 15752 boxShadow: '0 70px 110px -30px ' + $footerOuterEl.css('backgroundColor') 15753 }); 15754 } 15755 15756 } 15757 15758 } 15759 15760 15761 15762 15763 15764 /** 15765 * Switch header navigation BG color to match row BG color that is passes. 15766 * 15767 * Only called when using "Header Inherit Row Color" option. 15768 * 15769 * @since 5.0 15770 */ 15771 function headerRowColorInheritInit() { 15772 15773 if ($('body[data-header-inherit-rc="true"]').length > 0 && $('.mobile').length == 0 && $('#header-outer[data-transparent-header="true"]').length > 0 ) { 15774 15775 var headerOffset = $logoHeight / 2 + headerPadding + nectarDOMInfo.adminBarHeight; 15776 15777 if( $('#header-outer[data-permanent-transparent="1"]').length == 0 ) { 15778 headerOffset = ($logoHeight - logoShrinkNum) + Math.ceil((headerPadding * 2) / 1.8) + nectarDOMInfo.adminBarHeight; 15779 } 15780 15781 $('.main-content > .row > .wpb_row').each(function () { 15782 15783 var $that = $(this); 15784 var $textColor; 15785 15786 var waypoint = new Waypoint({ 15787 element: $that, 15788 handler: function (direction) { 15789 15790 //User is scrolling down. 15791 if (direction == 'down') { 15792 15793 if ($that.find('.row-bg.using-bg-color').length > 0) { 15794 15795 $textColor = ($that.find('> .col.span_12.light').length > 0) ? 'light-text' : 'dark-text'; 15796 15797 $headerOuterEl 15798 .css('background-color', $that.find('.row-bg').css('background-color')) 15799 .removeClass('light-text') 15800 .removeClass('dark-text') 15801 .addClass($textColor); 15802 15803 $headerOuterEl.attr('data-current-row-bg-color', $that.find('.row-bg').css('background-color')); 15804 $('body.material #header-outer .bg-color-stripe').css('background-color', $that.find('.row-bg').css('background-color')); 15805 15806 } else { 15807 15808 $headerOuterEl 15809 .css('background-color', $headerOuterEl.attr('data-user-set-bg')) 15810 .removeClass('light-text') 15811 .removeClass('dark-text'); 15812 15813 $headerOuterEl.attr('data-current-row-bg-color', $headerOuterEl.attr('data-user-set-bg')); 15814 $('body.material #header-outer .bg-color-stripe').css('background-color', ''); 15815 15816 } 15817 15818 } 15819 15820 //User is scrolling up. 15821 else { 15822 15823 if ($that.prev('div.wpb_row').find('.row-bg.using-bg-color').length > 0) { 15824 15825 $textColor = ($that.prev('div.wpb_row').find('> .col.span_12.light').length > 0) ? 'light-text' : 'dark-text'; 15826 15827 $headerOuterEl 15828 .css('background-color', $that.prev('div.wpb_row').find('.row-bg').css('background-color')) 15829 .removeClass('light-text') 15830 .removeClass('dark-text') 15831 .addClass($textColor); 15832 15833 $headerOuterEl.attr('data-current-row-bg-color', $that.prev('div.wpb_row').find('.row-bg').css('background-color')); 15834 $('body.material #header-outer .bg-color-stripe').css('background-color', $that.prev('div.wpb_row').find('.row-bg').css('background-color')); 15835 15836 } else { 15837 15838 $headerOuterEl 15839 .css('background-color', $headerOuterEl.attr('data-user-set-bg')) 15840 .removeClass('light-text') 15841 .removeClass('dark-text'); 15842 15843 $headerOuterEl.attr('data-current-row-bg-color', $headerOuterEl.attr('data-user-set-bg')); 15844 $('body.material #header-outer .bg-color-stripe').css('background-color', ''); 15845 15846 } 15847 15848 } 15849 15850 }, 15851 offset: headerOffset 15852 15853 }); // End of waypoint bind. 15854 15855 }); // End of loop through rows. 15856 15857 } 15858 15859 } 15860 15861 15862 15863 /** 15864 * Page submenu sticky functionality 15865 * 15866 * @since 10.5.2 15867 */ 15868 15869 function stickyPageSubmenuInit() { 15870 15871 var $ = window.jQuery, 15872 Waypoint = window.Waypoint, 15873 $offsetHeight = calcHeaderNavHeight(), 15874 $headerHeight = calcHeaderNavHeight(); 15875 15876 $window.on('smartresize', function () { 15877 15878 $offsetHeight = calcHeaderNavHeight(); 15879 15880 if ($wpAdminBar.length > 0 && 15881 $wpAdminBar.css('position') == 'fixed') { 15882 $offsetHeight += $wpAdminBar.height(); 15883 } 15884 15885 if ($bodyBorderTop.length > 0 && 15886 $window.width() > 1000 && 15887 $('body[data-hhun="1"]').length > 0) { 15888 $offsetHeight += $bodyBorderTop.height(); 15889 } 15890 15891 // Recalc for resizing (same as stuck/unstuck logic below) 15892 if ($('.page-submenu.stuck').length > 0) { 15893 15894 $('.page-submenu.stuck') 15895 .addClass('no-trans') 15896 .css('top', $offsetHeight) 15897 .css('transform', 'translateY(0)').addClass('stuck'); 15898 15899 setTimeout(function () { 15900 $('.page-submenu.stuck').removeClass('no-trans'); 15901 }, 50); 15902 15903 $('.page-submenu.stuck') 15904 .parents('.wpb_row') 15905 .css('z-index', 10000); 15906 15907 // Boxed layout 15908 if ($('#boxed').length > 0) { 15909 15910 var $negMargin = ($window.width() > 1000) ? $('.container-wrap').width() * 0.04 : 39; 15911 15912 $('.page-submenu.stuck').css({ 15913 'margin-left': '-' + $negMargin + 'px', 15914 'width': $('.container-wrap').width() 15915 });
15916 15917 } 15918 15919 } else { 15920 15921 $('.page-submenu.stuck') 15922 .css('top', '0') 15923 .removeClass('stuck'); 15924 15925 $('.page-submenu.stuck') 15926 .parents('.wpb_row') 15927 .css('z-index', 'auto'); 15928 15929 if ($('#boxed').length > 0) { 15930 $('.page-submenu.stuck').css({ 15931 'margin-left': '0px', 15932 'width': '100%' 15933 }); 15934 } 15935 15936 } 15937 15938 }); 15939 15940 /* http://imakewebthings.com/waypoints/shortcuts/sticky-elements */ 15941 function Sticky(options) { 15942 this.options = $.extend({}, Waypoint.defaults, Sticky.defaults, options); 15943 this.element = this.options.element; 15944 this.$element = $(this.element); 15945 this.createWrapper(); 15946 this.topLevel = ($(this.element).parents('.top-level').length > 0) ? true : false; 15947 this.createWaypoint(); 15948 } 15949 15950 /* Private */ 15951 Sticky.prototype.createWaypoint = function () { 15952 15953 var originalHandler = this.options.handler; 15954 15955 $offsetHeight = calcHeaderNavHeight(); 15956 15957 // top level hhun 15958 if( this.topLevel && $('body[data-hhun="1"] #header-outer.detached:not(.invisible)').length > 0) { 15959 $offsetHeight += 1; 15960 this.$element.css({ 15961 'margin-top': '-1px', 15962 }); 15963 } 15964 15965 if ($wpAdminBar.length > 0 && $wpAdminBar.css('position') == 'fixed') { 15966 $offsetHeight += $wpAdminBar.height(); 15967 } 15968 15969 if ($bodyBorderTop.length > 0 && $window.width() > 1000 && $('body[data-hhun="1"]').length > 0) { 15970 $offsetHeight += $bodyBorderTop.height(); 15971 } 15972 15973 this.waypoint = new Waypoint($.extend({}, this.options, { 15974 element: this.wrapper, 15975 handler: $.proxy(function (direction) { 15976 var shouldBeStuck = this.options.direction.indexOf(direction) > -1; 15977 var wrapperHeight = shouldBeStuck ? this.$element.outerHeight(true) : ''; 15978 15979 this.$wrapper.height(wrapperHeight); 15980 if (shouldBeStuck) { 15981 15982 // top level hhun 15983 var transformAmt = 0; 15984 if( this.topLevel && $('body[data-hhun="1"] #header-outer.detached:not(.invisible)').length > 0) { 15985 15986 // Page submenu adjust 15987 var heightToAdjust = $headerOuterEl.outerHeight(); 15988 var $bodyBorderSizeToRemove = 0; 15989 15990 if( $headerSecondaryEl.length > 0) { 15991 heightToAdjust -= nectarDOMInfo.secondaryHeaderHeight; 15992 } 15993 15994 if ($bodyBorderTop.length > 0 && $('body.mobile').length == 0) { 15995 $bodyBorderSizeToRemove = ($bodyBorderHeaderColorMatch) ? $bodyBorderTop.height() : 0; 15996 } 15997 15998 transformAmt = heightToAdjust - $bodyBorderSizeToRemove; 15999 16000 } 16001 16002 this.$element 16003 .addClass('no-trans') 16004 .css('top', $offsetHeight) 16005 .css('transform', 'translateY('+transformAmt+'px)') 16006 .addClass('stuck'); 16007 16008 var $that = this; 16009 16010 setTimeout(function () { 16011 $that.$element.removeClass('no-trans'); 16012 }, 50); 16013 16014 this.$element.parents('.wpb_row').css('z-index', 10000); 16015 16016 //boxed 16017 if ($('#boxed').length > 0) { 16018 var $negMargin = ($window.width() > 1000) ? $('.container-wrap').width() * 0.04 : 39; 16019 this.$element.css({ 16020 'margin-left': '-' + $negMargin + 'px', 16021 'width': $('.container-wrap').width() 16022 }); 16023 } 16024 16025 } else { 16026 this.$element.css('top', '0').removeClass('stuck'); 16027 16028 if ($('#boxed').length > 0) this.$element.css({ 16029 'margin-left': '0px', 16030 'width': '100%' 16031 }); 16032 } 16033 16034 if (originalHandler) { 16035 originalHandler.call(this, direction); 16036 } 16037 }, this), 16038 offset: $offsetHeight 16039 })); 16040 16041 var $that = this; 16042 16043 16044 setInterval(function () { 16045 16046 if ($('body[data-hhun="1"] #header-outer.detached:not(.invisible)').length > 0) { 16047 16048 var heightToAdjust = $headerOuterEl.outerHeight(); 16049 16050 if( $headerSecondaryEl.length > 0) { 16051 heightToAdjust -= nectarDOMInfo.secondaryHeaderHeight; 16052 } 16053 16054 $that.waypoint.options.offset = $offsetHeight + heightToAdjust; 16055 } 16056 else { 16057 $that.waypoint.options.offset = $offsetHeight; 16058 } 16059 16060 Waypoint.refreshAll(); 16061 16062 }, 100); 16063 16064 16065 }; 16066 16067 /* Private */ 16068 Sticky.prototype.createWrapper = function () { 16069 if (this.options.wrapper) { 16070 this.$element.wrap(this.options.wrapper); 16071 } 16072 this.$wrapper = this.$element.parent(); 16073 this.wrapper = this.$wrapper[0]; 16074 }; 16075 16076 /* Public */ 16077 Sticky.prototype.destroy = function () { 16078 16079 if (this.$element.parent()[0] === this.wrapper) { 16080 this.waypoint.destroy(); 16081 this.$element.removeClass(this.options.stuckClass); 16082 if (this.options.wrapper) { 16083 this.$element.unwrap(); 16084 } 16085 } 16086 16087 }; 16088 16089 Sticky.defaults = { 16090 wrapper: '<div class="sticky-wrapper" />', 16091 stuckClass: 'stuck', 16092 direction: 'down right' 16093 }; 16094
16095 Waypoint.Sticky = Sticky; 16096 16097 } 16098 16099 16100 16101 /** 16102 * Page submenu page builder element. 16103 * 16104 * @since 10.5 16105 */ 16106 16107 function pageSubmenuInit() { 16108 16109 if ($('.page-submenu[data-sticky="true"]').length > 0 && $('#nectar_fullscreen_rows').length == 0) { 16110 16111 stickyPageSubmenuInit(); 16112 16113 // Remove outside of column setups 16114 if ($('.page-submenu').parents('.span_12').find('> .wpb_column').length > 1) { 16115 16116 var pageMenu = $('.page-submenu').clone(), 16117 pageMenuParentRow = $('.page-submenu').parents('.wpb_row'); 16118 16119 $('.page-submenu').remove(); 16120 pageMenuParentRow.before(pageMenu); 16121 } 16122 16123 var sticky = new Waypoint.Sticky({ 16124 element: $('.page-submenu[data-sticky="true"]')[0] 16125 }); 16126 16127 } 16128 16129 // Adjust to be higher. 16130 if ($('#nectar_fullscreen_rows').length == 0) { 16131 16132 $('.page-submenu') 16133 .parents('.wpb_row') 16134 .css('z-index', 10000); 16135 } 16136 16137 // Bind events. 16138 $('.page-submenu .mobile-menu-link').on('click', function () { 16139 16140 $(this).parents('.page-submenu') 16141 .find('ul') 16142 .stop(true) 16143 .slideToggle(350); 16144 16145 return false; 16146 16147 }); 16148 16149 $('.page-submenu ul li a').on('click', function () { 16150 16151 if ($('body.mobile').length > 0) { 16152 $(this).parents('.page-submenu') 16153 .find('ul') 16154 .stop(true) 16155 .slideToggle(350); 16156 } 16157 16158 }); 16159 16160 } 16161 16162 16163 16164 16165 /** 16166 * Page builder full height row option. 16167 * 16168 * @since 8.0 16169 */ 16170 16171 function vcFullHeightRow() { 16172 16173 var $element = $(".vc_row-o-full-height:first"); 16174 if ($element.length) { 16175 16176 var windowHeight, offsetTop, fullHeight; 16177 windowHeight = $window.height(); 16178 16179 $(".vc_row-o-full-height").each(function () { 16180 16181 offsetTop = $(this).offset().top; 16182 16183 if (offsetTop < windowHeight && 16184 $(this).hasClass('top-level') && 16185 !nectarDOMInfo.usingFrontEndEditor) { 16186 16187 fullHeight = 100 - offsetTop / (windowHeight / 100); 16188 $(this).css("min-height", fullHeight + "vh"); 16189 $(this).find('> .col.span_12').css("min-height", fullHeight + "vh"); 16190 16191 } else { 16192 16193 $(this).css("min-height", windowHeight); 16194 $(this).find('> .col.span_12').css("min-height", windowHeight); 16195 16196 } 16197 16198 }); 16199 16200 } 16201 16202 } 16203 16204 16205 /** 16206 * Page builder full height row init. 16207 * 16208 * @since 10.5 16209 */ 16210 16211 function vcFullHeightRowInit() { 16212 16213 if( $('.vc_row-o-full-height').length > 0 ) { 16214 vcFullHeightRow(); 16215 $window.on('smartresize', vcFullHeightRow); 16216 } 16217 16218 } 16219 16220 16221 /** 16222 * Page builder equal height row IE helper. 16223 * 16224 * @since 8.0 16225 */ 16226 function fixIeFlexbox() { 16227 var ua = window.navigator.userAgent, 16228 msie = ua.indexOf("MSIE "); 16229 (msie > 0 || navigator.userAgent.match(/Trident.*rv\:11\./)) && $(".vc_row-o-full-height").each(function () { 16230 "flex" === $(this).find('> .span_12').css("display") && $(this).wrap('<div class="vc_ie-flexbox-fixer"></div>') 16231 }); 16232 16233 if( msie > 0 || navigator.userAgent.match(/Trident.*rv\:11\./)) { 16234 fixIE11Images(); 16235 $(window).on('resize',fixIE11Images); 16236 } 16237 16238 } 16239 16240 /** 16241 * Fix the IE11 bug with max-width 100% on imgs 16242 * 16243 * @since 11.0 16244 */ 16245 function fixIE11Images() { 16246 16247 $('.img-with-aniamtion-wrap img.img-with-animation').each(function() { 16248 16249 if( $(this).parents('.tabbed').length == 0 && $(this).parents('.toggle').length == 0 ) { 16250 16251 var $parentWrap = $(this).parents('.img-with-aniamtion-wrap'); 16252 $parentWrap.css({ 16253 'height' : '' 16254 }); 16255 var height = $(this).height(); 16256 16257 $parentWrap.css({ 16258 'height' : height 16259 }); 16260 16261 } 16262 16263 }); 16264 16265 } 16266 16267 16268 16269 16270 16271 16272 16273 16274 16275 /** 16276 * Recent post height 16277 * 16278 * @since 10.5 16279 */ 16280 function recentPostsTitleOnlyEqualHeight() { 16281 16282 function recentPostHeight() { 16283 16284 $('.blog-recent[data-style="title_only"]').each(function () { 16285 16286 if ($(this).find('> .col').length > 1) { 16287 return false; 16288 } 16289 var $parentsSeletor = $(this).parent().parent().parent(); 16290 16291 if ($parentsSeletor.hasClass('vc_col-sm-3') || 16292 $parentsSeletor.hasClass('vc_col-sm-4') || 16293 $parentsSeletor.hasClass('vc_col-sm-6') || 16294 $parentsSeletor.hasClass('vc_col-sm-8') || 16295 $parentsSeletor.hasClass('vc_col-sm-9')) { 16296 16297 if ($('body.mobile').length == 0 && $(this).next('div').length == 0) { 16298 var tallestColumn = 0; 16299 16300 $(this).find('> .col').css('padding', '50px 20px'); 16301 16302 $(this).parents('.span_12').find(' > .wpb_column').each(function () { 16303 16304 if( Math.floor($(this).height()) > tallestColumn ) { 16305 tallestColumn = Math.floor($(this).height()); 16306 } 16307 16308 });
16309 16310 if (Math.floor($(this).find('> .col').outerHeight(true)) < Math.floor($(this).parents('.wpb_row').height()) - 1) { 16311 $(this).find('> .col').css('padding-top', (tallestColumn - $(this).find('> .col').height()) / 2 + 'px'); 16312 $(this).find('> .col').css('padding-bottom', (tallestColumn - $(this).find('> .col').height()) / 2 + 'px'); 16313 } 16314 16315 } else { 16316 $(this).find('> .col').css('padding', '50px 20px'); 16317 } 16318 } 16319 }); 16320 16321 } 16322 16323 // Set heights. 16324 if( $('.blog-recent[data-style="title_only"]').length > 0 ) { 16325 recentPostHeight(); 16326 $window.on('smartresize',recentPostHeight); 16327 } 16328 16329 } 16330 16331 16332 16333 16334 16335 /** 16336 * Helper to calculate recent post slider height 16337 * 16338 * @since 7.0 16339 */ 16340 function recentPostSliderHeight() { 16341 16342 $('.nectar-recent-posts-slider').each(function () { 16343 16344 var $minHeight = 250, 16345 $definedHeight = parseInt($(this).attr('data-height')), 16346 dif = ($('body[data-ext-responsive="true"]').length > 0) ? $window.width() / 1400 : $window.width() / 1100, 16347 $sliderSelectors = $(this).find('.nectar-recent-post-slide, .flickity-viewport'); 16348 16349 if (nectarDOMInfo.winW > 1000 && $('#boxed').length == 0) { 16350 16351 if ($(this).parents('.full-width-content').length == 0) { 16352 16353 if ($('body[data-ext-responsive="true"]').length > 0 && nectarDOMInfo.winW >= 1400) { 16354 $sliderSelectors.css('height', Math.ceil($definedHeight)); 16355 } else if ($('body[data-ext-responsive="true"]').length == 0 && nectarDOMInfo.winW >= 1100) { 16356 $sliderSelectors.css('height', Math.ceil($definedHeight)); 16357 } else { 16358 $sliderSelectors.css('height', Math.ceil($definedHeight * dif)); 16359 } 16360 16361 } else { 16362 $sliderSelectors.css('height', Math.ceil($definedHeight * dif)); 16363 } 16364 16365 } else { 16366 16367 // Column sliders 16368 var $parentCol = ($(this).parents('.wpb_column').length > 0) ? $(this).parents('.wpb_column') : $(this).parents('.col'); 16369 16370 if ($parentCol.length == 0) { 16371 $parentCol = $('.main-content'); 16372 } 16373 16374 if (!$parentCol.hasClass('vc_span12') && 16375 !$parentCol.hasClass('main-content') && 16376 !$parentCol.hasClass('span_12') && 16377 !$parentCol.hasClass('vc_col-sm-12')) { 16378 16379 var $parentColWidth = sliderColumnDesktopWidth($parentCol), 16380 $aspectRatio = $definedHeight / $parentColWidth; 16381 16382 // Min height 16383 if ($aspectRatio * $parentCol.width() <= $minHeight) { 16384 $sliderSelectors.css('height', $minHeight); 16385 } else { 16386 $sliderSelectors.css('height', $aspectRatio * $parentCol.width()); 16387 } 16388 16389 } 16390 16391 // Regular 16392 else { 16393 16394 // Min height 16395 if ($definedHeight * dif <= $minHeight) { 16396 $sliderSelectors.css('height', $minHeight); 16397 } else { 16398 $sliderSelectors.css('height', Math.ceil($definedHeight * dif)); 16399 } 16400 16401 } 16402 16403 } 16404 16405 }); 16406 16407 } 16408 16409 16410 function sliderColumnDesktopWidth(parentCol) { 16411 16412 var $parentColWidth = 1100, 16413 $columnNumberParsed = $(parentCol).attr('class').match(/\d+/); 16414 16415 if ($columnNumberParsed == '2') { 16416 $parentColWidth = 170 16417 } else if ($columnNumberParsed == '3') { 16418 $parentColWidth = 260 16419 } else if ($columnNumberParsed == '4') { 16420 $parentColWidth = 340 16421 } else if ($columnNumberParsed == '6') { 16422 $parentColWidth = 530 16423 } else if ($columnNumberParsed == '8') { 16424 $parentColWidth = 700 16425 } else if ($columnNumberParsed == '9') { 16426 $parentColWidth = 805 16427 } else if ($columnNumberParsed == '10') { 16428 $parentColWidth = 916.3 16429 } else if ($columnNumberParsed == '12') { 16430 $parentColWidth = 1100 16431 } 16432 16433 return $parentColWidth; 16434 } 16435 16436 16437 /** 16438 * Spit text into separate lines to animate in 16439 * 16440 * @since 7.0 16441 */ 16442 16443 function splitLineText() { 16444 $('.nectar-recent-posts-single_featured.multiple_featured').each(function () { 16445 16446 var $slideClass = ($(this).find('.project-slides').length > 0) ? '.project-slide' : '.nectar-recent-post-slide', 16447 $slideInfoClass = ($(this).find('.project-slides').length > 0) ? '.project-info h1' : '.inner-wrap h2 a'; 16448 16449 $(this).find($slideClass).each(function () { 16450 16451 $(this).find($slideInfoClass).each(function () { 16452 16453 var textArr = $(this).text(); 16454 textArr = textArr.trim(); 16455 textArr = textArr.split(' '); 16456 16457 $(this)[0].innerHTML = ''; 16458 16459 for (var i = 0; i < textArr.length; i++) { 16460 $(this)[0].innerHTML += '<span>' + textArr[i] + '</span> '; 16461 } 16462 16463 });
16464 16465 $(this).find($slideInfoClass + ' > span').wrapInner('<span class="inner" />'); 16466 16467 }); 16468 16469 }); 16470 16471 } 16472 16473 16474 /** 16475 * Spit text into separate lines to animate in 16476 * 16477 * @since 7.0 16478 */ 16479 16480 function splitLineHeadingMarkup() { 16481 16482 $('.nectar-split-heading[data-animation-type="line-reveal-by-space"]').each(function () { 16483 16484 var animatedClass = ( $(this).hasClass('animated-in') ) ? ' animated' : ''; 16485 16486 $(this).find('> *').each(function () { 16487 16488 var textArr = $(this).text(); 16489 textArr = textArr.trim(); 16490 textArr = textArr.split(' '); 16491 16492 $(this)[0].innerHTML = ''; 16493 16494 for (var i = 0; i < textArr.length; i++) { 16495 $(this)[0].innerHTML += '<span><span class="inner'+animatedClass+'">' + textArr[i] + '</span></span> '; 16496 } 16497 16498 }); 16499 16500 $(this).addClass('markup-generated'); 16501 16502 }); 16503 16504 $('.nectar-split-heading[data-animation-type="letter-fade-reveal"]').each(function () { 16505 16506 16507 $(this).find('> *').each(function () { 16508 16509 var textArr = $(this).text(); 16510 textArr = textArr.trim(); 16511 textArr = textArr.split(' '); 16512 16513 $(this)[0].innerHTML = ''; 16514 16515 for (var i = 0; i < textArr.length; i++) { 16516 $(this)[0].innerHTML += '<span>' + textArr[i] + '</span> '; 16517 } 16518 16519 }); 16520 16521 16522 $(this).find('span').each(function () { 16523 16524 var $this = $(this); 16525 var textArr = $(this).text().split(''); 16526 16527 $this.empty(); 16528 16529 $.each(textArr, function (i, el) { 16530 $this.append("<span>" + el + "</span"); 16531 }); 16532 16533 }); 16534 16535 $(this).addClass('markup-generated'); 16536 16537 }); 16538 16539 } 16540 16541 function splitLineHeadingInit() { 16542 16543 if( $('.nectar-split-heading[data-animation-type="line-reveal-by-space"]').length > 0 || $('.nectar-split-heading[data-animation-type="letter-fade-reveal"]').length > 0 ) { 16544 // Generate markup. 16545 splitLineHeadingMarkup(); 16546 } 16547 16548 } 16549 16550 16551 /** 16552 * Create recent post sliders 16553 * 16554 * @since 7.0 16555 */ 16556 function recentPostsFlickityInit() { 16557 16558 16559 if ($('.nectar-recent-posts-slider-inner').length > 0) { 16560 16561 var $rpFGroupCells = ($('.nectar-recent-posts-slider_multiple_visible').length > 0) ? '90%' : false; 16562 16563 var $rpF = $('.nectar-recent-posts-slider-inner').flickity({ 16564 contain: true, 16565 groupCells: $rpFGroupCells, 16566 draggable: true, 16567 lazyLoad: false, 16568 imagesLoaded: true, 16569 percentPosition: true, 16570 prevNextButtons: false, 16571 pageDots: true, 16572 resize: true, 16573 setGallerySize: true, 16574 wrapAround: true, 16575 accessibility: false 16576 }); 16577 16578 setTimeout(function () { 16579 $('.nectar-recent-posts-slider-inner').addClass('loaded'); 16580 }, 1150); 16581 var flkty = $rpF.data('flickity'); 16582 16583 $rpF.on('dragStart.flickity', function () { 16584 $('.flickity-viewport').addClass('is-moving'); 16585 }); 16586 16587 $rpF.on('dragEnd.flickity', function () { 16588 $('.flickity-viewport').removeClass('is-moving'); 16589 }); 16590 16591 var $dragTimeout; 16592 16593 $rpF.on('select.flickity', function () { 16594 16595 $('.flickity-viewport').addClass('no-hover'); 16596 clearTimeout($dragTimeout); 16597 $dragTimeout = setTimeout(function () { 16598 $('.flickity-viewport').removeClass('no-hover'); 16599 }, 400); 16600 16601 }); 16602 16603 recentPostSliderHeight(); 16604 $window.on('resize', recentPostSliderHeight); 16605 16606 if (!nectarDOMInfo.usingMobileBrowser && !nectarDOMInfo.usingFrontEndEditor) { 16607 $window.on('resize', recentPostSliderParallaxMargins); 16608 } 16609 16610 16611 } 16612 16613 16614 16615 // Multiple featured controls 16616 function multipleLargeFeaturedInit() { 16617 $('.nectar-recent-posts-single_featured.multiple_featured').each(function (sliderIndex) { 16618 16619 if ($(this).find('> .normal-container').length > 0) { 16620 $(this).find('> .normal-container').remove(); 16621 } 16622 16623 $(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>'); 16624 var $that = $(this); 16625 var tallestFeaturedSlide = 0; 16626 var $slideClickTimeout; 16627 16628 // Store instance 16629 $nectarCustomSliderRotate[sliderIndex] = { 16630 autorotate: '' 16631 }; 16632 16633 $(this).find('.nectar-recent-post-slide').each(function (i) { 16634 16635 if ($(this).find('.recent-post-container').height() > tallestFeaturedSlide) { 16636 $(this).siblings().removeClass('tallest'); 16637 $(this).addClass('tallest'); 16638 tallestFeaturedSlide = $(this).find('.recent-post-container').height(); 16639 } 16640 16641 var $activeClass = (i == 0 && $(this).parents('.nectar-recent-posts-single_featured.multiple_featured[data-autorotate="none"]').length > 0) ? 'class="active"' : ''; 16642 $that.find('.controls').append('<li ' + $activeClass + '><span class="title">' + $(this).find('h2').text() + '</span></li>'); 16643 });
16644 16645 $(this).addClass('js-loaded'); 16646 16647 16648 // Click event 16649 $(this).find('.controls li').on('click', function (e) { 16650 16651 if ($(this).hasClass('active')) { 16652 return; 16653 } 16654 16655 if (e.originalEvent !== undefined) { 16656 $(this).parent().find('.active').addClass('trans-out'); 16657 } 16658 16659 var $index = $(this).index(), 16660 $oldIndex = $(this).parent().find('.active').index(), 16661 $that = $(this); 16662 16663 clearTimeout($slideClickTimeout); 16664 16665 $(this).siblings().removeClass('active'); 16666 $(this).addClass('active'); 16667 16668 $slideClickTimeout = setTimeout(function () { 16669 16670 $that.parents('.multiple_featured') 16671 .find('.nectar-recent-post-slide:not(:eq(' + $index + '))') 16672 .css('opacity', '0') 16673 .removeClass('active'); 16674 16675 $that.parent() 16676 .find('.trans-out') 16677 .removeClass('trans-out'); 16678 16679 }, 300); 16680 16681 $that.parents('.multiple_featured') 16682 .find('.nectar-recent-post-slide:not(:eq(' + $index + '))') 16683 .css('z-index', '10'); 16684 16685 $that.parents('.multiple_featured') 16686 .find('.nectar-recent-post-slide:eq(' + $oldIndex + ')') 16687 .css('z-index', '15'); 16688 16689 $(this).parents('.multiple_featured').find('.nectar-recent-post-slide').eq($index).css({ 16690 'opacity': '1', 16691 'z-index': '20' 16692 }).addClass('active'); 16693 16694 if ($(this).parents('.multiple_featured').attr('data-autorotate') != 'none') { 16695 nectarCustomSliderResetRotate($that.parents('.nectar-recent-posts-single_featured.multiple_featured'), sliderIndex); 16696 } 16697 }); 16698 16699 16700 // Autorotate 16701 $that = $(this); 16702 16703 if ($(this).attr('data-autorotate').length > 0 && 16704 $(this).attr('data-autorotate') != 'none' && 16705 $('body.vc_editor').length == 0) { 16706 16707 setTimeout(function () { 16708 var slide_interval = (parseInt($that.attr('data-autorotate')) < 100) ? 4000 : parseInt($that.attr('data-autorotate')); 16709 16710 $nectarCustomSliderRotate[sliderIndex].autorotate = setInterval(function () { 16711 nectarCustomSliderRotate($that) 16712 }, slide_interval); 16713 16714 // Set first active class 16715 $that 16716 .find('.controls > li:first-child') 16717 .addClass('active'); 16718 16719 }, 30); 16720 16721 } 16722 16723 }); 16724 16725 splitLineText(); 16726 $window.on('resize', splitLineText); 16727 16728 } 16729 16730 multipleLargeFeaturedInit(); 16731 16732 } 16733 16734 16735 16736 /** 16737 * Default recent post slider parallax RAF loop. 16738 * 16739 * @since 7.0 16740 */ 16741 function recentPostSliderParallax() { 16742 16743 $('.nectar-recent-posts-slider').each(function () { 16744 16745 var $offset = parseInt($(this).find('.flickity-slider').position().left), 16746 $slides = $(this).find('.nectar-recent-post-slide'), 16747 $slideLength = $slides.length, 16748 $slideWidth = $slides.width(), 16749 $lastChildIndex = $(this).find('.nectar-recent-post-slide:last-child').index(), 16750 $slideFirstChildBG = $(this).find('.nectar-recent-post-slide:first-child .nectar-recent-post-bg'), 16751 $slideLastChildBG = $(this).find('.nectar-recent-post-slide:last-child .nectar-recent-post-bg'); 16752 16753 // First going to last 16754 if ($offset >= -3) { 16755 $slideLastChildBG.css('margin-left', parseInt(Math.ceil($slideWidth / 3.5)) + 'px'); 16756 } else { 16757 $slideLastChildBG.css('margin-left', '-' + parseInt(Math.ceil($slideWidth / 3.5 * $lastChildIndex)) + 'px'); 16758 } 16759 16760 // Last going to first 16761 if (Math.abs($offset) >= ($slideLength - 1) * $slideWidth) { 16762 $slideFirstChildBG.css('margin-left', '-' + parseInt(Math.ceil(($slideWidth / 3.5) * $slideLength)) + 'px'); 16763 } else { 16764 $slideFirstChildBG.css('margin-left', '0px'); 16765 } 16766 16767 $(this) 16768 .find('.nectar-recent-post-bg') 16769 .css('transform', 'translateX(' + Math.ceil($(this).find('.flickity-slider').position().left / -3.5) + 'px)'); 16770 16771 }); 16772 16773 requestAnimationFrame(recentPostSliderParallax); 16774 16775 } 16776 16777 /** 16778 * Default recent post slider margin calculations. 16779 * 16780 * @since 7.0 16781 */ 16782 function recentPostSliderParallaxMargins() { 16783 16784 $('.nectar-recent-posts-slider').each(function () { 16785 16786 var $slideWidth = $(this).find('.nectar-recent-post-slide').width(); 16787 16788 $(this).find('.nectar-recent-post-slide').each(function (i) { 16789 $(this).find('.nectar-recent-post-bg').css('margin-left', '-' + parseInt(Math.ceil($slideWidth / 3.5) * i) + 'px'); 16790 });
16791 16792 }); 16793 16794 } 16795 16796 16797 16798 /** 16799 * Initialize all recent post elements. 16800 * 16801 * @since 7.0 16802 */ 16803 function recentPostsInit() { 16804 16805 // Start flickity based sliders. 16806 recentPostsFlickityInit(); 16807 16808 16809 // Classic enhanced specific 16810 $('.blog-recent[data-style="classic_enhanced_alt"] .inner-wrap').each(function () { 16811 $(this).find('.post-featured-img').each(function () { 16812 var $src = $(this).find('img').attr('src'); 16813 $(this).css('background-image', 'url(' + $src + ')'); 16814 }); 16815 }); 16816 16817 $('.blog-recent[data-style="classic_enhanced"]').each(function () { 16818 if ($(this).find('.inner-wrap.has-post-thumbnail').length == 0) { 16819 $(this).addClass('no-thumbs'); 16820 } 16821 }); 16822 16823 // Regular recent posts slider. 16824 if (!nectarDOMInfo.usingMobileBrowser) { 16825 if ($('.nectar-recent-posts-slider').length > 0 && !nectarDOMInfo.usingFrontEndEditor) { 16826 window.requestAnimationFrame(recentPostSliderParallax); 16827 } 16828 } 16829 16830 if (!nectarDOMInfo.usingMobileBrowser && !nectarDOMInfo.usingFrontEndEditor) { 16831 recentPostSliderParallaxMargins(); 16832 } 16833 16834 } 16835 16836 16837 16838 16839 /** 16840 * Parallax on mousemove effect 16841 * 16842 * @since 10.5 16843 */ 16844 function parallaxItemHoverEffect() { 16845 16846 //change sizer pos 16847 $('.style-5').each(function () { 16848 $(this) 16849 .find('.sizer') 16850 .insertBefore($(this).find('.parallaxImg')); 16851 }); 16852 16853 // Set parent zindex 16854 $('.style-5') 16855 .parents('.wpb_row') 16856 .css('z-index', '100'); 16857 16858 var d = document, 16859 bd = d.getElementsByTagName('body')[0], 16860 win = window, 16861 imgs = d.querySelectorAll('.parallaxImg'), 16862 totalImgs = imgs.length, 16863 supportsTouch = 'ontouchstart' in win || navigator.msMaxTouchPoints, 16864 lazyLoadedItems = false; 16865 16866 if (totalImgs <= 0) { 16867 return; 16868 } 16869 16870 // Build HTML 16871 for (var l = 0; l < totalImgs; l++) { 16872 16873 var thisImg = imgs[l], 16874 layerElems = thisImg.querySelectorAll('.parallaxImg-layer'), 16875 totalLayerElems = layerElems.length; 16876 16877 if (totalLayerElems <= 0) { 16878 continue; 16879 } 16880 16881 while (thisImg.firstChild) { 16882 thisImg.removeChild(thisImg.firstChild); 16883 } 16884 16885 var lastMove = 0; 16886 16887 //throttle performance old browsers 16888 var eventThrottle = 80; 16889 if ( navigator.userAgent.indexOf("Chrome") > -1 && navigator.userAgent.indexOf("Edge/") < 1 ) { 16890 eventThrottle = 1; 16891 $('html').addClass('cssreflections'); 16892 } else { 16893 $body.addClass('cssreflections'); 16894 } 16895 16896 var containerHTML = d.createElement('div'), 16897 shineHTML = d.createElement('div'), 16898 shadowHTML = d.createElement('div'), 16899 layersHTML = d.createElement('div'), 16900 layers = []; 16901 16902 thisImg.id = 'parallaxImg__' + l; 16903 containerHTML.className = 'parallaxImg-container'; 16904 shadowHTML.className = 'parallaxImg-shadow'; 16905 layersHTML.className = 'parallaxImg-layers'; 16906 16907 for (var i = 0; i < totalLayerElems; i++) { 16908 16909 var layer = d.createElement('div'), 16910 layerInner = d.createElement('div'), 16911 imgSrc = layerElems[i].getAttribute('data-img'); 16912 16913 $(layer).html($(layerElems[i]).html()); 16914 layer.className = 'parallaxImg-rendered-layer'; 16915 layer.setAttribute('data-layer', i); 16916 16917 if (i == 0 && $(thisImg).parents('.wpb_gallery').length == 0) { 16918 layerInner.className = 'bg-img'; 16919 16920 if( $(thisImg).parents('.nectar-fancy-box').length > 0 ) { 16921 layerInner.setAttribute('data-nectar-img-src', imgSrc); 16922 lazyLoadedItems = true; 16923 } else { 16924 layerInner.style.backgroundImage = 'url(' + imgSrc + ')'; 16925 } 16926 layer.appendChild(layerInner); 16927 } 16928 layersHTML.appendChild(layer); 16929 16930 layers.push(layer); 16931 } 16932 16933 16934 containerHTML.appendChild(layersHTML); 16935 thisImg.appendChild(containerHTML); 16936 $(thisImg).wrap('<div class="parallaxImg-wrap" />'); 16937 if (!(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1)) { 16938 $(thisImg).parent().append(shadowHTML); 16939 } 16940 16941 if (supportsTouch && $('body.using-mobile-browser').length > 0) { 16942 // Stop processing. 16943 } else { 16944 (function (_thisImg, _layers, _totalLayers, _shine) { 16945 $(thisImg).parents('.style-5').on('mousemove', function (e) { 16946 16947 var parentEl = $(this); 16948 var parallaxContainer = parentEl.find('.parallaxImg-container'); 16949 var parallaxShad = parentEl.find('.parallaxImg-shadow'); 16950 16951 var now = Date.now(); 16952 16953 var usingGallery = ($(_thisImg).parents('.wpb_gallery').length > 0) ? true : false; 16954 16955 if (now > lastMove + eventThrottle) { 16956 lastMove = now; 16957 window.requestAnimationFrame(function () { 16958 processMovement(e, false, _thisImg, _layers, _totalLayers, _shine, parentEl, parallaxContainer, parallaxShad, usingGallery); 16959 });
16960 } 16961 16962 16963 }); 16964 $(thisImg).parents('.style-5').on('mouseenter', function (e) { 16965 processEnter(e, _thisImg, _layers, _totalLayers, _shine); 16966 }); 16967 $(thisImg).parents('.style-5').on('mouseleave', function (e) { 16968 processExit(e, _thisImg, _layers, _totalLayers, _shine); 16969 }); 16970 })(thisImg, layers, totalLayerElems, shineHTML); 16971 } 16972 16973 // Set the depths 16974 (function (_thisImg, _layers, _totalLayers, _shine) { 16975 depths(false, _thisImg, _layers, _totalLayers, _shine); 16976 window.addEventListener('resize', function () { 16977 depths(false, _thisImg, _layers, _totalLayers, _shine); 16978 }); 16979 })(thisImg, layers, totalLayerElems, shineHTML); 16980 } 16981 16982 if( lazyLoadedItems ) { 16983 nectarLazyImageLoading(); 16984 } 16985 16986 function processMovement(e, touchEnabled, elem, layers, totalLayers, shine, parentEl, parallaxContainer, parallaxShad, usingGal) { 16987 16988 // Stop raf if exit already called 16989 if (!$(elem.firstChild).hasClass('over')) { 16990 processExit(e, elem, layers, totalLayers, shine); 16991 return false 16992 } 16993 16994 // Set up multipliers 16995 var yMult = 0.03; 16996 var xMult = 0.063; 16997 16998 var scaleAmount = '1.03'; 16999 var offsetAmount = '-10'; 17000 var usingMasonrySize = false; 17001 17002 if ($(elem).parents('.col.wide').length > 0) { 17003 yMult = 0.03; 17004 xMult = 0.063; 17005 usingMasonrySize = true; 17006 } else if ($(elem).parents('.col.regular').length > 0 || $(elem).parents('.wpb_gallery').length > 0) { 17007 yMult = 0.045; 17008 xMult = 0.045; 17009 } else if ($(elem).parents('.col.tall').length > 0) { 17010 yMult = 0.05; 17011 xMult = 0.015; 17012 usingMasonrySize = true; 17013 } else if ($(elem).parents('.col.wide_tall').length > 0) { 17014 yMult = 0.04; 17015 xMult = 0.04; 17016 usingMasonrySize = true; 17017 } else if (parentEl.hasClass('nectar-fancy-box')) { 17018 yMult = 0.045; 17019 xMult = 0.022; 17020 scaleAmount = '1.06'; 17021 offsetAmount = '-2'; 17022 } else { 17023 yMult = 0.045; 17024 xMult = 0.075; 17025 } 17026 17027 var bdst = nectarDOMInfo.scrollTop, 17028 bdsl = 0, 17029 pageX = (touchEnabled) ? e.touches[0].pageX : e.pageX, 17030 pageY = (touchEnabled) ? e.touches[0].pageY : e.pageY, 17031 offsets = elem.getBoundingClientRect(), 17032 w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth, 17033 h = elem.clientHeight || elem.offsetHeight || elem.scrollHeight, 17034 wMultiple = 320 / w, 17035 offsetX = 0.52 - (pageX - offsets.left - bdsl) / w, 17036 offsetY = 0.52 - (pageY - offsets.top - bdst) / h, 17037 dy = (pageY - offsets.top - bdst) - h / 2, 17038 dx = (pageX - offsets.left - bdsl) - w / 2, 17039 yRotate = (offsetX - dx) * (yMult * wMultiple), 17040 xRotate = (dy - offsetY) * (xMult * wMultiple); 17041 17042 var imgCSS; 17043 17044 if (usingGal == true) { 17045 imgCSS = ' perspective(' + w * 3 + 'px) rotateX(' + -xRotate * 1.9 + 'deg) rotateY(' + -yRotate * 1.3 + 'deg)'; 17046 } else { 17047 17048 if (usingMasonrySize == false) { 17049 imgCSS = ' perspective(' + w * 3 + 'px) rotateX(' + xRotate + 'deg) rotateY(' + yRotate + 'deg) translateY(' + offsetY * offsetAmount + 'px) translateX(' + offsetX * offsetAmount + 'px) scale(' + scaleAmount + ')'; 17050 } else { 17051 imgCSS = ' perspective(' + w * 3 + 'px) rotateX(' + xRotate + 'deg) rotateY(' + yRotate + 'deg) translateY(' + offsetY * -10 + 'px) translateX(' + offsetX * -10 + 'px) scale(1.013)'; 17052 } 17053 17054 } 17055 17056 17057 // Container transform 17058 parallaxContainer.css('transform', imgCSS); 17059 17060 if (!(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1)) { 17061 parallaxShad.css('transform', imgCSS); 17062 } 17063 17064 17065 } 17066 17067 17068 function processEnter(e, elem) { 17069 17070 elem.firstChild.className += ' over'; 17071 elem.className += ' over'; 17072 17073 $(elem).addClass('transition'); 17074 17075 if ($(elem).parents('.wpb_gallery').length > 0) { 17076 setTimeout(function () { 17077 $(elem).removeClass('transition'); 17078 }, 450); 17079 } else { 17080 setTimeout(function () { 17081 $(elem).removeClass('transition'); 17082 }, 200); 17083 } 17084 17085 } 17086 17087 17088 function processExit(e, elem) { 17089 17090 var w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth; 17091 var container = elem.firstChild; 17092 17093 container.className = container.className.replace(' over', ''); 17094 elem.className = elem.className.replace(' over', ''); 17095 $(container).css('transform', 'perspective(' + w * 3 + 'px) rotateX(0deg) rotateY(0deg) translateZ(0)'); 17096 $(elem).parents('.parallaxImg-wrap').find('.parallaxImg-shadow').css('transform', 'perspective(' + w * 3 + 'px) rotateX(0deg) rotateY(0deg) translateZ(0)'); 17097 17098 $(elem).addClass('transition'); 17099 setTimeout(function () { 17100 $(elem).removeClass('transition'); 17101 }, 200); 17102 17103 } 17104 17105 17106 function depths(touchEnabled, elem, layers, totalLayers) { 17107 17108 var w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth; 17109 var container = elem.firstChild; 17110 17111 // Set z 17112 for (var ly = 0; ly < totalLayers; ly++) { 17113 if (ly == 0) { 17114 $(layers[ly]).css('transform', 'translateZ(0px)'); 17115 } 17116 else { 17117 $(layers[ly]).css('transform', 'translateZ(' + (w * 3) / 27 * (ly * 1.1) + 'px) '); 17118 } 17119 17120 } 17121 17122 totalLayers = totalLayers + 3; 17123 17124 // Set perspective from beginning 17125 $(container).css('transform', 'perspective(' + w * 3 + 'px)'); 17126 17127 } 17128 17129 } 17130 17131 17132 /** 17133 * Fancy Box 17134 * 17135 * @since 11.0 17136 */ 17137 function nectarFancyBoxHover() { 17138 17139 if( $('.nectar-fancy-box[data-style="hover_desc"]').length == 0 ) { 17140 return false; 17141 } 17142 17143 var $hoverContentHeight = 0; 17144 17145 $('body').on('mouseenter touchstart','.nectar-fancy-box[data-style="hover_desc"]', function() { 17146 $hoverContentHeight = parseInt($(this).find('.hover-content').outerHeight(true)); 17147 $(this).addClass('hovered'); 17148 $(this).find('.heading-wrap').css('transform','translateY(-'+ $hoverContentHeight +'px)'); 17149 });
17150 17151 $('body').on('mouseleave touchend','.nectar-fancy-box[data-style="hover_desc"]', function() { 17152 $(this).removeClass('hovered'); 17153 $(this).find('.heading-wrap').css('transform','translateY(0)'); 17154 }); 17155 17156 } 17157 17158 17159 17160 /** 17161 * Mouse Follow Icon 17162 * 17163 * @since 11.0 17164 */ 17165 function NectarMouseFollowIcon(el,iconSelector) { 17166 17167 this.$el = el; 17168 this.$iconEl = this.$el.find(iconSelector); 17169 17170 this.elX = 0; 17171 this.elY = 0; 17172 17173 this.initialX = this.$el.width() / 2; 17174 this.initialY = this.$el.height() / 2; 17175 17176 this.elX = 0; 17177 this.elY = 0; 17178 17179 this.lastScroll = 0; 17180 this.scrollAdjust = 0; 17181 17182 this.lastX = this.initialX; 17183 this.lastY = this.initialY; 17184 this.activeFollow = false; 17185 17186 this.percentage = 0.13; 17187 this.percentageTimeout; 17188 17189 $window.on('resize', this.resizeEvent.bind(this)); 17190 this.mouseEvents(); 17191 this.rafLoop(); 17192 17193 } 17194 17195 NectarMouseFollowIcon.prototype.resizeEvent = function() { 17196 this.initialX = this.$el.width() / 2; 17197 this.initialY = this.$el.height() / 2; 17198 }; 17199 17200 NectarMouseFollowIcon.prototype.mouseEvents = function() { 17201 17202 var that = this; 17203 17204 that.$el.on('mouseenter', function(e) { 17205 17206 that.activeFollow = true; 17207 17208 that.elX = e.offsetX; 17209 that.elY = e.offsetY; 17210 17211 that.lastScroll = 0; 17212 17213 clearTimeout(that.percentageTimeout); 17214 that.percentageTimeout = setTimeout(function(){ 17215 that.percentage = 0.2; 17216 },700); 17217 }); 17218 17219 that.$el.on('mouseleave', function() { 17220 17221 that.activeFollow = false; 17222 that.lastScroll = 0; 17223 17224 clearTimeout(that.percentageTimeout); 17225 that.percentage = 0.13; 17226 }); 17227 17228 that.$el.on('mousemove', function(e){ 17229 that.elX = e.offsetX; 17230 that.elY = e.offsetY; 17231 that.lastScroll = 0; 17232 }); 17233 17234 $(window).on('scroll',function() { 17235 if( that.activeFollow == true && that.lastScroll == 0) { 17236 that.lastScroll = nectarDOMInfo.scrollTop; 17237 } 17238 }); 17239 17240 }; 17241 17242 17243 NectarMouseFollowIcon.prototype.rafLoop = function() { 17244 17245 if( this.activeFollow == true ) { 17246 17247 this.scrollAdjust = ( this.lastScroll > 0 ) ? nectarDOMInfo.scrollTop - this.lastScroll : 0; 17248 17249 this.lastY = linearInterpolate(this.lastY, this.elY + this.scrollAdjust, this.percentage); 17250 this.lastX = linearInterpolate(this.lastX, this.elX, this.percentage); 17251 } else { 17252 this.lastY = linearInterpolate(this.lastY, this.initialY, 0.13); 17253 this.lastX = linearInterpolate(this.lastX, this.initialX, 0.13); 17254 } 17255 17256 this.$iconEl.css({ 17257 'transform': 'translateX(' + this.lastX + 'px) translateY(' + this.lastY + 'px)' 17258 }); 17259 17260 requestAnimationFrame(this.rafLoop.bind(this)); 17261 17262 }; 17263 17264 17265 17266 17267 /** 17268 * Video Lightbox 17269 * 17270 * @since 11.0 17271 */ 17272 function nectarVideoLightbox() { 17273 17274 iconMouseFollowArr = []; 17275 17276 // Parent hover relationship. 17277 $body.on('mouseenter','.nectar_video_lightbox[data-parent-hover="1"]', function() { 17278 var $parentRow = $(this).parents('.wpb_row'); 17279 $parentRow.find('> .row-bg-wrap .row-bg, > .nectar-video-wrap .nectar-video-inner').addClass('transition'); 17280 $parentRow.find('> .row-bg-wrap .row-bg, > .nectar-video-wrap .nectar-video-inner').css({ 17281 'transform' : 'scale(1.08)' 17282 }); 17283 }); 17284 17285 $body.on('mouseleave','.nectar_video_lightbox[data-parent-hover="1"]', function() { 17286 var $parentRow = $(this).parents('.wpb_row'); 17287 $parentRow.find('> .row-bg-wrap .row-bg, > .nectar-video-wrap .nectar-video-inner').css({ 17288 'transform' : 'scale(1)' 17289 }); 17290 }); 17291 17292 // Mouse Indicator. 17293 $('.nectar-video-box').each(function(i){ 17294 17295 if( $(this).find('.play_button_mouse_follow') ) { 17296 17297 var $that = $(this); 17298 17299 $(this).imagesLoaded(function () { 17300 17301 // Follow mouse. 17302 if( !nectarDOMInfo.usingMobileBrowser ) { 17303 iconMouseFollowArr[i] = new NectarMouseFollowIcon($that, '.play_button_mouse_follow'); 17304 } 17305 17306 // Initial setup. 17307 var $playColor = ( $that.is('[data-mouse-icon-color]') && $that.attr('data-mouse-icon-color').length > 0 ) ? $that.attr('data-mouse-icon-color') : '#000'; 17308 17309 if( $that.is('[data-mouse-style="solid_color"]') ) { 17310 17311 $that.find('.play_button_mouse_follow').css({ 17312 'background-color': $playColor 17313 });
17314 } 17315 17316 $that.find('.play_button_mouse_follow').addClass('visible'); 17317 17318 }); 17319 17320 } 17321 17322 }); 17323 17324 } 17325 17326 17327 17328 /** 17329 * Salient slider rotation 17330 * 17331 * @since 10.5 17332 */ 17333 function nectarCustomSliderRotate(slider) { 17334 17335 if ($('body.vc_editor').length > 0) { 17336 return; 17337 } 17338 17339 var $controlSelector = (slider.find('.project-slides').length > 0) ? '.dot-nav > span' : '.controls > li', 17340 $controlSelectorInd = (slider.find('.project-slides').length > 0) ? 'span' : ' li', 17341 $slideLength = slider.find($controlSelector).length, 17342 $currentSlide = slider.find($controlSelector + '.active').index(); 17343 17344 if ($currentSlide + 1 == $slideLength) { 17345 slider.find($controlSelector + ':first-child').trigger('click'); 17346 } else { 17347 slider.find($controlSelector + '.active').next($controlSelectorInd).trigger('click'); 17348 } 17349 } 17350 17351 17352 /** 17353 * Salient slider rotation reset 17354 * 17355 * @since 10.5 17356 */ 17357 function nectarCustomSliderResetRotate(slider, index) { 17358 clearInterval($nectarCustomSliderRotate[index].autorotate); 17359 17360 // Reinit autorotate 17361 if (slider.attr('data-autorotate').length > 0) { 17362 var slide_interval = (parseInt(slider.attr('data-autorotate')) < 100) ? 4000 : parseInt(slider.attr('data-autorotate')); 17363 $nectarCustomSliderRotate[index].autorotate = setInterval(function () { 17364 nectarCustomSliderRotate(slider) 17365 }, slide_interval); 17366 } 17367 } 17368 17369 17370 17371 /** 17372 * Fullscreen recent project slider 17373 * 17374 * @since 10.5 17375 */ 17376 function fsProjectSliderInit() { 17377 17378 $fsProjectSliderArr = []; 17379 17380 if (typeof SalientRecentProjectsFullScreen === 'undefined') { 17381 return; 17382 } 17383 17384 $('.nectar_fullscreen_zoom_recent_projects').each(function (i) { 17385 $fsProjectSliderArr[i] = new SalientRecentProjectsFullScreen($(this)); 17386 }); 17387 17388 } 17389 17390 17391 17392 17393 17394 /** 17395 * Portfolio single template sticky sidebar 17396 * 17397 * @since 6.0 17398 */ 17399 function portfolioSidebarFollow() { 17400 17401 var sidebarFollow = $('.single-portfolio #sidebar').attr('data-follow-on-scroll'); 17402 17403 if ($('body.single-portfolio').length == 0 || $('#sidebar[data-follow-on-scroll]').length == 0) { 17404 return; 17405 } 17406 17407 sidebarFollow = $('.single-portfolio #sidebar').attr('data-follow-on-scroll'); 17408 17409 if (sidebarFollow == 1 && 17410 !$body.hasClass('mobile') && 17411 parseInt($('#sidebar').height()) + 50 <= parseInt($('.post-area').height())) { 17412 17413 //padding from top of screen 17414 var $ssExtraTopSpace = 50; 17415 17416 if ($('#header-outer[data-remove-fixed="0"]').length > 0 && 17417 $('body[data-hhun="1"]').length == 0) { 17418 17419 $ssExtraTopSpace += $headerOuterEl.outerHeight(); 17420 17421 // Resize effect 17422 if ($('#header-outer[data-shrink-num][data-header-resize="1"]').length > 0) { 17423 var headerPadding2 = parseInt($headerOuterEl.attr('data-padding')) - parseInt($headerOuterEl.attr('data-padding')) / 1.8; 17424 $ssExtraTopSpace -= logoShrinkNum; 17425 $ssExtraTopSpace -= headerPadding2; 17426 } 17427 17428 // Condense 17429 if ($('body.mobile').length == 0 && $('#header-outer[data-condense="true"]').length > 0) { 17430 17431 var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'); 17432 17433 $ssExtraTopSpace = 50; 17434 $ssExtraTopSpace += $headerOuterEl.height() - (parseInt($headerSpan9.position().top) - parseInt($('#header-outer #logo').css('margin-top'))) - parseInt(nectarDOMInfo.secondaryHeaderHeight); 17435 } 17436 17437 } 17438 17439 if ($wpAdminBar.length > 0) { 17440 $ssExtraTopSpace += $wpAdminBar.outerHeight(); 17441 } 17442 17443 17444 $('.single-portfolio #sidebar').theiaStickySidebar({ 17445 additionalMarginTop: $ssExtraTopSpace, 17446 updateSidebarHeight: false 17447 }); 17448 17449 17450 } 17451 17452 } 17453 17454 17455 17456 17457 17458 /** 17459 * Infinite scroll pagination 17460 * 17461 * @since 6.0 17462 */ 17463 function infiniteScrollInit() { 17464 17465 if ($('.infinite_scroll').length > 0) { 17466 17467 // Portfolio 17468 $('.portfolio-items.infinite_scroll').infinitescroll({ 17469 navSelector: "div#pagination", 17470 nextSelector: "div#pagination a:first", 17471 itemSelector: ".portfolio-items.infinite_scroll .element", 17472 finishedMsg: "<em>Congratulations, you've reached the end of the internet.</em>", 17473 msgText: " ", 17474 }, function (newElements) { 17475 17476 17477 var $container = $('.portfolio-items.infinite_scroll:not(.carousel)'), 17478 $newElems = $(newElements).css('opacity', 0); 17479 17480 // Ensure that images load before adding to masonry layout 17481 $newElems.imagesLoaded(function () { 17482 17483 $(newElements).css('opacity', 1); 17484 17485 $container.isotope('appended', $(newElements)); 17486 17487 $(newElements).find('.work-item').addClass('ajax-loaded'); 17488 $(newElements).addClass('ajax-loaded'); 17489
17490 // Show elems now they're ready 17491 $(newElements).find('.work-meta, .nectar-love-wrap').css({ 17492 'opacity': 1 17493 }); 17494 17495 // Keep current filtering 17496 if ($('.portfolio-filters-inline').length > 0 || $('.portfolio-filters').length > 0) { 17497 17498 var selector; 17499 17500 if ($('.portfolio-filters-inline').length > 0) { 17501 selector = $('.portfolio-filters-inline a.active').attr('data-filter'); 17502 } else { 17503 selector = $('.portfolio-filters a.active').attr('data-filter'); 17504 } 17505 17506 $('.portfolio-filters-inline a.active').attr('data-filter'); 17507 $container.isotope({ 17508 filter: selector 17509 }); 17510 } 17511 17512 // Set width 17513 for (var i = 0; i < $portfolio_containers.length; i++) { 17514 $portfolio_containers[i].reLayout(); 17515 } 17516 17517 if ($(newElements).find('.work-item.style-5').length > 0) { 17518 parallaxItemHoverEffect(); 17519 } 17520 17521 if ($(newElements).find('.inner-wrap').attr('data-animation') == 'none') { 17522 $('.portfolio-items .col .inner-wrap').removeClass('animated'); 17523 } else { 17524 17525 for (var i = 0; i < $portfolio_containers.length; i++) { 17526 $portfolio_containers[i].masonryZindex(); 17527 $portfolio_containers[i].portfolioAccentColor(); 17528 } 17529 17530 $(newElements).each(function () { 17531 17532 var $portfolioOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '90%'; 17533 17534 // Not already visible 17535 var $that = $(this); 17536 var waypoint = new Waypoint({ 17537 element: $that, 17538 handler: function () { 17539 17540 var $portfolioAnimationDelay = ($that.is('[data-masonry-type="photography"].masonry-items')) ? 85 : 115; 17541 17542 setTimeout(function () { 17543 $that.addClass("animated-in"); 17544 }, $portfolioAnimationDelay * $that.attr('data-delay-amount')); 17545 17546 17547 waypoint.destroy(); 17548 }, 17549 offset: $portfolioOffsetPos 17550 17551 }); 17552 17553 17554 }); 17555 } 17556 17557 17558 // Lightbox reinit. 17559 $('.portfolio-items').each(function () { 17560 var $unique_id = uniqueIdGenerate(); 17561 $(this).find('a[rel^="prettyPhoto"], a.pretty_photo').attr('rel', 'prettyPhoto[' + $unique_id + '_gal]').removeClass('pretty_photo'); 17562 });
17563 17564 17565 $('.portfolio-items').each(function () { 17566 var $unique_id = uniqueIdGenerate(); 17567 $(this).find('a[data-fancybox^="group_"]').attr('data-fancybox', 'group_' + $unique_id); 17568 }); 17569 17570 lightBoxInit(); 17571 17572 setTimeout(function () { 17573 17574 for (var i = 0; i < $portfolio_containers.length; i++) { 17575 $portfolio_containers[i].masonryZindex(); 17576 $portfolio_containers[i].reLayout(); 17577 $portfolio_containers[i].isotopeCatSelection(); 17578 } 17579 $(newElements).removeClass('ajax-loaded'); 17580 }, 700); 17581 17582 parallaxRowsBGCals(); 17583 17584 }); 17585 17586 17587 }); 17588 17589 // Blog 17590 $('.post-area.infinite_scroll .posts-container').infinitescroll({ 17591 navSelector: "div#pagination", 17592 nextSelector: "div#pagination a:first", 17593 itemSelector: ".post-area.infinite_scroll .posts-container .post", 17594 finishedMsg: "<em>Congratulations, you've reached the end of the internet.</em>", 17595 msgText: " " 17596 }, function (newElements) { 17597 17598 if($(newElements).find('[data-nectar-img-src]').length > 0) { 17599 nectarLazyImageLoading(); 17600 } 17601 17602 // Only trigger recalc of waypoints and elements if needed. 17603 if ($('.masonry.classic').length > 0 || 17604 $('.post-area:not(.masonry):not(.featured_img_left)').length > 0 || 17605 $('.post-area.standard-minimal').length > 0) { 17606 17607 // Gallery. 17608 flexsliderInit(); 17609 17610 // Media players. 17611 if ($().mediaelementplayer) { 17612 $(newElements).find('.wp-audio-shortcode, .wp-video-shortcode').mediaelementplayer(); 17613 } 17614 17615 // Lightbox. 17616 lightBoxInit(); 17617 17618 // Carousels. 17619 if ($('.carousel').length > 0) { 17620 standardCarouselInit(); 17621 clientsCarouselInit(); 17622 } 17623 17624 // Waypoints. 17625 waypoints(); 17626 17627 // Testimonial slider. 17628 $('.testimonial_slider').animate({ 17629 'opacity': '1' 17630 }, 800); 17631 nectarTestimonialSliders(); 17632 nectarTestimonialSlidersEvents(); 17633 17634 setTimeout(function () { 17635 responsiveVideoIframesInit(); 17636 responsiveVideoIframes(); 17637 $window.trigger('resize'); 17638 }, 500); 17639 17640 17641 parallaxRowsBGCals(); 17642 17643 $window.trigger('resize'); 17644 17645 } // Non meta overlaid style. 17646 else { 17647 parallaxRowsBGCals(); 17648 17649 $window.trigger('resize'); 17650 } 17651 17652 // Trigger Masonry as a callback. 17653 var $container = $('.infinite_scroll .posts-container'); 17654 if ($container.parent().hasClass('masonry')) { 17655 17656 $(newElements).addClass('masonry-blog-item'); 17657 17658 17659 } //if masonry. 17660 17661 17662 // Loading effect. 17663 17664 //// hide new items while they are loading. 17665 var $newElems = $(newElements); 17666 //// ensure that images load before adding to masonry layout. 17667 17668 if ($newElems.find('img').length == 0) { 17669 $newElems = $('body'); 17670 } 17671 17672 $newElems.imagesLoaded(function () { 17673 17674 if ($container.parent().hasClass('masonry') && 17675 !$container.parent().hasClass('auto_meta_overlaid_spaced')) { 17676 $container.isotope('appended', $(newElements)); 17677 } 17678 17679 for (var i = 0; i < $nectarMasonryBlogs.length; i++) { 17680 $nectarMasonryBlogs[i].flickityBlogInit(); 17681 } 17682 17683 $(newElements).addClass('ajax-loaded');
17684 // Show elems now they're ready. 17685 17686 // Classic enhanced specific 17687 if ($container.parent().hasClass('classic_enhanced')) { 17688 $container.find('.large_featured.has-post-thumbnail.ajax-loaded .post-featured-img, .wide_tall.has-post-thumbnail.ajax-loaded .post-featured-img').each(function () { 17689 var $src = $(this).find('img').attr('src'); 17690 $(this).css('background-image', 'url(' + $src + ')'); 17691 }); 17692 17693 $container.find('.large_featured.ajax-loaded .nectar-flickity, .wide_tall.ajax-loaded .nectar-flickity').each(function () { 17694 17695 $(this).find('.cell').each(function () { 17696 var $src = $(this).find('img').attr('src'); 17697 $(this).css('background-image', 'url(' + $src + ')'); 17698 }); 17699 17700 }); 17701 } 17702 17703 17704 if ($(newElements).parents('.posts-container').attr('data-animation') == 'none') { 17705 $(newElements).find('.inner-wrap').removeClass('animated'); 17706 } else { 17707 17708 for (var i = 0; i < $nectarMasonryBlogs.length; i++) { 17709 $nectarMasonryBlogs[i].blogMasonryZindex(); 17710 } 17711 17712 $(newElements).each(function () { 17713 17714 var $that = $(this); 17715 var waypoint = new Waypoint({ 17716 17717 element: $that, 17718 handler: function () { 17719 17720 setTimeout(function () { 17721 $that.addClass("animated-in"); 17722 }, 80 * $that.attr('data-delay-amount')); 17723 17724 waypoint.destroy(); 17725 }, 17726 offset: '90%' 17727 17728 }); 17729 17730 17731 }); 17732 } 17733 17734 setTimeout(function () { 17735 $(newElements).removeClass('ajax-loaded'); 17736 }, 700); 17737 17738 17739 }); 17740 17741 17742 }); 17743 17744 } 17745 17746 } 17747 17748 17749 17750 17751 17752 17753 /** 17754 * Scroll to top scroll bind. 17755 * 17756 * @since 2.0 17757 */ 17758 function toTopBind() { 17759 17760 if ($('#to-top').length > 0 && $window.width() > 1020 || 17761 $('#to-top').length > 0 && $('#to-top.mobile-enabled').length > 0) { 17762 17763 if (nectarDOMInfo.scrollTop > 350) { 17764 $window.on('scroll', hideToTop); 17765 } else { 17766 $window.on('scroll', showToTop); 17767 } 17768 } 17769 17770 } 17771 17772 /** 17773 * Scroll to top show. 17774 * 17775 * @since 2.0 17776 */ 17777 function showToTop() { 17778 17779 if (nectarDOMInfo.scrollTop > 350 && !$offCanvasEl.is('.fullscreen.open') ) { 17780 17781 $('#to-top').stop().transition({ 17782 'transform': 'translateY(-50%)' 17783 }, 350, 'easeInOutCubic'); 17784 17785 $window.off('scroll', showToTop); 17786 $window.on('scroll', hideToTop); 17787 } 17788 17789 } 17790 17791 17792 /** 17793 * Scroll to top hide. 17794 * 17795 * @since 2.0 17796 */ 17797 function hideToTop() { 17798 17799 if (nectarDOMInfo.scrollTop < 350 || $offCanvasEl.is('.fullscreen.open') ) { 17800 17801 var $animationTiming = ($('#slide-out-widget-area.fullscreen.open').length > 0) ? 1150 : 350; 17802 17803 $('#to-top').stop().transition({ 17804 'transform': 'translateY(105%)' 17805 }, $animationTiming, 'easeInOutQuint'); 17806 17807 $window.off('scroll', hideToTop); 17808 $window.on('scroll', showToTop); 17809 17810 } 17811 } 17812 17813 17814 /** 17815 * Scroll to top initialization. 17816 * 17817 * @since 10.5 17818 */ 17819 function scrollToTopInit() { 17820 17821 // Show/hide based on scroll pos 17822 if ($('.nectar-social.fixed').length == 0) { 17823 toTopBind(); 17824 } 17825 17826 17827 // Rounded style 17828 if ($('body[data-button-style*="rounded"]').length > 0) { 17829 var $clone = $('#to-top .fa-angle-up').clone(); 17830 $clone.addClass('top-icon'); 17831 $('#to-top').prepend($clone); 17832 } 17833 17834 // Scroll up click event 17835 $body.on('click', '#to-top, a[href="#top"]', function () { 17836 $('body,html').stop().animate({ 17837 scrollTop: 0 17838 }, 800, 'easeOutQuad', function () { 17839 if ($('.nectar-box-roll').length > 0) { 17840 $body.trigger('mousewheel', [1, 0, 0]); 17841 } 17842 }); 17843 return false; 17844 }); 17845 17846 } 17847 17848 17849 17850 17851 17852 17853 17854 17855 17856 /** 17857 * Scrollspy plugin initialization. 17858 * 17859 * @since 5.0 17860 */ 17861 function scrollSpyInit() { 17862 17863 var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $window.width() > 1000) ? 0 : $headerOuterEl.outerHeight(); 17864 17865 if ($('.page-template-template-no-header-footer').length > 0 || $('.page-template-template-no-header').length > 0) { 17866 $headerNavSpace = 0; 17867 } 17868 17869 // Track whether scrollspy is really needed. 17870 var hashLinksFound = false; 17871 17872 //prevent jump to top on empty items 17873 $('header#top .sf-menu li a[href="#"]').on('click', function (e) { 17874 e.preventDefault(); 17875 });
17876 17877 if ($('#nectar_fullscreen_rows').length == 0 || $nectarFullPage.$usingFullScreenRows == false) { 17878 17879 $('a.nectar-next-section').each(function () { 17880 17881 if ($(this).parents('.wpb_row:not(.inner_row)').length > 0) { 17882 17883 var $parentRow = $(this).parents('.wpb_row:not(.inner_row)'); 17884 17885 if ($parentRow.next('.wpb_row[id]:not(.inner_row)').length > 0) { 17886 17887 var $nextRowID = $parentRow.next('.wpb_row[id]:not(.inner_row)').attr('id'); 17888 $(this).attr('href', '#' + $nextRowID); 17889 hashLinksFound = true; 17890 } 17891 17892 } 17893 17894 }); 17895 } 17896 17897 else if ($().fullpage) { 17898 $('a.nectar-next-section').on('click', function () { 17899 $.fn.fullpage.moveSectionDown(); 17900 return false; 17901 }); 17902 } 17903 17904 17905 // Links in off canvas menu. 17906 if ($('#slide-out-widget-area .off-canvas-menu-container').length > 0) { 17907 $('#slide-out-widget-area .off-canvas-menu-container').find("a[href*='" + location.pathname + "']").each(function () { 17908 17909 var $href = $(this).attr('href'); 17910 17911 // Regular animated anchors. 17912 if ($href != '#' && 17913 $href.indexOf("#") != -1 && 17914 $href.substr($href.indexOf("#")) !== '#' && 17915 $('div' + $href.substr($href.indexOf("#"))).length > 0) { 17916 17917 $(this).attr('href', $href.substr($href.indexOf("#"))); 17918 17919 $(this).parent() 17920 .removeClass('current_page_item') 17921 .removeClass('current-menu-item'); 17922 17923 } 17924 17925 // Fullpage is a little different. 17926 if ($('div[data-fullscreen-anchor-id="' + $href.substr($href.indexOf("#") + 1) + '"]').length > 0) { 17927 17928 $(this).parent() 17929 .removeClass('current_page_item') 17930 .removeClass('current-menu-item'); 17931 17932 } 17933 17934 }); 17935 } 17936 17937 // Links in header navigation. 17938 $("#header-outer").find("a[href*='" + location.pathname + "']").each(function () { 17939 17940 var $href = $(this).attr('href'); 17941 17942 // Regular animated anchors 17943 if ($href.indexOf("#") != -1 && 17944 $href.substr($href.indexOf("#")) !== '#' && 17945 $('div' + $href.substr($href.indexOf("#"))).length > 0) { 17946 17947 $(this).attr('href', $href.substr($href.indexOf("#"))); 17948 $(this).parent() 17949 .removeClass('current_page_item') 17950 .removeClass('current-menu-item'); 17951 17952 } 17953 17954 // Fullpage is a little different 17955 if ($('div[data-fullscreen-anchor-id="' + $href.substr($href.indexOf("#") + 1) + '"]').length > 0) { 17956 17957 $(this).parent() 17958 .removeClass('current_page_item') 17959 .removeClass('current-menu-item'); 17960 17961 } 17962 17963 }); 17964 17965 // Hash links in menu? 17966 if( $("#header-outer").length > 0 ) { 17967 $("#header-outer").find("a[href*='#']:not([href='#'])").each(function() { 17968 if( $(this).attr('href') !== '#' && 17969 $(this).attr('href') !== '#searchbox' && 17970 $(this).attr('href') !== '#sidewidgetarea') { 17971 hashLinksFound = true; 17972 } 17973 }); 17974 } 17975 17976 if( $("#slide-out-widget-area .off-canvas-menu-container").length > 0 ) { 17977 $("#slide-out-widget-area .off-canvas-menu-container").find("a[href*='#']:not([href='#'])").each(function() { 17978 if( $(this).attr('href') !== '#' ) { 17979 hashLinksFound = true; 17980 } 17981 }); 17982 } 17983 17984 // Init scrollspy. 17985 var targetList = []; 17986 if( hashLinksFound == true ) { 17987 targetList.push('#header-outer nav'); 17988 } 17989 if( $('.page-submenu[data-sticky="true"] a[href*="#"]').length > 0 ) { 17990 targetList.push('.page-submenu[data-sticky="true"]'); 17991 } 17992 17993 if( targetList.length > 0 ) { 17994 targetList.forEach(function(tar, i) { 17995 var $el = (i == 0) ? $body : $(window); 17996 $el.scrollspy({ 17997 target: tar, 17998 offset: $headerNavSpace + nectarDOMInfo.adminBarHeight + 40 17999 }); 18000 }); 18001 } 18002 18003 } 18004 18005 18006 18007 18008 /** 18009 * Called to scroll to hash link on page load 18010 * 18011 * @since 5.0 18012 */ 18013 function pageLoadHash() { 18014 18015 var $hash = window.location.hash; 18016 18017 if( $hash && $hash.length > 0 ) { 18018 $hash = $hash.replace(/<|>/g,''); 18019 } 18020 18021 var $hashSubstrng = ($hash && $hash.length > 0) ? $hash.substring(1, $hash.length) : 0, 18022 headerPadding2 = headerPadding - headerPadding / 1.8, 18023 $hasSlashLength = 0; 18024 18025 18026 // If the hash has slashes 18027 if ($hashSubstrng) { 18028 $hasSlashLength = $hashSubstrng.split("/"); 18029 $hasSlashLength = $hasSlashLength.length; 18030 } 18031 18032 if ($hashSubstrng && $hasSlashLength > 1) { 18033 $hashSubstrng = $hashSubstrng.replace(/\//g, ""); 18034 $hash = $hash.replace(/\//g, ""); 18035 } 18036 18037 if ($hash && $('.main-content').find($hash).length > 0 || 18038 $hash && $('.main-content').find('[data-fullscreen-anchor-id="' + $hashSubstrng + '"]').length > 0) { 18039 18040 var $hashObj = ($('.main-content').find($hash).length > 0) ? $('.main-content').find($hash) : $('.main-content').find('[data-fullscreen-anchor-id="' + $hashSubstrng + '"]'), 18041 $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $window.width() > 1000) ? 0 : $('#header-space').outerHeight(); 18042 18043 if ($('.page-template-template-no-header-footer').length > 0 || $('.page-template-template-no-header').length > 0) { 18044 $headerNavSpace = 0; 18045 } 18046 18047 var $timeoutVar = 100; 18048 18049 if ($('.nectar-box-roll').length > 0 && $('.container-wrap.bottomBoxOut').length > 0) { 18050 nectarBoxRoll.boxRoll(null, -1); 18051 $timeoutVar = 2050; 18052 } 18053 18054 setTimeout(function () { 18055 18056 var $scrollTopDistance; 18057 18058 if ($('body[data-permanent-transparent="1"]').length == 0) { 18059 18060 if (!$body.hasClass('mobile')) { 18061 var $resize = ($('#header-outer[data-header-resize="0"]').length > 0) ? 0 : parseInt(logoShrinkNum) + headerPadding2 * 2; 18062 if ($('#header-outer[data-remove-fixed="1"]').length > 0) { 18063 $headerNavSpace = 0; 18064 } 18065 $scrollTopDistance = $hashObj.offset().top - parseInt($headerNavSpace) + $resize + 3 - nectarDOMInfo.adminBarHeight; 18066 18067 18068 // Condense 18069 if ($('body.mobile').length == 0 && 18070 $('#header-outer[data-condense="true"]').length > 0 && 18071 $('body.page-template-template-no-header').length === 0 && 18072 $('body.page-template-template-no-header-footer').length === 0) { 18073 18074 var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'), 18075 $headerHeightStored = $headerOuterEl.height(),
18076 $headerHeightCondensed = $headerHeightStored - (parseInt($headerSpan9.height()) + parseInt($('#header-outer #logo').css('margin-top'))); 18077 18078 $scrollTopDistance = $hashObj.offset().top - parseInt($headerNavSpace) + $headerHeightCondensed - nectarDOMInfo.adminBarHeight; 18079 } 18080 18081 } else { 18082 $scrollTopDistance = ($('#header-outer[data-mobile-fixed="1"]').length > 0) ? $hashObj.offset().top + 2 - $headerNavSpace + nectarDOMInfo.adminBarHeight : $hashObj.offset().top - nectarDOMInfo.adminBarHeight + 1; 18083 } 18084 18085 } else { 18086 $scrollTopDistance = $hashObj.offset().top - nectarDOMInfo.adminBarHeight + 1; 18087 } 18088 18089 if ($('body[data-hhun="1"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length == 0) { 18090 18091 // Alter offset 18092 if ($('#header-outer.detached').length == 0) { 18093 $scrollTopDistance = $scrollTopDistance + $headerNavSpace; 18094 } 18095 } 18096 18097 var $pageSubMenu = ($('.page-submenu[data-sticky="true"]').length > 0) ? $('.page-submenu').height() : 0; 18098 var $headerSecondary; 18099 18100 if ($('body.material').length > 0 && 18101 $headerSecondaryEl.length > 0 && 18102 $('body[data-hhun="1"]').length == 0 && 18103 $('#header-outer[data-remove-fixed="1"]').length == 0 && 18104 !$body.hasClass('mobile')) { 18105 18106 $headerSecondary = $headerSecondaryEl.height(); 18107 18108 } else { 18109 $headerSecondary = 0; 18110 } 18111 18112 nectar_scrollToY($scrollTopDistance - $pageSubMenu + $headerSecondary, 700, 'easeInOutQuint'); 18113 18114 }, $timeoutVar); 18115 } 18116 } 18117 18118 18119 /** 18120 * Initialize page load hash functionality 18121 * 18122 * @since 10.5 18123 */ 18124 function pageLoadHashInit() { 18125 18126 if ($('body[data-animated-anchors="true"]').length > 0) { 18127 if ($('.nectar-box-roll').length == 0 && $('#nectar_fullscreen_rows').length == 0) { 18128 18129 // Inside tabs 18130 if (typeof nectarGetQueryParam['tab'] != 'undefined') { 18131 setTimeout(function () { 18132 pageLoadHash(); 18133 }, 800); 18134 } 18135 // Regular 18136 else { 18137 pageLoadHash(); 18138 } 18139 18140 } 18141 18142 if ($('#nectar_fullscreen_rows[data-mobile-disable="on"]').length > 0 && $('.nectar-box-roll').length == 0 && 18143 nectarDOMInfo.usingMobileBrowser) { 18144 pageLoadHash(); 18145 } 18146 18147 } 18148 18149 } 18150 18151 18152 /** 18153 * Animated anchor link theme option. 18154 * 18155 * @since 10.5 18156 */ 18157 function animatedAnchorLinks() { 18158 18159 if ($('body[data-animated-anchors="true"]').length > 0 || 18160 $('.single-product [data-gallery-style="left_thumb_sticky"]').length > 0) { 18161 18162 var headerPadding2 = headerPadding - headerPadding / 1.8; 18163 18164 setTimeout(scrollSpyInit, 200); 18165 18166 var $animatedScrollingTimeout; 18167 18168 $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) { 18169 18170 var triggerAnimatedScroll = true; 18171 var $hash = $(this).prop("hash"); 18172 18173 if( !$(this).hasClass('nectar-next-section') && headerHideUntilNeeded == '1' ) { 18174 $body.addClass('animated-scrolling'); 18175 nectarState.animatedScrolling = true; 18176 } 18177 18178 clearTimeout($animatedScrollingTimeout); 18179 18180 $animatedScrollingTimeout = setTimeout(function () { 18181 $body.removeClass('animated-scrolling'); 18182 nectarState.animatedScrolling = false; 18183 }, 850); 18184 18185 var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $window.width() > 1000) ? 0 : $('#header-space').outerHeight(); 18186 18187 if ($('.page-template-template-no-header-footer').length > 0 || 18188 $('.page-template-template-no-header').length > 0 || 18189 $('#header-space').length == 0 ) { 18190 $headerNavSpace = 0; 18191 } 18192 18193 // Delay full page anchors until material right OCM closes 18194 if ( $nectarFullPage.$usingFullScreenRows != false && 18195 $('#nectar_fullscreen_rows[data-anchors="on"]').length > 0 && 18196 $hash && $hash != '' && $hash != '#top' &&
18197 $('body.material[data-slide-out-widget-area-style="slide-out-from-right"].material-ocm-open').length > 0) { 18198 18199 e.preventDefault(); 18200 18201 if (!$(this).hasClass('skip-hash')) { 18202 if (history.pushState) { 18203 history.pushState(null, null, $hash); 18204 } else { 18205 location.hash = $hash; 18206 } 18207 18208 } 18209 18210 setTimeout(function() { 18211 $(window).trigger('hashchange'); 18212 },800); 18213 18214 } 18215 18216 18217 if ($hash && $body.find($hash).length > 0 && $hash != '#top' && $hash != '' && $(this).attr('href').indexOf(window.location.href.split("#")[0]) !== -1 || 18218 $(this).is('[href^="#"]') && $hash != '' && $body.find($hash).length > 0 && $hash != '#top') { 18219 18220 //update hash 18221 if (!$(this).hasClass('skip-hash')) { 18222 if (history.pushState) { 18223 history.pushState(null, null, $hash); 18224 } else { 18225 location.hash = $hash; 18226 } 18227 } 18228 18229 if ($(this).parents('ul').length > 0) { 18230 18231 $(this) 18232 .parents('ul') 18233 .find('li') 18234 .removeClass('current-menu-item'); 18235 } 18236 18237 // Side widget area click 18238 if ($(this).parents('#slide-out-widget-area').length > 0) { 18239 18240 if ($('body.material[data-slide-out-widget-area-style="slide-out-from-right"].material-ocm-open').length > 0) { 18241 18242 $('body > .slide_out_area_close') 18243 .addClass('non-human-allowed') 18244 .trigger('click'); 18245 18246 // Scroll 18247 var $clickedLinkStore = $(this); 18248 18249 triggerAnimatedScroll = false; 18250 18251 setTimeout(function () { 18252 $clickedLinkStore.trigger('click'); 18253 }, 1000); 18254 18255 } else { 18256 $('#slide-out-widget-area .slide_out_area_close') 18257 .addClass('non-human-allowed') 18258 .trigger('click'); 18259 } 18260 18261 setTimeout(function () { 18262 if ($('body.material[data-slide-out-widget-area-style="slide-out-from-right"]').length > 0) { 18263 $('body > .slide_out_area_close').removeClass('non-human-allowed'); 18264 18265 } else { 18266 $('#slide-out-widget-area .slide_out_area_close').removeClass('non-human-allowed'); 18267 } 18268 }, 100); 18269 } 18270 18271 // Mobile menu click 18272 if ( $(this).parents('#mobile-menu').length > 0 ) { 18273 $('.slide-out-widget-area-toggle.mobile-icon a') 18274 .addClass('non-human-allowed') 18275 .trigger('click'); 18276 18277 setTimeout(function () { 18278 $('.slide-out-widget-area-toggle.mobile-icon a').removeClass('non-human-allowed'); 18279 }, 100); 18280 } 18281 18282 var $mobileMenuHeight = ($(this).parents('#mobile-menu').length > 0) ? $(this).parents('#mobile-menu').height() : null; 18283 var $timeoutVar = 1; 18284 var $that = $(this); 18285 18286 if ($('.nectar-box-roll').length > 0 && $('.container-wrap.bottomBoxOut').length > 0) { 18287 nectarBoxRoll.boxRoll(null, -1); 18288 $timeoutVar = 2050; 18289 } 18290 18291 18292 setTimeout(function () { 18293 18294 var $scrollTopDistance; 18295 18296 // Scrolling 18297 if ($('body[data-permanent-transparent="1"]').length == 0) { 18298 18299 if (!$body.hasClass('mobile')) { 18300 var $resize = ($('#header-outer[data-header-resize="0"]').length > 0) ? 0 : parseInt(logoShrinkNum) + headerPadding2 * 2; 18301 if ($('#header-outer[data-remove-fixed="1"]').length > 0) { 18302 $headerNavSpace = 0; 18303 } 18304 18305 $scrollTopDistance = $($hash).offset().top - $mobileMenuHeight - parseInt($headerNavSpace) + $resize + 3 - nectarDOMInfo.adminBarHeight; 18306 18307 // Condense 18308 if ($('body.mobile').length == 0 && 18309 $('body.page-template-template-no-header').length === 0 && 18310 $('body.page-template-template-no-header-footer').length === 0 && 18311 $('#header-outer[data-condense="true"]').length > 0) { 18312 18313 var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'), 18314 $headerHeightStored = $headerOuterEl.height(),
18315 $headerHeightCondensed = $headerHeightStored - (parseInt($headerSpan9.height()) + parseInt($('#header-outer #logo').css('margin-top'))); 18316 $scrollTopDistance = $($hash).offset().top - parseInt($headerNavSpace) + $headerHeightCondensed - nectarDOMInfo.adminBarHeight; 18317 18318 18319 } 18320 18321 18322 } else { 18323 $scrollTopDistance = ($('#header-outer[data-mobile-fixed="1"]').length > 0) ? $($hash).offset().top + 2 - $headerNavSpace + nectarDOMInfo.adminBarHeight : $($hash).offset().top - $mobileMenuHeight - nectarDOMInfo.adminBarHeight + 1; 18324 } 18325 18326 } else { 18327 $scrollTopDistance = $($hash).offset().top - nectarDOMInfo.adminBarHeight + 1; 18328 } 18329 18330 if ($('body[data-hhun="1"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length == 0) { 18331 18332 // Alter offset 18333 if ($('#header-outer.detached').length == 0 || $that.parents('.page-submenu[data-sticky="true"]').length > 0) { 18334 $scrollTopDistance = $scrollTopDistance + $headerNavSpace; 18335 } 18336 18337 // Hide top header 18338 if ($that.parents('.page-submenu[data-sticky="true"]').length > 0) { 18339 18340 $('#header-outer.detached').addClass('invisible'); 18341 $('.page-submenu') 18342 .addClass('header-not-visible') 18343 .css('transform', 'translateY(0px)'); 18344 18345 } 18346 } 18347 18348 var $pageSubMenu = ($that.parents('.page-submenu[data-sticky="true"]').length > 0) ? $that.parents('.page-submenu').height() : 0; 18349 var $headerSecondary; 18350 18351 if ($('body.material').length > 0 && 18352 $headerSecondaryEl.length > 0 && 18353 $('body[data-hhun="1"]').length == 0 && 18354 $('#header-outer[data-remove-fixed="1"]').length == 0 && 18355 !$body.hasClass('mobile')) { 18356 18357 $headerSecondary = $headerSecondaryEl.height(); 18358 18359 } else { 18360 18361 if($('body[data-hhun="1"]').length > 0 && 18362 $headerSecondaryEl.length > 0 && 18363 !$body.hasClass('mobile') && 18364 $('#header-outer[data-remove-fixed="1"]').length == 0) { 18365 $headerSecondary = $headerSecondaryEl.height(); 18366 } else { 18367 $headerSecondary = 0; 18368 } 18369 18370 } 18371 18372 18373 if( triggerAnimatedScroll ) { 18374 nectar_scrollToY($scrollTopDistance - $pageSubMenu + $headerSecondary, 700, 'easeInOutQuint'); 18375 } 18376 18377 18378 }, $timeoutVar); 18379 18380 e.preventDefault(); 18381 18382 } 18383 18384 if ($hash == '#top') { 18385 // Side widget area click 18386 if ($(this).parents('#slide-out-widget-area').length > 0) { 18387 $('#slide-out-widget-area .slide_out_area_close').trigger('click'); 18388 } 18389 } 18390 18391 }); 18392 18393 18394 } 18395 18396 } 18397 18398 18399 18400 18401 18402 18403 /** 18404 * Search results masonry layout. 18405 * 18406 * @since 10.0 18407 */ 18408 function searchResultMasonry() { 18409 18410 var $searchContainer = $('#search-results'), 18411 $dividerNum = ($searchContainer.is('[data-layout="masonry-no-sidebar"]')) ? 4 : 3; 18412 18413 $searchContainer.imagesLoaded(function () { 18414 18415 $searchContainer.isotope({ 18416 itemSelector: '.result', 18417 layoutMode: 'packery', 18418 packery: { 18419 gutter: 0 18420 } 18421 }); 18422 18423 $searchContainer 18424 .find('article') 18425 .css('opacity', '1'); 18426 18427 }); 18428 18429 $window.on('resize', function () { 18430 18431 $searchContainer.isotope({ 18432 layoutMode: 'packery', 18433 packery: { 18434 gutter: 0 18435 } 18436 }); 18437 }); 18438 18439 } 18440 18441 18442 /** 18443 * Search results masonry layout initialization. 18444 * 18445 * @since 10.5 18446 */ 18447 function searchResultMasonryInit() { 18448 if ($('body.search-results').length > 0 && 18449 $('#search-results article').length > 0 && 18450 $('#search-results[data-layout="list-no-sidebar"]').length == 0 && 18451 $('#search-results[data-layout="list-with-sidebar"]').length == 0) { 18452 searchResultMasonry(); 18453 } 18454 } 18455 18456 18457 18458 18459 /** 18460 * Custom colors for portfolio grid elements. 18461 * 18462 * @since 10.5 18463 */ 18464 function portfolioCustomColoring() { 18465 18466 //portfolio colors 18467 if ($('.portfolio-items .col .style-3-alt').length > 0 || 18468 $('.portfolio-items .col .style-3').length > 0 || 18469 $('.portfolio-items .col .style-2').length > 0 || 18470 $('.portfolio-items .col .style-5').length > 0) { 18471 18472 var portfolioColorCss = ''; 18473 18474 $('.portfolio-items .col').each(function () { 18475 18476 var $titleColor = $(this).attr('data-title-color'), 18477 $subTitleColor = $(this).attr('data-subtitle-color'); 18478 18479 if ($titleColor.length > 0) { 18480 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; } '; 18481 portfolioColorCss += ' .portfolio-items[data-ps="8"] .col[data-title-color="' + $titleColor + '"] .line { background-color: ' + $titleColor + '; }'; 18482 portfolioColorCss += '.portfolio-items[data-ps="8"] .col[data-title-color="' + $titleColor + '"] .next-arrow line { stroke: ' + $titleColor + '; } '; 18483 } 18484 if ($subTitleColor.length > 0) { 18485 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; } '; 18486 } 18487 18488 });
18489 18490 //style 18491 nectarCreateStyle(portfolioColorCss, 'nectar-portfolio-colors'); 18492 18493 } 18494 18495 } 18496 18497 18498 18499 18500 /** 18501 * Single post pagination/recent post mouse events 18502 * 18503 * @since 10.5 18504 */ 18505 function postMouseEvents() { 18506 18507 18508 $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 () { 18509 $(this).parents('.grav-wrap') 18510 .find('img') 18511 .addClass('hovered'); 18512 }); 18513 18514 $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 () { 18515 $(this).parents('.grav-wrap') 18516 .find('img') 18517 .removeClass('hovered'); 18518 }); 18519 18520 $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 () { 18521 $(this).addClass('mouse-leaving'); 18522 }); 18523 18524 } 18525 18526 18527 18528 18529 /** 18530 * Masonry portfolio initialization. 18531 * 18532 * @since 10.5 18533 */ 18534 function masonryPortfolioInit() { 18535 18536 $portfolio_containers = []; 18537 18538 var portfolioElCount = 0; 18539 18540 $('.portfolio-items:not(.carousel)').each(function(i) { 18541 18542 if( $(this).parents('.wpb_gallery').length > 0 && $(this).find('.nectar-lazy').length > 0 ) { 18543 18544 $(this).find('.col').each(function(i) { 18545 $(this).delay(90*i).queue(function(next){ 18546 $(this).addClass("animated-in"); 18547 next(); 18548 });
18549 }); 18550 18551 return true; 18552 } 18553 18554 $(this).attr('instance', i); 18555 $(this).parent().parent().find('div[class^=portfolio-filters]').attr('instance', i); 18556 18557 if (typeof SalientPortfolio !== 'undefined') { 18558 $portfolio_containers[portfolioElCount] = new SalientPortfolio($(this), fullWidthContentColumns); 18559 portfolioElCount++; 18560 } 18561 18562 }); 18563 18564 } 18565 18566 18567 18568 18569 /** 18570 * Perspective load in styling. 18571 * 18572 * @since 8.0 18573 */ 18574 function updatePerspectiveOrigin() { 18575 18576 if( nectarDOMInfo.winW > 690 ) { 18577 $('.posts-container[data-load-animation="perspective"]').css('perspective-origin', '50% ' + (nectarDOMInfo.scrollTop + nectarDOMInfo.winH) + 'px'); 18578 } 18579 requestAnimationFrame(updatePerspectiveOrigin); 18580 18581 } 18582 18583 18584 /** 18585 * Perspective load in styling. 18586 * 18587 * @since 8.0 18588 */ 18589 function updatePerspectiveOriginInit() { 18590 18591 if ($('.posts-container[data-load-animation="perspective"]').length > 0) { 18592 requestAnimationFrame(updatePerspectiveOrigin); 18593 } 18594 18595 } 18596 18597 18598 18599 /** 18600 * Blog load in animation. 18601 * 18602 * @since 3.0 18603 */ 18604 function blogLoadIn(post_container) { 18605 18606 if (post_container.attr('data-load-animation') == 'none') { 18607 18608 post_container 18609 .find('.inner-wrap') 18610 .removeClass('animated'); 18611 18612 } else { 18613 18614 post_container.find('article').each(function (i) { 18615 18616 // Loaded visible 18617 if ($(this).visible(true)) { 18618 18619 $(this).delay(110 * i).queue(function (next) { 18620 $(this).addClass("animated-in"); 18621 next(); 18622 });
18623 18624 18625 } else { 18626 18627 // Not already visible 18628 var $that = $(this); 18629 var waypoint = new Waypoint({ 18630 18631 element: $that, 18632 handler: function () { 18633 18634 setTimeout(function () { 18635 $that.addClass("animated-in"); 18636 }, 80 * $that.attr('data-delay-amount')); 18637 18638 waypoint.destroy(); 18639 }, 18640 offset: '90%' 18641 18642 }); 18643 } 18644 18645 }); 18646 18647 } 18648 18649 } 18650 18651 18652 /** 18653 * Masonry blog initialization. 18654 * 18655 * @since 10.5 18656 */ 18657 function masonryBlogInit() { 18658 18659 $nectarMasonryBlogs = []; 18660 18661 $('.posts-container').each(function (i) { 18662 18663 if ($(this).parent().hasClass('masonry') && !$(this).parent().hasClass('auto_meta_overlaid_spaced')) { 18664 18665 if (typeof NectarMasonryBlog == 'undefined') { 18666 return; 18667 } 18668 18669 $nectarMasonryBlogs[i] = new NectarMasonryBlog($(this), fullWidthSections, blogLoadIn); 18670 18671 } else { 18672 18673 blogLoadIn($(this)); 18674 18675 } 18676 18677 }); 18678 } 18679 18680 18681 18682 /** 18683 * Sticky Sidebar initialization. 18684 * 18685 * @since 10.5 18686 */ 18687 function stickySidebarInit() { 18688 18689 if (!$().theiaStickySidebar || nectarDOMInfo.usingMobileBrowser && nectarDOMInfo.winW < 1000 ) { 18690 return; 18691 } 18692 18693 var stickySelectors = '#sidebar[data-nectar-ss="true"], #sidebar[data-nectar-ss="1"], .nectar-scrolling-tabs .scrolling-tab-nav'; 18694 if( window.nectarOptions && window.nectarOptions.woo_sticky_sidebar && window.nectarOptions.woo_sticky_sidebar === '1' ) { 18695 stickySelectors += ', .woocommerce.archive #sidebar'; 18696 } 18697 18698 $(stickySelectors).each(function () { 18699 18700 // Padding from top of screen 18701 var $ssExtraTopSpace = 50; 18702 18703 if ($('#header-outer[data-remove-fixed="0"]').length > 0 && 18704 $('body[data-hhun="1"]').length == 0 && 18705 $('#header-outer[data-format="left-header"]').length == 0) { 18706 18707 $ssExtraTopSpace += $headerOuterEl.outerHeight(); 18708 18709 // Resize effect 18710 if ($('#header-outer[data-shrink-num][data-header-resize="1"]').length > 0) { 18711 var headerPadding2 = parseInt($headerOuterEl.attr('data-padding')) - parseInt($headerOuterEl.attr('data-padding')) / 1.8; 18712 $ssExtraTopSpace -= logoShrinkNum; 18713 $ssExtraTopSpace -= headerPadding2; 18714 } 18715 18716 // Condense 18717 if ($('body.mobile').length == 0 && $('#header-outer[data-condense="true"]').length > 0) { 18718 18719 var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'); 18720 $ssExtraTopSpace = 50; 18721 $ssExtraTopSpace += $headerOuterEl.height() - (parseInt($headerSpan9.position().top) - parseInt($('#header-outer #logo').css('margin-top'))) - parseInt(nectarDOMInfo.secondaryHeaderHeight); 18722 } 18723 18724 } 18725 18726 if ($wpAdminBar.length > 0) { 18727 $ssExtraTopSpace += $wpAdminBar.outerHeight(); 18728 } 18729 18730 18731 if ($(this).parents('.wpb_widgetised_column').length > 0) { 18732 18733 if ($('body.vc_editor').length > 0) { 18734 // Skip processing. 18735 } else { 18736 $(this).parents('.wpb_column').theiaStickySidebar({ 18737 additionalMarginTop: $ssExtraTopSpace, 18738 updateSidebarHeight: false 18739 });
18740 } 18741 18742 } else { 18743 $(this).theiaStickySidebar({ 18744 additionalMarginTop: $ssExtraTopSpace, 18745 updateSidebarHeight: false 18746 }); 18747 } 18748 18749 }); 18750 } 18751 18752 18753 18754 18755 18756 /** 18757 * Section down arrow animated link 18758 * 18759 * @since 10.5 18760 */ 18761 function sectionDownArrowEvent() { 18762 18763 var headerPadding2 = headerPadding - headerPadding / 1.8; 18764 18765 $body.on('click', '.section-down-arrow, .scroll-down-wrap > .minimal-arrow', function () { 18766 18767 if ($(this).parents('.nectar-box-roll').length > 0) { 18768 return false; 18769 } 18770 18771 var $currentSection = $(this).parents('#page-header-bg'), 18772 $topDistance = $currentSection.height(), 18773 $offset = ($currentSection.parents('.first-section').length == 0 || $('body[data-transparent-header="false"]').length > 0) ? $currentSection.offset().top : 0, 18774 $bodyBorderSize = ($bodyBorderTop.length > 0 && $window.width() > 1000) ? $bodyBorderTop.height() : 0, 18775 $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0) ? 0 : $('#header-space').height(), 18776 $materialSecondary = 0; 18777 18778 if ($('body.material').length > 0 && $headerSecondaryEl.length > 0) { 18779 $materialSecondary = $headerSecondaryEl.height(); 18780 } 18781 18782 if ($('body[data-permanent-transparent="1"]').length == 0) { 18783 18784 // Regular 18785 if (!$body.hasClass('mobile')) { 18786 18787 if ($('body[data-hhun="1"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length == 0) { 18788 18789 nectar_scrollToY(parseInt($topDistance) + $offset + 2 - $bodyBorderSize * 2, 700, 'easeInOutQuint'); 18790 18791 } else { 18792 18793 var $resize = ($('#header-outer[data-header-resize="0"]').length > 0) ? 0 : parseInt(logoShrinkNum) + headerPadding2 * 2; 18794 if ($('#header-outer[data-remove-fixed="1"]').length > 0) { 18795 $headerNavSpace = 0; 18796 $offset = 0; 18797 } 18798 18799 // Condense 18800 if ($('body.mobile').length == 0 && $('#header-outer[data-condense="true"]').length > 0) { 18801 var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'); 18802 $headerNavSpace = $headerOuterEl.height() - (parseInt($headerSpan9.position().top) - parseInt($('#header-outer #logo').css('margin-top'))) - parseInt(nectarDOMInfo.secondaryHeaderHeight); 18803 } 18804 18805 nectar_scrollToY(parseInt($topDistance - $headerNavSpace) + $resize + 3 + $offset + $materialSecondary, 700, 'easeInOutQuint'); 18806 18807 } 18808 18809 } else { 18810 18811 var $scrollPos; 18812 18813 if($('#header-outer[data-mobile-fixed="1"]').length > 0) { 18814 $scrollPos = parseInt($topDistance) - $headerNavSpace + parseInt($currentSection.offset().top) + 2; 18815 } else { 18816 $scrollPos = parseInt($topDistance) + parseInt($currentSection.offset().top) + 2; 18817 } 18818 18819 nectar_scrollToY($scrollPos - $bodyBorderSize * 2, 700, 'easeInOutQuint'); 18820 18821 } 18822 18823 } else { 18824 // Permanent transparent 18825 nectar_scrollToY(parseInt($topDistance) + parseInt($currentSection.offset().top) + 2 - $bodyBorderSize * 2, 700, 'easeInOutQuint'); 18826 18827 } 18828 return false; 18829 }); 18830 18831 } 18832 18833 18834 18835 18836 18837 /** 18838 * Displace filter column/row BG effect - fullpage 18839 * 18840 * @since 10.5 18841 */ 18842 function nectarLiquidBGFP() { 18843 18844 $('.nectar-liquid-bg').removeClass('animated-in'); 18845 18846 for (var k = 0; k < $liquidBG_EL.length; k++) { 18847 18848 if ($liquidBG_EL[k].animationType == 'displace-filter-fade' && $($liquidBG_EL[k].canvasContainer).parents('.fp-section.active').length > 0) { 18849 18850 //add bg to container 18851 if ($($liquidBG_EL[k].canvasContainer).find('.image-added-to-stage').length == 0) { 18852 $liquidBG_EL[k].imgContainer.addChild($liquidBG_EL[k].bg); 18853 } 18854 18855 $($liquidBG_EL[k].canvasContainer) 18856 .find('.nectar-liquid-bg') 18857 .addClass('image-added-to-stage'); 18858 18859 $liquidBG_EL[k].animateProps($liquidBG_EL[k]); 18860 18861 } 18862 } 18863 } 18864 18865 18866 /** 18867 * Page Full Screen Rows 18868 * 18869 * @since 10.5 18870 */ 18871 function nectarFullPageInit() { 18872 18873 if ($('#nectar_fullscreen_rows').length > 0 && $().fullpage) { 18874 18875 $fullscreenSelector = (window.vc_iframe) ? '.vc_element.vc_vc_row.active ' : '.wpb_row.active '; 18876 18877 var $disableFPonMobile = ($('#nectar_fullscreen_rows[data-mobile-disable]').length > 0) ? $('#nectar_fullscreen_rows').attr('data-mobile-disable') : 'off'; 18878 if( !nectarDOMInfo.usingMobileBrowser ) { 18879 $disableFPonMobile = 'off'; 18880 }
18881 // Support for mobile animation theme option. 18882 if( $disableFPonMobile != 'on' ) { 18883 $fullscreenMarkupBool = true; 18884 } else { 18885 $fullscreenSelector = ''; 18886 } 18887 18888 $nectarFullPage = new NectarFullScreenRows(waypoints, $mouseParallaxScenes, nectarLiquidBGFP, nectarDOMInfo, responsiveTooltips, $standAnimatedColTimeout, $svgIcons); 18889 18890 } 18891 18892 } 18893 18894 18895 18896 18897 /** 18898 * Cross browser adjustments. 18899 * 18900 * @since 1.0 18901 */ 18902 function crossBrowserAdjust() { 18903 18904 // Add specific class if on device for better tablet tracking. 18905 if (nectarDOMInfo.usingMobileBrowser) { 18906 $body.addClass('using-mobile-browser'); 18907 } 18908 18909 // Add class for old IE. 18910 var ua = window.navigator.userAgent; 18911 var msie = ua.indexOf("Edge/"); 18912 if (msie > 0) { 18913 $body.addClass('msie'); 18914 } 18915 18916 // For users updating to 8 with a custom, old header template file 18917 if ($('html.js').length == 0) { 18918 $('html').removeClass('no-js').addClass('js'); 18919 } 18920 18921 //remove br's from code tag 18922 $('code').find('br').remove(); 18923 18924 // Contact form 7. 18925 $('.wpcf7-form p:has(input[type=submit])').css('padding-bottom', '0px'); 18926 18927 $('.full-width-content .wpcf7-submit').on('click', function () { 18928 setTimeout(function () { 18929 fullWidthContentColumns(); 18930 }, 1000); 18931 setTimeout(function () { 18932 fullWidthContentColumns(); 18933 }, 2000); 18934 }); 18935 18936 // Gravity form inside fw content row 18937 $('.gform_body').on('click', function () { 18938 setTimeout(function () { 18939 fullWidthContentColumns(); 18940 }, 200); 18941 }); 18942 18943 // Popup Maker. 18944 $('.pum.pum-theme-salient-page-builder-optimized button.pum-close').wrapInner('<span />'); 18945 18946 // pum inside fspr 18947 if ($('#nectar_fullscreen_rows').length > 0 && 18948 $('.pum-container .pum-content > .wpb_row .full-page-inner > .container > .span_12').length > 0) { 18949 $('.pum-container .pum-content > .wpb_row .full-page-inner > .container > .span_12').unwrap(); 18950 } 18951 18952 // Blog bottom padding 18953 if ($('.single .blog_next_prev_buttons').length > 0) { 18954 $('.container-wrap').css('padding-bottom', 0); 18955 } 18956 18957 // Remove margin on last cols inside of full width sections 18958 $('.full-width-section').each(function () { 18959 $(this).find('> .span_12 > div.col_last').last().css('margin-bottom', '0'); 18960 }); 18961 18962 // Remove boxed style from full width content 18963 $('.full-width-content .col.boxed').removeClass('boxed'); 18964 18965 // Neg marg z-index adjust 18966 $('.wpb_column.neg-marg').parents('.wpb_row').css('z-index', '110'); 18967 18968 // Using full width section shortcode with WPBakery columns. 18969 $('.wpb_row.legacy').each(function(){ 18970 if( $(this).find('.wpb_column').length > 0 ) { 18971 $(this).removeClass('legacy'); 18972 } 18973 }); 18974 18975 } 18976 18977 18978 18979 18980 //vc col mobile fixes 18981 function vcMobileColumns() { 18982 18983 $('.wpb_row').each(function () { 18984 if (typeof $(this).find('.span_12').offset() != 'undefined') { 18985 18986 $(this).find('[class*="vc_col-"]').each(function () { 18987 18988 var $firstChildOffset = $(this).parents('.span_12').offset().left; 18989 18990 $(this).removeClass('no-left-margin'); 18991 18992 if ($(this).offset().left < $firstChildOffset + 27) { 18993 $(this).addClass('no-left-margin'); 18994 } else { 18995 $(this).removeClass('no-left-margin'); 18996 } 18997 });
18998 } 18999 }); 19000 } 19001 19002 function vcMobileColumnsInit() { 19003 19004 var $winDOMWidth = nectarDOMInfo.winW, 19005 $winDOMHeight = nectarDOMInfo.winH, 19006 $orientChangeTrack = 0; 19007 19008 // Only needed in legacy column setups. 19009 if( $body.is('[data-flex-cols="true"]') ) { 19010 return; 19011 } 19012 19013 if ($('[class*="vc_col-xs-"], [class*="vc_col-md-"], [class*="vc_col-lg-"]').length > 0) { 19014 19015 // Trigger immediately. 19016 vcMobileColumns(); 19017 19018 // Resize. 19019 if( !nectarDOMInfo.usingMobileBrowser ) { 19020 // Bind normally for desktop. 19021 $window.on('resize',vcMobileColumns); 19022 } 19023 else { 19024 19025 // For mobile make sure the orientation has changed. 19026 window.addEventListener("orientationchange", function () { 19027 $orientChangeTrack = 1; 19028 }); 19029 19030 $window.on('resize', function () { 19031 19032 if (($window.width() != $winDOMWidth && $window.height != $winDOMHeight) || $orientChangeTrack === 1) { 19033 19034 vcMobileColumns(); 19035 19036 // Store the current window dimensions. 19037 $winDOMWidth = nectarDOMInfo.winW; 19038 $winDOMHeight = nectarDOMInfo.winH; 19039 19040 // Reset orientation change tracker. 19041 $orientChangeTrack = 0; 19042 } 19043 19044 }); 19045 19046 19047 } // end mobile only. 19048 19049 } // endif vc offset cols found. 19050 19051 19052 } 19053 19054 19055 19056 19057 /** 19058 * Select2 plugin initialization. 19059 * 19060 * @since 5.0 19061 */ 19062 function select2Init() { 19063 19064 $('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 () { 19065 19066 // Prevent search from triggering on small devices. 19067 var $minimumToSearch = ( nectarDOMInfo.winW > 690 ) ? 7 : 200; 19068 19069 // Skip search class 19070 if( $(this).hasClass('skip-select2-search') || $(this).parents('.skip-select2-search').length > 0 ) { 19071 $minimumToSearch = 1000; 19072 } 19073 19074 if ($(this).parents('#buddypress').length == 0) { 19075 19076 var woo_product_dropdown_style = (window.nectarOptions && window.nectarOptions.woo_product_variable_select ) ? window.nectarOptions.woo_product_variable_select : 'default'; 19077 19078 // Default. 19079 var select2OptionsObj = { 19080 minimumResultsForSearch: $minimumToSearch, 19081 width: '100%' 19082 }; 19083 19084 // Inline scenario els 19085 if( woo_product_dropdown_style == 'underline' || 19086 $(this).parents('.woocommerce-ordering').length > 0 ) { 19087 19088 select2OptionsObj = { 19089 minimumResultsForSearch: $minimumToSearch, 19090 dropdownParent: $(this).parent(), 19091 dropdownAutoWidth: true 19092 }; 19093 19094 } 19095 19096 $(this).select2(select2OptionsObj); 19097 19098 } 19099 19100 }); 19101 } 19102 19103 19104 /** 19105 * Fancy select styling theme option. 19106 * 19107 * @since 10.5 19108 */ 19109 function fancySelectStyling() { 19110 19111 if ( $('body[data-fancy-form-rcs="1"]').length > 0 ) { 19112 19113 $('select:not(.comment-form-rating #rating)').each(function () { 19114 19115 var $selector; 19116 19117 //cf7 19118 if ($(this).parents('.wpcf7-form-control-wrap').length > 0) { 19119 19120 //select 2 already initialized 19121 if ($(this).parents('.wpcf7-form-control-wrap').find('.select2-container').length > 0) { 19122 $selector = $($(this).prev('.select2-container')); 19123 } else { 19124 $selector = $(this); 19125 } 19126 19127 //if label is found 19128 if ($selector.parents('.wpcf7-form-control-wrap').parent().find('label').length == 1) { 19129 $selector.parents('.wpcf7-form-control-wrap').parent().wrapInner('<div class="fancy-select-wrap" />'); 19130 } else { 19131 //default wrap 19132 $selector.wrap('<div class="fancy-select-wrap" />'); 19133 } 19134 } 19135 //default 19136 else { 19137 19138 //select 2 already initialized 19139 if ($(this).prev('.select2-container').length > 0) { 19140 $selector = $(this).prev('.select2-container'); 19141 } else { 19142 $selector = $(this); 19143 } 19144 19145 if ($(this).parents('#buddypress').length == 0 && $(this).parents('.widget_categories').length == 0) { 19146 //if label is found 19147 if ($selector.prev('label').length == 1) { 19148 $selector.prev('label').andSelf().wrapAll('<div class="fancy-select-wrap" />'); 19149 } else if ($selector.next('label').length == 1) { 19150 $selector.next('label').andSelf().wrapAll('<div class="fancy-select-wrap" />'); 19151 } else { 19152 //default wrap 19153 $selector.wrap('<div class="fancy-select-wrap" />'); 19154 } 19155 } 19156 19157 } 19158 });
19159 19160 select2Init(); 19161 19162 } 19163 19164 } 19165 19166 19167 19168 19169 19170 /** 19171 * Back/Forward Safari cache assist. 19172 * 19173 * @since 10.5 19174 */ 19175 function bfCacheAssist() { 19176 19177 //Back/forward cache OCM close 19178 if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1 || 19179 navigator.userAgent.match(/(iPod|iPhone|iPad)/)) { 19180 19181 window.onpageshow = function (event) { 19182 19183 if (event.persisted) { 19184 19185 // Play video BGs 19186 $('.nectar-video-wrap, .nectar-slider-wrap .swiper-slide .video-wrap').each(function () { 19187 19188 if ($(this).find('video').length > 0) { 19189 $(this).find('video')[0].play(); 19190 } 19191 19192 }); 19193 19194 19195 // Close mobile nav 19196 19197 //// Material Skin. 19198 if ($('body.material-ocm-open').length > 0) { 19199 $('body > .slide_out_area_close').addClass('non-human-allowed').trigger('click'); 19200 19201 setTimeout(function () { 19202 $('body > .slide_out_area_close').removeClass('non-human-allowed'); 19203 }, 100); 19204 19205 } else if ($('#slide-out-widget-area.slide-out-from-right-hover.open').length > 0 && navigator.userAgent.match(/(iPod|iPhone|iPad)/)) { 19206 OCM_mobileSlideOutRightHoverCloseCheck(); 19207 } 19208 // Others 19209 else if ($('#slide-out-widget-area.fullscreen.open').length > 0 || 19210 $('#slide-out-widget-area.fullscreen-alt.open').length > 0 || 19211 $('#slide-out-widget-area.slide-out-from-right.open').length > 0) { 19212 19213 $('#slide-out-widget-area .slide_out_area_close').addClass('non-human-allowed'); 19214 $('.slide-out-widget-area-toggle:not(.std-menu) a.open') 19215 .addClass('non-human-allowed') 19216 .trigger('click'); 19217 19218 setTimeout(function () { 19219 $('#slide-out-widget-area .slide_out_area_close').removeClass('non-human-allowed'); 19220 }, 100); 19221 19222 } 19223 19224 } // Loaded from bf cache 19225 19226 }; // onpage show 19227 19228 } 19229 19230 } 19231 19232 19233 19234 19235 19236 19237 /*-------------------------------------------------------------------------*/ 19238 /* WPBakery Frontend Editor 19239 /*-------------------------------------------------------------------------*/ 19240 19241 /** 19242 * Control adjustments 19243 * 19244 * @since 10.0 19245 */ 19246 function addRowCtrls() { 19247 19248 //remove padding for rows with only fullwidth ns 19249 $('.wpb_row').removeClass('only-ns'); 19250 19251 $('.nectar-slider-wrap[data-full-width="true"], .page-submenu, .portfolio-items[data-col-num="elastic"]:not(.fullwidth-constrained), .blog-fullwidth-wrap') 19252 .parents('.wpb_row') 19253 .addClass('only-ns'); 19254 19255 //padding when column contains item that could get lost under column controls 19256 $('body.vc_editor.compose-mode .wpb_row .vc_vc_column > .wpb_column > .vc_column-inner').each(function() { 19257 19258 if ($(this).find('> .vc_element-container > div').length > 0) { 19259 19260 if ($(this).find('> .vc_element-container > div:first-child').is('.vc_vc_row_inner')) { 19261 $(this).find('> .vc_element-container > div:first-child').addClass('first-inner-row-el'); 19262 } else { 19263 $(this).find('> .vc_element-container > div:first-child').removeClass('first-inner-row-el'); 19264 } 19265 19266 } 19267 19268 }); 19269 19270 } //addRowCtrl end 19271 19272 19273 /** 19274 * Convert front end padding 19275 * 19276 * Needed when the flexbox grid is not active due to 19277 * different markup in front end page builder view. 19278 * 19279 * @since 10.0 19280 */ 19281 function convertFrontEndPadding() { 19282 19283 $('.vc_element > .wpb_column[class*="padding-"][class*="-percent"]').each(function() { 19284 19285 var $elPaddingPercent = 4; 19286 19287 var elclassName = this.className.match(/padding-\d+/); 19288 if (elclassName) { 19289 $elPaddingPercent = elclassName[0].match(/\d+/); 19290 if ($elPaddingPercent) { 19291 $elPaddingPercent = $elPaddingPercent[0] / 100; 19292 } else { 19293 $elPaddingPercent = 0; 19294 } 19295 } 19296 19297 if ($elPaddingPercent) { 19298 var $parentRowWidth = $(this).parents('.span_12').width(); 19299 19300 if ($(this).is('[data-padding-pos="all"]')) { 19301 $(this).css('padding', $parentRowWidth * $elPaddingPercent); 19302 } else if ($(this).is('[data-padding-pos="top"]')) { 19303 $(this).css('padding-top', $parentRowWidth * $elPaddingPercent); 19304 } else if ($(this).is('[data-padding-pos="bottom"]')) { 19305 $(this).css('padding-bottom', $parentRowWidth * $elPaddingPercent); 19306 } else if ($(this).is('[data-padding-pos="left"]')) { 19307 $(this).css('padding-left', $parentRowWidth * $elPaddingPercent); 19308 } else if ($(this).is('[data-padding-pos="right"]')) { 19309 $(this).css('padding-right', $parentRowWidth * $elPaddingPercent); 19310 } else if ($(this).is('[data-padding-pos="top-bottom"]')) { 19311 $(this).css({ 19312 'padding-top': $parentRowWidth * $elPaddingPercent, 19313 'padding-bottom': $parentRowWidth * $elPaddingPercent, 19314 });
19315 } else if ($(this).is('[data-padding-pos="top-right"]')) { 19316 $(this).css({ 19317 'padding-top': $parentRowWidth * $elPaddingPercent, 19318 'padding-right': $parentRowWidth * $elPaddingPercent, 19319 }); 19320 } else if ($(this).is('[data-padding-pos="bottom-right"]')) { 19321 $(this).css({ 19322 'padding-right': $parentRowWidth * $elPaddingPercent, 19323 'padding-bottom': $parentRowWidth * $elPaddingPercent, 19324 }); 19325 } else if ($(this).is('[data-padding-pos="bottom-left"]')) { 19326 $(this).css({ 19327 'padding-left': $parentRowWidth * $elPaddingPercent, 19328 'padding-bottom': $parentRowWidth * $elPaddingPercent, 19329 }); 19330 } else if ($(this).is('[data-padding-pos="left-right"]')) { 19331 $(this).css({ 19332 'padding-left': $parentRowWidth * $elPaddingPercent, 19333 'padding-right': $parentRowWidth * $elPaddingPercent, 19334 }); 19335 } 19336 } 19337 19338 }); 19339 19340 $('.wpb_row[class*="vc_custom_"]').each(function() { 19341 19342 $(this).parent().addClass('no-bottom-margin'); 19343 19344 }); 19345 19346 } 19347 19348 19349 /** 19350 * WPBakery Front end editor integration 19351 * 19352 * @since 10.0 19353 */ 19354 function wpBakeryFrontendInit() { 19355 19356 // Set up controls/column padding. 19357 setTimeout(function() { 19358 19359 if ($('body.compose-mode').length > 0) { 19360 $('.container-wrap').addClass('visible-editor-controls'); 19361 } 19362 19363 if (nectarDOMInfo.usingFrontEndEditor) { 19364 addRowCtrls(); 19365 19366 if( !$body.is('[data-flex-cols="true"]') ) { 19367 convertFrontEndPadding(); 19368 $window.on('smartresize',convertFrontEndPadding); 19369 } 19370 19371 } 19372 19373 }, 200); 19374 19375 // Bind reload event 19376 $window.on('vc_reload', function() { 19377 19378 addRowCtrls(); 19379 columnBGColors(); 19380 coloredButtons(); 19381 twentytwentyInit(); 19382 parallaxRowsBGCals(); 19383 flexsliderInit(); 19384 accordionInit(); 19385 ulCheckmarks(); 19386 nectarFancyUlIcons(); 19387 nectarFancyBoxHover(); 19388 oneFourthClasses(); 19389 carouselfGrabbingClass(); 19390 nectarPostGridInit(); 19391 splitLineHeadingInit(); 19392 nectarVideoLightbox(); 19393 nectarKeyframeAssist(); 19394 nectarLazyImageLoading(); 19395 19396 if ($('.carousel').length > 0) { 19397 standardCarouselInit(); 19398 clientsCarouselInit(); 19399 carouselHeightCalcs(); 19400 } 19401 19402 if ($('.owl-carousel').length > 0) { 19403 $('.owl-carousel').each(function() { 19404 $(this).trigger('destroy.owl.carousel').removeClass('owl-loaded'); 19405 $(this).find('.owl-stage-outer .owl-stage > *').unwrap(); 19406 $(this).find('.owl-stage-outer > *').unwrap(); 19407 $(this).find('.owl-item > *').unwrap(); 19408 $(this).find('.owl-dots').remove(); 19409 $(this).find('.owl-nav').remove(); 19410 }); 19411 owlCarouselInit(); 19412 } 19413 19414 if ($('.nectar_cascading_images').length > 0) { 19415 imagesLoaded($('.nectar_cascading_images'), function() { 19416 cascadingImageBGSizing(); 19417 }); 19418 } 19419 19420 fullWidthSections(); 19421 fwsClasses(); 19422 recentPostsInit(); 19423 fullWidthRowPaddingAdjust(); 19424 19425 /*flickity carousels*/ 19426 if ($flickitySliders.length > 0) { 19427 for (var i = 0; i < $flickitySliders.length; i++) { 19428 19429 $flickitySliders[i].reloadCells(); 19430 $flickitySliders[i].off('scroll.flickity'); 19431 $flickitySliders[i].off('dragStart.flickity'); 19432 $flickitySliders[i].off('dragEnd.flickity'); 19433 19434 } 19435 } 19436 19437 flickityLazyInit(); 19438 19439 setTimeout(function() { 19440 19441 flickityInit(); 19442 if ($flickitySliders.length > 0) { 19443 for (var i = 0; i < $flickitySliders.length; i++) { 19444 $flickitySliders[i].reloadCells(); 19445 $flickitySliders[i].resize(); 19446 } 19447 } 19448 19449 }, 100); 19450 19451 /*flickity product carousels*/ 19452 if ($wooFlickityCarousels.length > 0) { 19453 for (var i = 0; i < $wooFlickityCarousels.length; i++) { 19454 19455 $wooFlickityCarousels[i].flickity('reloadCells'); 19456 $wooFlickityCarousels[i].off('scroll.flickity'); 19457 $wooFlickityCarousels[i].off('dragStart.flickity'); 19458 $wooFlickityCarousels[i].off('dragEnd.flickity'); 19459 19460 } 19461 } 19462 19463 setTimeout(function() { 19464 19465 if ($('.nectar-woo-flickity').length > 0) { 19466 productCarouselInit(); 19467 } 19468 if ($wooFlickityCarousels.length > 0) { 19469 for (var i = 0; i < $wooFlickityCarousels.length; i++) { 19470 $wooFlickityCarousels[i].flickity('reloadCells'); 19471 $wooFlickityCarousels[i].flickity('resize'); 19472 } 19473 } 19474 19475 }, 100); 19476 19477 nectarTestimonialSliders(); 19478 19479 for (var i = 0; i < $testimonialSliders.length; i++) { 19480 19481 if ($testimonialSliders[i].type == 'multiple_visible' || 19482 $testimonialSliders[i].type == 'multiple_visible_minimal') { 19483 19484 $testimonialSliders[i].flickityEl.flickity('reloadCells'); 19485 $testimonialSliders[i].flickityEl.off('select.flickity'); 19486 nectarTestimonialSliders(); 19487 $testimonialSliders[i].flickityEl.resize(); 19488 } 19489 19490 $testimonialSliders[i].testimonialSliderHeight(); 19491 } 19492 nectarTestimonialSlidersEvents(); 19493 19494 pricingTableHeight(); 19495 nectarIconMatchColoring(); 19496 lightBoxInit(); 19497 imageWithHotspotEvents(); 19498 largeIconHover(); 19499 nectarBoxRollInit(); 19500 midnightInit(); 19501 responsiveVideoIframesInit(); 19502 responsiveVideoIframes(); 19503 fullWidthContentColumns(); 19504 setTimeout(fullWidthContentColumns, 1000); 19505 videoBGInit(); 19506 vcFullHeightRowInit(); 19507 $window.off('scroll.parallaxSections').off('resize.parallaxSections'); 19508 parallaxScrollInit(); 19509 masonryBlogInit(); 19510 masonryPortfolioInit(); 19511 19512 if ($portfolio_containers.length > 0) { 19513 for (var i = 0; i < $portfolio_containers.length; i++) { 19514 $portfolio_containers[i].portfolioAccentColor(); 19515 } 19516 } 19517 19518 parallaxItemHoverEffect(); 19519 fsProjectSliderInit(); 19520 19521 setTimeout(function() { 19522 if ($('.nectar_fullscreen_zoom_recent_projects').length > 0) { 19523 19524 if ($fsProjectSliderArr.length > 0) { 19525 for (var i = 0; i < $fsProjectSliderArr.length; i++) { 19526 $fsProjectSliderArr[i].sliderCalcs(); 19527 } 19528 } 19529 19530 } 19531 }, 300); 19532 19533 $window.unbind('.infscr'); 19534 infiniteScrollInit();
19535 mouseParallaxInit(); 19536 19537 //play video BGs 19538 $('.nectar-video-wrap').each(function() { 19539 if ($(this).find('video').length > 0) { 19540 $(this).find('video').css('visibility', 'visible'); 19541 } 19542 }); 19543 19544 //tablet inherits small desktop 19545 $('.wpb_column[data-t-w-inherits]').each(function() { 19546 if ($(this).is('[data-t-w-inherits="small_desktop"]')) { 19547 $(this).parent().addClass('inherits-s-desktop-col'); 19548 } else { 19549 $(this).parent().removeClass('inherits-s-desktop-col'); 19550 } 19551 }); 19552 19553 //full screen page rows 19554 if ($('#nectar_fullscreen_rows').length > 0) { 19555 19556 if ($('#nectar_fullscreen_rows > .vc_element').length == 0) { 19557 $('#nectar_fullscreen_rows').prepend('<div class="vc_element empty_placeholder" />'); 19558 } 19559 19560 19561 if ($('#nectar_fullscreen_rows > .vc_element:not(.empty_placeholder)').length > 0) { 19562 $('#nectar_fullscreen_rows >.vc_element.empty_placeholder').remove(); 19563 } 19564 19565 19566 $.fn.fullpage.destroy('all'); 19567 nectarFullPageInit(); 19568 19569 //keep tooltip active status 19570 var nectarFPOffsets = [{ 19571 el: '', 19572 offset: 0 19573 }]; 19574 19575 ////create list of offsets 19576 $('#nectar_fullscreen_rows > div.vc_element').each(function(i) { 19577 nectarFPOffsets[i] = { 19578 el: $(this), 19579 offset: $(this).offset().top 19580 }; 19581 }); 19582 19583 19584 ////start active on that index 19585 19586 //move back to first section when all have been deleted but one 19587 if ($('#nectar_fullscreen_rows > div.vc_element').length === 1) { 19588 $('#nectar_fullscreen_rows').css({ 19589 'transform': 'translate3d(0,0,0)' 19590 });
19591 } 19592 19593 $body.scrollTo(0, 0); 19594 19595 19596 } else { 19597 19598 //remove container wrap padding/margin when needded 19599 if ($('body .main-content > .row > .vc_element:first > .wpb_row[class*="full-width-"]').length > 0 || 19600 $('body .main-content > .row > .vc_element:first .nectar-slider-wrap[data-full-width="true"]').length > 0) { 19601 $('.container-wrap').css({ 19602 'padding-top': '0', 19603 'margin-top': '0' 19604 }); 19605 } else { 19606 $('.container-wrap').css({ 19607 'padding-top': '40px' 19608 }); 19609 } 19610 19611 } 19612 19613 //reset svg icon arr 19614 $svgIcons = []; 19615 $('.svg-icon-holder') 19616 .removeClass('animated-in') 19617 .removeClass('bound'); 19618 19619 19620 //gmap 19621 if ($('.vc_nectar_gmap').length > 0) { 19622 19623 setTimeout(function() { 19624 19625 if (typeof google === 'object' && typeof google.maps === 'object') { 19626 window.mapAPI_Loaded(); 19627 } else { 19628 19629 if (window.nectarLove.mapApiKey.length > 0) { 19630 $.getScript('https://maps.google.com/maps/api/js?sensor=false&key=' + window.nectarLove.mapApiKey + '&callback=mapAPI_Loaded'); 19631 } 19632 } 19633 19634 }, 100); 19635 } 19636 19637 19638 stickySidebarInit(); 19639 19640 19641 if (typeof window.Waypoint != 'undefined') { 19642 Waypoint.destroyAll(); 19643 waypoints(); 19644 } 19645 19646 }); 19647 19648 } 19649 19650 19651 19652 19653 19654 19655 19656 19657 /** 19658 * Page transitions and waypoint triggering 19659 * 19660 * @since 10.5 19661 */ 19662 function pageTransitionInit() { 19663 19664 var mobileDisabledCondition = false; 19665 19666 if( $('body[data-ajax-transitions="true"]').length > 0 && 19667 $('#ajax-loading-screen[data-disable-mobile="1"]').length > 0 && 19668 nectarDOMInfo.winW < 1000 ) { 19669 19670 mobileDisabledCondition = true; 19671 19672 } 19673 19674 if ($('body[data-ajax-transitions="true"]').length > 0 && $('#ajax-loading-screen[data-method="standard"]').length > 0 && mobileDisabledCondition == false) { 19675 19676 $('html').addClass('page-trans-loaded'); 19677 19678 // Fade loading animation 19679 if ($('#ajax-loading-screen[data-effect="standard"]').length > 0) { 19680 19681 if ($('.nectar-particles').length == 0) { 19682 19683 $loadingScreenEl.transition({ 19684 'opacity': 0 19685 }, 500, function () { 19686 $(this).css({ 19687 'display': 'none' 19688 }); 19689 });
19690 $('#ajax-loading-screen .loading-icon').transition({ 19691 'opacity': 0 19692 }, 500); 19693 19694 } 19695 19696 // Bind waypoints after loading screen has left 19697 if ($('.nectar-box-roll').length == 0) { 19698 setTimeout(function () { 19699 waypoints(); 19700 }, 550); 19701 } 19702 19703 } 19704 19705 // Swipe loading animation 19706 else { 19707 19708 if ($('#ajax-loading-screen[data-effect*="horizontal_swipe"]').length > 0) { 19709 setTimeout(function () { 19710 $loadingScreenEl.addClass('loaded'); 19711 }, 60); 19712 } 19713 19714 if ($('#page-header-wrap #page-header-bg[data-animate-in-effect="zoom-out"] .nectar-video-wrap').length == 0) { 19715 setTimeout(function () { 19716 $('#ajax-loading-screen:not(.loaded)').addClass('loaded'); 19717 setTimeout(function () { 19718 $loadingScreenEl.addClass('hidden'); 19719 }, 1000); 19720 }, 150); 19721 } 19722 19723 19724 // Bind waypoints after loading screen has left 19725 if ($('.nectar-box-roll').length == 0 && $('#ajax-loading-screen[data-effect*="horizontal_swipe"]').length > 0) { 19726 setTimeout(function () { 19727 waypoints(); 19728 }, 750); 19729 } else if ($('.nectar-box-roll').length == 0) setTimeout(function () { 19730 waypoints(); 19731 }, 350); 19732 19733 } 19734 19735 19736 // Safari back/prev fix 19737 if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1 || 19738 navigator.userAgent.match(/(iPod|iPhone|iPad)/)) { 19739 19740 window.onunload = function () { 19741 19742 $('#ajax-loading-screen').stop().transition({ 19743 'opacity': 0 19744 }, 800, function () { 19745 $(this).css({ 19746 'display': 'none' 19747 }); 19748 });
19749 $('#ajax-loading-screen .loading-icon').transition({ 19750 'opacity': 0 19751 }, 600); 19752 }; 19753 window.onpageshow = function (event) { 19754 19755 if (event.persisted) { 19756 19757 $('#ajax-loading-screen').stop().transition({ 19758 'opacity': 0 19759 }, 800, function () { 19760 $(this).css({ 19761 'display': 'none' 19762 }); 19763 }); 19764 $('#ajax-loading-screen .loading-icon').transition({ 19765 'opacity': 0 19766 }, 600); 19767 19768 } 19769 19770 }; 19771 19772 } 19773 19774 else if (navigator.userAgent.indexOf('Firefox') != -1) { 19775 window.onunload = function () {}; 19776 } 19777 19778 19779 // Remove excess loading images if using page transitions. 19780 $('.portfolio-loading, .nectar-slider-loading .loading-icon').remove(); 19781 19782 19783 if ($('#ajax-loading-screen[data-disable-fade-on-click="1"]').length == 0) { 19784 19785 if ($('body.using-mobile-browser #ajax-loading-screen[data-method="standard"][data-disable-mobile="1"]').length == 0) { 19786 19787 var ignore_onbeforeunload = false; 19788 $('a[href^="mailto"], a[href^="tel"], .woocommerce-order-downloads a[class*="downloads-file"], .wpdm-cta.download-l
19788ink a[data-downloadurl], .nectar-ignore-beforeunload a').on('click', function () { 19789 ignore_onbeforeunload = true; 19790 }); 19791 window.addEventListener('beforeunload', function () { 19792 19793 if (!ignore_onbeforeunload) { 19794 $loadingScreenEl.addClass('set-to-fade'); 19795 transitionPage(); 19796 } 19797 ignore_onbeforeunload = false; 19798 }); 19799 } 19800 19801 } 19802 19803 } 19804 19805 // No page transitions 19806 else { 19807 19808 // Mobile disabled. 19809 if( mobileDisabledCondition == true ) { 19810 $loadingScreenEl.css({ 19811 'opacity': '0', 19812 'display': 'none' 19813 }).addClass('loaded').addClass('hidden'); 19814 } 19815 19816 if ($('.nectar-box-roll').length == 0 && !nectarDOMInfo.usingFrontEndEditor) { 19817 19818 // Waypoints. 19819 setTimeout(function () { 19820 waypoints(); 19821 }, 80); 19822 19823 } 19824 19825 } 19826 19827 19828 function transitionPage() { 19829 19830 if ($('#ajax-loading-screen[data-effect*="horizontal_swipe"]').length > 0) { 19831 $loadingScreenEl.removeClass('loaded'); 19832 $loadingScreenEl.addClass('in-from-right'); 19833 19834 setTimeout(function () { 19835 $loadingScreenEl.addClass('loaded'); 19836 }, 30); 19837 19838 } 19839 else { 19840 if ($('#ajax-loading-screen[data-effect="center_mask_reveal"]').length > 0) { 19841 $loadingScreenEl.css('opacity', '0').css('display', 'block').transition({ 19842 'opacity': '1' 19843 }, 450); 19844 } else { 19845 $loadingScreenEl.show().transition({ 19846 'opacity': '1' 19847 }, 450); 19848 } 19849 } 19850 19851 } 19852 19853 } 19854 19855 19856 19857 // Document ready event - starting everything up. 19858 jQuery(document).ready(function ($) { 19859 19860 // Initialize Nectar DOM helper. 19861 nectarDOMInfo.init(); 19862 19863 // Priority calls 19864 nectarBoxRollInit(); 19865 nectarFullPageInit(); 19866 nectarLazyImageLoading(); 19867 19868 // Header navigation. 19869 initSF(); 19870 navigationSearchInit(); 19871 centeredNavBottomBarInit(); 19872 centeredLogoHeaderInit(); 19873 headerNavPreInit(); 19874 headerNavScrollInit(); 19875 headerNavOffsetInit(); 19876 19877 // Page builder elements. 19878 salientPageBuilderElInit(); 19879 19880 // Column related. 19881 columnBGColors(); 19882 vcMobileColumnsInit(); 19883 19884 // Row related. 19885 fullWidthSections(); 19886 fwsClasses(); 19887 fwCarouselLinkFix(); 19888 fullWidthSectionsPreInit(); 19889 firstFWSection(); 19890 parallaxScrollInit(); 19891 parallaxRowsBGCals(); 19892 fullWidthRowPaddingAdjust(); 19893 fullWidthContentColumns(); 19894 oneFourthClasses(); 19895 fixIeFlexbox(); 19896 vcFullHeightRowInit(); 19897 19898 // Media. 19899 lightBoxInit(); 19900 audioVideoVis(); 19901 responsiveVideoIframesInit(); 19902 responsiveVideoIframes(); 19903 videoBGInit(); 19904 blogSingle(); 19905 19906 19907 // Off canvas navigation. 19908 mobileNavMegamenuCorrect(); 19909 materialSkinOCM_Init(); 19910 OCM_dropdownMarkup(); 19911 OCM_dropdownIconPos(); 19912 clickToggleSubmenus(); 19913 OCM_init(); 19914 19915 19916 // Page header 19917 pageHeaderInit(); 19918 19919 // Footer. 19920 footerRevealInit(); 19921 19922 // Third party. 19923 wooCommerceEvents(); 19924 fancySelectStyling(); 19925 19926 // Scrolling 19927 infiniteScrollInit(); 19928 scrollToTopInit(); 19929 animatedAnchorLinks(); 19930 updatePerspectiveOriginInit(); 19931 sectionDownArrowEvent(); 19932 19933 // Cross browser assist. 19934 crossBrowserAdjust(); 19935 bfCacheAssist(); 19936 19937 // Front end editing. 19938 wpBakeryFrontendInit(); 19939 19940 // Page transitions and waypoint activation. 19941 pageTransitionInit(); 19942 19943 19944 19945 // Main Debounced Resize Event. 19946 $window.off('smartresize.srInit'); 19947 $window.on('smartresize.srInit', smartResizeInit); 19948 19949 // Main Resize Event. 19950 $window.off('resize.srInit'); 19951 $window.on('resize.srInit', resizeInit); 19952 19953 // Orientation change. 19954 window.addEventListener("orientationchange", orientationChangeInit); 19955 19956 // Window Load Event. 19957 $window.on('load', function () { 19958 19959 // Set header space. 19960 if ( $(window).scrollTop() == 0 ) { 19961 headerSpace(); 19962 } 19963 19964 $('video').css('visibility', 'visible'); 19965 19966 // Scroll to anchor 19967 pageLoadHashInit(); 19968 19969 // Row/Column related. 19970 fullWidthContentColumns();
19971 parallaxRowsBGCals(); 19972 19973 // Video BG 19974 resizeVideoToCover(); 19975 19976 }); 19977 19978 19979 }); 19980 19981 19982 19983}(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.