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 $bodyBorderWidth = ($('.body-border-right').length > 0) ? $('.body-border-right').width() : 0, 29 $logoHeight = ($headerOuterEl.is('[data-logo-height]')) ? parseInt($headerOuterEl.attr('data-logo-height')) : 30, 30 headerPadding = ($headerOuterEl.is('[data-padding]')) ? parseInt($headerOuterEl.attr('data-padding')) : 28, 31 logoShrinkNum = ($headerOuterEl.is('[data-shrink-num]')) ? $headerOuterEl.attr('data-shrink-num') : 6, 32 condenseHeaderLayout = ($headerOuterEl.is('[data-condense="true"]')) ? true : false, 33 usingLogoImage = ($headerOuterEl.is('[data-using-logo="1"]')) ? true : false, 34 headerResize = ($headerOuterEl.is('[data-header-resize="1"]')) ? true : false, 35 headerHideUntilNeeded = ($body.is('[data-hhun]')) ? $body.attr('data-hhun') : '', 36 $animationEasing = ($body.is('[data-cae]') && $body.attr('data-cae') !== 'swing' ) ? $body.attr('data-cae') : 'easeOutCubic', 37 $animationDuration = ($body.is('[data-cad]')) ? $body.attr('data-cad') : '650', 38 $portfolio_containers = [], 39 $svgIcons = [], 40 $nectarCustomSliderRotate = [], 41 $flickitySliders = [], 42 flickityDragArr = [], 43 viewIndicatorArr = [], 44 iconMouseFollowArr = [], 45 $fsProjectSliderArr = [], 46 $wooFlickityCarousels = [], 47 $liquidBG_EL = [], 48 $testimonialSliders = [], 49 $mouseParallaxScenes = [], 50 $nectarMasonryBlogs = [], 51 $standAnimatedColTimeout = [], 52 $animatedSVGIconTimeout = [], 53 $projectCarouselSliderArr = [], 54 $nectarPostGridArr = [], 55 $tabbedClickCount = 0, 56 $fullscreenSelector = '', 57 $bodyBorderHeaderColorMatch = false, 58 nectarBoxRoll = { 59 animating: 'false', 60 perspect: 'not-rolled' 61 }, 62 $nectarFullPage = { 63 $usingFullScreenRows: false 64 }, 65 $svgResizeTimeout, 66 $bodyBorderSizeToRemove; 67 68 if( $bodyBorderTop.length > 0 ) { 69 70 if ( $bodyBorderTop.css('background-color') == '#ffffff' && $body.attr('data-header-color') == 'light' || 71 $bodyBorderTop.css('background-color') == 'rgb(255, 255, 255)' && $body.attr('data-header-color') == 'light' || 72 $bodyBorderTop.css('background-color') == $headerOuterEl.attr('data-user-set-bg')) { 73 $bodyBorderHeaderColorMatch = true; 74 } 75 76 } 77 78 79 80 /** 81 * Nectar DOM info helper. 82 * 83 * @since 9.0 84 */ 85 var nectarDOMInfo = { 86 87 usingMobileBrowser: (navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) ? true : false, 88 usingFrontEndEditor: (typeof window.vc_iframe === 'undefined') ? false : true, 89 getWindowSize: function() { 90 nectarDOMInfo.winH = window.innerHeight; 91 nectarDOMInfo.winW = window.innerWidth; 92 nectarDOMInfo.adminBarHeight = ($wpAdminBar.length > 0) ? $wpAdminBar.height() : 0; 93 nectarDOMInfo.secondaryHeaderHeight = ($headerSecondaryEl.length > 0 && $headerSecondaryEl.css('display') != 'none') ? $headerSecondaryEl.outerHeight() : 0; 94 }, 95 scrollTop: 0, 96 clientX: 0, 97 clientY: 0, 98 scrollPosMouse: function() { 99 return $window.scrollTop(); 100 }, 101 scrollPosRAF: function() { 102 nectarDOMInfo.scrollTop = $window.scrollTop(); 103 requestAnimationFrame(nectarDOMInfo.scrollPosRAF); 104 }, 105 bindEvents: function() { 106 107 if (!nectarDOMInfo.usingMobileBrowser) { 108 $window.on('scroll', function() { 109 nectarDOMInfo.scrollTop = nectarDOMInfo.scrollPosMouse(); 110 }); 111 } else { 112 requestAnimationFrame(nectarDOMInfo.scrollPosRAF); 113 } 114 115 document.addEventListener("mousemove", function(e) { 116 nectarDOMInfo.clientX = e.clientX; 117 nectarDOMInfo.clientY = e.clientY; 118 }); 119 120 $window.on('resize', nectarDOMInfo.getWindowSize); 121 122 }, 123 init: function() { 124 // Re-cache WP admin bar after DOM ready 125 $wpAdminBar = $('#wpadminbar'); 126 127 // Get values and bind events 128 this.getWindowSize(); 129 this.scrollTop = this.scrollPosMouse(); 130 this.bindEvents(); 131 132 this.usingFrontEndEditor = (typeof window.vc_iframe === 'undefined') ? false : true; 133 } 134 135 }; 136
137 138 139 140 /** 141 * Debounced resize event 142 * 143 * @since 2.0 144 */ 145 146 function smartResizeInit() { 147 fullWidthContentColumns(); 148 parallaxRowsBGCals(); 149 headerSpace(); 150 OCM_overflowState(); 151 showOnLeftSubMenu(); 152 } 153 154 155 156 /** 157 * Main resize event. 158 * 159 * @since 2.0 160 */ 161 function resizeInit() { 162 fullWidthSections(); 163 fullWidthContentColumns(); 164 addOrRemoveSF(); 165 responsiveVideoIframes(); 166 167 if (!nectarDOMInfo.usingMobileBrowser) { 168 parallaxRowsBGCals(); 169 } 170 171 } 172 173 174 175 /** 176 * Flexslider plugin initialization. 177 * 178 * @since 5.0 179 */ 180 function flexsliderInit() { 181 $('.flex-gallery').each(function () { 182 183 if (!$().flexslider) { 184 return; 185 } 186 187 var $that = $(this); 188 189 imagesLoaded($(this), function () { 190 191 $that.flexslider({ 192 animation: 'fade', 193 smoothHeight: false, 194 animationSpeed: 500, 195 useCSS: false, 196 touch: true 197 }); 198 199 //gallery slider add arrows 200 $('.flex-gallery .flex-direction-nav li a.flex-next').html('<i class="fa fa-angle-right"></i>'); 201 $('.flex-gallery .flex-direction-nav li a.flex-prev').html('<i class="fa fa-angle-left"></i>'); 202 203 }); 204 205 }); 206 } 207 208 209 210 /** 211 * Icon follow. 212 * 213 * @since 11.0 214 */ 215 function NectarIconMouseFollow($el, iconType) { 216 217 this.lastX = 0; 218 this.lastY = 0; 219 this.$el = $el; 220 this.iconType = iconType; 221 this.timeout = false; 222 this.overEl = false; 223 this.$dragEl = ''; 224 this.$viewEl = ''; 225 this.$closeEl = ''; 226 227 this.createMarkup(); 228 this.mouseBind(); 229 } 230 231 NectarIconMouseFollow.prototype.createMarkup = function() { 232 233 if( this.iconType === 'horizontal-movement' ) { 234 235 if( $('.nectar-drag-indicator').length == 0 ) { 236 $('body').append('<div class="nectar-drag-indicator"><span><i class="fa fa-angle-left"></i><i class="fa fa-angle-right"></i></span></div>'); 237 this.$dragEl = $('.nectar-drag-indicator'); 238 this.dragRAF(); 239 } else { 240 this.$dragEl = $('.nectar-drag-indicator'); 241 } 242 243 244 } 245 246 if( this.iconType === 'view-indicator' ) { 247 248 if( $('.nectar-view-indicator').length == 0 ) { 249 $('body').append('<div class="nectar-view-indicator"><div class="color-circle"></div><span></span></div>'); 250 $('.nectar-view-indicator span').text( $('.nectar-post-grid').attr('data-indicator-text') ); 251 this.$viewEl = $('.nectar-view-indicator'); 252 this.viewRAF(); 253 } else { 254 this.$viewEl = $('.nectar-view-indicator'); 255 } 256 257 } 258 259 if( this.iconType === 'close-indicator' ) { 260 if( $('.nectar-view-indicator').length == 0 ) { 261 var $usingBoxedClass = ($('body > #boxed').length > 0) ? 'in-boxed' : ''; 262 $('body').append('<div class="nectar-close-indicator ' + $usingBoxedClass + '"><div class="inner"></div></div>'); 263 this.$closeEl = $('.nectar-close-indicator'); 264 this.closeRAF(); 265 } else { 266 this.$closeEl = $('.nectar-close-indicator'); 267 } 268 269 } 270 271 } 272 273 NectarIconMouseFollow.prototype.mouseBind = function() { 274 275 var that = this; 276 277 if( this.iconType === 'horizontal-movement' ) { 278 279 that.$el.find('.flickity-viewport').on('mouseenter', function() { 280 that.$dragEl.addClass('visible'); 281 }); 282 283 that.$el.find('.flickity-viewport').on('mouseleave', function() { 284 that.$dragEl.removeClass('visible'); 285 }); 286 287 } else if( this.iconType === 'close-indicator' ) { 288 289 $('body').on('click','.team-member[data-style*="bio_fullscreen"]',function(){ 290 291 if ($('.nectar_team_member_overlay:not(.open)').length > 0) { 292 return; 293 } 294 295 that.$closeEl.addClass('visible'); 296 that.$closeEl.find('.inner').addClass('visible'); 297 }); 298 299 $('body').on('click','.nectar_team_member_overlay:not(.animating)',function(){ 300 that.$closeEl.removeClass('visible'); 301 that.$closeEl.find('.inner').removeClass('visible'); 302 }); 303 304 // Handle social links. 305 $('body').on('mouseenter', '.nectar_team_member_overlay .bottom_meta a', function() { 306 that.$closeEl.removeClass('visible'); 307 }); 308 $('body').on('mouseleave', '.nectar_team_member_overlay .bottom_meta a', function() { 309 that.$closeEl.addClass('visible'); 310 }); 311 312 } 313 else if( this.iconType === 'view-indicator' ) { 314 315 var $color = that.$el.attr('data-indicator-color'); 316 var $style = that.$el.attr('data-indicator-style'); 317 318 // unbind first. 319 that.$el.find('.nectar-post-grid-item').off(); 320 321 that.$el.find('.nectar-post-grid-item').on('mouseenter', function() { 322 323 that.$viewEl.addClass('visible'); 324 325 // Handle style class. 326 that.$viewEl.attr('class', function(i, c){ 327 return c.replace(/(^|\s)style-\S+/g, ''); 328 }); 329 that.$viewEl.addClass('style-'+$style); 330 if( $style !== 'see-through' ) {
331 that.$viewEl.find('.color-circle').css('background-color', $color); 332 } 333 334 clearTimeout(that.timeout); 335 }); 336 337 that.$el.find('.nectar-post-grid-item').on('mouseleave', function() { 338 that.timeout = setTimeout(function(){ 339 that.$viewEl.removeClass('visible'); 340 },100); 341 342 }); 343 344 // Handle category links. 345 that.$el.find('.nectar-post-grid-item .meta-category a').on('mouseenter', function() { 346 that.$viewEl.removeClass('visible'); 347 }); 348 that.$el.find('.nectar-post-grid-item .meta-category a').on('mouseleave', function() { 349 that.$viewEl.addClass('visible'); 350 }); 351 352 } 353 354 }; 355 356 NectarIconMouseFollow.prototype.dragRAF = function() { 357 358 this.lastY = linearInterpolate(this.lastY, nectarDOMInfo.clientY, 0.21); 359 this.lastX = linearInterpolate(this.lastX, nectarDOMInfo.clientX, 0.21); 360 361 this.$dragEl.css({ 362 'transform': 'translateX(' + this.lastX + 'px) translateY(' + this.lastY + 'px)' 363 }); 364 365 requestAnimationFrame(this.dragRAF.bind(this)); 366 367 }; 368 369 NectarIconMouseFollow.prototype.viewRAF = function() { 370 371 this.lastY = linearInterpolate(this.lastY, nectarDOMInfo.clientY, 0.21); 372 this.lastX = linearInterpolate(this.lastX, nectarDOMInfo.clientX, 0.21); 373 374 this.$viewEl.css({ 375 'transform': 'translateX(' + this.lastX + 'px) translateY(' + this.lastY + 'px)' 376 }); 377 378 requestAnimationFrame(this.viewRAF.bind(this)); 379 380 }; 381 382 NectarIconMouseFollow.prototype.closeRAF = function() { 383 384 this.lastY = linearInterpolate(this.lastY, nectarDOMInfo.clientY, 0.21); 385 this.lastX = linearInterpolate(this.lastX, nectarDOMInfo.clientX, 0.21); 386 387 this.$closeEl.css({ 388 'transform': 'translateX(' + this.lastX + 'px) translateY(' + this.lastY + 'px)' 389 }); 390 391 requestAnimationFrame(this.closeRAF.bind(this)); 392 393 }; 394 395 396 397 /** 398 * Flickity lazy image helper 399 * 400 * Needed to calculate the space which 401 * lazy loaded images will eventually occupy. 402 * 403 * @since 11.0 404 */ 405 function flickityLazyCalcs() { 406 407 $('.wpb_gallery_slidesflickity_static_height_style .cell[data-lazy="true"]').each(function() { 408 409 $(this).css({ 410 'height': '', 411 'width' : '' 412 }); 413 414 var heightAttr = parseInt($(this).find('img').attr('height')); 415 var widthAttr = parseInt($(this).find('img').attr('width')); 416 417 var dimensions = calculateAspectRatio( widthAttr, heightAttr, 2000, parseInt($(this).find('img').height()) ); 418 419 $(this).css({ 420 'height': dimensions.height + 'px', 421 'width' : dimensions.width + 'px' 422 }); 423 424 }); 425 426 } 427 428 429 /** 430 * Flickity lazy initialization. 431 * 432 * @since 11.0 433 */ 434 function flickityLazyInit() { 435 // Lazy assist. 436 if( $('.wpb_gallery_slidesflickity_static_height_style .cell[data-lazy="true"]').length > 0 ) { 437 flickityLazyCalcs(); 438 $window.on('smartresize',flickityLazyCalcs); 439 } 440 } 441 442 443 /** 444 * Flickity plugin initialization. 445 * 446 * @since 7.0 447 */ 448 function flickityInit() { 449 450 if ($('.nectar-flickity:not(.masonry)').length == 0) { 451 return false; 452 } 453 454 $flickitySliders = []; 455 flickityDragArr = []; 456 457 458 $('.nectar-flickity:not(.masonry)').each(function (i) { 459 460 $(this).removeClass(function (index, className) { 461 return (className.match(/(^|\s)instance-\S+/g) || []).join(' '); 462 }); 463 $(this).addClass('instance-' + i); 464 465 var $freeScrollBool = ($(this).is('[data-free-scroll]') && $(this).attr('data-free-scroll') == 'true') ? true : false, 466 $groupCellsBool = true, 467 $flickContainBool = true, 468 $flcikAttr = 0.025, 469 $paginationBool = false, 470 $nextPrevArrowBool = true, 471 $flickCellAlign = 'center'; 472 473 if ($(this).is('[data-format="fixed_text_content_fullwidth"]')) { 474 $flickCellAlign = 'left'; 475 $groupCellsBool = false; 476 $flickContainBool = false; 477 $flcikAttr = 0.02; 478 } 479 480 if ($freeScrollBool == true ) { 481 $groupCellsBool = false; 482 } 483 484 485 if ($(this).attr('data-controls').length > 0 && 486 $(this).attr('data-controls') == 'next_prev_arrows'|| 487 $(this).attr('data-controls').length > 0 && 488 $(this).attr('data-controls') == 'next_prev_arrows_overlaid') { 489 $paginationBool = false;
490 $nextPrevArrowBool = true; 491 } else { 492 $paginationBool = true; 493 $nextPrevArrowBool = false; 494 } 495 496 497 if ($(this).attr('data-controls').length > 0 && 498 $(this).attr('data-controls') == 'none') { 499 $paginationBool = false; 500 $nextPrevArrowBool = false; 501 } 502 503 var $flickity_autoplay = false; 504 505 if ($(this).is('[data-autoplay]') && 506 $(this).attr('data-autoplay') == 'true') { 507 508 $flickity_autoplay = true; 509 510 if ($(this).is('[data-autoplay-dur]') && 511 $(this).attr('data-autoplay-dur').length > 0) { 512 513 if (parseInt($(this).attr('data-autoplay-dur')) > 100 && 514 parseInt($(this).attr('data-autoplay-dur')) < 30000) { 515 $flickity_autoplay = parseInt($(this).attr('data-autoplay-dur')); 516 } 517 518 } 519 520 } 521 522 var $that = $(this); 523 var $frontEndEditorDrag = ($('body.vc_editor').length > 0) ? false : true; 524 var $frontEndEditorPause = ($('body.vc_editor').length > 0) ? true : false; 525 var $arrowShape = ''; 526 var $wrapAround = ( $(this).is('[data-wrap]') && $(this).attr('data-wrap') == 'no-wrap' ) ? false : true; 527 var $lazyload = ($(this).find('img[data-flickity-lazyload]')) ? 1 : false; 528 if( $(this).find('img[data-flickity-lazyload]') && $(this).is('[data-overflow="visible"]') && $(this).is('[data-wrap="no-wrap"]') ) { 529 $lazyload = 2; 530 } 531 532 if( $(this).attr('data-controls').length > 0 && $(this).attr('data-controls') == 'next_prev_arrows_overlaid' || 533 $(this).attr('data-controls').length > 0 && $(this).attr('data-controls') == 'touch_total' ) { 534 $arrowShape = { 535 x0: 10, 536 x1: 60, y1: 50, 537 x2: 70, y2: 40, 538 x3: 30 539 } 540 } else { 541 $arrowShape = { 542 x0: 20, 543 x1: 70, 544 y1: 30, 545 x2: 70, 546 y2: 25, 547 x3: 70 548 } 549 } 550 551 $flickitySliders[i] = new Flickity('.nectar-flickity.instance-' + i, { 552 contain: $flickContainBool, 553 draggable: $frontEndEditorDrag, 554 lazyLoad: $lazyload, 555 imagesLoaded: true, 556 percentPosition: true, 557 cellAlign: $flickCellAlign, 558 groupCells: $groupCellsBool, 559 prevNextButtons: $nextPrevArrowBool, 560 freeScroll: $freeScrollBool, 561 pageDots: $paginationBool, 562 resize: true, 563 selectedAttraction: $flcikAttr, 564 autoPlay: $flickity_autoplay, 565 pauseAutoPlayOnHover: $frontEndEditorPause, 566 setGallerySize: true, 567 wrapAround: $wrapAround, 568 accessibility: false, 569 arrowShape: $arrowShape 570 }); 571 572 573 // Visualized total controls 574 if( $(this).is('[data-controls="touch_total"]') ) { 575 576 // Create markup. 577 if( $(this).find('.visualized-total').length == 0 ) { 578 if( $(this).parents('.full-width-content').length > 0 && $(this).parents('.vc_col-sm-12').length > 0 ) { 579 $(this).append('<div class="container normal-container"><div class="visualized-total"><span></span></div></div>'); 580 } else { 581 $(this).append('<div class="visualized-total"><span></span></div>'); 582 } 583 } 584 585 586 // Init drag indicator. 587 if( !nectarDOMInfo.usingMobileBrowser ) { 588 589 flickityDragArr[i] = new NectarIconMouseFollow($(this),'horizontal-movement'); 590 591 $flickitySliders[i].on('dragMove', function (event, pointer) { 592 nectarDOMInfo.clientY = pointer.clientY; 593 nectarDOMInfo.clientX = pointer.clientX; 594 }); 595 596 } 597 598 var $totalImgs = $(this).find('.flickity-page-dots li').length; 599 var $totalIndicator = $(this).find('.visualized-total span'); 600 var $totalPosition = 1; 601 var $totalWidth = $(this).find('.visualized-total').width(); 602 603 $window.on('smartresize',function() { 604 605 setTimeout(function() { 606 607 $totalImgs = $that.find('.flickity-page-dots li').length; 608 $totalWidth = $that.find('.visualized-total').width(); 609 610 $totalPosition = ($totalWidth / $totalImgs) * $that.find('.flickity-page-dots .is-selected').index(); 611 612 // Update pos on interaction. 613 $totalIndicator.css('width', 100/$totalImgs + '%'); 614 $totalIndicator.css({ 615 'x' : $totalPosition + 'px' 616 }); 617 618 },200); 619 620 }); 621 622 // Set initial total tracker width. 623 setTimeout(function(){ 624 $totalImgs = $that.find('.flickity-page-dots li').length; 625 $totalWidth = $that.find('.visualized-total').width(); 626 627 $totalIndicator.css('width', 100/$totalImgs + '%'); 628 },200); 629 630 $flickitySliders[i].on('change', function (event, progress) { 631 632 $totalPosition = ($totalWidth / $totalImgs) * $that.find('.flickity-page-dots .is-selected').index(); 633 634 // Update pos on interaction. 635 $totalIndicator.css({ 636 'x' : $totalPosition + 'px' 637 }); 638 639 }); 640 641 } 642 643 644 // Fixed text content style 645 if ($(this).is('[data-format="fixed_text_content_fullwidth"]') && !nectarDOMInfo.usingFrontEndEditor) { 646 647 var $onMobileBrowser = nectarDOMInfo.usingMobileBrowser; 648 649 $flickitySliders[i].on('scroll', function () { 650 651 if ($onMobileBrowser) { 652 return; 653 } 654 655 var $flkSlideWidth = $that.find('.cell').outerWidth() + 25, 656 $leftHeaderSize = ($('body[data-header-format="left-header"]').length > 0 && $window.width() > 1000) ? 275 : 0, 657 $extraWindowSpace = (($window.width() + $leftHeaderSize) - $that.parents('.main-content').width()) / 2; 658 659 $extraWindowSpace += parseInt($that.css('margin-left')) + 2; 660
661 $flickitySliders[i].slides.forEach(function (slide, j) { 662 663 var $scaleAmt = 1, 664 $translateXAmt = 0, 665 $rotateAmt = 0, 666 $slideZIndex = 10, 667 $opacityAmt = 1, 668 $slideOffset = $(slide.cells[0].element).offset().left, 669 flkInstanceSlide = $('.nectar-flickity.instance-' + i + ' .cell:nth-child(' + (j + 1) + ')'); 670 671 if ($slideOffset - $extraWindowSpace < 0 && 672 $slideOffset - $extraWindowSpace > $flkSlideWidth * -1) { 673 674 $scaleAmt = 1 + (($slideOffset - $extraWindowSpace) / 1500); 675 $opacityAmt = 1 + (($slideOffset - $extraWindowSpace + 70) / 550); 676 $translateXAmt = (($slideOffset - $extraWindowSpace)) * -1; 677 $rotateAmt = (($slideOffset - $extraWindowSpace) / 25) * -1; 678 679 } else { 680 $scaleAmt = 1; 681 $opacityAmt = 1; 682 $translateXAmt = 0; 683 $rotateAmt = 0; 684 } 685 686 if ($slideOffset + 5 - $extraWindowSpace < 0 && 687 $slideOffset - $extraWindowSpace > $flkSlideWidth * -1) { 688 689 $slideZIndex = 5; 690 } else { 691 $slideZIndex = 10; 692 } 693 694 flkInstanceSlide.css({ 695 'z-index': $slideZIndex 696 }); 697 698 flkInstanceSlide.find('.inner-wrap-outer').css({ 699 'transform': 'perspective(800px) translateX(' + $translateXAmt + 'px) rotateY(' + $rotateAmt + 'deg) translateZ(0)', 700 'opacity': $opacityAmt 701 }); 702 703 flkInstanceSlide.find('.inner-wrap').css({ 704 'transform': 'scale(' + $scaleAmt + ') translateZ(0)' 705 }); 706 707 }); 708 709 }); 710 711 } 712 713 var $removeHiddenTimeout; 714 var $removeMovingTimeout; 715 716 $flickitySliders[i].on('dragStart', function () { 717 718 clearTimeout($removeHiddenTimeout); 719 clearTimeout($removeMovingTimeout); 720 $that.addClass('is-dragging'); 721 $that.addClass('is-moving'); 722 723 $that.find('.flickity-prev-next-button').addClass('hidden'); 724 }); 725 726 $flickitySliders[i].on('dragEnd', function () { 727 728 $that.removeClass('is-dragging'); 729 730 $removeHiddenTimeout = setTimeout(function () { 731 732 $that.removeClass('is-moving'); 733 $that.find('.flickity-prev-next-button').removeClass('hidden'); 734 735 }, 600); 736 737 $removeMovingTimeout = setTimeout(function () { 738 $that.removeClass('is-moving'); 739 }, 300); 740 741 }); 742 743 $('.flickity-prev-next-button').on('click', function () { 744 745 clearTimeout($removeHiddenTimeout); 746 747 $(this).parents('.nectar-flickity') 748 .find('.flickity-prev-next-button') 749 .addClass('hidden'); 750 751 $removeHiddenTimeout = setTimeout(function () { 752 $that 753 .find('.flickity-prev-next-button') 754 .removeClass('hidden'); 755 }, 600); 756 757 }); 758 759 760 // Images loaded. 761 if ($that.hasClass('nectar-carousel')) { 762 imagesLoaded($that, function () { 763 nectarCarouselFlkEH($that); 764 }); 765 } 766 767 }); 768 769 770 // Resize event. 771 var $usingNectarCarouselFlk = ($('.nectar-carousel.nectar-flickity:not(.masonry)').length > 0) ? true : false; 772 773 if ($usingNectarCarouselFlk) { 774 $window.on('resize',setNectarCarouselFlkEH); 775 } 776 777 } 778 779 780 781 782 783 /** 784 * Flickity equal height helper. 785 * 786 * @since 7.0 787 */ 788 function setNectarCarouselFlkEH() { 789 $('.nectar-carousel.nectar-flickity:not(.masonry)').each(function () { 790 nectarCarouselFlkEH($(this)); 791 }); 792 } 793 794 795 796 /** 797 * Flickity equal height calculations. 798 * 799 * @since 7.0 800 */ 801 function nectarCarouselFlkEH($slider_instance) { 802 803 var $tallestSlideCol = 0; 804 805 $slider_instance 806 .find('.flickity-slider > .cell') 807 .css('height', 'auto'); 808 809 $slider_instance.find('.flickity-slider > .cell').each(function () { 810 811 if( $(this).height() > $tallestSlideCol ) { 812 $tallestSlideCol = $(this).height(); 813 } 814 815 }); 816 817 if ($tallestSlideCol < 10) { 818 $tallestSlideCol = 'auto'; 819 } 820 821 //set even height 822 $slider_instance 823 .find('.flickity-slider > .cell') 824 .css('height', $tallestSlideCol + 'px'); 825 826 } 827 828 829 830 /** 831 * twentytwenty plugin initialization. 832 * 833 * @since 7.0 834 */
835 function twentytwentyInit() { 836 $('.twentytwenty-container').each(function () { 837 var $that = $(this); 838 839 if ($that.find('.twentytwenty-handle').length == 0) { 840 $(this).imagesLoaded(function () { 841 $that.twentytwenty(); 842 }); 843 } 844 845 }); 846 } 847 848 849 850 851 852 /** 853 * Superfish initialization and submenu functionality. 854 * 855 * @since 2.0 856 */ 857 function initSF() { 858 859 addOrRemoveSF(); 860 861 if ($('body[data-header-format="left-header"]').length == 0) { 862 863 var $disableHI; 864 865 if (!($('#header-outer[data-megamenu-rt="1"]').length > 0 && 866 $('#header-outer[data-transparent-header="true"]').length > 0)) { 867 $disableHI = true; 868 } else { 869 $disableHI = false; 870 } 871 872 $(".sf-menu:not(.buttons)").superfish({ 873 delay: 650, 874 speed: 'fast', 875 disableHI: $disableHI, 876 speedOut: 'fast', 877 animation: { 878 opacity: 'show' 879 } 880 }); 881 882 // Pull right/left menu 883 $('#header-outer .sf-menu.buttons li.menu-item').on('mouseover',function(){ 884 $(this).addClass('sfHover'); 885 }); 886 $('#header-outer .sf-menu.buttons li.menu-item').on('mouseleave',function(){ 887 var $that = $(this); 888 889 if( $that.is('.menu-item-has-children') ) { 890 setTimeout(function () { 891 if( !$that.is(':hover') ) { 892 $that.removeClass('sfHover'); 893 } 894 }, 200); 895 } else { 896 $that.removeClass('sfHover'); 897 } 898 }); 899 900 // Areas that do not use megamenu. 901 $('#header-secondary-outer li.megamenu, .sf-menu.buttons li.megamenu').removeClass('megamenu'); 902 903 $('#header-outer .sf-menu > li:not(.megamenu) > ul > li > ul').each(function () { 904 905 if ($(this).offset().left + $(this).outerWidth() > $window.width()) { 906 $(this).addClass('on-left-side'); 907 $(this).find('ul').addClass('on-left-side'); 908 } 909 910 }); 911 912 // Megamenu multi section per column title support. 913 $('body:not([data-header-format="left-header"]) header#top nav > ul > li.megamenu > ul > li > ul > li:has("> ul")').addClass('has-ul'); 914 915 // Full width megamenu. 916 if ($('body[data-megamenu-width="full-width"]').length > 0 && $('ul.sub-menu').length > 0) { 917 megamenuFullwidth(); 918 $window.on('smartresize', megamenuFullwidth); 919 $('header#top nav > ul > li.megamenu > .sub-menu').css('box-sizing', 'content-box'); 920 } 921 922 // Extra hover class for megamenu check. 923 $('header#top nav > ul.sf-menu > li.menu-item').on('mouseenter', function () { 924 $(this).addClass('menu-item-over'); 925 }); 926 $('header#top nav > ul.sf-menu > li.menu-item').on('mouseleave', function () { 927 $(this).removeClass('menu-item-over'); 928 }); 929 930 // Remove arrows on mega menu item. 931 $('header#top nav .megamenu .sub-menu a.sf-with-ul .sf-sub-indicator, header#top .megamenu .sub-menu a .sf-sub-indicator').remove(); 932 933 // Blank title megamenu columns. 934 $('header#top nav > ul > li.megamenu > ul.sub-menu > li > a').each(function () { 935 if ($(this).text() == '-' || $(this).text() == '–' || $(this).parent().hasClass('hide-title')) { 936 $(this).remove(); 937 } 938 }); 939 940 } 941 942 943 // Deactivate hide header until needed effect on phone. 944 if (nectarDOMInfo.usingMobileBrowser && $('#header-outer[data-remove-fixed="1"]').length == 0) { 945 $body.attr('data-hhun', '0'); 946 } 947 948 } 949 950 951 952 /** 953 * Calculates the "Header Mega Menu Width - Full screen width" theme option. 954 * 955 * @since 6.0 956 */ 957 function megamenuFullwidth() { 958 959 var $windowWidth = $window.width(); 960 var $headerContainerWidth = $('header#top > .container').width(); 961 $('header#top nav > ul > li.megamenu > .sub-menu').css({ 962 'padding-left': ($windowWidth - $headerContainerWidth) / 2 + 'px', 963 'padding-right': ($windowWidth + 2 - $headerContainerWidth) / 2 + 'px', 964 'width': $headerContainerWidth, 965 'left': '-' + ($windowWidth - $headerContainerWidth) / 2 + 'px' 966 }); 967 } 968 969 970 /** 971 * Hide main navigation on mobile. 972 * 973 * @since 2.0 974 */ 975 function addOrRemoveSF() { 976 977 if (nectarDOMInfo.winW < 1000 && $body.attr('data-responsive') == '1') { 978 $body.addClass('mobile'); 979 $('header#top nav').css('display', 'none'); 980 } else { 981 $body.removeClass('mobile'); 982 $('header#top nav').css('display', ''); 983 $('.slide-out-widget-area-toggle #toggle-nav .lines-button').removeClass('close'); 984 } 985 986 987 } 988 989 990 /** 991 * Calculates whether submenu needs to display aligned opposite (from lack of space). 992 * 993 * @since 2.0 994 */ 995 function showOnLeftSubMenu() { 996 997 // Show on left class for minimal styling. 998 $('#header-outer .sf-menu > li:not(.megamenu) > ul > li > ul').each(function () { 999 1000 $(this).removeClass('on-left-side'); 1001 1002 if ($(this).offset().left + $(this).outerWidth() > $window.width()) { 1003 $(this).addClass('on-left-side'); 1004 $(this).find('ul').addClass('on-left-side'); 1005 } else { 1006 $(this).removeClass('on-left-side'); 1007 $(this).find('ul').removeClass('on-left-side'); 1008 } 1009 1010 }); 1011 } 1012 1013 1014 1015 1016 /** 1017 * Caroufredsel plugin initialization. 1018 * 1019 * @since 2.0 1020 */ 1021 function standardCarouselInit() { 1022 1023 if ($('.carousel').length == 0) { 1024 return; 1025 } 1026 1027 if (typeof SalientRecentProjectsCarousel !== 'undefined') { 1028 $('ul.carousel.portfolio-items').each(function (i) { 1029 $projectCarouselSliderArr[i] = new SalientRecentProjectsCarousel($(this)); 1030 }); 1031 } 1032 1033 $('ul.carousel:not(".clients"):not(.portfolio-items)').each(function () { 1034 1035 var $that = $(this), 1036 maxCols = ($(this).parents('.carousel-wrap').attr('data-full-width') == 'true') ? 'auto' : 3, 1037 scrollNum = ($(this).parents('.carousel-wrap').attr('data-full-width') == 'true') ? 'auto' : '', 1038 colWidth = ($(this).parents('.carousel-wrap').attr('data-full-width') == 'true') ? 500 : 453, 1039 $autoplayBool = ($(this).attr('data-autorotate') == 'true') ? true : false, 1040 $themeSkin = true, 1041 $themeSkin2 = true; 1042 1043 var scrollSpeed, easing; 1044 1045 if ($('body.ascend').length > 0 && $(this).parents('.carousel-wrap').attr('data-full-width') != 'true' || 1046 $('body.material').length > 0 && $(this).parents('.carousel-wrap').attr('data-full-width') != 'true') { 1047 1048 if ($(this).find('li').length % 3 === 0) { 1049 $themeSkin = true; 1050 $themeSkin2 = true; 1051 } else { 1052 $themeSkin = false;
1053 $themeSkin2 = true; 1054 } 1055 1056 } else { 1057 $themeSkin = true; 1058 $themeSkin2 = true; 1059 } 1060 1061 scrollSpeed = (parseInt($(this).attr('data-scroll-speed'))) ? parseInt($(this).attr('data-scroll-speed')) : 700; 1062 easing = ($(this).is('[data-easing]')) ? $(this).attr('data-easing') : 'linear'; 1063 1064 var $element = $that; 1065 if ($that.find('img').length == 0) { 1066 $element = $body; 1067 } 1068 1069 imagesLoaded($element, function () { 1070 1071 $that.carouFredSel({ 1072 circular: $themeSkin, 1073 infinite: $themeSkin2, 1074 height: 'auto', 1075 responsive: true, 1076 items: { 1077 width: colWidth, 1078 visible: { 1079 min: 1, 1080 max: maxCols 1081 } 1082 }, 1083 swipe: { 1084 onTouch: true, 1085 onMouse: true, 1086 options: { 1087 excludedElements: "button, input, select, textarea, .noSwipe", 1088 tap: function (event, target) { 1089 if ($(target).attr('href') && 1090 !$(target).is('[target="_blank"]') && 1091 !$(target).is('[rel^="prettyPhoto"]') && 1092 !$(target).is('.magnific-popup') && 1093 !$(target).is('.magnific')) { 1094 window.open($(target).attr('href'), '_self'); 1095 } 1096 } 1097 }, 1098 onBefore: function () { 1099 // Hover effect. 1100 $that.find('.work-item').trigger('mouseleave'); 1101 $that.find('.work-item .work-info a').trigger('mouseup'); 1102 } 1103 }, 1104 scroll: { 1105 items: scrollNum, 1106 easing: easing, 1107 duration: scrollSpeed, 1108 onBefore: function () { 1109 1110 if ($('body.ascend').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true' || 1111 $('body.material').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true') { 1112 1113 $that.parents('.carousel-wrap') 1114 .find('.item-count .total') 1115 .html(Math.ceil($that.find('> li').length / $that.triggerHandler("currentVisible").length)); 1116 1117 } 1118 }, 1119 onAfter: function () { 1120 if ($('body.ascend').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true' || 1121 $('body.material').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true') { 1122 1123 $that.parents('.carousel-wrap') 1124 .find('.item-count .current') 1125 .html($that.triggerHandler('currentPage') + 1); 1126 1127 $that.parents('.carousel-wrap') 1128 .find('.item-count .total') 1129 .html(Math.ceil($that.find('> li').length / $that.triggerHandler("currentVisible").length)); 1130 1131 } 1132 } 1133 1134 }, 1135 prev: { 1136 button: function () { 1137 return $that.parents('.carousel-wrap').find('.carousel-prev'); 1138 } 1139 }, 1140 next: { 1141 button: function () { 1142 return $that.parents('.carousel-wrap').find('.carousel-next'); 1143 } 1144 }, 1145 auto: { 1146 play: $autoplayBool 1147 } 1148 }, {
1149 transition: true 1150 }).animate({ 1151 'opacity': 1 1152 }, 1300); 1153 1154 $that 1155 .parents('.carousel-wrap') 1156 .wrap('<div class="carousel-outer">'); 1157 1158 if ($that.parents('.carousel-wrap').attr('data-full-width') == 'true') { 1159 $that 1160 .parents('.carousel-outer') 1161 .css('overflow', 'visible'); 1162 } 1163 1164 // Add count for non full width ascend skin. 1165 if ($('body.ascend').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true' || 1166 $('body.material').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true') { 1167 $('<div class="item-count"><span class="current">1</span>/<span class="total">' + ($that.find('> li').length / $that.triggerHandler("currentVisible").length) + '</span></div>').insertAfter($that.parents('.carousel-wrap').find('.carousel-prev')); 1168 } 1169 1170 $that.addClass('finished-loading'); 1171 1172 carouselHeightCalcs(); 1173 1174 }); 1175 1176 }); 1177 1178 // Resize 1179 $window.off('smartresize.carouselHeightCalcs'); 1180 $window.on('smartresize.carouselHeightCalcs', carouselHeightCalcs); 1181 1182 } 1183 1184 1185 1186 1187 1188 1189 1190 /** 1191 * Full width carousel link event. 1192 * 1193 * @since 4.0 1194 */ 1195 function fwCarouselLinkFix() { 1196 1197 var $mousePosStart = 0, 1198 $mousePosEnd = 0, 1199 fwCarouselLinkSelector = '.carousel-wrap .portfolio-items .col .work-info a, .woocommerce .products-carousel ul.products li.product a'; 1200 1201 $(fwCarouselLinkSelector).on('mousedown', function (e) { 1202 $mousePosStart = e.clientX; 1203 }); 1204 1205 $(fwCarouselLinkSelector).on('mouseup', function (e) { 1206 $mousePosEnd = e.clientX; 1207 }); 1208 1209 $(fwCarouselLinkSelector).on('click', function () { 1210 if (Math.abs($mousePosStart - $mousePosEnd) > 10) { 1211 return false; 1212 } 1213 }); 1214 1215 } 1216 1217 1218 1219 1220 1221 /** 1222 * Owl carousel plugin initialization. 1223 * 1224 * @since 6.0 1225 */ 1226 function owlCarouselInit() { 1227 1228 if ( $('.owl-carousel').length === 0 ) { 1229 return; 1230 } 1231 1232 $('.owl-carousel').each(function () { 1233 1234 $(this).addClass('owl-theme'); 1235 1236 var $that = $(this), 1237 $autoRotateBool = $that.attr('data-autorotate'), 1238 $autoRotateSpeed = $that.attr('data-autorotation-speed'), 1239 $owlLoopBool = ($that.is('[data-loop="true"]')) ? true : false; 1240 1241 $(this).owlCarousel({ 1242 responsive: { 1243 0: { 1244 items: $(this).attr('data-mobile-cols') 1245 }, 1246 690: { 1247 items: $(this).attr('data-tablet-cols') 1248 }, 1249 1000: { 1250 items: $(this).attr('data-desktop-small-cols') 1251 }, 1252 1300: { 1253 items: $(this).attr('data-desktop-cols') 1254 } 1255 }, 1256 autoplay: $autoRotateBool, 1257 autoplayTimeout: $autoRotateSpeed, 1258 loop: $owlLoopBool, 1259 smartSpeed: 350, 1260 onTranslate: function () { 1261 $that.addClass('moving'); 1262 }, 1263 onTranslated: function () { 1264 $that.removeClass('moving'); 1265 } 1266 1267 }); 1268 1269 $(this).on('changed.owl.carousel', function (event) { 1270 if (event.item.count - event.page.size == event.item.index) { 1271 1272 $(event.target).find('.owl-dots div:last') 1273 .addClass('active') 1274 .siblings() 1275 .removeClass('active'); 1276 } 1277 1278 }); 1279 1280 }); 1281 1282 } 1283 1284 1285 /** 1286 * Owl carousel animate items. 1287 * 1288 * @since 6.0 1289 */ 1290 function owl_carousel_animate() { 1291 1292 $($fullscreenSelector + '.owl-carousel[data-enable-animation="true"]').each(function () { 1293 1294 var $owlOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : 'bottom-in-view'; 1295 var $animationDelay = 0; 1296 1297 if($(this).is('[data-animation-delay]') && 1298 $(this).attr('data-animation-delay').length > 0 && 1299 $(this).attr('data-animation') != 'false') { 1300 $animationDelay = $(this).attr('data-animation-delay'); 1301 } 1302 1303 var $that = $(this); 1304 var waypoint = new Waypoint({ 1305 element: $that, 1306 handler: function () { 1307 1308 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 1309 waypoint.destroy(); 1310 return; 1311 } 1312 1313 setTimeout(function () { 1314 $that.find('.owl-stage > .owl-item').each(function (i) { 1315 1316 var $that = $(this); 1317 $that.delay(i * 200).transition({ 1318 'opacity': '1', 1319 'y': '0' 1320 }, 600, 'easeOutQuart'); 1321 }); 1322 $that.addClass('animated-in'); 1323 1324 }, $animationDelay); 1325 1326 waypoint.destroy(); 1327 }, 1328 offset: $owlOffsetPos 1329 1330 }); 1331 1332 }); 1333 1334 } 1335 1336 1337 /** 1338 * Update WooCommerce Flickity count. 1339 * 1340 * Updates next/prev count for carousels on mobile devices. 1341 * 1342 * @since 9.0 1343 */ 1344 function updateWooFlickityCount(e) {
1345 var slideNumber = e.data.wooFlickity.selectedIndex + 1; 1346 e.data.wooFlickityCount.text(slideNumber + '/' + e.data.wooFlickity.slides.length); 1347 } 1348 1349 1350 1351 /** 1352 * Product carousel initialization. 1353 * 1354 * @since 4.0 1355 */ 1356 function productCarouselInit() { 1357 1358 if ($('.products-carousel').length === 0 && $('.nectar-woo-flickity').length === 0) { 1359 return; 1360 } 1361 1362 $('.products-carousel').each(function () { 1363 1364 var $that = $(this).find('ul'), 1365 maxCols = 'auto', 1366 scrollNum = 'auto', 1367 colWidth = ($(this).parents('.full-width-content ').length > 0) ? 400 : 353, 1368 scrollSpeed = 800, 1369 easing = 'easeInOutQuart'; 1370 1371 var $element = $that; 1372 if ($that.find('img').length == 0) { 1373 $element = $body; 1374 } 1375 1376 // Controls on hover. 1377 $(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>'); 1378 1379 imagesLoaded($element, function () { 1380 1381 $that.carouFredSel({ 1382 circular: true, 1383 responsive: true, 1384 items: { 1385 width: colWidth, 1386 visible: { 1387 min: 1, 1388 max: maxCols 1389 } 1390 }, 1391 swipe: { 1392 onTouch: true, 1393 onMouse: true, 1394 options: { 1395 excludedElements: "button, input, select, textarea, .noSwipe", 1396 tap: function (event, target) { 1397 1398 if ($(target).attr('href') && 1399 !$(target).is('[target="_blank"]') && 1400 !$(target).hasClass('add_to_wishlist') && 1401 !$(target).hasClass('add_to_cart_button') && 1402 !$(target).is('[rel^="prettyPhoto"]')) { 1403 window.open($(target).attr('href'), '_self'); 1404 } 1405 1406 if ($(target).parent().attr('href') && 1407 !$(target).parent().is('[target="_blank"]') && 1408 !$(target).parent().hasClass('add_to_wishlist') && 1409 !$(target).parent().hasClass('add_to_cart_button') && 1410 !$(target).parent().is('[rel^="prettyPhoto"]')) { 1411 window.open($(target).parent().attr('href'), '_self'); 1412 } 1413 1414 } 1415 }, 1416 onBefore: function () { 1417 $that.find('.product-wrap').trigger('mouseleave'); 1418 $that.find('.product a').trigger('mouseup'); 1419 } 1420 }, 1421 scroll: { 1422 items: scrollNum, 1423 easing: easing, 1424 duration: scrollSpeed 1425 }, 1426 prev: { 1427 button: function () { 1428 return $that.parents('.carousel-wrap').find('.carousel-prev'); 1429 } 1430 }, 1431 next: { 1432 button: function () { 1433 return $that.parents('.carousel-wrap').find('.carousel-next'); 1434 } 1435 }, 1436 auto: { 1437 play: false 1438 } 1439 }).animate({ 1440 'opacity': 1 1441 }, 1300); 1442 1443 $that.parents('.carousel-wrap').wrap('<div class="carousel-outer">'); 1444 1445 $that.addClass('finished-loading'); 1446 fullWidthContentColumns(); 1447 $window.trigger('resize'); 1448 1449 }); 1450 1451 1452 }); 1453 1454 1455 1456 $wooFlickityCarousels = []; 1457 $('.nectar-woo-flickity').each(function (i) { 1458 1459 var $that = $(this); 1460 1461 $(this).find('.products > li').each(function () { 1462 $(this).wrap('<div class="flickity-cell"></div>'); 1463 }); 1464 1465 fullWidthSections(); 1466 1467 var pageDotsBool = ($that.is('[data-controls="bottom-pagination"]')) ? true : false, 1468 arrowsBool = ($that.is('[data-controls="bottom-pagination"]')) ? false : true, 1469 $autoplay = ($that.is('[data-autorotate-speed]') && parseInt($that.attr('data-autorotate-speed')) > 800) ? parseInt($that.attr('data-autorotate-speed')) : 5000; 1470 1471 if (!$that.is('[data-autorotate="true"]')) { 1472 $autoplay = false; 1473 } 1474 1475 $(this).find('ul').addClass('generate-markup'); 1476 1477 $wooFlickityCarousels[i] = $(this).find('ul'); 1478 1479 if (arrowsBool == true) { 1480 $wooFlickityCarousels[i].on('ready.flickity', function () { 1481 var flickityPrv = $that.find('.flickity-prev-next-button.previous').detach(); 1482 var flickityNxt = $that.find('.flickity-prev-next-button.next').detach(); 1483 1484 $that.find('.nectar-woo-carousel-top').append(flickityPrv).append(flickityNxt); 1485 }); 1486 } 1487 1488 $wooFlickityCarousels[i].flickity({ 1489 draggable: true, 1490 lazyLoad: false, 1491 imagesLoaded: true, 1492 cellAlign: 'left', 1493 groupCells: pageDotsBool, 1494 prevNextButtons: arrowsBool, 1495 pageDots: pageDotsBool, 1496 resize: true, 1497 percentPosition: true, 1498 setGallerySize: true, 1499 wrapAround: true, 1500 autoPlay: $autoplay, 1501 accessibility: false 1502 }); 1503 1504 1505 // Mobile pagination numbers. 1506 if (arrowsBool == true) { 1507 1508 $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>'); 1509 1510 var $wooFlickityCount = $('<div class="woo-flickity-count" />'); 1511 $that.append($wooFlickityCount); 1512 var $wooFlickityData = $wooFlickityCarousels[i].data('flickity'); 1513 1514 var $eventData = { 1515 data: { 1516 wooFlickity: $wooFlickityData, 1517 wooFlickityCount: $wooFlickityCount 1518 } 1519 }; 1520 1521 updateWooFlickityCount($eventData); 1522 1523 $wooFlickityCarousels[i].on('select.flickity', { wooFlickity: $wooFlickityData, wooFlickityCount: $wooFlickityCount }, updateWooFlickityCount ); 1524 } 1525 1526 }); 1527 1528 } 1529 1530 1531 1532 1533 1534 /** 1535 * Standard Carousel Height Calculations. 1536 * 1537 * @since 2.0 1538 */ 1539 function carouselHeightCalcs() { 1540 1541 // Standard carousels 1542 $('.carousel.finished-loading:not(".portfolio-items, .clients"), .caroufredsel_wrapper .products.finished-loading').each(function () { 1543 1544 var tallestColumn = 0; 1545 1546 $(this).find('> li').each(function () { 1547 1548 if( $(this).height() > tallestColumn ) { 1549 tallestColumn = $(this).height(); 1550 } 1551 1552 }); 1553 1554 $(this).css('height', tallestColumn + 5); 1555 $(this).parents('.caroufredsel_wrapper').css('height', tallestColumn + 5); 1556 1557 if ($('body.ascend').length > 0 && $(this).parents('.carousel-wrap').attr('data-full-width') != 'true' || 1558 $('body.material').length > 0 && $(this).parents('.carousel-wrap').attr('data-full-width') != 'true') { 1559 1560 $(this).parents('.carousel-wrap').find('.item-count .current').html(Math.ceil(($(this).triggerHandler("currentPosition") + 1) / $(this).triggerHandler("currentVisible").length)); 1561 $(this).parents('.carousel-wrap').find('.item-count .total').html(Math.ceil($(this).find('> li').length / $(this).triggerHandler("currentVisible").length)); 1562 } 1563 1564 }); 1565 1566 } 1567 1568 1569 1570 /** 1571 * Clients carousel element. 1572 * 1573 * @since 2.0 1574 */ 1575 function clientsCarouselInit() { 1576 1577 if ( $('.carousel.clients').length === 0 ) { 1578 return; 1579 } 1580 1581 $('.carousel.clients').each(function () { 1582 1583 var $that = $(this); 1584 var $autoRotate = (!$(this).hasClass('disable-autorotate')) ? true : false;
1585 var columns; 1586 1587 columns = (parseInt($(this).attr('data-max'))) ? parseInt($(this).attr('data-max')) : 5; 1588 1589 if ($window.width() < 690 && $body.attr('data-responsive') == '1') { 1590 columns = 2; 1591 $(this).addClass('phone'); 1592 } 1593 1594 var $element = $that; 1595 if ($that.find('img').length == 0) { 1596 $element = $body; 1597 } 1598 1599 imagesLoaded($element, function () { 1600 1601 $that.carouFredSel({ 1602 circular: true, 1603 responsive: true, 1604 items: { 1605 1606 height: $that.find('> div:first').height(), 1607 width: $that.find('> div:first').width(), 1608 visible: { 1609 min: 1, 1610 max: columns 1611 } 1612 }, 1613 swipe: { 1614 onTouch: true, 1615 onMouse: true 1616 }, 1617 scroll: { 1618 items: 1, 1619 easing: 'easeInOutCubic', 1620 duration: '800', 1621 pauseOnHover: true 1622 }, 1623 auto: { 1624 play: $autoRotate, 1625 timeoutDuration: 2700 1626 } 1627 }).animate({ 1628 'opacity': 1 1629 }, 1300); 1630 1631 $that.addClass('finished-loading'); 1632 $that.parents('.carousel-wrap').wrap('<div class="carousel-outer">'); 1633 1634 $window.trigger('resize'); 1635 1636 }); 1637 1638 }); 1639 1640 $window.off('smartresize.clientsCarouselHeight',clientsCarouselHeightRecalc); 1641 $window.on('smartresize.clientsCarouselHeight',clientsCarouselHeightRecalc); 1642 } 1643 1644 1645 1646 1647 1648 1649 /** 1650 * Clients carousel height calculations. 1651 * 1652 * @since 2.0 1653 */ 1654 function clientsCarouselHeightRecalc() { 1655 1656 var tallestImage = 0; 1657 1658 $('.carousel.clients.finished-loading').each(function () { 1659 1660 $(this).find('> div').each(function () { 1661 1662 if( $(this).height() > tallestImage ) { 1663 tallestImage = $(this).height(); 1664 } 1665 1666 }); 1667 1668 $(this).css('height', tallestImage); 1669 $(this).parent().css('height', tallestImage); 1670 }); 1671 } 1672 1673 $window.on("orientationchange", function () { 1674 setTimeout(clientsCarouselHeightRecalc, 200); 1675 }); 1676 1677 1678 1679 /** 1680 * Adds grabbing classes onto carousels when dragging. 1681 * 1682 * @since 3.0 1683 */ 1684 function carouselfGrabbingClass() { 1685 1686 $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 () { 1687 $(this).addClass('active'); 1688 }); 1689 1690 $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 () { 1691 $(this).removeClass('active'); 1692 }); 1693 1694 // Arrow hover class. 1695 $('body.ascend, body.material').on('mouseover', '.carousel-next', function () { 1696 $(this).parent().find('.carousel-prev, .item-count').addClass('next-hovered'); 1697 }); 1698 1699 $('body.ascend, body.material').on('mouseleave', '.carousel-next', function () { 1700 $(this).parent().find('.carousel-prev, .item-count').removeClass('next-hovered'); 1701 }); 1702 1703 } 1704 1705 1706 1707 1708 1709 1710 1711 /** 1712 * Client element fade in animation. 1713 * 1714 * @since 3.0 1715 * @see waypoints 1716 */ 1717 function clientsFadeIn() { 1718 1719 var $clientsOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : 'bottom-in-view'; 1720 $($fullscreenSelector + '.clients.fade-in-animation').each(function () { 1721 1722 var $that = $(this), 1723 waypoint = new Waypoint({ 1724 element: $that, 1725 handler: function () { 1726 1727 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 1728 waypoint.destroy(); 1729 return; 1730 } 1731 1732 $that.find('> div').each(function (i) { 1733 $(this).delay(i * 80).transition({ 1734 'opacity': "1" 1735 }, 450); 1736 }); 1737 1738 // Add the css transition class back in after the aniamtion is done. 1739 setTimeout(function () { 1740 $that.addClass('completed'); 1741 }, ($that.find('> div').length * 80) + 450); 1742 1743 1744 $that.addClass('animated-in'); 1745 waypoint.destroy(); 1746 }, 1747 offset: $clientsOffsetPos 1748 1749 }); 1750 }); 1751 } 1752 1753 1754 1755 /*-------------------------------------------------------------------------*/ 1756 /* Helper Functions 1757 /*-------------------------------------------------------------------------*/ 1758 1759 1760 /** 1761 * Cross browser request animation frame. 1762 * 1763 * @since 4.0 1764 */ 1765 window.requestAnimationFrame = window.requestAnimationFrame || 1766 window.mozRequestAnimationFrame || 1767 window.webkitRequestAnimationFrame || 1768 window.msRequestAnimationFrame || 1769 function(f) { 1770 setTimeout(f, 1000 / 60); 1771 } 1772 1773 1774 /** 1775 * Smart resize. 1776 * 1777 * @since 1.0 1778 */ 1779 var $event = $.event, 1780 dispatchMethod = $.event.handle ? 'handle' : 'dispatch', 1781 resizeTimeout; 1782 1783 $event.special.smartresize = { 1784 setup: function() { 1785 $(this).on( "resize", $event.special.smartresize.handler ); 1786 }, 1787 teardown: function() { 1788 $(this).off( "resize", $event.special.smartresize.handler ); 1789 }, 1790 handler: function( event, execAsap ) { 1791 1792 var context = this, 1793 args = arguments; 1794 1795 event.type = "smartresize"; 1796 1797 if ( resizeTimeout ) { 1798 clearTimeout( resizeTimeout ); 1799 } 1800 resizeTimeout = setTimeout(function() { 1801 $event[ dispatchMethod ].apply( context, args ); 1802 }, execAsap === "execAsap"? 0 : 100 ); 1803 } 1804 }; 1805 1806 $.fn.smartresize = function( fn ) { 1807 return fn ? this.on( "smartresize", fn ) : this.trigger( "smartresize", ["execAsap"] ); 1808 }; 1809
1810 1811 /** 1812 * Linear interpolation 1813 * 1814 * @since 11.0 1815 */ 1816 function linearInterpolate(a, b, n) { 1817 return (1 - n) * a + n * b; 1818 } 1819 1820 /** 1821 * Aspect Ratio Calculator 1822 * 1823 * @since 11.0 1824 */ 1825 function calculateAspectRatio(srcWidth, srcHeight, maxWidth, maxHeight) { 1826 var ratio = Math.min(maxWidth / srcWidth, maxHeight / srcHeight); 1827 return { width: srcWidth*ratio, height: srcHeight*ratio }; 1828 } 1829 1830 /** 1831 * Calculate header navigation height 1832 * 1833 * The header nav bar height can change on scrolling from theme option effects/using the secondary 1834 * header, so it is necessary to calculate the reduced height in advance for correct sticky waypoint 1835 * event binding & animated anchor links. 1836 * 1837 * @since 10.5 1838 * @return {number} Height of nav bar. 1839 */ 1840 function calcHeaderNavHeight() { 1841 1842 var navHeight; 1843 1844 // Left header format, no header template, hide header until needed. 1845 if( ($body.is('[data-header-format="left-header"]') && nectarDOMInfo.winW >= 1000) || 1846 $body.is('[data-hhun="1"]') && nectarDOMInfo.winW >= 1000 || 1847 $('.page-template-template-no-header-footer').length > 0 || 1848 $('.page-template-template-no-header').length > 0) { 1849 1850 navHeight = 0; 1851 1852 } 1853 1854 // Regular Header 1855 else { 1856 1857 var headerPadding2 = headerPadding - headerPadding / 1.8; 1858 var $headerNavSpace = $headerOuterEl.outerHeight(); 1859 1860 // Secondary header bar. 1861 if( $headerSecondaryEl.length > 0 && $body.is('.material') || 1862 $headerSecondaryEl.length > 0 && !$body.is('.material') && nectarDOMInfo.winW < 1000) { 1863 $headerNavSpace -= nectarDOMInfo.secondaryHeaderHeight; 1864 } 1865 1866 // Check for header resize effect. 1867 if( $headerOuterEl.is('[data-header-resize="1"]') && !$headerOuterEl.is('.small-nav') && nectarDOMInfo.winW >= 1000 ) { 1868 navHeight = $headerNavSpace - (parseInt(logoShrinkNum) + headerPadding2 * 2); 1869 } else { 1870 navHeight = $headerNavSpace; 1871 } 1872 1873 } 1874 1875 // Condense header effect. 1876 if ( nectarDOMInfo.winW >= 1000 && $('#header-outer[data-condense="true"]').length > 0 ) { 1877 1878 var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'); 1879 navHeight = $headerOuterEl.height() - (parseInt($headerSpan9.position().top) - parseInt($headerOuterEl.find('#logo').css('margin-top'))) - parseInt(nectarDOMInfo.secondaryHeaderHeight); 1880 1881 } 1882 1883 return navHeight; 1884 1885 } 1886 1887 1888 /** 1889 * Removes CSS outlines in an accessible manner. 1890 * 1891 * @since 10.5 1892 */ 1893 (function(d){ 1894 1895 var style_element = d.createElement('STYLE'), 1896 dom_events = 'addEventListener' in d, 1897 add_event_listener = function(type, callback){ 1898 if(dom_events){ 1899 d.addEventListener(type, callback); 1900 }else{ 1901 d.attachEvent('on' + type, callback); 1902 } 1903 }, 1904 set_css = function(css_text){ 1905 !!style_element.styleSheet ? style_element.styleSheet.cssText = css_text : style_element.innerHTML = css_text; 1906 }; 1907 1908 d.getElementsByTagName('HEAD')[0].appendChild(style_element); 1909 1910 add_event_listener('mousedown', function(){ 1911 set_css(':focus{outline:0}::-moz-focus-inner{border:0;}'); 1912 }); 1913 1914 add_event_listener('keydown', function(){ 1915 set_css(''); 1916 }); 1917 1918 })(document); 1919 1920 1921 1922 /** 1923 * Cursor position. 1924 * 1925 * @since 4.0 1926 */ 1927 jQuery.fn.setCursorPosition = function (position) { 1928 1929 if (this.length == 0) { 1930 return this; 1931 } 1932 return $(this).setSelection(position, position); 1933 }; 1934 1935 1936 /** 1937 * Set selection in input. 1938 * 1939 * @since 4.0 1940 */ 1941 jQuery.fn.setSelection = function (selectionStart, selectionEnd) { 1942 if (this.length == 0) { 1943 return this; 1944 } 1945 var input = this[0]; 1946 1947 if (input.createTextRange) { 1948 var range = input.createTextRange(); 1949 range.collapse(true); 1950 range.moveEnd('character', selectionEnd); 1951 range.moveStart('character', selectionStart); 1952 range.select(); 1953 } else if (input.setSelectionRange) { 1954 input.focus(); 1955 input.setSelectionRange(selectionStart, selectionEnd); 1956 } 1957 1958 return this; 1959 }; 1960 1961 $.extend($.expr[':'], { 1962 transparent: function (elem, i, attr) { 1963 return ($(elem).css("opacity") === "0"); 1964 } 1965 }); 1966 1967 1968 1969 /** 1970 * Converts to hex. 1971 * 1972 * @since 3.0 1973 */ 1974 function hex(x) { 1975 return ("0" + parseInt(x).toString(16)).slice(-2); 1976 } 1977 1978 /** 1979 * CSS color RGB helper. 1980 * 1981 * @since 3.0 1982 */ 1983 $.cssHooks.color = { 1984 get: function (elem) { 1985 1986 var color; 1987 1988 if (elem.currentStyle) { 1989 color = elem.currentStyle["color"]; 1990 } else if (window.getComputedStyle) { 1991 color = document.defaultView.getComputedStyle(elem, 1992 null).getPropertyValue("color"); 1993 } 1994 if (color.search("rgb") == -1) { 1995 return color; 1996 } else { 1997 color = color.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/); 1998 1999 if (color) { 2000 return "#" + hex(color[1]) + hex(color[2]) + hex(color[3]); 2001 } 2002 } 2003 } 2004 }; 2005 2006 /** 2007 * CSS background color RGB helper. 2008 * 2009 * @since 3.0 2010 */ 2011 $.cssHooks.backgroundColor = { 2012 get: function (elem) { 2013 2014 var bg; 2015 2016 if (elem.currentStyle) { 2017 bg = elem.currentStyle["backgroundColor"]; 2018 } else if (window.getComputedStyle) { 2019 bg = document.defaultView.getComputedStyle(elem, 2020 null).getPropertyValue("background-color"); 2021 } 2022 if (bg.search("rgb") == -1) { 2023 return bg; 2024 } else { 2025 bg = bg.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/); 2026 2027 if (bg) { 2028 return "#" + hex(bg[1]) + hex(bg[2]) + hex(bg[3]); 2029 } 2030 } 2031 } 2032 }; 2033 2034 2035 /** 2036 * Unique ID generator. 2037 * 2038 * @since 10.5 2039 */ 2040 function uniqueIdGenerate() { 2041 return Math.floor(Math.random() * 10000); 2042 } 2043 2044 2045 2046 2047 /** 2048 * Animated page scroll 2049 * 2050 * @since 9.0 2051 */ 2052 function nectar_scrollToY(scrollTargetY, speed, easing) { 2053 2054 var scrollY = window.scrollY || document.documentElement.scrollTop, 2055 scrollTargetY = scrollTargetY || 0, 2056 speed = speed || 2000, 2057 easing = easing || 'easeOutSine', 2058 currentTime = 0; 2059 2060 var time = Math.max(0.1, Math.min(Math.abs(scrollY - scrollTargetY) / speed, 0.8)); 2061 2062 var easingEquations = { 2063 easeInOutQuint: function (pos) { 2064 if ((pos /= 0.5) < 1) { 2065 return 0.5 * Math.pow(pos, 5); 2066 } 2067 return 0.5 * (Math.pow((pos - 2), 5) + 2); 2068 } 2069 }; 2070 2071 function tick() { 2072 currentTime += 1 / 60; 2073 2074 var p = currentTime / time; 2075 var t = easingEquations[easing](p); 2076 2077 if (p < 1) { 2078 requestAnimationFrame(tick); 2079 2080 window.scrollTo(0, scrollY + ((scrollTargetY - scrollY) * t)); 2081 } else { 2082 window.scrollTo(0, scrollTargetY); 2083 } 2084 } 2085 2086 tick(); 2087 } 2088 2089 2090 /* 2091 * Bootstrap ScrollSpy Component 2092 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) */ 2093 (function ($) { 2094 2095 function s(e, i) { 2096 var r = $.proxy(this.process, this); 2097 this.$body = $("body"), this.$scrollElement = $($(e).is("body") ? window : e), 2098 this.options = $.extend({}, s.DEFAULTS, i), 2099 this.selector = (this.options.target || "") + " ul li > a", 2100 this.offsets = [], 2101 this.targets = [], 2102 this.activeTarget = null, 2103 this.scrollHeight = 0, 2104 this.$scrollElement.on("scroll.bs.scrollspy", r), 2105 this.refresh(), 2106 this.process(); 2107 } 2108 2109 function e(e) { 2110 return this.each(function () { 2111 var i = $(this), 2112 r = i.data("bs.scrollspy"), 2113 o = "object" == typeof e && e; 2114 r || i.data("bs.scrollspy", r = new s(this, o)), "string" == typeof e && r[e]() 2115 }) 2116 } 2117 2118 s.VERSION = "3.2.0", 2119 s.DEFAULTS = { 2120 offset: 10 2121 }, 2122 s.prototype.getScrollHeight = function () { 2123 return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight) 2124 }, 2125 s.prototype.refresh = function () { 2126 var s = "offset", 2127 e = 0; 2128 $.isWindow(this.$scrollElement[0]) || (s = "position", e = this.$scrollElement.scrollTop()), this.offsets = [], this.targets = [], this.scrollHeight = this.get
2128ScrollHeight(); 2129 var i = this; 2130 this.$body.find(this.selector).map(function () { 2131 var i = $(this), 2132 r = i.data("target") || i.attr("href"), 2133 o = /^#./.test(r) && $(r); 2134 return o && o.length && o.is(":visible") && [ 2135 [o[s]().top + e, r] 2136 ] || null 2137 }).sort(function (t, s) { 2138 return t[0] - s[0] 2139 }).each(function () { 2140 i.offsets.push(this[0]), i.targets.push(this[1]) 2141 }) 2142 }, 2143 s.prototype.process = function () { 2144 2145 var $pageSubMenu = 0; 2146 2147 if( $('.page-submenu[data-sticky="true"]').length > 0 && $('body[data-hhun="1"]').length == 0 2148 || $('.page-submenu[data-sticky="true"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length > 0 ) { 2149 $pageSubMenu = $('.page-submenu').height(); 2150 } 2151 2152 var t, s = this.$scrollElement.scrollTop() + this.options.offset + $pageSubMenu, 2153 e = this.getScrollHeight(), 2154 i = this.options.offset + e - this.$scrollElement.height() - $pageSubMenu, 2155 r = this.offsets, 2156 o = this.targets, 2157 l = this.activeTarget; 2158 2159 // remove active when scrolling to first section that does not have an anchor 2160 if (this.activeTarget && s < this.offsets[0] && this.offsets[0] > 0) { 2161 this.activeTarget = null; 2162 $(this.selector).parentsUntil(this.options.target, ".current-menu-item").removeClass("current-menu-item").removeClass('sfHover'); 2163 return; 2164 } 2165 2166 if (this.scrollHeight != e && this.refresh(), s >= i) { 2167 return l != (t = o[o.length - 1]) && this.activate(t); 2168 } 2169 if (l && s <= r[0]) { 2170 return l != (t = o[0]) && this.activate(t); 2171 } 2172 2173 2174 for (t = r.length; t--;) l != o[t] && s >= r[t] && (!r[t + 1] || s <= r[t + 1]) && this.activate(o[t]) 2175 }, 2176 s.prototype.activate = function (s) { 2177 this.activeTarget = s, $(this.selector).parentsUntil(this.options.target, ".current-menu-item").removeClass("current-menu-item").removeClass('sfHover'); 2178 var e = this.selector + '[data-target="' + s + '"],' + this.selector + '[href="' + s + '"]', 2179 i = $(e).parents("li").addClass("current-menu-item"); 2180 i.parent(".dropdown-menu").length && (i = i.closest("li.dropdown").addClass("current-menu-item")), i.trigger("activate.bs.scrollspy") 2181 }; 2182 2183 var i = $.fn.scrollspy; 2184 2185 $.fn.scrollspy = e, 2186 $.fn.scrollspy.Constructor = s, 2187 $.fn.scrollspy.noConflict = function () { 2188 return $.fn.scrollspy = i, this 2189 } 2190 2191 }(jQuery)); 2192 2193 2194 /** 2195 * Mobile break point checker 2196 * 2197 * @since 9.0 2198 */ 2199 function mobileBreakPointCheck() { 2200 2201 var $mobileBreakpoint = ($('body[data-header-breakpoint]').length > 0 && $body.attr('data-header-breakpoint') != '1000') ? parseInt($body.attr('data-header-breakpoint')) : 1000; 2202 var $withinCustomBreakpoint = false; 2203 2204 if ($mobileBreakpoint != 1000) { 2205 if ($('body[data-user-set-ocm="1"][data-slide-out-widget-area-style="slide-out-from-right-hover"]').length == 0 && nectarDOMInfo.winW > 1000 && nectarDOMInfo.winW <= $mobileBreakpoint) { 2206 $withinCustomBreakpoint = true; 2207 } 2208 } 2209 2210 return $withinCustomBreakpoint; 2211 } 2212 2213 /** 2214 * Extract a URL 2215 * 2216 * @since 5.0 2217 */ 2218 function extractUrl(input) { 2219 return input.replace(/"/g, "").replace(/url\(|\)$/ig, ""); 2220 } 2221 2222 /** 2223 * Extract query params 2224 * 2225 * @since 10.5 2226 */ 2227 function getQueryParams(qs) { 2228 qs = qs.split("+").join(" "); 2229 var params = {}, 2230 tokens, 2231 re = /[?&]?([^=]+)=([^&]*)/g; 2232 2233 while (tokens = re.exec(qs)) { 2234 params[decodeURIComponent(tokens[1])] = decodeURIComponent(tokens[2]); 2235 } 2236 2237 return params; 2238 } 2239 2240 var nectarGetQueryParam = getQueryParams(document.location.search); 2241 2242 2243 /** 2244 * Check whether an el is visible. 2245 * 2246 * @since 6.0 2247 */ 2248 (function (t) { 2249 var i = t(window); 2250 t.fn.visible = function (t, e, o) { 2251 if (!(this.length < 1)) { 2252 var r = this.length > 1 ? this.eq(0) : this, 2253 n = r.get(0), 2254 f = i.width(), 2255 h = i.height(), 2256 o = o ? o : "both", 2257 l = e === !0 ? n.offsetWidth * n.offsetHeight : !0; 2258 if ("function" == typeof n.getBoundingClientRect) { 2259 var g = n.getBoundingClientRect(), 2260 u = g.top >= 0 && g.top < h, 2261 s = g.bottom > 0 && g.bottom <= h, 2262 c = g.left >= 0 && g.left < f, 2263 a = g.right > 0 && g.right <= f, 2264 v = t ? u || s : u && s, 2265 b = t ? c || a : c && a; 2266 if ("both" === o) { 2267 return l && v && b; 2268 } 2269 if ("vertical" === o) { 2270 return l && v; 2271 } 2272 if ("horizontal" === o) { 2273 return l && b 2274 } 2275 } else { 2276 var d = i.scrollTop(), 2277 p = d + h, 2278 w = i.scrollLeft(), 2279 m = w + f, 2280 y = r.offset(), 2281 z = y.top, 2282 B = z + r.height(), 2283 C = y.left, 2284 R = C + r.width(), 2285 j = t === !0 ? B : z, 2286 q = t === !0 ? z : B, 2287 H = t === !0 ? R : C, 2288 L = t === !0 ? C : R; 2289 if ("both" === o) { 2290 return !!l && p >= q && j >= d && m >= L && H >= w; 2291 } 2292 if ("vertical" === o) { 2293 return !!l && p >= q && j >= d; 2294 } 2295 if ("horizontal" === o) { 2296 return !!l && m >= L && H >= w; 2297 } 2298 } 2299 } 2300 }; 2301 2302 }(jQuery)); 2303 2304 2305 /** 2306 * Count to a specific number 2307 * 2308 * @since 8.0 2309 */ 2310 var CountUp = function (target, startVal, endVal, decimals, duration, options) { 2311 2312 var lastTime = 0; 2313 var vendors = ['webkit', 'moz', 'ms', 'o']; 2314 for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { 2315 window.requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame']; 2316 window.cancelAnimationFrame = 2317 window[vendors[x] + 'CancelAnimationFrame'] || window[vendors[x] + 'CancelRequestAnimationFrame']; 2318 } 2319 if (!window.requestAnimationFrame) { 2320 window.requestAnimationFrame = function (callback) { 2321 var currTime = new Date().getTime(); 2322 var timeToCall = Math.max(0, 16 - (currTime - lastTime)); 2323 var id = window.setTimeout(function () { 2324 callback(currTime + timeToCall); 2325 }, 2326 timeToCall); 2327 lastTime = currTime + timeToCall; 2328 return id; 2329 }; 2330 } 2331 if (!window.cancelAnimationFrame) { 2332 window.cancelAnimationFrame = function (id) { 2333 clearTimeout(id); 2334 }; 2335 } 2336 2337 var self = this; 2338 2339 self.options = { 2340 useEasing: true, 2341 useGrouping: true, 2342 separator: ',',
vendor: 4,182 bytes, lines 2343-2480
2343 decimal: '.', 2344 easingFn: null, 2345 formattingFn: null 2346 }; 2347 // Extend default options with passed options object 2348 for (var key in options) { 2349 if (options.hasOwnProperty(key)) { 2350 self.options[key] = options[key]; 2351 } 2352 } 2353 if (self.options.separator === '') { 2354 self.options.useGrouping = false; 2355 } 2356 if (!self.options.prefix) { 2357 self.options.prefix = ''; 2358 } 2359 if (!self.options.suffix) { 2360 self.options.suffix = ''; 2361 } 2362 2363 self.d = (typeof target === 'string') ? document.getElementById(target) : target; 2364 self.startVal = Number(startVal); 2365 self.endVal = Number(endVal); 2366 self.countDown = (self.startVal > self.endVal); 2367 self.frameVal = self.startVal; 2368 self.decimals = Math.max(0, decimals || 0); 2369 self.dec = Math.pow(10, self.decimals); 2370 self.duration = Number(duration) * 1000 || 2000; 2371 2372 self.formatNumber = function (nStr) { 2373 nStr = nStr.toFixed(self.decimals); 2374 nStr += ''; 2375 var x, x1, x2, rgx; 2376 x = nStr.split('.'); 2377 x1 = x[0]; 2378 x2 = x.length > 1 ? self.options.decimal + x[1] : ''; 2379 rgx = /(\d+)(\d{3})/; 2380 if (self.options.useGrouping) { 2381 while (rgx.test(x1)) { 2382 x1 = x1.replace(rgx, '$1' + self.options.separator + '$2'); 2383 } 2384 } 2385 return self.options.prefix + x1 + x2 + self.options.suffix; 2386 }; 2387 // Robert Penner's easeOutExpo 2388 self.easeOutExpo = function (t, b, c, d) { 2389 return c * (-Math.pow(2, -10 * t / d) + 1) * 1024 / 1023 + b; 2390 }; 2391 2392 self.easingFn = self.options.easingFn ? self.options.easingFn : self.easeOutExpo; 2393 self.formattingFn = self.options.formattingFn ? self.options.formattingFn : self.formatNumber; 2394 2395 self.version = function () { 2396 return '1.7.1'; 2397 }; 2398 2399 // Print value to target 2400 self.printValue = function (value) { 2401 var result = self.formattingFn(value); 2402 2403 if (self.d.tagName === 'INPUT') { 2404 this.d.value = result; 2405 } else if (self.d.tagName === 'text' || self.d.tagName === 'tspan') { 2406 this.d.textContent = result; 2407 } else { 2408 this.d.innerHTML = result; 2409 } 2410 }; 2411 2412 self.count = function (timestamp) { 2413 2414 if (!self.startTime) { 2415 self.startTime = timestamp; 2416 } 2417 2418 self.timestamp = timestamp; 2419 var progress = timestamp - self.startTime; 2420 self.remaining = self.duration - progress; 2421 2422 // To ease or not to ease 2423 if (self.options.useEasing) { 2424 if (self.countDown) { 2425 self.frameVal = self.startVal - self.easingFn(progress, 0, self.startVal - self.endVal, self.duration); 2426 } else { 2427 self.frameVal = self.easingFn(progress, self.startVal, self.endVal - self.startVal, self.duration); 2428 } 2429 } else { 2430 if (self.countDown) { 2431 self.frameVal = self.startVal - ((self.startVal - self.endVal) * (progress / self.duration)); 2432 } else { 2433 self.frameVal = self.startVal + (self.endVal - self.startVal) * (progress / self.duration); 2434 } 2435 } 2436 2437 // Don't go past endVal since progress can exceed duration in the last frame 2438 if (self.countDown) { 2439 self.frameVal = (self.frameVal < self.endVal) ? self.endVal : self.frameVal; 2440 } else { 2441 self.frameVal = (self.frameVal > self.endVal) ? self.endVal : self.frameVal; 2442 } 2443 2444 // Decimal 2445 self.frameVal = Math.round(self.frameVal * self.dec) / self.dec; 2446 2447 // Format and print value 2448 self.printValue(self.frameVal); 2449 2450 // Whether to continue 2451 if (progress < self.duration) { 2452 self.rAF = requestAnimationFrame(self.count); 2453 } else { 2454 if (self.callback) { 2455 self.callback(); 2456 } 2457 } 2458 }; 2459 // Start animation 2460 self.start = function (callback) { 2461 self.callback = callback; 2462 self.rAF = requestAnimationFrame(self.count); 2463 return false; 2464 }; 2465 // Toggles pause/resume animation 2466 self.pauseResume = function () { 2467 if (!self.paused) { 2468 self.paused = true; 2469 cancelAnimationFrame(self.rAF); 2470 } else { 2471 self.paused = false; 2472 delete self.startTime; 2473 self.duration = self.remaining; 2474 self.startVal = self.frameVal; 2475 requestAnimationFrame(self.count); 2476 } 2477 }; 2478 // Reset to startVal so animation can be run again 2479 self.reset = function () { 2480 self.paused = false;
2481 delete self.startTime; 2482 self.startVal = startVal; 2483 cancelAnimationFrame(self.rAF); 2484 self.printValue(self.startVal); 2485 }; 2486 // Pass a new endVal and start animation 2487 self.update = function (newEndVal) { 2488 cancelAnimationFrame(self.rAF); 2489 self.paused = false; 2490 delete self.startTime; 2491 self.startVal = self.frameVal; 2492 self.endVal = Number(newEndVal); 2493 self.countDown = (self.startVal > self.endVal); 2494 self.rAF = requestAnimationFrame(self.count); 2495 }; 2496 2497 // Format startVal on initialization 2498 self.printValue(self.startVal); 2499 }; 2500 2501 var easeOutCubic = function (t, b, c, d) { 2502 return c * ((t = t / d - 1) * t * t + 1) + b; 2503 }; 2504 2505 2506 /** 2507 * Create styles 2508 * 2509 * @since 10.5 2510 */ 2511 function nectarCreateStyle(styles, name) { 2512 2513 if(styles.length > 0) { 2514 2515 var head = document.head || document.getElementsByTagName('head')[0]; 2516 var style = document.createElement('style'); 2517 2518 style.type = 'text/css'; 2519 if (style.styleSheet) { 2520 style.styleSheet.cssText = styles; 2521 } else { 2522 style.appendChild(document.createTextNode(styles)); 2523 } 2524 2525 $(style).attr('id', name); 2526 $('head').find('#'+name).remove(); 2527 head.appendChild(style); 2528 2529 } 2530 2531 } 2532 2533 2534 2535 2536 /** 2537 * FancyBox lightbox. 2538 * 2539 * @since 8.0 2540 */ 2541 function fancyBoxInit() { 2542 2543 // Convert prettyPhoto links 2544 $('a.pp') 2545 .removeClass('pp') 2546 .attr('data-fancybox', ''); 2547 2548 $("a[rel^='prettyPhoto']:not([rel*='_gal']):not([rel*='product-gallery']):not([rel*='prettyPhoto['])") 2549 .removeAttr('rel') 2550 .attr('data-fancybox', ''); 2551 2552 var $unique_id = uniqueIdGenerate(); 2553 2554 // Image gallery nectar. 2555 $('.wpb_gallery .wpb_gallery_slidesnectarslider_style').each(function() { 2556 $unique_id = uniqueIdGenerate(); 2557 $(this).find('.swiper-slide a:not(.ext-url-link)').attr('data-fancybox', 'group_' + $unique_id); 2558 }); 2559 2560 // Flexslider. 2561 $('.wpb_gallery_slides.wpb_flexslider:not([data-onclick="custom_link"])').each(function() { 2562 $unique_id = uniqueIdGenerate(); 2563 $(this).find('.slides > li > a').attr('data-fancybox', 'group_' + $unique_id); 2564 }); 2565 2566 // Touch enabled gallery. 2567 $('.wpb_gallery_slidesflickity_style, .wpb_gallery_slidesflickity_static_height_style').each(function() { 2568 $unique_id = uniqueIdGenerate(); 2569 $(this).find('.cell > a:not(.ext-url-link)').attr('data-fancybox', 'group_' + $unique_id); 2570 }); 2571 2572 // Add galleries to portfolios. 2573 $('.portfolio-items, .wpb_gallery_slidesparallax_image_grid').each(function() { 2574 $unique_id = uniqueIdGenerate(); 2575 if ($(this).find('.pretty_photo').length > 0) { 2576 2577 $(this).find('.pretty_photo') 2578 .removeClass('pretty_photo') 2579 .attr('data-fancybox', 'group_' + $unique_id); 2580 2581 } else if ($(this).find('a[rel*="prettyPhoto["]').length > 0) { 2582 2583 $(this).find('a[rel*="prettyPhoto["]') 2584 .removeAttr('rel') 2585 .attr('data-fancybox', 'group_' + $unique_id); 2586 } 2587 2588 }); 2589 2590 // Nectar auto lightbox theme option. 2591 if ($body.hasClass('nectar-auto-lightbox')) { 2592 2593 $('.gallery').each(function() { 2594 if ($(this).find('.gallery-icon a[rel^="prettyPhoto"]').length == 0) { 2595 var $unique_id = uniqueIdGenerate(); 2596 $(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"]') 2597 .attr('data-fancybox', 'group_' + $unique_id) 2598 .removeClass('pretty_photo'); 2599 } 2600 }); 2601 2602 $('.main-content img').each(function() { 2603 2604 if ($(this).parent().is("[href]") && 2605 !$(this).parent().is(".magnific-popup") && 2606 $(this).parents('.tiled-gallery').length == 0 && 2607 $(this).parents('.product-image').length == 0 && 2608 $(this).parents('.iosSlider.product-slider').length == 0) { 2609 2610 var match = $(this).parent().attr('href').match(/\.(jpg|png|gif)\b/); 2611 if (match) { 2612 $(this).parent().attr('data-fancybox', ''); 2613 } 2614 } 2615 }); 2616 } 2617 2618 // Regular. 2619 var fbMarginArr = ($('body.admin-bar').length > 0) ? [60, 100] : [60, 100]; 2620 if (nectarDOMInfo.winW < 1000) { 2621 fbMarginArr = [0, 0]; 2622 } 2623 $("[data-fancybox]").fancybox({ 2624 animationEffect: "zoom-in-out", 2625 animationDuration: 350, 2626 buttons: [ 2627 'fullScreen', 2628 'zoom', 2629 'close' 2630 ], 2631 margin: fbMarginArr, 2632 loop: true, 2633 caption: function() { 2634 return $(this).attr('title'); 2635 }, 2636 beforeLoad: function(instance) { 2637 2638 if (typeof instance.current.src !== 'string') { 2639 $.fancybox.close(true); 2640 } 2641 2642 }, 2643 mobile: { 2644 margin: 0 2645 } 2646 }); 2647 } 2648 2649 /** 2650 * Magnific lightbox. 2651 * 2652 * @since 6.0 2653 */ 2654 function magnificInit() { 2655 2656 // Convert old pp links 2657 $('a.pp') 2658 .removeClass('pp') 2659 .addClass('magnific-popup'); 2660 2661 $("a[rel^='prettyPhoto']:not([rel*='_gal']):not([rel*='product-gallery']):not([rel*='prettyPhoto['])") 2662 .removeAttr('rel') 2663 .addClass('magnific-popup'); 2664 2665 // Image gallery nectar. 2666 $('.wpb_gallery .wpb_gallery_slidesnectarslider_style').each(function() { 2667 $(this).find('.swiper-slide a:not(.ext-url-link)').addClass('pretty_photo'); 2668 }); 2669 2670 // Flexslider. 2671 $('.wpb_gallery_slides.wpb_flexslider:not([data-onclick="custom_link"])').each(function() { 2672 $(this).find('.slides > li > a').addClass('pretty_photo'); 2673 }); 2674 2675 // Touch enabled gallery. 2676 $('.wpb_gallery_slidesflickity_style, .wpb_gallery_slidesflickity_static_height_style').each(function() { 2677 $(this).find('.cell > a:not(.ext-url-link)').addClass('pretty_photo'); 2678 }); 2679 2680 // Add galleries to portfolios. 2681 $('.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').each(function() { 2682 2683 if ($(this).find('.pretty_photo').length > 0) { 2684 2685 $(this) 2686 .find('.pretty_photo') 2687 .removeClass('pretty_photo') 2688 .addClass('gallery') 2689 .addClass('magnific'); 2690 2691 } else if ($(this).find('a[rel*="prettyPhoto["]').length > 0) { 2692 2693 $(this) 2694 .find('a[rel*="prettyPhoto["]') 2695 .removeAttr('rel') 2696 .addClass('gallery') 2697 .addClass('magnific'); 2698 } 2699 2700 }); 2701 2702 $("a[data-rel='prettyPhoto[product-gallery]']").each(function() { 2703 $(this) 2704 .removeAttr('data-rel') 2705 .addClass('magnific') 2706 .addClass('gallery'); 2707 }); 2708 2709 // Nectar auto lightbox theme option. 2710 if ($body.hasClass('nectar-auto-lightbox')) { 2711 $('.gallery').each(function() { 2712 if ($(this).find('.gallery-icon a[rel^="prettyPhoto"]').length == 0) { 2713 2714 $(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"]') 2715 .addClass('magnific') 2716 .addClass('gallery') 2717 .removeClass('pretty_photo'); 2718 } 2719 }); 2720 2721 $('.main-content img').each(function() { 2722 2723 if ($(this).parent().is("[href]") && 2724 !$(this).parent().is(".magnific-popup") && 2725 $(this).parents('.tiled-gallery').length == 0 && 2726 $(this).parents('.product-image').length == 0 && 2727 $(this).parents('.iosSlider.product-slider').length == 0) { 2728 2729 var match = $(this).parent().attr('href').match(/\.(jpg|png|gif)\b/); 2730 if (match) { 2731 2732 $(this).parent() 2733 .addClass('magnific-popup') 2734 .addClass('image-link'); 2735 } 2736 } 2737 2738 }); 2739 2740 } 2741 2742 2743 // Regular. 2744 $('a.magnific-popup:not(.gallery):not(.nectar_video_lightbox)').magnificPopup({ 2745 type: 'image', 2746 callbacks: { 2747 imageLoadComplete: function() { 2748 var $that = this; 2749 setTimeout(function() { 2750 $that.wrap.addClass('mfp-image-loaded'); 2751 }, 10); 2752 }, 2753 beforeOpen: function() { 2754 this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim'); 2755 }, 2756 open: function() { 2757 2758 $.magnificPopup.instance.next = function() { 2759 var $that = this; 2760 2761 this.wrap.removeClass('mfp-image-loaded'); 2762 setTimeout(function() { 2763 $.magnificPopup.proto.next.call($that); 2764 }, 100); 2765 }; 2766 2767 $.magnificPopup.instance.prev = function() { 2768 var $that = this; 2769 2770 this.wrap.removeClass('mfp-image-loaded'); 2771 setTimeout(function() { 2772 $.magnificPopup.proto.prev.call($that); 2773 }, 100); 2774 }; 2775 2776 } 2777 },
2778 fixedContentPos: false, 2779 mainClass: 'mfp-zoom-in', 2780 removalDelay: 400 2781 }); 2782 2783 // Video. 2784 $('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({ 2785 type: 'iframe', 2786 fixedContentPos: false, 2787 mainClass: 'mfp-zoom-in', 2788 removalDelay: 400 2789 }); 2790 2791 2792 // Galleries. 2793 $('a.magnific.gallery').each(function() { 2794 2795 var $parentRow = ($(this).closest('.wpb_column').length > 0) ? $(this).closest('.wpb_column') : $(this).parents('.row'); 2796 2797 if ($parentRow.length > 0 && !$parentRow.hasClass('lightbox-col')) { 2798 2799 $parentRow.magnificPopup({ 2800 type: 'image', 2801 delegate: 'a.magnific', 2802 mainClass: 'mfp-zoom-in', 2803 fixedContentPos: false, 2804 callbacks: { 2805 2806 elementParse: function(item) { 2807 2808 if ($(item.el.context).is('[href]') && $(item.el.context).attr('href').indexOf('iframe=true') != -1 || 2809 $(item.el.context).is('[href]') && $(item.el.context).attr('href').indexOf('https://www.youtube.com/watch') != -1) { 2810 item.type = 'iframe'; 2811 } else if ($(item.el.context).is('[href]') && $(item.el.context).attr('href').indexOf('video-popup-') != -1) { 2812 item.type = 'inline'; 2813 } else { 2814 item.type = 'image'; 2815 } 2816 }, 2817 2818 imageLoadComplete: function() { 2819 var $that = this; 2820 setTimeout(function() { 2821 $that.wrap.addClass('mfp-image-loaded'); 2822 }, 10); 2823 }, 2824 2825 beforeOpen: function() { 2826 this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim'); 2827 }, 2828 2829 open: function() { 2830 2831 // Self hosted video. 2832 if ($(this.content).find('.mejs-video video').length > 0 && $().mediaelementplayer) { 2833 $(this.content).find('.mejs-video video')[0].player.remove(); 2834 2835 var $that = this; 2836 setTimeout(function() { 2837 $($that.content).find('video').mediaelementplayer(); 2838 $($that.content).find('.mejs-video video')[0].player.play(); 2839 }, 50); 2840 2841 } 2842 2843 $.magnificPopup.instance.next = function() { 2844 var $that = this; 2845 2846 this.wrap.removeClass('mfp-image-loaded'); 2847 setTimeout(function() { 2848 $.magnificPopup.proto.next.call($that); 2849 2850 // Self hosted video. 2851 if ($($that.content).find('.mejs-video video').length > 0) { 2852 $($that.content).find('.mejs-video video')[0].play(); 2853 } 2854 2855 }, 100); 2856 }; 2857 2858 $.magnificPopup.instance.prev = function() { 2859 var $that = this; 2860 2861 this.wrap.removeClass('mfp-image-loaded'); 2862 setTimeout(function() { 2863 $.magnificPopup.proto.prev.call($that); 2864 2865 // Self hosted video. 2866 if ($($that.content).find('.mejs-video video').length > 0) { 2867 $($that.content).find('.mejs-video video')[0].play(); 2868 } 2869 }, 100); 2870 }; 2871 2872 }, 2873 2874 close: function() { 2875 // Self hosted video. 2876 if ($(this.content).find('.mejs-video video').length > 0) { 2877 $(this.content).find('.mejs-video video')[0].load(); 2878 } 2879 } 2880 }, 2881 removalDelay: 400, 2882 gallery: { 2883 enabled: true 2884 } 2885 }); 2886 2887 $parentRow.addClass('lightbox-col'); 2888 } 2889 2890 }); 2891 2892 } 2893 2894 2895 /** 2896 * Lightbox initialization. 2897 * 2898 * Determines which lightbox to use based on theme option. 2899 * 2900 * @since 8.0 2901 */ 2902 function lightBoxInit() { 2903 2904 setTimeout(function(){ 2905 if ($('body[data-ls="magnific"]').length > 0 || $('body[data-ls="pretty_photo"]').length > 0) { 2906 magnificInit(); 2907 } else if ($('body[data-ls="fancybox"]').length > 0) { 2908 fancyBoxInit(); 2909 } 2910 },100); 2911 2912 } 2913 2914 2915 /** 2916 * WPBakery page builder standard animations. 2917 * 2918 * @since 7.0 2919 * @see waypoints 2920 */ 2921 function vcWaypoints() { 2922 2923 $($fullscreenSelector + ' .wpb_animate_when_almost_visible').each(function () { 2924 2925 var $that = $(this), 2926 $vcOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '90%', 2927 waypoint = new Waypoint({ 2928 element: $that, 2929 handler: function () { 2930 2931 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated')) { 2932 waypoint.destroy(); 2933 return; 2934 } 2935 2936 $that.addClass("animated"); 2937 $that.addClass("wpb_start_animation"); 2938 waypoint.destroy(); 2939 2940 if ($that.is('.nectar-button') && $('body[data-button-style*="rounded_shadow"]').length > 0) { 2941 setTimeout(function () { 2942 $that.removeClass('wpb_start_animation'); 2943 }, 1100); 2944 } 2945 2946 }, 2947 offset: $vcOffsetPos 2948 2949 }); 2950 2951 }); 2952 } 2953 2954 2955 2956 /** 2957 * Milestone element initialization. 2958 * 2959 * @since 4.0 2960 * @see waypoints 2961 */ 2962 function milestoneInit() { 2963 2964 $('.nectar-milestone').each(function () { 2965 2966 // Symbol 2967 if ($(this).is('[data-symbol]')) { 2968 2969 if ($(this).find('.symbol-wrap').length == 0) { 2970 2971 if ($(this).attr('data-symbol-pos') == 'before') { 2972 $(this) 2973 .find('.number') 2974 .prepend('<div class="symbol-wrap"><span class="symbol">' + $(this).attr('data-symbol') + '</span></div>'); 2975 } else { 2976 $(this) 2977 .find('.number') 2978 .append('<div class="symbol-wrap"><span class="symbol">' + $(this).attr('data-symbol') + '</span></div>'); 2979 } 2980 } 2981 2982 var $symbol_size; 2983 2984 if ($(this).attr('data-symbol-size') == $(this).find('.number').attr('data-number-size') && $(this).attr('data-symbol-alignment') == 'superscript') { 2985 $symbol_size = 32; 2986 } else { 2987 $symbol_size = parseInt($(this).attr('data-symbol-size')); 2988 } 2989 2990 $(this).find('.symbol-wrap').css({ 2991 'font-size': $symbol_size + 'px', 2992 'line-height': $symbol_size + 'px' 2993 }); 2994 } 2995 2996 $(this).find('.number').css({ 2997 'font-size': $(this).find('.number').attr('data-number-size') + 'px', 2998 'line-height': $(this).find('.number').attr('data-number-size') + 'px' 2999 }); 3000 }); 3001 3002 if (!$body.hasClass('mobile') && $('.nectar-milestone').length > 0 || $body.hasClass('rtl') && $('.nectar-milestone').length > 0) { 3003 3004 // Blur effect
3005 var $blurCssString = ''; 3006 $($fullscreenSelector + '.nectar-milestone.motion_blur').each(function (i) { 3007 3008 $(this).removeClass(function (index, className) { 3009 return (className.match(/(^|\s)instance-\S+/g) || []).join(' '); 3010 }); 3011 3012 $(this).addClass('instance-' + i); 3013 3014 var $currentColor = $(this).find('.number').css('color'), 3015 colorInt = parseInt($currentColor.substring(1), 16); 3016 3017 var R = (colorInt & 0xFF0000) >> 16, 3018 G = (colorInt & 0x00FF00) >> 8, 3019 B = (colorInt & 0x0000FF) >> 0; 3020 3021 var $rgbaColorStart = 'rgba(' + R + ',' + G + ',' + B + ',0.2)', 3022 $rgbaColorEnd = 'rgba(' + R + ',' + G + ',' + B + ',1)', 3023 $numberSize = parseInt($(this).find('.number').attr('data-number-size')); 3024 3025 $blurCssString += '@keyframes motion-blur-number-' + i + ' { ' + 3026 ' 0% { ' + 3027 'opacity: 0;' + 3028 'color: ' + $rgbaColorStart + '; ' + 3029 '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 + '; ' + 3030 'transform: translateZ(0px) translateY(-100%); ' + 3031 '-webkit-transform: translateZ(0px) translateY(-100%); ' + 3032 '} ' + 3033 '33% { opacity: 1 }' + 3034 '100% { ' + 3035 'color: ' + $rgbaColorEnd + '; ' + 3036 'text-shadow: none; ' + 3037 'transform: translateZ(0px) translateY(0px); ' + 3038 '-webkit-transform: translateZ(0px) translateY(0px); ' + 3039 '} ' + 3040 '} ' + 3041 '@-webkit-keyframes motion-blur-number-' + i + ' { ' + 3042 ' 0% { ' + 3043 'opacity: 0;' + 3044 'color: ' + $rgbaColorStart + '; ' + 3045 '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 + '; ' + 3046 'transform: translateZ(0px) translateY(-100%); ' + 3047 '-webkit-transform: translateZ(0px) translateY(-100%); ' + 3048 '} ' + 3049 '33% { opacity: 1 }' + 3050 '100% { ' + 3051 'color: ' + $rgbaColorEnd + '; ' + 3052 'text-shadow: none; ' + 3053 'transform: translateZ(0px) translateY(0px); ' + 3054 '-webkit-transform: translateZ(0px) translateY(0px); ' + 3055 '} ' + 3056 '} ' + 3057 '.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 + '; } '; 3058 3059 // Separate each character into spans 3060 var $symbol = $(this).find('.symbol-wrap').clone(); 3061 $(this).find('.symbol-wrap').remove(); 3062 3063 var characters = $(this).find('.number').text().split(""); 3064 var $this = $(this).find('.number'); 3065 3066 $this.empty(); 3067 $.each(characters, function (i, el) { 3068 $this.append("<span>" + el + "</span"); 3069 }); 3070 3071 // Handle symbol 3072 if ($(this).has('[data-symbol]')) { 3073 if ($(this).attr('data-symbol-pos') == 'after') { 3074 $this.append($symbol); 3075 } else { 3076 $this.prepend($symbol); 3077 } 3078 } 3079 3080 }); 3081 3082 // Style 3083 nectarCreateStyle($blurCssString, 'milestone-blur'); 3084 3085 // Activate 3086 milestoneWaypoint(); 3087 3088 } 3089 3090 } 3091 3092 3093 /** 3094 * Milestone animation 3095 * 3096 * @since 4.0 3097 */ 3098 function milestoneWaypoint() { 3099 3100 $($fullscreenSelector + '.nectar-milestone').each(function () { 3101 3102 // Animation 3103 var $offset = ($('#nectar_fullscreen_rows').length > 0) ? '250%' : '98%', 3104 $that = $(this), 3105 waypoint = new Waypoint({ 3106 element: $that, 3107 handler: function () { 3108 3109 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 3110 waypoint.destroy(); 3111 return; 3112 } 3113 3114 var $endNum = parseInt($that.find('.number span:not(.symbol)').text().replace(/,/g, '')); 3115 3116 if (!$that.hasClass('motion_blur')) { 3117 3118 var countOptions = { 3119 easingFn: easeOutCubic 3120 }; 3121 var $countEle = $that.find('.number span:not(.symbol)')[0]; 3122 var numAnim = new CountUp($countEle, 0, $endNum, 0, 2.2, countOptions); 3123 numAnim.start(); 3124 3125 } else { 3126 $that.find('span').each(function (i) { 3127 var $that = $(this); 3128 setTimeout(function () { 3129 $that.addClass('in-sight'); 3130 }, 200 * i); 3131 }); 3132 } 3133 3134 3135 $that.addClass('animated-in'); 3136 waypoint.destroy(); 3137 }, 3138 offset: $offset 3139 3140 }); 3141 3142 }); 3143 } 3144 3145 3146 3147 /** 3148 * Tabbed element change section event. 3149 * 3150 * @since 10.5 3151 */ 3152 function tabbedChangeSection(clickedTab) { 3153 3154 var $id = clickedTab.parents('li').index() + 1; 3155 var $frontEndEditorTabDiv = ($('body.vc_editor').length > 0) ? '> .wpb_tab ' : ''; 3156 3157 if (!clickedTab.hasClass('active-tab') && !clickedTab.hasClass('loading')) { 3158 3159 clickedTab.parents('ul') 3160 .find('a') 3161 .removeClass('active-tab'); 3162 3163 clickedTab 3164 .addClass('active-tab'); 3165 3166 clickedTab.parents('.tabbed').find('>
3166 div:not(.clear)' + $frontEndEditorTabDiv).css({ 3167 'visibility': 'hidden', 3168 'position': 'absolute', 3169 'opacity': '0', 3170 'left': '-9999px', 3171 'display': 'none' 3172 }).removeClass('visible-tab'); 3173 3174 if ($('body.vc_editor').length > 0) { 3175 3176 var $data_m_id = (clickedTab.parent().is('[data-m-id]')) ? clickedTab.parent().attr('data-m-id') : ''; 3177 3178 clickedTab.parents('.tabbed').find('> div[data-model-id="' + $data_m_id + '"]' + $frontEndEditorTabDiv).css({ 3179 'visibility': 'visible', 3180 'position': 'relative', 3181 'left': '0', 3182 'display': 'block' 3183 }).stop().transition({ 3184 'opacity': 1 3185 }, 400).addClass('visible-tab'); 3186 3187 if( !$body.is('[data-flex-cols="true"]') ) { 3188 convertFrontEndPadding(); 3189 } 3190 3191 } else { 3192 clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ')' + $frontEndEditorTabDiv).css({ 3193 'visibility': 'visible', 3194 'position': 'relative', 3195 'left': '0', 3196 'display': 'block' 3197 }).stop().transition({ 3198 'opacity': 1 3199 }, 400).addClass('visible-tab'); 3200 } 3201 3202 if (clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ') .iframe-embed').length > 0 || 3203 clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ') .portfolio-items').length > 0) { 3204 setTimeout(function () { 3205 $window.trigger('resize'); 3206 }, 10); 3207 } 3208 } 3209 3210 // Waypoint checking 3211 if ($tabbedClickCount != 0) { 3212 3213 var $currentVisTab = clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ')' + $frontEndEditorTabDiv); 3214 3215 if ($currentVisTab.find('.nectar-progress-bar').length > 0) { 3216 progressBars(); 3217 } 3218 if ($currentVisTab.find('.divider-small-border [data-animate="yes"]').length > 0 || 3219 $currentVisTab.find('.divider-border [data-animate="yes"]').length > 0) { 3220 dividers(); 3221 } 3222 if ($currentVisTab.find('img.img-with-animation').length > 0 || 3223 $currentVisTab.find('.col.has-animation').length > 0 || 3224 $currentVisTab.find('.nectar_cascading_images').length > 0 || 3225 $currentVisTab.find('.wpb_column.has-animation').length > 0) { 3226 colAndImgAnimations(); 3227 cascadingImageBGSizing(); 3228 } 3229 if ($currentVisTab.find('.column-image-bg-wrap[data-bg-animation="displace-filter-fade"]').length > 0) { 3230 3231 for (var k = 0; k < $liquidBG_EL.length; k++) { 3232 3233 if ($($liquidBG_EL[k].canvasContainer).parents('.wpb_tab').length > 0 && 3234 $($liquidBG_EL[k].canvasContainer).parents('.wpb_tab').css('visibility') != 'hidden') { 3235 3236 // Add bg to container 3237 if ($($liquidBG_EL[k].canvasContainer).find('.image-added-to-stage').length == 0) { 3238 $liquidBG_EL[k].imgContainer.addChild($liquidBG_EL[k].bg); 3239 } 3240 $($liquidBG_EL[k].canvasContainer).find('.nectar-liquid-bg').addClass('image-added-to-stage'); 3241
3242 // Resize calcs 3243 $liquidBG_EL[k].resize(); 3244 3245 // Animate 3246 if ($($liquidBG_EL[k].canvasContainer).find('.nectar-liquid-bg.animated-in').length == 0) { 3247 $liquidBG_EL[k].animateProps($liquidBG_EL[k]); 3248 } 3249 3250 } 3251 } 3252 } 3253 if ($currentVisTab.find('.nectar-milestone').length > 0) { 3254 milestoneWaypoint(); 3255 } 3256 if ($currentVisTab.find('.nectar_image_with_hotspots[data-animation="true"]').length > 0) { 3257 imageWithHotspots(); 3258 setTimeout(function(){ 3259 $window.trigger('resize'); 3260 },100); 3261 } 3262 if ($currentVisTab.find('.nectar-fancy-ul').length > 0) { 3263 nectarFancyUlInit(); 3264 } 3265 if ($currentVisTab.find('.nectar-split-heading').length > 0) { 3266 splitLineHeadings(); 3267 } 3268 if ($currentVisTab.find('.wpb_column[data-border-animation="true"]').length > 0) { 3269 animatedColBorders(); 3270 } 3271 if ($currentVisTab.find('.wpb_animate_when_almost_visible').length > 0) { 3272 vcWaypoints(); 3273 } 3274 if ($currentVisTab.find('.nectar-animated-title').length > 0) { 3275 animatedTitles(); 3276 } 3277 if ($currentVisTab.find('.nectar-highlighted-text').length > 0) { 3278 highlightedText(); 3279 } 3280 if ($currentVisTab.find('.nectar_food_menu_item').length > 0) { 3281 foodMenuItems(); 3282 } 3283 if (clickedTab.parents('.wpb_row').length > 0) { 3284 3285 if ($currentVisTab.find('.vc_pie_chart').length > 0 || 3286 $currentVisTab.find('.wp-video-shortcode').length > 0 || 3287 $currentVisTab.find('.post-area.masonry .posts-container').length > 0 || 3288 $currentVisTab.find('.twentytwenty-container').length > 0 || 3289 clickedTab.parents('#nectar_fullscreen_rows[data-content-overflow="scrollbar"]').length > 0 || 3290 clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ')').find('.wpb_gallery').length > 0 || 3291 clickedTab.parents('.wpb_row').next().hasClass('parallax_section')) { 3292 $window.trigger('resize'); 3293 } 3294 3295 if ($currentVisTab.find('.nectar-flickity').length > 0 && typeof Flickity != 'undefined') { 3296 var tabbedFlkty = Flickity.data(clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ')').find('.nectar-flickity')[0]); 3297 tabbedFlkty.resize(); 3298 } 3299 3300 if ($currentVisTab.find('.nectar-woo-flickity').length > 0 && typeof Flickity != 'undefined') { 3301 var wootabbedFlkty = Flickity.data(clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ')').find('.nectar-woo-flickity > ul')[0]); 3302 wootabbedFlkty.resize(); 3303 } 3304 3305 } 3306 3307 //SVG icons 3308 $currentVisTab.find('.svg-icon-holder').each(function (i) { 3309 3310 var $that = $(this); 3311 3312 setTimeout(function () { 3313 3314 var $animationDelay = 0; 3315 3316 if($that.is('[data-animation-delay]') && 3317 $that.attr('data-animation-delay').length > 0 && 3318 $that.attr('data-animation') != 'false') { 3319 $animationDelay = $that.attr('data-animation-delay'); 3320 } 3321 3322 clearTimeout($animatedSVGIconTimeout[i]); 3323 3324 if ($that.attr('data-animation') == 'false') { 3325 $that.css('opacity', '1'); 3326 $svgIcons[$that.find('svg').attr('id').slice(-1)].finish(); 3327 } else { 3328 3329 $svgIcons[$that.find('svg').attr('id').slice(-1)].reset(); 3330 $animatedSVGIconTimeout[i] = setTimeout(function () { 3331 $svgIcons[$that.find('svg').attr('id').slice(-1)].play(); 3332 }, $animationDelay); 3333 3334 } 3335 }, 150); 3336 }); 3337 3338 } 3339 3340 // Fix columns inside tabs 3341 clickedTab.parents('.tabbed').find('.wpb_row').each(function () { 3342 if (typeof $(this).find('[class*="vc_col-"]').first().offset() != 'undefined') { 3343 3344 var $firstChildOffset = $(this).find('[class*="vc_col-"]').first().offset().left; 3345 3346 $(this).find('[class*="vc_col-"]').each(function () { 3347 $(this).removeClass('no-left-margin'); 3348 if ($(this).offset().left < $firstChildOffset + 15) { 3349 $(this).addClass('no-left-margin'); 3350 } else { 3351 $(this).removeClass('no-left-margin'); 3352 } 3353 }); 3354 } 3355 3356 }); 3357 3358 $tabbedClickCount++; 3359 3360 // Magic line 3361 if (clickedTab.parent().parent().find('.magic-line').length > 0) { 3362 magicLineCalc(clickedTab); 3363 } 3364 3365 } 3366 3367 3368 /** 3369 * Tabbed element magic line - used for style "Minimal alt" 3370 * 3371 * @since 7.0 3372 */ 3373 function magicLineCalc($ele) { 3374 3375 var el, leftPos, ratio; 3376 3377 el = $ele.parent(); 3378 if (el.length) { 3379 leftPos = el.position().left; 3380 ratio = el.width(); 3381 } else { 3382 leftPos = ratio = 0; 3383 } 3384 3385 $ele.parent().parent() 3386 .find('.magic-line') 3387 .css('transform', 'translateX(' + leftPos + 'px) scaleX(' + ratio + ')'); 3388 } 3389 3390 3391 /** 3392 * Tabbed element deep linking. 3393 * 3394 * @since 3.0 3395 */ 3396 function tabbbedDeepLinking() { 3397 3398 if (typeof nectarGetQueryParam['tab'] != 'undefined') { 3399 $('.wpb_tabs_nav').each(function () { 3400 3401 $(this).find('li').each(function () { 3402 3403 var $currentText = $(this).find('a').clone(), 3404 $getText = nectarGetQueryParam['tab'], 3405 $that = $(this); 3406 3407 $currentText.find('svg').remove(); 3408 $currentText = $currentText.text(); 3409 $currentText = $currentText.replace(/\s+/g, '-').toLowerCase(); 3410 3411 // SVG icons. 3412 if( $currentText.length > 0 && $currentText.substring(0,1) === '-' ) { 3413 $currentText = $currentText.substring(1); 3414 } 3415 3416 $getText = $getText.replace(/\s+/g, '-').replace(/</g, '<').replace(/"/g, '"').toLowerCase(); 3417 3418 if ($currentText == $getText) { 3419 3420 $(this).find('a').trigger('click'); 3421 3422 setTimeout(function () { 3423 $that.find('a').trigger('click'); 3424 }, 501); 3425 } 3426 3427 }); 3428 3429 }); 3430 3431 } 3432 3433 } 3434 3435 3436 3437 /** 3438 * Tabbed element initialization. 3439 * 3440 * @since 3.0 3441 */ 3442 function tabbedInit() { 3443 3444 // Click event 3445 $body.on('click', '.tabbed > ul li:not(.cta-button) a', function(){ 3446 tabbedChangeSection($(this)); 3447 return false;
3448 }); 3449 3450 $('.tabbed').each(function () { 3451 3452 var $that; 3453 3454 // Handle icons 3455 $(this).find('.wpb_tab').each(function (i) { 3456 3457 if ($(this).is('[data-tab-icon]') && $(this).attr('data-tab-icon').length > 0) { 3458 3459 $(this) 3460 .parents('.tabbed') 3461 .addClass('using-icons'); 3462 3463 $(this) 3464 .parents('.tabbed') 3465 .find('.wpb_tabs_nav li:nth-child(' + (i + 1) + ') > a') 3466 .prepend('<i class="' + $(this).attr("data-tab-icon") + '"></i>'); 3467 3468 } 3469 3470 // SVG icons 3471 if ($(this).find('.im-icon-wrap.tab-icon').length > 0) { 3472 3473 var $svg_icon_markup = $(this).find('.im-icon-wrap.tab-icon').detach(); 3474 $(this).parents('.tabbed') 3475 .find('.wpb_tabs_nav li:nth-child(' + (i + 1) + ') > a') 3476 .prepend($svg_icon_markup); 3477 } 3478 3479 }); 3480 3481 3482 if ($(this).find('.swiper-container').length == 0 && 3483 $(this).find('.testimonial_slider').length == 0 && 3484 $(this).find('.portfolio-items:not(".carousel")').length == 0 && 3485 $(this).find('.wpb_gallery .portfolio-items').length == 0 && 3486 $(this).find('iframe').length == 0) { 3487 $(this).find('> ul li:first-child a').trigger('click'); 3488 } 3489 3490 if ($(this).find('.testimonial_slider').length > 0 || 3491 $(this).find('.portfolio-items:not(".carousel")').length > 0 || 3492 $(this).find('.wpb_gallery .portfolio-items').length > 0 || 3493 $(this).find('iframe').length > 0) { 3494 3495 $that = $(this); 3496 $(this).find('.wpb_tab').show().css({ 3497 'opacity': 0, 3498 'height': '1px' 3499 }); 3500 3501 $(this).find('> ul li a').addClass('loading'); 3502 3503 setTimeout(function () { 3504 $that.find('.wpb_tab').hide().css({ 3505 'opacity': 1, 3506 'height': 'auto' 3507 }); 3508 3509 $that.find('> ul li a').removeClass('loading'); 3510 $that.find('> ul li:first-child a').trigger('click'); 3511 tabbbedDeepLinking(); 3512 3513 }, 900); 3514 } 3515 3516 $that = $(this); 3517 3518 // Minimal alt effect 3519 setTimeout(function () { 3520 if ($that.is('[data-style="minimal_alt"]')) { 3521 $that.find('> ul').append('<li class="magic-line" />'); 3522 magicLineCalc($that.find('> ul > li:first-child > a')); 3523 } 3524 }, 100); 3525 3526 3527 }); 3528 3529 // Minimal alt resize event. 3530 if ( $('.tabbed[data-style="minimal_alt"]').length > 0 ) { 3531 $window.on('smartresize',function(){ 3532 magicLineCalc($('.tabbed[data-style="minimal_alt"] > ul > li > a.active-tab')); 3533 }); 3534 3535 } 3536 3537 3538 tabbbedDeepLinking(); 3539 3540 } 3541 3542 3543 3544 3545 3546 3547 3548 /** 3549 * Toggle Panels element deep linking. 3550 * 3551 * @since 3.0 3552 */ 3553 function accordionDeepLinking() { 3554 3555 if (typeof nectarGetQueryParam['toggle'] != 'undefined') { 3556 $('.toggles').each(function () { 3557 3558 $(this).find('.toggle').each(function () { 3559 var $currentText = $(this).find('h3 a').clone(); 3560 var $getText = nectarGetQueryParam['toggle']; 3561 3562 $($currentText).find('i').remove(); 3563 $currentText = $currentText.text(); 3564 $currentText = $currentText.replace(/\s+/g, '-').toLowerCase(); 3565 $getText = $getText.replace(/\s+/g, '-').replace(/</g, '<').replace(/"/g, '"').toLowerCase(); 3566 3567 if ($currentText == $getText) { 3568 $(this).find('h3 a').trigger('click'); 3569 } 3570 }); 3571 }); 3572 } 3573 3574 } 3575 3576 3577 3578 /** 3579 * Toggle Panels element initialization. 3580 * 3581 * @since 3.0 3582 */ 3583 function accordionInit() { 3584 3585 // Regular toggle click event 3586 $body.on('click', '.toggle h3 a', function () { 3587 3588 if (!$(this).parents('.toggles').hasClass('accordion')) { 3589 3590 $(this).parents('.toggle') 3591 .find('> div') 3592 .slideToggle(300); 3593 3594 $(this).parents('.toggle') 3595 .toggleClass('open'); 3596 3597 // Switch icon 3598 if ($(this).parents('.toggle').hasClass('open')) { 3599 $(this) 3600 .find('i') 3601 .attr('class', 'icon-minus-sign'); 3602 } else { 3603 $(this) 3604 .find('i') 3605 .attr('class', 'icon-plus-sign'); 3606 } 3607 3608 if ($(this).parents('.toggle').find('> div .iframe-embed').length > 0 && 3609 $(this).parents('.toggle').find('> div iframe.iframe-embed').height() == '0') { 3610 responsiveVideoIframes(); 3611 } 3612 3613 if ($(this).parents('.full-width-content').length > 0) { 3614 setTimeout(function () { 3615 fullWidthContentColumns(); 3616 }, 300); 3617 } 3618 3619 if ($('#nectar_fullscreen_rows').length > 0) { 3620 setTimeout(function () { 3621 $window.trigger('smartresize'); 3622 }, 300); 3623 } 3624 return false;
3625 } 3626 }); 3627 3628 // Accordion click event 3629 $body.on('click', '.accordion .toggle h3 a', function () { 3630 3631 if ($(this).parents('.toggle').hasClass('open')) { 3632 return false; 3633 } 3634 3635 var $t; 3636 var $parentToggles = $(this).parents('.toggles'); 3637 var $parentToggle = $(this).parents('.toggle'); 3638 3639 $parentToggles.find('.toggle > div').slideUp(300); 3640 $parentToggles.find('.toggle h3 a i').attr('class', 'icon-plus-sign'); 3641 $parentToggles.find('.toggle').removeClass('open'); 3642 $parentToggle.find('> div').slideDown(300); 3643 $parentToggle.addClass('open'); 3644 3645 // Switch icon 3646 if ($parentToggle.hasClass('open')) { 3647 $(this).find('i').attr('class', 'icon-minus-sign'); 3648 } else { 3649 $(this).find('i').attr('class', 'icon-plus-sign'); 3650 } 3651 3652 if ($(this).parents('.full-width-content').length > 0) { 3653 clearTimeout($t); 3654 $t = setTimeout(function () { 3655 fullWidthContentColumns(); 3656 }, 400); 3657 } 3658 if ($('#nectar_fullscreen_rows').length > 0) { 3659 clearTimeout($t); 3660 $t = setTimeout(function () { 3661 $window.trigger('smartresize'); 3662 }, 400); 3663 } 3664 3665 return false; 3666 3667 }); 3668 3669 3670 $('.accordion').each(function () { 3671 $(this).find('> .toggle').first().addClass('open').find('> div').show(); 3672 $(this).find('> .toggle').first().find('a i').attr('class', 'icon-minus-sign'); 3673 }); 3674 3675 3676 $('.toggles').each(function () { 3677 3678 var $isAccordion = ($(this).hasClass('accordion')) ? true : false; 3679 3680 $(this).find('.toggle').each(function () { 3681 if ($(this).find('> div .testimonial_slider').length > 0 || $(this).find('> div iframe').length > 0) { 3682 var $that = $(this); 3683 $(this).find('> div').show().css({ 3684 'opacity': 0, 3685 'height': '1px', 3686 'padding': '0' 3687 }); 3688 3689 for (var i = 0; i < $testimonialSliders.length; i++) { 3690 $testimonialSliders[i].testimonialHeightResize(); 3691 } 3692 3693 setTimeout(function () { 3694 $that.find('> div').hide().css({ 3695 'opacity': 1, 3696 'height': 'auto', 3697 'padding': '10px 14px' 3698 }); 3699 if ($isAccordion == true && $that.index() == 0) { 3700 $that.find('> div').slideDown(300); 3701 } 3702 }, 900); 3703 } 3704 }); 3705 3706 }); 3707 3708 accordionDeepLinking(); 3709 3710 } 3711 3712 3713 3714 3715 3716 /** 3717 * Color hex to rgb 3718 * 3719 * @since 3.0 3720 */ 3721 function shadeColor(hex, lum) { 3722 3723 // Validate hex string 3724 hex = String(hex).replace(/[^0-9a-f]/gi, ''); 3725 if (hex.length < 6) { 3726 hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2]; 3727 } 3728 lum = lum || 0; 3729 3730 // Convert to decimal and change luminosity 3731 var rgb = "#", 3732 c, i; 3733 for (i = 0; i < 3; i++) { 3734 c = parseInt(hex.substr(i * 2, 2), 16); 3735 c = Math.round(Math.min(Math.max(0, c + (c * lum)), 255)).toString(16); 3736 rgb += ("00" + c).substr(c.length); 3737 } 3738 3739 return rgb; 3740 } 3741 3742 /** 3743 * Jumbo size 3D nectar button. 3744 * 3745 * @since 3.0 3746 */ 3747 function createExtraJumboSize() { 3748 3749 $('.nectar-3d-transparent-button').each(function () { 3750 3751 if ($(this).css('visibility') != 'visible') { 3752 return; 3753 } 3754 3755 var $that = $(this), 3756 $size = $that.attr('data-size'), 3757 $padding = 0; 3758 3759 var $vert_height_divider = 1.7; 3760 3761 if ($size == 'extra_jumbo') { 3762 3763 var $font_size; 3764 3765 if (nectarDOMInfo.winW < 1000 && nectarDOMInfo.winW > 690) { 3766 $padding = 64; 3767 $font_size = 34; 3768 $that.find('.back-3d rect').attr('stroke-width', '12'); 3769 $vert_height_divider = 1.7; 3770 } else if (nectarDOMInfo.winW <= 690) { 3771 $padding = 46; 3772 $font_size = 16; 3773 $that.find('.back-3d rect').attr('stroke-width', '10'); 3774 $vert_height_divider = 1.7; 3775 } else { 3776 $padding = 100; 3777 $font_size = 64; 3778 $that.find('.back-3d rect').attr('stroke-width', '20'); 3779 $vert_height_divider = 1.6; 3780 } 3781 3782 3783 $that.find('svg text').attr('font-size', $font_size); 3784 3785 var $boundingRect = $(this).find('.back-3d .button-text')[0].getBoundingClientRect(), 3786 $text_width = $boundingRect.width, 3787 $text_height = $font_size * 1.5; 3788 3789 $that.css({ 3790 'width': ($text_width + $padding * 1.5) + 'px', 3791 'height': ($text_height + $padding) + 'px' 3792 }); 3793 3794 $that.find('> a').css({ 3795 'height': ($text_height + $padding) + 'px' 3796 }); 3797 3798 $that.find('.back-3d svg, .front-3d svg').css({ 3799 'width': ($text_width + $padding * 1.5) + 'px', 3800 'height': ($text_height + $padding) + 'px' 3801 }).attr('viewBox', '0 0 ' + ($text_width + $padding) + ' ' + ($text_height + $padding)); 3802 3803 $that.find('svg text').attr('transform', 'matrix(1 0 0 1 ' + ($text_width + $padding * 1.6) / 2 + ' ' + (($text_height + $padding) / $vert_height_divider) + ')'); 3804 $that.find('.front-3d ').css('transform-origin', '50% 50% -' + ($text_height + $padding) / 2 + 'px'); 3805 $that.find('.back-3d').css('transform-origin', '50% 50% -' + ($text_height + $padding) / 2 + 'px'); 3806 3807 } 3808 3809 }); 3810 3811 } 3812 3813 3814 /** 3815 * Nectar Button custom coloring 3816 * 3817 * @since 3.0 3818 */ 3819 function coloredButtons() { 3820 3821 $('.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 () { 3822 3823 var $usingMaterialSkin = ($('body.material[data-button-style^="rounded"]').length > 0) ? true : false;
3824 $(this).css('visibility', 'visible'); 3825 3826 if ($(this).hasClass('see-through-3') && $(this).attr('data-color-override') == 'false') { 3827 return true; 3828 } 3829 3830 var $color; 3831 var $that; 3832 3833 if ($(this).attr('data-color-override') != 'false') { 3834 $color = $(this).attr('data-color-override'); 3835 } else { 3836 3837 if ($(this).parents('.dark').length > 0) { 3838 $color = '#000000'; 3839 } else { 3840 $color = '#ffffff'; 3841 } 3842 3843 } 3844 3845 if (!$(this).hasClass('see-through-3')) { 3846 $(this).css('color', $color); 3847 } 3848 3849 $(this).find('i').css('color', $color); 3850 3851 var colorInt = parseInt($color.substring(1), 16); 3852 var $hoverColor = ($(this).has('[data-hover-color-override]')) ? $(this).attr('data-hover-color-override') : 'no-override'; 3853 var $hoverTextColor = ($(this).has('[data-hover-text-color-override]')) ? $(this).attr('data-hover-text-color-override') : '#fff'; 3854 3855 var R = (colorInt & 0xFF0000) >> 16; 3856 var G = (colorInt & 0x00FF00) >> 8; 3857 var B = (colorInt & 0x0000FF) >> 0; 3858 3859 var $opacityStr = ($(this).hasClass('see-through-3')) ? '1' : '0.75'; 3860 3861 $(this).css('border-color', 'rgba(' + R + ',' + G + ',' + B + ',' + $opacityStr + ')'); 3862 3863 // Material theme skin buttons w/ icons starting 3864 if ($usingMaterialSkin) { 3865 $(this).find('i').css({ 3866 'background-color': 'rgba(' + R + ',' + G + ',' + B + ',1)', 3867 'box-shadow': '0px 8px 15px rgba(' + R + ',' + G + ',' + B + ',0.24)' 3868 }); 3869 } 3870 3871 if ($(this).hasClass('see-through')) { 3872 3873 $that = $(this); 3874 3875 $(this).on('mouseenter touchstart', function () { 3876 $that.css('border-color', 'rgba(' + R + ',' + G + ',' + B + ',1)'); 3877 }); 3878 3879 $(this).on('mouseleave touchtouchend', function () { 3880 $that.css('border-color', 'rgba(' + R + ',' + G + ',' + B + ',1)'); 3881 $opacityStr = ($(this).hasClass('see-through-3')) ? '1' : '0.75'; 3882 $that.css('border-color', 'rgba(' + R + ',' + G + ',' + B + ',' + $opacityStr + ')'); 3883 }); 3884 3885 } else { 3886 3887 $(this).find('i').css('color', $hoverTextColor); 3888 3889 if ($hoverColor != 'no-override') { 3890 3891 $that = $(this); 3892 3893 $(this).on('mouseenter touchstart', function () { 3894 3895 $that.css({ 3896 'border-color': $hoverColor, 3897 'background-color': $hoverColor, 3898 'color': $hoverTextColor 3899 }); 3900 3901 // Material buttons w/ icons over 3902 if ($usingMaterialSkin) { 3903 $that.find('i').css({ 3904 'background-color': '', 3905 'box-shadow': '' 3906 }); 3907 } 3908 }); 3909 3910 $(this).on('mouseleave touchtouchend', function () { 3911 3912 $opacityStr = ($(this).hasClass('see-through-3')) ? '1' : '0.75'; 3913 3914 if ($usingMaterialSkin) { 3915 $that.find('i').css({ 3916 'background-color': 'rgba(' + R + ',' + G + ',' + B + ',1)', 3917 'box-shadow': '0px 8px 15px rgba(' + R + ',' + G + ',' + B + ',0.24)' 3918 }); 3919 } 3920 3921 if (!$that.hasClass('see-through-3')) { 3922 $that.css({ 3923 'border-color': 'rgba(' + R + ',' + G + ',' + B + ',' + $opacityStr + ')', 3924 'background-color': 'transparent', 3925 'color': $color 3926 }); 3927 } else { 3928 $that.css({ 3929 'border-color': 'rgba(' + R + ',' + G + ',' + B + ',' + $opacityStr + ')', 3930 'background-color': 'transparent' 3931 }); 3932 } 3933 3934 }); 3935 3936 } else { 3937 3938 $that = $(this); 3939 3940 $(this).on('mouseenter touchstart', function () { 3941 3942 $that.css({ 3943 'border-color': $hoverColor, 3944 'color': $hoverTextColor 3945 }); 3946 3947 }); 3948 3949 $(this).on('mouseleave touchtouchend', function () { 3950 3951 $opacityStr = ($that.hasClass('see-through-3')) ? '1' : '0.75'; 3952 $that.css({ 3953 'border-color': 'rgba(' + R + ',' + G + ',' + B + ',' + $opacityStr + ')', 3954 'color': $hoverTextColor 3955 }); 3956 3957 }); 3958 3959 } 3960 } 3961 }); 3962 3963 $('.nectar-button:not(.see-through):not(.see-through-2):not(.see-through-3)[data-color-override]').each(function () { 3964 3965 $(this).css('visibility', 'visible'); 3966 3967 if ($(this).attr('data-color-override') != 'false') { 3968 3969 var $color = $(this).attr('data-color-override'); 3970 3971 $(this) 3972 .removeClass('accent-color') 3973 .removeClass('extra-color-1') 3974 .removeClass('extra-color-2') 3975 .removeClass('extra-color-3') 3976 .css('background-color', $color); 3977 } 3978 3979 }); 3980 3981 3982 // Solid color tilt 3983 if ($('.swiper-slide .solid_color_2').length > 0 || $('.tilt-button-inner').length > 0) { 3984 3985 var $tiltButtonCssString = ''; 3986 var $color; 3987 3988 $('.swiper-slide .solid_color_2 a').each(function (i) { 3989 3990 $(this).addClass('instance-' + i); 3991 3992 if ($(this).attr('data-color-override') != 'false') { 3993 $color = $(this).attr('data-color-override'); 3994 } else {
3995 if ($(this).parents('.dark').length > 0) { 3996 $color = '#000000'; 3997 } 3998 else { 3999 $color = '#ffffff'; 4000 } 4001 } 4002 4003 $(this).css('color', $color); 4004 $(this).find('i').css('color', $color); 4005 4006 var $currentColor = $(this).css('background-color'), 4007 $topColor = shadeColor($currentColor, 0.13), 4008 $bottomColor = shadeColor($currentColor, -0.15); 4009 4010 $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 + '; } '; 4011 4012 }); 4013 4014 4015 $('.tilt-button-wrap a').each(function (i) { 4016 4017 $(this).addClass('instance-' + i); 4018 4019 var $currentColor = $(this).css('background-color'); 4020 var $color; 4021 4022 if ($(this).attr('data-color-override') != 'false') { 4023 $color = $(this).attr('data-color-override'); 4024 $(this).css('background-color', $color); 4025 $currentColor = $color; 4026 } 4027 4028 var $topColor = shadeColor($currentColor, 0.13), 4029 $bottomColor = shadeColor($currentColor, -0.15); 4030 4031 $tiltButtonCssString += '.tilt-button-wrap a.instance-' + i + ':after { background-color: ' + $topColor + '; }' + ' .tilt-button-wrap a.instance-' + i + ':before { background-color: ' + $bottomColor + '; } '; 4032 4033 }); 4034 4035 // Style 4036 nectarCreateStyle($tiltButtonCssString, 'tilt-button'); 4037 4038 } 4039 4040 4041 // Transparent 3D 4042 if ($('.nectar-3d-transparent-button').length > 0) { 4043 4044 var $3dTransButtonCssString = ''; 4045 $('.nectar-3d-transparent-button').each(function (i) { 4046 4047 var $that = $(this), 4048 $size = $that.attr('data-size'), 4049 $padding = 0, 4050 v1 = 1.5, 4051 v2 = 1.65, 4052 $font_size; 4053 4054 // Size 4055 if ($size == 'large') { 4056 $padding = 46; 4057 $font_size = 16; 4058 v1 = 1.5; 4059 v2 = 1.7; 4060 } else if ($size == 'medium') { 4061 $padding = 30; 4062 $font_size = 16; 4063 } else if ($size == 'small') { 4064 $padding = 20; 4065 $font_size = 12; 4066 } else if ($size == 'jumbo') { 4067 $padding = 54; 4068 $font_size = 24; 4069 v1 = 1.5; 4070 v2 = 1.68; 4071 } else if ($size == 'extra_jumbo') { 4072 $padding = 100; 4073 $font_size = 64; 4074 v1 = 1.6; 4075 v2 = 1.6; 4076 } 4077 4078 $that.find('svg text').attr('font-size', $font_size); 4079 4080 var $boundingRect = $(this).find('.back-3d .button-text')[0].getBoundingClientRect(), 4081 $text_width = $boundingRect.width, 4082 $text_height = $font_size * 1.5; 4083 4084 $that.css({ 4085 'width': ($text_width + $padding * 1.5) + 'px', 4086 'height': ($text_height + $padding) + 'px' 4087 }); 4088 4089 $that.find('> a').css({ 4090 'height': ($text_height + $padding) + 'px' 4091 }); 4092 4093 $that.find('.back-3d svg, .front-3d svg').css({ 4094 'width': ($text_width + $padding * 1.5) + 'px', 4095 'height': ($text_height + $padding) + 'px' 4096 }).attr('viewBox', '0 0 ' + ($text_width + $padding) + ' ' + ($text_height + $padding)); 4097 4098 $that.find('svg text').attr('transform', 'matrix(1 0 0 1 ' + ($text_width + $padding * v1) / 2 + ' ' + (($text_height + $padding) / v2) + ')'); 4099 $that.find('.front-3d, .back-3d').css('transform-origin', '50% 50% -' + ($text_height + $padding) / 2 + 'px'); 4100 4101 // Mask 4102 $(this).find('.front-3d svg > rect').attr('id', 'masked-rect-id-' + i); 4103 $(this).find('.front-3d defs mask').attr('id', 'button-text-mask-' + i); 4104 4105 $that.css('visibility', 'visible'); 4106 $3dTransButtonCssString += '#masked-rect-id-' + i + ' { mask: url(#button-text-mask-' + i + '); -webkit-mask: url(#button-text-mask-' + i + ')} '; 4107 4108 }); 4109 4110 // Extra jumbo resize 4111 createExtraJumboSize(); 4112 $window.on('smartresize', createExtraJumboSize); 4113 4114 // Style 4115 nectarCreateStyle($3dTransButtonCssString, 'nectar-td-button'); 4116 4117 } 4118 4119 // Gradient btn init 4120 setTimeout(function () { 4121 $('.nectar-button[class*="color-gradient"] .start').removeClass('loading'); 4122 }, 150); 4123 // No grad for ff 4124 if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1 || 4125 navigator.userAgent.indexOf("MSIE ") > -1 || 4126 navigator.userAgent.match(/Trident\/7\./)) { 4127 $('.nectar-button[class*="color-gradient"] .start').addClass('no-text-grad'); 4128 } 4129 } 4130 4131 4132 4133 4134 /** 4135 * Shortcode icon large style 4136 * 4137 * @since 1.0 4138 */ 4139 function largeIconHover() { 4140 $('.icon-3x').each(function () { 4141 $(this).closest('.col').on('mouseenter', function () { 4142 $(this).find('.icon-3x').addClass('hovered'); 4143 }); 4144 4145 $(this).closest('.col').on('mouseleave', function () { 4146 $(this).find('.icon-3x').removeClass('hovered'); 4147 }); 4148 }); 4149 4150 if (navigator.userAgent.indexOf("MSIE ") > -1 || navigator.userAgent.match(/Trident\/7\./)) { 4151 $('[class^="icon-"][class*="color-gradient"], .nectar_icon_wrap[data-color*="extra-color-gradient"] .nectar_icon, .nectar-gradient-text').addClass('no-grad'); 4152 } 4153 } 4154 4155 4156 4157 /** 4158 * Team member element - fullscreen style. 4159 * 4160 * @since 7.0 4161 */ 4162 function teamMemberFullscreen() { 4163 4164 if ( $('.team-member').length === 0 ) { 4165 return; 4166 } 4167 4168 // Open click event 4169 $body.on('click', '.team-member[data-style="bio_fullscreen"], .team-member[data-style="bio_fullscreen_alt"]', function () { 4170 4171 if ($('.nectar_team_member_overlay').length > 0) { 4172 return; 4173 } 4174 4175 var $usingBoxedClass = ($('body > #boxed').length > 0) ? 'in-boxed' : '', 4176 $teamMemberMeta = $(this).find('.nectar_team_bio').html(), 4177 $teamMemberTitle = ($(this).is('[data-style="bio_fullscreen_alt"]')) ? $(this).find('.team-meta h5').html() : $(this).find('.team-meta p').html(), 4178 $teamMemberImg = ($(this).find('.nectar_team_bio_img[data-img-src]').length > 0) ? $(this).find('.nectar_team_bio_img').attr('data-img-src') : '', 4179 $teamMemberStyle = ($(this).is('[data-style="bio_fullscreen_alt"]')) ? 'bio-fullscreen-alt' : 'bio-fullscreen', 4180 $teamName = ''; 4181 4182 if($(this).is('[data-style="bio_fullscreen_alt"]')) { 4183 $teamName = '<div class="title">' + $teamMemberTitle + '</div><h2>' + $(this).find('.team-meta h3').html() + '</h2>'; 4184 } else { 4185 $teamName = '<h2>' + $(this).find('.team-meta h3').html() + '</h2><div class="title">' + $teamMemberTitle + '</div>'; 4186 } 4187 4188 $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">' + $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>'); 4189 4190 if ($teamMemberImg.length > 0) { 4191
4192 // Fade in img on load 4193 var teamTmpImg = new Image(); 4194 teamTmpImg.src = $teamMemberImg; 4195 teamTmpImg.onload = function () { 4196 $('.nectar_team_member_overlay .team_member_image').css('opacity', '1'); 4197 }; 4198 $('.nectar_team_member_overlay .team_member_image').css({ 4199 'background-image': 'url("' + $teamMemberImg + '")' 4200 }); 4201 } 4202 4203 var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $window.width() > 1000) ? 0 : $headerOuterEl.height(); 4204 $('.nectar_team_member_overlay .inner-wrap').css({ 4205 'padding-top': $headerNavSpace 4206 }); 4207 4208 // No-scroll class - ios ready 4209 if ($('.using-mobile-browser').length > 0) { 4210 $('body,html').addClass('nectar-no-scrolling'); 4211 } 4212 4213 teamFullscreenResize(); 4214 4215 // Transition in 4216 $('.nectar_team_member_overlay') 4217 .addClass('open') 4218 .addClass('animating'); 4219 4220 setTimeout(function () { 4221 $('.nectar_team_member_close').addClass('visible'); 4222 $('.nectar_team_member_overlay').removeClass('animating'); 4223 }, 500); 4224 4225 // Bind overflow 4226 if ($('.using-mobile-browser').length == 0) { 4227 fullscreenBioScrolling(); 4228 } 4229 4230 if ($('.team-member[data-style="bio_fullscreen"]').length > 0 && nectarDOMInfo.usingMobileBrowser) { 4231 $('.nectar_team_member_overlay').addClass('on-mobile'); 4232 } 4233 4234 }); 4235 4236 // Close click event 4237 $body.on('click', '.nectar_team_member_overlay', function () { 4238 4239 if (!$(this).hasClass('animating')) { 4240 4241 $('.nectar_team_member_overlay').removeClass('open'); 4242 $('.nectar_team_member_close').removeClass('visible'); 4243 4244 if ($('.using-mobile-browser').length > 0) { 4245 $('body,html').removeClass('nectar-no-scrolling'); 4246 } 4247 4248 setTimeout(function () { 4249 4250 $('.nectar_team_member_overlay, .nectar_team_member_close').remove(); 4251 4252 }, 820); 4253 } 4254 }); 4255 4256 if ($('.team-member[data-style="bio_fullscreen"]').length > 0 || $('.team-member[data-style="bio_fullscreen_alt"]').length > 0) { 4257 $window.on('resize', teamFullscreenResize); 4258 if( !nectarDOMInfo.usingMobileBrowser ) { 4259 var closeIndicator = new NectarIconMouseFollow('','close-indicator'); 4260 } 4261 4262 } 4263 4264 } 4265 4266 4267 /** 4268 * Team member element fullscreen resize event. 4269 * 4270 * @since 7.0 4271 */ 4272 function teamFullscreenResize() { 4273 var $leftHeaderSize = ($('body[data-header-format="left-header"]').length > 0 && $window.width() > 1000) ? 275 : 0; 4274 $('.nectar_team_member_overlay').css({ 4275 'width': $window.width() - $leftHeaderSize, 4276 'left': $leftHeaderSize 4277 }); 4278 } 4279 4280 /** 4281 * Team member element fullscreen overflow scrolling event. 4282 * 4283 * @since 7.0 4284 */ 4285 function fullscreenBioScrolling() { 4286 $('.nectar_team_member_overlay .inner-wrap').mousewheel(function (event, delta) { 4287 this.scrollTop -= (delta * 30); 4288 event.preventDefault(); 4289 }); 4290 4291 } 4292 4293 4294 4295 /** 4296 * WPBakery column element BG hover 4297 * 4298 * @since 5.0 4299 */ 4300 function columnBGColors() { 4301 4302 var $columnColorCSS = ''; 4303 4304 $('.wpb_column').each(function (i) { 4305 4306 $(this).removeClass(function (index, className) { 4307 return (className.match(/(^|\s)instance-\S+/g) || []).join(' '); 4308 }); 4309 4310 $(this).addClass('instance-' + i); 4311 4312 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 ' : ''; 4313 var $innerWrapSelector = ( $(this).find($innerSelector + ' > .column-bg-overlay-wrap').length > 0 ) ? '> .column-bg-overlay-wrap ' : ''; 4314 4315 // BG color 4316 if ($(this).attr('data-has-bg-color') == 'true') { 4317 $columnColorCSS += '.wpb_column.instance-' + i + $innerSelector + $innerWrapSelector + ' > .column-bg-overlay { background-color:' + $(this).attr('data-bg-color') + '; opacity: ' + $(this).attr('data-bg-opacity') + '; }'; 4318 } 4319 4320 // Hover bg color 4321 if ($(this).is('[data-hover-bg^="#"]')) { 4322 $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; }'; 4323 } 4324 }); 4325 4326 // Style 4327 nectarCreateStyle($columnColorCSS, 'column-bg-colors'); 4328 4329 } 4330 4331 4332 4333 /**
4334 * Displace filter column/row BG effect 4335 * 4336 * @since 10.5 4337 */ 4338 function nectarLiquidBGs() { 4339 $liquidBG_EL = []; 4340 4341 if (typeof NectarLiquid == 'undefined' || nectarDOMInfo.usingFrontEndEditor) { 4342 return; 4343 } 4344 4345 $('.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) { 4346 4347 var $that_el = $(this); 4348 var $type; 4349 var $el_type; 4350 4351 if ($(this).is('.row-bg')) { 4352 $type = $(this).parents('.row-bg-wrap').attr('data-bg-animation'); 4353 $el_type = 'row'; 4354 } 4355 else if ($(this).is('.column-image-bg')) { 4356 $type = $(this).parents('.column-image-bg-wrap').attr('data-bg-animation'); 4357 $el_type = 'col'; 4358 } 4359 4360 $liquidBG_EL[i] = new NectarLiquid($that_el, $type, $el_type); 4361 4362 }); 4363 } 4364 4365 4366 4367 /** 4368 * Morphing outline element creation. 4369 * 4370 * @since 5.0 4371 */ 4372 function morphingOutlines() { 4373 4374 if ($('.morphing-outline').length > 0) { 4375 4376 var $morphingOutlineCSS = '', 4377 $frontEndEditorMOSelector = ($('body.vc_editor').length > 0) ? '' : '>'; 4378 4379 $('.morphing-outline').each(function (i) { 4380 4381 $(this).removeClass(function (index, className) { 4382 return (className.match(/(^|\s)instance-\S+/g) || []).join(' '); 4383 }); 4384 4385 $(this).addClass('instance-' + i).css({ 4386 'visibility': 'visible' 4387 }); 4388 4389 var $width = $(this).find('.inner').width(), 4390 $height = $(this).find('.inner').height(), 4391 $border = parseInt($(this).attr("data-border-thickness")), 4392 $hover = ($('body[data-button-style*="rounded"]').length > 0) ? ':hover' : '', 4393 $hover2 = ($('body[data-button-style*="rounded"]').length > 0) ? '' : ':hover'; 4394 4395 $morphingOutlineCSS += 'body .morphing-outline.instance-' + i + ' .inner > * { color: ' + $(this).attr("data-starting-color") + '; } '; 4396 $morphingOutlineCSS += 'body .morphing-outline.instance-' + i + ' .inner:after { border-width:' + $(this).attr("data-border-thickness") + 'px ; border-color: ' + $(this).attr("data-starting-color") + '; } '; 4397 4398 $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") + '; } '; 4399 $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") + '; } '; 4400 4401 // Padding calcs 4402 $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}'; 4403 $morphingOutlineCSS += '.morphing-outline.instance-' + i + ' { padding: ' + (30 + ($width + 80 + $border * 2 - $height) / 2 - $border) + 'px 50px}'; 4404 $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 }'; 4405 4406 $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 }'; 4407 4408 // Hover 4409 $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}'; 4410 $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 }'; 4411 4412 }); 4413 4414 // Style 4415 nectarCreateStyle($morphingOutlineCSS, 'morphing-outlines'); 4416 4417 } 4418 4419 } 4420 4421 4422 /**
4423 * Morphing outline element initialization. 4424 * 4425 * @since 5.0 4426 */ 4427 function morphingOutlinesInit() { 4428 4429 if($('.morphing-outline').length > 0) { 4430 4431 // Create style. 4432 setTimeout(morphingOutlines, 100); 4433 setTimeout(fullWidthContentColumns, 125); 4434 4435 // Handle resize. 4436 $window.on('smartresize', morphingOutlines); 4437 4438 } 4439 4440 } 4441 4442 4443 4444 4445 /** 4446 * SVG icon element animations 4447 * 4448 * @since 6.0 4449 * @see waypoints 4450 */ 4451 function svgAnimations() { 4452 4453 var $svgOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : 'bottom-in-view'; 4454 4455 if ($svgIcons.length == 0) { 4456 4457 $('.svg-icon-holder:not(.animated-in)').has('svg').each(function (i) { 4458 4459 var $that = $(this); 4460 4461 if (nectarDOMInfo.usingMobileBrowser) { 4462 $that.attr('data-animation', 'false'); 4463 } 4464 // Size 4465 $that.find('svg').css({ 4466 'height': parseInt($that.attr('data-size')) + 'px', 4467 'width': parseInt($that.attr('data-size')) + 'px' 4468 }); 4469 4470 // Animation 4471 $(this).find('svg').attr('id', 'nectar-svg-animation-instance-' + i); 4472 4473 var $animationSpeed = ($that.is('[data-animation-speed]') && $that.attr('data-animation-speed').length > 0) ? $that.attr('data-animation-speed') : 200; 4474 4475 if ($that.attr('data-animation') == 'false') { 4476 $animationSpeed = 1; 4477 $that.css('opacity', '1'); 4478 } 4479 4480 if (!$that.hasClass('bound')) { 4481 $svgIcons[i] = new Vivus($that.find('svg').attr('id'), { 4482 type: 'delayed', 4483 pathTimingFunction: Vivus.EASE_OUT, 4484 animTimingFunction: Vivus.LINEAR, 4485 duration: $animationSpeed, 4486 onReady: svgInit 4487 }); 4488 } 4489 4490 if ($animationSpeed !== 1) { 4491 4492 var waypoint = new Waypoint({ 4493 element: $that, 4494 handler: function () { 4495 if ($that.hasClass('animated-in')) { 4496 waypoint.destroy(); 4497 return; 4498 } 4499 4500 checkIfReady(); 4501 $that.addClass('animated-in'); 4502 waypoint.destroy(); 4503 }, 4504 offset: $svgOffsetPos 4505 4506 }); 4507 4508 } else { 4509 checkIfReady(); 4510 } 4511 4512 function checkIfReady() { 4513 4514 var $animationDelay = 0; 4515 4516 if($that.is('[data-animation-delay]') && 4517 $that.attr('data-animation-delay').length > 0 && 4518 $that.attr('data-animation') != 'false') { 4519 $animationDelay = $that.attr('data-animation-delay'); 4520 } 4521 4522 var $iconID = $that.find('svg').attr('id').replace(/[^0-9]/g, ''); 4523 4524 if ($svgIcons[$iconID].isReady == true) { 4525 setTimeout(function () { 4526 $that.css('opacity', '1'); 4527 $svgIcons[$iconID].reset().play(); 4528 }, $animationDelay); 4529 } else { 4530 setTimeout(checkIfReady, 50); 4531 } 4532 } 4533 4534 function svgInit() { 4535 4536 //set size 4537 $that.css({ 4538 'height': parseInt($that.attr('data-size')) + 'px', 4539 'width': parseInt($that.attr('data-size')) + 'px' 4540 }); 4541 4542 } 4543 4544 $that.addClass('bound'); 4545 4546 }); 4547 4548 4549 // SVG in equal height column resize 4550 if ($('.vc_row-o-equal-height .svg-icon-holder[data-animation="true"]').length > 0 && 4551 $('#nectar_fullscreen_rows').length == 0) { 4552 4553 $window.on('smartresize', function () { 4554 clearTimeout($svgResizeTimeout); 4555 $svgResizeTimeout = setTimeout(function () { 4556 4557 if ($svgIcons.length > 0) { 4558 $('.svg-icon-holder.animated-in').each(function () { 4559 4560 $(this).css('opacity', '1'); 4561 if ($(this).is('[id]')) { 4562 var $iconID = $(this).attr('id').replace(/[^0-9]/g, ''); 4563 $svgIcons[$iconID].finish(); 4564 } 4565 4566 }); 4567 } 4568 4569 }, 300); 4570 4571 }); 4572 4573 } 4574 4575 } 4576 4577 // After svg animated icons initalized 4578 else { 4579 $('.svg-icon-holder').addClass('animated-in').css('opacity', '1'); 4580 } 4581 4582 // Full vc row support 4583 $('#nectar_fullscreen_rows .svg-icon-holder.animated-in').has('svg').each(function (i) { 4584 4585 var $animationDelay = 0; 4586 4587 if($(this).is('[data-animation-delay]') && 4588 $(this).attr('data-animation-delay').length > 0 && 4589 $(this).attr('data-animation') != 'false') { 4590 $animationDelay = $(this).attr('data-animation-delay'); 4591 } 4592 4593 var $that = $(this); 4594 4595 var $iconID = $that.find('svg').attr('id').replace(/[^0-9]/g, ''); 4596 4597 clearTimeout($animatedSVGIconTimeout[i]); 4598 4599 if ($that.attr('data-animation') == 'false') { 4600 4601 $that.css('opacity', '1'); 4602 $svgIcons[$iconID].finish(); 4603 4604 } else { 4605 4606 if ($(this).parents('.active').length > 0 || 4607 $(this).parents('#footer-outer').length > 0 || 4608 $('body.mobile').length > 0) { 4609 4610 $svgIcons[$iconID].reset(); 4611 $animatedSVGIconTimeout[i] = setTimeout(function () { 4612 $svgIcons[$iconID].play(); 4613 }, $animationDelay); 4614 4615 } else { 4616 $svgIcons[$iconID].reset().stop(); 4617 } 4618 } 4619 }); 4620 4621 } 4622 4623 4624 4625 /** 4626 * Fancy unordered list element initialization. 4627 * 4628 * @since 4.0 4629 * @see waypoints 4630 */ 4631 function nectarFancyUlInit() { 4632 4633 $($fullscreenSelector + '.nectar-fancy-ul').each(function () { 4634 4635 var $animation = $(this).attr('data-animation'), 4636 $animationDelay = 0; 4637 4638 if($(this).is('[data-animation-delay]') && 4639 $(this).attr('data-animation-delay').length > 0 && 4640 $(this).attr('data-animation') != 'false') { 4641 $animationDelay = $(this).attr('data-animation-delay'); 4642 } 4643 4644 if ($animation == 'true') { 4645 4646 var $that = $(this), 4647 waypoint = new Waypoint({ 4648 element: $that, 4649 handler: function () { 4650 4651 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 4652 waypoint.destroy(); 4653 return; 4654 } 4655 4656 setTimeout(function () { 4657 $that.find('li').each(function (i) { 4658 var $that = $(this); 4659 $that.delay(i * 220).transition({ 4660 'opacity': '1', 4661 'left': '0' 4662 }, 220, 'easeOutCubic'); 4663 }); 4664 }, $animationDelay); 4665 4666 $that.addClass('animated-in'); 4667 waypoint.destroy(); 4668 }, 4669 offset: 'bottom-in-view' 4670 4671 }); 4672 4673 } 4674 4675 }); 4676 4677 } 4678 4679 4680 /** 4681 * Fancy unordered list element icons. 4682 * 4683 * @since 11.0 4684 */ 4685 function nectarFancyUlIcons() { 4686 4687 $('.nectar-fancy-ul:not([data-list-icon="dot"])').each(function () { 4688 4689 var $icon = $(this).attr('data-list-icon'), 4690 $color = $(this).attr('data-color'); 4691 4692 $(this).find('li').each(function () { 4693 $(this).find('> i').remove(); 4694 $(this).prepend('<i class="icon-default-style ' + $icon + ' ' + $color + '"></i> '); 4695 }); 4696 4697 }); 4698 4699 } 4700 4701 4702 /** 4703 * Flipbox element height calculations. 4704 * 4705 * @since 7.0 4706 */ 4707 function flipBoxHeights() { 4708 4709 $('.nectar-flip-box').each(function () { 4710
4711 var $flipBoxMinHeight = parseInt($(this).attr('data-min-height')), 4712 $flipBoxHeight = $(this).find('.flip-box-front .inner').height(); 4713 4714 if ($(this).find('.flip-box-back .inner').height() > $(this).find('.flip-box-front .inner').height()) { 4715 $flipBoxHeight = $(this).find('.flip-box-back .inner').height(); 4716 } 4717 4718 if ($flipBoxHeight >= $flipBoxMinHeight - 80) { 4719 $(this).find('> div').css('height', $flipBoxHeight + 80); 4720 } else { 4721 $(this).find('> div').css('height', 'auto'); 4722 } 4723 4724 // Safari needs 3D translate. 4725 if ($(this).parent().hasClass('wpb_wrapper')) { 4726 $(this).parent().css('transform', 'translateZ(0)'); 4727 } 4728 4729 }); 4730 } 4731 4732 4733 4734 4735 /** 4736 * Flipbox element events. 4737 * 4738 * @since 7.0 4739 */ 4740 function flipBoxInit() { 4741 4742 if( $('.nectar-flip-box').length > 0 ) { 4743 4744 // Mobile gets click. 4745 if (nectarDOMInfo.usingMobileBrowser) { 4746 $body.on('click', '.nectar-flip-box', function () { 4747 $(this).toggleClass('flipped'); 4748 }); 4749 } 4750 4751 flipBoxHeights(); 4752 4753 // Handle resize. 4754 $window.on('smartresize', flipBoxHeights); 4755 } 4756 4757 } 4758 4759 4760 4761 4762 /** 4763 * Parallax Scrolling 4764 * 4765 * @since 3.0 4766 */ 4767 $.fn.parallaxScroll = function (xpos, speedFactor, outerHeight) { 4768 4769 var $windowDOMWidth = nectarDOMInfo.winW, 4770 $windowDOMHeight = nectarDOMInfo.winH, 4771 $orientationChange = 0, 4772 $this = $(this), 4773 firstTop = $this.offset().top; 4774 4775 // Get the starting position of each element to have parallax applied to it 4776 $this.each(function () { 4777 firstTop = $this.offset().top; 4778 }); 4779 4780 var getHeight = function (jqo) { 4781 return jqo.outerHeight(true); 4782 }; 4783 4784 // setup defaults if arguments aren't specified 4785 if (arguments.length < 1 || xpos === null) { 4786 xpos = "50%"; 4787 } 4788 if (arguments.length < 2 || speedFactor === null) { 4789 speedFactor = 0.25; 4790 } 4791 if (arguments.length < 3 || outerHeight === null) { 4792 outerHeight = true; 4793 } 4794 4795 var $onMobileBrowser = nectarDOMInfo.usingMobileBrowser, 4796 classic_mobile_menu_open = false, 4797 firstSection = false, 4798 $element = $this, 4799 height = getHeight($element); 4800 4801 4802 $this.find('.row-bg.using-image, .page-header-bg-image, .image-bg, .video-wrap').addClass('translate'); 4803 4804 setInterval(function () { 4805 4806 height = getHeight($element); 4807 classic_mobile_menu_open = ($('body.classic_mobile_menu_open.mobile').length > 0) ? true : false; 4808 4809 }, 600); 4810 4811 4812 if($element.parents('.top-level').length > 0 && $element.parents('.parallax_slider_outer').length > 0 || 4813 $element.parents('.top-level').length > 0 && $element.is('.nectar-recent-posts-single_featured') || 4814 $element.is('.wpb_row.top-level') || 4815 $('.wpb_row').length == 0) { 4816 firstSection = true; 4817 } 4818 4819 if ($('.wpb_row').length == 0 && $element.parents('.parallax_slider_outer').length > 0 && $element.is('[data-full-width="true"]') || 4820 ($('#portfolio-extra').length > 0 && $element.parents('.parallax_slider_outer').length > 0 && $element.parents('.wpb_row').length > 0 && $element.parents('.wpb_row').index() == '0')) { 4821 firstSection = true; 4822 } 4823 4824 if (nectarDOMInfo.usingFrontEndEditor) { 4825 firstSection = false; 4826 } 4827 4828 var nectarSliderElBool = $this.is('.nectar-slider-wrap'); 4829 var pageHeaderBool = ($this.find('.page-header-bg-image').length > 0) ? true : false; 4830 var $elToParallax = false; 4831 4832 if (nectarSliderElBool) { 4833 4834 if ($this.find('.video-wrap').length > 0 || $this.find('.image-bg').length > 0) { 4835 $elToParallax = $this.find('.video-wrap, .image-bg'); 4836 } 4837 4838 } else { 4839 4840 if ($this.find('.row-bg.using-image').length > 0) { 4841 $elToParallax = $this.find('.row-bg.using-image'); 4842 } else if ($this.find('.page-header-bg-image').length > 0) { 4843 $elToParallax = $this.find('.page-header-bg-image'); 4844 } 4845 4846 } 4847 4848
4849 function update() { 4850 4851 firstTop = $element.offset().top; 4852 4853 // Check if totally above or totally below viewport. 4854 if ($elToParallax == false || 4855 firstTop + height < nectarDOMInfo.scrollTop || 4856 firstTop > nectarDOMInfo.scrollTop + nectarDOMInfo.winH || 4857 $('body.material-ocm-open').length > 0) { 4858 // Skip processing. 4859 } else { 4860 4861 // Nectar slider 4862 if (nectarSliderElBool) { 4863 4864 if (firstSection) { 4865 // Top level row 4866 if (!classic_mobile_menu_open) { 4867 $this.find('.video-wrap, .image-bg').css({ 4868 'transform': 'translate3d(0, ' + parseFloat(nectarDOMInfo.scrollTop * speedFactor) + 'px, 0)' 4869 }); 4870 } 4871 } else { 4872 $this.find('.video-wrap, .image-bg').css({ 4873 'transform': 'translate3d(0, ' + parseFloat((($windowDOMHeight + nectarDOMInfo.scrollTop - firstTop) * speedFactor)) + 'px, 0)' 4874 }); 4875 } 4876 4877 } else { 4878 4879 // Rows 4880 if (firstSection) { 4881 // Top level row 4882 if (!classic_mobile_menu_open) { 4883 $elToParallax.css({ 4884 'transform': 'translate3d(0, ' + parseFloat(nectarDOMInfo.scrollTop * speedFactor) + 'px, 0)' 4885 }); 4886 } 4887 } else { 4888 // Regular rows further down page 4889 $elToParallax.css({ 4890 'transform': 'translate3d(0, ' + parseFloat((($windowDOMHeight + nectarDOMInfo.scrollTop - firstTop) * speedFactor)) + 'px, 0), scale(1.005)' 4891 }); 4892 } 4893 4894 // Page header 4895 if (pageHeaderBool && !classic_mobile_menu_open) { 4896 $elToParallax.css({ 4897 'transform': 'translate3d(0, ' + parseFloat(nectarDOMInfo.scrollTop * speedFactor) + 'px, 0)' 4898 }); 4899 } 4900 4901 } 4902 4903 } 4904 4905 4906 //if on mobile, auto RAF 4907 if ($onMobileBrowser) { 4908 requestAnimationFrame(update); 4909 } 4910 4911 } 4912 4913 if (window.addEventListener) { 4914 4915 if (nectarDOMInfo.usingFrontEndEditor || !nectarDOMInfo.usingMobileBrowser) { 4916 $window.on('resize', function () { 4917 $windowDOMWidth = nectarDOMInfo.winW; 4918 $windowDOMHeight = nectarDOMInfo.winH; 4919 }); 4920 } 4921 4922 if (nectarDOMInfo.usingFrontEndEditor) { 4923 4924 $window.on('scroll.parallaxSections', update); 4925 4926 } else if (!nectarDOMInfo.usingMobileBrowser) { 4927 4928 window.addEventListener('scroll', function () { 4929 requestAnimationFrame(update); 4930 }, false); 4931 4932 } else { 4933 4934 //if on mobile, auto RAF 4935 requestAnimationFrame(update); 4936 4937 window.addEventListener("orientationchange", function () { 4938 $orientationChange = 1; 4939 }); 4940 4941 $window.on('resize', function () { 4942 if (($window.width() != $windowDOMWidth && $window.height != $windowDOMHeight) || $orientationChange == 1) { 4943 4944 //store the current window dimensions 4945 $windowDOMWidth = nectarDOMInfo.winW; 4946 $windowDOMHeight = nectarDOMInfo.winH; 4947 4948 $orientationChange = 0; 4949 } 4950 }); 4951 4952 } 4953 4954 } 4955 4956 $window.on('resize.parallaxSections', update); 4957 4958 update(); 4959 4960 }; 4961 4962 4963 4964 4965 /** 4966 * Nectar Slider force full width parent row when using full width element option. 4967 * 4968 * @since 4.0 4969 */ 4970 function fullWidthSectionsPreInit() { 4971 $('.wpb_row .vc_col-sm-12 .nectar-slider-wrap[data-full-width="true"]').each(function () { 4972 if ($(this).parents('.wpb_row.full-width-section').length == 0 && $(this).parents('.wpb_row.full-width-content').length == 0) { 4973 $(this).parents('.wpb_row').addClass('full-width-section'); 4974 } 4975 }); 4976 } 4977 4978 4979 4980 /** 4981 * Full width section calculations. 4982 * 4983 * @since 4.0 4984 */ 4985 function fullWidthSections() { 4986 4987 var $windowInnerWidth = nectarDOMInfo.winW, 4988 $bodyBorderWidth = ($('.body-border-right').length > 0 && $windowInnerWidth > 1000) ? parseInt($('.body-border-right').width()) * 2 : 0, 4989 $container_width = ($('.container-wrap').length > 0) ? parseInt($('.container-wrap').outerWidth()) : $window.width(); 4990 4991 var $windowWidth, 4992 $justOutOfSight, 4993 $mainContentWidth; 4994 4995 if ($('#boxed').length == 1) { 4996 $justOutOfSight = ((parseInt($('.container-wrap').width())
4996- parseInt($('.main-content').width())) / 2) + 4; 4997 } else { 4998 4999 // Ext responsive mode is on - add the extra padding into the calcs 5000 var $extResponsivePadding = ($('body[data-ext-responsive="true"]').length > 0 && $windowInnerWidth >= 1000) ? 180 : 0; 5001 5002 if ($container_width - $bodyBorderWidth <= parseInt($('.main-content').css('max-width'))) { 5003 $windowWidth = parseInt($('.main-content').css('max-width')); 5004 } else { 5005 $windowWidth = $container_width - $bodyBorderWidth; 5006 } 5007 5008 5009 var $contentWidth = parseInt($('.main-content').css('max-width')); 5010 5011 // Single post fullwidth 5012 if ($('body.single-post[data-ext-responsive="true"]').length > 0 && $('.container-wrap.no-sidebar').length > 0) { 5013 $contentWidth = $('.post-area').width(); 5014 $extResponsivePadding = 0; 5015 } 5016 5017 $justOutOfSight = Math.ceil((($windowWidth + $extResponsivePadding - $contentWidth) / 2)); 5018 } 5019 5020 5021 // Full width content row type. 5022 $('.carousel-outer').has('.carousel-wrap[data-full-width="true"]').css('overflow', 'visible'); 5023 5024 $('.carousel-wrap[data-full-width="true"], .portfolio-items[data-col-num="elastic"]:not(.fullwidth-constrained), .full-width-content').each(function () { 5025 5026 var $leftHeaderSize = ($('#header-outer[data-format="left-header"]').length > 0 && $windowInnerWidth >= 1000) ? parseInt($('#header-outer[data-format="left-header"]').width()) : 0; 5027 var $bodyBorderWidth = ($('.body-border-right').length > 0 && $windowInnerWidth > 1000) ? (parseInt($('.body-border-right').width()) * 2) - 2 : 0; 5028 5029 // Single post fullwidth. 5030 if ($('#boxed').length == 1) { 5031 5032 $mainContentWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').width()) : parseInt($(this).parents('.container').width()); 5033 5034 if ($('body.single-post[data-ext-responsive="true"]').length > 0 && $('.container-wrap.no-sidebar').length > 0 && $(this).parents('.post-area').length > 0) { 5035 $contentWidth = $('.post-area').width(); 5036 $extResponsivePadding = 0; 5037 $windowWidth = $container_width - $bodyBorderWidth; 5038 $justOutOfSight = Math.ceil((($windowWidth + $extResponsivePadding - $contentWidth) / 2)); 5039 } else { 5040 if ($(this).parents('.page-submenu').length > 0) { 5041 $justOutOfSight = ((parseInt($('.container-wrap').width()) - $mainContentWidth) / 2); 5042 } 5043 else { 5044 $justOutOfSight = ((parseInt($('.container-wrap').width()) - $mainContentWidth) / 2) + 4; 5045 } 5046 } 5047 } else { 5048 5049 if ($('body.single-post[data-ext-responsive="true"]').length > 0 && $('.container-wrap.no-sidebar').length > 0 && $(this).parents('.post-area').length > 0) { 5050 5051 $contentWidth = $('.post-area').width(); 5052 $extResponsivePadding = 0; 5053 $windowWidth = $container_width - $bodyBorderWidth; 5054 5055 } else { 5056 5057 var $mainContentMaxWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').css('max-width')) : parseInt($(this).parents('.container').css('max-width')); 5058 5059 if ($container_width - $bodyBorderWidth <= $mainContentMaxWidth) { 5060 $windowWidth = $mainContentMaxWidth; 5061 } 5062 5063 $contentWidth = $mainContentMaxWidth; 5064 $extResponsivePadding = ($('body[data-ext-responsive="true"]').length > 0 && nectarDOMInfo.winW >= 1000) ? 180 : 0; 5065 5066 if ($leftHeaderSize > 0) { 5067 $extResponsivePadding = ($('body[data-ext-responsive="true"]').length > 0 && nectarDOMInfo.winW >= 1000) ? 120 : 0; 5068 } 5069 5070 } 5071 5072 $justOutOfSight = Math.ceil((($windowWidth + $extResponsivePadding - $contentWidth) / 2)); 5073 } 5074 5075 var $extraSpace = 0; 5076 if ($(this).hasClass('carousel-wrap')) { 5077 $extraSpace = 1; 5078 } 5079 if ($(this).hasClass('portfolio-items')) { 5080 $extraSpace = 5; 5081 } 5082 5083 var $carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight * 2) : $container_width - $bodyBorderWidth + $extraSpace; 5084 5085 // When using gutter on portfolio don't add extra space 5086 if ($('#boxed').length == 0 && $(this).hasClass('portfolio-items') && $(this).is('[data-gutter*="px"]') && $(this).attr('data-gutter').length > 0 && $(this).attr('data-gutter') != 'none') { 5087 if ($container_width > 1000) { 5088 $carouselWidth = $container_width - $bodyBorderWidth + 3; 5089 } 5090 else { 5091 $carouselWidth = $container_width - $bodyBorderWidth; 5092 } 5093 } 5094 5095 if ($(this).parent().hasClass('default-style')) { 5096 5097 $mainContentWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').width()) : parseInt($(this).parents('.container').width()); 5098 5099 if ($('#boxed').length != 0) { 5100 $carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight * 2) : $container_width + $extraSpace; 5101 } else { 5102 $carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight * 2) : ($container_width - $bodyBorderWidth) - (($container_width - $bodyBorderWidth) * 0.025) + $extraSpace; 5103 $windowWidth = ($container_width - $bodyBorderWidth <= $mainContentWidth) ? $mainContentWidth : ($container_width - $bodyBorderWidth) - (($container_width - $bodyBorderWidth) * 0.025);
5104 $justOutOfSight = Math.ceil((($windowWidth - $mainContentWidth) / 2)); 5105 } 5106 5107 } 5108 5109 else if ($(this).parent().hasClass('spaced')) { 5110 5111 $mainContentWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').width()) : parseInt($(this).parents('.container').width()); 5112 5113 if ($('#boxed').length != 0) { 5114 $carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight * 2) - ($container_width * 0.02) : $container_width + $extraSpace; 5115 } else { 5116 $carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight * 2) : ($container_width - $bodyBorderWidth) - Math.ceil(($container_width - $bodyBorderWidth) * 0.02) + $extraSpace; 5117 var $windowWidth2 = ($container_width - $bodyBorderWidth <= $mainContentWidth) ? $mainContentWidth : ($container_width - $bodyBorderWidth) - (($container_width - $bodyBorderWidth) * 0.02); 5118 $justOutOfSight = Math.ceil((($windowWidth2 - $mainContentWidth) / 2) + 2); 5119 } 5120 } 5121 5122 // Make sure the element/row is capable of going full width. 5123 if (!$(this).parents('.span_9').length > 0 && 5124 !$(this).parent().hasClass('span_3') && 5125 $(this).parent().attr('id') != 'sidebar-inner' && 5126 $(this).parent().attr('id') != 'portfolio-extra' && 5127 !$(this).find('.carousel-wrap[data-full-width="true"]').length > 0 && 5128 !$(this).find('.nectar-carousel-flickity-fixed-content').length > 0 && 5129 !$(this).find('.portfolio-items:not(".carousel")[data-col-num="elastic"]').length > 0) { 5130 5131 // Escape if inside woocoommerce page and not using applicable layout 5132 if ($('.single-product').length > 0 && 5133 $(this).parents('#tab-description').length > 0 && 5134 $(this).parents('.full-width-tabs').length == 0) { 5135 5136 $(this).css({ 5137 'visibility': 'visible' 5138 }); 5139 5140 } else { 5141 // Portfolio. 5142 if ($(this).hasClass('portfolio-items')) { 5143 $(this).css({ 5144 'margin-left': -$justOutOfSight, 5145 'left': 0, 5146 'width': $carouselWidth, 5147 'visibility': 'visible' 5148 }); 5149 5150 } else { 5151 5152 // Fullscreen page rows left. 5153 if ($('#nectar_fullscreen_rows').length > 0 && $(this).hasClass('wpb_row')) { 5154 5155 $(this).css({ 5156 'margin-left': -$justOutOfSight, 5157 'width': $carouselWidth, 5158 'visibility': 'visible' 5159 }); 5160 5161 } else { 5162 // Regular rows. 5163 $(this).css({ 5164 'left': 0, 5165 'margin-left': -$justOutOfSight, 5166 'width': $carouselWidth, 5167 'visibility': 'visible' 5168 }); 5169 } 5170 5171 } 5172 5173 } 5174 } 5175 5176 else if ($(this).parent().attr('id') == 'portfolio-extra' && $('#full_width_portfolio').length != 0) { 5177 5178 $(this).css({ 5179 'left': 0, 5180 'margin-left': -$justOutOfSight, 5181 'width': $carouselWidth, 5182 'visibility': 'visible' 5183 }); 5184 5185 } else { 5186 5187 $(this).css({ 5188 'margin-left': 0, 5189 'width': 'auto', 5190 'left': '0', 5191 'visibility': 'visible' 5192 }); 5193 } 5194 5195 }); 5196 5197 } 5198 5199 5200 5201 /** 5202 * Parallax scroll speed helper. 5203 * 5204 * @since 4.0 5205 */ 5206 function parallaxSrollSpeed(speedString) { 5207 5208 var speed; 5209 switch (speedString) { 5210 case 'slow': 5211 speed = 0.6; 5212 break; 5213 case 'medium': 5214 speed = 0.4; 5215 break; 5216 case 'fast': 5217 speed = 0.25; 5218 break; 5219 } 5220 5221 return speed; 5222 } 5223 5224 5225 /** 5226 * Parallax scroll initialization. 5227 * 5228 * @since 4.0 5229 */ 5230 function parallaxScrollInit() { 5231 5232 if (nectarDOMInfo.usingMobileBrowser && $('body[data-remove-m-parallax="1"]').length > 0) { 5233 return; 5234 } 5235 5236 parallaxRowsBGCals(); 5237 5238 $('.nectar-recent-posts-single_featured, .wpb_row.parallax_section, #page-header-bg[data-parallax="1"] .page-header-bg-image-wrap, .parallax_slider_outer .nectar-slider-wrap').each(function () { 5239 var $id = $(this).attr('id'); 5240 5241 if ( $(this).find('[data-parallax-speed="fixed"]').length == 0) { 5242 5243 if ($(this).find('.row-bg').length == 0) { 5244 //set default scroll speed if not defined 5245 $('#' + $id).parallaxScroll("50%", 0.25); 5246 } else { 5247 $('#' + $id + ".parallax_section").parallaxScroll("50%", parallaxSrollSpeed($(this).find('.row-bg').attr('data-parallax-speed'))); 5248 } 5249 5250 } 5251 5252 $(this).addClass('nectar-parallax-enabled'); 5253 5254 }); 5255 5256 } 5257 5258 5259 /** 5260 * First full width row on page 5261 * 5262 * @since 4.0 5263 */ 5264 function firstFWSection() { 5265 $('.full-width-section.wpb_row, .full-width-content.wpb_row').each(function () { 5266 5267 if (!$(this).parent().hasClass('span_9') && 5268 !$(this).parent().hasClass('span_3') && 5269 $(this).parent().attr('id') != 'sidebar-inner') { 5270 5271 if ($(this).parents('#portfolio-extra').length > 0 && $('#full_width_portfolio').length == 0) { 5272 return false;
5273 } 5274 5275 if ($(this).index() == '0' && 5276 $pageHeaderBG.length == 0 && 5277 $('.page-header-no-bg').length == 0 && 5278 $('.project-title').length == 0 && 5279 $('body.single').length == 0 && 5280 $('.project-title').length == 0) { 5281 5282 $(this).addClass('first-section'); 5283 var $that = $(this); 5284 setTimeout(function () { 5285 $that.addClass('loaded'); 5286 }, 50); 5287 5288 } 5289 5290 } 5291 5292 }); 5293 } 5294 5295 5296 5297 5298 5299 /** 5300 * Parallax row background height calculations. 5301 * 5302 * @since 6.0 5303 */ 5304 function parallaxRowsBGCals() { 5305 5306 if (nectarDOMInfo.usingMobileBrowser && $('body[data-remove-m-parallax="1"]').length > 0) { 5307 return; 5308 } 5309 5310 $('.nectar-recent-posts-single_featured, .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 () { 5311 5312 var $non_page_builder_slider; 5313 5314 if ($(this).find('.row-bg').length == 0 && $(this).find('.page-header-bg-image').length > 0) { 5315 //skip processing. 5316 } else if ($(this).find('.row-bg').length == 0 && $(this).find('.image-bg').length > 0) { 5317 5318 $non_page_builder_slider = false;
5319 5320 // First nectar slider shortcode without page builder 5321 if ($('.wpb_row').length == 0 && 5322 $(this).parents('.nectar-slider-wrap[data-full-width="true"]').length > 0 && 5323 $(this).parents('.parallax_slider_outer').length > 0 && 5324 $(this).parents('.parallax_slider_outer').index() == '1') { 5325 $non_page_builder_slider = true; 5326 } 5327 5328 // Portfolio first 5329 if ($('#portfolio-extra').length > 0 && 5330 $(this).parents('.wpb_row').length > 0 && 5331 $(this).parents('.parallax_slider_outer').length > 0 && 5332 $(this).parents('.wpb_row').index() == '0') { 5333 $non_page_builder_slider = true; 5334 } 5335 5336 // Set heights. 5337 if ($(this).parents('.top-level').length > 0 && !nectarDOMInfo.usingFrontEndEditor || 5338 $non_page_builder_slider && !nectarDOMInfo.usingFrontEndEditor) { 5339 $(this).find('.image-bg').css({ 5340 'height': Math.ceil($(this).parent().offset().top * 0.25) + $(this).outerHeight(true) 5341 }); 5342 } else { 5343 $(this).find('.image-bg').css({ 5344 'height': Math.ceil($window.height() * 0.25) + $(this).outerHeight(true) 5345 }); 5346 } 5347 5348 } 5349 5350 // Video backgrounds. 5351 else if ($(this).find('.row-bg').length == 0 && $(this).find('.video-wrap').length > 0) { 5352 5353 $non_page_builder_slider = false;
5354 // First nectar slider shortcode without page builder 5355 if ($('.wpb_row').length == 0 && 5356 $(this).parents('.nectar-slider-wrap[data-full-width="true"]').length > 0 && 5357 $(this).parents('.parallax_slider_outer').length > 0 && 5358 $(this).parents('.parallax_slider_outer').index() == '1') { 5359 $non_page_builder_slider = true; 5360 } 5361 // Portfolio first 5362 if ($('#portfolio-extra').length > 0 && 5363 $(this).parents('.wpb_row').length > 0 && 5364 $(this).parents('.parallax_slider_outer').length > 0 && 5365 $(this).parents('.wpb_row').index() == '0') { 5366 $non_page_builder_slider = true; 5367 } 5368 5369 // Set heights. 5370 if ($(this).parents('.top-level').length > 0 && !nectarDOMInfo.usingFrontEndEditor || 5371 $non_page_builder_slider && !nectarDOMInfo.usingFrontEndEditor) { 5372 5373 $(this).find('.video-wrap').css({ 5374 'height': Math.ceil($(this).parent().offset().top * 0.25) + $(this).outerHeight(true) 5375 }); 5376 } 5377 5378 else { 5379 $(this).find('.video-wrap').css({ 5380 'height': Math.ceil($window.height() * 0.25) + $(this).outerHeight(true) 5381 }); 5382 } 5383 5384 var vid = $(this).find('.video-wrap video'), 5385 vid_w_orig = 1280, 5386 vid_h_orig = 720; 5387 5388 // Get the parent element size 5389 var container_w = vid.parent().width(), 5390 container_h = vid.parent().height(), 5391 scale_w = container_w / vid_w_orig, 5392 scale_h = container_h / vid_h_orig; 5393 5394 var scale = scale_w > scale_h ? scale_w : scale_h; 5395 5396 // Scale the video. 5397 vid.width(scale * vid_w_orig); 5398 vid.height(scale * vid_h_orig); 5399 5400 } else { 5401 5402 if ($(this).is('.nectar-recent-posts-single_featured') && $(this).parents('.top-level').length > 0 && !nectarDOMInfo.usingFrontEndEditor) { 5403 //skip processing. 5404 } else if (!$(this).hasClass('top-level') || nectarDOMInfo.usingFrontEndEditor) { 5405 5406 var $ifFast = ($(this).find('.row-bg[data-parallax-speed="fast"]').length > 0) ? 60 : 0; 5407 $(this).find('.row-bg').css({ 5408 'height': Math.ceil($window.height() * parallaxSrollSpeed($(this).find('.row-bg').attr('data-parallax-speed'))) + $(this).outerHeight(true) + $ifFast 5409 }); 5410 5411 } 5412 5413 } 5414 5415 }); 5416 5417 } 5418 5419 5420 /** 5421 * Class names added for specific full width section rows at top 5422 * 5423 * @since 3.0 5424 */ 5425 function fwsClasses() { 5426 5427 $('.wpb_wrapper > .nectar-slider-wrap[data-full-width="true"]').each(function () { 5428 if (!$(this).parent().hasClass('span_9') && !$(this).parent().hasClass('span_3') && $(this).parent().attr('id') != 'sidebar-inner') { 5429 if ($(this).parents('.wpb_row').index() == '0') { 5430 $(this).addClass('first-nectar-slider'); 5431 } 5432 } 5433 }); 5434 5435 var $contentElementsNum = ($('#portfolio-extra').length == 0) ? $('.main-content > .row > *').length : $('.main-content > .row #portfolio-extra > *').length; 5436 5437 if ($('#portfolio-extra').length == 0) { 5438 $contentElementsNum = ($('.main-content > .row > .wpb_row').length > 0) ? $('.main-content > .row > .wpb_row').length : $('.main-content > .row > *').length; 5439 } else { 5440 $contentElementsNum = $('.main-content > .row #portfolio-extra > *').length; 5441 } 5442 5443 $('.full-width-section, .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 () { 5444 5445 if (!$(this).parent().hasClass('span_9') && !$(this).parent().hasClass('span_3') && $(this).parent().attr('id') != 'sidebar-inner') { 5446 5447 if ($(this).parents('.wpb_row').length > 0) { 5448 5449 if ($(this).parents('#portfolio-extra').length > 0 && 5450 $('#full_width_portfolio').length == 0) { 5451 return false; 5452 } 5453 5454 ////first 5455 if ($(this).parents('.wpb_row').index() == '0' && $pageHeaderBG.length != 0) { 5456 //skip processing. 5457 } 5458 else if ($(this).parents('.wpb_row').index() == '0' && 5459 $pageHeaderBG.length == 0 && $('.page-header-no-bg').length == 0 && 5460 $('.project-title').length == 0 && $(this).parents('.wpb_row').index() == '0' && 5461 $('.project-title').length == 0 && $('body[data-bg-header="true"]').length == 0) { 5462 5463 if ($('.single').length == 0) { 5464 $('.container-wrap').css('padding-top', '0px'); 5465 } else { 5466 $(this).addClass('first-section'); 5467 } 5468 5469 } 5470 5471 // Check if it's also last (i.e. the only fws) 5472 if ($(this).parents('.wpb_row').index() == $contentElementsNum - 1 && $('#respond').length == 0) { 5473 if ($(this).attr('id') != 'portfolio-filters-inline') { 5474 $('.container-wrap').css('padding-bottom', '0px'); 5475 $('#call-to-action .triangle').remove(); 5476 } 5477 } 5478 5479 } else { 5480 5481 if ($(this).parents('#portfolio-extra').length > 0 && $('#full_width_portfolio').length == 0) { 5482 return false;
5483 } 5484 5485 if ($(this).find('.portfolio-filters-inline').length == 0 && $(this).attr('id') != 'post-area') { 5486 5487 ////first 5488 if ($(this).index() == '0' && $pageHeaderBG.length != 0) { 5489 //skip processing. 5490 } 5491 else if ($(this).index() == '0' && $pageHeaderBG.length == 0 && 5492 $(this).index() == '0' && $('.page-header-no-bg').length == 0 && 5493 $(this).index() == '0' && !$(this).hasClass('blog_next_prev_buttons') && 5494 !$(this).hasClass('nectar-shop-outer') && $(this).parents('.pum-container').length == 0) { 5495 5496 if ($('body[data-header-resize="0"]').length == 1 && $('.single').length == 0 || $('body.material').length > 0 && $('.single').length == 0) { 5497 5498 if (!$('body.blog .blog-fullwidth-wrap > .masonry:not(.meta-overlaid)').length > 0) { 5499 $('.container-wrap').css('padding-top', '0px'); 5500 } 5501 5502 } 5503 5504 else { 5505 $(this).addClass('first-section'); 5506 } 5507 5508 } 5509 5510 //check if it's also last (i.e. the only fws) 5511 if ($(this).index() == $contentElementsNum - 1 && $('#respond').length == 0 && $('body.woocommerce-checkout').length == 0) { 5512 $('.container-wrap').css('padding-bottom', '0px'); 5513 $('.bottom_controls').css('margin-top', '0px'); 5514 $('#call-to-action .triangle').remove(); 5515 } 5516 5517 } 5518 } 5519 } 5520 5521 }); 5522 5523 5524 $('#portfolio-extra > .nectar-slider-wrap[data-full-width="true"], .portfolio-wrap').each(function () { 5525 //check if it's last 5526 if ($(this).index() == $contentElementsNum - 1 && $('#commentform').length == 0 && $('#pagination').length == 0) { 5527 if (parseInt($('.container-wrap').css('padding-bottom')) > 0) { 5528 $(this).css('margin-bottom', '-40px'); 5529 } 5530 $('#call-to-action .triangle').remove(); 5531 } 5532 }); 5533 5534 5535 $('.portfolio-filters').each(function () { 5536 ////first 5537 if ($(this).index() == '0' && $pageHeaderBG.length != 0 || $(this).index() == '0') { 5538 $(this).addClass('first-section nder-page-header'); 5539 } else if ($(this).index() == '0' && $pageHeaderBG.length == 0 || $(this).index() == '0') { 5540 $(this).css({ 5541 'margin-top': '0px' 5542 }).addClass('first-section'); 5543 } 5544 }); 5545 5546 5547 $('.portfolio-filters-inline').each(function () { 5548 ////first 5549 if ($(this).parents('.wpb_row').length > 0) { 5550 //skip processing. 5551 } else { 5552 if ($(this).index() == '0' && $pageHeaderBG.length != 0 || $(this).index() == '0') { 5553 $(this).addClass('first-section nder-page-header'); 5554 } else if ($(this).index() == '0' && $pageHeaderBG.length == 0 || $(this).index() == '0') { 5555 5556 $(this).css({ 5557 'margin-top': '-30px', 5558 'padding-top': '50px' 5559 }).addClass('first-section'); 5560 5561 } 5562 } 5563 5564 }); 5565 5566 5567 } 5568 5569 5570 5571 5572 5573 5574 /** 5575 * Full width row padding adjust calculations. 5576 * 5577 * @since 3.0 5578 */ 5579 function fullWidthRowPaddingAdjustCalc() { 5580 5581 if ($('#boxed').length == 0) { 5582 5583 $('.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 () { 5584 5585 var $windowHeight = $window.width(), 5586 $topPadding = ($(this).attr('data-top-percent')) ? $(this).attr('data-top-percent') : 'skip', 5587 $bottomPadding = ($(this).attr('data-bottom-percent')) ? $(this).attr('data-bottom-percent') : 'skip'; 5588 5589 //top 5590 if ($topPadding != 'skip') { 5591 $(this).css('padding-top', $windowHeight * (parseInt($topPadding) / 100)); 5592 } 5593 5594 //bottom 5595 if ($bottomPadding != 'skip') { 5596 $(this).css('padding-bottom', $windowHeight * (parseInt($bottomPadding) / 100)); 5597 } 5598 5599 }); 5600 } 5601 } 5602 5603 5604 /** 5605 * Full width row padding adjust initialization 5606 * 5607 * @since 10.5 5608 */ 5609 function fullWidthRowPaddingAdjust() { 5610 5611 if (nectarDOMInfo.usingMobileBrowser) { 5612 fullWidthRowPaddingAdjustCalc(); 5613 } 5614 5615 $window.on('resize', fullWidthRowPaddingAdjustCalc); 5616 5617 } 5618 5619 5620 5621 5622 5623 /** 5624 * Full width content row auto equal height cols. 5625 * 5626 * @since 4.0 5627 */ 5628 function fullWidthContentColumns() { 5629 5630 var $frontEndEditorElDiv = ($('body.vc_editor').length > 0) ? '.vc_element > ' : ''; 5631 5632 $('.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 () { 5633 5634 // Only set the height if more than one column 5635 if ($(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col').length > 1) { 5636 5637 var tallestColumn = 0;
5638 var $columnInnerHeight = 0; 5639 var $column_inner_selector; 5640 5641 $(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col').each(function () { 5642 5643 $column_inner_selector = ($(this).find('> .vc_column-inner > .wpb_wrapper').length > 0) ? '.vc_column-inner' : '.column-inner-wrap > .column-inner'; 5644 5645 var $padding = ( $body.is('[data-flex-cols="true"]') ) ? parseInt($(this).find('> .vc_column-inner').css('padding-top')) : parseInt($(this).css('padding-top')); 5646 var $frontEndEditorElPadding = ($frontEndEditorElDiv.length > 2 && $(this).find('> .vc_column-inner').length > 0) ? parseInt($(this).find('> .vc_column-inner').css('padding-top')) : 0; 5647 5648 if( $(this).find('> ' + $column_inner_selector + ' > .wpb_wrapper').height() + ($padding * 2) + $frontEndEditorElPadding > tallestColumn ) { 5649 tallestColumn = $(this).find('> ' + $column_inner_selector + ' > .wpb_wrapper').height() + ($padding * 2) + $frontEndEditorElPadding; 5650 } 5651 5652 }); 5653 5654 $(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col').each(function () { 5655 5656 $column_inner_selector = ($(this).find('> .vc_column-inner > .wpb_wrapper').length > 0) ? '.vc_column-inner' : '.column-inner-wrap > .column-inner'; 5657 5658 // Columns with content 5659 if ($(this).find('> ' + $column_inner_selector + ' > .wpb_wrapper > *').length > 0) { 5660 5661 // Added in 7.6 to fix equal height columns 5662 if ($frontEndEditorElDiv.length < 2 && !$(this).parent().parent().hasClass('vc_row-o-equal-height')) { 5663 $(this).css('height', tallestColumn); 5664 5665 if( $body.is('[data-flex-cols="true"]') ) { 5666 $(this).find('> .vc_column-inner').css('height', tallestColumn); 5667 } 5668 5669 } else if ($frontEndEditorElDiv.length > 2 && !$(this).parent().parent().parent().hasClass('vc_row-o-equal-height')) { 5670 $(this).css('height', tallestColumn); 5671 5672 if( $body.is('[data-flex-cols="true"]') ) { 5673 $(this).find('> .vc_column-inner').css('height', tallestColumn); 5674 } 5675 5676 } 5677 } 5678 5679 // Empty columns 5680 else { 5681 if ($(this).is('[data-using-bg="true"]')) { 5682 5683 $(this).css('min-height', tallestColumn); 5684 5685 if( $body.is('[data-flex-cols="true"]') ) { 5686 $(this).find('> .vc_column-inner').css('min-height', tallestColumn); 5687 } 5688 5689 if ($(this).is('[data-animation*="reveal"]')) { 5690 $(this).find('.column-inner') 5691 .css('min-height', tallestColumn); 5692 } 5693 5694 } 5695 } 5696 5697 }); 5698 5699 // Nested column height 5700 if (nectarDOMInfo.winW < 1000) { 5701 $(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col .wpb_row .col').css('min-height', '0px'); 5702 } 5703 5704 // Vertically center 5705 if ($(this).hasClass('vertically-align-columns') && 5706 nectarDOMInfo.winW > 1000 && 5707 !$(this).hasClass('vc_row-o-equal-height')) { 5708 5709 // Parent columns 5710 $(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col').each(function () { 5711 5712 $column_inner_selector = ($(this).find('> .vc_column-inner > .wpb_wrapper').length > 0) ? '.vc_column-inner' : '.column-inner-wrap > .column-inner'; 5713
5714 $columnInnerHeight = $(this).find('> ' + $column_inner_selector + ' > .wpb_wrapper').height(); 5715 5716 var $marginCalc = ($(this).height() / 2) - ($columnInnerHeight / 2); 5717 5718 if ($marginCalc <= 0) { 5719 $marginCalc = 0; 5720 } 5721 5722 $(this).find('> ' + $column_inner_selector + ' > .wpb_wrapper') 5723 .css('margin-top', $marginCalc) 5724 .css('margin-bottom', $marginCalc); 5725 5726 }); 5727 5728 5729 } 5730 5731 } 5732 5733 }); 5734 5735 5736 if( $('body[data-flex-cols="true"]').length == 0 ) { 5737 5738 // Equal height columns in container type with reveal columns 5739 $('.main-content > .row > .wpb_row:not(.full-width-content).vc_row-o-equal-height').each(function () { 5740 if ($(this).find('>.span_12 > ' + $frontEndEditorElDiv + ' .wpb_column[data-animation*="reveal"]').length > 0) { 5741 5742 var tallestColumn = 0; 5743 5744 $(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col').each(function () { 5745 5746 var $padding = parseInt($(this).find('> .column-inner-wrap > .column-inner').css('padding-top')); 5747 5748 if( $(this).find('> .column-inner-wrap > .column-inner').height() + ($padding * 2) > tallestColumn ) { 5749 tallestColumn = $(this).find('> .column-inner-wrap > .column-inner').height() + ($padding * 2); 5750 } 5751 5752 }); 5753 5754 $(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col').each(function () { 5755 5756 // Columns with content 5757 if ($(this).find('> .column-inner-wrap > .column-inner .wpb_wrapper > *').length > 0) { 5758 $(this).find('> .column-inner-wrap').css('height', tallestColumn); 5759 } 5760 // Empty columns 5761 else { 5762 $(this).css('min-height', tallestColumn); 5763 if ($(this).is('[data-animation*="reveal"]')) { 5764 $(this).find('.column-inner').css('min-height', tallestColumn); 5765 } 5766 } 5767 }); 5768 5769 } 5770 }); 5771 5772 // Using equal height option, top/bottom padding % needs to be convered into px for cross browser (flex bug) 5773 $('.wpb_row.vc_row-o-equal-height>.span_12> ' + $frontEndEditorElDiv + '.wpb_column[class*="padding-"][data-padding-pos="all"]').each(function () { 5774 if ($(this).parents('.tabbed').length == 0) { 5775 $(this).css({ 5776 'padding-top': $(this).css('padding-left'), 5777 'padding-bottom': $(this).css('padding-left') 5778 }); 5779 } 5780 }); 5781 5782 } // endif; Not using modern grid system. 5783 5784 } 5785 5786 5787 5788 5789 /** 5790 * Mouse parallax row option. 5791 * 5792 * @since 4.0 5793 */ 5794 function mouseParallaxInit() { 5795 5796 $('.wpb_row:has(.nectar-parallax-scene)').each(function (i) { 5797 5798 var $strength = parseInt($(this).find('.nectar-parallax-scene').attr('data-scene-strength')); 5799 5800 $mouseParallaxScenes[i] = $(this).find('.nectar-parallax-scene').parallax({ 5801 scalarX: $strength, 5802 scalarY: $strength 5803 }); 5804 5805 // Wait until the images in the scene have loaded. 5806 var images = $(this).find('.nectar-parallax-scene li'); 5807 5808 $.each(images, function () { 5809 if ($(this).find('div').length > 0) { 5810 var el = $(this).find('div'), 5811 image = el.css('background-image').replace(/"/g, '').replace(/url\(|\)$/ig, ''); 5812 if (image && image !== '' && image !== 'none') { 5813 images = images.add($('<img>').attr('src', image)); 5814 } 5815 } 5816 }); 5817 5818 }); 5819 5820 } 5821 5822 5823 5824 5825 5826 5827 /** 5828 * Add checkmark icons to unorder list with checkmark class. 5829 * 5830 * @since 2.0 5831 */ 5832 function ulCheckmarks() { 5833 $('ul.checks li').each(function () { 5834 if ($(this).find('i.icon-ok-sign').length == 0) { 5835 $(this).prepend('<i class="icon-ok-sign"></i>'); 5836 } 5837 }); 5838 } 5839 5840 5841 5842 5843 /** 5844 * Allow CTA element BG color to also act as a link. 5845 * 5846 * @since 11.0 5847 */ 5848 function ctaLinkBG() { 5849 5850 $body.on('click','.nectar-cta[data-using-bg="true"]:not([data-style="material"]) .link_wrap', function() { 5851 5852 $(this).find('a.link_text')[0].click(); 5853 5854 }); 5855 5856 } 5857 5858 5859 5860 /** 5861 * Add CSS default animation classes through JS to 5862 * avoid inital animation on page load. 5863 * 5864 * @since 11.0 5865 */ 5866 function nectarKeyframeAssist() { 5867 5868 $('.nectar-cta[data-style="arrow-animation"]').addClass('loaded'); 5869 5870 } 5871 5872 5873 5874 5875 /** 5876 * Page builder row background layer animations. 5877 * 5878 * @since 9.0 5879 * @see waypoints 5880 */ 5881 function rowBGAnimations() { 5882 5883 var $rowBGAnimationsOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '93%'; 5884 var $rowBGAnimationsRevealOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '75%'; 5885 var $rowBGOffset; 5886 5887 $($fullscreenSelector + '.row-bg-wrap[data-bg-animation]:not([data-bg-animation="none"]):not([data-bg-animation*="displace-filter"]) .row-bg').each(function () { 5888 5889 if( !$(this).parents('.row-bg-wrap').is('[data-bg-animation="zoom-out-reveal"]') ) { 5890 $rowBGOffset = $rowBGAnimationsOffsetPos; 5891 } else { 5892 $rowBGOffset = $rowBGAnimationsRevealOffsetPos; 5893 } 5894 5895 if( !$(this).hasClass('using-image') && !$(this).parents('.row-bg-wrap').is('[data-bg-animation="zoom-out-reveal"]') ) { 5896 return; 5897 } 5898 5899 var $that = $(this); 5900 var waypoint = new Waypoint({ 5901 element: $that.parents('.row-bg-wrap'), 5902 handler: function () { 5903 5904 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 5905 waypoint.destroy(); 5906 return; 5907 } 5908 5909 $that.parents('.inner-wrap').addClass('animated-in'); 5910 5911 if($that.parents('.row-bg-wrap').is('[data-bg-animation="zoom-out-reveal"]')) { 5912 $that.parents('.row-bg-wrap').addClass('animated-in'); 5913 } 5914 5915 waypoint.destroy(); 5916 }, 5917 offset: $rowBGOffset 5918 }); 5919 5920 }); 5921 5922 } 5923 5924 5925 /** 5926 * Page builder column background layer animations. 5927 * 5928 * @since 9.0 5929 * @see waypoints 5930 */ 5931 function columnBGAnimations() { 5932 5933 var $colBGAnimationsOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '93%'; 5934 var $colBGAnimationsRevealOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '80%'; 5935 var $colBGOffset; 5936 5937 $($fullscreenSelector + '.column-image-bg-wrap[data-bg-animation]:not([data-bg-animation="none"]):not([data-bg-animation*="displace-filter"]) .column-image-bg').each(function () { 5938 5939 if( !$(this).parents('.column-image-bg-wrap').is('[data-bg-animation="zoom-out-reveal"]') ) { 5940 $colBGOffset = $colBGAnimationsOffsetPos; 5941 } else { 5942 $colBGOffset = $colBGAnimationsRevealOffsetPos; 5943 } 5944 5945 var $that = $(this); 5946 5947 var waypoint = new Waypoint({ 5948 element: $that.parents('.column-image-bg-wrap'), 5949 handler: function () { 5950 5951 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 5952 waypoint.destroy(); 5953 return; 5954 } 5955 5956 $that.parents('.inner-wrap').addClass('animated-in'); 5957 if( $that.parents('.column-image-bg-wrap').is('[data-bg-animation="zoom-out-reveal"]') ) { 5958 $that.parents('.column-image-bg-wrap').addClass('animated-in'); 5959 $that.parents('.column-image-bg-wrap').siblings('.column-bg-overlay-wrap').addClass('animated-in'); 5960 } 5961 waypoint.destroy(); 5962 }, 5963 offset: $colBGOffset 5964 }); 5965 5966 }); 5967 5968 // Zoom out reveal with BG color only 5969 $($fullscreenSelector + '.column-bg-overlay-wrap[data-bg-animation="zoom-out-reveal"]').each(function () { 5970 5971 $colBGOffset = $colBGAnimationsRevealOffsetPos; 5972 5973 var $that = $(this); 5974 5975 if( $that.parent().find('.column-image-bg-wrap').length == 0 ) { 5976 5977 var waypoint = new Waypoint({ 5978 element: $that, 5979 handler: function () { 5980 5981 if ( $that.hasClass('animated-in') ) { 5982 waypoint.destroy(); 5983 return; 5984 } 5985 5986 $that.addClass('animated-in'); 5987 waypoint.destroy(); 5988 5989 }, 5990 offset: $colBGOffset 5991 }); 5992 5993 } 5994 5995 }); 5996 5997 } 5998 5999 6000 6001 /** 6002 * Page builder column and image animations. 6003 * 6004 * @since 4.0 6005 * @see waypoints 6006 */ 6007 function colAndImgAnimations() { 6008 6009 var $colAndImgOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '88%'; 6010 var $cascadingOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '70%'; 6011 var $colAndImgRevealOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '70%'; 6012 6013 $($fullscreenSelector + 'img.img-with-animation').each(function () { 6014 6015 var $that = $(this); 6016 6017 var waypoint = new Waypoint({ 6018 element: $that, 6019 handler: function () { 6020 6021 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 6022 waypoint.destroy(); 6023 return; 6024 } 6025 6026 if (!nectarDOMInfo.usingMobileBrowser || $('body[data-responsive="0"]').length > 0) { 6027 6028 var $delay = $that.attr('data-delay'); 6029 6030 // Upgrade proof. 6031 var $elToAnimate = ($that.parents('.hover-wrap').length > 0) ? $that.parents('.hover-wrap') : $that; 6032 6033 if ($that.attr('data-animation') == 'fade-in-from-left' || $that.attr('data-animation') == 'fade-in-from-right') { 6034 $elToAnimate.delay($delay).transition({ 6035 'opacity': 1, 6036 'x': '0px' 6037 }, $animationDuration, $animationEasing); 6038 } else if ($that.attr('data-animation') == 'fade-in-from-bottom') { 6039 $elToAnimate.delay($delay).transition({ 6040 'opacity': 1, 6041 'y': '0px' 6042 }, $animationDuration, $animationEasing); 6043 } else if ($that.attr('data-animation') == 'fade-in') { 6044 $elToAnimate.delay($delay).transition({ 6045 'opacity': 1 6046 }, $animationDuration, $animationEasing); 6047 } else if ($that.attr('data-animation') == 'grow-in') { 6048 setTimeout(function () { 6049 $elToAnimate.transition({ 6050 scale: 1, 6051 'opacity': 1 6052 }, $animationDuration, $animationEasing); 6053 }, $delay); 6054 } else if ($that.attr('data-animation') == 'flip-in') { 6055 setTimeout(function () { 6056 $elToAnimate.transition({ 6057 rotateY: 0, 6058 'opacity': 1 6059 }, $animationDuration, $animationEasing); 6060 }, $delay); 6061 } else if ($that.attr('data-animation') == 'flip-in-vertical') { 6062 setTimeout(function () { 6063 $elToAnimate.transition({ 6064 rotateX: 0, 6065 'opacity': 1 6066 }, $animationDuration, $animationEasing); 6067 }, $delay); 6068 } 6069 6070 6071 $that.addClass('animated-in'); 6072 6073 } 6074 6075 waypoint.destroy(); 6076 6077 }, 6078 offset: $colAndImgOffsetPos 6079 }); 6080 6081 6082 6083 }); 6084 6085 6086 $($fullscreenSelector + '.nectar_cascading_images').each(function () { 6087 6088 var $that = $(this); 6089 var $animationDelay = ($(this).is('[data-animation-timing]')) ? $(this).attr('data-animation-timing') : 175; 6090 $animationDelay = parseInt($animationDelay); 6091 6092 var waypoint = new Waypoint({ 6093 element: $that, 6094 handler: function () { 6095 6096 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 6097 waypoint.destroy(); 6098 return; 6099 } 6100 6101 if (!nectarDOMInfo.usingMobileBrowser || $('body[data-responsive="0"]').length > 0) { 6102 6103 $that.find('.cascading-image').each(function (i) { 6104 6105 var $that2 = $(this); 6106 6107 if ($that2.attr('data-animation') == 'flip-in' || $that2.attr('data-animation') == 'flip-in-vertical') { 6108 setTimeout(function () { 6109 $that2.find('.inner-wrap').css({ 6110 'opacity': 1, 6111 'transform': 'rotate(0deg) translateZ(0px)' 6112 }); 6113 }, i * $animationDelay); 6114 } else if( $that2.attr('data-animation') == 'grow-in-reveal' ) { 6115 setTimeout(function () { 6116 $that2.find('.inner-wrap').css({ 6117 'opacity': 1, 6118 'transform': 'translateX(0px) translateY(0px) scale(1,1) translateZ(0px)' 6119 }); 6120 $that2.find('.inner-wrap img').css({ 6121 'transform': 'translateX(0px) translateY(0px) scale(1,1) translateZ(0px)' 6122 }); 6123 }, i * $animationDelay); 6124 } 6125 else { 6126 setTimeout(function () { 6127 $that2.find('.inner-wrap').css({ 6128 'opacity': 1, 6129 'transform': 'translateX(0px) translateY(0px) scale(1,1) translateZ(0px)' 6130 }); 6131 }, i * $animationDelay); 6132 } 6133 6134 6135 }); 6136 6137 $that.addClass('animated-in'); 6138 6139 } 6140 6141 waypoint.destroy(); 6142 6143 }, 6144 offset: $cascadingOffsetPos 6145 }); 6146 6147 }); 6148 6149 6150 $($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) { 6151 6152 var $that = $(this); 6153 6154 //set perspective for vertical flip 6155 if ($that.is('[data-animation="flip-in-vertical"]') || $that.is('[data-animation="slight-twist"]')) { 6156 $that.parents('.col.span_12').addClass('flip-in-vertical-wrap'); 6157 } 6158 6159 var waypoint = new Waypoint({ 6160 element: $that, 6161 handler: function () { 6162 6163 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 6164 waypoint.destroy(); 6165 return; 6166 } 6167 6168 if (!nectarDOMInfo.usingMobileBrowser || $('body[data-responsive="0"]').length > 0) { 6169 6170 var $delay = $that.attr('data-delay'); 6171 6172 if ($that.attr('data-animation') == 'fade-in-from-left' || $that.attr('data-animation') == 'fade-in-from-right') { 6173 6174 $standAnimatedColTimeout[i] = setTimeout(function () { 6175 $that.transition({ 6176 'opacity': 1, 6177 'x': '0px' 6178 }, $animationDuration, $animationEasing); 6179 }, $delay); 6180 6181 } else if ($that.attr('data-animation') == 'fade-in-from-bottom') { 6182 6183 $standAnimatedColTimeout[i] = setTimeout(function () { 6184 $that.transition({ 6185 'opacity': 1, 6186 'y': '0px' 6187 }, $animationDuration, $animationEasing); 6188 }, $delay); 6189 6190 } else if ($that.attr('data-animation') == 'fade-in') { 6191 6192 $standAnimatedColTimeout[i] = setTimeout(function () { 6193 $that.transition({ 6194 'opacity': 1 6195 }, $animationDuration, $animationEasing); 6196 }, $delay); 6197 6198 } else if ($that.attr('data-animation') == 'grow-in' || $that.attr('data-animation') == 'zoom-out') { 6199 6200 $standAnimatedColTimeout[i] = setTimeout(function () { 6201 $that.transition({ 6202 scale: 1, 6203 'opacity': 1 6204 }, $animationDuration, $animationEasing); 6205 }, $delay); 6206 6207 } else if ($that.attr('data-animation') == 'flip-in') { 6208 6209 $standAnimatedColTimeout[i] = setTimeout(function () { 6210 $that.transition({ 6211 rotateY: 0, 6212 'opacity': 1 6213 }, $animationDuration, $animationEasing); 6214 }, $delay); 6215 6216 } else if ($that.attr('data-animation') == 'flip-in-vertical') { 6217 6218 $standAnimatedColTimeout[i] = setTimeout(function () { 6219 $that.transition({ 6220 rotateX: 0,
6221 y: 0, 6222 'opacity': 1 6223 }, $animationDuration, $animationEasing); 6224 }, $delay); 6225 6226 } else if ($that.attr('data-animation') == 'slight-twist') { 6227 6228 $standAnimatedColTimeout[i] = setTimeout(function () { 6229 anime({ 6230 targets: $that[0], 6231 rotateY: [20, 0], 6232 rotateZ: [-4, 0], 6233 opacity: 1, 6234 easing: $animationEasing, 6235 duration: $animationDuration 6236 }); 6237 }, $delay); 6238 6239 } 6240 6241 //boxed column hover fix 6242 if ($that.hasClass('boxed')) { 6243 $that.addClass('no-pointer-events'); 6244 setTimeout(function () { 6245 $that.removeClass('no-pointer-events'); 6246 }, parseInt($animationDuration) + parseInt($delay) + 30); 6247 } 6248 6249 $that.addClass('animated-in'); 6250 6251 } 6252 6253 waypoint.destroy(); 6254 }, 6255 offset: $colAndImgOffsetPos 6256 }); 6257 6258 }); 6259 6260 6261 $($fullscreenSelector + '.wpb_column.has-animation[data-animation*="reveal"]').each(function () { 6262 6263 var $that = $(this), 6264 waypoint = new Waypoint({ 6265 element: $that, 6266 handler: function () { 6267 6268 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 6269 waypoint.destroy(); 6270 return; 6271 } 6272 6273 var $delay = $that.attr('data-delay'); 6274 6275 if (!nectarDOMInfo.usingMobileBrowser || $('body[data-responsive="0"]').length > 0) { 6276 6277 var $columnInnerSelector = ( $that.find('> .vc_column-inner').length > 0 ) ? true : false; 6278 6279 if ($that.attr('data-animation') == 'reveal-from-bottom' || $that.attr('data-animation') == 'reveal-from-top') { 6280 6281 setTimeout(function () { 6282 6283 if ($that.hasClass('animated-in')) { 6284 6285 if( $columnInnerSelector == true ) { 6286 6287 // Modern. 6288 $that.find('> .vc_column-inner').transition({ 6289 'y': 0 6290 }, $animationDuration, $animationEasing ); 6291 6292 } else { 6293 6294 // Legacy. 6295 $that.find('.column-inner-wrap, .column-inner').transition({ 6296 'y': 0 6297 }, $animationDuration, $animationEasing, function () { 6298 $that.find('.column-inner-wrap, .column-inner').addClass('no-transform'); 6299 }); 6300 } 6301 6302 } 6303 6304 }, $delay); 6305 6306 } else if ($that.attr('data-animation') == 'reveal-from-right' || $that.attr('data-animation') == 'reveal-from-left') { 6307 setTimeout(function () { 6308 if ($that.hasClass('animated-in')) { 6309 6310 if( $columnInnerSelector == true ) { 6311 6312 // Modern. 6313 $that.find('> .vc_column-inner').transition({ 6314 'x': 0 6315 }, $animationDuration, $animationEasing); 6316 6317 6318 } else { 6319 // Legacy. 6320 $that.find('.column-inner-wrap, .column-inner').transition({ 6321 'x': 0 6322 }, $animationDuration, $animationEasing, function () { 6323 $that.find('.column-inner-wrap, .column-inner').addClass('no-transform'); 6324 }); 6325 6326 } 6327 6328 6329 } 6330 }, $delay); 6331 } 6332 6333 $that.addClass('animated-in'); 6334 6335 } 6336 6337 waypoint.destroy(); 6338 }, 6339 offset: $colAndImgRevealOffsetPos 6340 }); 6341 6342 }); 6343 6344 } 6345 6346 6347 6348 /** 6349 * Cascading images element sizing 6350 * 6351 * @since 6.0 6352 */ 6353 function cascadingImageBGSizing() { 6354 6355 $('.nectar_cascading_images').each(function () { 6356 6357 //handle max width for cascading images in equal height columns 6358 if ($(this).parents('.vc_row-o-equal-height').length > 0 && $(this).parents('.wpb_column').length > 0) { 6359 $(this).css('max-width', $(this).parents('.wpb_column').width()); 6360 } 6361 6362 //set size for layers with no images 6363 $(this).find('.bg-color').each(function () { 6364 6365 var $bgColorHeight = 0; 6366 var $bgColorWidth = 0; 6367 6368 if ($(this).parent().find('.img-wrap').length == 0) { 6369 6370 var $firstSibling = $(this).parents('.cascading-image').siblings('.cascading-image[data-has-img="true"]').first(); 6371 6372 $firstSibling.css({ 6373 'position': 'relative', 6374 'visiblity': 'hidden' 6375 }); 6376 6377 $bgColorHeight = $firstSibling.find('.img-wrap').height(); 6378 $bgColorWidth = $firstSibling.find('.img-wrap').width(); 6379 6380 if ($firstSibling.index() == 0) { 6381 $firstSibling.css({ 6382 'visiblity': 'visible' 6383 }); 6384 } else { 6385 $firstSibling.css({ 6386 'position': 'absolute', 6387 'visiblity': 'visible' 6388 }); 6389 } 6390 } else { 6391 $bgColorHeight = $(this).parent().find('.img-wrap').height(); 6392 $bgColorWidth = $(this).parent().find('.img-wrap').width(); 6393 } 6394 6395 $(this).css({ 6396 'height': $bgColorHeight, 6397 'width': $bgColorWidth 6398 }); 6399 }); 6400 }); 6401 6402 } 6403 6404 6405 6406 6407 /** 6408 * Cascading images element initialization. 6409 * 6410 * @since 10.5 6411 */ 6412 function cascadingImageInit() { 6413 6414 if ($('.nectar_cascading_images').length > 0) { 6415 6416 var cascadingParallax = []; 6417 6418 $('.nectar_cascading_images').each(function(i){ 6419 6420 imagesLoaded($(this), function (instance) { 6421 6422 // Create sizes.
6423 cascadingImageBGSizing(); 6424 6425 // Parallax scrolling. 6426 if( $(instance.elements[0]).is('[data-parallax="yes"]') && !nectarDOMInfo.usingMobileBrowser && $('#nectar_fullscreen_rows').length == 0 ) { 6427 cascadingParallax[i] = new CascadingParallax($(instance.elements[0]), $(instance.elements[0]).attr('data-parallax-intensity')); 6428 } 6429 6430 }); 6431 6432 }); 6433 6434 // BG Sizing Resize. 6435 $window.on('resize', cascadingImageBGSizing); 6436 6437 } 6438 6439 } 6440 6441 6442 6443 6444 function CascadingParallax(el, intensity) { 6445 6446 this.$element = el; 6447 this.inView = false; 6448 this.topLevel = false; 6449 this.lastY = 0; 6450 6451 switch(intensity) { 6452 case 'subtle': 6453 this.intensity = 0.09; 6454 break; 6455 case 'medium': 6456 this.intensity = 0.15; 6457 break; 6458 case 'high': 6459 this.intensity = 0.25; 6460 break; 6461 } 6462 this.calculatePos(); 6463 this.trackView(); 6464 this.animate(); 6465 6466 $window.on('resize', this.calculatePos.bind(this)); 6467 } 6468 6469 CascadingParallax.prototype.calculatePos = function() { 6470 this.offsetTop = this.$element.offset().top; 6471 this.height = this.$element.outerHeight(); 6472 this.vertCenter = nectarDOMInfo.winH/2 - this.height/2; 6473 }; 6474 6475 CascadingParallax.prototype.trackView = function() { 6476 6477 var that = this; 6478 6479 if( this.$element.parents('.top-level').length > 0 ) { 6480 this.topLevel = true; 6481 } 6482 6483 if( 'IntersectionObserver' in window ) { 6484 6485 var options = { 6486 rootMargin: '250px', 6487 } 6488 var observer = new IntersectionObserver(function(entries) { 6489 6490 entries.forEach(function(entry){ 6491 var isIntersecting = entry.isIntersecting; 6492 6493 if (isIntersecting) { 6494 that.inView = true; 6495 } else { 6496 that.inView = false; 6497 } 6498 }); 6499 6500 }, options); 6501 6502 observer.observe(this.$element[0]); 6503 6504 } 6505 6506 }; 6507 6508 CascadingParallax.prototype.animate = function() { 6509 6510 if( this.inView ) { 6511 6512 var that = this; 6513 6514 this.lastY = linearInterpolate(this.lastY, nectarDOMInfo.scrollTop, 0.19); 6515 6516 this.$element.find('.bg-layer').each(function(i) { 6517 6518 var $scale = $(this).attr('data-scale'); 6519 6520 if( that.topLevel === true && nectarDOMInfo.winW > 1000) { 6521 $(this).css('transform','translateY(' + -(that.lastY * that.intensity * i) + 'px) translateZ(0) scale(' + $scale + ')'); 6522 } else { 6523 $(this).css('transform','translateY(' + -((that.lastY - that.offsetTop + that.vertCenter ) * that.intensity * i ) + 'px) translateZ(0) scale(' + $scale + ')'); 6524 } 6525 6526 }); 6527 } 6528 6529 window.requestAnimationFrame(this.animate.bind(this)); 6530 }; 6531 6532 6533 6534 6535 /** 6536 * Split line heading element initialization. 6537 * 6538 * @since 10.5 6539 * @see waypoints 6540 */ 6541 function splitLineHeadings() { 6542 6543 // Create waypoint. 6544 var $splitLineOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : 'bottom-in-view'; 6545 $($fullscreenSelector + '.nectar-split-heading').each(function () { 6546 6547 var $that = $(this); 6548 var $delay = ( $that.is('[data-animation-delay]') ) ? parseInt($that.attr('data-animation-delay')) : 0; 6549 6550 var waypoint = new Waypoint({ 6551 element: $that, 6552 handler: function () { 6553 6554 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 6555 waypoint.destroy(); 6556 return; 6557 } 6558 6559 if (!nectarDOMInfo.usingMobileBrowser || $('body[data-responsive="0"]').length > 0) { 6560 6561 var $animationDurationCap; 6562 6563 setTimeout(function() { 6564 6565 if( $that.is('[data-animation-type="line-reveal-by-space"]') ) { 6566 6567 $animationDurationCap = (parseInt($animationDuration) < 900) ? $animationDuration : '900'; 6568 $that.find('> * > span').each(function (i) { 6569 6570 $(this).find('> .inner').transition({ 6571 'y': '0px' 6572 }, $animationDuration, $animationEasing); 6573 6574 }); 6575 6576 } else if( $that.is('[data-animation-type="letter-fade-reveal"]') ) { 6577 6578 $animationDurationCap = (parseInt($animationDuration) < 1000) ? $animationDuration : '1000'; 6579 $that.find('> * > span span').each(function (i) { 6580 6581 $(this).delay(i * 8).transition({ 6582 'y': '0px', 6583 'opacity': '1' 6584 }, $animationDurationCap, $animationEasing); 6585 6586 }); 6587 6588 } else { 6589 $that.find('.heading-line').each(function (i) { 6590 6591 $(this).find('> div').delay(i * 70).transition({ 6592 'y': '0px' 6593 }, $animationDuration, $animationEasing); 6594 6595 }); 6596 } 6597 6598 $that.addClass('animated-in'); 6599 6600 }, $delay); 6601 6602 } 6603 6604 waypoint.destroy(); 6605 }, 6606 offset: $splitLineOffsetPos 6607 }); 6608 6609 }); 6610 } 6611 6612 6613 6614 /** 6615 * Progress bar element initialization. 6616 * 6617 * @since 3.0 6618 * @see waypoints 6619 */ 6620 6621 function progressBars() { 6622 6623 var $progressBarsOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : 'bottom-in-view'; 6624 var $progressSelector = ($('#nectar_fullscreen_rows[data-mobile-disable="on"]').length > 0 && nectarDOMInfo.usingMobileBrowser) ? '.nectar-progress-bar' : $fullscreenSelector + '.nectar-progress-bar'; 6625 6626 $($progressSelector).parent().each(function () { 6627 6628 var $that = $(this), 6629 waypoint = new Waypoint({ 6630 element: $that, 6631 handler: function () { 6632 6633 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 6634 waypoint.destroy(); 6635 return; 6636 } 6637 6638 if ($progressBarsOffsetPos == '100%') { 6639 $that.find('.nectar-progress-bar .bar-wrap').css('opacity', '1'); 6640 } 6641 6642 $that.find('.nectar-progress-bar').each(function (i) { 6643 6644 var percent = $(this).find('span').attr('data-width'), 6645 $endNum = parseInt($(this).find('span strong i').text()), 6646 $that = $(this); 6647 6648 $that.find('span').delay(i * 90).transition({ 6649 'width': percent + '%' 6650 }, 1050, 'easeInOutQuint', function () {}); 6651 6652 setTimeout(function () { 6653 6654 var countOptions = {
6655 useEasing: false 6656 }; 6657 var $countEle = $that.find('span strong i')[0]; 6658 var numAnim = new CountUp($countEle, 0, $endNum, 0, 1, countOptions); 6659 numAnim.start(); 6660 6661 $that.find('span strong').transition({ 6662 'opacity': 1 6663 }, 550, 'easeInCirc'); 6664 }, (i * 90)); 6665 6666 ////100% progress bar 6667 if (percent == '100') { 6668 $that.find('span strong').addClass('full'); 6669 } 6670 }); 6671 6672 $that.addClass('completed'); 6673 6674 waypoint.destroy(); 6675 6676 }, 6677 offset: $progressBarsOffsetPos 6678 }); 6679 6680 }); 6681 } 6682 6683 6684 6685 /** 6686 * Page builder column border animations. 6687 * 6688 * @since 8.0 6689 * @see waypoints 6690 */ 6691 function animatedColBorders() { 6692 6693 var $progressBarsOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '75%'; 6694 $($fullscreenSelector + '.wpb_column[data-border-animation="true"]').each(function () { 6695 6696 var $that = $(this), 6697 waypoint = new Waypoint({ 6698 element: $that, 6699 handler: function () { 6700 6701 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 6702 waypoint.destroy(); 6703 return; 6704 } 6705 6706 var $borderDelay = ($that.attr('data-border-animation-delay').length > 0) ? parseInt($that.attr('data-border-animation-delay')) : 0; 6707 setTimeout(function () { 6708 $that.find('.border-wrap').addClass('animation'); 6709 $that.find('.border-wrap').addClass('completed'); 6710 }, $borderDelay); 6711 6712 waypoint.destroy(); 6713 6714 }, 6715 offset: $progressBarsOffsetPos 6716 }); 6717 6718 }); 6719 } 6720 6721 6722 6723 /** 6724 * Food menu item element. 6725 * 6726 * @since 8.0 6727 * @see waypoints 6728 */ 6729 function foodMenuItems() { 6730 6731 var $foodItemOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '80%'; 6732 $($fullscreenSelector + '.nectar_food_menu_item').parent().each(function () { 6733 6734 var $that = $(this), 6735 waypoint = new Waypoint({ 6736 element: $that, 6737 handler: function () { 6738 6739 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 6740 waypoint.destroy(); 6741 return; 6742 } 6743 6744 $that.find('.nectar_food_menu_item').each(function (i) { 6745 6746 var $that = $(this); 6747 6748 setTimeout(function () { 6749 $that.addClass('animated-in'); 6750 }, i * 150); 6751 6752 }); 6753 6754 waypoint.destroy(); 6755 6756 }, 6757 offset: $foodItemOffsetPos 6758 }); 6759 6760 }); 6761 } 6762 6763 6764 6765 /** 6766 * Divider element 6767 * 6768 * @since 3.0 6769 * @see waypoints 6770 */ 6771 function dividers() { 6772 6773 var $dividerOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : 'bottom-in-view'; 6774 6775 $($fullscreenSelector + '.divider-small-border[data-animate="yes"], ' + $fullscreenSelector + '.divider-border[data-animate="yes"]').each(function () { 6776 6777 var $lineDur = ($(this).hasClass('divider-small-border')) ? 1300 : 1500, 6778 $that = $(this), 6779 waypoint = new Waypoint({ 6780 element: $that, 6781 handler: function () { 6782 6783 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 6784 waypoint.destroy(); 6785 return; 6786 } 6787 6788 $that.each(function () { 6789 6790 $(this).css({ 6791 'transform': 'scale(0,1)', 6792 'visibility': 'visible' 6793 }); 6794 var $that = $(this); 6795 6796 $that.delay($that.attr('data-animation-delay')).transition({ 6797 'transform': 'scale(1, 1)' 6798 }, $lineDur, 'cubic-bezier(.18,1,.22,1)'); 6799 6800 }); 6801 6802 $that.addClass('completed'); 6803 6804 waypoint.destroy(); 6805 6806 }, 6807 offset: $dividerOffsetPos 6808 }); 6809 6810 }); 6811 } 6812 6813 6814 6815 /** 6816 * Image with hotspots element hover event 6817 * 6818 * @since 7.0 6819 */ 6820 function hotSpotHoverBind() { 6821 6822 //add pulse animation 6823 $('.nectar_image_with_hotspots[data-hotspot-icon="numerical"]').each(function () { 6824 $(this).find('.nectar_hotspot_wrap').each(function (i) { 6825 var $that = $(this); 6826 setTimeout(function () { 6827 $that.find('.nectar_hotspot').addClass('pulse'); 6828 }, i * 300); 6829 }); 6830 }); 6831 6832 6833 var hotSpotHoverTimeout = []; 6834 6835 $('.nectar_image_with_hotspots:not([data-tooltip-func="click"]) .nectar_hotspot').each(function (i) { 6836 6837 hotSpotHoverTimeout[i] = ''; 6838 6839 $(this).on('mouseover', function () { 6840 clearTimeout(hotSpotHoverTimeout[i]); 6841 $(this).parent().css({ 6842 'z-index': '400', 6843 'height': 'auto', 6844 'width': 'auto' 6845 }); 6846 }); 6847 6848 $(this).on('mouseleave', function () { 6849 6850 var $that = $(this); 6851 $that.parent().css({ 6852 'z-index': 'auto' 6853 }); 6854 6855 hotSpotHoverTimeout[i] = setTimeout(function () { 6856 $that.parent().css({ 6857 'height': '30px', 6858 'width': '30px' 6859 }); 6860 }, 300); 6861 6862 }); 6863 6864 }); 6865 6866 } 6867 6868 6869 6870 /** 6871 * Image with hotspots element responsive behavior. 6872 * 6873 * @since 7.0 6874 */ 6875 function responsiveTooltips() { 6876 6877 $('.nectar_image_with_hotspots').each(function () { 6878 6879 $(this).find('.nectar_hotspot_wrap').each(function () { 6880 6881 if (nectarDOMInfo.winW > 690) { 6882 6883 // Remove click if applicable 6884 if ($(this).parents('.nectar_image_with_hotspots[data-tooltip-func="hover"]').length > 0) { 6885 $(this).find('.nectar_hotspot').removeClass('click'); 6886 $(this).find('.nttip').removeClass('open'); 6887 } 6888 6889 $(this).find('.nttip .inner a.tipclose').remove(); 6890 $('.nttip').css('height', 'auto'); 6891 6892 // Reset for positioning 6893 $(this).css({ 6894 'width': 'auto', 6895 'height': 'auto' 6896 }); 6897 6898 $(this).find('.nttip') 6899 .removeClass('force-right') 6900 .removeClass('force-left') 6901 .removeClass('force-top') 6902 .css('width', 'auto'); 6903 6904 var $tipOffset = $(this).find('.nttip').offset(); 6905 6906 // Against right side 6907 if ($tipOffset.left > $(this).parents('.nectar_image_with_hotspots').width() - 200) { 6908 $(this).find('.nttip').css('width', '250px'); 6909 } 6910 else { 6911 $(this).find('.nttip').css('width', 'auto'); 6912 } 6913 6914 // Responsive 6915 if ($tipOffset.left < 0) { 6916 $(this).find('.nttip').addClass('force-right'); 6917 } 6918 else if ($tipOffset.left + $(this).find('.nttip').outerWidth(true) > nectarDOMInfo.winW) { 6919 $(this).find('.nttip').addClass('force-left').css('width', '250px'); 6920 } 6921 else if ($tipOffset.top + $(this).find('.nttip').height() + 35 > $window.height() && $('#nectar_fullscreen_rows').length > 0) { 6922 $(this).find('.nttip').addClass('force-top'); 6923 } 6924 6925 if ($(this).find('> .open').length == 0) { 6926 6927 $(this).css({ 6928 'width': '30px', 6929 'height': '30px' 6930 }); 6931 } 6932 6933 } else { 6934 6935 //fixed position 6936 $(this).find('.nttip') 6937 .removeClass('force-left') 6938 .removeClass('force-right') 6939 .removeClass('force-top'); 6940 6941 $(this).find('.nectar_hotspot').addClass('click'); 6942 6943 if ($(this).find('.nttip a.tipclose').length == 0) { 6944 $(this).find('.nttip .inner').append('<a href="#" class="tipclose"><span></span></a>'); 6945 } 6946 6947 // Change height of fixed 6948 $('.nttip').css('height', $window.height()); 6949 } 6950 }); 6951 }); 6952 6953 } 6954 6955 6956 /** 6957 * Image with hotspots events 6958 * 6959 * @since 10.5 6960 */ 6961 function imageWithHotspotEvents() { 6962 6963 if( $('.nectar_image_with_hotspots').length == 0 ) { 6964 return; 6965 } 6966 6967 // Hover 6968 hotSpotHoverBind(); 6969 6970 // Click 6971 $body.on('click', '.nectar_hotspot.click', function () { 6972 $(this).parents('.nectar_image_with_hotspots').find('.nttip').removeClass('open'); 6973 $(this).parent().find('.nttip').addClass('open'); 6974 6975 $(this).parents('.nectar_image_with_hotspots').find('.nectar_hotspot').removeClass('open'); 6976 $(this).parent().find('.nectar_hotspot').addClass('open'); 6977 6978 if (nectarDOMInfo.winW > 690) { 6979 $(this).parent().css({ 6980 'z-index': '120', 6981 'height': 'auto', 6982 'width': 'auto' 6983 }); 6984 6985 var $that = $(this); 6986 6987 setTimeout(function () { 6988 $that.parents('.nectar_image_with_hotspots').find('.nectar_hotspot_wrap').each(function () { 6989 6990 if ($(this).find('> .open').length == 0) { 6991 $(this).css({ 6992 'height': '30px', 6993 'width': '30px', 6994 'z-index': 'auto' 6995 }); 6996 } 6997 }); 6998 }, 300); 6999 } 7000 7001 if (nectarDOMInfo.winW <= 690) { 7002 $(this).parents('.wpb_row, [class*="vc_col-"]').css('z-index', '200'); 7003 } 7004 7005 return false;
7006 }); 7007 7008 $body.on('click', '.nectar_hotspot.open', function () { 7009 $(this).parent().find('.nttip').removeClass('open'); 7010 $(this).parent().find('.nectar_hotspot').removeClass('open'); 7011 7012 $(this).parents('.wpb_row').css('z-index', 'auto'); 7013 7014 return false; 7015 }); 7016 7017 $body.on('click', '.nttip.open', function () { 7018 if (nectarDOMInfo.winW < 690) { 7019 $(this).parents('.nectar_image_with_hotspots').find('.nttip').removeClass('open'); 7020 $(this).parents('.nectar_image_with_hotspots').find('.nectar_hotspot').removeClass('open'); 7021 $(this).parents('.wpb_row').css('z-index', 'auto'); 7022 return false; 7023 } 7024 }); 7025 7026 7027 // Calculate on init. 7028 responsiveTooltips(); 7029 7030 // Resize event. 7031 $window.on('resize',responsiveTooltips); 7032 7033 } 7034 7035 7036 7037 /** 7038 * Image with hotspots initialization. 7039 * 7040 * @since 7.0 7041 * @see waypoints 7042 */ 7043 function imageWithHotspots() { 7044 7045 var $imageWithHotspotsOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '50%'; 7046 7047 $($fullscreenSelector + '.nectar_image_with_hotspots[data-animation="true"]').each(function () { 7048 7049 var $that = $(this); 7050 var waypoint = new Waypoint({ 7051 element: $that, 7052 handler: function () { 7053 7054 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 7055 waypoint.destroy(); 7056 return; 7057 } 7058 7059 $that.addClass('completed'); 7060 $that.find('.nectar_hotspot_wrap').each(function (i) { 7061 var $that2 = $(this); 7062 var $extrai = ($that2.parents('.col.has-animation').length > 0) ? 1 : 0; 7063 setTimeout(function () { 7064 $that2.addClass('animated-in'); 7065 }, 175 * (i + $extrai)); 7066 }); 7067 7068 waypoint.destroy(); 7069 7070 }, 7071 offset: $imageWithHotspotsOffsetPos 7072 }); 7073 7074 }); 7075 7076 7077 } 7078 7079 7080 /** 7081 * Nectar Lazy Loading 7082 * 7083 * @since 11.0 7084 */ 7085 function nectarLazyImageLoading() { 7086 7087 var lazyItems = [].slice.call(document.querySelectorAll('[data-nectar-img-src]')); 7088 7089 if ('IntersectionObserver' in window) { 7090 7091 var options = { 7092 rootMargin: '75px', 7093 } 7094 7095 nectarLazyImageSizing(); 7096 $window.on('resize', nectarLazyImageSizing); 7097 7098 var lazyItemObserver = new IntersectionObserver(function(entries) { 7099 7100 entries.forEach(function(entry) { 7101 if (entry.isIntersecting) { 7102 var lazyItem = entry.target; 7103 7104 var imgSrc = lazyItem.getAttribute('data-nectar-img-src'); 7105 7106 // img tags. 7107 if( lazyItem.classList.contains('nectar-lazy') ) { 7108 lazyItem.addEventListener( 'load', function() { 7109 lazyItem.style.height = ""; 7110 lazyItem.style.width = ""; 7111 lazyItem.classList.add('loaded'); 7112 lazyItem.removeAttribute('data-nectar-img-src'); 7113 lazyItemObserver.unobserve(lazyItem); 7114 }); 7115 lazyItem.src = imgSrc; 7116 var srcset = lazyItem.getAttribute('data-nectar-img-srcset'); 7117 if( srcset ) { 7118 lazyItem.setAttribute( 'srcset', srcset ); 7119 lazyItem.removeAttribute('data-nectar-img-srcset'); 7120 } 7121 } 7122 // BGs. 7123 else { 7124 lazyItem.style.backgroundImage = "url('" + imgSrc + "')"; 7125 lazyItem.classList.add('loaded'); 7126 lazyItem.removeAttribute('data-nectar-img-src'); 7127 lazyItemObserver.unobserve(lazyItem); 7128 } 7129 7130 } 7131 7132 }); 7133 7134 }, options); 7135 7136 lazyItems.forEach(function(lazyItem) { 7137 lazyItemObserver.observe(lazyItem); 7138 }); 7139 7140 } 7141 else { 7142 // load all the images when intersection observer is not supported. 7143 lazyItems.forEach(function(lazyItem) { 7144 7145 // img tags. 7146 if( lazyItem.classList.contains('nectar-lazy') ) { 7147 lazyItem.style.height = ""; 7148 lazyItem.style.width = ""; 7149 lazyItem.src = lazyItem.getAttribute('data-nectar-img-src'); 7150 var srcset = lazyItem.getAttribute('data-nectar-img-srcset'); 7151 if( srcset ) { 7152 lazyItem.setAttribute( 'srcset', srcset ); 7153 lazyItem.removeAttribute('data-nectar-img-srcset'); 7154 } 7155 lazyItem.classList.add('loaded'); 7156 lazyItem.removeAttribute('data-nectar-img-src'); 7157 } 7158 // BGs. 7159 else { 7160 lazyItem.style.backgroundImage = "url('" + lazyItem.getAttribute('data-nectar-img-src') + "')"; 7161 lazyItem.classList.add('loaded'); 7162 lazyItem.removeAttribute('data-nectar-img-src'); 7163 } 7164 7165 }); 7166 } 7167 7168 7169 } 7170 7171 7172 /** 7173 * Nectar lazy img size helper. 7174 * 7175 * @since 11.0 7176 */ 7177
7178 function nectarLazyImageSizing() { 7179 7180 $('img.nectar-lazy:not(.loaded)').each(function() { 7181 7182 $(this).css({ 7183 'height': '', 7184 'width' : '' 7185 }); 7186 7187 var heightAttr = parseInt($(this).attr('height')); 7188 var widthAttr = parseInt($(this).attr('width')); 7189 7190 var width = ($(this).parents('.nectar_cascading_images').length > 0) ? $(this).parents('.bg-layer').width() : $(this).width(); 7191 7192 var dimensions = calculateAspectRatio( widthAttr, heightAttr, width, 2000 ); 7193 7194 $(this).css({ 7195 'height': dimensions.height + 'px', 7196 'width' : dimensions.width + 'px' 7197 }); 7198 7199 }); 7200 7201 } 7202 7203 7204 /** 7205 * Nectar Post Grid Mouse Follow Init 7206 * 7207 * @since 11.0 7208 */ 7209 function nectarPostGridMouse() { 7210 7211 viewIndicatorArr = []; 7212 7213 if( !nectarDOMInfo.usingMobileBrowser ) { 7214 7215 $('.nectar-post-grid[data-indicator="yes"]').each(function(i) { 7216 viewIndicatorArr[i] = new NectarIconMouseFollow($(this),'view-indicator'); 7217 }); 7218 7219 } 7220 7221 } 7222 7223 7224 7225 7226 7227 /** 7228 * Nectar Post Grid 7229 * 7230 * @since 11.0 7231 */ 7232 function nectarPostGridInit() { 7233 7234 $nectarPostGridArr = []; 7235 7236 // Mouse follow. 7237 nectarPostGridMouse(); 7238 7239 // Create grid instances. 7240 $('.nectar-post-grid-wrap').each(function(i) { 7241 $nectarPostGridArr[i] = new NectarPostGrid($(this)); 7242 }); 7243 7244 7245 } 7246 7247 7248 7249 function NectarPostGrid(el) { 7250 7251 this.el = el; 7252 this.currentPage = 0; 7253 this.activeFilter = 1; 7254 this.activeCatTotal = 0; 7255 this.settingsData = JSON.parse(this.el.attr('data-el-settings')); 7256 this.queryData = JSON.parse(this.el.attr('data-query')); 7257 this.sortable = this.el.find('.nectar-post-grid-filters').attr('data-sortable'); 7258 7259 this.initialMarkup(); 7260 this.clickEvents(); 7261 } 7262 7263 NectarPostGrid.prototype.initialMarkup = function() { 7264 7265 // Start Filter Active. 7266 if( this.el.find('.nectar-post-grid-filters a.active').length == 0 ) { 7267 this.el.find('.nectar-post-grid-filters a:first-child').addClass('active'); 7268 } 7269 7270 // Load More Markup. 7271 if( this.settingsData.pagination === 'load-more' && this.el.find('.load-more-wrap').length == 0 ) { 7272 7273 this.activeCatTotal = parseInt(this.el.find('.nectar-post-grid-filters a:nth-child(' + this.activeFilter + ')').attr('data-total-count')); 7274 7275 // Start hidden? 7276 if( this.el.find('.nectar-post-grid-item').length >= this.activeCatTotal ) { 7277 this.el.append('<div class="load-more-wrap inactive"><a href="#" class="load-more">'+ this.el.attr('data-load-more-text') + '</a></div>'); 7278 } else { 7279 this.el.append('<div class="load-more-wrap"><a href="#" class="load-more">'+ this.el.attr('data-load-more-text') + '</a></div>'); 7280 } 7281 7282 } 7283 7284 }; 7285 7286 7287 7288 NectarPostGrid.prototype.clickEvents = function() { 7289 7290 // Sortable Mobile Toggle. 7291 this.el.find('.nectar-post-grid-filters h4').on('click', function(){ 7292 $(this).parent().find('div').toggleClass('visible'); 7293 $(this).toggleClass('visible'); 7294 }); 7295 7296 // Sortable/Pagination. 7297 var settingsData = this.settingsData; 7298 var queryData = this.queryData; 7299 var instance = this; 7300 7301 this.el.find('.nectar-post-grid-filters a, .load-more-wrap:not(.inactive) .load-more').on('click', function(){ 7302 7303 var $that = $(this); 7304 7305 // Filter active. 7306 if($that.parents('.nectar-post-grid-wrap.loading').length > 0 || $(this).hasClass('active')) { 7307 return false; 7308 } 7309 7310 7311 if( $(this).parents('.nectar-post-grid-filters').length > 0 ) { 7312 // Filter specific. 7313 $that.parent().find('a').removeClass('active'); 7314 $that.addClass('active'); 7315 instance.currentPage = 0; 7316 instance.activeFilter = $that.index() + 1; 7317 } else { 7318 // Load More specific. 7319 instance.currentPage++; 7320 } 7321 7322 var $gridEl = $that.parents('.nectar-post-grid-wrap').find('.nectar-post-grid') 7323 var $pagination = settingsData.pagination; 7324 var $action = ($that.hasClass('load-more') && $pagination === 'load-more') ? 'load-more' : 'filter'; 7325 var $category = ''; 7326 7327 // Determine what category to load from. 7328 if( instance.sortable === 'yes' ) { 7329 $category = $that.parents('.nectar-post-grid-wrap').find('.nectar-post-grid-filters a.active').attr('data-filter'); 7330 } else { 7331 7332 var skipAll = ( $that.parents('.nectar-post-grid-wrap').find('.nectar-post-grid-filters a').length > 1 ) ? ':not(.all-filter)' : ''; 7333 7334 $that.parents('.nectar-post-grid-wrap').find('.nectar-post-grid-filters a' + skipAll).each(function(){ 7335 $category += $(this).attr('data-filter') + ', '; 7336 }); 7337 7338 $category = $category.substring(0, $category.length - 2); 7339 7340 } 7341 7342 7343 var $dataToPass = { 7344 action: 'nectar_get_post_grid_segment', 7345 post_type: queryData.post_type, 7346 category: $category, 7347 posts_per_page: queryData.posts_per_page, 7348 current_page: instance.currentPage, 7349 offset: queryData.offset, 7350 order: queryData.order, 7351 orderby: queryData.orderby, 7352 load_action: $action, 7353 settings: { 7354 pagination: $pagination, 7355 post_type: settingsData.post_type, 7356 image_size: settingsData.image_size, 7357 display_categories: settingsData.display_categories, 7358 display_excerpt: settingsData.display_excerpt, 7359 display_date: settingsData.display_date, 7360 color_overlay: settingsData.color_overlay, 7361 color_overlay_opacity: settingsData.color_overlay_opacity, 7362 color_overlay_hover_opacity: settingsData.color_overlay_hover_opacity 7363 } 7364 }; 7365 7366 $that.parents('.nectar-post-grid-wrap').addClass('loading'); 7367 7368 $.post(window.nectarLove.ajaxurl, $dataToPass, function (data) { 7369 7370 $that.parents('.nectar-post-grid-wrap').removeClass('loading'); 7371 7372 // Update markup. 7373 if( $action === 'load-more' ) { 7374 $gridEl.append(data); 7375 } else { 7376 $gridEl.html(data); 7377 } 7378 7379 if( $pagination === 'load-more' ) { 7380 7381 instance.activeCatTotal = parseInt(instance.el.find('.nectar-post-grid-filters a:nth-child(' + instance.activeFilter + ')').attr('data-total-count')); 7382 7383 if( $gridEl.find('.nectar-post-grid-item').length >= instance.activeCatTotal ) { 7384 instance.el.find('.load-more-wrap').addClass('inactive'); 7385 } else { 7386 instance.el.find('.load-more-wrap').removeClass('inactive'); 7387 } 7388 7389 } 7390 7391 // Resize. 7392 $window.trigger('resize'); 7393 7394 // Mouse follow. 7395 nectarPostGridMouse(); 7396 7397 }); 7398 7399 return false;
7400 7401 }); 7402 7403 }; 7404 7405 7406 7407 /** 7408 * Animated title element initialization. 7409 * 7410 * @since 7.0 7411 * @see waypoints 7412 */ 7413 function animatedTitles() { 7414 7415 var $animatedTitlesOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : 'bottom-in-view'; 7416 7417 $($fullscreenSelector + '.nectar-animated-title').each(function () { 7418 7419 var $that = $(this), 7420 waypoint = new Waypoint({ 7421 element: $that, 7422 handler: function () { 7423 7424 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 7425 waypoint.destroy(); 7426 return; 7427 } 7428 7429 $that.addClass('completed'); 7430 7431 waypoint.destroy(); 7432 7433 }, 7434 offset: $animatedTitlesOffsetPos 7435 }); 7436 7437 }); 7438 } 7439 7440 7441 7442 7443 /** 7444 * Highlighted Text element initialization. 7445 * 7446 * @since 9.0 7447 * @see waypoints 7448 */ 7449 function highlightedText() { 7450 7451 var $highlightedTextOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : 'bottom-in-view'; 7452 var highlightedColorCss = ''; 7453 7454 $($fullscreenSelector + '.nectar-highlighted-text').each(function (i) { 7455 7456 var $animationDelay = 0; 7457 7458 if($(this).is('[data-animation-delay]') && 7459 $(this).attr('data-animation-delay').length > 0 && 7460 $(this).attr('data-animation') != 'false') { 7461 $animationDelay = $(this).attr('data-animation-delay'); 7462 } 7463 7464 // Custom color 7465 if ($(this).is('[data-using-custom-color="true"]')) { 7466 7467 var $custom_highlight_color = $(this).attr('data-color'); 7468 var $custom_highlight_color_2 = ( $(this).is('[data-color-gradient]') && $(this).attr('data-color-gradient').length > 0 ) ? $(this).attr('data-color-gradient') : false; 7469 7470 $(this).addClass('instance-' + i); 7471 7472 if( $custom_highlight_color_2 !== false && $custom_highlight_color_2.length > 0 ) { 7473 highlightedColorCss += '.nectar-highlighted-text.instance-' + i + ' em:before { background: linear-gradient(90deg, '+ $custom_highlight_color +', '+ $custom_highlight_color_2 +'); }'; 7474 } else { 7475 highlightedColorCss += '.nectar-highlighted-text.instance-' + i + ' em:before { background-color: ' + $custom_highlight_color + '; }'; 7476 } 7477 7478 7479 } 7480 7481 if (nectarDOMInfo.usingMobileBrowser) { 7482 $(this).find('em').addClass('animated'); 7483 } 7484 7485 // Waypoint 7486 var $that = $(this); 7487 var waypoint = new Waypoint({ 7488 element: $that, 7489 handler: function () { 7490 7491 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated')) { 7492 waypoint.destroy(); 7493 return; 7494 } 7495 7496 setTimeout(function() { 7497 7498 $that.find('em').each(function (i) { 7499 var $highlighted_em = $(this); 7500 setTimeout(function () { 7501 $highlighted_em.addClass('animated'); 7502 }, i * 300); 7503 7504 }); 7505 7506 }, $animationDelay); 7507 7508 waypoint.destroy(); 7509 7510 }, 7511 offset: $highlightedTextOffsetPos 7512 }); 7513 7514 }); 7515 7516 // Style 7517 nectarCreateStyle(highlightedColorCss, 'highlighted-text'); 7518 7519 } 7520 7521 7522 7523 7524 /** 7525 * Pricing table element height calculations. 7526 * 7527 * @since 2.0 7528 */ 7529 function pricingTableHeight() { 7530 7531 var $tallestCol; 7532 7533 $('.pricing-table[data-style="default"]').each(function () { 7534 $tallestCol = 0; 7535 7536 $(this).find('> div ul').each(function () { 7537 7538 if( $(this).height() > $tallestCol ) { 7539 $tallestCol = $(this).height(); 7540 } 7541 7542 }); 7543 7544 //safety net incase pricing tables height couldn't be determined 7545 if ($tallestCol == 0) { 7546 $tallestCol = 'auto'; 7547 } 7548 7549 //set even height 7550 $(this).find('> div ul').css('height', $tallestCol); 7551 7552 }); 7553 } 7554 7555 7556 7557 7558 /** 7559 * Testimonial slider element initialization. 7560 * 7561 * @since 10.5 7562 */ 7563 function nectarTestimonialSliders() { 7564 7565 $testimonialSliders = []; 7566 7567 if (typeof NectarTestimonialSlider == 'undefined') { 7568 return; 7569 } 7570 7571 $('.testimonial_slider').each(function (i) { 7572 7573 var $that_el = $(this), 7574 $type = ($(this).is('[data-style]')) ? $(this).attr('data-style') : 'none'; 7575 7576 $testimonialSliders[i] = new NectarTestimonialSlider($that_el, $type, resizeVideoToCover, fullWidthContentColumns); 7577 7578 7579 if ($(this).is('.disable-height-animation:not([data-style*="multiple_visible"])')) { 7580 $testimonialSliders[i].testimonialSliderHeight(); 7581 setTimeout($testimonialSliders[i].testimonialSliderHeight.bind($testimonialSliders[i]), 500); 7582 } 7583 7584 if ($(this).is('.testimonial_slider[data-style="multiple_visible_minimal"]')) { 7585 $testimonialSliders[i].testimonialSliderHeightMinimalMult(); 7586 setTimeout($testimonialSliders[i].testimonialSliderHeightMinimalMult.bind($testimonialSliders[i]), 500); 7587 } 7588 7589 }); 7590 7591 7592 } 7593 7594 7595 /** 7596 * Testimonial slider element resize binding. 7597 * 7598 * @since 10.5 7599 */ 7600 function nectarTestimonialSlidersEvents() { 7601 7602 $window.off('smartresize.nectarTestimonials'); 7603 $window.off('resize.nectarTestimonialsMin'); 7604 7605 if($testimonialSliders.length > 0) { 7606 $window.on('smartresize.nectarTestimonials',nectarTestimonialMainResize); 7607 } 7608 7609 if( $('.testimonial_slider[data-style="multiple_visible_minimal"]').length > 0 ) { 7610 $window.on('resize.nectarTestimonialsMin',nectarTestimonialMiniamlResize); 7611 } 7612 7613 } 7614 7615 function nectarTestimonialMainResize() { 7616 for (var i = 0; i < $testimonialSliders.length; i++) { 7617 $testimonialSliders[i].testimonialSliderHeight(); 7618 $testimonialSliders[i].testimonialHeightResize(); 7619 } 7620 } 7621 function nectarTestimonialMiniamlResize() { 7622 for (var i = 0; i < $testimonialSliders.length; i++) { 7623 $testimonialSliders[i].testimonialSliderHeightMinimalMult(); 7624 } 7625 } 7626 7627 7628 7629 /** 7630 * Icon list element initialization. 7631 * 7632 * @since 6.0 7633 * @see waypoints 7634 */ 7635 function iconList() { 7636 7637 var $iconListOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '250%' : '75%'; 7638 7639 $($fullscreenSelector + '.nectar-icon-list[data-animate="true"]').each(function () { 7640 7641 var $that = $(this), 7642 waypoint = new Waypoint({ 7643 element: $that, 7644 handler: function () { 7645 7646 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 7647 waypoint.destroy(); 7648 return; 7649 } 7650 7651 $that.each(function () { 7652 7653 var $listItemAnimationDelay = ($that.is('[data-direction="horizontal"]')) ? 100 : 300; 7654 7655 $(this).find('.nectar-icon-list-item').each(function (i) { 7656 var $thatt = $(this); 7657 setTimeout(function () { 7658 $thatt.addClass('animated'); 7659 }, i * $listItemAnimationDelay); 7660 }); 7661 7662 }); 7663 7664 $that.addClass('completed'); 7665 7666 waypoint.destroy(); 7667 7668 }, 7669 offset: $iconListOffsetPos 7670 }); 7671 7672 }); 7673 } 7674 7675 7676 7677 /** 7678 * Get the BG color of parent column/row. 7679 * 7680 * @since 6.0 7681 */ 7682 function narrowParentBGC(element) { 7683 7684 var narrowedBGC; 7685 7686 if (element.parents('.wpb_column[data-bg-color*="#"]').length > 0 && element.parents('.wpb_column[data-bg-opacity="1"]').length > 0) { 7687 narrowedBGC = element.parents('.wpb_column').attr('data-bg-color'); 7688 } 7689 else if (element.parents('.wpb_row').length > 0 && element.parents('.wpb_row').find('.row-bg.using-bg-color').length > 0 || 7690 element.parents('.wpb_row').length > 0 && element.parents('.wpb_row').find('.row-bg.using-bg-color-excluded').length > 0) { 7691 narrowedBGC = element.parents('.wpb_row').find('.row-bg').css('background-color'); 7692 } 7693 else { 7694 if ($('#nectar_fullscreen_rows').length > 0) { 7695 narrowedBGC = $('#nectar_fullscreen_rows > .wpb_row .full-page-inner-wrap').css('background-color'); 7696 } 7697 else { 7698 narrowedBGC = $('.container-wrap').css('background-color'); 7699 } 7700 } 7701 7702 return narrowedBGC; 7703 7704 } 7705 7706 7707 /** 7708 * Icon BG matching row BG 7709 * 7710 * @since 6.0 7711 */ 7712 function nectarIconMatchColoring() { 7713 7714 var nectarMatchingBGCss = ''; 7715 7716 // Icon list 7717 $('.nectar-icon-list[data-icon-style="border"], .nectar_icon_wrap[data-style="border-animation"][data-color*="extra-color-gradient-"]').each(function (i) { 7718 7719 var $bgColorToSet = narrowParentBGC($(this)); 7720 7721 if( $(this).hasClass('nectar-icon-list') ) { 7722 $(this).find('.list-icon-holder').css('background-color', $bgColorToSet); 7723 } 7724 else { 7725 7726 $(this).removeClass(function (index, className) { 7727 return (className.match(/(^|\s)instance-\S+/g) || []).join(' '); 7728 }); 7729 7730 $(this).addClass('instance-' + i); 7731 nectarMatchingBGCss += '.nectar_icon_wrap.instance-' + i + ' .nectar_icon:before { background-color: ' + $bgColorToSet + '!important; }'; 7732 } 7733 7734 }); 7735 7736 // Material gradient btns 7737 $('body.material .nectar-button.see-through[class*="m-extra-color-gradient"]').each(function (i) { 7738 7739 var $bgColorToSet = narrowParentBGC($(this)); 7740 7741 $(this).removeClass(function (index, className) { 7742 return (className.match(/(^|\s)instance-\S+/g) || []).join(' '); 7743 }); 7744 7745 $(this).addClass('instance-' + i); 7746 nectarMatchingBGCss += '.nectar-button.see-through.instance-' + i + ':after { background-color: ' + $bgColorToSet + '!important; }'; 7747 7748 }); 7749 7750 // Style 7751 nectarCreateStyle(nectarMatchingBGCss, 'nectaricon-color-match'); 7752 7753 } 7754 7755 7756 7757 7758 7759 /** 7760 * One fourth column classes. 7761 * 7762 * @since 2.0 7763 */ 7764 function oneFourthClasses() { 7765 7766 $('.col.span_3, .vc_span3, .vc_col-sm-3').each(function () { 7767 if (!$(this).is('[data-t-w-inherits="small_desktop"]')) { 7768 7769 var $currentDiv = $(this); 7770 var $nextDiv = $(this).next('div'); 7771 7772 if ($nextDiv.hasClass('span_3') && !$currentDiv.hasClass('one-fourths') || 7773 $nextDiv.hasClass('vc_span3') && !$currentDiv.hasClass('one-fourths') || 7774 $nextDiv.hasClass('vc_col-sm-3') && !$currentDiv.hasClass('one-fourths')) { 7775 $currentDiv.addClass('one-fourths clear-both'); 7776 $nextDiv.addClass('one-fourths right-edge'); 7777 } 7778 } 7779 }); 7780 7781 // Make empty second 1/2 half columns display right on iPad 7782 $('.span_12 .col.span_6').each(function () { 7783 if ($(this).next('div').hasClass('span_6') && $.trim($(this).next('div').html()).length == 0) { 7784 $(this).addClass('empty-second'); 7785 } 7786 }); 7787 7788 } 7789 7790 7791 7792 7793 /** 7794 * Responsive video iframes initialization. 7795 * 7796 * @since 3.0 7797 */ 7798 function responsiveVideoIframesInit() { 7799 7800 $('iframe').each(function () { 7801 7802 // Make sure the iframe has a src 7803 if (typeof $(this).attr('src') != 'undefined' && 7804 !$(this).hasClass('skip-nectar-video-size') && 7805 !$(this).hasClass('iframe-embed') && 7806 $(this).parents('.ult_modal').length == 0 && 7807 $(this).parents('.ls-slide').length == 0 && 7808 $(this).parents('.esg-entry-media').length == 0 && 7809 $(this).parents('.wpb_video_widget.wpb_content_element').length == 0) { 7810 7811 var embedSrcLower = $(this).attr('src').toLowerCase(); 7812 7813 if (embedSrcLower.indexOf("youtube") >= 0 || 7814 embedSrcLower.indexOf("vimeo") >= 0 || 7815 embedSrcLower.indexOf("twitch.tv") >= 0 || 7816 embedSrcLower.indexOf("kickstarter") >= 0 || 7817 embedSrcLower.indexOf("embed-ssl.ted") >= 0 || 7818 embedSrcLower.indexOf("dailymotion") >= 0) { 7819 7820 $(this).addClass('iframe-embed'); 7821 7822 if ($(this).width() < $(this).parent().width()) { 7823 $(this) 7824 .attr('data-aspectRatio', $(this).height() / $(this).width()) 7825 .removeAttr('height') 7826 .removeAttr('width'); 7827 } else { 7828 $(this) 7829 .attr('data-aspectRatio', '0.56') 7830 .removeAttr('height') 7831 .removeAttr('width'); 7832 } 7833 7834 if ($(this).parents('.post-area.masonry.classic').length > 0) { 7835 $(this) 7836 .attr('data-aspectRatio', '0.56') 7837 .removeAttr('height') 7838 .removeAttr('width'); 7839 } 7840 7841 } 7842 7843 } 7844 7845 }); 7846 7847 } 7848 7849 7850 /** 7851 * Responsive video iframes. 7852 * 7853 * @since 3.0 7854 */ 7855 function responsiveVideoIframes() { 7856 7857 $('iframe[data-aspectRatio]').each(function () { 7858 7859 var $el = $(this), 7860 newWidth = $el.parent().width(); 7861 7862 // In nectar slider 7863 if ($(this).parents('.swiper-slide').length > 0) { 7864 if ($(this).is(':visible')) { 7865 $el 7866 .width(newWidth) 7867 .height(newWidth * $el.attr('data-aspectRatio')); 7868 } 7869 } 7870 // All others 7871 else { 7872 $el 7873 .width(newWidth) 7874 .height(newWidth * $el.attr('data-aspectRatio')); 7875 } 7876 7877 }); 7878 7879 } 7880 7881 7882 /** 7883 * Reveal the audio/video elements after the size has been calculated. 7884 * 7885 * @since 10.5 7886 */ 7887 function audioVideoVis() { 7888 7889 //unwrap post and protfolio videos 7890 $('.video-wrap iframe').unwrap(); 7891 $('#sidebar iframe[src]').unwrap(); 7892 7893 $('audio') 7894 .attr('width', '100%') 7895 .attr('height', '100%') 7896 .css('visibility', 'visible'); 7897 7898 if ($body.hasClass('mobile')) { 7899 $('video').css('visibility', 'hidden'); 7900 } else { 7901 $('video').css('visibility', 'visible'); 7902 } 7903 7904 7905 $('.wp-video').each(function () { 7906 var video = $(this).find('video').get(0); 7907 video.addEventListener('loadeddata', function () { 7908 $window.trigger('resize'); 7909 }, false); 7910 }); 7911 7912 //webkit video back button fix 7913 $('.main-content iframe[src]').each(function () { 7914 $(this).css({ 7915 'opacity': '1', 7916 'visibility': 'visible' 7917 }); 7918 }); 7919 7920 } 7921 7922 7923 7924 7925 7926 /** 7927 * Nectar video background size calculations 7928 * 7929 * @since 5.0 7930 */ 7931 function resizeVideoToCover() { 7932 7933 var vid_w_orig = 1280, 7934 vid_h_orig = 720, 7935 min_w = 1200; 7936 7937 $('.nectar-video-wrap').each(function () { 7938 7939 var $containerHeight, $containerWidth; 7940 7941 if ($(this).find('video').length == 0) { 7942 return; 7943 } 7944 7945 if ($(this).parents('#page-header-bg').length > 0) { 7946 7947 if ($('.container-wrap.auto-height').length > 0) { 7948 return false;
7949 } 7950 7951 $containerHeight = $(this).parents('#page-header-bg').outerHeight(); 7952 $containerWidth = $(this).parents('#page-header-bg').outerWidth(); 7953 } else { 7954 7955 if ($(this).hasClass('column-video')) { 7956 if( $body.is('[data-flex-cols="true"]') ) { 7957 $containerHeight = $(this).parents('.vc_column-inner').outerHeight(); 7958 $containerWidth = $(this).parents('.vc_column-inner').outerWidth(); 7959 } else { 7960 $containerHeight = $(this).parents('.wpb_column').outerHeight(); 7961 $containerWidth = $(this).parents('.wpb_column').outerWidth(); 7962 } 7963 } else { 7964 $containerHeight = $(this).parents('.wpb_row').outerHeight(); 7965 $containerWidth = ($(this).parents('.full-width-section').length > 0) ? nectarDOMInfo.winW : $(this).parents('.wpb_row').outerWidth(); 7966 } 7967 } 7968 7969 // Set the video viewport to the window size 7970 $(this).width($containerWidth); 7971 if ($(this).parents('#page-header-bg').length > 0) { 7972 $(this).height($containerHeight); 7973 } 7974 7975 // Use largest scale factor of horizontal/vertical 7976 var scale_h = $containerWidth / vid_w_orig, 7977 scale_v = ($containerHeight - $containerHeight) / vid_h_orig, 7978 scale = scale_h > scale_v ? scale_h : scale_v; 7979 7980 // Update minium width to never allow excess space 7981 min_w = 1280 / 720 * ($containerHeight + 40); 7982 7983 // Don't allow scaled width < minimum video width 7984 if (scale * vid_w_orig < min_w) { 7985 scale = min_w / vid_w_orig; 7986 } 7987 7988 // Now scale the video 7989 $(this).find('video, .mejs-overlay, .mejs-poster').width(Math.ceil(scale * vid_w_orig + 0)); 7990 $(this).find('video, .mejs-overlay, .mejs-poster').height(Math.ceil(scale * vid_h_orig + 0)); 7991 7992 // And center it by scrolling the video viewport 7993 $(this).scrollLeft(($(this).find('video').width() - $containerWidth) / 2); 7994 $(this).scrollTop(($(this).find('video').height() - ($containerHeight)) / 2); 7995 $(this).find('.mejs-overlay, .mejs-poster').scrollTop(($(this).find('video').height() - ($containerHeight)) / 2); 7996 7997 7998 // Align bottom 7999 if ($(this).attr('data-bg-alignment') == 'center bottom' || $(this).attr('data-bg-alignment') == 'bottom') { 8000 $(this).scrollTop(($(this).find('video').height() - ($containerHeight + 6))); 8001 } 8002 // Align top 8003 else if ($(this).attr('data-bg-alignment') == 'center top' || $(this).attr('data-bg-alignment') == 'top') { 8004 $(this).scrollTop(0); 8005 } 8006 8007 // Add loaded class 8008 $(this).addClass('position-loaded'); 8009 }); 8010 8011 } 8012 8013 8014 8015 /** 8016 * Nectar video background initialization. 8017 * 8018 * @since 5.0 8019 */ 8020 function videoBGInit() { 8021 8022 if ($('.nectar-video-wrap').length == 0 && $('.nectar-youtube-bg').length == 0) { 8023 return; 8024 } 8025 8026 setTimeout(function () { 8027 8028 resizeVideoToCover(); 8029 8030 // Resize 8031 $window.on('resize',resizeVideoToCover); 8032 8033 $('.video-color-overlay').each(function () { 8034 $(this).css('background-color', $(this).attr('data-color')); 8035 }); 8036 8037 $('.nectar-video-wrap').each(function () { 8038 8039 if ($(this).find('video').length == 0) { 8040 return; 8041 } 8042 8043 var $headerVideo = ($(this).parents('#page-header-bg').length > 0) ? true : false; 8044 var $that = $(this); 8045 var videoReady = setInterval(function () { 8046 8047 if ($that.find('video').get(0).readyState > 3) { 8048 8049 if (!nectarDOMInfo.usingMobileBrowser) { 8050 $that.transition({ 8051 'opacity': '1' 8052 }, 400); 8053 $that.find('video').transition({ 8054 'opacity': '1' 8055 }, 400); 8056 $that.parent().find('.video-color-overlay').transition({ 8057 'opacity': '0.7' 8058 }, 400); 8059 if ($headerVideo == true) { 8060 pageHeaderTextEffect(); 8061 } 8062 } 8063 8064 // Remove page loading screen 8065 $loadingScreenEl.addClass('loaded'); 8066 setTimeout(function () { 8067 $loadingScreenEl.addClass('hidden'); 8068 }, 1000); 8069 8070 8071 clearInterval(videoReady); 8072 } 8073 8074 }, 60); 8075 8076 if (nectarDOMInfo.usingMobileBrowser) { 8077 if ($that.parents('.full-width-section').length > 0 && $that.parents('#nectar_fullscreen_rows').length == 0) { 8078 $that.css('left', '50%'); 8079 } else { 8080 $that.css('left', '0px'); 8081 } 8082 8083 if ($headerVideo == true) { 8084 pageHeaderTextEffect(); 8085 } 8086 $that.find('video')[0].onplay = function () { 8087 $that.transition({ 8088 'opacity': '1' 8089 }, 400); 8090 $that.find('video').transition({ 8091 'opacity': '1' 8092 }, 400); 8093 $that.parent().find('.video-color-overlay').transition({ 8094 'opacity': '0.7' 8095 }, 400); 8096 }; 8097 } 8098 8099 }); 8100 }, 300); 8101 8102 8103 if (nectarDOMInfo.usingMobileBrowser) { 8104 8105 $('.nectar-video-wrap').each(function () { 8106 8107 if (!$(this).find('video').is('[muted]')) { 8108 8109 // Autoplay not supported unless muted 8110 $(this).parent().find('.mobile-video-image').show(); 8111 $(this).remove(); 8112 } 8113 8114 }); 8115 8116 } 8117 8118 8119 $('.wpb_row:has(".nectar-video-wrap"):not(.fp-section)').each(function (i) { 8120 $(this).css('z-index', 100 + i); 8121 }); 8122 8123 8124 $(".vc_row").each(function () { 8125 var youtubeUrl, youtubeId, $row = jQuery(this); 8126 $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(), nectarInsertYoutubeVideoAsBackgroun
8126d($row.find('.nectar-youtube-bg'), youtubeId))) : $row.find(".nectar-youtube-bg").remove(); 8127 8128 // Remove yt url 8129 $row.find('.nectar-youtube-bg span').remove(); 8130 8131 if (!nectarDOMInfo.usingMobileBrowser) { 8132 $row.find('.nectar-video-wrap, .nectar-youtube-bg').css({ 8133 'opacity': '1', 8134 'width': '100%', 8135 'height': '100%' 8136 }); 8137 } 8138 $row.find('.video-color-overlay').transition({ 8139 'opacity': '0.7' 8140 }, 400); 8141 }); 8142 8143 8144 function nectarInsertYoutubeVideoAsBackground($element, youtubeId, counter) { 8145 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 () { 8146 nectarInsertYoutubeVideoAsBackground($element, youtubeId, counter++) 8147 }, 100); 8148 var $container = $element.prepend('<div class="vc_video-bg"><div class="inner"></div></div>').find(".inner"); 8149 new YT.Player($container[0], { 8150 width: "100%", 8151 height: "100%", 8152 videoId: youtubeId, 8153 playerVars: { 8154 playlist: youtubeId, 8155 iv_load_policy: 3, 8156 enablejsapi: 1, 8157 disablekb: 1, 8158 autoplay: 1, 8159 controls: 0, 8160 showinfo: 0, 8161 rel: 0, 8162 loop: 1 8163 }, 8164 events: { 8165 onReady: function (event) { 8166 event.target.mute().setLoop(!0); 8167 nectarResizeVideoBackground($element); 8168 } 8169 } 8170 }), nectarResizeVideoBackground($element), jQuery(window).on("resize", function () { 8171 nectarResizeVideoBackground($element); 8172 }); 8173 8174 setTimeout(function () { 8175 nectarResizeVideoBackground($element); 8176 }, 100); 8177 } 8178 8179 function nectarResizeVideoBackground($element) { 8180 var iframeW, iframeH, marginLeft, marginTop, containerW = $element.innerWidth(), 8181 containerH = $element.innerHeight(), 8182 ratio1 = 16, 8183 ratio2 = 9; 8184 ratio1 / ratio2 > containerW / containerH ? (iframeW = containerH * (ratio1 / ratio2), 8185 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", 8186 marginLeft = -Math.round((iframeW - containerW) / 2) + "px", iframeW += "px", iframeH += "px"), 8187 $element.find(".vc_video-bg iframe").css({ 8188 maxWidth: "1000%", 8189 marginLeft: marginLeft, 8190 marginTop: marginTop, 8191 width: iframeW, 8192 height: iframeH 8193 }); 8194 } 8195 8196 function nectarExtractYoutubeId(url) { 8197 8198 if ("undefined" == typeof url) { 8199 return !1; 8200 } 8201 8202 var id = url.match(/(?:https?:\/{2})?(?:w{3}\.)?youtu(?:be)?\.(?:com|be)(?:\/watch\?v=|\/)([^\s&]+)/); 8203 return null !== id ? id[1] : !1 8204 } 8205 8206 8207 } 8208 8209 8210 8211 8212 /** 8213 * Single Blog Posts 8214 * 8215 * @since 11.0 8216 */ 8217 function blogSingle() { 8218 8219 // Remove first gallery on post when using the gallery slider option. 8220 if( $body.hasClass('single-post') && $('.content-inner[data-has-gallery]').length > 0 ) { 8221 8222 8223 if($('.wp-block-gallery').length > 0) { 8224 // Gutenberg. 8225 $('.content-inner').find('.wp-block-gallery').each(function(i) { 8226 if(i !== 0) { 8227 $(this).css('display','flex'); 8228 } 8229 }); 8230 8231 } else { 8232 // Classic Editor. 8233 $('.content-inner').find('.gallery').each(function(i) { 8234 if(i !== 0) { 8235 $(this).css('display','block'); 8236 } 8237 }); 8238 8239 } 8240 8241 } // If using gallery slider on single conditional end. 8242 8243 } 8244 8245 8246 8247 8248 8249 /*-------------------------------------------------------------------------*/ 8250 /* Header + Search 8251 /*-------------------------------------------------------------------------*/ 8252 8253 /** 8254 * Correct megamenus in mobile navigation. 8255 * 8256 * @since 8.0 8257 */ 8258 function mobileNavMegamenuCorrect() { 8259 8260 ////mobile megamenus without titles / nested groupings 8261 var $mobileNavSelector = ( $('#top #mobile-menu').length > 0 ) ? '#top #mobile-menu ' : '.off-canvas-menu-container.mobile-only '; 8262 8263 $($mobileNavSelector + '.megamenu > ul > li > a').each(function () { 8264 if ($(this).text() == '-' || $(this).text() == '–' || $(this).parent().hasClass('hide-title')) {
8265 var $navLIs = $(this).parent().find('> ul > li').clone(); 8266 $(this).parent().find('ul').remove(); 8267 $(this).parent().parent().append($navLIs); 8268 $(this).parent().remove(); 8269 } 8270 }); 8271 8272 } 8273 8274 8275 8276 8277 8278 8279 8280 8281 /** 8282 * Material theme skin off canvas menu initialization. 8283 * 8284 * @since 10.5 8285 */ 8286 function materialSkinOCM_Init() { 8287 8288 if ($('body.material[data-slide-out-widget-area-style="slide-out-from-right"]').length > 0) { 8289 OCM_materialWidth(); 8290 8291 if( $wpAdminBar.length > 0 ) { 8292 var $topToolBar = $wpAdminBar.detach(); 8293 $('.ocm-effect-wrap-inner').append($topToolBar); 8294 } 8295 8296 } 8297 8298 OCM_materialIconMarkup(); 8299 materialSkinTransition(); 8300 8301 $window.on('resize', OCM_materialSize); 8302 8303 } 8304 8305 8306 8307 8308 /** 8309 * Material theme skin transition helper 8310 * 8311 * @since 10.5 8312 */ 8313 function materialSkinTransition() { 8314 8315 if ($('body.material[data-header-search="true"]').length > 0 || 8316 $('body.material .ocm-effect-wrap').length > 0) { 8317 8318 var materialTransTO, 8319 allowMaterialResizeCalc = false, 8320 orientTrack = 0, 8321 $winDOMWidth = nectarDOMInfo.winW, 8322 $winDOMHeight = nectarDOMInfo.winH; 8323 8324 // For mobile make sure the orientation has changed. 8325 window.addEventListener("orientationchange", function () { 8326 orientTrack = 1; 8327 }); 8328 8329 // Resize. 8330 $window.on('resize', function () { 8331 8332 if( nectarDOMInfo.usingMobileBrowser ) { 8333 // Mobile. 8334 if (($window.width() != $winDOMWidth && $window.height != $winDOMHeight) || orientTrack === 1) { 8335 8336 // Store the current window dimensions. 8337 $winDOMWidth = nectarDOMInfo.winW; 8338 $winDOMHeight = nectarDOMInfo.winH; 8339 8340 // Reset orientation change tracker. 8341 orientTrack = 0; 8342 8343 // Set to allow. 8344 allowMaterialResizeCalc = true; 8345 8346 } 8347 } else { 8348 // Desktop always allows. 8349 allowMaterialResizeCalc = true; 8350 } 8351 8352 if(allowMaterialResizeCalc) { 8353 8354 clearTimeout(materialTransTO); 8355 8356 $('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') 8357 .addClass('no-material-transition'); 8358 8359 materialTransTO = setTimeout(function () { 8360 $('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') 8361 .removeClass('no-material-transition'); 8362 }, 250); 8363 8364 OCM_materialWidth(); 8365 8366 // Reset allow. 8367 allowMaterialResizeCalc = false; 8368 8369 } // endif for allow. 8370 8371 }); // end resize. 8372 8373 } 8374 8375 } 8376 8377 8378 8379 /** 8380 * Calculate off canvas menu slide out from right on hover 8381 * 8382 * @since 8.0 8383 */ 8384 function calculateHoverNavMinHeight() { 8385 8386 var $widgetHeights = 0; 8387 $('#slide-out-widget-area > .widget').each(function () { 8388 $widgetHeights += $(this).height(); 8389 }); 8390 8391 var $menuHeight; 8392 8393 if(($offCanvasEl.height() - 25 - $('.bottom-meta-wrap').outerHeight(true) - $widgetHeights) > $('#slide-out-widget-area .off-canvas-menu-container:last-child').height()) { 8394 $menuHeight = $offCanvasEl.height() - 25 - $('.bottom-meta-wrap').outerHeight(true) - $widgetHeights; 8395 } else { 8396 $menuHeight = $('#slide-out-widget-area .off-canvas-menu-container:last-child').height(); 8397 } 8398 8399 $('#slide-out-widget-area .inner').css({ 8400 'height': 'auto', 8401 'min-height': $menuHeight 8402 }); 8403 8404 $('#slide-out-widget-area > .inner .off-canvas-menu-container').transition({ 8405 y: '-' + ($('#slide-out-widget-area > .inner .off-canvas-menu-container:last-child').height() / 2) + 'px' 8406 }, 0); 8407 8408 } 8409 8410 8411 /** 8412 * Material theme skin off canvas menu width. 8413 * 8414 * @since 8.0 8415 */ 8416 function OCM_materialWidth() { 8417 8418 $('#slide-out-widget-area.slide-out-from-right').css({ 8419 'padding-top': $window.height() * 0.1, 8420 'padding-bottom': $window.height() * 0.1 8421 }); 8422 8423 OCM_overflowState(); 8424 } 8425 8426 8427 8428 /** 8429 * Material theme skin off canvas menu icon markup 8430 * 8431 * @since 8.0 8432 */ 8433 function OCM_materialIconMarkup() { 8434 8435 if ($('body.material').length >
8435 0 && $('body[data-slide-out-widget-area-style="slide-out-from-right-hover"]').length == 0 ) { 8436 8437 if ($('body[data-slide-out-widget-area-style*="fullscreen"]').length == 0 && $('#mobile-menu').length == 0) { 8438 var $menuIconClone = $('header#top nav ul .slide-out-widget-area-toggle a > span > i').clone(); 8439 $menuIconClone.addClass('hover-effect'); 8440 $('header#top nav ul .slide-out-widget-area-toggle a > span').append($menuIconClone); 8441 8442 var $menuIconClone2 = $('header#top .slide-out-widget-area-toggle.mobile-icon a > span > i').clone(); 8443 $menuIconClone2.addClass('hover-effect'); 8444 $('header#top .slide-out-widget-area-toggle.mobile-icon a > span').append($menuIconClone2); 8445 } 8446 8447 $('body:not([data-slide-out-widget-area-style="slide-out-from-right"]) header#top .slide-out-widget-area-toggle a > span') 8448 .append($('<span class="close-wrap"> <span class="close-line close-line1"></span> <span class="close-line close-line2"></span> </span>')); 8449 } 8450 8451 if ($('body.material #boxed').length > 0 && $('body[data-slide-out-widget-area-style="slide-out-from-right-hover"]').length > 0) { 8452 $('#ajax-content-wrap > .slide-out-widget-area-toggle.slide-out-hover-icon-effect').insertAfter('.ocm-effect-wrap'); 8453 } 8454 8455 //move material skin default ocm 8456 if ($('body.material').length > 0 && $('body[data-slide-out-widget-area-style*="fullscreen"]').length == 0) { 8457 $('body.material #slide-out-widget-area.slide-out-from-right .slide_out_area_close').insertAfter('.ocm-effect-wrap'); 8458 $('#slide-out-widget-area-bg').insertAfter('.ocm-effect-wrap'); 8459 $offCanvasEl.insertAfter('.ocm-effect-wrap'); 8460 } 8461 8462 } 8463 8464 8465 8466 /** 8467 * Material theme skin off canvas menu height 8468 * 8469 * @since 8.0 8470 */ 8471 function OCM_materialSize() { 8472 if ($('.ocm-effect-wrap.material-ocm-open').length > 0) { 8473 8474 $('.ocm-effect-wrap').css({ 8475 'height': $window.height() 8476 }); 8477 8478 $('.ocm-effect-wrap-inner').css({ 8479 'padding-top': nectarDOMInfo.adminBarHeight 8480 }); 8481 8482 } 8483 } 8484 8485 8486 8487 /** 8488 * Off canvas menu dropdown markup 8489 * 8490 * @since 8.0 8491 */ 8492 function OCM_dropdownMarkup() { 8493 var $nectar_ocm_dropdown_func = ($('#slide-out-widget-area[data-dropdown-func]').length > 0) ? $offCanvasEl.attr('data-dropdown-func') : 'default'; 8494 if ($nectar_ocm_dropdown_func == 'separate-dropdown-parent-link') { 8495 $('#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>'); 8496 } 8497 } 8498 8499 8500 8501 8502 8503 /** 8504 * Off canvas menu dropdown icon position. 8505 * 8506 * @since 8.0 8507 */ 8508 function OCM_dropdownIconPos() { 8509 $('#slide-out-widget-area[class*="slide-out-from-right"] .off-canvas-menu-container li.menu-item-has-children').each(function () { 8510 $(this).find('.ocm-dropdown-arrow').css({ 8511 'top': $(this).find('a').height() / 2 8512 }); 8513 }); 8514 } 8515 8516 8517 8518 8519 8520 8521 /** 8522 * Off canvas menu overflow scrolling. 8523 * 8524 * @since 8.0 8525 */ 8526 function OCM_overflowState() { 8527 8528 //switch position of social media/extra info based on screen size 8529 if (nectarDOMInfo.winW < 1000 || 8530 $('body > #boxed').length > 0 || 8531 $('.ocm-effect-wrap-inner > #boxed').length > 0) { 8532 8533 $('#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'); 8534 $('#slide-out-widget-area.fullscreen .bottom-text, #slide-out-widget-area.fullscreen-alt .bottom-text').appendTo('#slide-out-widget-area .inner'); 8535 8536 } else { 8537 $('#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'); 8538 $('#slide-out-widget-area.fullscreen .bottom-text, #slide-out-widget-area.fullscreen-alt .bottom-text').appendTo('#slide-out-widget-area .inner-wrap'); 8539 } 8540 8541 //add overflow 8542 if ($('#slide-out-widget-area[class*="fullscreen"] .inner').height() >= $window.height() - 100) { 8543 $('#slide-out-widget-area[class*="fullscreen"] .inner, #slide-out-widget-area[class*="fullscreen"]').addClass('overflow-state'); 8544 } else { 8545 $('#slide-out-widget-area[class*="fullscreen"] .inner, #slide-out-widget-area[class*="fullscreen"]').removeClass('overflow-state'); 8546 } 8547 8548 $('#slide-out-widget-area[class*="fullscreen"] .inner').transition({ 8549 y: '-' + ($('#slide-out-widget-area[class*="fullscreen"] .inner').height() / 2) + 'px' 8550 }, 0); 8551 8552 //close mobile only slide out widget area if switching back to desktop 8553 if ($('.slide-out-from-right.open .off-canvas-menu-container.mobile-only').length > 0 && $('body.mobile').length == 0) { 8554 $('#slide-out-widget-area .slide_out_area_close').trigger('click'); 8555 } 8556 8557 //sizing for dropdown 8558 OCM_dropdownIconPos(); 8559 8560 } 8561 8562 8563 8564 /** 8565 * Off canvas menu: slide out from right hover open. 8566 * 8567 * @since 10.5 8568 */ 8569 function OCM_slideOutRightHoverOpen() { 8570 8571 calculateHoverNavMinHeight(); 8572 8573 if ( nectarDOMInfo.usingMobileBrowser && $('#slide-out-widget-area.open').length > 0 ) { 8574 OCM_mobileSlideOutRightHoverCloseCheck(); 8575 return; 8576 } 8577 8578 if( nectarDOMInfo.usingMobileBrowser ) { 8579 $('.slide-out-widget-area-toggle a').attr('aria-expanded','true'); 8580 } 8581 8582 $offCanvasEl.css({
8583 'transform': 'translate3d(0,0,0)' 8584 }).addClass('open'); 8585 8586 // Icon effect 8587 // Set position 8588 if ($('header#top .container .span_9 > .slide-out-widget-area-toggle').length > 0) { 8589 8590 var $hIconEl = $('.slide-out-hover-icon-effect'), 8591 secondaryBarHeight = nectarDOMInfo.secondaryHeaderHeight; 8592 8593 var $nectarHamMenuPos; 8594 8595 if ($('body.mobile').length > 0) { 8596 8597 $hIconEl.css({ 8598 'top': $('header#top .span_9 > .slide-out-widget-area-toggle a').offset().top - nectarDOMInfo.scrollTop, 8599 'right': parseInt($('#header-outer header > .container').css('padding-right')) + 1 8600 }); 8601 8602 } else { 8603 8604 if ($bodyBorderHeaderColorMatch) { 8605 8606 var $extraCushion = ($('#header-outer[data-has-menu="false"]').length > 0) ? 2 : 1; 8607 $hIconEl.css({ 8608 'top': nectarDOMInfo.adminBarHeight + secondaryBarHeight + parseInt($('header#top nav >ul .slide-out-widget-area-toggle a').css('padding-top')), 8609 'right': 29 + $extraCushion 8610 }); 8611 8612 } else { 8613 8614 if ($('#header-outer[data-format="centered-menu-bottom-bar"]').length > 0) { 8615 $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 .span_3 .right-side .slide-out-widget-area-toggle > div').offset(); 8616 8617 $hIconEl.css({ 8618 'top': parseInt($nectarHamMenuPos.top) - nectarDOMInfo.scrollTop, 8619 'right': parseInt($('#header-outer header >.container').css('padding-right')) + 2 8620 }); 8621 } else { 8622 8623 if( $body.hasClass('ascend') ) { 8624 $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').position(); 8625 } else { 8626 $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(); 8627 } 8628 8629 8630 if ($('#header-secondary-outer.hide-up').length > 0) { 8631 secondaryBarHeight = 0; 8632 } 8633 8634 $hIconEl.css({ 8635 'top': nectarDOMInfo.adminBarHeight + secondaryBarHeight + parseInt($nectarHamMenuPos.top), 8636 'right': parseInt($('#header-outer header >.container').css('padding-right')) + 2 8637 }); 8638 } 8639 8640 } // No body border color match. 8641 8642 } //Not on mobile. 8643 8644 } 8645 8646 ////Open 8647 $('.slide-out-hover-icon-effect .lines-button') 8648 .removeClass('no-delay') 8649 .addClass('unhidden-line'); 8650 8651 if ($('#header-outer[data-permanent-transparent="1"]').length == 0 && 8652 $('#nectar_fullscreen_rows').length == 0 && 8653 !nectarDOMInfo.usingFrontEndEditor && 8654 nectarDOMInfo.winW > 1000) { 8655 8656 if (!(nectarDOMInfo.scrollTop == 0 && $('#header-outer.transparent').length > 0)) { 8657 8658 if ($('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) { 8659 8660 $headerOuterEl.attr('data-transparent', 'true').addClass('no-bg-color').addClass('slide-out-hover'); 8661 $('#header-outer header, #header-outer > .cart-outer').addClass('all-hidden'); 8662 } 8663 8664 } 8665 8666 if ($('#header-outer[data-remove-fixed="1"]').length == 0 && $('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) { 8667 8668 if (headerResize == true) { 8669 8670 $window.off('scroll', bigNav); 8671 $window.off('scroll', smallNav); 8672 8673 } else { 8674 $window.off('scroll', opaqueCheck); 8675 $window.off('scroll', transparentCheck); 8676 } 8677 } 8678 8679 } 8680 8681 if (!nectarDOMInfo.usingMobileBrowser) { 8682 $window.on('mousemove.rightOffsetCheck', OCM_slideOutRightHoverCloseCheck); 8683 } 8684 8685 } 8686 8687 8688 /** 8689 * Off canvas menu: slide out from right hover close 8690 * 8691 * @since 10.5 8692 */ 8693 function OCM_slideOutRightHoverCloseCheck(e) { 8694 8695 var $windowWidth = $window.width(); 8696 8697 if (e.clientX < $windowWidth - 340 - $bodyBorderWidth && $offCanvasEl.hasClass('mouse-accessed')) { 8698 8699 $offCanvasEl.removeClass('mouse-accessed'); 8700 $window.off('mousemove.rightOffsetCheck', OCM_slideOutRightHoverCloseCheck); 8701 8702 $offCanvasEl.css({ 8703 'transform': 'translate3d(341px,0,0)' 8704 }).removeClass('open'); 8705 8706 $headerOuterEl.removeClass('style-slide-out-from-right'); 8707 8708 $('.slide-out-hover-icon-effect .lines-button') 8709 .removeClass('unhidden-line') 8710 .addClass('no-delay'); 8711 8712 if ($('#header-outer[data-permanent-transparent="1"]').length == 0) { 8713 8714 if ($('#header-outer[data-remove-fixed="1"]').length == 0 && $('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) { 8715 8716 if ($('body.mobile').length == 0) { 8717 $headerOuterEl.removeClass('no-bg-color'); 8718 $('#header-outer header, #header-outer > .cart-outer').removeClass('all-hidden'); 8719 } 8720 } 8721 8722 if ($('#header-outer[data-remove-fixed="1"]').length == 0 && $('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) { 8723 8724 if (headerResize == true) { 8725 8726 $window.off('scroll.headerResizeEffect'); 8727 8728 if (nectarDOMInfo.scrollTop == 0) { 8729 8730 $window.on('scroll.headerResizeEffect', smallNav); 8731 8732 if ($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 && 8733 $bodyBorderTop.length > 0 && 8734 $bodyBorderHeaderColorMatch == true && 8735 $('#header-outer.pseudo-data-transparent').length > 0) { 8736 8737 $('#header-outer[data-full-width="true"] header > .container').stop(true, true).animate({ 8738 'padding': '0' 8739 }, {
8740 queue: false, 8741 duration: 250, 8742 easing: 'easeOutCubic' 8743 }); 8744 8745 } 8746 } else { 8747 $window.on('scroll.headerResizeEffect', bigNav); 8748 } 8749 8750 } else { 8751 8752 $window.off('scroll.headerResizeEffectOpaque'); 8753 $window.on('scroll.headerResizeEffectOpaque', opaqueCheck); 8754 } 8755 } 8756 } 8757 } 8758 8759 } 8760 8761 8762 /** 8763 * Off canvas menu: mobile slide out from right hover close. 8764 * 8765 * @since 10.5 8766 */ 8767 function OCM_mobileSlideOutRightHoverCloseCheck() { 8768 8769 if(nectarDOMInfo.usingMobileBrowser) { 8770 $('.slide-out-widget-area-toggle a').attr('aria-expanded','false'); 8771 } 8772 8773 $offCanvasEl.css({ 8774 'transform': 'translate3d(341px,0,0)' 8775 }).removeClass('open'); 8776 8777 $headerOuterEl.removeClass('style-slide-out-from-right'); 8778 8779 $('.slide-out-hover-icon-effect .lines-button') 8780 .removeClass('unhidden-line') 8781 .addClass('no-delay'); 8782 8783 if ($('#header-outer[data-permanent-transparent="1"]').length == 0) { 8784 8785 $headerOuterEl.removeClass('no-bg-color'); 8786 $('#header-outer header').removeClass('all-hidden'); 8787 8788 } 8789 8790 8791 if ($('#header-outer[data-remove-fixed="1"]').length == 0 && $('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) { 8792 8793 if (headerResize == true) { 8794 8795 $window.off('scroll.headerResizeEffect'); 8796 8797 if (nectarDOMInfo.scrollTop == 0) { 8798 8799 $window.on('scroll.headerResizeEffect', smallNav); 8800 8801 if ($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 && 8802 $bodyBorderTop.length > 0 && 8803 $bodyBorderHeaderColorMatch == true && 8804 $('#header-outer.pseudo-data-transparent').length > 0) { 8805 8806 $('#header-outer[data-full-width="true"] header > .container').stop(true, true).animate({ 8807 'padding': '0' 8808 }, { 8809 queue: false, 8810 duration: 250, 8811 easing: 'easeOutCubic' 8812 }); 8813 8814 } 8815 } 8816 8817 else { 8818 $window.on('scroll.headerResizeEffect', bigNav); 8819 } 8820 8821 } else { 8822 8823 $window.off('scroll.headerResizeEffectOpaque'); 8824 $window.on('scroll.headerResizeEffectOpaque', opaqueCheck); 8825 8826 } 8827 8828 } 8829 8830 } 8831 8832 8833 8834 /** 8835 * Off canvas menu: slide out from right hover initialization. 8836 * 8837 * @since 10.5 8838 */ 8839 function OCM_slideOutRightHoverInit() { 8840 8841 if ($('#ajax-content-wrap > .slide-out-widget-area-toggle').length == 0) { 8842 8843 //icon effect html creation 8844 $('<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('#slide-out-widget-area'); 8845 8846 if ($('#header-outer[data-has-menu="true"]').length > 0 || $('body[data-header-search="true"]').length > 0 || $('.slide-out-widget-area-toggle a.using-label').length > 0 ) { 8847 $('.slide-out-widget-area-toggle').addClass('small'); 8848 } 8849 } 8850 8851 8852 //hover triggered 8853 if (!nectarDOMInfo.usingMobileBrowser) { 8854 $body.on('mouseenter', '#header-outer .slide-out-widget-area-toggle:not(.std-menu) a', OCM_slideOutRightHoverOpen); 8855 $offCanvasEl.on('mouseenter', function () { 8856 $(this).addClass('mouse-accessed'); 8857 }); 8858 8859 } else { 8860 $body.on('click', '.slide-out-widget-area-toggle:not(.std-menu) a', OCM_slideOutRightHoverOpen); 8861 } 8862 8863 $window.on('smartresize', calculateHoverNavMinHeight); 8864 8865 8866 } 8867 8868 8869 /** 8870 * Off canvas menu: slide out from right open. 8871 * 8872 * @since 10.5 8873 */ 8874 function OCM_slideOutRightOpen() { 8875 8876 var $slideOutAmount = ($bodyBorderTop.length > 0 && $('body.mobile').length == 0) ? $bodyBorderTop.height() : 0; 8877 8878 if ($('body.material').length == 0) { 8879 8880 //calc height if used bottom meta 8881 $('#slide-out-widget-area .inner').css({ 8882 'height': 'auto', 8883 'min-height': $offCanvasEl.height() - 25 - $('.bottom-meta-wrap').height() 8884 }); 8885 8886 if ($('#boxed').length == 0) { 8887 8888 $('.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({ 8889 x: '-300px'
8890 }, 700, 'easeInOutCubic'); 8891 8892 var $withinCustomBreakpoint = mobileBreakPointCheck(); 8893 8894 if ($('#header-outer[data-format="centered-logo-between-menu"]').length == 0 || $withinCustomBreakpoint) { 8895 8896 if ($('#header-outer[data-transparency-option="1"]').length == 0 || 8897 ($('#header-outer[data-transparency-option="1"]').length > 0 && $('#header-outer[data-full-width="true"]').length == 0) || 8898 $('body.mobile').length > 0) { 8899 8900 $headerOuterEl.stop(true).css('transform', 'translateY(0)').transition({ 8901 x: '-' + (300 + $slideOutAmount) + 'px' 8902 }, 700, 'easeInOutCubic'); 8903 8904 } else { 8905 8906 $headerOuterEl.stop(true).css('transform', 'translateY(0)').transition({ 8907 x: '-' + (300 + $slideOutAmount) + 'px', 8908 'background-color': 'transparent', 8909 'border-bottom': '1px solid rgba(255,255,255,0.22)' 8910 }, 700, 'easeInOutCubic'); 8911 8912 } 8913 } else { 8914 $('#header-outer header#top nav > ul.buttons, body:not(.material) #header-outer .cart-outer .cart-menu-wrap').transition({ 8915 x: '-300px' 8916 }, 700, 'easeInOutCubic'); 8917 } 8918 8919 } 8920 8921 $offCanvasEl.stop(true).transition({ 8922 x: '-' + $slideOutAmount + 'px' 8923 }, 700, 'easeInOutCubic').addClass('open'); 8924 8925 8926 if ($('#boxed').length == 0) { 8927 8928 // Full width menu adjustments 8929 if ($('#header-outer[data-full-width="true"]').length > 0 && !$body.hasClass('mobile')) { 8930 $headerOuterEl.addClass('highzI'); 8931 $('#ascrail2000').addClass('z-index-adj'); 8932 8933 if ($('#header-outer[data-format="centered-logo-between-menu"]').length == 0) { 8934 8935 if ($bodyBorderWidth == 0) { 8936 $('header#top #logo').stop(true).transition({ 8937 x: (300 + $slideOutAmount) + 'px' 8938 }, 700, 'easeInOutCubic'); 8939 } 8940 8941 } 8942 8943 $('header#top .slide-out-widget-area-toggle .lines-button').addClass('close'); 8944 8945 $('body #header-outer nav > ul > li > a').css({ 8946 'margin-bottom': '0' 8947 }); 8948 8949 } 8950 8951 } 8952 8953 $headerOuterEl.addClass('style-slide-out-from-right'); 8954 8955 // Fade In BG Overlay 8956 $offCanvasBG.css({ 8957 'height': '100%', 8958 'width': '100%' 8959 }).stop(true).transition({ 8960 'opacity': 1 8961 }, 700, 'easeInOutCubic', function () { 8962 $('.slide-out-widget-area-toggle:not(.std-menu) > div > a').removeClass('animating'); 8963 }); 8964 8965 // Hide menu if no space 8966 if ($('#header-outer[data-format="centered-logo-between-menu"]').length == 0) { 8967 8968 var $logoWidth = ($('#logo img:visible').length > 0) ? $('#logo img:visible').width() : $('#logo').width(); 8969 8970 if ($('header#top nav > .sf-menu').offset().left - $logoWidth - 300 < 20) { 8971 $headerOuterEl.addClass('hidden-menu'); 8972 } 8973 8974 } else { 8975 $headerOuterEl.addClass('hidden-menu-items'); 8976 } 8977 8978 8979 if ($('#header-outer[data-remove-fixed="1"]').length == 0 && nectarDOMInfo.winW > 1000) { 8980 8981 if ($bodyBorderHeaderColorMatch == true && headerResize == true) { 8982 8983 $headerOuterEl.stop(true).transition({ 8984 y: '0' 8985 }, 0).addClass('transparent').css('transition', 'transform'); 8986 if ($headerOuterEl.attr('data-transparent-header') != 'true') { 8987 $headerOuterEl.attr('data-transparent-header', 'true').addClass('pseudo-data-transparent'); 8988 } 8989 8990 $window.off('scroll', bigNav); 8991 $window.off('scroll', smallNav); 8992 8993 } else if ($bodyBorderHeaderColorMatch == true) { 8994 8995 $headerOuterEl.addClass('transparent'); 8996 $window.off('scroll', opaqueCheck); 8997 $window.off('scroll', transparentCheck); 8998 8999 if ($headerOuterEl.attr('data-transparent-header') != 'true') { 9000 $headerOuterEl.attr('data-transparent-header', 'true').addClass('pseudo-data-transparent'); 9001 } 9002 } 9003 } 9004 9005 } else if ($('body.material').length > 0) { 9006 9007 // Material theme skin slide out from right 9008 9009 //move ajax loading outside 9010 if ($loadingScreenEl.length > 0 && $('.ocm-effect-wrap #ajax-loading-screen').length > 0) { 9011 $loadingScreenEl.insertBefore('.ocm-effect-wrap'); 9012 } 9013 9014 // Hide secondary header when not at top with hhun 9015 if (nectarDOMInfo.scrollTop > 40) { 9016 9017 $('body[data-hhun="1"] #header-secondary-outer').addClass('hidden'); 9018 } 9019 9020 9021 setTimeout(function () { 9022 $('.slide-out-widget-area-toggle:not(.std-menu) > div > a').removeClass('animating'); 9023 }, 300); 9024 $('#slide-out-widget-area, #slide-out-widget-area-bg, #header-outer .slide-out-widget-area-toggle').addClass('material-open'); 9025 9026 9027 // Handle bottom bar nav 9028 if ($('body:not(.mobile) #header-outer[data-format="centered-menu-bottom-bar"][data-condense="true"]').length > 0 && 9029 $('#header-outer[data-format="centered-menu-bottom-bar"] .span_9').css('display') != 'none') { 9030 9031 $('#header-outer:not(.fixed-menu)').css('top', nectarDOMInfo.adminBarHeight - nectarDOMInfo.scrollTop + 'px'); 9032 9033 if ($headerSecondaryEl.length > 0 && $('#header-outer.fixed-menu').length > 0) { 9034 $headerSecondaryEl.css('visibility', 'hidden'); 9035 } 9036 9037 } 9038 9039 $('#ajax-content-wrap').css({ 9040 'position': 'relative', 9041 'top': '-' + nectarDOMInfo.scrollTop + 'px' 9042 }); 9043 9044 $('.ocm-effect-wrap-inner').css({ 9045 'padding-top': nectarDOMInfo.adminBarHeight 9046 }); 9047 9048 $('#fp-nav').addClass('material-ocm-open'); 9049 9050 $body.addClass('material-ocm-open'); 9051 $body.addClass('nectar-no-flex-height'); 9052 9053 $('.ocm-effect-wrap').css({ 9054 'height': nectarDOMInfo.winH 9055 }); 9056 9057 setTimeout(function () { 9058 $('.ocm-effect-wrap').addClass('material-ocm-open'); 9059 }, 40); 9060 9061 9062 $('body > .slide_out_area_close').addClass('follow-body'); 9063 9064 //icon effect 9065 $('#header-outer:not([data-format="left-header"]) header#top .slide-out-widget-area-toggle a').addClass('effect-shown'); 9066 9067 //handle hhun when at top 9068 $('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({ 9069 'transition': 'none', 9070 'transform': 'translateY(' + nectarDOMInfo.adminBarHeight + 'px)' 9071 }); 9072 9073 setTimeout(function () { 9074 $('body > .slide_out_area_close').addClass('material-ocm-open'); 9075 }, 350); 9076 9077 9078 } 9079 9080 } 9081 9082 9083 /** 9084 * Off canvas menu: slide out from right close. 9085 * 9086 * @since 10.5 9087 */ 9088 function OCM_slideOutRightClose() { 9089 9090 if ($('body.material').length == 0) { 9091 9092 $('.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({ 9093 x: '0px' 9094 }, 700, 'easeInOutCubic'); 9095 9096 if ($('#header-outer[data-transparency-option="1"]').length > 0 && $('#boxed').length == 0) { 9097 var $currentRowBG = ($('#header-outer[data-current-row-bg-color]').length > 0) ? $headerOuterEl.attr('data-current-row-bg-color') : $headerOuterEl.attr('data-user-set-bg'); 9098 $headerOuterEl.stop(true).transition({ 9099 x: '0px', 9100 'background-color': $currentRowBG 9101 }, 700, 'easeInOutCubic'); 9102 } else { 9103 $headerOuterEl.stop(true).transition({ 9104 x: '0px' 9105 }, 700, 'easeInOutCubic'); 9106 } 9107 9108 $offCanvasEl.stop(true).transition({ 9109 x: '301px' 9110 }, 700, 'easeInOutCubic').removeClass('open'); 9111 9112 9113 if ($('#boxed').length == 0) { 9114 if ($('#header-outer[data-full-width="true"]').length > 0) { 9115 $headerOuterEl.removeClass('highzI'); 9116 $('header#top #logo').stop(true).transition({ 9117 x: '0px' 9118 }, 700, 'easeInOutCubic'); 9119 $('.lines-button').removeClass('close'); 9120 9121 } 9122 } 9123 9124 if ($('#header-outer[data-format="centered-logo-between-menu"]').length > 0) { 9125 $('#header-outer header#top nav > ul.buttons, #header-outer .cart-outer .cart-menu-wrap').stop(true).transition({ 9126 x: '0px' 9127 }, 700, 'easeInOutCubic'); 9128 } 9129 9130 //fade out overlay 9131 $offCanvasBG.stop(true).transition({ 9132 'opacity': 0 9133 }, 700, 'easeInOutCubic', function () { 9134 9135 $('.slide-out-widget-area-toggle a').removeClass('animating'); 9136 9137 $(this).css({ 9138 'height': '1px', 9139 'width': '1px' 9140 }); 9141 9142 if ($('#header-outer[data-remove-fixed="1"]').length == 0) { 9143 9144 //hide menu if transparent, user has scrolled down and hhun is on 9145 if ($headerOuterEl.hasClass('parallax-contained') && 9146 nectarDOMInfo.scrollTop > 0 && 9147 $('#header-outer[data-permanent-transparent="1"]').length == 0) { 9148 $headerOuterEl.removeClass('parallax-contained').addClass('detached').removeClass('transparent'); 9149 } 9150 else if (nectarDOMInfo.scrollTop == 0 && $('body[data-hhun="1"]').length >
9150 0 && $('#page-header-bg[data-parallax="1"]').length > 0 || 9151 nectarDOMInfo.scrollTop == 0 && $('body[data-hhun="1"]').length > 0 && $('.parallax_slider_outer').length > 0) { 9152 9153 if ($('#header-outer[data-transparency-option="1"]').length > 0) { 9154 $headerOuterEl.addClass('transparent'); 9155 } 9156 9157 $headerOuterEl 9158 .addClass('parallax-contained') 9159 .removeClass('detached'); 9160 9161 } 9162 9163 } 9164 9165 //fix for fixed subpage menu 9166 $('.container-wrap').css('transform', 'none'); 9167 9168 }); 9169 9170 9171 $headerOuterEl.removeClass('style-slide-out-from-right'); 9172 9173 9174 if ($('#header-outer[data-remove-fixed="1"]').length == 0) { 9175 9176 if ($bodyBorderHeaderColorMatch == true && 9177 headerResize == true && 9178 nectarDOMInfo.winW > 1000) { 9179 9180 $window.off('scroll.headerResizeEffect'); 9181 if (nectarDOMInfo.scrollTop == 0) { 9182 9183 $window.on('scroll.headerResizeEffect', smallNav); 9184 9185 if ($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 && 9186 $bodyBorderTop.length > 0 && 9187 $bodyBorderHeaderColorMatch == true && 9188 $('#header-outer.pseudo-data-transparent').length > 0) { 9189 9190 $('#header-outer[data-full-width="true"] header > .container').stop(true, true).animate({ 9191 'padding': '0' 9192 }, { 9193 queue: false, 9194 duration: 250, 9195 easing: 'easeOutCubic' 9196 }); 9197 9198 } 9199 } else { 9200 $window.on('scroll.headerResizeEffect', bigNav); 9201 } 9202 9203 if ($headerOuterEl.hasClass('pseudo-data-transparent')) { 9204 9205 $headerOuterEl.attr('data-transparent-header', 'false') 9206 .removeClass('pseudo-data-transparent') 9207 .removeClass('transparent'); 9208 } 9209 9210 $headerOuterEl.css('transition', 'transform'); 9211 9212 } else if ($bodyBorderHeaderColorMatch == true && nectarDOMInfo.winW > 1000) { 9213 9214 $window.off('scroll.headerResizeEffectOpaque'); 9215 $window.on('scroll.headerResizeEffectOpaque', opaqueCheck); 9216 9217 $headerOuterEl.css('transition', 'transform'); 9218 9219 if ($headerOuterEl.hasClass('pseudo-data-transparent')) { 9220 $headerOuterEl.attr('data-transparent-header', 'false') 9221 .removeClass('pseudo-data-transparent') 9222 .removeClass('transparent'); 9223 } 9224 } 9225 } 9226 } 9227 9228 else if ($('body.material').length > 0) { 9229 9230 //material 9231 $offCanvasEl.removeClass('open'); 9232 9233 $('#slide-out-widget-area, #slide-out-widget-area-bg, #header-outer .slide-out-widget-area-toggle').removeClass('material-open'); 9234 $('.ocm-effect-wrap, .ocm-effect-wrap-shadow, body > .slide_out_area_close, #fp-nav').removeClass('material-ocm-open'); 9235 9236 $('body > .slide_out_area_close').removeClass('follow-body'); 9237 9238 setTimeout(function () { 9239 $('.slide-out-widget-area-toggle a').removeClass('animating'); 9240 9241 $body.removeClass('material-ocm-open'); 9242 $body.removeClass('nectar-no-flex-height'); 9243 9244 $('.ocm-effect-wrap').css({ 9245 'height': '100%' 9246 }); 9247 9248 $('.ocm-effect-wrap-inner').css({ 9249 'padding-top': '0' 9250 }); 9251 9252 $window.scrollTop(Math.abs(parseInt($('#ajax-content-wrap').css('top')))); 9253 9254 $('#ajax-content-wrap').css({ 9255 'position': '', 9256 'top': '' 9257 }); 9258 9259 9260 //handle bottom bar nav 9261 if ($('#header-outer[data-format="centered-menu-bottom-bar"]').length > 0 && 9262 $('#header-outer[data-format="centered-menu-bottom-bar"] .span_9').css('display') != 'none' && 9263 $('body.mobile').length == 0) { 9264 9265 $('#header-outer:not(.fixed-menu)').css('top', ''); 9266 $headerSecondaryEl.css('visibility', ''); 9267 9268 } 9269 9270 //handle hhun when at top 9271 $('body[data-hhun="1"]:not(.no-scroll) #header-outer[data-permanent-transparent="false"]:not(.detached):not(.parallax-contained):not(.at-top-before-box)').css({ 9272 'transform': '' 9273 }); 9274 setTimeout(function () { 9275 $('body[data-hhun="1"]:not(.no-scroll) #header-outer[data-permanent-transparent="false"]:not(.detached):not(.parallax-contained):not(.at-top-before-box)').css({ 9276 'transition': '' 9277 }); 9278 }, 30); 9279 9280 9281 $('body[data-hhun="1"] #header-secondary-outer.hidden').removeClass('hidden'); 9282 9283 }, 900); 9284 9285 setTimeout(function () { 9286 9287 //icon effect 9288 $('#header-outer:not([data-format="left-header"]) header#top .slide-out-widget-area-toggle a') 9289 .addClass('no-trans') 9290 .removeClass('effect-shown'); 9291 9292 }, 200); 9293 9294 setTimeout(function () { 9295 //icon 9296 $('#header-outer:not([data-format="left-header"]) header#top .slide-out-widget-area-toggle a').removeClass('no-trans'); 9297 }, 500); 9298 9299 } 9300 9301 } 9302 9303 9304 9305 9306 /** 9307 * Off canvas menu: fullscreen open. 9308 * 9309 * @since 10.5 9310 */ 9311 function OCM_fullscreenOpen() { 9312 9313 if ($('body.material').length > 0) { 9314 $('header#top .slide-out-widget-area-toggle a').addClass('menu-push-out'); 9315 } 9316 9317 // Scroll away from fixed reveal footer if shown (firefox bug with bluring over it)
9318 var $scrollDelay = 0; 9319 var $scrollDelay2 = 0; 9320 9321 if (nectarDOMInfo.scrollTop + $window.height() > $('.blurred-wrap').height() && $('#nectar_fullscreen_rows').length == 0) { 9322 $('body,html').stop().animate({ 9323 scrollTop: $('.blurred-wrap').height() - $window.height() 9324 }, 600, 'easeInOutCubic'); 9325 $scrollDelay = 550; 9326 $scrollDelay2 = 200; 9327 } 9328 9329 $('header#top .slide-out-widget-area-toggle:not(.std-menu) .lines-button').addClass('close'); 9330 setTimeout(function () { 9331 $('.blurred-wrap').addClass('blurred'); 9332 }, $scrollDelay); 9333 $('#slide-out-widget-area.fullscreen').show().addClass('open'); 9334 9335 if ($('.nectar-social.fixed').length == 0) { 9336 hideToTop(); 9337 } 9338 9339 // Remove box shadow incase at the top of the page with nectar box roll above 9340 $('.container-wrap').addClass('no-shadow'); 9341 $headerOuterEl.stop(true).css('transform', 'translateY(0)'); 9342 9343 setTimeout(function () { 9344 9345 $('.off-canvas-menu-container .menu > li').each(function (i) { 9346 $(this).delay(i * 50).transition({ 9347 y: 0, 9348 'opacity': 1 9349 }, 800, 'easeOutExpo'); 9350 }); 9351 9352 $('#slide-out-widget-area.fullscreen .widget').each(function (i) { 9353 $(this).delay(i * 100).transition({ 9354 y: 0, 9355 'opacity': 1 9356 }, 800, 'easeOutExpo'); 9357 }); 9358 }, 370 + $scrollDelay2); 9359 9360 setTimeout(function () { 9361 $('#slide-out-widget-area .off-canvas-social-links').addClass('line-shown'); 9362 9363 $('#slide-out-widget-area .off-canvas-social-links li').each(function (i) { 9364 $(this).delay(i * 50).transition({ 9365 'scale': 1 9366 }, 400, 'easeOutCubic'); 9367 }); 9368 9369 $('#slide-out-widget-area .bottom-text').transition({ 9370 'opacity': 0.7 9371 }, 400, 'easeOutCubic'); 9372 }, 750 + $scrollDelay2); 9373 9374 // Fade In BG Overlay 9375 setTimeout(function () { 9376 var $easing = ($('body.mobile').length > 0) ? 'easeOutCubic' : 'easeInOutQuint'; 9377 $offCanvasBG.css({ 9378 'height': '100%', 9379 'width': '100%' 9380 }).show().stop(true).transition({ 9381 'y': '0%' 9382 }, 920, $easing, function () { 9383 $('.slide-out-widget-area-toggle > div > a').removeClass('animating'); 9384 }); 9385 }, 50 + $scrollDelay2); 9386 9387 // Overflow state 9388 OCM_overflowState(); 9389 9390 if ($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && $('.container-wrap').hasClass('no-scroll')) { 9391 $('#ajax-content-wrap').addClass('at-content'); 9392 } 9393 9394 if ($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 || $('.mobile').length == 0 && $('#header-outer.transparent').length == 0) { 9395 $('#slide-out-widget-area.fullscreen .inner-wrap').css('padding-top', $headerOuterEl.height()); 9396 } 9397 9398 } 9399 9400 9401 /** 9402 * Off canvas menu: fullscreen close. 9403 * 9404 * @since 10.5 9405 */ 9406 function OCM_fullscreenClose() { 9407 9408 if ($('body.material').length > 0) { 9409 setTimeout(function () { 9410 $('header#top .slide-out-widget-area-toggle a').removeClass('menu-push-out'); 9411 }, 350); 9412 } 9413 9414 $('.slide-out-widget-area-toggle:not(.std-menu) .lines-button').removeClass('close'); 9415 $('.blurred-wrap').removeClass('blurred'); 9416 $('#slide-out-widget-area.fullscreen').transition({ 9417 'opacity': 0 9418 }, 700, 'easeOutQuad', function () { 9419 $('#slide-out-widget-area.fullscreen').hide().css('opacity', '1'); 9420 }).removeClass('open'); 9421 $('#slide-out-widget-area.fullscreen .widget').transition({ 9422 'opacity': 0 9423 }, 700, 'easeOutQuad', function () { 9424 $(this).transition({ 9425 y: '110px' 9426 }, 0); 9427 }); 9428 9429 setTimeout(function () { 9430 $('.off-canvas-menu-container .menu > li').transition({ 9431 y: '80px', 9432 'opacity': 0 9433 }, 0); 9434 $('#slide-out-widget-area .off-canvas-social-links li').transition({ 9435 'scale': 0 9436 }, 0); 9437 $('#slide-out-widget-area .off-canvas-social-links').removeClass('line-shown'); 9438 $('#slide-out-widget-area .bottom-text').transition({ 9439 'opacity': 0 9440 }, 0); 9441 9442 // Close submenu items 9443 $('#slide-out-widget-area .menuwrapper .menu').removeClass('subview'); 9444 $('#slide-out-widget-area .menuwrapper .menu li').removeClass('subview subviewopen'); 9445 $('#slide-out-widget-area.fullscreen .inner .off-canvas-menu-container').css('height', 'auto'); 9446 }, 800); 9447 9448 setTimeout(function () { 9449 if ($('.nectar-social.fixed').length == 0) { 9450 showToTop(); 9451 } 9452 $('.container-wrap').removeClass('no-shadow'); 9453 }, 500); 9454 9455 // Fade out overlay 9456 $offCanvasBG.stop(true).transition({ 9457 'opacity': 0 9458 }, 900, 'easeOutQuad', function () { 9459 9460 if ($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && $('.container-wrap').hasClass('no-scroll')) { 9461 $('#ajax-content-wrap').removeClass('at-content'); 9462 } 9463 if ($('.mobile #header-outer[data-permanent-transparent="false"]').length == 0) { 9464 $('#slide-out-widget-area.fullscreen .inner-wrap').css('padding-top', '0'); 9465 } 9466 9467 $('.slide-out-widget-area-toggle a').removeClass('animating'); 9468 9469 var $opacity = 0.4; 9470 9471 if ($offCanvasBG.hasClass('solid')) { 9472 $opacity = 1; 9473 } 9474 if ($offCanvasBG.hasClass('dark')) { 9475 $opacity = 0.93; 9476 } 9477 if ($offCanvasBG.hasClass('medium')) { 9478 $opacity = 0.6; 9479 } 9480 if ($offCanvasBG.hasClass('light')) { 9481 $opacity = 0.4; 9482 } 9483 $(this).css({ 9484 'height': '1px', 9485 'width': '1px', 9486 'opacity': $opacity 9487 }).transition({ 9488 y: '-100%' 9489 }, 0); 9490 }); 9491 9492 } 9493 9494 9495 /** 9496 * Off canvas menu: fullscreen alt open. 9497 * 9498 * @since 10.5 9499 */ 9500 function OCM_fullscreenAltOpen() { 9501 9502 if ($('body.material').length > 0) { 9503 $('header#top .slide-out-widget-area-toggle a').addClass('menu-push-out'); 9504 } 9505 9506 $('header#top .slide-out-widget-area-toggle:not(.std-menu) .lines-button').addClass('close'); 9507 $('#slide-out-widget-area.fullscreen-alt').show().addClass('open'); 9508 $offCanvasBG.addClass('open'); 9509 9510 $('body > div[class*="body-border"]').css('z-index', '9995'); 9511 9512 $('.off-canvas-menu-container .menu').transition({ 9513 y: '0px', 9514 'opacity': 1 9515 }, 0); 9516 9517 if ($('.nectar-social.fixed').length == 0) { 9518 hideToTop(); 9519 } 9520 9521 if ($('#header-outer.transparent').length > 0) { 9522 9523 if ($bodyBorderTop.length > 0) { 9524 $('.admin-bar #slide-out-widget-area-bg.fullscreen-alt').css({ 9525 'padding-top': ($bodyBorderTop.outerHeight(true) + 32) + 'px' 9526 }); 9527 $('body:not(.admin-bar) #slide-out-widget-area-bg.fullscreen-alt').css({ 9528 'padding-top': ($bodyBorderTop.outerHeight(true)) + 'px' 9529 }); 9530 } 9531 } 9532 9533 // Set translateY to 0 in all cases 9534 $headerOuterEl.stop(true).css('transform', 'translateY(0)'); 9535 9536 if ($('#logo .starting-logo').length > 0 && 9537 $window.width() > 1000 && 9538 $('#header-outer[data-format="centered-menu-bottom-bar"].fixed-menu').length == 0 && 9539 $('body.material #header-outer[data-condense="true"]').length == 0 && 9540 !nectarDOMInfo.usingFrontEndEditor) { 9541 9542 $headerOuterEl.stop(true).css('transform', 'translateY(0)').addClass('transparent'); 9543 if ($headerOuterEl.attr('data-transparent-header') != 'true') { 9544 $headerOuterEl.attr('data-transparent-header', 'true').addClass('pseudo-data-transparent'); 9545 } 9546 9547 } 9548 9549 $('.off-canvas-menu-container .clip-wrap').css('transition-duration', '0s'); 9550 9551 setTimeout(function () { 9552 9553 $('.off-canvas-menu-container .menu > li').each(function (i) { 9554 $(this).delay(i * 50).transition({ 9555 y: 0, 9556 'opacity': 1 9557 }, 750, 'easeOutCubic').addClass('no-pointer-events'); 9558 }); 9559 9560 setTimeout(function () { 9561 $('.off-canvas-menu-container .menu > li').removeClass('no-pointer-events'); 9562 $('.off-canvas-menu-container .clip-wrap').css('transition-duration', '.45s'); 9563 }, 500); 9564 9565 $('#slide-out-widget-area.fullscreen-alt .widget').each(function (i) { 9566 $(this).delay(i * 100).transition({ 9567 y: 0, 9568 'opacity': 1 9569 }, 650, 'easeOutCubic'); 9570 }); 9571 }, 200); 9572 9573 setTimeout(function () { 9574 $('#slide-out-widget-area .off-canvas-social-links').addClass('line-shown'); 9575 9576 $('#slide-out-widget-area .off-canvas-social-links li').css('opacity', '1').each(function (i) { 9577 $(this).delay(i * 50).transition({ 9578 'scale': 1 9579 }, 400, 'easeOutCubic'); 9580 }); 9581 $('#slide-out-widget-area .bottom-text').transition({ 9582 'opacity': 1 9583 }, 600, 'easeOutCubic'); 9584 }, 200); 9585 9586 // Fade In BG Overlay 9587 var $opacity = 0.4; 9588 9589 if ($offCanvasBG.hasClass('solid')) { 9590 $opacity = 1; 9591 } 9592 if ($offCanvasBG.hasClass('dark')) { 9593 $opacity = 0.97; 9594 } 9595 if ($offCanvasBG.hasClass('medium')) { 9596 $opacity = 0.6; 9597 } 9598 if ($offCanvasBG.hasClass('light')) { 9599 $opacity = 0.4; 9600 } 9601 $offCanvasBG.removeClass('no-transition'); 9602 9603 9604 $offCanvasBG.addClass('padding-removed').css({ 9605 'height': '100%', 9606 'width': '100%', 9607 'left': '0', 9608 'opacity': $opacity 9609 }); 9610 9611 9612 setTimeout(function () { 9613 $('.slide-out-widget-area-toggle > div > a').removeClass('animating'); 9614 }, 600); 9615 9616 9617 // Overflow state 9618 OCM_overflowState(); 9619 9620 if ($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && 9621 $('.container-wrap').hasClass('no-scroll')) { 9622 $('#ajax-content-wrap').addClass('at-content'); 9623 } 9624 9625 if ($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 || 9626 $('.mobile').length == 0 && $('#header-outer.transparent').length == 0) { 9627 $('#slide-out-widget-area.fullscreen-alt .inner-wrap').css('padding-top', $headerOuterEl.height()); 9628 } 9629 9630 } 9631 9632 9633 /** 9634 * Off canvas menu: fullscreen alt close. 9635 * 9636 * @since 10.5 9637 */ 9638 function OCM_fullscreenAltClose() { 9639 9640 if ($('body.material').length > 0) { 9641 setTimeout(function () { 9642 $('header#top .slide-out-widget-area-toggle a').removeClass('menu-push-out'); 9643 }, 350); 9644 } 9645 9646 $('.slide-out-widget-area-toggle:not(.std-menu) .lines-button').removeClass('close'); 9647 $('.blurred-wrap').removeClass('blurred'); 9648 $offCanvasBG.removeClass('open'); 9649 9650 $('#slide-out-widget-area.fullscreen-alt .widget').transition({ 9651 'opacity': 0 9652 }, 500, 'easeOutQuad', function () { 9653 $(this).transition({ 9654 y: '40px' 9655 }, 0); 9656 }); 9657 $('#slide-out-widget-area .bottom-text, #slide-out-widget-area .off-canvas-social-links li').transition({ 9658 'opacity': 0 9659 }, 250, 'easeOutQuad'); 9660 $('#slide-out-widget-area .off-canvas-social-links').removeClass('line-shown'); 9661 9662 $('.off-canvas-menu-container .menu').transition({ 9663 y: '-13px', 9664 'opacity': 0 9665 }, 400); 9666 9667 9668 setTimeout(function () { 9669 $('.off-canvas-menu-container .menu > li').stop(true, true).transition({ 9670 y: '40px', 9671 'opacity': 0 9672 }, 0); 9673 $('#slide-out-widget-area .off-canvas-social-links li').transition({ 9674 'scale': 0 9675 }, 0); 9676 $('#slide-out-widget-area .off-canvas-social-links').removeClass('line-shown'); 9677 9678 // Close submenu items 9679 $('#slide-out-widget-area .menuwrapper .menu').removeClass('subview'); 9680 $('#slide-out-widget-area .menuwrapper .menu li').removeClass('subview subviewopen'); 9681 $('#slide-out-widget-area.fullscreen-alt .inner .off-canvas-menu-container').css('height', 'auto'); 9682 9683 if ($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && $('.container-wrap').hasClass('no-scroll')) { 9684 $('#ajax-content-wrap').removeClass('at-content'); 9685 } 9686 9687 if ($('.mobile #header-outer[data-permanent-transparent="false"]').length == 0) { 9688 $('#slide-out-widget-area.fullscreen-alt .inner-wrap').css('padding-top', '0'); 9689 } 9690 9691 $('.slide-out-widget-area-toggle a').removeClass('animating'); 9692 9693 $offCanvasBG.css({ 9694 'height': '1px', 9695 'width': '1px', 9696 'left': '-100%' 9697 }); 9698 9699 $('#slide-out-widget-area.fullscreen-alt').hide().removeClass('open'); 9700 9701 }, 550); 9702 9703 setTimeout(function () { 9704 if ($('.nectar-social.fixed').length == 0) { 9705 showToTop(); 9706 } 9707 }, 600); 9708 9709 // Fade out overlay 9710 setTimeout(function () { 9711 $offCanvasBG.removeClass('padding-removed'); 9712 }, 50); 9713 9714 9715 var borderDelay = ($bodyBorderHeaderColorMatch == true) ? 150 : 50; 9716 9717 setTimeout(function () { 9718 $offCanvasBG.stop(true).css({ 9719 'opacity': 0 9720 }); 9721 if ($('#header-outer[data-transparent-header="true"]').length > 0) { 9722 $('body > div[class*="body-border"]').css('z-index', '10000'); 9723 } 9724 }, borderDelay); 9725 9726 setTimeout(function () { 9727 $('#header-outer.transparent.small-nav, #header-outer.transparent.detached, #header-outer:not([data-permanent-transparent="1"]).transparent.scrolled-down').removeClass('transparent'); 9728 9729 if ($headerOuterEl.hasClass('pseudo-data-transparent')) { 9730 9731 $headerOuterEl.attr('data-transparent-header', 'false') 9732 .removeClass('pseudo-data-transparent') 9733 .removeClass('transparent'); 9734 } 9735 9736 }, 100); 9737 9738 } 9739 9740 9741 /** 9742 * Off canvas menu: simple dropdown open. 9743 * 9744 * @since 10.5 9745 */ 9746 function OCM_simpleDropdownOpen() { 9747 9748 $('#mobile-menu').show(); 9749 9750 $('header#top .slide-out-widget-area-toggle:not(.std-menu) .lines-button').addClass('close'); 9751 9752 if ($('body.material').length > 0) { 9753 $('header#top .slide-out-widget-area-toggle a').addClass('menu-push-out'); 9754 } 9755 9756 setTimeout(function () { 9757 $('.slide-out-widget-area-toggle > div > a').removeClass('animating'); 9758 }, 100); 9759 9760 } 9761 9762 /** 9763 * Off canvas menu: simple dropdown close. 9764 * 9765 * @since 10.5 9766 */ 9767 function OCM_simpleDropdownClose() { 9768 $('#mobile-menu').hide(); 9769 9770 $('.slide-out-widget-area-toggle:not(.std-menu) .lines-button').removeClass('close'); 9771 9772 setTimeout(function () { 9773 if ($('body.material').length > 0) { 9774 $('header#top .slide-out-widget-area-toggle a').removeClass('menu-push-out'); 9775 } 9776 $('.slide-out-widget-area-toggle a').removeClass('animating'); 9777 }, 350); 9778 } 9779 9780 9781 /** 9782 * Off canvas menu: simple dropdown click events. 9783 * 9784 * @since 10.5 9785 */ 9786 function OCM_simpleStyleInit() { 9787 9788 if( $('#header-outer #mobile-menu').length == 0 ) { 9789 return; 9790 } 9791 9792 $('#header-outer #mobile-menu li.megamenu').removeClass('megamenu'); 9793 9794 // Add icons/markup. 9795 $('#header-outer #mobile-menu ul li').each(function(){ 9796 $(this).find('a').wrapInner('<span></span>'); 9797 if($(this).find('> ul').length > 0) { 9798 $(this).find('> a').append('<span class="sf-sub-indicator"><i class="fa fa-angle-down"></i></span>'); 9799 } 9800 }); 9801 9802 // Click event. 9803 $('#header-outer #mobile-menu .sf-sub-indicator').on('click', function(){ 9804 9805 var $parentLI = $(this).parent().parent(); 9806 9807 $parentLI.toggleClass('current-open-item'); 9808 9809 // Open. 9810 if( $parentLI.hasClass('current-open-item') ) { 9811 $parentLI.find('> ul').show(); 9812 setTimeout(function(){ 9813 $parentLI.addClass('visible'); 9814 },30); 9815 } else { 9816 // Close. 9817 $parentLI.find('ul').hide(); 9818 // Ensure open children also close. 9819 $parentLI.find('li').removeClass('visible').removeClass('current-open-item'); 9820 $parentLI.removeClass('visible'); 9821 } 9822 9823 return false;
9824 9825 }); 9826 9827 // Resize event. 9828 $window.on('smartresize', function(){ 9829 9830 if( nectarDOMInfo.winW > 1000 && $('.slide-out-widget-area-toggle.mobile-icon a.open').length > 0 ) { 9831 9832 $('.slide-out-widget-area-toggle.mobile-icon a') 9833 .addClass('non-human-allowed') 9834 .trigger('click'); 9835 9836 setTimeout(function () { 9837 $('.slide-out-widget-area-toggle.mobile-icon a').removeClass('non-human-allowed'); 9838 }, 100); 9839 9840 } 9841 9842 }); 9843 9844 } 9845 9846 9847 /** 9848 * Off canvas menu click triggered styles initialization 9849 * 9850 * @since 10.5 9851 */ 9852 function OCM_clickTriggeredStylesInit() { 9853 9854 // Click triggered open bind. 9855 $body.on('click', '.slide-out-widget-area-toggle:not(.std-menu) a.closed:not(.animating), .nectar-ocm-trigger-open', function () { 9856 9857 if (nectarBoxRoll.animating == 'true' || $('.slide-out-from-right-hover').length > 0) { 9858 return false; 9859 } 9860 9861 $headerOuterEl.removeClass('no-transition'); 9862 9863 // Slide out from right. 9864 if ($offCanvasEl.hasClass('slide-out-from-right')) { 9865 OCM_slideOutRightOpen(); 9866 } 9867 // Fullscreen. 9868 else if ($offCanvasEl.hasClass('fullscreen')) { 9869 OCM_fullscreenOpen(); 9870 } 9871 // Fullscreen Alt. 9872 else if ($offCanvasEl.hasClass('fullscreen-alt')) { 9873 OCM_fullscreenAltOpen(); 9874 } 9875 // Simple dropdown. 9876 else if( $('#header-outer #mobile-menu').length > 0 ) { 9877 OCM_simpleDropdownOpen(); 9878 } 9879 9880 9881 // Add open class 9882 if( $('#header-outer #mobile-menu').length == 0 ) { 9883 9884 $headerOuterEl 9885 .removeClass('side-widget-closed') 9886 .addClass('side-widget-open'); 9887 9888 9889 // Give header transparent state 9890 if ($('#header-outer[data-transparency-option="1"]').length > 0 && 9891 $('#boxed').length == 0 && 9892 $('#header-outer[data-full-width="true"]').length > 0 && 9893 !nectarDOMInfo.usingFrontEndEditor) { 9894 9895 if ($('body.material[data-slide-out-widget-area-style="slide-out-from-right"]').length == 0 && 9896 $('body.material #header-outer[data-condense="true"]').length == 0) { 9897 9898 $headerOuterEl.addClass('transparent'); 9899 9900 } 9901 9902 } 9903 9904 // Dark slide transparent nav 9905 if ($('#header-outer.dark-slide.transparent').length > 0 && 9906 $('#boxed').length == 0 && 9907 $('body.material-ocm-open').length == 0) { 9908 $headerOuterEl 9909 .removeClass('dark-slide') 9910 .addClass('temp-removed-dark-slide'); 9911 } 9912 9913 } // Not using simple OCM. 9914 9915 9916 $('.slide-out-widget-area-toggle > div > a') 9917 .removeClass('closed') 9918 .addClass('open') 9919 .attr('aria-expanded','true'); 9920 9921 $('.slide-out-widget-area-toggle > div > a').addClass('animating'); 9922 9923 return false; 9924 9925 }); 9926 9927 9928 9929 // Close event bind. 9930 $body.on('click', '.slide-out-widget-area-toggle:not(.std-menu) a.open:not(.animating), #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) { 9931 9932 if (e.originalEvent == undefined && 9933 $('.slide_out_area_close.non-human-allowed').length == 0 && 9934 $('.slide-out-widget-area-toggle.mobile-icon a.non-human-allowed').length == 0) { 9935 return; 9936 } 9937 9938 if ($('.slide-out-widget-area-toggle:not(.std-menu) a.animating').length > 0) { 9939 return; 9940 } 9941 9942 $headerOuterEl.removeClass('no-transition'); 9943 9944 $('.slide-out-widget-area-toggle:not(.std-menu) a') 9945 .removeClass('open') 9946 .addClass('closed') 9947 .attr('aria-expanded','false'); 9948 9949 $('.slide-out-widget-area-toggle:not(.std-menu) a') 9950 .addClass('animating'); 9951 9952 // Slide out from right. 9953 if ($offCanvasEl.hasClass('slide-out-from-right')) { 9954 OCM_slideOutRightClose(); 9955 } 9956 9957 // Fullscreen. 9958 else if ($offCanvasEl.hasClass('fullscreen')) { 9959 OCM_fullscreenClose(); 9960 } 9961 // Fullscreen alt. 9962 else if ($offCanvasEl.hasClass('fullscreen-alt')) { 9963 OCM_fullscreenAltClose(); 9964 } 9965 // Simple dropdown. 9966 else if( $('#header-outer #mobile-menu').length > 0 ) { 9967 OCM_simpleDropdownClose(); 9968 } 9969 9970 if( $('#header-outer #mobile-menu').length == 0 ) { 9971 9972 // Dark slide transparent nav 9973 if ($('#header-outer.temp-removed-dark-slide.transparent').length > 0 && $('#boxed').length == 0) { 9974 $headerOuterEl 9975 .removeClass('temp-removed-dark-slide') 9976 .addClass('dark-slide'); 9977 } 9978 9979 // Remove header transparent state 9980 if ($('#header-outer[data-permanent-transparent="1"]').length == 0 && $('#slide-out-widget-area.fullscreen-alt').length == 0) { 9981 9982 if ($('.nectar-box-roll').length == 0) { 9983 if ($('#header-outer.small-nav').length > 0 || 9984 $('#header-outer.scrolled-down').length > 0) { 9985 $headerOuterEl.removeClass('transparent'); 9986 } 9987 } 9988 else { 9989 if ($('#header-outer.small-nav').length > 0 || 9990 $('#header-outer.scrolled-down').length > 0 || 9991 $('.container-wrap.auto-height').length > 0) { 9992 $headerOuterEl.removeClass('transparent'); 9993 } 9994 } 9995 9996 } 9997 9998 // Remove hidden menu 9999 $headerOuterEl.removeClass('hidden-menu'); 10000 10001 $headerOuterEl 10002 .removeClass('side-widget-open') 10003 .addClass('side-widget-closed'); 10004 10005 } // Not using simple OCM. 10006 10007 return false;
10008 10009 }); 10010 10011 } 10012 10013 10014 /** 10015 * Off canvas menu main initialization. 10016 * 10017 * @since 10.5 10018 */ 10019 function OCM_init() { 10020 10021 if ($('#slide-out-widget-area.slide-out-from-right-hover').length > 0) { 10022 OCM_slideOutRightHoverInit(); 10023 } else { 10024 OCM_clickTriggeredStylesInit(); 10025 OCM_simpleStyleInit(); 10026 } 10027 10028 10029 if ($('body.material[data-slide-out-widget-area-style*="slide-out-from-right"]').length == 0 && 10030 $('#slide-out-widget-area[data-dropdown-func="separate-dropdown-parent-link"]').length == 0) { 10031 10032 fullscreenMenuInit(); 10033 10034 } else if ($('body.using-mobile-browser[data-slide-out-widget-area-style="slide-out-from-right-hover"]').length > 0) { 10035 10036 // Close OCM on mobile when clicking anchor on same page 10037 $('body #slide-out-widget-area .inner .off-canvas-menu-container li a[href]').on('click', function () { 10038 10039 if ($(this).attr('href') != '#') { 10040 OCM_close($(this).parent()); 10041 } 10042 10043 }); 10044 10045 } 10046 10047 // Page fullscreen row close OCM fullscreen 10048 if ($('#nectar_fullscreen_rows').length > 0 && $('body[data-slide-out-widget-area-style*="fullscreen"]').length > 0) { 10049 10050 $('body #slide-out-widget-area .inner .off-canvas-menu-container li a[href]').on('click', function () { 10051 var $link_href = ($(this).is('[href*="#"]')) ? $(this).attr('href') : ''; 10052 if ($link_href != '#' && $('div[data-fullscreen-anchor-id="' + $link_href.substr($link_href.indexOf("#") + 1) + '"]').length > 0) { 10053 10054 setTimeout(function () { 10055 10056 $('#slide-out-widget-area .slide_out_area_close') 10057 .addClass('non-human-allowed') 10058 .trigger('click'); 10059 10060 }, 100); 10061 10062 setTimeout(function () { 10063 $('#slide-out-widget-area .slide_out_area_close').removeClass('non-human-allowed'); 10064 }, 150); 10065 10066 } 10067 10068 }); 10069 } 10070 10071 10072 // Submenu link hover fix 10073 $body.on('mouseover', '#slide-out-widget-area .off-canvas-menu-container .menuwrapper > .sub-menu li > a', function () { 10074 var $currentTxt = $(this).text(); 10075 $('.off-canvas-menu-container .menuwrapper .menu li > a').removeClass('hovered'); 10076 $('.off-canvas-menu-container .menuwrapper .menu li > a:contains(' + $currentTxt + ')').addClass('hovered'); 10077 }); 10078 10079 $body.on('mouseover', '.off-canvas-menu-container .menuwrapper .menu li > a', function () { 10080 $('.off-canvas-menu-container .menuwrapper .menu li > a').removeClass('hovered'); 10081 }); 10082 10083 10084 // Bind mousewheel. 10085 setTimeout(OCM_scrolling, 500); 10086 10087 // Handle mobile scrolling. 10088 if (nectarDOMInfo.usingMobileBrowser) { 10089 $offCanvasEl.addClass('mobile'); 10090 } 10091 10092 10093 } 10094 10095 10096 10097 10098 /** 10099 * Off canvas menu scrolling. 10100 * 10101 * @since 10.5 10102 */ 10103 function OCM_scrolling() { 10104 10105 $offCanvasEl.mousewheel(function (event, delta) { 10106 10107 this.scrollTop -= (delta * 30); 10108 10109 event.preventDefault(); 10110 }); 10111 10112 } 10113 10114 10115 10116 /** 10117 * Off canvas menu close. 10118 * 10119 * @since 10.5 10120 */ 10121 function OCM_close(item) { 10122 10123 if ($('#slide-out-widget-area.open').length > 0) { 10124 10125 var $windowCurrentLocation = window.location.href.split("#")[0]; 10126 var $windowClickedLocation = item.find('> a').attr('href').split("#")[0]; 10127 10128 if ($windowCurrentLocation == $windowClickedLocation || item.find('a[href^="#"]').length > 0) { 10129 if (item.parents('.slide-out-from-right-hover').length > 0) { 10130 $('.slide-out-widget-area-toggle.slide-out-hover-icon-effect a').trigger('click'); 10131 } else { 10132 $('.slide-out-widget-area-toggle a').trigger('click'); 10133 } 10134 10135 } 10136 } 10137 10138 } 10139 10140 10141 10142 10143 /** 10144 * Click based submenus. 10145 * 10146 * Used by left header layout and off canvas menu. 10147 * 10148 * @since 10.5 10149 */ 10150 function clickToggleSubmenus() { 10151 10152 if (!$('#header-outer[data-format="left-header"]').length > 0 &&
10153 !$('body.material[data-slide-out-widget-area-style*="slide-out-from-right"]').length > 0 && 10154 !$('#slide-out-widget-area[data-dropdown-func="separate-dropdown-parent-link"]').length > 0) { 10155 return; 10156 } 10157 10158 // Remove megamenu class. 10159 $('#header-outer[data-format="left-header"] nav li.megamenu').removeClass('megamenu'); 10160 10161 var $ocm_link_selector; 10162 10163 if ($('#slide-out-widget-area[data-dropdown-func="separate-dropdown-parent-link"]').length > 0) { 10164 $ocm_link_selector = '#slide-out-widget-area .off-canvas-menu-container li.menu-item-has-children > .ocm-dropdown-arrow'; 10165 } else { 10166 $ocm_link_selector = 'body.material #slide-out-widget-area[class*="slide-out-from-right"] .off-canvas-menu-container li.menu-item-has-children > a'; 10167 } 10168 10169 // Click event. 10170 $('#header-outer[data-format="left-header"] nav li.menu-item-has-children > a, ' + $ocm_link_selector).on('click', function () { 10171 10172 if ($(this).parent().hasClass('open-submenu')) { 10173 $(this).parent().find('.sub-menu').css({ 10174 'max-height': '0' 10175 }); 10176 $(this).parent().removeClass('open-submenu'); 10177 } else { 10178 10179 // Get max height. 10180 var $that = $(this); 10181 var $maxSubMenuHeight; 10182 10183 $that.parent() 10184 .find('> .sub-menu') 10185 .addClass('no-trans'); 10186 10187 setTimeout(function () { 10188 10189 $that.parent().find('> .sub-menu').css({ 10190 'max-height': 'none', 10191 'position': 'absolute', 10192 'visibility': 'hidden' 10193 }); 10194 10195 $maxSubMenuHeight = $that.parent().find('> .sub-menu').height(); 10196 10197 $that.parent() 10198 .find('> .sub-menu') 10199 .removeClass('no-trans'); 10200 10201 $that.parent().find('> .sub-menu').css({ 10202 'max-height': '0', 10203 'position': 'relative', 10204 'visibility': 'visible' 10205 }); 10206 10207 }, 25); 10208 10209 setTimeout(function () { 10210 10211 // Reset Max Height. 10212 $that.closest('ul') 10213 .find('li.menu-item-has-children') 10214 .removeClass('open-submenu'); 10215 10216 $that.closest('ul').find('li.menu-item-has-children > .sub-menu').css({ 10217 'max-height': '0' 10218 }); 10219 10220 $that.parent().addClass('open-submenu'); 10221 10222 $that.parent() 10223 .find('> .sub-menu') 10224 .css('max-height', $maxSubMenuHeight); 10225 10226 // Add height to open parents. 10227 if ($that.parents('ul').length > 0) { 10228 10229 $that.parents('ul:not(.sf-menu)').each(function () { 10230 $(this).css('max-height'); 10231 $(this).css('max-height', parseInt($(this).height() + parseInt($(this).css('padding-top')) * 2 + $maxSubMenuHeight) + 'px'); 10232 }); 10233 } 10234 10235 10236 }, 50); 10237 } 10238 10239 return false; 10240 10241 }); 10242 10243 // Start open for current page items. 10244 if($('#header-outer[data-format="left-header"] nav .sf-menu > .current-menu-ancestor.menu-item-has-children > ul > li.current-menu-item').length > 0) { 10245 $('#header-outer[data-format="left-header"] nav .sf-menu > .current-menu-ancestor.menu-item-has-children > a').trigger('click'); 10246 } 10247 10248 10249 } 10250 10251 10252 10253 10254 10255 10256 10257 10258 /** 10259 * DLMenu - plugin used for submenus in off canvas menu. 10260 * 10261 * @since 6.0 10262 */ 10263 $.DLMenu = function (options, element) { 10264 this.$el = $(element); 10265 this._init(options); 10266 }; 10267 10268 // the options 10269 $.DLMenu.defaults = { 10270 // classes for the animation effects 10271 animationClasses: { 10272 classin: 'dl-animate-in-1', 10273 classout: 'dl-animate-out-1' 10274 }, 10275 onLevelClick: function () { 10276 return false; 10277 }, 10278 onLinkClick: function () { 10279 return false; 10280 } 10281 }; 10282 10283 $.DLMenu.prototype = { 10284 _init: function (options) { 10285 10286 // options 10287 this.options = $.extend(true, {}, $.DLMenu.defaults, options); 10288 this._config(); 10289 10290 var animEndEventNames = { 10291 'WebkitAnimation': 'webkitAnimationEnd', 10292 'OAnimation': 'oAnimationEnd', 10293 'msAnimation': 'MSAnimationEnd', 10294 'animation': 'animationend' 10295 }, 10296 transEndEventNames = { 10297 'WebkitTransition': 'webkitTransitionEnd', 10298 'MozTransition': 'transitionend', 10299 'OTransition': 'oTransitionEnd', 10300 'msTransition': 'MSTransitionEnd', 10301 'transition': 'transitionend' 10302 }; 10303 // animation end event name 10304 this.animEndEventName = animEndEventNames['animation'] + '.menu'; 10305 // transition end event name 10306 this.transEndEventName = transEndEventNames['transition'] + '.menu', 10307 // support for css animations and css transitions 10308 this.supportAnimations = true, 10309 this.supportTransitions = true; 10310 this._initEvents(); 10311 10312 }, 10313 _config: function () { 10314 this.open = false;
10315 this.$trigger = this.$el.children('.trigger'); 10316 this.$menu = this.$el.children('ul.menu'); 10317 this.$menuitems = this.$menu.find('li:not(.back) > a'); 10318 10319 this.$el.find('ul.sub-menu') 10320 .prepend('<li class="back"><a href="#"> ' + $offCanvasEl.attr('data-back-txt') + ' </a></li>'); 10321 10322 this.$back = this.$menu.find('li.back'); 10323 }, 10324 _initEvents: function () { 10325 10326 var self = this; 10327 10328 this.$trigger.on('click.menu', function () { 10329 10330 if (self.open) { 10331 self._closeMenu(); 10332 } else { 10333 self._openMenu(); 10334 } 10335 return false; 10336 10337 }); 10338 10339 this.$menuitems.on('click.menu', function (event) { 10340 10341 10342 var $item = $(this).parent('li'), 10343 $submenu = $item.children('ul.sub-menu'); 10344 10345 $('.fullscreen-alt .off-canvas-menu-container .clip-wrap, .fullscreen-alt .off-canvas-menu-container .clip-wrap span').css('transition-duration', '0s'); 10346 10347 if ($submenu.length > 0) { 10348 10349 var $flyin = $submenu.clone().css('opacity', 0).insertAfter(self.$menu), 10350 onAnimationEndFn = function () { 10351 self.$menu.off(self.animEndEventName).removeClass(self.options.animationClasses.classout).addClass('subview'); 10352 $item.addClass('subviewopen').parents('.subviewopen:first').removeClass('subviewopen').addClass('subview'); 10353 $flyin.remove(); 10354 setTimeout(function () { 10355 $('.off-canvas-menu-container .menu > li').removeClass('no-pointer-events'); 10356 $('.off-canvas-menu-container .clip-wrap, .off-canvas-menu-container .clip-wrap span').css('transition-duration', '.45s'); 10357 }, 300); 10358 10359 }; 10360 10361 setTimeout(function () { 10362 $flyin.addClass(self.options.animationClasses.classin); 10363 self.$menu.addClass(self.options.animationClasses.classout); 10364 if (self.supportAnimations) { 10365 self.$menu.on(self.animEndEventName, onAnimationEndFn); 10366 } else { 10367 onAnimationEndFn.call(); 10368 } 10369 10370 self.options.onLevelClick($item, $item.children('a:first').text()); 10371 }); 10372 10373 10374 $item.parents('.off-canvas-menu-container').css('height', $item.parents('.off-canvas-menu-container').find('.menuwrapper .menu').height()).transition({ 10375 'height': $flyin.height() 10376 }, 500, 'easeInOutQuad'); 10377 10378 10379 return false; 10380 10381 } else { 10382 10383 self.options.onLinkClick($item.find('> a'), event); 10384 } 10385 10386 OCM_close($item); 10387 10388 }); 10389 10390 10391 10392 this.$back.on('click.menu', function () { 10393 10394 var $this = $(this), 10395 $submenu = $this.parents('ul.sub-menu:first'), 10396 $item = $submenu.parent(), 10397 $flyin = $submenu.clone().insertAfter(self.$menu); 10398 10399 var onAnimationEndFn = function () { 10400 self.$menu.off(self.animEndEventName).removeClass(self.options.animationClasses.classin); 10401 $flyin.remove(); 10402 }; 10403 10404 setTimeout(function () { 10405 $flyin.addClass(self.options.animationClasses.classout); 10406 self.$menu.addClass(self.options.animationClasses.classin); 10407 if (self.supportAnimations) { 10408 self.$menu.on(self.animEndEventName, onAnimationEndFn); 10409 } else { 10410 onAnimationEndFn.call(); 10411 } 10412 10413 $item.removeClass('subviewopen'); 10414 10415 var $subview = $this.parents('.subview:first'); 10416 if ($subview.is('li')) { 10417 $subview.addClass('subviewopen'); 10418 } 10419 $subview.removeClass('subview'); 10420 }); 10421 10422 10423 $item.parents('.off-canvas-menu-container').css('height', $item.parents('.off-canvas-menu-container').find('.menuwrapper .menu').height()); 10424 10425 setTimeout(function () { 10426 $item.parents('.off-canvas-menu-container').transition({ 10427 'height': $item.parent().height() 10428 }, 500, 'easeInOutQuad'); 10429 }, 50); 10430 10431 10432 return false; 10433 10434 }); 10435 10436 }, 10437 closeMenu: function () { 10438 if (this.open) { 10439 this._closeMenu(); 10440 } 10441 }, 10442 _closeMenu: function () { 10443 var self = this, 10444 onTransitionEndFn = function () { 10445 self.$menu.off(self.transEndEventName); 10446 self._resetMenu(); 10447 }; 10448 10449 this.$menu.removeClass('menuopen'); 10450 this.$menu.addClass('menu-toggle'); 10451 this.$trigger.removeClass('active'); 10452 10453 if (this.supportTransitions) { 10454 this.$menu.on(this.transEndEventName, onTransitionEndFn); 10455 } else { 10456 onTransitionEndFn.call(); 10457 } 10458 10459 this.open = false;
10460 }, 10461 openMenu: function () { 10462 if (!this.open) { 10463 this._openMenu(); 10464 } 10465 }, 10466 _openMenu: function () { 10467 var self = this; 10468 $body.off('click').on('click.menu', function () { 10469 self._closeMenu(); 10470 }); 10471 this.$menu.addClass('menuopen menu-toggle').on(this.transEndEventName, function () { 10472 $(this).removeClass('menu-toggle'); 10473 }); 10474 this.$trigger.addClass('active'); 10475 this.open = true; 10476 }, 10477 _resetMenu: function () { 10478 this.$menu.removeClass('subview'); 10479 this.$menuitems.removeClass('subview subviewopen'); 10480 } 10481 }; 10482 10483 var logError = function (message) { 10484 if (window.console) { 10485 window.console.error(message); 10486 } 10487 }; 10488 10489 $.fn.dlmenu = function (options) { 10490 if (typeof options === 'string') { 10491 var args = Array.prototype.slice.call(arguments, 1); 10492 this.each(function () { 10493 var instance = $.data(this, 'menu'); 10494 if (!instance) { 10495 logError("cannot call methods on menu prior to initialization; " + 10496 "attempted to call method '" + options + "'"); 10497 return; 10498 } 10499 if (!$.isFunction(instance[options]) || options.charAt(0) === "_") { 10500 logError("no such method '" + options + "' for menu instance"); 10501 return; 10502 } 10503 instance[options].apply(instance, args); 10504 }); 10505 } else { 10506 this.each(function () { 10507 var instance = $.data(this, 'menu'); 10508 if (instance) { 10509 instance._init(); 10510 } else { 10511 instance = $.data(this, 'menu', new $.DLMenu(options, this)); 10512 } 10513 }); 10514 } 10515 return this; 10516 }; 10517 10518 10519 /** 10520 * Initialize DL menu. 10521 * 10522 * @since 6.0 10523 */ 10524 function fullscreenMenuInit() { 10525 10526 $('#slide-out-widget-area .off-canvas-menu-container .menu').wrap('<div class="menu-wrap menuwrapper" />'); 10527 $('#slide-out-widget-area .off-canvas-menu-container .menu').addClass('menuopen'); 10528 10529 var $ocmAnimationClassNum = ($('#slide-out-widget-area.fullscreen-alt').length > 0) ? '4' : '5'; 10530 $('#slide-out-widget-area .off-canvas-menu-container .menu-wrap').dlmenu({ 10531 animationClasses: { 10532 classin: 'dl-animate-in-' + $ocmAnimationClassNum, 10533 classout: 'dl-animate-out-' + $ocmAnimationClassNum 10534 } 10535 }); 10536 10537 } 10538 10539 10540 10541 10542 10543 10544 10545 10546 10547 /** 10548 * Set the page header height when using "slide down" theme option effect. 10549 * 10550 * @since 2.0 10551 */ 10552 function pageHeaderSlideInHeight() { 10553 10554 var pageHeaderHeight = parseInt($pageHeaderBG.height()); 10555 $('body[data-aie="slide-down"] #page-header-wrap:not(.fullscreen-header)').css('height', pageHeaderHeight + 'px'); 10556 10557 } 10558 10559 10560 /** 10561 * Fired after page header image has loaded. 10562 * 10563 * @since 2.0 10564 */ 10565 function pageHeaderAfterLoad() { 10566 10567 10568 // Transparent 10569 if ($('#header-outer[data-transparent-header="true"]').length > 0) { 10570 $('#page-header-bg[data-parallax="1"]').css({ 10571 'top': nectarDOMInfo.adminBarHeight 10572 }); 10573 } else { 10574 10575 if ($('body[data-header-resize="0"]').length == 0 && $('body.material').length == 0) { 10576 $('#page-header-bg[data-parallax="1"]').css({ 10577 'top': ($('#page-header-wrap').offset().top) + 'px' 10578 }); 10579 } 10580 } 10581 10582 //fade in header 10583 if ($('#ajax-content-wrap').length == 0 || !$body.hasClass('ajax-loaded')) { 10584 $('#page-header-bg[data-parallax="1"]').animate({ 10585 'opacity': 1 10586 }, 350, 'easeInCubic'); 10587 } else if ($('#ajax-content-wrap').length == 1) { 10588 $('#page-header-bg[data-parallax="1"]').css({ 10589 'opacity': 1 10590 }); 10591 } 10592 10593 $('#page-header-bg[data-parallax="1"] .nectar-particles').append('<div class="fade-out" />'); 10594 10595 } 10596 10597 10598 10599 /** 10600 * Page header unload event. 10601 * 10602 * @since 2.0 10603 */ 10604 function pageHeaderUnload() { 10605 10606 if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1 || navigator.userAgent.match(/(iPod|iPhone|iPad)/)) { 10607 window.onunload = function () { 10608 10609 pageHeaderInit(); 10610
10611 $('#page-header-bg[data-parallax="1"] .span_6').css({ 10612 'opacity': 1 10613 }); 10614 10615 }; 10616 } 10617 10618 } 10619 10620 10621 /** 10622 * Page header initialization. 10623 * 10624 * @since 2.0 10625 */ 10626 function pageHeaderInit() { 10627 10628 var $headerRemoveStickyness = ($('body[data-hhun="1"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length > 0) ? 1 : 0; 10629 10630 if ($('#page-header-bg[data-parallax="1"]').length > 0) { 10631 10632 // Fade in 10633 var img = new Image(), 10634 pageHeaderHeight = parseInt($pageHeaderBG.height()), 10635 $initialImgCheck = extractUrl($('#page-header-bg[data-parallax="1"]').css('background-image')); 10636 10637 if ($initialImgCheck && $initialImgCheck.indexOf('.') !== -1) { 10638 img.onload = function () { 10639 pageHeaderAfterLoad(); 10640 }; 10641 10642 img.src = extractUrl($('#page-header-bg[data-parallax="1"]').css('background-image')); 10643 10644 } else { 10645 pageHeaderAfterLoad(); 10646 } 10647 10648 10649 if ($('body[data-hhun="1"]').length > 0 && !$('#header-outer[data-remove-fixed="1"]').length > 0) { 10650 $headerOuterEl.addClass('parallax-contained'); 10651 } 10652 10653 // Calculate on scroll. 10654 window.addEventListener('scroll', function () { 10655 if( nectarDOMInfo.winW > 1000 ) { 10656 window.requestAnimationFrame(parallaxPageHeaderCalc); 10657 } 10658 }, false); 10659 10660 } 10661 10662 var $pt_timeout = ($('body[data-ajax-transitions="true"]').length > 0 && $('#page-header-bg[data-animate-in-effect="slide-down"]').length > 0) ? 350 : 0; 10663 10664 if ($pageHeaderBG.length > 0) { 10665 10666 // Slide in height effect. 10667 setTimeout(function () { 10668 pageHeaderSlideInHeight(); 10669 }, $pt_timeout); 10670 10671 $('#page-header-bg[data-animate-in-effect="fade-in"]').addClass('loaded'); 10672 10673 // Using bg classname. 10674 var $initialImgCheckAscend = extractUrl($pageHeaderBG.css('background-image')); 10675 if ($initialImgCheckAscend && $initialImgCheckAscend.indexOf('.') !== -1) { 10676 $pageHeaderBG.addClass('has-bg'); 10677 } 10678 10679 // Resize slide in height. 10680 $window.on('smartresize',pageHeaderSlideInHeight); 10681 10682 } 10683 10684 function parallaxPageHeaderCalc() { 10685 10686 var $scrollTop = nectarDOMInfo.scrollTop, 10687 $multiplier1 = 0.4, 10688 $multiplier2 = 0.09; 10689 10690 if (!$body.hasClass('mobile') && 10691 navigator.userAgent.match(/iPad/i) == null && 10692 $('body.material-ocm-open').length == 0) { 10693 10694 // Material needs to set top for when effect wrap sets transform. 10695 if (nectarDOMInfo.winW > 1000) { 10696 $('body:not("[data-header-format=\'left-header\']") #page-header-bg').css('top', $('#ajax-content-wrap').offset().top); 10697 } else { 10698 $('body:not("[data-header-format=\'left-header\']") #page-header-bg').css('top', '0'); 10699 } 10700 10701 // Calc bg pos. 10702 if ($('#page-header-bg.out-of-sight').length == 0) { 10703 10704 if ($headerRemoveStickyness) { 10705 $pageHeaderBG.css({ 10706 'transform': 'translateY(' + $scrollTop * -0.55 + 'px)' 10707 }); 10708 $('#page-header-bg .span_6 .inner-wrap, body[data-button-style="rounded"] #page-header-bg .scroll-down-wrap, #page-header-bg[data-post-hs="default_minimal"] .author-section').css({ 10709 'transform': 'translateY(' + $scrollTop * -0.45 + 'px)' 10710 }); 10711 10712 } else { 10713 $pageHeaderBG.css({ 10714 'transform': 'translateY(' + $scrollTop * -$multiplier1 + 'px)' 10715 }); 10716 $('#page-header-bg .span_6 .inner-wrap, body[data-button-style="rounded"] #page-header-bg .section-down-arrow, #page-header-bg[data-post-hs="default_minimal"] .author-section').css({ 10717 'transform': 'translateY(' + $scrollTop * -$multiplier2 + 'px)' 10718 }); 10719 $('#page-header-bg .span_6 .inner-wrap, #page-header-bg[data-post-hs="default_minimal"] .author-section').css({ 10720 'opacity': 1 - ($scrollTop / (pageHeaderHeight - 60)) 10721 }); 10722 } 10723 10724 10725 if ($('#page-header-bg .span_6 .inner-wrap').css('opacity') == 0) { 10726 $('#page-header-bg .span_6 .inner-wrap, #page-header-bg .portfolio-filters').hide(); 10727 } else { 10728 $('#page-header-bg .span_6 .inner-wrap, #page-header-bg .portfolio-filters').show(); 10729 } 10730 10731 10732 } 10733 10734 // Hide elements to allow other parallax sections to work in webkit browsers. 10735 if (($scrollTop / (pageHeaderHeight + $('#header-space').height() + nectarDOMInfo.adminBarHeight)) > 1) { 10736 $('#page-header-bg, .nectar-particles, #page-header-bg .fade-out').css('visibility', 'hidden').hide().addClass('out-of-sight'); 10737 } 10738 else { 10739 $('#page-header-bg, .nectar-particles, #page-header-bg .fade-out').css('visibility', 'visible').show().removeClass('out-of-sight'); 10740 10741 // Ensure header is centered. 10742 pageHeaderHeight = parseInt($pageHeaderBG.height()); 10743 $('#page-header-bg .container > .row').css('top', 0); 10744 10745 } 10746 10747 } 10748 10749 } 10750 10751 if ($pageHeaderBG.length > 0) { 10752 10753 // Bind unload event 10754 pageHeaderUnload(); 10755 10756 // Initialize text effects. 10757 if( $('.nectar-box-roll').length == 0 ) { 10758 pageHeaderTextEffectInit(); 10759 } 10760 10761 } 10762 10763 } 10764 10765 10766 10767 10768 10769 10770 10771 /** 10772 * Page header text effect markup creation. 10773 * 10774 * @since 6.0 10775 */ 10776 function pageHeaderTextEffectMarkup() { 10777 10778 $pageHeaderBG.each(function () { 10779 10780 if ($(this).attr('data-text-effect') == 'rotate_in') { 10781 10782 var $topHeading = 'none'; 10783 10784 if ($(this).find('.span_6 h1').length > 0) { 10785 $topHeading = 'h1'; 10786 } 10787 10788 if ($topHeading != 'none') { 10789 10790 var $selector = ($(this).find('.nectar-particles').length > 0) ? '.inner-wrap.shape-1' : '.span_6'; 10791 10792 $(this).find($selector).find($topHeading).addClass('top-heading').contents().filter(function () { 10793 return this.nodeType === 3 && typeof this.data != 'undefined' && this.data.replace(/\s+/, ""); 10794 }).wrap('<span class="wraped"></span>'); 10795 10796 $(this).find($selector).find('.wraped').each(function () { 10797 10798 var textNode = $(this), 10799 text = textNode.text().split(' '), 10800 replace = ''; 10801 10802 $.each(text, function (index, value) { 10803 if (value.replace(/\s+/, "")) { 10804 replace += '<span class="wraped"><span>' + value + '</span></span> '; 10805 } 10806 }); 10807 10808 textNode.replaceWith($(replace)); 10809 10810 }); 10811 10812 } 10813 10814 } 10815 10816 }); 10817 10818 } 10819 10820 10821 /** 10822 * Page header text effect animation. 10823 * 10824 * @since 6.0 10825 */ 10826 function pageHeaderTextEffect() { 10827 10828 if ($('#page-header-bg .nectar-particles').length == 0 && $('#page-header-bg[data-text-effect="none"]').length == 0 || 10829 $('.nectar-box-roll').length > 0 && $('#page-header-bg .nectar-particles').length == 0) { 10830 10831 var $selector = ($('.nectar-box-roll').length == 0) ? '#page-header-bg .span_6' : '.nectar-box-roll .overlaid-content .span_6'; 10832 10833 $($selector).find('.wraped').each(function (i) { 10834 $(this).find('span').delay(i * 370).transition({ 10835 rotateX: '0', 10836 'opacity': 1, 10837 y: 0 10838 }, 400, 'easeOutQuad'); 10839 }); 10840 10841 setTimeout(function () { 10842 10843 $($selector).find('.inner-wrap > *:not(.top-heading)').each(function (i) { 10844 $(this).delay(i * 370).transition({ 10845 rotateX: '0', 10846 'opacity': 1, 10847 y: 0 10848 }, 650, 'easeOutQuad'); 10849 }); 10850 10851 $('.scroll-down-wrap, .scroll-down-wrap .section-down-arrow').removeClass('hidden'); 10852 10853 }, $($selector).find('.wraped').length * 370); 10854 } 10855 10856 } 10857 10858 10859 /** 10860 * Page header text effect initialization. 10861 * 10862 * @since 6.0 10863 */ 10864 function pageHeaderTextEffectInit() { 10865 10866 pageHeaderTextEffectMarkup(); 10867 10868 var $effectTimeout = ($loadingScreenEl.length > 0) ? 800 : 0; 10869 10870 if ($('#page-header-bg .nectar-video-wrap video').length == 0) { 10871 setTimeout(pageHeaderTextEffect, $effectTimeout); 10872 } 10873 10874 } 10875 10876 10877 10878 10879 10880 10881 10882 /** 10883 * Permanent transparent header effect. 10884 * 10885 * @since 6.0 10886 */ 10887 function midnightInit() { 10888 10889 if ($('#header-outer[data-permanent-transparent="1"]').length > 0 && 10890 $('body[data-bg-header="true"]').length > 0) { 10891 10892 10893 // Pages that set no midnight coloring. 10894 if ($('.container-wrap div[data-midnight]').length == 0) { 10895 $('.container-wrap').attr('data-midnight', 'dark'); 10896 } 10897 10898 //// Cache midnight compat divs. 10899 var $midnightCompatArr = []; 10900 $('div[data-midnight]').each(function () { 10901 10902 if ($(this).attr('data-midnight') == 'light' && $(this).parents('.pum-content').length == 0 ||
10903 $(this).attr('data-midnight') == 'dark' && $(this).parents('.pum-content').length == 0) { 10904 10905 if( $(this).is('#page-header-bg') && $(this).parents('#page-header-wrap[data-midnight]').length > 0 ) { 10906 // skip. 10907 } else { 10908 $midnightCompatArr.push($(this)); 10909 } 10910 10911 } 10912 10913 }); 10914 10915 10916 if ($midnightCompatArr.length > 0) { 10917 10918 $.each($midnightCompatArr, function (k, v) { 10919 10920 if (v.attr('data-midnight') == 'light' || v.attr('data-midnight') == 'dark') { 10921 10922 var $that = v; 10923 var waypoint = new Waypoint({ 10924 element: $that, 10925 handler: function (direction) { 10926 10927 if ($('body.material-ocm-open').length > 0) { 10928 return; 10929 } 10930 10931 var $textColor; 10932 10933 if (direction == 'down') { 10934 $textColor = ($that.attr('data-midnight') == 'light') ? '' : 'dark-slide'; 10935 $headerOuterEl.removeClass('dark-slide').addClass($textColor); 10936 10937 } else { 10938 10939 var $prevMidItem; 10940 10941 if (k - 1 >= 0) { 10942 $prevMidItem = k - 1; 10943 } else { 10944 $prevMidItem = k; 10945 } 10946 10947 $textColor = ($midnightCompatArr[$prevMidItem].attr('data-midnight') == 'light') ? '' : 'dark-slide'; 10948 $headerOuterEl.removeClass('dark-slide').addClass($textColor); 10949 10950 } 10951 10952 }, 10953 offset: $headerOuterEl.height() 10954 10955 }); 10956 10957 } 10958 10959 }); 10960 10961 } 10962 10963 } 10964 10965 10966 } 10967 10968 10969 10970 10971 /** 10972 * Box roll header effect initialization. 10973 * 10974 * @since 6.0 10975 */ 10976 function nectarBoxRollInit() { 10977 if ($('.nectar-box-roll').length > 0 && typeof NectarBoxRoll !== 'undefined') { 10978 pageHeaderTextEffectInit(); 10979 nectarBoxRoll = new NectarBoxRoll(nectarDOMInfo, waypoints, midnightInit, pageLoadHash, resizeVideoToCover); 10980 } 10981 } 10982 10983 10984 10985 10986 /** 10987 * Create all waypoints. 10988 * 10989 * @since 6.0 10990 */ 10991 function waypoints() { 10992 rowBGAnimations(); 10993 columnBGAnimations(); 10994 colAndImgAnimations(); 10995 progressBars(); 10996 dividers(); 10997 iconList(); 10998 animatedTitles(); 10999 highlightedText(); 11000 imageWithHotspots(); 11001 clientsFadeIn(); 11002 splitLineHeadings(); 11003 svgAnimations(); 11004 milestoneInit(); 11005 nectarFancyUlInit(); 11006 owl_carousel_animate(); 11007 headerRowColorInheritInit(); 11008 morphingOutlines(); 11009 animatedColBorders(); 11010 foodMenuItems(); 11011 vcWaypoints(); 11012 } 11013 11014 11015 11016 /** 11017 * Salient page builder elements initialization. 11018 * 11019 * @since 10.5 11020 */ 11021 function salientPageBuilderElInit() { 11022 flexsliderInit(); 11023 flickityLazyInit(); 11024 setTimeout(flickityInit, 100); 11025 twentytwentyInit(); 11026 standardCarouselInit(); 11027 productCarouselInit(); 11028 clientsCarouselInit(); 11029 carouselfGrabbingClass(); 11030 setTimeout(tabbedInit, 60); 11031 accordionInit(); 11032 largeIconHover(); 11033 nectarIconMatchColoring(); 11034 coloredButtons(); 11035 ctaLinkBG(); 11036 teamMemberFullscreen(); 11037 flipBoxInit(); 11038 owlCarouselInit(); 11039 mouseParallaxInit(); 11040 ulCheckmarks(); 11041 nectarFancyUlIcons(); 11042 nectarFancyBoxHover(); 11043 nectarVideoLightbox(); 11044 nectarKeyframeAssist(); 11045 morphingOutlinesInit(); 11046 nectarPostGridInit(); 11047 cascadingImageInit(); 11048 imageWithHotspotEvents(); 11049 pricingTableHeight(); 11050 pageSubmenuInit(); 11051 nectarLiquidBGs(); 11052 nectarTestimonialSliders(); 11053 nectarTestimonialSlidersEvents(); 11054 recentPostsTitleOnlyEqualHeight(); 11055 recentPostsInit(); 11056 parallaxItemHoverEffect(); 11057 fsProjectSliderInit(); 11058 postMouseEvents(); 11059 masonryPortfolioInit(); 11060 masonryBlogInit(); 11061 portfolioCustomColoring(); 11062 searchResultMasonryInit(); 11063 stickySidebarInit(); 11064 portfolioSidebarFollow(); 11065 splitLineHeadingInit(); 11066 } 11067 11068 11069 11070 11071 /***************** WooCommerce *****************/ 11072 11073 11074 /** 11075 * Add quantity buttons to WooCommerce pages 11076 * 11077 * @since 10.5 11078 */ 11079 function wooQauntityBtns() { 11080 11081 jQuery(document.body).on('updated_cart_totals', function () { 11082 11083 if ($('.plus').length == 0) { 11084 $('div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)') 11085 .addClass('buttons_added') 11086 .append('<input type="button" value="+" class="plus" />') 11087 .prepend('<input type="button" value="-" class="minus" />'); 11088 } 11089 }); 11090 11091 11092 // Quantity buttons 11093 if ($('.plus').length == 0) { 11094 11095 $('div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)') 11096 .addClass('buttons_added') 11097 .append('<input type="button" value="+" class="plus" />') 11098 .prepend('<input type="button" value="-" class="minus" />'); 11099 11100 $(document).on('click', '.plus, .minus', function () { 11101 11102 // Get values 11103 var $qty = $(this).closest('.quantity').find('.qty'), 11104 currentVal = parseFloat($qty.val()), 11105 max = parseFloat($qty.attr('max')), 11106 min = parseFloat($qty.attr('min')), 11107 step = $qty.attr('step'); 11108 11109 // Format values 11110 if (!currentVal || currentVal === '' || currentVal === 'NaN') { 11111 currentVal = 0; 11112 } 11113 if (max === '' || max === 'NaN') { 11114 max = ''; 11115 } 11116 if (min === '' || min === 'NaN') { 11117 min = 0; 11118 } 11119 if (step === 'any' || step === '' || step === undefined || parseFloat(step) === 'NaN') { 11120 step = 1; 11121 } 11122 11123 // Change the value 11124 if ($(this).is('.plus')) { 11125 11126 if (max && (max == currentVal || currentVal > max)) { 11127 $qty.val(max); 11128 } else { 11129 $qty.val(currentVal + parseFloat(step)); 11130 } 11131 11132 } else { 11133 11134 if (min && (min == currentVal || currentVal < min)) { 11135 $qty.val(min); 11136 } else if (currentVal > 0) { 11137 $qty.val(currentVal - parseFloat(step)); 11138 } 11139 11140 } 11141 11142 // Trigger change event 11143 $qty.trigger('change'); 11144 11145 }); 11146 } 11147 11148 } 11149 11150 11151 11152 /** 11153 * WooCommerce plugin events. 11154 * 11155 * @since 10.5 11156 */ 11157 function wooCommerceEvents() { 11158 11159 var wooCartTimeout; 11160 11161 // Notification. 11162 $body.on('click', '.product .add_to_cart_button', function () { 11163 11164 var $productHeading = ($(this).parents('li').find('h2').length > 0) ? 'h2' : 'h3', 11165 productToAdd = $(this).parents('li').find($productHeading).text(); 11166 11167 $('#header-outer .cart-notification span.item-name').html(productToAdd); 11168 11169 }); 11170 11171 // Notification hover. 11172 $body.on('mouseenter', '#header-outer .cart-notification', function () { 11173 11174 $(this).hide(); 11175 11176 $('#header-outer .widget_shopping_cart') 11177 .addClass('open') 11178 .stop(true, true) 11179 .show(); 11180 11181 $('#header-outer .cart_list') 11182 .stop(true, true) 11183 .show(); 11184 11185 clearTimeout(wooCartTimeout); 11186 11187 }); 11188 11189 11190 // Cart dropdown. 11191 var $headerCartSelector = '#header-outer .nectar-woo-cart'; 11192 11193 if ($($headerCartSelector).length > 0) { 11194 11195 $($headerCartSelector).hoverIntent(function () { 11196 11197 $('#header-outer .widget_shopping_cart') 11198 .addClass('open') 11199 .stop(true, true) 11200 .show(); 11201 11202 $('#header-outer .cart_list') 11203 .stop(true, true) 11204 .show(); 11205 11206 clearTimeout(wooCartTimeout); 11207 11208 $('#header-outer .cart-notification').hide(); 11209 11210 }); 11211 } 11212 11213 11214 $body.on('mouseleave', $headerCartSelector, function () { 11215 var $that = $(this); 11216 setTimeout(function () { 11217 if (!$that.is(':hover')) { 11218 $('#header-outer .widget_shopping_cart') 11219 .removeClass('open') 11220 .stop(true, true) 11221 .fadeOut(300); 11222 11223 $('#header-outer .cart_list') 11224 .stop(true, true) 11225 .fadeOut(300); 11226 } 11227 }, 200); 11228 }); 11229 11230 if ($('#header-outer[data-cart="false"]').length == 0) { 11231 11232 $body.on('added_to_cart', shopping_cart_dropdown_show); 11233 $body.on('added_to_cart', shopping_cart_dropdown); 11234
11235 // Update header cart markup after ajax remove. 11236 $body.on('removed_from_cart', wooCartImgPos); 11237 } 11238 11239 function shopping_cart_dropdown() { 11240 11241 if (!$('.widget_shopping_cart .widget_shopping_cart_content .cart_list .empty').length && 11242 $('.widget_shopping_cart .widget_shopping_cart_content .cart_list').length > 0) { 11243 11244 $('.cart-menu-wrap').addClass('has_products'); 11245 $('header#top nav > ul, #search-outer #search #close a, header#top .span_9 >.slide-out-widget-area-toggle').addClass('product_added'); 11246 11247 if (!$('.cart-menu-wrap').hasClass('static')) { 11248 $('.cart-menu-wrap, #mobile-cart-link').addClass('first-load'); 11249 } 11250 11251 // Change position of img in cart nav dropdown. 11252 wooCartImgPos(); 11253 11254 } 11255 11256 } 11257 11258 11259 function shopping_cart_dropdown_show(e) { 11260 11261 clearTimeout(wooCartTimeout); 11262 11263 if (!$('.widget_shopping_cart .widget_shopping_cart_content .cart_list .empty').length && 11264 $('.widget_shopping_cart .widget_shopping_cart_content .cart_list').length > 0 && 11265 typeof e.type != 'undefined') { 11266 11267 // Standalone woocommerce add to cart buttons. 11268 if ($('#header-outer .cart-notification .item-name').length > 0 && 11269 $('#header-outer .cart-notification .item-name').text().length == 0) { 11270 return; 11271 } 11272 11273 // Before cart has slide in. 11274 if (!$('#header-outer .cart-menu-wrap').hasClass('has_products')) { 11275 11276 setTimeout(function () { 11277 $('#header-outer .cart-notification').fadeIn(400); 11278 }, 400); 11279 11280 } else if (!$('#header-outer .cart-notification').is(':visible')) { 11281 $('#header-outer .cart-notification').fadeIn(400); 11282 } else { 11283 $('#header-outer .cart-notification').show(); 11284 } 11285 wooCartTimeout = setTimeout(hideCart, 2700); 11286 11287 } 11288 } 11289 11290 function hideCart() { 11291 $('#header-outer .cart-notification').stop(true, true).fadeOut(); 11292 } 11293 11294 function checkForWooItems() { 11295 11296 var checkForCartItems = setInterval(shopping_cart_dropdown, 250); 11297 setTimeout(function () { 11298 clearInterval(checkForCartItems); 11299 }, 4500); 11300 11301 } 11302 11303 function wooCartImgPos() { 11304 $('#header-outer .widget_shopping_cart .cart_list li, #slide-out-widget-area .widget_shopping_cart .cart_list li').each(function () { 11305 11306 if ($(this).find('> img').length == 0 && $(this).find('.product-meta').length == 0) { 11307 11308 var productCartImgLinkSrc = ($(this).find('> a[href]:not(.remove)').length > 0) ? $(this).find('> a[href]:not(.remove)').attr('href') : ''; 11309 var productCartImg = $(this).find('> a > img').clone(); 11310 11311 $(this).wrapInner('<div class="product-meta" />'); 11312 $(this).prepend(productCartImg); 11313 11314 if (productCartImgLinkSrc.length > 0) { 11315 productCartImg.wrap('<a href="' + productCartImgLinkSrc + '"></a>'); 11316 } 11317 11318 } 11319 11320 }); 11321 } 11322 11323 if ($('#header-outer[data-cart="false"]').length == 0) { 11324 checkForWooItems(); 11325 } 11326 11327 function nectarAccountPageTabs() { 11328 11329 // Not on account page. 11330 if ($('body.woocommerce-account #customer_login').length == 0) { 11331 return; 11332 } 11333 11334 // Create HTML. 11335 $('.woocommerce-account .woocommerce > #customer_login').prepend('<div class="nectar-form-controls" />'); 11336 11337 $('.woocommerce-account .woocommerce > #customer_login > div:not(.nectar-form-controls)').each(function () { 11338 var $title = $(this).find('> h2').text(); 11339 $('#customer_login .nectar-form-controls').append('<div class="control">' + $title + '</div>'); 11340 }); 11341 11342 // Click event. 11343 $('.woocommerce-account .woocommerce > #customer_login .nectar-form-controls .control').on('click', function () { 11344 11345 $('.woocommerce-account .woocommerce > #customer_login .nectar-form-controls .control').removeClass('active'); 11346 $(this).addClass('active'); 11347 11348 var formIndex = $(this).index() + 1; 11349 $('#customer_login div[class*="u-column"]').hide(); 11350 $('#customer_login div[class*="u-column"].col-' + formIndex).show(); 11351 11352 setTimeout(function () { 11353 $('#customer_login div[class*="u-column"]').removeClass('visible'); 11354 $('#customer_login div[class*="u-column"].col-' + formIndex).addClass('visible'); 11355 }, 30); 11356 11357 }); 11358 11359 // Starting. 11360 $('.woocommerce-account .woocommerce >
11360 #customer_login .nectar-form-controls .control:nth-child(1)').trigger('click'); 11361 11362 } 11363 11364 nectarAccountPageTabs(); 11365 11366 // Text on hover effect. 11367 $body.on('mouseover', '.text_on_hover .product-wrap, .text_on_hover > a:first-child', function () { 11368 $(this).parent().addClass('hovered'); 11369 }); 11370 11371 $body.on('mouseout', '.text_on_hover .product-wrap, .text_on_hover > a:first-child', function () { 11372 $(this).parent().removeClass('hovered'); 11373 }); 11374 11375 11376 // Material/fancy parallax hover effect zindex. 11377 if ($('.material.product').length > 0 || 11378 $('.minimal.product').length > 0 || 11379 $('.nectar-fancy-box[data-style="parallax_hover"]').length > 0 || 11380 $('.nectar-category-grid[data-shadow-hover="yes"]').length > 0) { 11381 11382 var $productZindex = 101; 11383 11384 $body.on('mouseenter', '.material.product, .minimal.product, .nectar-fancy-box[data-style="parallax_hover"], .nectar-category-grid[data-shadow-hover="yes"] .nectar-category-grid-item', function () { 11385 $productZindex++; 11386 $(this).css('z-index', $productZindex + 1); 11387 }); 11388 11389 $body.on('mouseleave', '.material.product, .minimal.product, .nectar-fancy-box[data-style="parallax_hover"], .nectar-category-grid[data-shadow-hover="yes"] .nectar-category-grid-item', function () { 11390 11391 var $that = $(this); 11392 setTimeout(function () { 11393 if (!$that.is(':hover')) { 11394 $that.css('z-index', 100); 11395 } 11396 }, 350); 11397 }); 11398 11399 // Reset to stop zindex from getting too high. 11400 setInterval(function () { 11401 if ($('.nectar-fancy-box[data-style="parallax_hover"]:hover').length > 0 || 11402 $('.minimal.product:hover').length > 0) { 11403 return; 11404 } 11405 11406 $('.material.product:not(:hover), .minimal.product:not(:hover), .nectar-fancy-box[data-style="parallax_hover"]:not(:hover), .nectar-category-grid[data-shadow-hover="yes"] .nectar-category-grid-item:not(:hover)').css('z-index', 100); 11407 $productZindex = 101; 11408 }, 10000); 11409 11410 } 11411 11412 function minimalProductHover() { 11413 11414 // Add icons. 11415 $('.products .classic .product-wrap .add_to_cart_button').wrapInner('<span />'); 11416 $('.products .classic .product-wrap .add_to_cart_button').prepend('<i class="normal icon-salient-cart"></i>'); 11417 11418 // Bind hover. 11419 $body.on('mouseover', '.products .minimal.product', function () { 11420 minimalProductCalc($(this)); 11421 }); 11422 11423 $body.on('mouseleave', '.products .minimal.product', function () { 11424 11425 $(this).find('.background-color-expand').css({ 11426 'transform': 'scale(1)' 11427 }); 11428 11429 }); 11430 11431 // Starting trigger mouse over. 11432 $('.products .minimal.product').each(function () { 11433 if ($(this).is(':hover')) { 11434 $(this).trigger('mouseover'); 11435 } 11436 }); 11437 } 11438 11439 function minimalProductCalc(el) { 11440 11441 var $item = el, 11442 $itemWidth = $item.width(), 11443 $itemHeight = $item.height(), 11444 $wChange = (parseInt($itemWidth) + 40) / parseInt($itemWidth), 11445 $hChange = (parseInt($itemHeight) + 40) / parseInt($itemHeight); 11446 11447 $item.addClass('hover-bound'); 11448 11449 $item.find('.background-color-expand').css({ 11450 'transform': 'scale(' + $wChange + ',' + $hChange + ') translateY(0px)' 11451 }); 11452 11453 } 11454 11455 minimalProductHover(); 11456 11457 11458 11459 // Mobile widget filters. 11460 $('.woocommerce #sidebar .widget.woocommerce').each(function () { 11461 11462 // Skip widgets without any titles. 11463 if ($(this).find('> h4').length == 0) { 11464 $(this).addClass('no-widget-title'); 11465 } 11466 }); 11467 11468 $body.on('click', '#sidebar .widget.woocommerce:not(.widget_price_filter) h4', function () { 11469 11470 if ($window.width() < 1000) { 11471 11472 if ($(this).parent().is('.widget_product_tag_cloud')) { 11473 $(this).parent().find('> div').slideToggle(); 11474 } 11475 if ($(this).parent().is('.woocommerce-widget-layered-nav') && $(this).parent().find('> .woocommerce-widget-layered-nav-dropdown').length > 0) { 11476 $(this).parent().find('> .woocommerce-widget-layered-nav-dropdown').slideToggle(); 11477 } 11478 11479 $(this).parent().find('> ul').slideToggle(); 11480 11481 $(this).parent().toggleClass('open-filter'); 11482 } 11483 11484 }); 11485 11486 // Slide in cart event. 11487 $body.on('mouseenter', '#header-outer [data-cart-style="slide_in"] .cart-menu-wrap', openRightCart); 11488 11489 function openRightCart() { 11490 11491 if ($('.nectar-slide-in-cart ul.cart_list li:not(.empty)').length > 0) { 11492 11493 $('.nectar-slide-in-cart').addClass('open'); 11494 $window.on('mousemove.rightCartOffsetCheck', closeCartCheck); 11495 11496 } 11497 } 11498 11499 function closeCartCheck(e) { 11500 11501 var $windowWidth = $window.width(); 11502 if (e.clientX < $windowWidth - 370 - $bodyBorderWidth) { 11503 11504 $window.off('mousemove.rightCartOffsetCheck', closeCartCheck); 11505 11506 $('.nectar-slide-in-cart').removeClass('open'); 11507 11508 } 11509 11510 } 11511 11512 // Add quantity buttons if needed. 11513 wooQauntityBtns(); 11514 11515 } 11516 11517 11518 11519 11520 11521 /** 11522 * Search in navigation functionality. 11523 * 11524 * @since 10.5 11525 */ 11526 11527 function navigationSearchInit() { 11528 11529 var $placeholder = ($('#search-outer #search input[type=text][data-placeholder]').length > 0) ? $('#search-outer #search input[type=text]').attr('data-placeholder') : ''; 11530 11531 // Material skin add search BG markup. 11532 if ($body.hasClass('material') && $('#header-outer .bg-color-stripe').length == 0) { 11533 $headerOuterEl.append('<div class="bg-color-stripe" />'); 11534 } 11535 11536 // Prevent jumping on click. 11537 $body.on('click', '#search-btn a', function () { 11538 return false;
11539 }); 11540 11541 // Open search on mouseup. 11542 $body.on('click', '#search-btn a:not(.inactive), #header-outer .mobile-search', function () { 11543 11544 if ($(this).hasClass('open-search')) { 11545 return false; 11546 } 11547 11548 // Close menu on original skin. 11549 if( $body.hasClass('original') && $('.slide-out-widget-area-toggle.mobile-icon a.open').length > 0 ) { 11550 $('.slide-out-widget-area-toggle.mobile-icon a') 11551 .addClass('non-human-allowed') 11552 .trigger('click'); 11553 11554 setTimeout(function () { 11555 $('.slide-out-widget-area-toggle.mobile-icon a').removeClass('non-human-allowed'); 11556 }, 100); 11557 } 11558 11559 if ($body.hasClass('ascend') || 11560 $('body[data-header-format="left-header"]').length > 0 && $('body.material').length == 0) { 11561 11562 // Ascend theme skin. 11563 $('#search-outer > #search form, #search-outer #search .span_12 span, #search-outer #search #close').css('opacity', 0); 11564 11565 $('#search-outer > #search form').css('transform', 'translateY(-30px)'); 11566 $('#search-outer #search .span_12 span').css('transform', 'translateY(20px)'); 11567 11568 $('#search-outer').show(); 11569 $('#search-outer').stop().transition({ 11570 scale: '1,0', 11571 'opacity': 1 11572 }, 0).transition({ 11573 scale: '1,1' 11574 }, 700, 'cubic-bezier(0.2, 1, 0.3, 1)'); 11575 11576 $('#search-outer > #search form').delay(350).transition({ 11577 'opacity': 1, 11578 'transform': 'translateY(0)' 11579 }, 700, 'cubic-bezier(0.2, 1, 0.3, 1)'); 11580 11581 $('#search-outer #search #close').delay(500).transition({ 11582 'opacity': 1 11583 }, 700, 'cubic-bezier(0.2, 1, 0.3, 1)'); 11584 11585 11586 $('#search-outer #search .span_12 span').delay(450).transition({ 11587 'opacity': 1, 11588 'transform': 'translateY(0)' 11589 }, 700, 'cubic-bezier(0.2, 1, 0.3, 1)'); 11590 11591 } 11592 11593 else if (!$body.hasClass('material')) { 11594 // Original theme skin. 11595 $('#search-outer').stop(true).fadeIn(600, 'easeOutExpo'); 11596 } 11597 else { 11598 11599 // Material theme skin. 11600 $('#header-outer[data-transparent-header="true"] .bg-color-stripe').css('transition', ''); 11601 $('#search-outer, #ajax-content-wrap').addClass('material-open'); 11602 $headerOuterEl.addClass('material-search-open'); 11603 $('#fp-nav').addClass('material-ocm-open'); 11604 11605 } 11606 11607 11608 setTimeout(function () { 11609 11610 $('#search input[type=text]').trigger('focus'); 11611 11612 if ($('#search input[type=text]').attr('value') == $placeholder) { 11613 $('#search input[type=text]').setCursorPosition(0); 11614 } 11615 11616 }, 300); 11617 11618 11619 $(this).toggleClass('open-search'); 11620 11621 // Close slide out widget area. 11622 $('.slide-out-widget-area-toggle a:not(#toggle-nav).open:not(.animating)').trigger('click'); 11623 11624 return false; 11625 11626 }); 11627 11628 // Handle the placeholder value. 11629 $('body:not(.material)').on('keydown', '#search input[type=text]', function () { 11630 if ($(this).attr('value') == $placeholder) { 11631 $(this).attr('value', ''); 11632 } 11633 }); 11634 11635 $('body:not(.material)').on('keyup', '#search input[type=text]', function () { 11636 if ($(this).attr('value') == '') { 11637 $(this).attr('value', $placeholder); 11638 $(this).setCursorPosition(0); 11639 } 11640 }); 11641 11642 11643 // Close search btn event. 11644 $body.on('click', '#close', function () { 11645 closeSearch(); 11646 $searchButtonEl.removeClass('open-search'); 11647 $('#header-outer .mobile-search').removeClass('open-search'); 11648 return false; 11649 }); 11650 11651 // Original and Ascend skin close search when clicking off. 11652 $('body:not(.material)').on('blur', '#search-box input[type=text]', function () { 11653 closeSearch(); 11654 $searchButtonEl.removeClass('open-search'); 11655 $('#header-outer .mobile-search').removeClass('open-search'); 11656 }); 11657 11658 11659 // Material skin close when clicking off the search. 11660 $('body.material').on('click', '#ajax-content-wrap', function (e) { 11661 if (e.originalEvent !== undefined) { 11662 closeSearch(); 11663 $searchButtonEl.removeClass('open-search'); 11664 $('#header-outer .mobile-search').removeClass('open-search'); 11665 } 11666 }); 11667 11668 // Material skin close on esc button event. 11669 if ($('body.material').length > 0) { 11670 $(document).on('keyup', function (e) { 11671 11672 if (e.keyCode == 27) { 11673 closeSearch(); 11674 $searchButtonEl.removeClass('open-search'); 11675 11676 // Close ocm material 11677 if ($('.ocm-effect-wrap.material-ocm-open').length > 0) { 11678 $('.slide-out-widget-area-toggle.material-open a').trigger('click'); 11679 } 11680 } 11681 11682 }); 11683 } 11684 11685 11686 11687 // Called to hide the search bar. 11688 function closeSearch() { 11689 11690 if ($body.hasClass('ascend') || $('body[data-header-format="left-header"]').length > 0 && $('body.material').length == 0) { 11691 $('#search-outer').stop().transition({ 11692 'opacity': 0 11693 }, 300, 'cubic-bezier(0.2, 1, 0.3, 1)'); 11694 $searchButtonEl.addClass('inactive'); 11695 setTimeout(function () { 11696 $('#search-outer').hide(); 11697 $searchButtonEl.removeClass('inactive'); 11698 }, 300); 11699 } else if ($('body.material').length == 0) { 11700 $('#search-outer').stop(true).fadeOut(450, 'easeOutExpo'); 11701 } 11702 11703 if ($body.hasClass('material')) { 11704 $('#ajax-content-wrap').removeClass('material-open'); 11705 $headerOuterEl.removeClass('material-search-open'); 11706 $('#search-outer').removeClass('material-open'); 11707 $('#fp-nav').removeClass('material-ocm-open'); 11708 } 11709 11710 } 11711 11712 } 11713 11714 11715 11716 11717 11718 11719 /** 11720 * Header layout "Centered header bottom bar" functionality. 11721 * 11722 * @since 9.0 11723 */ 11724 function centeredNavBottomBarReposition() { 11725 11726 var $headerOuter = $headerOuterEl, 11727 $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'), 11728 $headerSpan3 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_3'), 11729 $secondaryHeader = $headerSecondaryEl, 11730 $headerBtns = $headerSpan3.find('nav >ul.buttons'),
11731 $navLogoMargin = parseInt($('body.material #header-outer').attr('data-padding')), 11732 $navLogoHeight = parseInt($('body.material #header-outer').attr('data-logo-height')), 11733 $triggerCondition = ($navLogoMargin*2) + $navLogoHeight - parseInt(nectarDOMInfo.adminBarHeight) + parseInt(nectarDOMInfo.secondaryHeaderHeight); 11734 11735 if ($secondaryHeader.length > 0) { 11736 11737 if ($('#header-outer[data-remove-fixed="1"]').length == 0 && $('#header-outer[data-condense="true"]').length > 0) { 11738 setTimeout(function () { 11739 nectarDOMInfo.secondaryHeaderHeight = $headerSecondaryEl.outerHeight(); 11740 }, 50); 11741 } 11742 11743 } 11744 11745 // Helper to determine if custom mobile breakpoint is active. 11746 function condenseCustomBreakPointHelper() { 11747 var $withinCustomBreakpoint = mobileBreakPointCheck(); 11748 11749 // Adding class to prevent logo from hiding when opening OCM 11750 if ( $withinCustomBreakpoint ) { 11751 $headerOuterEl.addClass('within-custom-breakpoint'); 11752 } else { 11753 $headerOuterEl.removeClass('within-custom-breakpoint'); 11754 } 11755 } 11756 11757 11758 // Bind events if "Condense Header On Scroll" effect is enabled. 11759 if ($('#header-outer[data-condense="true"]').length > 0) { 11760 11761 $window.on('scroll.centeredNavCondense', centeredNavBottomFixed_Scroll); 11762 $window.trigger('scroll'); 11763 11764 $window.on('resize', function(){ 11765 if(nectarDOMInfo.winW < 1000 ) { 11766 $headerOuter.addClass('force-condense-remove'); 11767 $window.off('scroll.centeredNavCondense'); 11768 } 11769 }); 11770 11771 $window.smartresize(function () { 11772 condenseCustomBreakPointHelper(); 11773 11774 if(nectarDOMInfo.winW >= 1000 ) { 11775 11776 // Coming from mobile. 11777 if($headerOuter.hasClass('force-condense-remove')) { 11778 11779 // Remove condense effect. 11780 centeredNavBottomFixed_Scroll(); 11781 $headerOuter.removeClass('force-condense-remove'); 11782 11783 // See if the condense effect needs to be reapplied. 11784 setTimeout(function() { 11785 11786 if(nectarDOMInfo.scrollTop >= $triggerCondition) { 11787 $headerOuter.addClass('force-condense'); 11788 centeredNavBottomFixed_Scroll(); 11789 $headerOuter.removeClass('force-condense'); 11790 } 11791 // Bind scroll event. 11792 $window.on('scroll.centeredNavCondense', centeredNavBottomFixed_Scroll); 11793 },200); 11794 11795 } 11796 } 11797 11798 }); 11799 11800 condenseCustomBreakPointHelper(); 11801 11802 } 11803 11804 11805 11806 function centeredNavBottomFixed_Scroll() { 11807 11808 // Bypass calculating. 11809 if (nectarDOMInfo.winW < 1000 || 11810 $('body.material-ocm-open').length > 0 || 11811 $('#header-outer[data-has-menu="true"][data-format="centered-menu-bottom-bar"] .span_9').css('display') == 'none') { 11812 return; 11813 } 11814 11815 $bodyBorderTop = ($bodyBorderTop.length > 0 && nectarDOMInfo.secondaryHeaderHeight > 0) ? $bodyBorderTop.height() : 0; 11816 11817 // Add condense effect. 11818 if ($headerOuter.hasClass('force-condense') || !$headerOuter.hasClass('fixed-menu') && nectarDOMInfo.scrollTop >= $triggerCondition) { 11819 11820 var amountToMove = (parseInt($headerSpan9.position().top) - $navLogoMargin - parseInt(nectarDOMInfo.adminBarHeight)) + parseInt(nectarDOMInfo.secondaryHeaderHeight) - $bodyBorderTop; 11821 11822 // Megamenu removes transparency option 11823 if ($('#header-outer[data-megamenu-rt="1"]').length > 0 && $('#header-outer .megamenu').length > 0 && $('#header-outer[data-transparent-header="true"]').length > 0) { 11824 $headerOuterEl.removeClass('no-transition'); 11825 } 11826 11827 $headerOuter.addClass('fixed-menu').removeClass('transparent').css({ 11828 'top': '-' + amountToMove + 'px', 11829 'position': 'fixed' 11830 }); 11831 11832 var $headerNavBarOffset = $('header#top .span_9 nav >ul').offset().top; 11833 var $headerButtonsOffset = $headerBtns.offset().top; 11834 11835 11836 var $headerButtonsHeight = ($headerSpan9.find('.sf-menu > li > a').length > 0) ? (20 - parseInt($headerSpan9.find('.sf-menu > li > a').height())) / 2 : 2; 11837 11838 $headerBtns.css('transform', 'translateY(' + (parseInt($headerNavBarOffset) - parseInt($headerButtonsOffset) - $headerButtonsHeight - 1) + 'px)'); 11839 $headerBtns.find('.nectar-woo-cart').css('height', $headerOuter.height() + parseInt($headerOuter.css('top')) - parseInt(nectarDOMInfo.adminBarHeight)); 11840 11841 } 11842
11843 // Remove condense effect. 11844 else if ($headerOuter.hasClass('force-condense-remove') || $headerOuter.hasClass('fixed-menu') && nectarDOMInfo.scrollTop < $triggerCondition ) { 11845 11846 $headerOuter.removeClass('fixed-menu').css({ 11847 'top': '0', 11848 'position': 'absolute' 11849 }); 11850 11851 $headerBtns.css('transform', 'translateY(0px)'); 11852 $headerBtns.find('.nectar-woo-cart').css('height', ''); 11853 11854 if ($('#header-outer.transparent').length == 0) { 11855 11856 if ($('#header-outer[data-megamenu-rt="1"]').length > 0 && 11857 $('#header-outer .megamenu').length > 0) { 11858 $headerOuterEl.removeClass('no-transition'); 11859 } 11860 11861 if ($('#header-outer[data-megamenu-rt="1"]').length > 0 && 11862 $('#header-outer[data-transparent-header="true"]').length > 0 && 11863 $('#header-outer .megamenu').length > 0) { 11864 11865 if ($headerOuterEl.attr('data-transparent-header') == 'true' && 11866 $('.nectar-box-roll').length == 0 && 11867 $('.megamenu.sfHover').length == 0) { 11868 11869 $headerOuterEl.addClass('transparent'); 11870 $headerOuterEl.removeClass('no-transition'); 11871 11872 } 11873 else if ($headerOuterEl.attr('data-transparent-header') == 'true' && 11874 $('.nectar-box-roll').length == 0 && 11875 $('.megamenu.sfHover').length > 0) { 11876 11877 $headerOuterEl.addClass('no-transition'); 11878 } 11879 11880 } 11881 11882 else { 11883 if ($headerOuterEl.attr('data-transparent-header') == 'true' && $('.nectar-box-roll').length == 0) { 11884 $headerOuterEl.addClass('transparent'); 11885 } 11886 } 11887 11888 } // endif transparent header conditional. 11889 11890 11891 } // End Remove condense effect. 11892 11893 } // End centeredNavBottomFixed_Scroll. 11894 11895 11896 11897 } 11898 11899 11900 11901 11902 /** 11903 * Header layout "Centered header bottom bar" initialization. 11904 * 11905 * @since 10.5 11906 */ 11907 function centeredNavBottomBarInit() { 11908 11909 if ($('#header-outer[data-format="centered-menu-bottom-bar"]').length > 0) { 11910 centeredNavBottomBarReposition(); 11911 } 11912 11913 } 11914 11915 11916 11917 11918 11919 /** 11920 * Header layout "Centered logo between menu". 11921 * 11922 * Splits the main navigation menu into two sections placed on each side of logo. 11923 * 11924 * @since 8.0 11925 */ 11926 function centeredLogoMargins() { 11927 11928 if (nectarDOMInfo.winW > 1000) { 11929 11930 var $navItemLength = $('#header-outer[data-format="centered-logo-between-menu"] #top nav > .sf-menu:not(.buttons) > li').length; 11931 11932 if ($('#header-outer #social-in-menu').length > 0) { 11933 $navItemLength--; 11934 } 11935 11936 var $centerLogoWidth, 11937 $extraMenuSpace; 11938 11939 if ($('#header-outer #top .row .col.span_3 #logo img:visible').length == 0) { 11940 $centerLogoWidth = parseInt($('#header-outer #top .row .col.span_3').width()); 11941 } else { 11942 $centerLogoWidth = parseInt($('#header-outer #top .row .col.span_3 img:visible').width()); 11943 } 11944 11945 if ($('#header-outer[data-lhe="animated_underline"]').length > 0) { 11946 $extraMenuSpace = parseInt($('header#top nav > ul > li:first-child > a').css('margin-right')); 11947 } else { 11948 $extraMenuSpace = parseInt($('header#top nav > ul > li:first-child > a').css('padding-right')); 11949 } 11950 11951 if ($extraMenuSpace > 30) { 11952 $extraMenuSpace += 45; 11953 } else if ($extraMenuSpace > 20) { 11954 $extraMenuSpace += 40; 11955 } else { 11956 $extraMenuSpace += 30; 11957 } 11958 11959 if (!$body.hasClass('rtl')) { 11960 $('#header-outer[data-format="centered-logo-between-menu"] #top nav > .sf-menu:not(.buttons) > li:nth-child(' + Math.floor($navItemLength / 2) + ')').css({ 11961 'margin-right': ($centerLogoWidth + $extraMenuSpace) + 'px' 11962 }).addClass('menu-item-with-margin'); 11963 } else { 11964 $('#header-outer[data-format="centered-logo-between-menu"] #top nav > .sf-menu:not(.buttons) > li:nth-child(' + Math.floor($navItemLength / 2) + ')').css({
11965 'margin-left': ($centerLogoWidth + $extraMenuSpace) + 'px' 11966 }).addClass('menu-item-with-margin'); 11967 } 11968 11969 var $leftMenuWidth = 0; 11970 var $rightMenuWidth = 0; 11971 11972 $('#header-outer[data-format="centered-logo-between-menu"] #top nav > .sf-menu:not(.buttons) > li:not(#social-in-menu)').each(function (i) { 11973 if (i + 1 <= Math.floor($navItemLength / 2)) { 11974 $leftMenuWidth += $(this).width(); 11975 } else { 11976 $rightMenuWidth += $(this).width(); 11977 } 11978 11979 }); 11980 11981 var $menuDiff = Math.abs($rightMenuWidth - $leftMenuWidth); 11982 11983 if ($leftMenuWidth > $rightMenuWidth || ($body.hasClass('rtl') && $leftMenuWidth < $rightMenuWidth) ) { 11984 $('#header-outer #top .row > .col.span_9').css('padding-right', $menuDiff); 11985 } else { 11986 $('#header-outer #top .row > .col.span_9').css('padding-left', $menuDiff); 11987 } 11988 11989 $('#header-outer[data-format="centered-logo-between-menu"] nav').css('visibility', 'visible'); 11990 11991 } 11992 11993 else if ($('#header-outer[data-format="centered-logo-between-menu"]').length > 0 && nectarDOMInfo.winW < 1000) { 11994 $('#header-outer .row > .col.span_9').css({ 11995 'padding-right': '0', 11996 'padding-left': '0' 11997 }); 11998 } 11999 12000 } 12001 12002 12003 /** 12004 * Header layout "Centered logo between menu" initialization. 12005 * 12006 * @since 10.5 12007 */ 12008 function centeredLogoHeaderInit() { 12009 12010 if($('#header-outer[data-format="centered-logo-between-menu"]').length > 0) { 12011 12012 if(!usingLogoImage) { 12013 centeredLogoMargins(); 12014 } 12015 else if(usingLogoImage && $('#header-outer[data-format="centered-logo-between-menu"]').length > 0 && $('header#top #logo img:first[src]').length > 0) { 12016 12017 //fadein img on load 12018 var tempLogoImg = new Image(); 12019 tempLogoImg.src = $('header#top #logo img:first').attr('src'); 12020 12021 tempLogoImg.onload = function() { 12022 centeredLogoMargins(); 12023 }; 12024 12025 } 12026 12027 // Resize event. 12028 $window.on('smartresize', centeredLogoMargins); 12029 12030 } 12031 12032 } 12033 12034 12035 12036 12037 12038 12039 12040 12041 /** 12042 * Handle basic items before initializing effects. 12043 * 12044 * @since 10.5 12045 */ 12046 function headerNavPreInit() { 12047 12048 // Deactivate hide header until needed effect on mobile. 12049 if (nectarDOMInfo.usingMobileBrowser && $('#header-outer[data-remove-fixed="1"]').length == 0) { 12050 $body.attr('data-hhun', '0'); 12051 } 12052 12053 // Page fullscreen rows does not need permanent transparent. 12054 if ($('#nectar_fullscreen_rows').length > 0) { 12055 ($headerOuterEl.attr('data-permanent-transparent', 'false')); 12056 } 12057 12058 // Set mobile header height. 12059 if (nectarDOMInfo.usingMobileBrowser && $('#header-outer[data-mobile-fixed="1"]').length > 0 && 12060 $('#header-outer[data-transparent-header="true"]').length == 0) { 12061 $('#header-space').css('height', $headerOuterEl.outerHeight()); 12062 } 12063 12064 } 12065 12066 12067 12068 12069 12070 12071 /** 12072 * Hide header until needed. 12073 * 12074 * Used when "Header Hide Until Needed" is active. 12075 * 12076 * @since 10.5 12077 */ 12078 function hhunHeaderEffect() { 12079 12080 var previousScroll = 0, // previous scroll position 12081 menuOffset = 250, // height of menu (once scroll passed it, menu is hidden) 12082 hideShowOffset = 6; // scrolling value after which triggers hide/show menu 12083 12084 // Called in RAF loop to calculate the header visibility. 12085 function hhunCalcs() { 12086 12087 $headerOuterEl.addClass('detached'); 12088 12089 var currentScroll = nectarDOMInfo.scrollTop, // Gets current scroll position 12090 scrollDifference = Math.abs(currentScroll - previousScroll); // Calculates how fast user is scrolling 12091 12092 // Stop scrolling while animated anchors / box roll 12093 if ($('body.animated-scrolling').length > 0 && $('#header-outer.detached').length > 0 || $('body.no-scroll').length > 0) { 12094 12095 if (nectarDOMInfo.winW > 999) { 12096 12097 if (currentScroll > menuOffset) { 12098 12099 // Alter scroll tracking to continue hiding menu. 12100 previousScroll = nectarDOMInfo.scrollTop; 12101 currentScroll = nectarDOMInfo.scrollTop; 12102 12103 } 12104 12105 requestAnimationFrame(hhunCalcs); 12106 return; 12107 } 12108 } 12109 12110 // Stop when material ocm or material search is open 12111 if ($('body.material-ocm-open').length > 0 || $('#search-outer.material-open').length > 0) { 12112 if (nectarDOMInfo.winW > 999) { 12113 requestAnimationFrame(hhunCalcs); 12114 return; 12115 } 12116 } 12117 12118 // Stop on mobile if not using sticky option 12119 if ($('#header-outer[data-mobile-fixed="false"]').length > 0 && $('body.mobile').length > 0) { 12120 $headerOuterEl.removeClass('detached'); 12121 return; 12122 } 12123 12124 12125 12126 if (!$headerOuterEl.hasClass('side-widget-open') && !$('#header-outer .slide-out-widget-area-toggle a').hasClass('animating')) { 12127 12128 var heightToAdjust; 12129 12130 // Remove transparent and body border margin 12131 if (currentScroll > 1) { 12132 if ($('#header-outer[data-permanent-transparent="1"]').length == 0) { 12133 $headerOuterEl.removeClass('transparent'); 12134 $headerOuterEl.addClass('scrolling'); 12135 } 12136 12137 // Handle secondary header 12138 if ($headerSecondaryEl.length > 0) { 12139 if (currentScroll > menuOffset) { 12140 $headerSecondaryEl.addClass('hide-up'); 12141 $headerOuterEl.css('transform', 'translateY(-' + nectarDOMInfo.secondaryHeaderHeight + 'px)'); 12142 } else { 12143 $headerSecondaryEl.removeClass('hide-up'); 12144 $headerOuterEl.css('transform', '0px)'); 12145 } 12146 } 12147 12148 } 12149 12150 // Scrolled past menu 12151 if (currentScroll > menuOffset) { 12152 12153 // Scrolled past detach point add class to fix menu 12154 if (!$headerOuterEl.hasClass('detached')) { 12155 12156 $headerOuterEl 12157 .addClass('detached') 12158 .removeClass('parallax-contained'); 12159 } 12160 12161 $headerOuterEl.removeClass('no-transition'); 12162 12163 12164 // Scrolling faster than hideShowOffset hide/show menu 12165 if (scrollDifference >= hideShowOffset) { 12166 12167 if (currentScroll > previousScroll) { 12168 12169 // Hide menu 12170 if (!$headerOuterEl.hasClass('invisible')) { 12171 12172 $headerOuterEl 12173 .addClass('invisible') 12174 .removeClass('at-top'); 12175 12176 // Close submenus 12177 if ($(".sf-menu").length > 0 && $().superfish) { 12178 $(".sf-menu").superfish('hide'); 12179 $('header#top nav > ul.sf-menu > li.menu-item-over').removeClass('menu-item-over'); 12180 } 12181 12182 } 12183 12184 $('.page-submenu.stuck') 12185 .css('transform', 'translateY(0px)') 12186 .addClass('header-not-visible'); 12187 12188 } else { 12189 12190 // Show menu 12191 if ($headerOuterEl.hasClass('invisible')) { 12192 $headerOuterEl.removeClass('invisible'); 12193 } 12194 12195 // Page submenu adjust 12196 heightToAdjust = $headerOuterEl.outerHeight(); 12197 12198 if( $headerSecondaryEl.length > 0) { 12199 heightToAdjust -= nectarDOMInfo.secondaryHeaderHeight; 12200 } 12201 12202 if ($bodyBorderTop.length > 0 && $('body.mobile').length == 0) { 12203 12204 $bodyBorderSizeToRemove = ($bodyBorderHeaderColorMatch) ? $bodyBorderTop.height() : 0; 12205 12206 $('.page-submenu.stuck') 12207 .css('transform', 'translateY(' + (heightToAdjust - $bodyBorderSizeToRemove) + 'px)') 12208 .removeClass('header-not-visible'); 12209 12210 } else { 12211 $('.page-submenu.stuck') 12212 .css('transform', 'translateY(' + heightToAdjust + 'px)') 12213 .removeClass('header-not-visible'); 12214 } 12215 12216 } 12217 } 12218 12219 } else { 12220 12221 12222 var $topDetachNum = ($('#header-outer[data-using-secondary="1"]').length > 0) ? 32 : 0; 12223 if ($bodyBorderTop.length > 0) { 12224 $topDetachNum = ($('#header-outer[data-using-secondary="1"]').length > 0) ? 32 + $bodyBorderTop.height() : $bodyBorderTop.height(); 12225 } 12226 12227 if (currentScroll <= $topDetachNum) { 12228 12229 $headerOuterEl 12230 .addClass('at-top') 12231 .removeClass('invisible') 12232 .removeClass('scrolling'); 12233 12234 if ($('#header-outer[data-megamenu-rt="1"]').length > 0 && 12235 $('#header-outer[data-transparent-header="true"]').length > 0 && 12236 $('#header-outer .megamenu').length > 0) { 12237 12238 if ($('#header-outer[data-transparent-header="true"]').length > 0 && 12239 $('.nectar-box-roll').length == 0 && 12240 $('.megamenu.sfHover').length == 0) { 12241 12242 $headerOuterEl 12243 .addClass('transparent') 12244 .css('transform', 'translateY(0)') 12245 .removeClass('no-transition'); 12246 12247 } else if ($('.nectar-box-roll').length > 0) { 12248 12249 $headerOuterEl 12250 .css('transform', 'translateY(0)') 12251 .addClass('at-top-before-box'); 12252 } 12253 12254 } else { 12255 12256 if ($('#header-outer[data-transparent-header="true"]').length > 0 && 12257 $('.nectar-box-roll').length == 0) { 12258 12259 $headerOuterEl 12260 .addClass('transparent') 12261 .css('transform', 'translateY(0)'); 12262 12263 } else if ($('.nectar-box-roll').length > 0) { 12264 12265 $headerOuterEl 12266 .css('transform', 'translateY(0)') 12267 .addClass('at-top-before-box'); 12268 } 12269 } 12270
12271 if ($('#page-header-bg[data-parallax="1"]').length > 0) { 12272 12273 $headerOuterEl 12274 .addClass('parallax-contained') 12275 .css('transform', 'translateY(0)'); 12276 } 12277 12278 } 12279 12280 } 12281 12282 // At the bottom of document - show menu 12283 if ((nectarDOMInfo.winH + window.scrollY) >= document.body.offsetHeight) { 12284 12285 $headerOuterEl.removeClass('invisible'); 12286 12287 // Page submenu adjust 12288 heightToAdjust = $headerOuterEl.outerHeight(); 12289 if( $headerSecondaryEl.length > 0) { 12290 heightToAdjust -= nectarDOMInfo.secondaryHeaderHeight; 12291 } 12292 12293 if ($bodyBorderTop.length > 0 && $('body.mobile').length == 0) { 12294 12295 $bodyBorderSizeToRemove = ($bodyBorderHeaderColorMatch) ? $bodyBorderTop.height() : 0; 12296 $('.page-submenu.stuck') 12297 .css('transform', 'translateY(' + (heightToAdjust - $bodyBorderSizeToRemove) + 'px)') 12298 .removeClass('header-not-visible'); 12299 } else { 12300 12301 $('.page-submenu.stuck') 12302 .css('transform', 'translateY(' + heightToAdjust + 'px)') 12303 .removeClass('header-not-visible'); 12304 } 12305 12306 } 12307 12308 } 12309 12310 // Keep track of current scroll position 12311 previousScroll = currentScroll; 12312 12313 if (nectarDOMInfo.winW > 999) { 12314 requestAnimationFrame(hhunCalcs); 12315 } 12316 12317 } 12318 12319 // Start the animation loop. 12320 hhunCalcs(); 12321 12322 } 12323 12324 12325 12326 /** 12327 * Shrink the header navigation size. 12328 * 12329 * Used when "Header Resize On Scroll" is active. 12330 * 12331 * @since 1.0 12332 */ 12333 function smallNav() { 12334 12335 var $offset = nectarDOMInfo.scrollTop, 12336 $windowWidth = nectarDOMInfo.winW, 12337 $scrollTriggerOffset = ($body.is('.material')) ? 150 : 30; 12338 12339 if ($offset > $scrollTriggerOffset && $windowWidth >= 1000 && $('body.material-ocm-open').length == 0) { 12340 12341 12342 // Going to small when material search is closing, it must be closed immediately 12343 if ($body.is('.material')) { 12344 12345 if ($('#search-outer.material-open').length == 0) { 12346 $('#header-outer[data-transparent-header="true"] .bg-color-stripe').css('transition', 'none'); 12347 } 12348 12349 // Secondary header 12350 if ($headerSecondaryEl.length > 0) { 12351 $headerSecondaryEl.addClass('hide-up'); 12352 $headerOuterEl.css('transform', 'translateY(-' + nectarDOMInfo.secondaryHeaderHeight + 'px)'); 12353 } 12354 12355 } 12356 12357 if ($('#header-outer[data-megamenu-rt="1"]').length > 0 && 12358 $('#header-outer[data-transparent-header="true"]').length > 0 && 12359 $('#header-outer .megamenu').length > 0) { 12360 12361 if ($headerOuterEl.attr('data-transparent-header') == 'true' && 12362 $('#header-outer.side-widget-open').length == 0 && 12363 $('#header-outer[data-permanent-transparent="1"]').length == 0 && 12364 $('.megamenu.sfHover').length == 0) { 12365 $headerOuterEl.removeClass('transparent'); 12366 $headerOuterEl.removeClass('no-transition'); 12367 } 12368 12369 } else { 12370 12371 if ($headerOuterEl.attr('data-transparent-header') == 'true' && 12372 $('#header-outer.side-widget-open').length == 0 && 12373 $('#header-outer[data-permanent-transparent="1"]').length == 0) { 12374 $headerOuterEl.removeClass('transparent'); 12375 } 12376 12377 } 12378 12379 $('#header-outer, #search-outer').addClass('small-nav'); 12380 12381 // Body border full width side padding 12382 if ($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 && 12383 $bodyBorderTop.length > 0 && 12384 $bodyBorderHeaderColorMatch == true) { 12385 12386 $('#header-outer[data-full-width="true"] header > .container').stop(true, true).animate({ 12387 'padding': '0' 12388 }, { 12389 queue: false, 12390 duration: 250, 12391 easing: 'easeOutCubic' 12392 }); 12393 12394 } 12395 12396 if ($('body.material').length > 0) { 12397 $('header#top nav > ul > li.menu-item-with-margin').stop(true, true).animate({ 12398 'margin-right': (parseInt($('header#top nav > ul > li.menu-item-with-margin').css('margin-right')) - parseInt(logoShrinkNum) * 3) + 'px' 12399 }, {
12400 queue: false, 12401 duration: 310, 12402 easing: 'easeOutQuad' 12403 }); 12404 } 12405 12406 // Box roll effect 12407 if ($('.nectar-box-roll').length > 0 && $('#header-outer[data-permanent-transparent="1"]').length == 0) { 12408 $('#ajax-content-wrap').animate({ 12409 'margin-top': (Math.floor(($logoHeight - logoShrinkNum) + (headerPadding * 2) / 1.8 + nectarDOMInfo.adminBarHeight + nectarDOMInfo.secondaryHeaderHeight)) 12410 }, { 12411 queue: false, 12412 duration: 250, 12413 easing: 'easeOutCubic' 12414 }); 12415 } 12416 12417 $window.off('scroll.headerResizeEffect', smallNav); 12418 $window.on('scroll.headerResizeEffect', bigNav); 12419 12420 // Dark slider coloring border 12421 $('#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'); 12422 $('#header-outer[data-transparent-header="true"] .cart-menu').css('transition', 'none'); 12423 setTimeout(function () { 12424 $('#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'); 12425 $('#header-outer[data-transparent-header="true"] .cart-menu').css('transition', 'border-color 0.30s ease'); 12426 }, 300); 12427 12428 } 12429 12430 } 12431 12432 12433 /** 12434 * Return header navigation size to full. 12435 * 12436 * Used when "Header Resize On Scroll" is active. 12437 * 12438 * @since 1.0 12439 */ 12440 function bigNav() { 12441 12442 var $offset = nectarDOMInfo.scrollTop, 12443 $windowWidth = nectarDOMInfo.winW, 12444 $scrollTriggerOffset = ($body.is('.material')) ? 150 : 30; 12445 12446 if ($body.is('.material-ocm-open')) { 12447 return false; 12448 } 12449 12450 if ($offset <= $scrollTriggerOffset && $windowWidth >= 1000 || $('.small-nav').length > 0 && $('#ajax-content-wrap.no-scroll').length > 0) { 12451 12452 $('#header-outer, #search-outer').removeClass('small-nav'); 12453 12454 if ($('#header-outer[data-megamenu-rt="1"]').length > 0 && 12455 $('#header-outer[data-transparent-header="true"]').length > 0 && 12456 $('#header-outer .megamenu').length > 0) { 12457 12458 if ($headerOuterEl.attr('data-transparent-header') == 'true' && 12459 $('.nectar-box-roll').length == 0 && 12460 $('.megamenu.sfHover').length == 0) { 12461 12462 $headerOuterEl.addClass('transparent'); 12463 $headerOuterEl.removeClass('no-transition'); 12464 } 12465 12466 } else { 12467 12468 if ($headerOuterEl.attr('data-transparent-header') == 'true' && $('.nectar-box-roll').length == 0) { 12469 $headerOuterEl.addClass('transparent'); 12470 } 12471 12472 } 12473 12474 // Body border full width side padding 12475 if ($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 && 12476 $bodyBorderTop.length > 0 && 12477 $bodyBorderHeaderColorMatch == true) { 12478 12479 $('#header-outer[data-full-width="true"] header > .container').stop(true, true).animate({ 12480 'padding': '0 28px' 12481 }, { 12482 queue: false, 12483 duration: 250, 12484 easing: 'easeOutCubic' 12485 }); 12486 12487 } 12488 12489 12490 if ($('body.material').length > 0) { 12491 12492 $('header#top nav > ul > li.menu-item-with-margin').stop(true, true).animate({ 12493 'margin-right': (parseInt($('header#top nav > ul > li.menu-item-with-margin').css('margin-right')) + parseInt(logoShrinkNum) * 3) + 'px' 12494 }, { 12495 queue: false, 12496 duration: 140, 12497 easing: 'easeOutQuad' 12498 }); 12499 12500 } 12501 12502 12503 // Secondary header 12504 if ($headerSecondaryEl.length > 0) { 12505 12506 $headerSecondaryEl.removeClass('hide-up'); 12507 $headerOuterEl 12508 .removeClass('hide-up') 12509 .css('transform', 'translateY(0%)'); 12510 12511 } 12512 12513 // Box roll 12514 if ($('.nectar-box-roll').length > 0 && $('#header-outer[data-permanent-transparent="1"]').length == 0) { 12515 $('#ajax-content-wrap').animate({ 12516 'margin-top': (Math.floor(($logoHeight) + (headerPadding * 2) + nectarDOMInfo.adminBarHeight + nectarDOMInfo.secondaryHeaderHeight)) 12517 }, {
12518 queue: false, 12519 duration: 250, 12520 easing: 'easeOutCubic' 12521 }); 12522 } 12523 12524 $window.off('scroll.headerResizeEffect', bigNav); 12525 $window.on('scroll.headerResizeEffect', smallNav); 12526 12527 // Dark slider coloring border 12528 $('#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'); 12529 $('#header-outer[data-transparent-header="true"] .cart-menu').css('transition', 'none'); 12530 setTimeout(function () { 12531 $('#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'); 12532 $('#header-outer[data-transparent-header="true"] .cart-menu').css('transition', 'border-color 0.30s ease'); 12533 }, 300); 12534 } 12535 12536 } 12537 12538 12539 12540 /** 12541 * Default scroll event to handle transparency/secondary header when no header effects are enabled. 12542 * 12543 * @since 4.0 12544 */ 12545 function opaqueCheck() { 12546 12547 // The condense header effect will bypass this unless in the custom mobile breakpoint (which is defined in theme options). 12548 if ($('#header-outer[data-format="centered-menu-bottom-bar"][data-condense="true"]').length > 0 && !$headerOuterEl.hasClass('within-custom-breakpoint') ) { 12549 return; 12550 } 12551 12552 if (nectarDOMInfo.scrollTop > 0) { 12553 12554 if ($('body.material').length > 0) { 12555 $headerOuterEl.addClass('scrolled-down'); 12556 12557 // Secondary header 12558 if ($headerSecondaryEl.length > 0 && nectarDOMInfo.winW > 1000) { 12559 $headerSecondaryEl.addClass('hide-up'); 12560 $headerOuterEl.css('transform', 'translateY(-' + nectarDOMInfo.secondaryHeaderHeight + 'px)'); 12561 } 12562 } 12563 12564 if ($headerOuterEl.attr('data-transparent-header') == 'true' && $('#header-outer[data-permanent-transparent="1"]').length == 0) { 12565 $headerOuterEl.removeClass('transparent').addClass('scrolled-down'); 12566 } 12567 12568 // Switch event to watch. 12569 $window.off('scroll.headerResizeEffectOpaque', opaqueCheck); 12570 $window.on('scroll.headerResizeEffectOpaque', transparentCheck); 12571 } 12572 } 12573 12574 12575 /** 12576 * Default scroll event to handle transparency/secondary header when no header effects are enabled. 12577 * 12578 * @since 4.0 12579 */ 12580 function transparentCheck() { 12581 12582 // The condense header effect will bypass this unless in the custom mobile breakpoint (which is defined in theme options). 12583 if ($('#header-outer[data-format="centered-menu-bottom-bar"][data-condense="true"]').length > 0 && !$headerOuterEl.hasClass('within-custom-breakpoint') ) { 12584 return; 12585 } 12586 12587 if (nectarDOMInfo.scrollTop == 0 && $('body.material-ocm-open').length == 0) { 12588 12589 if ($('#header-outer[data-megamenu-rt="1"]').length > 0 && 12590 $('#header-outer[data-transparent-header="true"]').length > 0 && 12591 $('#header-outer .megamenu').length > 0) { 12592 12593 if ($headerOuterEl.attr('data-transparent-header') == 'true' && $('.megamenu.sfHover').length == 0) { 12594 12595 $headerOuterEl 12596 .addClass('transparent') 12597 .removeClass('scrolled-down'); 12598 12599 $headerOuterEl.removeClass('no-transition'); 12600 12601 } else if ($headerOuterEl.attr('data-transparent-header') == 'true') { 12602 12603 $headerOuterEl.removeClass('scrolled-down'); 12604 } 12605 12606 } else { 12607 12608 if ($headerOuterEl.attr('data-transparent-header') == 'true') { 12609 $headerOuterEl 12610 .addClass('transparent') 12611 .removeClass('scrolled-down'); 12612 } 12613 12614 } 12615 12616 if ($('body.material').length > 0) { 12617 $headerOuterEl.removeClass('scrolled-down'); 12618 12619 // Secondary header 12620 if ($headerSecondaryEl.length > 0 && nectarDOMInfo.winW > 1000) { 12621 12622 $headerSecondaryEl.removeClass('hide-up'); 12623 $headerOuterEl 12624 .removeClass('hide-up') 12625 .css('transform', 'translateY(0%)'); 12626 } 12627 } 12628 12629 // Switch event to watch. 12630 $window.off('scroll.headerResizeEffectOpaque', transparentCheck); 12631 $window.on('scroll.headerResizeEffectOpaque', opaqueCheck); 12632 } 12633 12634 } 12635 12636 12637 12638 12639 /** 12640 * Mobile header event for handling transparency/secondary header. 12641 * 12642 * @since 10.5 12643 * @see bindScrollEffectsMobile 12644 */ 12645 function mobileHeaderRAF() { 12646 12647 if ($('body.material-ocm-open').length > 0) { 12648 requestAnimationFrame(mobileHeaderRAF); 12649 return; 12650 } 12651 // Scrolled down. 12652 if (nectarDOMInfo.scrollTop > 80) { 12653 12654 if (!$headerOuterEl.is('[data-permanent-transparent="1"]')) { 12655 $headerOuterEl.removeClass('transparent'); 12656 } 12657 12658 if (nectarDOMInfo.secondaryHeaderHeight > 0) { 12659 $headerSecondaryEl.addClass('hide-up'); 12660 $headerOuterEl.css('transform', 'translateY(-' + nectarDOMInfo.secondaryHeaderHeight + 'px)').addClass('hidden-secondary'); 12661 } else { 12662 $headerOuterEl.removeClass('hidden-secondary'); 12663 } 12664 12665 } 12666 // At top. 12667 else { 12668 12669 if ($headerOuterEl.is('[data-transparent-header="true"]')) { 12670 $headerOuterEl.addClass('transparent'); 12671 } 12672 12673 if (nectarDOMInfo.secondaryHeaderHeight > 0) { 12674 $headerSecondaryEl.removeClass('hide-up'); 12675 $headerOuterEl.css('transform', 'translateY(0px)'); 12676 } 12677 $headerOuterEl.removeClass('hidden-secondary'); 12678 12679 } 12680 12681 if (nectarDOMInfo.winW < 1000) { 12682 requestAnimationFrame(mobileHeaderRAF); 12683 } 12684 } 12685 12686 12687 12688 /** 12689 * Bind mobile header scroll effects. 12690 * 12691 * @since 10.5 12692 * @see headerNavScrollInit 12693 */ 12694 function bindScrollEffectsMobile() { 12695 12696 if (nectarDOMInfo.winW > 999) { 12697 return; 12698 } 12699 12700 // Unbind desktop effects. 12701 $window.off('scroll.headerResizeEffect'); 12702 $window.off('scroll.headerResizeEffectOpaque'); 12703 12704 // Remove HHUN classes. 12705 $headerOuterEl 12706 .removeClass('scrolled-down') 12707 .removeClass('detached') 12708 .removeClass('invisible') 12709 .removeClass('at-top') 12710 .css('transform', 'none'); 12711 12712 // Handle mobile transparent class. 12713 if ($('#header-outer[data-mobile-fixed="1"]').length > 0) { 12714 requestAnimationFrame(mobileHeaderRAF); 12715 } else if ($headerOuterEl.attr('data-transparent-header') == 'true') { 12716 $headerOuterEl.addClass('transparent'); 12717 } 12718 12719 $window.off('smartresize.nectarNavScrollEffects'); 12720 $window.on('smartresize.nectarNavScrollEffects', bindScrollEffectsDesktop); 12721 12722 } 12723 12724 /** 12725 * Bind deaktop header scroll effects. 12726 * 12727 * @since 10.5 12728 * @see headerNavScrollInit 12729 */ 12730 function bindScrollEffectsDesktop() { 12731 12732 if (nectarDOMInfo.winW < 1000) { 12733 return; 12734 } 12735 12736 if (headerResize == true && headerHideUntilNeeded != '1') { 12737 12738 $window.off('scroll.headerResizeEffect'); 12739 12740 if ($('#nectar_fullscreen_rows').length == 0) { 12741 $window.on('scroll.headerResizeEffect', smallNav); 12742 } else if ($('#nectar_fullscreen_rows[data-mobile-disable="on"]').length > 0 && nectarDOMInfo.usingMobileBrowser) { 12743 $window.on('scroll.headerResizeEffect', smallNav); 12744 } 12745 12746 } else if (headerHideUntilNeeded != '1') { 12747 12748 $window.off('scroll.headerResizeEffectOpaque'); 12749 $window.on('scroll.headerResizeEffectOpaque', opaqueCheck); 12750 12751 }
12751 else if (headerHideUntilNeeded == '1') { 12752 12753 12754 if ($('.nectar-box-roll').length > 0) { 12755 $headerOuterEl.addClass('at-top-before-box'); 12756 } 12757 12758 // Don't trigger for header remove stickiness. 12759 if ($('#header-outer[data-remove-fixed="1"]').length == 0) { 12760 hhunHeaderEffect(); 12761 } 12762 12763 } //end if hhun 12764 12765 // Condense header effect coming from mobile. 12766 if ($('#header-outer[data-format="centered-menu-bottom-bar"][data-condense="true"]').length > 0 ) { 12767 12768 if( $headerSecondaryEl.length > 0 ) { 12769 // Remove transform. 12770 $headerOuterEl.css('transform',''); 12771 } 12772 12773 if ( nectarDOMInfo.scrollTop > 200 && !$headerOuterEl.hasClass('fixed-menu') ) { 12774 $headerOuterEl.addClass('fixed-menu'); 12775 } 12776 12777 } 12778 12779 // Only bind mobile if applicable. 12780 12781 $window.off('smartresize.nectarNavScrollEffects'); 12782 $window.on('smartresize.nectarNavScrollEffects', bindScrollEffectsMobile); 12783 12784 } 12785 12786 12787 12788 /** 12789 * Header Navigation scroll events initialization. 12790 * 12791 * @since 10.5 12792 */ 12793 function headerNavScrollInit() { 12794 12795 // Remove transparent class if page loaded further down. 12796 if ($('#header-outer[data-remove-fixed="1"]').length == 0 && nectarDOMInfo.winW > 1000) { 12797 if ( $(window).scrollTop() != 0 && $('#header-outer.transparent[data-permanent-transparent="false"]').length == 1) { 12798 $headerOuterEl.removeClass('transparent'); 12799 } 12800 } 12801 12802 // Permanent transparent header. 12803 if ($('#nectar_fullscreen_rows').length == 0 && $('.nectar-box-roll').length == 0) { 12804 midnightInit(); 12805 } 12806 12807 // Determine which events to bind at start. 12808 if (nectarDOMInfo.winW < 1000 && $('.nectar-box-roll').length == 0) { 12809 bindScrollEffectsMobile(); 12810 $window.on('smartresize.nectarNavScrollEffects', bindScrollEffectsMobile); 12811 } else { 12812 bindScrollEffectsDesktop(); 12813 $window.on('smartresize.nectarNavScrollEffects', bindScrollEffectsDesktop); 12814 } 12815 12816 } 12817 12818 12819 12820 12821 12822 12823 /** 12824 * Set the header space div height. 12825 * 12826 * @since 10.5 12827 */ 12828 function headerSpace() { 12829 12830 if ($('.mobile').length > 0) { 12831 12832 if (nectarDOMInfo.winH < nectarDOMInfo.winW && nectarDOMInfo.winW > 1000) { 12833 if ($('#header-outer.small-nav').length == 0) { 12834 $('#header-space').css('height', $headerOuterEl.outerHeight()); 12835 } 12836 } else { 12837 $('#header-space').css('height', $headerOuterEl.outerHeight()); 12838 } 12839 12840 } else { 12841 12842 if ($('.nectar-parallax-scene.first-section').length == 0) { 12843 12844 var headerPadding2 = headerPadding - headerPadding / 1.8; 12845 var $headerHeight = ($('#header-outer[data-header-resize="1"]').length > 0 && $('.small-nav').length > 0) ? $headerOuterEl.outerHeight() + (parseInt(logoShrinkNum) + headerPadding2 * 2) : $headerOuterEl.outerHeight(); 12846 12847 $('#header-space').css('height', $headerHeight); 12848 12849 } 12850 12851 } 12852 12853 } 12854 12855 12856 12857 /** 12858 * Handle header nav distance away from top to account for admin bar. 12859 * 12860 * @since 10.5 12861 */ 12862 12863 function headerNavOffsetInit() { 12864 12865 var lastPosition = -1; 12866 var $headerScrollTop = nectarDOMInfo.scrollTop; 12867 12868 // Verify scroll pos has changed before calculating. 12869 function headerOffsetAdjust() { 12870 12871 if ($('body.compose-mode').length > 0) { 12872 return; 12873 } 12874 12875 $headerScrollTop = nectarDOMInfo.scrollTop; 12876 12877 if (lastPosition == $headerScrollTop) { 12878 requestAnimationFrame(headerOffsetAdjust); 12879 return false; 12880 } else { 12881 lastPosition = $headerScrollTop; 12882 } 12883 12884 headerOffsetAdjustCalc(); 12885 requestAnimationFrame(headerOffsetAdjust); 12886 12887 } 12888 12889 // Called when scrolling occurs. 12890 function headerOffsetAdjustCalc() { 12891 12892 var $eleHeight = 0; 12893 12894 // Mobile. 12895 if ($('body.mobile').length > 0 || (condenseHeaderLayout == true && $('#header-outer .span_9').css('display') == 'none')) { 12896 12897 $eleHeight = 0; 12898 var $endOffset = ($wpAdminBar.css('position') == 'fixed') ? $wpAdminBar.height() : 0; 12899 12900 $eleHeight += nectarDOMInfo.adminBarHeight; 12901 12902 if ($eleHeight - $headerScrollTop > $endOffset) { 12903 $headerOuterEl.css('top', $eleHeight - $headerScrollTop + 'px'); 12904 } else { 12905 $headerOuterEl.css('top', $endOffset); 12906 } 12907 12908 } 12909 // Desktop 12910 else { 12911 if ( condenseHeaderLayout == false ) { 12912 12913 $eleHeight = 0; 12914 12915 if( !$headerOuterEl.is('[data-remove-fixed="1"]') ) { 12916 $eleHeight += nectarDOMInfo.adminBarHeight; 12917 } 12918 $headerOuterEl.css('top', $eleHeight + 'px'); 12919 } 12920 } 12921 12922 } 12923 12924 // Bind event and begin if needed. 12925 if ($('#header-outer[data-mobile-fixed="1"]').length > 0 && $wpAdminBar.length > 0) { 12926 12927 if ($('#nectar_fullscreen_rows').length == 0) { 12928 requestAnimationFrame(headerOffsetAdjust); 12929 } else if ($('#nectar_fullscreen_rows').length > 0 && nectarDOMInfo.usingMobileBrowser) { 12930 requestAnimationFrame(headerOffsetAdjust); 12931 } 12932 12933 $window.smartresize(headerOffsetAdjustCalc); 12934 12935 } 12936 12937 } 12938 12939 12940 12941 12942 12943 12944 12945 /** 12946 * Calculate the minimum body height when using the footer reveal effect or material OCM 12947 * 12948 * @since 7.0 12949 */ 12950 function footerRevealCalcs() { 12951 12952 var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $window.width() > 1000) ? 0 : $headerOuterEl.outerHeight(); 12953 12954 if ($window.height() - $wpAdminBar.height() - $headerNavSpace - $('#footer-outer').height() - 1 - $pageHeaderBG.height() - $('.page-header-no-bg').height() > 0) { 12955 var $resizeExtra = ($('body:not(.material) #header-outer[data-header-resize="1"]').length > 0) ? 55 : 0; 12956 $('body[data-footer-reveal="1"] .container-wrap').css({ 12957 'margin-bottom': $('#footer-outer').height() - 1 12958 }); 12959 12960 $('.container-wrap').css({ 12961 'min-height': $window.height() - $wpAdminBar.height() - $headerNavSpace - $('#footer-outer').height() - 1 - $('.page-header-no-bg').height() - $pageHeaderBG.height() + $resizeExtra 12962 }); 12963 12964 } else { 12965 $('body[data-footer-reveal="1"] .container-wrap').css({ 12966 'margin-bottom': $('#footer-outer').height() - 1 12967 }); 12968 } 12969 12970 if ($window.width() < 1000) { 12971 $('#footer-outer').attr('data-midnight', 'light'); 12972 } 12973 else { 12974 $('#footer-outer').removeAttr('data-midnight'); 12975 } 12976 } 12977 12978 12979 /** 12980 * Initialize footer reveal and bind event 12981 * 12982 * @since 10.5 12983 */ 12984 function footerRevealInit() { 12985 12986 if ($('body[data-footer-reveal="1"]').length >
12986 0 || $('body.material[data-slide-out-widget-area-style="slide-out-from-right"]').length > 0) { 12987 12988 $body.addClass('nectar-no-flex-height'); 12989 12990 setTimeout(function () { 12991 footerRevealCalcs(); 12992 }, 60); 12993 footerRevealCalcs(); 12994 12995 $window.on('resize', footerRevealCalcs); 12996 12997 if ($('bodybody[data-footer-reveal="1"][data-footer-reveal-shadow="large_2"]').length > 0) $('.container-wrap').css({ 12998 boxShadow: '0 70px 110px -30px ' + $('#footer-outer').css('backgroundColor') 12999 }); 13000 13001 } 13002 13003 } 13004 13005 13006 13007 13008 13009 /** 13010 * Switch header navigation BG color to match row BG color that is passes. 13011 * 13012 * Only called when using "Header Inherit Row Color" option. 13013 * 13014 * @since 5.0 13015 */ 13016 function headerRowColorInheritInit() { 13017 13018 if ($('body[data-header-inherit-rc="true"]').length > 0 && $('.mobile').length == 0 && $('#header-outer[data-transparent-header="true"]').length > 0 ) { 13019 13020 var headerOffset = $logoHeight / 2 + headerPadding + nectarDOMInfo.adminBarHeight; 13021 13022 if( $('#header-outer[data-permanent-transparent="1"]').length == 0 ) { 13023 headerOffset = ($logoHeight - logoShrinkNum) + Math.ceil((headerPadding * 2) / 1.8) + nectarDOMInfo.adminBarHeight; 13024 } 13025 13026 $('.main-content > .row > .wpb_row').each(function () { 13027 13028 var $that = $(this); 13029 var $textColor; 13030 13031 var waypoint = new Waypoint({ 13032 element: $that, 13033 handler: function (direction) { 13034 13035 //User is scrolling down. 13036 if (direction == 'down') { 13037 13038 if ($that.find('.row-bg.using-bg-color').length > 0) { 13039 13040 $textColor = ($that.find('> .col.span_12.light').length > 0) ? 'light-text' : 'dark-text'; 13041 13042 $headerOuterEl 13043 .css('background-color', $that.find('.row-bg').css('background-color')) 13044 .removeClass('light-text') 13045 .removeClass('dark-text') 13046 .addClass($textColor); 13047 13048 $headerOuterEl.attr('data-current-row-bg-color', $that.find('.row-bg').css('background-color')); 13049 $('body.material #header-outer .bg-color-stripe').css('background-color', $that.find('.row-bg').css('background-color')); 13050 13051 } else { 13052 13053 $headerOuterEl 13054 .css('background-color', $headerOuterEl.attr('data-user-set-bg')) 13055 .removeClass('light-text') 13056 .removeClass('dark-text'); 13057 13058 $headerOuterEl.attr('data-current-row-bg-color', $headerOuterEl.attr('data-user-set-bg')); 13059 $('body.material #header-outer .bg-color-stripe').css('background-color', ''); 13060 13061 } 13062 13063 } 13064 13065 //User is scrolling up. 13066 else { 13067 13068 if ($that.prev('div.wpb_row').find('.row-bg.using-bg-color').length > 0) { 13069 13070 $textColor = ($that.prev('div.wpb_row').find('> .col.span_12.light').length > 0) ? 'light-text' : 'dark-text'; 13071 13072 $headerOuterEl 13073 .css('background-color', $that.prev('div.wpb_row').find('.row-bg').css('background-color')) 13074 .removeClass('light-text') 13075 .removeClass('dark-text') 13076 .addClass($textColor); 13077 13078 $headerOuterEl.attr('data-current-row-bg-color', $that.prev('div.wpb_row').find('.row-bg').css('background-color')); 13079 $('body.material #header-outer .bg-color-stripe').css('background-color', $that.prev('div.wpb_row').find('.row-bg').css('background-color')); 13080 13081 } else { 13082 13083 $headerOuterEl 13084 .css('background-color', $headerOuterEl.attr('data-user-set-bg')) 13085 .removeClass('light-text') 13086 .removeClass('dark-text'); 13087 13088 $headerOuterEl.attr('data-current-row-bg-color', $headerOuterEl.attr('data-user-set-bg')); 13089 $('body.material #header-outer .bg-color-stripe').css('background-color', ''); 13090 13091 } 13092 13093 } 13094 13095 }, 13096 offset: headerOffset 13097 13098 }); // End of waypoint bind. 13099 13100 }); // End of loop through rows. 13101 13102 } 13103 13104 } 13105 13106 13107 13108 /** 13109 * Page submenu sticky functionality 13110 * 13111 * @since 10.5.2 13112 */ 13113 13114 function stickyPageSubmenuInit() { 13115 13116 var $ = window.jQuery, 13117 Waypoint = window.Waypoint, 13118 $offsetHeight = calcHeaderNavHeight(), 13119 $headerHeight = calcHeaderNavHeight(); 13120 13121 $window.on('smartresize', function () { 13122 13123 $offsetHeight = calcHeaderNavHeight(); 13124 13125 if ($wpAdminBar.length > 0 && 13126 $wpAdminBar.css('position') == 'fixed') { 13127 $offsetHeight += $wpAdminBar.height(); 13128 } 13129 13130 if ($bodyBorderTop.length > 0 && 13131 $window.width() > 1000 && 13132 $('body[data-hhun="1"]').length > 0) { 13133 $offsetHeight += $bodyBorderTop.height(); 13134 } 13135 13136 // Recalc for resizing (same as stuck/unstuck logic below) 13137 if ($('.page-submenu.stuck').length > 0) { 13138 13139 $('.page-submenu.stuck') 13140 .addClass('no-trans') 13141 .css('top', $offsetHeight) 13142 .css('transform', 'translateY(0)').addClass('stuck'); 13143 13144 setTimeout(function () { 13145 $('.page-submenu.stuck').removeClass('no-trans'); 13146 }, 50); 13147 13148 $('.page-submenu.stuck') 13149 .parents('.wpb_row') 13150 .css('z-index', 10000); 13151 13152 // Boxed layout 13153 if ($('#boxed').length > 0) { 13154 13155 var $negMargin = ($window.width() > 1000) ? $('.container-wrap').width() * 0.04 : 39; 13156 13157 $('.page-submenu.stuck').css({ 13158 'margin-left': '-' + $negMargin + 'px', 13159 'width': $('.container-wrap').width() 13160 }); 13161 13162 } 13163 13164 } else { 13165 13166 $('.page-submenu.stuck') 13167 .css('top', '0') 13168 .removeClass('stuck'); 13169 13170 $('.page-submenu.stuck') 13171 .parents('.wpb_row') 13172 .css('z-index', 'auto'); 13173 13174 if ($('#boxed').length > 0) { 13175 $('.page-submenu.stuck').css({ 13176 'margin-left': '0px', 13177 'width': '100%' 13178 }); 13179 } 13180 13181 } 13182 13183 }); 13184 13185 /* http://imakewebthings.com/waypoints/shortcuts/sticky-elements */ 13186 function Sticky(options) { 13187 this.options = $.extend({}, Waypoint.defaults, Sticky.defaults, options); 13188 this.element = this.options.element; 13189 this.$element = $(this.element); 13190 this.createWrapper(); 13191 this.createWaypoint(); 13192 } 13193 13194 /* Private */ 13195 Sticky.prototype.createWaypoint = function () { 13196 13197 var originalHandler = this.options.handler; 13198 13199 $offsetHeight = calcHeaderNavHeight(); 13200 13201 if ($wpAdminBar.length > 0 && $wpAdminBar.css('position') == 'fixed') { 13202 $offsetHeight += $wpAdminBar.height(); 13203 } 13204 13205 if ($bodyBorderTop.length > 0 && $window.width() > 1000 && $('body[data-hhun="1"]').length > 0) { 13206 $offsetHeight += $bodyBorderTop.height(); 13207 } 13208 13209 this.waypoint = new Waypoint($.extend({}, this.options, { 13210 element: this.wrapper, 13211 handler: $.proxy(function (direction) { 13212 var shouldBeStuck = this.options.direction.indexOf(direction) > -1; 13213 var wrapperHeight = shouldBeStuck ? this.$element.outerHeight(true) : ''; 13214 13215 this.$wrapper.height(wrapperHeight); 13216 if (shouldBeStuck) { 13217 13218 this.$element 13219 .addClass('no-trans') 13220 .css('top', $offsetHeight) 13221 .css('transform', 'translateY(0)') 13222 .addClass('stuck'); 13223 13224 var $that = this; 13225 13226 setTimeout(function () { 13227 $that.$element.removeClass('no-trans'); 13228 }, 50); 13229 13230 this.$element.parents('.wpb_row').css('z-index', 10000); 13231 13232 //boxed 13233 if ($('#boxed').length > 0) { 13234 var $negMargin = ($window.width() > 1000) ? $('.container-wrap').width() * 0.04 : 39; 13235 this.$element.css({ 13236 'margin-left': '-' + $negMargin + 'px', 13237 'width': $('.container-wrap').width() 13238 }); 13239 } 13240 13241 } else { 13242 this.$element.css('top', '0').removeClass('stuck'); 13243 13244 if ($('#boxed').length > 0) this.$element.css({ 13245 'margin-left': '0px', 13246 'width': '100%' 13247 }); 13248 } 13249 13250 if (originalHandler) { 13251 originalHandler.call(this, direction); 13252 } 13253 }, this), 13254 offset: $offsetHeight 13255 })); 13256 13257 var $that = this; 13258 13259 13260 setInterval(function () { 13261 13262 if ($('body[data-hhun="1"] #header-outer.detached:not(.invisible)').length > 0) { 13263 13264 var heightToAdjust = $headerOuterEl.outerHeight(); 13265 13266 if( $headerSecondaryEl.length > 0) { 13267 heightToAdjust -= nectarDOMInfo.secondaryHeaderHeight; 13268 } 13269 13270 $that.waypoint.options.offset = $offsetHeight + heightToAdjust; 13271 } 13272 else { 13273 $that.waypoint.options.offset = $offsetHeight; 13274 } 13275 13276 Waypoint.refreshAll(); 13277 13278 }, 100); 13279 13280 13281 }; 13282 13283 /* Private */ 13284 Sticky.prototype.createWrapper = function () { 13285 if (this.options.wrapper) { 13286 this.$element.wrap(this.options.wrapper); 13287 } 13288 this.$wrapper = this.$element.parent(); 13289 this.wrapper = this.$wrapper[0]; 13290 }; 13291 13292 /* Public */ 13293 Sticky.prototype.destroy = function () { 13294 13295 if (this.$element.parent()[0] === this.wrapper) { 13296 this.waypoint.destroy(); 13297 this.$element.removeClass(this.options.stuckClass); 13298 if (this.options.wrapper) { 13299 this.$element.unwrap(); 13300 } 13301 } 13302 13303 }; 13304 13305 Sticky.defaults = { 13306 wrapper: '<div class="sticky-wrapper" />', 13307 stuckClass: 'stuck', 13308 direction: 'down right' 13309 }; 13310
13311 Waypoint.Sticky = Sticky; 13312 13313 } 13314 13315 13316 13317 /** 13318 * Page submenu page builder element. 13319 * 13320 * @since 10.5 13321 */ 13322 13323 function pageSubmenuInit() { 13324 13325 if ($('.page-submenu[data-sticky="true"]').length > 0 && $('#nectar_fullscreen_rows').length == 0) { 13326 13327 stickyPageSubmenuInit(); 13328 13329 // Remove outside of column setups 13330 if ($('.page-submenu').parents('.span_12').find('> .wpb_column').length > 1) { 13331 13332 var pageMenu = $('.page-submenu').clone(), 13333 pageMenuParentRow = $('.page-submenu').parents('.wpb_row'); 13334 13335 $('.page-submenu').remove(); 13336 pageMenuParentRow.before(pageMenu); 13337 } 13338 13339 var sticky = new Waypoint.Sticky({ 13340 element: $('.page-submenu[data-sticky="true"]')[0] 13341 }); 13342 13343 } 13344 13345 // Adjust to be higher. 13346 if ($('#nectar_fullscreen_rows').length == 0) { 13347 13348 $('.page-submenu') 13349 .parents('.wpb_row') 13350 .css('z-index', 10000); 13351 } 13352 13353 // Bind events. 13354 $('.page-submenu .mobile-menu-link').on('click', function () { 13355 13356 $(this).parents('.page-submenu') 13357 .find('ul') 13358 .stop(true) 13359 .slideToggle(350); 13360 13361 return false; 13362 13363 }); 13364 13365 $('.page-submenu ul li a').on('click', function () { 13366 13367 if ($('body.mobile').length > 0) { 13368 $(this).parents('.page-submenu') 13369 .find('ul') 13370 .stop(true) 13371 .slideToggle(350); 13372 } 13373 13374 }); 13375 13376 } 13377 13378 13379 13380 13381 /** 13382 * Page builder full height row option. 13383 * 13384 * @since 8.0 13385 */ 13386 13387 function vcFullHeightRow() { 13388 13389 var $element = $(".vc_row-o-full-height:first"); 13390 if ($element.length) { 13391 13392 var windowHeight, offsetTop, fullHeight; 13393 windowHeight = $window.height(); 13394 13395 $(".vc_row-o-full-height").each(function () { 13396 13397 offsetTop = $(this).offset().top; 13398 13399 if (offsetTop < windowHeight && 13400 $(this).hasClass('top-level') && 13401 !nectarDOMInfo.usingFrontEndEditor) { 13402 13403 fullHeight = 100 - offsetTop / (windowHeight / 100); 13404 $(this).css("min-height", fullHeight + "vh"); 13405 $(this).find('> .col.span_12').css("min-height", fullHeight + "vh"); 13406 13407 } else { 13408 13409 $(this).css("min-height", windowHeight); 13410 $(this).find('> .col.span_12').css("min-height", windowHeight); 13411 13412 } 13413 13414 }); 13415 13416 } 13417 13418 } 13419 13420 13421 /** 13422 * Page builder full height row init. 13423 * 13424 * @since 10.5 13425 */ 13426 13427 function vcFullHeightRowInit() { 13428 13429 if( $('.vc_row-o-full-height').length > 0 ) { 13430 vcFullHeightRow(); 13431 $window.on('smartresize', vcFullHeightRow); 13432 } 13433 13434 } 13435 13436 13437 /** 13438 * Page builder equal height row IE helper. 13439 * 13440 * @since 8.0 13441 */ 13442 function fixIeFlexbox() { 13443 var ua = window.navigator.userAgent, 13444 msie = ua.indexOf("MSIE "); 13445 (msie > 0 || navigator.userAgent.match(/Trident.*rv\:11\./)) && $(".vc_row-o-full-height").each(function () { 13446 "flex" === $(this).find('> .span_12').css("display") && $(this).wrap('<div class="vc_ie-flexbox-fixer"></div>') 13447 }); 13448 13449 if( msie > 0 || navigator.userAgent.match(/Trident.*rv\:11\./)) { 13450 fixIE11Images(); 13451 $(window).on('resize',fixIE11Images); 13452 } 13453 13454 } 13455 13456 /** 13457 * Fix the IE11 bug with max-width 100% on imgs 13458 * 13459 * @since 11.0 13460 */ 13461 function fixIE11Images() { 13462 13463 $('.img-with-aniamtion-wrap img.img-with-animation').each(function() { 13464 var $parentWrap = $(this).parents('.img-with-aniamtion-wrap'); 13465 $parentWrap.css({ 13466 'height' : '' 13467 }); 13468 var height = $(this).height(); 13469 13470 $parentWrap.css({ 13471 'height' : height 13472 }); 13473 13474 }); 13475 13476 } 13477 13478 13479 13480 13481 13482 13483 13484 13485 13486 /** 13487 * Recent post height 13488 * 13489 * @since 10.5 13490 */ 13491 function recentPostsTitleOnlyEqualHeight() { 13492 13493 function recentPostHeight() { 13494 13495 $('.blog-recent[data-style="title_only"]').each(function () { 13496 13497 if ($(this).find('> .col').length > 1) { 13498 return false;
13499 } 13500 var $parentsSeletor = $(this).parent().parent().parent(); 13501 13502 if ($parentsSeletor.hasClass('vc_col-sm-3') || 13503 $parentsSeletor.hasClass('vc_col-sm-4') || 13504 $parentsSeletor.hasClass('vc_col-sm-6') || 13505 $parentsSeletor.hasClass('vc_col-sm-8') || 13506 $parentsSeletor.hasClass('vc_col-sm-9')) { 13507 13508 if ($('body.mobile').length == 0 && $(this).next('div').length == 0) { 13509 var tallestColumn = 0; 13510 13511 $(this).find('> .col').css('padding', '50px 20px'); 13512 13513 $(this).parents('.span_12').find(' > .wpb_column').each(function () { 13514 13515 if( Math.floor($(this).height()) > tallestColumn ) { 13516 tallestColumn = Math.floor($(this).height()); 13517 } 13518 13519 }); 13520 13521 if (Math.floor($(this).find('> .col').outerHeight(true)) < Math.floor($(this).parents('.wpb_row').height()) - 1) { 13522 $(this).find('> .col').css('padding-top', (tallestColumn - $(this).find('> .col').height()) / 2 + 'px'); 13523 $(this).find('> .col').css('padding-bottom', (tallestColumn - $(this).find('> .col').height()) / 2 + 'px'); 13524 } 13525 13526 } else { 13527 $(this).find('> .col').css('padding', '50px 20px'); 13528 } 13529 } 13530 }); 13531 13532 } 13533 13534 // Set heights. 13535 if( $('.blog-recent[data-style="title_only"]').length > 0 ) { 13536 recentPostHeight(); 13537 $window.on('smartresize',recentPostHeight); 13538 } 13539 13540 } 13541 13542 13543 13544 13545 13546 /** 13547 * Helper to calculate recent post slider height 13548 * 13549 * @since 7.0 13550 */ 13551 function recentPostSliderHeight() { 13552 13553 $('.nectar-recent-posts-slider').each(function () { 13554 13555 var $minHeight = 250, 13556 $definedHeight = parseInt($(this).attr('data-height')), 13557 dif = ($('body[data-ext-responsive="true"]').length > 0) ? $window.width() / 1400 : $window.width() / 1100, 13558 $sliderSelectors = $(this).find('.nectar-recent-post-slide, .flickity-viewport'); 13559 13560 if (nectarDOMInfo.winW > 1000 && $('#boxed').length == 0) { 13561 13562 if ($(this).parents('.full-width-content').length == 0) { 13563 13564 if ($('body[data-ext-responsive="true"]').length > 0 && nectarDOMInfo.winW >= 1400) { 13565 $sliderSelectors.css('height', Math.ceil($definedHeight)); 13566 } else if ($('body[data-ext-responsive="true"]').length == 0 && nectarDOMInfo.winW >= 1100) { 13567 $sliderSelectors.css('height', Math.ceil($definedHeight)); 13568 } else { 13569 $sliderSelectors.css('height', Math.ceil($definedHeight * dif)); 13570 } 13571 13572 } else { 13573 $sliderSelectors.css('height', Math.ceil($definedHeight * dif)); 13574 } 13575 13576 } else { 13577 13578 // Column sliders 13579 var $parentCol = ($(this).parents('.wpb_column').length > 0) ? $(this).parents('.wpb_column') : $(this).parents('.col'); 13580 13581 if ($parentCol.length == 0) { 13582 $parentCol = $('.main-content'); 13583 } 13584 13585 if (!$parentCol.hasClass('vc_span12') && 13586 !$parentCol.hasClass('main-content') && 13587 !$parentCol.hasClass('span_12') && 13588 !$parentCol.hasClass('vc_col-sm-12')) { 13589 13590 var $parentColWidth = sliderColumnDesktopWidth($parentCol), 13591 $aspectRatio = $definedHeight / $parentColWidth; 13592 13593 // Min height 13594 if ($aspectRatio * $parentCol.width() <= $minHeight) { 13595 $sliderSelectors.css('height', $minHeight); 13596 } else { 13597 $sliderSelectors.css('height', $aspectRatio * $parentCol.width()); 13598 } 13599 13600 } 13601 13602 // Regular 13603 else { 13604 13605 // Min height 13606 if ($definedHeight * dif <= $minHeight) { 13607 $sliderSelectors.css('height', $minHeight); 13608 } else { 13609 $sliderSelectors.css('height', Math.ceil($definedHeight * dif)); 13610 } 13611 13612 } 13613 13614 } 13615 13616 }); 13617 13618 } 13619 13620 13621 function sliderColumnDesktopWidth(parentCol) { 13622 13623 var $parentColWidth = 1100, 13624 $columnNumberParsed = $(parentCol).attr('class').match(/\d+/); 13625 13626 if ($columnNumberParsed == '2') { 13627 $parentColWidth = 170 13628 } else if ($columnNumberParsed == '3') { 13629 $parentColWidth = 260 13630 } else if ($columnNumberParsed == '4') { 13631 $parentColWidth = 340 13632 } else if ($columnNumberParsed == '6') { 13633 $parentColWidth = 530 13634 } else if ($columnNumberParsed == '8') { 13635 $parentColWidth = 700 13636 } else if ($columnNumberParsed == '9') { 13637 $parentColWidth = 805 13638 } else if ($columnNumberParsed == '10') { 13639 $parentColWidth = 916.3 13640 } else if ($columnNumberParsed == '12') { 13641 $parentColWidth = 1100 13642 } 13643 13644 return $parentColWidth; 13645 } 13646 13647 13648 /** 13649 * Spit text into separate lines to animate in 13650 * 13651 * @since 7.0 13652 */ 13653 13654 function splitLineText() { 13655 $('.nectar-recent-posts-single_featured.multiple_featured').each(function () { 13656 13657 var $slideClass = ($(this).find('.project-slides').length > 0) ? '.project-slide' : '.nectar-recent-post-slide', 13658 $slideInfoClass = ($(this).find('.project-slides').length > 0) ? '.project-info h1' : '.inner-wrap h2 a'; 13659 13660 $(this).find($slideClass).each(function () { 13661 13662 $(this).find($slideInfoClass).each(function () { 13663 13664 var textArr = $(this).text(); 13665 textArr = textArr.trim(); 13666 textArr = textArr.split(' '); 13667 13668 $(this)[0].innerHTML = ''; 13669 13670 for (var i = 0; i < textArr.length; i++) { 13671 $(this)[0].innerHTML += '<span>' + textArr[i] + '</span> '; 13672 } 13673 13674 }); 13675 13676 $(this).find($slideInfoClass + ' > span').wrapInner('<span class="inner" />'); 13677 13678 }); 13679 13680 }); 13681 13682 } 13683 13684 13685 /** 13686 * Spit text into separate lines to animate in 13687 * 13688 * @since 7.0 13689 */ 13690 13691 function splitLineHeadingMarkup() { 13692 13693 $('.nectar-split-heading[data-animation-type="line-reveal-by-space"]').each(function () { 13694 13695 $(this).find('> *').each(function () { 13696 13697 var textArr = $(this).text(); 13698 textArr = textArr.trim(); 13699 textArr = textArr.split(' '); 13700 13701 $(this)[0].innerHTML = ''; 13702 13703 for (var i = 0; i < textArr.length; i++) { 13704 $(this)[0].innerHTML += '<span>' + textArr[i] + '</span> '; 13705 } 13706 13707 }); 13708 13709 if( !$(this).hasClass('animated-in') ) { 13710 $(this).find('> * > span').wrapInner('<span class="inner" />'); 13711 } else { 13712 $(this).find('> * > span').wrapInner('<span class="inner animated" />'); 13713 } 13714 13715 $(this).addClass('markup-generated'); 13716 13717 }); 13718 13719 $('.nectar-split-heading[data-animation-type="letter-fade-reveal"]').each(function () { 13720 13721 13722 $(this).find('> *').each(function () { 13723 13724 var textArr = $(this).text(); 13725 textArr = textArr.trim(); 13726 textArr = textArr.split(' '); 13727 13728 $(this)[0].innerHTML = ''; 13729 13730 for (var i = 0; i < textArr.length; i++) { 13731 $(this)[0].innerHTML += '<span>' + textArr[i] + '</span> '; 13732 } 13733 13734 }); 13735 13736 13737 $(this).find('span').each(function () { 13738 13739 var $this = $(this); 13740 var textArr = $(this).text().split(''); 13741 13742 $this.empty(); 13743 13744 $.each(textArr, function (i, el) { 13745 $this.append("<span>" + el + "</span"); 13746 }); 13747 13748 }); 13749 13750 $(this).addClass('markup-generated'); 13751 13752 }); 13753 13754 } 13755 13756 function splitLineHeadingInit() { 13757 13758 if( $('.nectar-split-heading[data-animation-type="line-reveal-by-space"]').length > 0 || $('.nectar-split-heading[data-animation-type="letter-fade-reveal"]').length > 0 ) { 13759 // Generate markup. 13760 splitLineHeadingMarkup(); 13761 } 13762 13763 } 13764 13765 13766 /** 13767 * Create recent post sliders 13768 * 13769 * @since 7.0 13770 */ 13771 function recentPostsFlickityInit() { 13772 13773 13774 if ($('.nectar-recent-posts-slider-inner').length > 0) { 13775 13776 var $rpFGroupCells = ($('.nectar-recent-posts-slider_multiple_visible').length > 0) ? '90%' : false;
13777 13778 var $rpF = $('.nectar-recent-posts-slider-inner').flickity({ 13779 contain: true, 13780 groupCells: $rpFGroupCells, 13781 draggable: true, 13782 lazyLoad: false, 13783 imagesLoaded: true, 13784 percentPosition: true, 13785 prevNextButtons: false, 13786 pageDots: true, 13787 resize: true, 13788 setGallerySize: true, 13789 wrapAround: true, 13790 accessibility: false 13791 }); 13792 13793 setTimeout(function () { 13794 $('.nectar-recent-posts-slider-inner').addClass('loaded'); 13795 }, 1150); 13796 var flkty = $rpF.data('flickity'); 13797 13798 $rpF.on('dragStart.flickity', function () { 13799 $('.flickity-viewport').addClass('is-moving'); 13800 }); 13801 13802 $rpF.on('dragEnd.flickity', function () { 13803 $('.flickity-viewport').removeClass('is-moving'); 13804 }); 13805 13806 var $dragTimeout; 13807 13808 $rpF.on('select.flickity', function () { 13809 13810 $('.flickity-viewport').addClass('no-hover'); 13811 clearTimeout($dragTimeout); 13812 $dragTimeout = setTimeout(function () { 13813 $('.flickity-viewport').removeClass('no-hover'); 13814 }, 400); 13815 13816 }); 13817 13818 recentPostSliderHeight(); 13819 $window.on('resize', recentPostSliderHeight); 13820 13821 if (!nectarDOMInfo.usingMobileBrowser && !nectarDOMInfo.usingFrontEndEditor) { 13822 $window.on('resize', recentPostSliderParallaxMargins); 13823 } 13824 13825 13826 } 13827 13828 13829 13830 // Multiple featured controls 13831 function multipleLargeFeaturedInit() { 13832 $('.nectar-recent-posts-single_featured.multiple_featured').each(function (sliderIndex) { 13833 13834 if ($(this).find('> .normal-container').length > 0) { 13835 $(this).find('> .normal-container').remove(); 13836 } 13837 13838 $(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>'); 13839 var $that = $(this); 13840 var tallestFeaturedSlide = 0; 13841 var $slideClickTimeout; 13842 13843 // Store instance 13844 $nectarCustomSliderRotate[sliderIndex] = { 13845 autorotate: '' 13846 }; 13847 13848 $(this).find('.nectar-recent-post-slide').each(function (i) { 13849 13850 if ($(this).find('.recent-post-container').height() > tallestFeaturedSlide) { 13851 $(this).siblings().removeClass('tallest'); 13852 $(this).addClass('tallest'); 13853 tallestFeaturedSlide = $(this).find('.recent-post-container').height(); 13854 } 13855 13856 var $activeClass = (i == 0 && $(this).parents('.nectar-recent-posts-single_featured.multiple_featured[data-autorotate="none"]').length > 0) ? 'class="active"' : ''; 13857 $that.find('.controls').append('<li ' + $activeClass + '><span class="title">' + $(this).find('h2').text() + '</span></li>'); 13858 }); 13859 13860 $(this).addClass('js-loaded'); 13861 13862 13863 // Click event 13864 $(this).find('.controls li').on('click', function (e) { 13865 13866 if ($(this).hasClass('active')) { 13867 return; 13868 } 13869 13870 if (e.originalEvent !== undefined) { 13871 $(this).parent().find('.active').addClass('trans-out'); 13872 } 13873 13874 var $index = $(this).index(), 13875 $oldIndex = $(this).parent().find('.active').index(), 13876 $that = $(this); 13877 13878 clearTimeout($slideClickTimeout); 13879 13880 $(this).siblings().removeClass('active'); 13881 $(this).addClass('active'); 13882 13883 $slideClickTimeout = setTimeout(function () { 13884 13885 $that.parents('.multiple_featured') 13886 .find('.nectar-recent-post-slide:not(:eq(' + $index + '))') 13887 .css('opacity', '0') 13888 .removeClass('active'); 13889 13890 $that.parent() 13891 .find('.trans-out') 13892 .removeClass('trans-out'); 13893 13894 }, 300); 13895 13896 $that.parents('.multiple_featured') 13897 .find('.nectar-recent-post-slide:not(:eq(' + $index + '))') 13898 .css('z-index', '10'); 13899 13900 $that.parents('.multiple_featured') 13901 .find('.nectar-recent-post-slide:eq(' + $oldIndex + ')') 13902 .css('z-index', '15'); 13903 13904 $(this).parents('.multiple_featured').find('.nectar-recent-post-slide').eq($index).css({ 13905 'opacity': '1', 13906 'z-index': '20' 13907 }).addClass('active'); 13908 13909 if ($(this).parents('.multiple_featured').attr('data-autorotate') != 'none') { 13910 nectarCustomSliderResetRotate($that.parents('.nectar-recent-posts-single_featured.multiple_featured'), sliderIndex); 13911 } 13912 }); 13913 13914 13915 // Autorotate 13916 $that = $(this); 13917 13918 if ($(this).attr('data-autorotate').length > 0 && 13919 $(this).attr('data-autorotate') != 'none' && 13920 $('body.vc_editor').length == 0) { 13921 13922 setTimeout(function () { 13923 var slide_interval = (parseInt($that.attr('data-autorotate')) < 100) ? 4000 : parseInt($that.attr('data-autorotate')); 13924 13925 $nectarCustomSliderRotate[sliderIndex].autorotate = setInterval(function () { 13926 nectarCustomSliderRotate($that) 13927 }, slide_interval); 13928 13929 // Set first active class 13930 $that 13931 .find('.controls > li:first-child') 13932 .addClass('active'); 13933 13934 }, 30); 13935 13936 } 13937 13938 }); 13939 13940 splitLineText(); 13941 $window.on('resize', splitLineText); 13942 13943 } 13944 13945 multipleLargeFeaturedInit(); 13946 13947 } 13948 13949 13950 13951 /** 13952 * Default recent post slider parallax RAF loop. 13953 * 13954 * @since 7.0 13955 */ 13956 function recentPostSliderParallax() { 13957 13958 $('.nectar-recent-posts-slider').each(function () { 13959 13960 var $offset = parseInt($(this).find('.flickity-slider').position().left), 13961 $slides = $(this).find('.nectar-recent-post-slide'), 13962 $slideLength = $slides.length, 13963 $slideWidth = $slides.width(), 13964 $lastChildIndex = $(this).find('.nectar-recent-post-slide:last-child').index(), 13965 $slideFirstChildBG = $(this).find('.nectar-recent-post-slide:first-child .nectar-recent-post-bg'), 13966 $slideLastChildBG = $(this).find('.nectar-recent-post-slide:last-child .nectar-recent-post-bg'); 13967 13968 // First going to last 13969 if ($offset >= -3) { 13970 $slideLastChildBG.css('margin-left', parseInt(Math.ceil($slideWidth / 3.5)) + 'px'); 13971 } else { 13972 $slideLastChildBG.css('margin-left', '-' + parseInt(Math.ceil($slideWidth / 3.5 * $lastChildIndex)) + 'px'); 13973 } 13974 13975 // Last going to first 13976 if (Math.abs($offset) >= ($slideLength - 1) * $slideWidth) { 13977 $slideFirstChildBG.css('margin-left', '-' + parseInt(Math.ceil(($slideWidth / 3.5) * $slideLength)) + 'px'); 13978 } else { 13979 $slideFirstChildBG.css('margin-left', '0px'); 13980 } 13981 13982 $(this) 13983 .find('.nectar-recent-post-bg') 13984 .css('transform', 'translateX(' + Math.ceil($(this).find('.flickity-slider').position().left / -3.5) + 'px)'); 13985 13986 }); 13987 13988 requestAnimationFrame(recentPostSliderParallax); 13989 13990 } 13991 13992 /** 13993 * Default recent post slider margin calculations. 13994 * 13995 * @since 7.0 13996 */ 13997 function recentPostSliderParallaxMargins() { 13998 13999 $('.nectar-recent-posts-slider').each(function () { 14000 14001 var $slideWidth = $(this).find('.nectar-recent-post-slide').width(); 14002 14003 $(this).find('.nectar-recent-post-slide').each(function (i) { 14004 $(this).find('.nectar-recent-post-bg').css('margin-left', '-' + parseInt(Math.ceil($slideWidth / 3.5) * i) + 'px'); 14005 }); 14006 14007 }); 14008 14009 } 14010 14011 14012 14013 /** 14014 * Initialize all recent post elements. 14015 * 14016 * @since 7.0 14017 */
14018 function recentPostsInit() { 14019 14020 // Start flickity based sliders. 14021 recentPostsFlickityInit(); 14022 14023 14024 // Classic enhanced specific 14025 $('.blog-recent[data-style="classic_enhanced_alt"] .inner-wrap').each(function () { 14026 $(this).find('.post-featured-img').each(function () { 14027 var $src = $(this).find('img').attr('src'); 14028 $(this).css('background-image', 'url(' + $src + ')'); 14029 }); 14030 }); 14031 14032 $('.blog-recent[data-style="classic_enhanced"]').each(function () { 14033 if ($(this).find('.inner-wrap.has-post-thumbnail').length == 0) { 14034 $(this).addClass('no-thumbs'); 14035 } 14036 }); 14037 14038 // Regular recent posts slider. 14039 if (!nectarDOMInfo.usingMobileBrowser) { 14040 if ($('.nectar-recent-posts-slider').length > 0 && !nectarDOMInfo.usingFrontEndEditor) { 14041 window.requestAnimationFrame(recentPostSliderParallax); 14042 } 14043 } 14044 14045 if (!nectarDOMInfo.usingMobileBrowser && !nectarDOMInfo.usingFrontEndEditor) { 14046 recentPostSliderParallaxMargins(); 14047 } 14048 14049 } 14050 14051 14052 14053 14054 /** 14055 * Parallax on mousemove effect 14056 * 14057 * @since 10.5 14058 */ 14059 function parallaxItemHoverEffect() { 14060 14061 //change sizer pos 14062 $('.style-5').each(function () { 14063 $(this) 14064 .find('.sizer') 14065 .insertBefore($(this).find('.parallaxImg')); 14066 }); 14067 14068 // Set parent zindex 14069 $('.style-5') 14070 .parents('.wpb_row') 14071 .css('z-index', '100'); 14072 14073 var d = document, 14074 bd = d.getElementsByTagName('body')[0], 14075 win = window, 14076 imgs = d.querySelectorAll('.parallaxImg'), 14077 totalImgs = imgs.length, 14078 supportsTouch = 'ontouchstart' in win || navigator.msMaxTouchPoints; 14079 14080 if (totalImgs <= 0) { 14081 return; 14082 } 14083 14084 // Build HTML 14085 for (var l = 0; l < totalImgs; l++) { 14086 14087 var thisImg = imgs[l], 14088 layerElems = thisImg.querySelectorAll('.parallaxImg-layer'), 14089 totalLayerElems = layerElems.length; 14090 14091 if (totalLayerElems <= 0) { 14092 continue; 14093 } 14094 14095 while (thisImg.firstChild) { 14096 thisImg.removeChild(thisImg.firstChild); 14097 } 14098 14099 var lastMove = 0; 14100 14101 //throttle performance for all browser other than chrome 14102 var eventThrottle = $('html').hasClass('cssreflections') ? 1 : 80; 14103 if (eventThrottle == 80) { 14104 $body.addClass('cssreflections'); 14105 } 14106 14107 var containerHTML = d.createElement('div'), 14108 shineHTML = d.createElement('div'), 14109 shadowHTML = d.createElement('div'), 14110 layersHTML = d.createElement('div'), 14111 layers = []; 14112 14113 thisImg.id = 'parallaxImg__' + l; 14114 containerHTML.className = 'parallaxImg-container'; 14115 shadowHTML.className = 'parallaxImg-shadow'; 14116 layersHTML.className = 'parallaxImg-layers'; 14117 14118 for (var i = 0; i < totalLayerElems; i++) { 14119 14120 var layer = d.createElement('div'), 14121 layerInner = d.createElement('div'), 14122 imgSrc = layerElems[i].getAttribute('data-img'); 14123 14124 $(layer).html($(layerElems[i]).html()); 14125 layer.className = 'parallaxImg-rendered-layer'; 14126 layer.setAttribute('data-layer', i); 14127 14128 if (i == 0 && $(thisImg).parents('.wpb_gallery').length == 0) { 14129 layerInner.className = 'bg-img'; 14130 layerInner.style.backgroundImage = 'url(' + imgSrc + ')'; 14131 layer.appendChild(layerInner); 14132 } 14133 layersHTML.appendChild(layer); 14134 14135 layers.push(layer); 14136 } 14137 14138 containerHTML.appendChild(layersHTML); 14139 thisImg.appendChild(containerHTML); 14140 $(thisImg).wrap('<div class="parallaxImg-wrap" />'); 14141 if (!(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1)) { 14142 $(thisImg).parent().append(shadowHTML); 14143 } 14144 14145 if (supportsTouch && $('body.using-mobile-browser').length > 0) { 14146 // Stop processing. 14147 } else { 14148 (function (_thisImg, _layers, _totalLayers, _shine) { 14149 $(thisImg).parents('.style-5').on('mousemove', function (e) { 14150 14151 var parentEl = $(this); 14152 var now = Date.now(); 14153 if (now > lastMove + eventThrottle) { 14154 lastMove = now; 14155 window.requestAnimationFrame(function () { 14156 processMovement(e, false, _thisImg, _layers, _totalLayers, _shine, parentEl); 14157 }); 14158 } 14159 14160 14161 }); 14162 $(thisImg).parents('.style-5').on('mouseenter', function (e) { 14163 processEnter(e, _thisImg, _layers, _totalLayers, _shine); 14164 }); 14165 $(thisImg).parents('.style-5').on('mouseleave', function (e) { 14166 processExit(e, _thisImg, _layers, _totalLayers, _shine); 14167 }); 14168 })(thisImg, layers, totalLayerElems, shineHTML); 14169 } 14170 14171 // Set the depths 14172 (function (_thisImg, _layers, _totalLayers, _shine) { 14173 depths(false, _thisImg, _layers, _totalLayers, _shine); 14174 window.addEventListener('resize', function () { 14175 depths(false, _thisImg, _layers, _totalLayers, _shine); 14176 }); 14177 })(thisImg, layers, totalLayerElems, shineHTML); 14178 } 14179 14180 function processMovement(e, touchEnabled, elem, layers, totalLayers, shine, parentEl) { 14181 14182 // Stop raf if exit already called 14183 if (!$(elem.firstChild).hasClass('over')) { 14184 processExit(e, elem, layers, totalLayers, shine); 14185 return false 14186 } 14187 14188 // Set up multipliers 14189 var yMult = 0.03; 14190 var xMult = 0.063; 14191 14192 if ($(elem).parents('.col.wide').length > 0) { 14193 yMult = 0.03; 14194 xMult = 0.063; 14195 } else if ($(elem).parents('.col.regular').length > 0 || $(elem).parents('.wpb_gallery').length > 0) { 14196 yMult = 0.045; 14197 xMult = 0.045; 14198 } else if ($(elem).parents('.col.tall').length > 0) { 14199 yMult = 0.05; 14200 xMult = 0.015; 14201 } else if ($(elem).parents('.col.wide_tall').length > 0) { 14202 yMult = 0.04; 14203 xMult = 0.04; 14204 } else if (parentEl.hasClass('nectar-fancy-box')) { 14205 yMult = 0.045; 14206 xMult = 0.022; 14207 } else { 14208 yMult = 0.045; 14209 xMult = 0.075; 14210 } 14211 14212 var bdst = nectarDOMInfo.scrollTop, 14213 bdsl = bd.scrollLeft, 14214 pageX = (touchEnabled) ? e.touches[0].pageX : e.pageX, 14215 pageY = (touchEnabled) ? e.touches[0].pageY : e.pageY, 14216 offsets = elem.getBoundingClientRect(), 14217 w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth, 14218 h = elem.clientHeight || elem.offsetHeight || elem.scrollHeight, 14219 wMultiple = 320 / w, 14220 offsetX = 0.52 - (pageX - offsets.left - bdsl) / w, 14221 offsetY = 0.52 - (pageY - offsets.top - bdst) / h, 14222 dy = (pageY - offsets.top - bdst) - h / 2, 14223 dx = (pageX - offsets.left - bdsl) - w / 2, 14224 yRotate = (offsetX - dx) * (yMult * wMultiple), 14225 xRotate = (dy - offsetY) * (xMult * wMultiple); 14226 14227 var imgCSS; 14228 14229 if ($(elem).parents('.wpb_gallery').length > 0) { 14230 imgCSS = ' perspective(' + w * 3 + 'px) rotateX(' + -xRotate * 1.9 + 'deg) rotateY(' + -yRotate * 1.3 + 'deg)'; 14231 } else { 14232 14233 if ($(elem).parents('.wide_tall').length == 0 && 14234 $(elem).parents('.wide').length == 0 && 14235 $(elem).parents('.tall').length == 0) { 14236 var $scaleAmount = (parentEl.hasClass('nectar-fancy-box')) ? '1.06' : '1.03'; 14237 var $offsetAmount = (parentEl.hasClass('nectar-fancy-box')) ? '-2' : '-10'; 14238 imgCSS = ' perspective(' + w * 3 + 'px) rotateX(' + xRotate
14238+ 'deg) rotateY(' + yRotate + 'deg) translateY(' + offsetY * $offsetAmount + 'px) translateX(' + offsetX * $offsetAmount + 'px) scale(' + $scaleAmount + ')'; 14239 } else { 14240 imgCSS = ' perspective(' + w * 3 + 'px) rotateX(' + xRotate + 'deg) rotateY(' + yRotate + 'deg) translateY(' + offsetY * -10 + 'px) translateX(' + offsetX * -10 + 'px) scale(1.013)'; 14241 } 14242 14243 } 14244 14245 14246 // Container transform 14247 $(elem).find('.parallaxImg-container').css('transform', imgCSS); 14248 14249 if (!(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1)) { 14250 $(elem).parents('.parallaxImg-wrap').find('.parallaxImg-shadow').css('transform', imgCSS); 14251 } 14252 14253 14254 } 14255 14256 14257 function processEnter(e, elem) { 14258 14259 elem.firstChild.className += ' over'; 14260 elem.className += ' over'; 14261 14262 $(elem).addClass('transition'); 14263 14264 if ($(elem).parents('.wpb_gallery').length > 0) { 14265 setTimeout(function () { 14266 $(elem).removeClass('transition'); 14267 }, 450); 14268 } else { 14269 setTimeout(function () { 14270 $(elem).removeClass('transition'); 14271 }, 200); 14272 } 14273 14274 } 14275 14276 14277 function processExit(e, elem) { 14278 14279 var w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth; 14280 var container = elem.firstChild; 14281 14282 container.className = container.className.replace(' over', ''); 14283 elem.className = elem.className.replace(' over', ''); 14284 $(container).css('transform', 'perspective(' + w * 3 + 'px) rotateX(0deg) rotateY(0deg) translateZ(0)'); 14285 $(elem).parents('.parallaxImg-wrap').find('.parallaxImg-shadow').css('transform', 'perspective(' + w * 3 + 'px) rotateX(0deg) rotateY(0deg) translateZ(0)'); 14286 14287 $(elem).addClass('transition'); 14288 setTimeout(function () { 14289 $(elem).removeClass('transition'); 14290 }, 200); 14291 14292 } 14293 14294 14295 function depths(touchEnabled, elem, layers, totalLayers) { 14296 14297 var w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth; 14298 var container = elem.firstChild; 14299 14300 // Set z 14301 for (var ly = 0; ly < totalLayers; ly++) { 14302 if (ly == 0) { 14303 $(layers[ly]).css('transform', 'translateZ(0px)'); 14304 } 14305 else { 14306 $(layers[ly]).css('transform', 'translateZ(' + (w * 3) / 27 * (ly * 1.1) + 'px) '); 14307 } 14308 14309 } 14310 14311 totalLayers = totalLayers + 3; 14312 14313 // Set perspective from beginning 14314 $(container).css('transform', 'perspective(' + w * 3 + 'px)'); 14315 14316 } 14317 14318 } 14319 14320 14321 /** 14322 * Fancy Box 14323 * 14324 * @since 11.0 14325 */ 14326 function nectarFancyBoxHover() { 14327 14328 if( $('.nectar-fancy-box[data-style="hover_desc"]').length == 0 ) { 14329 return false; 14330 } 14331 14332 var $hoverContentHeight = 0; 14333 14334 $('body').on('mouseenter','.nectar-fancy-box[data-style="hover_desc"]', function() { 14335 $hoverContentHeight = parseInt($(this).find('.hover-content').outerHeight(true)); 14336 $(this).find('.heading-wrap').css('transform','translateY(-'+ $hoverContentHeight +'px)'); 14337 }); 14338 14339 $('body').on('mouseleave','.nectar-fancy-box[data-style="hover_desc"]', function() { 14340 $(this).find('.heading-wrap').css('transform','translateY(0)'); 14341 }); 14342 14343 } 14344 14345 14346 14347 /** 14348 * Mouse Follow Icon 14349 * 14350 * @since 11.0 14351 */ 14352 function NectarMouseFollowIcon(el,iconSelector) { 14353 14354 this.$el = el; 14355 this.$iconEl = this.$el.find(iconSelector); 14356 14357 this.elX = 0; 14358 this.elY = 0; 14359 14360 this.initialX = this.$el.width() / 2; 14361 this.initialY = this.$el.height() / 2; 14362 14363 this.elX = 0; 14364 this.elY = 0; 14365 14366 this.lastScroll = 0; 14367 this.scrollAdjust = 0; 14368 14369 this.lastX = this.initialX; 14370 this.lastY = this.initialY; 14371 this.activeFollow = false; 14372 14373 this.percentage = 0.13; 14374 this.percentageTimeout; 14375 14376 $window.on('resize', this.resizeEvent.bind(this)); 14377 this.mouseEvents(); 14378 this.rafLoop(); 14379 14380 } 14381 14382 NectarMouseFollowIcon.prototype.resizeEvent = function() { 14383 this.initialX = this.$el.width() / 2; 14384 this.initialY = this.$el.height() / 2; 14385 }; 14386 14387 NectarMouseFollowIcon.prototype.mouseEvents = function() { 14388 14389 var that = this; 14390 14391 that.$el.on('mouseenter', function(e) { 14392 14393 that.activeFollow = true; 14394 14395 that.elX = e.offsetX; 14396 that.elY = e.offsetY; 14397 14398 that.lastScroll = 0; 14399 14400 clearTimeout(that.percentageTimeout); 14401 that.percentageTimeout = setTimeout(function(){ 14402 that.percentage = 0.2; 14403 },700); 14404 }); 14405 14406 that.$el.on('mouseleave', function() { 14407 14408 that.activeFollow = false;
14409 that.lastScroll = 0; 14410 14411 clearTimeout(that.percentageTimeout); 14412 that.percentage = 0.13; 14413 }); 14414 14415 that.$el.on('mousemove', function(e){ 14416 that.elX = e.offsetX; 14417 that.elY = e.offsetY; 14418 that.lastScroll = 0; 14419 }); 14420 14421 $(window).on('scroll',function() { 14422 if( that.activeFollow == true && that.lastScroll == 0) { 14423 that.lastScroll = nectarDOMInfo.scrollTop; 14424 } 14425 }); 14426 14427 }; 14428 14429 14430 NectarMouseFollowIcon.prototype.rafLoop = function() { 14431 14432 if( this.activeFollow == true ) { 14433 14434 this.scrollAdjust = ( this.lastScroll > 0 ) ? nectarDOMInfo.scrollTop - this.lastScroll : 0; 14435 14436 this.lastY = linearInterpolate(this.lastY, this.elY + this.scrollAdjust, this.percentage); 14437 this.lastX = linearInterpolate(this.lastX, this.elX, this.percentage); 14438 } else { 14439 this.lastY = linearInterpolate(this.lastY, this.initialY, 0.13); 14440 this.lastX = linearInterpolate(this.lastX, this.initialX, 0.13); 14441 } 14442 14443 this.$iconEl.css({ 14444 'transform': 'translateX(' + this.lastX + 'px) translateY(' + this.lastY + 'px)' 14445 }); 14446 14447 requestAnimationFrame(this.rafLoop.bind(this)); 14448 14449 }; 14450 14451 14452 14453 14454 /** 14455 * Video Lightbox 14456 * 14457 * @since 11.0 14458 */ 14459 function nectarVideoLightbox() { 14460 14461 iconMouseFollowArr = []; 14462 14463 // Parent hover relationship. 14464 $body.on('mouseenter','.nectar_video_lightbox[data-parent-hover="1"]', function() { 14465 var $parentRow = $(this).parents('.wpb_row'); 14466 $parentRow.find('> .row-bg-wrap .row-bg, > .nectar-video-wrap .nectar-video-inner').addClass('transition'); 14467 $parentRow.find('> .row-bg-wrap .row-bg, > .nectar-video-wrap .nectar-video-inner').css({ 14468 'transform' : 'scale(1.08)' 14469 }); 14470 }); 14471 14472 $body.on('mouseleave','.nectar_video_lightbox[data-parent-hover="1"]', function() { 14473 var $parentRow = $(this).parents('.wpb_row'); 14474 $parentRow.find('> .row-bg-wrap .row-bg, > .nectar-video-wrap .nectar-video-inner').css({ 14475 'transform' : 'scale(1)' 14476 }); 14477 }); 14478 14479 // Mouse Indicator. 14480 $('.nectar-video-box').each(function(i){ 14481 14482 if( $(this).find('.play_button_mouse_follow') ) { 14483 14484 var $that = $(this); 14485 14486 $(this).imagesLoaded(function () { 14487 14488 // Follow mouse. 14489 if( !nectarDOMInfo.usingMobileBrowser ) { 14490 iconMouseFollowArr[i] = new NectarMouseFollowIcon($that, '.play_button_mouse_follow'); 14491 } 14492 14493 // Initial setup. 14494 var $playColor = ( $that.is('[data-mouse-icon-color]') && $that.attr('data-mouse-icon-color').length > 0 ) ? $that.attr('data-mouse-icon-color') : '#000'; 14495 14496 if( $that.is('[data-mouse-style="solid_color"]') ) { 14497 14498 $that.find('.play_button_mouse_follow').css({ 14499 'background-color': $playColor 14500 }); 14501 } 14502 14503 $that.find('.play_button_mouse_follow').addClass('visible'); 14504 14505 }); 14506 14507 } 14508 14509 }); 14510 14511 } 14512 14513 14514 14515 /** 14516 * Salient slider rotation 14517 * 14518 * @since 10.5 14519 */ 14520 function nectarCustomSliderRotate(slider) { 14521 14522 if ($('body.vc_editor').length > 0) { 14523 return; 14524 } 14525 14526 var $controlSelector = (slider.find('.project-slides').length > 0) ? '.dot-nav > span' : '.controls > li', 14527 $controlSelectorInd = (slider.find('.project-slides').length > 0) ? 'span' : ' li', 14528 $slideLength = slider.find($controlSelector).length, 14529 $currentSlide = slider.find($controlSelector + '.active').index(); 14530 14531 if ($currentSlide + 1 == $slideLength) { 14532 slider.find($controlSelector + ':first-child').trigger('click'); 14533 } else { 14534 slider.find($controlSelector + '.active').next($controlSelectorInd).trigger('click'); 14535 } 14536 } 14537 14538 14539 /** 14540 * Salient slider rotation reset 14541 * 14542 * @since 10.5 14543 */ 14544 function nectarCustomSliderResetRotate(slider, index) { 14545 clearInterval($nectarCustomSliderRotate[index].autorotate); 14546 14547 // Reinit autorotate 14548 if (slider.attr('data-autorotate').length > 0) { 14549 var slide_interval = (parseInt(slider.attr('data-autorotate')) < 100) ? 4000 : parseInt(slider.attr('data-autorotate')); 14550 $nectarCustomSliderRotate[index].autorotate = setInterval(function () { 14551 nectarCustomSliderRotate(slider) 14552 }, slide_interval); 14553 } 14554 } 14555 14556 14557 14558 /** 14559 * Fullscreen recent project slider 14560 * 14561 * @since 10.5 14562 */ 14563 function fsProjectSliderInit() { 14564 14565 $fsProjectSliderArr = []; 14566 14567 if (typeof SalientRecentProjectsFullScreen === 'undefined') { 14568 return; 14569 } 14570 14571 $('.nectar_fullscreen_zoom_recent_projects').each(function (i) { 14572 $fsProjectSliderArr[i] = new SalientRecentProjectsFullScreen($(this)); 14573 }); 14574 14575 } 14576 14577 14578 14579 14580 14581 /**
14582 * Portfolio single template sticky sidebar 14583 * 14584 * @since 6.0 14585 */ 14586 function portfolioSidebarFollow() { 14587 14588 var sidebarFollow = $('.single-portfolio #sidebar').attr('data-follow-on-scroll'); 14589 14590 if ($('body.single-portfolio').length == 0 || $('#sidebar[data-follow-on-scroll]').length == 0) { 14591 return; 14592 } 14593 14594 sidebarFollow = $('.single-portfolio #sidebar').attr('data-follow-on-scroll'); 14595 14596 if (sidebarFollow == 1 && 14597 !$body.hasClass('mobile') && 14598 parseInt($('#sidebar').height()) + 50 <= parseInt($('.post-area').height())) { 14599 14600 //padding from top of screen 14601 var $ssExtraTopSpace = 50; 14602 14603 if ($('#header-outer[data-remove-fixed="0"]').length > 0 && 14604 $('body[data-hhun="1"]').length == 0) { 14605 14606 $ssExtraTopSpace += $headerOuterEl.outerHeight(); 14607 14608 // Resize effect 14609 if ($('#header-outer[data-shrink-num][data-header-resize="1"]').length > 0) { 14610 var headerPadding2 = parseInt($headerOuterEl.attr('data-padding')) - parseInt($headerOuterEl.attr('data-padding')) / 1.8; 14611 $ssExtraTopSpace -= logoShrinkNum; 14612 $ssExtraTopSpace -= headerPadding2; 14613 } 14614 14615 // Condense 14616 if ($('body.mobile').length == 0 && $('#header-outer[data-condense="true"]').length > 0) { 14617 14618 var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'); 14619 14620 $ssExtraTopSpace = 50; 14621 $ssExtraTopSpace += $headerOuterEl.height() - (parseInt($headerSpan9.position().top) - parseInt($('#header-outer #logo').css('margin-top'))) - parseInt(nectarDOMInfo.secondaryHeaderHeight); 14622 } 14623 14624 } 14625 14626 if ($wpAdminBar.length > 0) { 14627 $ssExtraTopSpace += $wpAdminBar.outerHeight(); 14628 } 14629 14630 14631 $('.single-portfolio #sidebar').theiaStickySidebar({ 14632 additionalMarginTop: $ssExtraTopSpace, 14633 updateSidebarHeight: false 14634 }); 14635 14636 14637 } 14638 14639 } 14640 14641 14642 14643 14644 14645 /** 14646 * Infinite scroll pagination 14647 * 14648 * @since 6.0 14649 */ 14650 function infiniteScrollInit() { 14651 14652 if ($('.infinite_scroll').length > 0) { 14653 14654 // Portfolio 14655 $('.portfolio-items.infinite_scroll').infinitescroll({ 14656 navSelector: "div#pagination", 14657 nextSelector: "div#pagination a:first", 14658 itemSelector: ".portfolio-items.infinite_scroll .element", 14659 finishedMsg: "<em>Congratulations, you've reached the end of the internet.</em>", 14660 msgText: " ", 14661 }, function (newElements) { 14662 14663 14664 var $container = $('.portfolio-items.infinite_scroll:not(.carousel)'), 14665 $newElems = $(newElements).css('opacity', 0); 14666 14667 // Ensure that images load before adding to masonry layout 14668 $newElems.imagesLoaded(function () { 14669 14670 $(newElements).css('opacity', 1); 14671 14672 $container.isotope('appended', $(newElements)); 14673 14674 $(newElements).find('.work-item').addClass('ajax-loaded'); 14675 $(newElements).addClass('ajax-loaded'); 14676
14677 // Show elems now they're ready 14678 $(newElements).find('.work-meta, .nectar-love-wrap').css({ 14679 'opacity': 1 14680 }); 14681 14682 // Keep current filtering 14683 if ($('.portfolio-filters-inline').length > 0 || $('.portfolio-filters').length > 0) { 14684 14685 var selector; 14686 14687 if ($('.portfolio-filters-inline').length > 0) { 14688 selector = $('.portfolio-filters-inline a.active').attr('data-filter'); 14689 } else { 14690 selector = $('.portfolio-filters a.active').attr('data-filter'); 14691 } 14692 14693 $('.portfolio-filters-inline a.active').attr('data-filter'); 14694 $container.isotope({ 14695 filter: selector 14696 }); 14697 } 14698 14699 // Set width 14700 for (var i = 0; i < $portfolio_containers.length; i++) { 14701 $portfolio_containers[i].reLayout(); 14702 } 14703 14704 if ($(newElements).find('.work-item.style-5').length > 0) { 14705 parallaxItemHoverEffect(); 14706 } 14707 14708 if ($(newElements).find('.inner-wrap').attr('data-animation') == 'none') { 14709 $('.portfolio-items .col .inner-wrap').removeClass('animated'); 14710 } else { 14711 14712 for (var i = 0; i < $portfolio_containers.length; i++) { 14713 $portfolio_containers[i].masonryZindex(); 14714 $portfolio_containers[i].portfolioAccentColor(); 14715 } 14716 14717 $(newElements).each(function () { 14718 14719 var $portfolioOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '90%'; 14720 14721 // Not already visible 14722 var $that = $(this); 14723 var waypoint = new Waypoint({ 14724 element: $that, 14725 handler: function () { 14726 14727 var $portfolioAnimationDelay = ($that.is('[data-masonry-type="photography"].masonry-items')) ? 85 : 115; 14728 14729 setTimeout(function () { 14730 $that.addClass("animated-in"); 14731 }, $portfolioAnimationDelay * $that.attr('data-delay-amount')); 14732 14733 14734 waypoint.destroy(); 14735 }, 14736 offset: $portfolioOffsetPos 14737 14738 }); 14739 14740 14741 }); 14742 } 14743 14744 14745 // Lightbox reinit. 14746 $('.portfolio-items').each(function () { 14747 var $unique_id = uniqueIdGenerate(); 14748 $(this).find('a[rel^="prettyPhoto"], a.pretty_photo').attr('rel', 'prettyPhoto[' + $unique_id + '_gal]').removeClass('pretty_photo'); 14749 }); 14750 14751 14752 $('.portfolio-items').each(function () { 14753 var $unique_id = uniqueIdGenerate(); 14754 $(this).find('a[data-fancybox^="group_"]').attr('data-fancybox', 'group_' + $unique_id); 14755 }); 14756 14757 lightBoxInit(); 14758 14759 setTimeout(function () { 14760 14761 for (var i = 0; i < $portfolio_containers.length; i++) { 14762 $portfolio_containers[i].masonryZindex(); 14763 $portfolio_containers[i].reLayout(); 14764 $portfolio_containers[i].isotopeCatSelection(); 14765 } 14766 $(newElements).removeClass('ajax-loaded'); 14767 }, 700); 14768 14769 parallaxRowsBGCals(); 14770 14771 }); 14772 14773 14774 }); 14775 14776 // Blog 14777 $('.post-area.infinite_scroll .posts-container').infinitescroll({ 14778 navSelector: "div#pagination", 14779 nextSelector: "div#pagination a:first", 14780 itemSelector: ".post-area .posts-container .post", 14781 finishedMsg: "<em>Congratulations, you've reached the end of the internet.</em>", 14782 msgText: " " 14783 }, function (newElements) { 14784 14785 // Only trigger recalc of waypoints and elements if needed 14786 if ($('.masonry.classic').length > 0 || $('.post-area:not(.masonry):not(.featured_img_left)').length > 0 || $('.post-area.standard-minimal').length > 0) { 14787 14788 // Gallery 14789 flexsliderInit(); 14790 14791 14792 // Media players 14793 if ($().mediaelementplayer) { 14794 $(newElements).find('.wp-audio-shortcode, .wp-video-shortcode').mediaelementplayer(); 14795 } 14796 14797 14798 // Lightbox 14799 lightBoxInit(); 14800 14801 // Carousels 14802 if ($('.carousel').length > 0) { 14803 standardCarouselInit(); 14804 clientsCarouselInit(); 14805 } 14806 14807 // Waypoints 14808 waypoints(); 14809 14810 // Testimonial slider 14811 $('.testimonial_slider').animate({ 14812 'opacity': '1' 14813 }, 800); 14814 nectarTestimonialSliders(); 14815 nectarTestimonialSlidersEvents(); 14816 14817 setTimeout(function () { 14818 responsiveVideoIframesInit(); 14819 responsiveVideoIframes(); 14820 $window.trigger('resize'); 14821 }, 500); 14822 14823
14824 parallaxRowsBGCals(); 14825 14826 $window.trigger('resize'); 14827 14828 } // Non meta overlaid style 14829 else { 14830 parallaxRowsBGCals(); 14831 14832 $window.trigger('resize'); 14833 } 14834 14835 // Trigger Masonry as a callback 14836 var $container = $('.posts-container'); 14837 if ($container.parent().hasClass('masonry')) { 14838 14839 $(newElements).addClass('masonry-blog-item'); 14840 14841 14842 } //if masonry 14843 14844 14845 // Loading effect 14846 14847 //// hide new items while they are loading 14848 var $newElems = $(newElements); 14849 //// ensure that images load before adding to masonry layout 14850 14851 if ($newElems.find('img').length == 0) { 14852 $newElems = $('body'); 14853 } 14854 14855 $newElems.imagesLoaded(function () { 14856 14857 if ($container.parent().hasClass('masonry') && 14858 !$container.parent().hasClass('auto_meta_overlaid_spaced')) { 14859 $container.isotope('appended', $(newElements)); 14860 } 14861 14862 for (var i = 0; i < $nectarMasonryBlogs.length; i++) { 14863 $nectarMasonryBlogs[i].flickityBlogInit(); 14864 } 14865 14866 $(newElements).addClass('ajax-loaded');
14867 // Show elems now they're ready 14868 14869 14870 // Classic enhanced specific 14871 if ($container.parent().hasClass('classic_enhanced')) { 14872 $container.find('.large_featured.has-post-thumbnail.ajax-loaded .post-featured-img, .wide_tall.has-post-thumbnail.ajax-loaded .post-featured-img').each(function () { 14873 var $src = $(this).find('img').attr('src'); 14874 $(this).css('background-image', 'url(' + $src + ')'); 14875 }); 14876 14877 $container.find('.large_featured.ajax-loaded .nectar-flickity, .wide_tall.ajax-loaded .nectar-flickity').each(function () { 14878 14879 $(this).find('.cell').each(function () { 14880 var $src = $(this).find('img').attr('src'); 14881 $(this).css('background-image', 'url(' + $src + ')'); 14882 }); 14883 14884 }); 14885 } 14886 14887 14888 if ($(newElements).parents('.posts-container').attr('data-animation') == 'none') { 14889 $(newElements).find('.inner-wrap').removeClass('animated'); 14890 } else { 14891 14892 for (var i = 0; i < $nectarMasonryBlogs.length; i++) { 14893 $nectarMasonryBlogs[i].blogMasonryZindex(); 14894 } 14895 14896 $(newElements).each(function () { 14897 14898 var $that = $(this); 14899 var waypoint = new Waypoint({ 14900 14901 element: $that, 14902 handler: function () { 14903 14904 setTimeout(function () { 14905 $that.addClass("animated-in"); 14906 }, 80 * $that.attr('data-delay-amount')); 14907 14908 waypoint.destroy(); 14909 }, 14910 offset: '90%' 14911 14912 }); 14913 14914 14915 }); 14916 } 14917 14918 setTimeout(function () { 14919 $(newElements).removeClass('ajax-loaded'); 14920 }, 700); 14921 14922 14923 }); 14924 14925 14926 }); 14927 14928 } 14929 14930 } 14931 14932 14933 14934 14935 14936 14937 /** 14938 * Scroll to top scroll bind. 14939 * 14940 * @since 2.0 14941 */ 14942 function toTopBind() { 14943 14944 if ($('#to-top').length > 0 && $window.width() > 1020 || 14945 $('#to-top').length > 0 && $('#to-top.mobile-enabled').length > 0) { 14946 14947 if (nectarDOMInfo.scrollTop > 350) { 14948 $window.on('scroll', hideToTop); 14949 } else { 14950 $window.on('scroll', showToTop); 14951 } 14952 } 14953 14954 } 14955 14956 /** 14957 * Scroll to top show. 14958 * 14959 * @since 2.0 14960 */ 14961 function showToTop() { 14962 14963 if (nectarDOMInfo.scrollTop > 350 && !$offCanvasEl.is('.fullscreen.open') ) { 14964 14965 $('#to-top').stop().transition({ 14966 'bottom': '17px' 14967 }, 350, 'easeInOutCubic'); 14968 14969 $window.off('scroll', showToTop); 14970 $window.on('scroll', hideToTop); 14971 } 14972 14973 } 14974 14975 14976 /** 14977 * Scroll to top hide. 14978 * 14979 * @since 2.0 14980 */ 14981 function hideToTop() { 14982 14983 if (nectarDOMInfo.scrollTop < 350 || $offCanvasEl.is('.fullscreen.open') ) { 14984 14985 var $animationTiming = ($('#slide-out-widget-area.fullscreen.open').length > 0) ? 1150 : 350; 14986 14987 $('#to-top').stop().transition({ 14988 'bottom': '-30px' 14989 }, $animationTiming, 'easeInOutQuint'); 14990 14991 $window.off('scroll', hideToTop); 14992 $window.on('scroll', showToTop); 14993 14994 } 14995 } 14996 14997 14998 /** 14999 * Scroll to top initialization. 15000 * 15001 * @since 10.5 15002 */ 15003 function scrollToTopInit() { 15004 15005 // Show/hide based on scroll pos 15006 if ($('.nectar-social.fixed').length == 0) { 15007 toTopBind(); 15008 } 15009 15010 15011 // Rounded style 15012 if ($('body[data-button-style*="rounded"]').length > 0) { 15013 var $clone = $('#to-top .fa-angle-up').clone(); 15014 $clone.addClass('top-icon'); 15015 $('#to-top').prepend($clone); 15016 } 15017 15018 // Scroll up click event 15019 $body.on('click', '#to-top, a[href="#top"]', function () { 15020 $('body,html').stop().animate({ 15021 scrollTop: 0 15022 }, 800, 'easeOutQuad', function () { 15023 if ($('.nectar-box-roll').length > 0) { 15024 $body.trigger('mousewheel', [1, 0, 0]); 15025 } 15026 }); 15027 return false; 15028 }); 15029 15030 } 15031 15032 15033 15034 15035 15036 15037 15038 15039 15040 /** 15041 * Scrollspy plugin initialization. 15042 * 15043 * @since 5.0 15044 */ 15045 function scrollSpyInit() { 15046 15047 var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $window.width() > 1000) ? 0 : $headerOuterEl.outerHeight(); 15048 15049 if ($('.page-template-template-no-header-footer').length > 0 || $('.page-template-template-no-header').length > 0) { 15050 $headerNavSpace = 0; 15051 } 15052 15053 //prevent jump to rop on empty items 15054 $('header#top .sf-menu li a[href="#"]').on('click', function (e) { 15055 e.preventDefault(); 15056 }); 15057 15058 if ($('#nectar_fullscreen_rows').length == 0 || $nectarFullPage.$usingFullScreenRows == false) { 15059 15060 $('a.nectar-next-section').each(function () { 15061 15062 if ($(this).parents('.wpb_row:not(.inner_row)').length > 0) { 15063 15064 var $parentRow = $(this).parents('.wpb_row:not(.inner_row)'), 15065 $parentRowIndex = $(this).parents('.wpb_row:not(.inner_row)').index(); 15066 15067 if ($parentRow.parent().find('> .wpb_row[id]:eq(' + ($parentRowIndex + 1) + ')').length > 0) { 15068 var $nextRowID = $parentRow.parent().find('> .wpb_row:eq(' + ($parentRowIndex + 1) + ')').attr('id'); 15069 $(this).attr('href', '#' + $nextRowID); 15070 } 15071 15072 } 15073 15074 }); 15075 } 15076 15077 else if ($().fullpage) { 15078 $('a.nectar-next-section').on('click', function () { 15079 $.fn.fullpage.moveSectionDown(); 15080 return false;
15081 }); 15082 } 15083 15084 15085 // Links in off canvas menu. 15086 if ($('#slide-out-widget-area .off-canvas-menu-container').length > 0) { 15087 $('#slide-out-widget-area .off-canvas-menu-container').find("a[href*='" + location.pathname + "']").each(function () { 15088 15089 var $href = $(this).attr('href'); 15090 15091 // Regular animated anchors. 15092 if ($href != '#' && $href.indexOf("#") != -1 && $('div' + $href.substr($href.indexOf("#"))).length > 0) { 15093 $(this).attr('href', $href.substr($href.indexOf("#"))); 15094 15095 $(this).parent() 15096 .removeClass('current_page_item') 15097 .removeClass('current-menu-item'); 15098 } 15099 15100 // Fullpage is a little different. 15101 if ($('div[data-fullscreen-anchor-id="' + $href.substr($href.indexOf("#") + 1) + '"]').length > 0) { 15102 15103 $(this).parent() 15104 .removeClass('current_page_item') 15105 .removeClass('current-menu-item'); 15106 } 15107 15108 }); 15109 } 15110 15111 // Links in header navigation. 15112 $("#header-outer").find("a[href*='" + location.pathname + "']").each(function () { 15113 15114 var $href = $(this).attr('href'); 15115 15116 // Regular animated anchors 15117 if ($href.indexOf("#") != -1 && $('div' + $href.substr($href.indexOf("#"))).length > 0) { 15118 15119 $(this).attr('href', $href.substr($href.indexOf("#"))); 15120 $(this).parent() 15121 .removeClass('current_page_item') 15122 .removeClass('current-menu-item'); 15123 } 15124 15125 // Fullpage is a little different 15126 if ($('div[data-fullscreen-anchor-id="' + $href.substr($href.indexOf("#") + 1) + '"]').length > 0) { 15127 15128 $(this).parent() 15129 .removeClass('current_page_item') 15130 .removeClass('current-menu-item'); 15131 } 15132 15133 }); 15134 15135 // Start scrollspy. 15136 var $target = ($('.page-submenu[data-sticky="true"]').length == 0) ? '#header-outer nav' : '.page-submenu'; 15137 $body.scrollspy({ 15138 target: $target, 15139 offset: $headerNavSpace + nectarDOMInfo.adminBarHeight + 40 15140 }); 15141 15142 } 15143 15144 15145 15146 15147 /** 15148 * Called to scroll to hash link on page load 15149 * 15150 * @since 5.0 15151 */ 15152 function pageLoadHash() { 15153 15154 var $hash = window.location.hash; 15155 15156 if( $hash && $hash.length > 0 ) { 15157 $hash = $hash.replace(/<|>/g,''); 15158 } 15159 15160 var $hashSubstrng = ($hash && $hash.length > 0) ? $hash.substring(1, $hash.length) : 0, 15161 headerPadding2 = parseInt($headerOuterEl.attr('data-padding')) * 2, 15162 $hasSlashLength = 0; 15163 15164 // If the hash has slashes 15165 if ($hashSubstrng) { 15166 $hasSlashLength = $hashSubstrng.split("/"); 15167 $hasSlashLength = $hasSlashLength.length; 15168 } 15169 15170 if ($hashSubstrng && $hasSlashLength > 1) { 15171 $hashSubstrng = $hashSubstrng.replace(/\//g, ""); 15172 $hash = $hash.replace(/\//g, ""); 15173 } 15174 15175 if ($hash && $('.main-content').find($hash).length > 0 || 15176 $hash && $('.main-content').find('[data-fullscreen-anchor-id="' + $hashSubstrng + '"]').length > 0) { 15177 15178 var $hashObj = ($('.main-content').find($hash).length > 0) ? $('.main-content').find($hash) : $('.main-content').find('[data-fullscreen-anchor-id="' + $hashSubstrng + '"]'), 15179 $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $window.width() > 1000) ? 0 : $('#header-space').outerHeight(); 15180 15181 if ($('.page-template-template-no-header-footer').length > 0 || $('.page-template-template-no-header').length > 0) { 15182 $headerNavSpace = 0; 15183 } 15184 15185 var $timeoutVar = 0; 15186 15187 if ($('.nectar-box-roll').length > 0 && $('.container-wrap.bottomBoxOut').length > 0) { 15188 nectarBoxRoll.boxRoll(null, -1); 15189 $timeoutVar = 2050; 15190 } 15191 15192 setTimeout(function () { 15193 15194 var $scrollTopDistance; 15195 15196 if ($('body[data-permanent-transparent="1"]').length == 0) { 15197 15198 if (!$body.hasClass('mobile')) { 15199 var $resize = ($('#header-outer[data-header-resize="0"]').length > 0) ? 0 : parseInt(logoShrinkNum) + headerPadding2 * 2; 15200 if ($('#header-outer[data-remove-fixed="1"]').length > 0) { 15201 $headerNavSpace = 0; 15202 } 15203 $scrollTopDistance = $hashObj.offset().top - parseInt($headerNavSpace) + $resize + 3 - nectarDOMInfo.adminBarHeight; 15204 15205 15206 // Condense 15207 if ($('body.mobile').length == 0 && $('#header-outer[data-condense="true"]').length > 0) { 15208 15209 var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'), 15210 $headerHeightStored = $headerOuterEl.height(),
15211 $headerHeightCondensed = $headerHeightStored - (parseInt($headerSpan9.height()) + parseInt($('#header-outer #logo').css('margin-top'))); 15212 15213 $scrollTopDistance = $hashObj.offset().top - parseInt($headerNavSpace) + $headerHeightCondensed - nectarDOMInfo.adminBarHeight; 15214 } 15215 15216 } else { 15217 $scrollTopDistance = ($('#header-outer[data-mobile-fixed="1"]').length > 0) ? $hashObj.offset().top + 2 - $headerNavSpace + nectarDOMInfo.adminBarHeight : $hashObj.offset().top - nectarDOMInfo.adminBarHeight + 1; 15218 } 15219 15220 } else { 15221 $scrollTopDistance = $hashObj.offset().top - nectarDOMInfo.adminBarHeight + 1; 15222 } 15223 15224 if ($('body[data-hhun="1"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length == 0) { 15225 15226 // Alter offset 15227 if ($('#header-outer.detached').length == 0) { 15228 $scrollTopDistance = $scrollTopDistance + $headerNavSpace; 15229 } 15230 } 15231 15232 var $pageSubMenu = ($('.page-submenu[data-sticky="true"]').length > 0) ? $('.page-submenu').height() : 0; 15233 var $headerSecondary; 15234 15235 if ($('body.material').length > 0 && 15236 $headerSecondaryEl.length > 0 && 15237 $('body[data-hhun="1"]').length == 0 && 15238 $('#header-outer[data-remove-fixed="1"]').length == 0 && 15239 !$body.hasClass('mobile')) { 15240 15241 $headerSecondary = $headerSecondaryEl.height(); 15242 15243 } else { 15244 $headerSecondary = 0; 15245 } 15246 15247 nectar_scrollToY($scrollTopDistance - $pageSubMenu + $headerSecondary, 700, 'easeInOutQuint'); 15248 15249 }, $timeoutVar); 15250 } 15251 } 15252 15253 15254 /** 15255 * Initialize page load hash functionality 15256 * 15257 * @since 10.5 15258 */ 15259 function pageLoadHashInit() { 15260 15261 if ($('body[data-animated-anchors="true"]').length > 0) { 15262 if ($('.nectar-box-roll').length == 0 && $('#nectar_fullscreen_rows').length == 0) { 15263 15264 // Inside tabs 15265 if (typeof nectarGetQueryParam['tab'] != 'undefined') { 15266 setTimeout(function () { 15267 pageLoadHash(); 15268 }, 800); 15269 } 15270 // Regular 15271 else { 15272 pageLoadHash(); 15273 } 15274 15275 } 15276 15277 if ($('#nectar_fullscreen_rows[data-mobile-disable="on"]').length > 0 && $('.nectar-box-roll').length == 0 && 15278 nectarDOMInfo.usingMobileBrowser) { 15279 pageLoadHash(); 15280 } 15281 15282 } 15283 15284 } 15285 15286 15287 /** 15288 * Animated anchor link theme option. 15289 * 15290 * @since 10.5 15291 */ 15292 function animatedAnchorLinks() { 15293 15294 if ($('body[data-animated-anchors="true"]').length > 0 || 15295 $('.single-product [data-gallery-style="left_thumb_sticky"]').length > 0) { 15296 15297 var headerPadding2 = headerPadding - headerPadding / 1.8; 15298 15299 setTimeout(scrollSpyInit, 200); 15300 15301 var $animatedScrollingTimeout; 15302 15303 $body.on('click', '#header-outer nav .sf-menu a, #footer-outer .nectar-button, #mobile-menu li a, .container-wrap a:not(.wpb_tabs_nav 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), .swiper-slide .button a, #slide-out-widget-area a, #slide-out-widget-area .inner div a', function (e) { 15304 15305 var $hash = $(this).prop("hash"); 15306 15307 if( !$(this).hasClass('nectar-next-section') ) { 15308 $body.addClass('animated-scrolling'); 15309 } 15310 15311 clearTimeout($animatedScrollingTimeout); 15312 15313 $animatedScrollingTimeout = setTimeout(function () { 15314 $body.removeClass('animated-scrolling'); 15315 }, 850); 15316 15317 var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $window.width() > 1000) ? 0 : $('#header-space').outerHeight(); 15318 15319 if ($('.page-template-template-no-header-footer').length > 0 || $('.page-template-template-no-header').length > 0) { 15320 $headerNavSpace = 0; 15321 } 15322 15323 if ($hash && $body.find($hash).length > 0 && $hash != '#top' && $hash != '' && $(this).attr('href').indexOf(window.location.href.split("#")[0]) !== -1 || 15324 $(this).is('[href^="#"]') && $hash != '' && $body.find($hash).length > 0 && $hash != '#top') { 15325 15326 //update hash 15327 if (!$(this).hasClass('skip-hash')) { 15328 if (history.pushState) { 15329 history.pushState(null, null, $hash); 15330 } else { 15331 location.hash = $hash; 15332 } 15333 } 15334 15335 if ($(this).parents('ul').length > 0) { 15336 15337 $(this) 15338 .parents('ul') 15339 .find('li') 15340 .removeClass('current-menu-item'); 15341 } 15342 15343 // Side widget area click 15344 if ($(this).parents('#slide-out-widget-area').length > 0) { 15345
15346 if ($('body.material[data-slide-out-widget-area-style="slide-out-from-right"].material-ocm-open').length > 0) { 15347 15348 $('body > .slide_out_area_close') 15349 .addClass('non-human-allowed') 15350 .trigger('click'); 15351 15352 // Sroll 15353 var $clickedLinkStore = $(this); 15354 15355 setTimeout(function () { 15356 $clickedLinkStore.trigger('click'); 15357 }, 1000); 15358 15359 } else { 15360 $('#slide-out-widget-area .slide_out_area_close') 15361 .addClass('non-human-allowed') 15362 .trigger('click'); 15363 } 15364 15365 setTimeout(function () { 15366 if ($('body.material[data-slide-out-widget-area-style="slide-out-from-right"]').length > 0) { 15367 $('body > .slide_out_area_close').removeClass('non-human-allowed'); 15368 15369 } else { 15370 $('#slide-out-widget-area .slide_out_area_close').removeClass('non-human-allowed'); 15371 } 15372 }, 100); 15373 } 15374 15375 // Mobile menu click 15376 if ( $(this).parents('#mobile-menu').length > 0 ) { 15377 $('.slide-out-widget-area-toggle.mobile-icon a') 15378 .addClass('non-human-allowed') 15379 .trigger('click'); 15380 15381 setTimeout(function () { 15382 $('.slide-out-widget-area-toggle.mobile-icon a').removeClass('non-human-allowed'); 15383 }, 100); 15384 } 15385 15386 var $mobileMenuHeight = ($(this).parents('#mobile-menu').length > 0) ? $(this).parents('#mobile-menu').height() : null; 15387 var $timeoutVar = 1; 15388 var $that = $(this); 15389 15390 if ($('.nectar-box-roll').length > 0 && $('.container-wrap.bottomBoxOut').length > 0) { 15391 nectarBoxRoll.boxRoll(null, -1); 15392 $timeoutVar = 2050; 15393 } 15394 15395 15396 setTimeout(function () { 15397 15398 var $scrollTopDistance; 15399 15400 // Scrolling 15401 if ($('body[data-permanent-transparent="1"]').length == 0) { 15402 15403 if (!$body.hasClass('mobile')) { 15404 var $resize = ($('#header-outer[data-header-resize="0"]').length > 0) ? 0 : parseInt(logoShrinkNum) + headerPadding2 * 2; 15405 if ($('#header-outer[data-remove-fixed="1"]').length > 0) { 15406 $headerNavSpace = 0; 15407 } 15408 15409 $scrollTopDistance = $($hash).offset().top - $mobileMenuHeight - parseInt($headerNavSpace) + $resize + 3 - nectarDOMInfo.adminBarHeight; 15410 15411 // Condense 15412 if ($('body.mobile').length == 0 && $('#header-outer[data-condense="true"]').length > 0) { 15413 15414 var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'), 15415 $headerHeightStored = $headerOuterEl.height(),
15416 $headerHeightCondensed = $headerHeightStored - (parseInt($headerSpan9.height()) + parseInt($('#header-outer #logo').css('margin-top'))); 15417 $scrollTopDistance = $($hash).offset().top - parseInt($headerNavSpace) + $headerHeightCondensed - nectarDOMInfo.adminBarHeight; 15418 15419 } 15420 15421 15422 } else { 15423 $scrollTopDistance = ($('#header-outer[data-mobile-fixed="1"]').length > 0) ? $($hash).offset().top + 2 - $headerNavSpace + nectarDOMInfo.adminBarHeight : $($hash).offset().top - $mobileMenuHeight - nectarDOMInfo.adminBarHeight + 1; 15424 } 15425 15426 } else { 15427 $scrollTopDistance = $($hash).offset().top - nectarDOMInfo.adminBarHeight + 1; 15428 } 15429 15430 if ($('body[data-hhun="1"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length == 0) { 15431 15432 // Alter offset 15433 if ($('#header-outer.detached').length == 0 || $that.parents('.page-submenu[data-sticky="true"]').length > 0) { 15434 $scrollTopDistance = $scrollTopDistance + $headerNavSpace; 15435 } 15436 15437 // Hide top header 15438 if ($that.parents('.page-submenu[data-sticky="true"]').length > 0) { 15439 15440 $('#header-outer.detached').addClass('invisible'); 15441 $('.page-submenu') 15442 .addClass('header-not-visible') 15443 .css('transform', 'translateY(0px)'); 15444 15445 } 15446 } 15447 15448 var $pageSubMenu = ($that.parents('.page-submenu[data-sticky="true"]').length > 0) ? $that.parents('.page-submenu').height() : 0; 15449 var $headerSecondary; 15450 15451 if ($('body.material').length > 0 && 15452 $headerSecondaryEl.length > 0 && 15453 $('body[data-hhun="1"]').length == 0 && 15454 $('#header-outer[data-remove-fixed="1"]').length == 0 && 15455 !$body.hasClass('mobile')) { 15456 15457 $headerSecondary = $headerSecondaryEl.height(); 15458 15459 } else { 15460 15461 if($('body[data-hhun="1"]').length > 0 && 15462 $headerSecondaryEl.length > 0 && 15463 !$body.hasClass('mobile') && 15464 $('#header-outer[data-remove-fixed="1"]').length == 0) { 15465 $headerSecondary = $headerSecondaryEl.height(); 15466 } else { 15467 $headerSecondary = 0; 15468 } 15469 15470 } 15471 15472 15473 nectar_scrollToY($scrollTopDistance - $pageSubMenu + $headerSecondary, 700, 'easeInOutQuint'); 15474 15475 }, $timeoutVar); 15476 15477 e.preventDefault(); 15478 15479 } 15480 15481 if ($hash == '#top') { 15482 // Side widget area click 15483 if ($(this).parents('#slide-out-widget-area').length > 0) { 15484 $('#slide-out-widget-area .slide_out_area_close').trigger('click'); 15485 } 15486 } 15487 15488 }); 15489 15490 15491 } 15492 15493 } 15494 15495 15496 15497 15498 15499 15500 /** 15501 * Search results masonry layout. 15502 * 15503 * @since 10.0 15504 */ 15505 function searchResultMasonry() { 15506 15507 var $searchContainer = $('#search-results'), 15508 $dividerNum = ($searchContainer.is('[data-layout="masonry-no-sidebar"]')) ? 4 : 3; 15509 15510 $searchContainer.imagesLoaded(function () { 15511 15512 $searchContainer.isotope({ 15513 itemSelector: '.result', 15514 layoutMode: 'packery', 15515 packery: { 15516 columnWidth: $('#search-results').width() / $dividerNum 15517 } 15518 }); 15519 15520 $searchContainer 15521 .find('article') 15522 .css('opacity', '1'); 15523 15524 }); 15525 15526 $window.on('resize', function () { 15527 $searchContainer.isotope({ 15528 layoutMode: 'packery', 15529 packery: { 15530 columnWidth: $('#search-results').width() / $dividerNum 15531 } 15532 }); 15533 }); 15534 15535 } 15536 15537 15538 /** 15539 * Search results masonry layout initialization. 15540 * 15541 * @since 10.5 15542 */ 15543 function searchResultMasonryInit() { 15544 if ($('body.search-results').length > 0 && 15545 $('#search-results article').length > 0 && 15546 $('#search-results[data-layout="list-no-sidebar"]').length == 0) { 15547 searchResultMasonry(); 15548 } 15549 } 15550 15551 15552 15553 15554 /** 15555 * Custom colors for portfolio grid elements. 15556 * 15557 * @since 10.5 15558 */ 15559 function portfolioCustomColoring() { 15560 15561 //portfolio colors 15562 if ($('.portfolio-items .col .style-3-alt').length > 0 || 15563 $('.portfolio-items .col .style-3').length > 0 || 15564 $('.portfolio-items .col .style-2').length > 0 || 15565 $('.portfolio-items .col .style-5').length > 0) { 15566 15567 var portfolioColorCss = ''; 15568 15569 $('.portfolio-items .col').each(function () { 15570 15571 var $titleColor = $(this).attr('data-title-color'), 15572 $subTitleColor = $(this).attr('data-subtitle-color'); 15573 15574 if ($titleColor.length > 0) { 15575 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; } '; 15576 portfolioColorCss += ' .portfolio-items[data-ps="8"] .col[data-title-color="' + $titleColor + '"] .line { background-color: ' + $titleColor + '; }'; 15577 portfolioColorCss += '.portfolio-items[data-ps="8"] .col[data-title-color="' + $titleColor + '"] .next-arrow line { stroke: ' + $titleColor + '; } '; 15578 } 15579 if ($subTitleColor.length > 0) { 15580 portfolioColorCss += '.col[data-subtitle-color="' + $subTitleColor + '"] .vert-center p, .portfolio-items[data-ps="6"] .col[data-title-color="' + $titleColor + '"] .work-meta p { color: ' + $subTitleColor + '; } '; 15581 } 15582 15583 }); 15584 15585 //style 15586 nectarCreateStyle(portfolioColorCss, 'nectar-portfolio-colors'); 15587 15588 } 15589 15590 } 15591 15592 15593 15594 15595 /** 15596 * Single post pagination/recent post mouse events 15597 * 15598 * @since 10.5 15599 */ 15600 function postMouseEvents() { 15601 15602 15603 $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 () { 15604 $(this).parents('.grav-wrap') 15605 .find('img') 15606 .addClass('hovered'); 15607 }); 15608 15609 $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 () { 15610 $(this).parents('.grav-wrap') 15611 .find('img') 15612 .removeClass('hovered'); 15613 }); 15614 15615 $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 () { 15616 $(this).addClass('mouse-leaving'); 15617 }); 15618 15619 } 15620 15621 15622 15623 15624 /** 15625 * Masonry portfolio initialization. 15626 * 15627 * @since 10.5 15628 */ 15629 function masonryPortfolioInit() { 15630 15631 $portfolio_containers = []; 15632 15633 $('.portfolio-items:not(.carousel)').each(function (i) { 15634 15635 $(this).attr('instance', i); 15636 $(this).parent().parent().find('div[class^=portfolio-filters]').attr('instance', i); 15637 15638 if (typeof SalientPortfolio !== 'undefined') { 15639 $portfolio_containers[i] = new SalientPortfolio($(this), fullWidthContentColumns); 15640 } 15641 15642 }); 15643 15644 } 15645 15646 15647 15648 15649 /** 15650 * Perspective load in styling. 15651 * 15652 * @since 8.0 15653 */ 15654 function updatePerspectiveOrigin() { 15655 15656 if( nectarDOMInfo.winW > 690 ) { 15657 $('.posts-container[data-load-animation="perspective"]').css('perspective-origin', '50% ' + (nectarDOMInfo.scrollTop + nectarDOMInfo.winH) + 'px'); 15658 } 15659 requestAnimationFrame(updatePerspectiveOrigin); 15660 15661 } 15662 15663 15664 /** 15665 * Perspective load in styling. 15666 * 15667 * @since 8.0 15668 */ 15669 function updatePerspectiveOriginInit() { 15670 15671 if ($('.posts-container[data-load-animation="perspective"]').length > 0) { 15672 requestAnimationFrame(updatePerspectiveOrigin); 15673 } 15674 15675 } 15676 15677 15678 15679 /** 15680 * Blog load in animation. 15681 * 15682 * @since 3.0 15683 */ 15684 function blogLoadIn(post_container) { 15685 15686 if (post_container.attr('data-load-animation') == 'none') { 15687 15688 post_container 15689 .find('.inner-wrap') 15690 .removeClass('animated'); 15691 15692 } else { 15693 15694 post_container.find('article').each(function (i) { 15695 15696 // Loaded visible 15697 if ($(this).visible(true)) { 15698 15699 $(this).delay(110 * i).queue(function (next) { 15700 $(this).addClass("animated-in"); 15701 next(); 15702 }); 15703 15704 15705 } else { 15706 15707 // Not already visible 15708 var $that = $(this); 15709 var waypoint = new Waypoint({ 15710 15711 element: $that, 15712 handler: function () { 15713 15714 setTimeout(function () { 15715 $that.addClass("animated-in"); 15716 }, 80 * $that.attr('data-delay-amount')); 15717 15718 waypoint.destroy(); 15719 }, 15720 offset: '90%' 15721 15722 }); 15723 } 15724 15725 }); 15726 15727 } 15728 15729 } 15730 15731 15732 /** 15733 * Masonry blog initialization. 15734 * 15735 * @since 10.5 15736 */ 15737 function masonryBlogInit() { 15738 15739 $nectarMasonryBlogs = []; 15740 15741 $('.posts-container').each(function (i) { 15742 15743 if ($(this).parent().hasClass('masonry') && !$(this).parent().hasClass('auto_meta_overlaid_spaced')) { 15744 15745 if (typeof NectarMasonryBlog == 'undefined') { 15746 return; 15747 } 15748 15749 $nectarMasonryBlogs[i] = new NectarMasonryBlog($(this), fullWidthSections, blogLoadIn); 15750 15751 } else { 15752 15753 blogLoadIn($(this)); 15754 15755 } 15756 15757 }); 15758 } 15759 15760 15761 15762 /** 15763 * Sticky Sidebar initialization. 15764 * 15765 * @since 10.5 15766 */ 15767 function stickySidebarInit() { 15768 15769 if (!$().theiaStickySidebar) { 15770 return; 15771 } 15772 15773 $('#sidebar[data-nectar-ss="true"], #sidebar[data-nectar-ss="1"]').each(function () { 15774 15775 // Padding from top of screen 15776 var $ssExtraTopSpace = 50; 15777 15778 if ($('#header-outer[data-remove-fixed="0"]').length > 0 && 15779 $('body[data-hhun="1"]').length == 0 && 15780 $('#header-outer[data-format="left-header"]').length == 0) { 15781 15782 $ssExtraTopSpace += $headerOuterEl.outerHeight(); 15783 15784 // Resize effect 15785 if ($('#header-outer[data-shrink-num][data-header-resize="1"]').length > 0) { 15786 var headerPadding2 = parseInt($headerOuterEl.attr('data-padding')) - parseInt($headerOuterEl.attr('data-padding')) / 1.8; 15787 $ssExtraTopSpace -= logoShrinkNum; 15788 $ssExtraTopSpace -= headerPadding2; 15789 } 15790 15791 // Condense 15792 if ($('body.mobile').length == 0 && $('#header-outer[data-condense="true"]').length > 0) { 15793 15794 var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'); 15795 $ssExtraTopSpace = 50; 15796 $ssExtraTopSpace += $headerOuterEl.height() - (parseInt($headerSpan9.position().top) - parseInt($('#header-outer #logo').css('margin-top'))) - parseInt(nectarDOMInfo.secondaryHeaderHeight); 15797 } 15798 15799 } 15800 15801 if ($wpAdminBar.length > 0) {
15802 $ssExtraTopSpace += $wpAdminBar.outerHeight(); 15803 } 15804 15805 15806 if ($(this).parents('.wpb_widgetised_column').length > 0) { 15807 15808 if ($('body.vc_editor').length > 0) { 15809 // Skip processing. 15810 } else { 15811 $(this).parents('.wpb_column').theiaStickySidebar({ 15812 additionalMarginTop: $ssExtraTopSpace, 15813 updateSidebarHeight: false 15814 }); 15815 } 15816 15817 } else { 15818 $(this).theiaStickySidebar({ 15819 additionalMarginTop: $ssExtraTopSpace, 15820 updateSidebarHeight: false 15821 }); 15822 } 15823 15824 }); 15825 } 15826 15827 15828 15829 15830 15831 /** 15832 * Section down arrow animated link 15833 * 15834 * @since 10.5 15835 */ 15836 function sectionDownArrowEvent() { 15837 15838 var headerPadding2 = headerPadding - headerPadding / 1.8; 15839 15840 $body.on('click', '.section-down-arrow, .scroll-down-wrap > .minimal-arrow', function () { 15841 15842 if ($(this).parents('.nectar-box-roll').length > 0) { 15843 return false; 15844 } 15845 15846 var $currentSection = $(this).parents('#page-header-bg'), 15847 $topDistance = $currentSection.height(), 15848 $offset = ($currentSection.parents('.first-section').length == 0 || $('body[data-transparent-header="false"]').length > 0) ? $currentSection.offset().top : 0, 15849 $bodyBorderSize = ($bodyBorderTop.length > 0 && $window.width() > 1000) ? $bodyBorderTop.height() : 0, 15850 $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0) ? 0 : $('#header-space').height(), 15851 $materialSecondary = 0; 15852 15853 if ($('body.material').length > 0 && $headerSecondaryEl.length > 0) { 15854 $materialSecondary = $headerSecondaryEl.height(); 15855 } 15856 15857 if ($('body[data-permanent-transparent="1"]').length == 0) { 15858 15859 // Regular 15860 if (!$body.hasClass('mobile')) { 15861 15862 if ($('body[data-hhun="1"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length == 0) { 15863 $('body,html').stop().animate({ 15864 scrollTop: parseInt($topDistance) + $offset + 2 - $bodyBorderSize * 2 15865 }, 1000, 'easeInOutCubic'); 15866 } else { 15867 15868 var $resize = ($('#header-outer[data-header-resize="0"]').length > 0) ? 0 : parseInt(logoShrinkNum) + headerPadding2 * 2; 15869 if ($('#header-outer[data-remove-fixed="1"]').length > 0) { 15870 $headerNavSpace = 0; 15871 $offset = 0; 15872 } 15873 15874 // Condense 15875 if ($('body.mobile').length == 0 && $('#header-outer[data-condense="true"]').length > 0) { 15876 var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'); 15877 $headerNavSpace = $headerOuterEl.height() - (parseInt($headerSpan9.position().top) - parseInt($('#header-outer #logo').css('margin-top'))) - parseInt(nectarDOMInfo.secondaryHeaderHeight); 15878 } 15879 15880 $('body,html').stop().animate({ 15881 scrollTop: parseInt($topDistance - $headerNavSpace) + $resize + 3 + $offset + $materialSecondary 15882 }, 1000, 'easeInOutCubic'); 15883 15884 } 15885 15886 } else { 15887 15888 var $scrollPos; 15889 15890 if($('#header-outer[data-mobile-fixed="1"]').length > 0) { 15891 $scrollPos = parseInt($topDistance) - $headerNavSpace + parseInt($currentSection.offset().top) + 2; 15892 } else { 15893 $scrollPos = parseInt($topDistance) + parseInt($currentSection.offset().top) + 2; 15894 } 15895 15896 $('body,html').stop().animate({ 15897 scrollTop: $scrollPos - $bodyBorderSize * 2 15898 }, 1000, 'easeInOutCubic'); 15899 } 15900 15901 } else { 15902 // Permanent transparent 15903 $('body,html').stop().animate({ 15904 scrollTop: parseInt($topDistance) + parseInt($currentSection.offset().top) + 2 - $bodyBorderSize * 2 15905 }, 1000, 'easeInOutCubic'); 15906 } 15907 return false; 15908 }); 15909 15910 } 15911 15912 15913 15914 15915 15916 /** 15917 * Displace filter column/row BG effect - fullpage 15918 * 15919 * @since 10.5 15920 */ 15921 function nectarLiquidBGFP() { 15922 15923 $('.nectar-liquid-bg').removeClass('animated-in'); 15924 15925 for (var k = 0; k < $liquidBG_EL.length; k++) { 15926 15927 if ($liquidBG_EL[k].animationType == 'displace-filter-fade' && $($liquidBG_EL[k].canvasContainer).parents('.fp-section.active').length > 0) { 15928 15929 //add bg to container 15930 if ($($liquidBG_EL[k].canvasContainer).find('.image-added-to-stage').length == 0) { 15931 $liquidBG_EL[k].imgContainer.addChild($liquidBG_EL[k].bg); 15932 } 15933 15934 $($liquidBG_EL[k].canvasContainer) 15935 .find('.nectar-liquid-bg') 15936 .addClass('image-added-to-stage'); 15937 15938 $liquidBG_EL[k].animateProps($liquidBG_EL[k]); 15939 15940 } 15941 } 15942 } 15943 15944 15945 /** 15946 * Page Full Screen Rows 15947 * 15948 * @since 10.5 15949 */ 15950 function nectarFullPageInit() { 15951 15952 if ($('#nectar_fullscreen_rows').length > 0 && $().fullpage) { 15953 15954 $fullscreenSelector = (window.vc_iframe) ? '.vc_element.vc_vc_row.active ' : '.wpb_row.active ';
15955 15956 $nectarFullPage = new NectarFullScreenRows(waypoints, $mouseParallaxScenes, nectarLiquidBGFP, nectarDOMInfo, responsiveTooltips, $standAnimatedColTimeout, $svgIcons); 15957 15958 } 15959 15960 } 15961 15962 15963 15964 15965 /** 15966 * Cross browser adjustments. 15967 * 15968 * @since 1.0 15969 */ 15970 function crossBrowserAdjust() { 15971 15972 // Add specific class if on device for better tablet tracking. 15973 if (nectarDOMInfo.usingMobileBrowser) { 15974 $body.addClass('using-mobile-browser'); 15975 } 15976 15977 // Add class for old IE. 15978 var ua = window.navigator.userAgent; 15979 var msie = ua.indexOf("Edge/"); 15980 if (msie > 0) { 15981 $body.addClass('msie'); 15982 } 15983 15984 // For users updating to 8 with a custom, old header template file 15985 if ($('html.js').length == 0) { 15986 $('html').removeClass('no-js').addClass('js'); 15987 } 15988 15989 //remove br's from code tag 15990 $('code').find('br').remove(); 15991 15992 // Contact form 7. 15993 $('.wpcf7-form p:has(input[type=submit])').css('padding-bottom', '0px'); 15994 15995 $('.full-width-content .wpcf7-submit').on('click', function () { 15996 setTimeout(function () { 15997 fullWidthContentColumns(); 15998 }, 1000); 15999 setTimeout(function () { 16000 fullWidthContentColumns(); 16001 }, 2000); 16002 }); 16003 16004 // Gravity form inside fw content row 16005 $('.gform_body').on('click', function () { 16006 setTimeout(function () { 16007 fullWidthContentColumns(); 16008 }, 200); 16009 }); 16010 16011 // Popup Maker. 16012 $('.pum.pum-theme-salient-page-builder-optimized button.pum-close').wrapInner('<span />'); 16013 16014 // pum inside fspr 16015 if ($('#nectar_fullscreen_rows').length > 0 && 16016 $('.pum-container .pum-content > .wpb_row .full-page-inner > .container > .span_12').length > 0) { 16017 $('.pum-container .pum-content > .wpb_row .full-page-inner > .container > .span_12').unwrap(); 16018 } 16019 16020 // Blog bottom padding 16021 if ($('.single .blog_next_prev_buttons').length > 0) { 16022 $('.container-wrap').css('padding-bottom', 0); 16023 } 16024 16025 // Remove margin on last cols inside of full width sections 16026 $('.full-width-section').each(function () { 16027 $(this).find('> .span_12 > div.col_last').last().css('margin-bottom', '0'); 16028 }); 16029 16030 // Remove boxed style from full width content 16031 $('.full-width-content .col.boxed').removeClass('boxed'); 16032 16033 // Neg marg z-index adjust 16034 $('.wpb_column.neg-marg').parents('.wpb_row').css('z-index', '110'); 16035 16036 16037 } 16038 16039 16040 16041 16042 //vc col mobile fixes 16043 function vcMobileColumns() { 16044 16045 $('.wpb_row').each(function () { 16046 if (typeof $(this).find('.span_12').offset() != 'undefined') { 16047 16048 $(this).find('[class*="vc_col-"]').each(function () { 16049 16050 var $firstChildOffset = $(this).parents('.span_12').offset().left; 16051 16052 $(this).removeClass('no-left-margin'); 16053 16054 if ($(this).offset().left < $firstChildOffset + 27) { 16055 $(this).addClass('no-left-margin'); 16056 } else { 16057 $(this).removeClass('no-left-margin'); 16058 } 16059 }); 16060 } 16061 }); 16062 } 16063 16064 function vcMobileColumnsInit() { 16065 16066 var $winDOMWidth = nectarDOMInfo.winW, 16067 $winDOMHeight = nectarDOMInfo.winH, 16068 $orientChangeTrack = 0; 16069 16070 // Only needed in legacy column setups. 16071 if( $body.is('[data-flex-cols="true"]') ) { 16072 return; 16073 } 16074 16075 if ($('[class*="vc_col-xs-"], [class*="vc_col-md-"], [class*="vc_col-lg-"]').length > 0) { 16076 16077 // Trigger immediately. 16078 vcMobileColumns(); 16079 16080 // Resize. 16081 if( !nectarDOMInfo.usingMobileBrowser ) { 16082 // Bind normally for desktop. 16083 $window.on('resize',vcMobileColumns); 16084 } 16085 else { 16086 16087 // For mobile make sure the orientation has changed. 16088 window.addEventListener("orientationchange", function () { 16089 $orientChangeTrack = 1; 16090 }); 16091 16092 $window.on('resize', function () { 16093 16094 if (($window.width() != $winDOMWidth && $window.height != $winDOMHeight) || $orientChangeTrack === 1) { 16095 16096 vcMobileColumns(); 16097 16098 // Store the current window dimensions. 16099 $winDOMWidth = nectarDOMInfo.winW; 16100 $winDOMHeight = nectarDOMInfo.winH; 16101 16102 // Reset orientation change tracker. 16103 $orientChangeTrack = 0; 16104 } 16105 16106 }); 16107 16108 16109 } // end mobile only. 16110 16111 } // endif vc offset cols found. 16112 16113 16114 } 16115 16116 16117 16118 16119 /** 16120 * Select2 plugin initialization. 16121 * 16122 * @since 5.0 16123 */ 16124 function select2Init() { 16125 16126 $('select:not(.state_select):not(.country_select):not(.comment-form-rating #rating):not(#tribe-bar-form select):not(.woocommerce-currency-switcher)').each(function () { 16127 16128 // Prevent search from triggering on small devices. 16129 var $minimumToSearch = ( nectarDOMInfo.winW > 690 ) ? 7 : 200; 16130 16131 if ($(this).parents('#buddypress').length == 0) { 16132 16133 if ($(this).parents('.woocommerce-ordering').length == 0) { 16134 $(this).select2({ 16135 minimumResultsForSearch: $minimumToSearch, 16136 width: '100%' 16137 }); 16138 } else { 16139 $(this).select2({ 16140 minimumResultsForSearch: $minimumToSearch, 16141 dropdownAutoWidth: true 16142 }); 16143 } 16144 } 16145 16146 }); 16147 } 16148 16149 16150 /** 16151 * Fancy select styling theme option. 16152 * 16153 * @since 10.5 16154 */ 16155 function fancySelectStyling() { 16156 16157 if ( $('body[data-fancy-form-rcs="1"]').length > 0 ) { 16158 16159 $('select:not(.comment-form-rating #rating)').each(function () { 16160 16161 var $selector; 16162 16163 //cf7 16164 if ($(this).parents('.wpcf7-form-control-wrap').length > 0) { 16165 16166 //select 2 already initialized 16167 if ($(this).parents('.wpcf7-form-control-wrap').find('.select2-container').length > 0) { 16168 $selector = $($(this).prev('.select2-container')); 16169 } else { 16170 $selector = $(this); 16171 } 16172 16173 //if label is found 16174 if ($selector.parents('.wpcf7-form-control-wrap').parent().find('label').length == 1) { 16175 $selector.parents('.wpcf7-form-control-wrap').parent().wrapInner('<div class="fancy-select-wrap" />'); 16176 } else { 16177 //default wrap 16178 $selector.wrap('<div class="fancy-select-wrap" />'); 16179 } 16180 } 16181 //default 16182 else { 16183 16184 //select 2 already initialized 16185 if ($(this).prev('.select2-container').length > 0) { 16186 $selector = $(this).prev('.select2-container'); 16187 } else { 16188 $selector = $(this); 16189 } 16190 16191 if ($(this).parents('#buddypress').length == 0 && $(this).parents('.widget_categories').length == 0) { 16192 //if label is found 16193 if ($selector.prev('label').length == 1) { 16194 $selector.prev('label').andSelf().wrapAll('<div class="fancy-select-wrap" />'); 16195 } else if ($selector.next('label').length == 1) { 16196 $selector.next('label').andSelf().wrapAll('<div class="fancy-select-wrap" />'); 16197 } else { 16198 //default wrap 16199 $selector.wrap('<div class="fancy-select-wrap" />'); 16200 } 16201 } 16202 16203 } 16204 }); 16205 16206 select2Init(); 16207 16208 } 16209 16210 } 16211 16212 16213 16214 16215 16216 /** 16217 * Back/Forward Safari cache assist. 16218 * 16219 * @since 10.5 16220 */ 16221 function bfCacheAssist() { 16222 16223 //Back/forward cache OCM close 16224 if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1 || 16225 navigator.userAgent.match(/(iPod|iPhone|iPad)/)) { 16226 16227 window.onpageshow = function (event) { 16228 16229 if (event.persisted) { 16230 16231 // Play video BGs 16232 $('.nectar-video-wrap, .nectar-slider-wrap .swiper-slide .video-wrap').each(function () { 16233 16234 if ($(this).find('video').length > 0) { 16235 $(this).find('video')[0].play(); 16236 } 16237 16238 }); 16239 16240 16241 // Close mobile nav 16242 16243 //// Material Skin. 16244 if ($('body.material-ocm-open').length > 0) { 16245 $('body > .slide_out_area_close').addClass('non-human-allowed').trigger('click'); 16246 16247 setTimeout(function () { 16248 $('body > .slide_out_area_close').removeClass('non-human-allowed'); 16249 }, 100); 16250 16251 } else if ($('#slide-out-widget-area.slide-out-from-right-hover.open').length > 0 && navigator.userAgent.match(/(iPod|iPhone|iPad)/)) { 16252 OCM_mobileSlideOutRightHoverCloseCheck(); 16253 } 16254 // Others 16255 else if ($('#slide-out-widget-area.fullscreen.open').length > 0 || 16256 $('#slide-out-widget-area.fullscreen-alt.open').length > 0 || 16257 $('#slide-out-widget-area.slide-out-from-right.open').length > 0) { 16258 16259 $('#slide-out-widget-area .slide_out_area_close').addClass('non-human-allowed'); 16260 $('.slide-out-widget-area-toggle:not(.std-menu) a.open') 16261 .addClass('non-human-allowed') 16262 .trigger('click'); 16263 16264 setTimeout(function () { 16265 $('#slide-out-widget-area .slide_out_area_close').removeClass('non-human-allowed'); 16266 }, 100); 16267 16268 } 16269 16270 }
16270 // Loaded from bf cache 16271 16272 }; // onpage show 16273 16274 } 16275 16276 } 16277 16278 16279 16280 16281 16282 16283 /*-------------------------------------------------------------------------*/ 16284 /* WPBakery Frontend Editor 16285 /*-------------------------------------------------------------------------*/ 16286 16287 /** 16288 * Control adjustments 16289 * 16290 * @since 10.0 16291 */ 16292 function addRowCtrls() { 16293 16294 //remove padding for rows with only fullwidth ns 16295 $('.wpb_row').removeClass('only-ns'); 16296 16297 $('.nectar-slider-wrap[data-full-width="true"], .page-submenu, .portfolio-items[data-col-num="elastic"]:not(.fullwidth-constrained), .blog-fullwidth-wrap') 16298 .parents('.wpb_row') 16299 .addClass('only-ns'); 16300 16301 //padding when column contains item that could get lost under column controls 16302 $('body.vc_editor.compose-mode .wpb_row .vc_vc_column > .wpb_column > .vc_column-inner').each(function() { 16303 16304 if ($(this).find('> .vc_element-container > div').length > 0) { 16305 16306 if ($(this).find('> .vc_element-container > div:first-child').is('.vc_vc_row_inner')) { 16307 $(this).find('> .vc_element-container > div:first-child').addClass('first-inner-row-el'); 16308 } else { 16309 $(this).find('> .vc_element-container > div:first-child').removeClass('first-inner-row-el'); 16310 } 16311 16312 } 16313 16314 }); 16315 16316 } //addRowCtrl end 16317 16318 16319 /** 16320 * Convert front end padding 16321 * 16322 * Needed when the flexbox grid is not active due to 16323 * different markup in front end page builder view. 16324 * 16325 * @since 10.0 16326 */ 16327 function convertFrontEndPadding() { 16328 16329 $('.vc_element > .wpb_column[class*="padding-"][class*="-percent"]').each(function() { 16330 16331 var $elPaddingPercent = 4; 16332 16333 var elclassName = this.className.match(/padding-\d+/); 16334 if (elclassName) { 16335 $elPaddingPercent = elclassName[0].match(/\d+/); 16336 if ($elPaddingPercent) { 16337 $elPaddingPercent = $elPaddingPercent[0] / 100; 16338 } else { 16339 $elPaddingPercent = 0; 16340 } 16341 } 16342 16343 if ($elPaddingPercent) { 16344 var $parentRowWidth = $(this).parents('.span_12').width(); 16345 16346 if ($(this).is('[data-padding-pos="all"]')) { 16347 $(this).css('padding', $parentRowWidth * $elPaddingPercent); 16348 } else if ($(this).is('[data-padding-pos="top"]')) { 16349 $(this).css('padding-top', $parentRowWidth * $elPaddingPercent); 16350 } else if ($(this).is('[data-padding-pos="bottom"]')) { 16351 $(this).css('padding-bottom', $parentRowWidth * $elPaddingPercent); 16352 } else if ($(this).is('[data-padding-pos="left"]')) { 16353 $(this).css('padding-left', $parentRowWidth * $elPaddingPercent); 16354 } else if ($(this).is('[data-padding-pos="right"]')) { 16355 $(this).css('padding-right', $parentRowWidth * $elPaddingPercent); 16356 } else if ($(this).is('[data-padding-pos="top-bottom"]')) { 16357 $(this).css({ 16358 'padding-top': $parentRowWidth * $elPaddingPercent, 16359 'padding-bottom': $parentRowWidth * $elPaddingPercent, 16360 }); 16361 } else if ($(this).is('[data-padding-pos="top-right"]')) { 16362 $(this).css({ 16363 'padding-top': $parentRowWidth * $elPaddingPercent, 16364 'padding-right': $parentRowWidth * $elPaddingPercent, 16365 }); 16366 } else if ($(this).is('[data-padding-pos="bottom-right"]')) { 16367 $(this).css({ 16368 'padding-right': $parentRowWidth * $elPaddingPercent, 16369 'padding-bottom': $parentRowWidth * $elPaddingPercent, 16370 }); 16371 } else if ($(this).is('[data-padding-pos="bottom-left"]')) { 16372 $(this).css({ 16373 'padding-left': $parentRowWidth * $elPaddingPercent, 16374 'padding-bottom': $parentRowWidth * $elPaddingPercent, 16375 }); 16376 } else if ($(this).is('[data-padding-pos="left-right"]')) { 16377 $(this).css({ 16378 'padding-left': $parentRowWidth * $elPaddingPercent, 16379 'padding-right': $parentRowWidth * $elPaddingPercent, 16380 }); 16381 } 16382 } 16383 16384 }); 16385 16386 $('.wpb_row[class*="vc_custom_"]').each(function() { 16387 16388 $(this).parent().addClass('no-bottom-margin'); 16389 16390 }); 16391 16392 } 16393 16394 16395 /** 16396 * WPBakery Front end editor integration 16397 * 16398 * @since 10.0 16399 */ 16400 function wpBakeryFrontendInit() { 16401 16402 // Set up controls/column padding. 16403 setTimeout(function() { 16404 16405 if ($('body.compose-mode').length > 0) {
16406 $('.container-wrap').addClass('visible-editor-controls'); 16407 } 16408 16409 if (nectarDOMInfo.usingFrontEndEditor) { 16410 addRowCtrls(); 16411 16412 if( !$body.is('[data-flex-cols="true"]') ) { 16413 convertFrontEndPadding(); 16414 $window.smartresize(convertFrontEndPadding); 16415 } 16416 16417 } 16418 16419 }, 200); 16420 16421 // Bind reload event 16422 $window.on('vc_reload', function() { 16423 16424 addRowCtrls(); 16425 columnBGColors(); 16426 coloredButtons(); 16427 twentytwentyInit(); 16428 parallaxRowsBGCals(); 16429 flexsliderInit(); 16430 accordionInit(); 16431 ulCheckmarks(); 16432 nectarFancyUlIcons(); 16433 nectarFancyBoxHover(); 16434 oneFourthClasses(); 16435 carouselfGrabbingClass(); 16436 nectarPostGridInit(); 16437 splitLineHeadingInit(); 16438 nectarVideoLightbox(); 16439 nectarKeyframeAssist(); 16440 nectarLazyImageLoading(); 16441 16442 if ($('.carousel').length > 0) { 16443 standardCarouselInit(); 16444 clientsCarouselInit(); 16445 carouselHeightCalcs(); 16446 } 16447 16448 if ($('.owl-carousel').length > 0) { 16449 $('.owl-carousel').each(function() { 16450 $(this).trigger('destroy.owl.carousel').removeClass('owl-loaded'); 16451 $(this).find('.owl-stage-outer .owl-stage > *').unwrap(); 16452 $(this).find('.owl-stage-outer > *').unwrap(); 16453 $(this).find('.owl-item > *').unwrap(); 16454 $(this).find('.owl-dots').remove(); 16455 $(this).find('.owl-nav').remove(); 16456 }); 16457 owlCarouselInit(); 16458 } 16459 16460 if ($('.nectar_cascading_images').length > 0) { 16461 imagesLoaded($('.nectar_cascading_images'), function() { 16462 cascadingImageBGSizing(); 16463 }); 16464 } 16465 16466 fullWidthSections(); 16467 fwsClasses(); 16468 recentPostsInit(); 16469 fullWidthRowPaddingAdjust(); 16470 16471 /*flickity carousels*/ 16472 if ($flickitySliders.length > 0) { 16473 for (var i = 0; i < $flickitySliders.length; i++) { 16474 16475 $flickitySliders[i].reloadCells(); 16476 $flickitySliders[i].off('scroll.flickity'); 16477 $flickitySliders[i].off('dragStart.flickity'); 16478 $flickitySliders[i].off('dragEnd.flickity'); 16479 16480 } 16481 } 16482 16483 flickityLazyInit(); 16484 16485 setTimeout(function() { 16486 16487 flickityInit(); 16488 if ($flickitySliders.length > 0) { 16489 for (var i = 0; i < $flickitySliders.length; i++) { 16490 $flickitySliders[i].reloadCells(); 16491 $flickitySliders[i].resize(); 16492 } 16493 } 16494 16495 }, 100); 16496 16497 /*flickity product carousels*/ 16498 if ($wooFlickityCarousels.length > 0) { 16499 for (var i = 0; i < $wooFlickityCarousels.length; i++) { 16500 16501 $wooFlickityCarousels[i].flickity('reloadCells'); 16502 $wooFlickityCarousels[i].off('scroll.flickity'); 16503 $wooFlickityCarousels[i].off('dragStart.flickity'); 16504 $wooFlickityCarousels[i].off('dragEnd.flickity'); 16505 16506 } 16507 } 16508 16509 setTimeout(function() { 16510 16511 if ($('.nectar-woo-flickity').length > 0) { 16512 productCarouselInit(); 16513 } 16514 if ($wooFlickityCarousels.length > 0) { 16515 for (var i = 0; i < $wooFlickityCarousels.length; i++) { 16516 $wooFlickityCarousels[i].flickity('reloadCells'); 16517 $wooFlickityCarousels[i].flickity('resize'); 16518 } 16519 } 16520 16521 }, 100); 16522 16523 nectarTestimonialSliders(); 16524 16525 for (var i = 0; i < $testimonialSliders.length; i++) { 16526 16527 if ($testimonialSliders[i].type == 'multiple_visible' || 16528 $testimonialSliders[i].type == 'multiple_visible_minimal') { 16529 16530 $testimonialSliders[i].flickityEl.flickity('reloadCells'); 16531 $testimonialSliders[i].flickityEl.off('select.flickity'); 16532 nectarTestimonialSliders(); 16533 $testimonialSliders[i].flickityEl.resize(); 16534 } 16535 16536 $testimonialSliders[i].testimonialSliderHeight(); 16537 } 16538 nectarTestimonialSlidersEvents(); 16539 16540 pricingTableHeight(); 16541 nectarIconMatchColoring(); 16542 lightBoxInit(); 16543 imageWithHotspotEvents(); 16544 largeIconHover(); 16545 nectarBoxRollInit(); 16546 midnightInit(); 16547 responsiveVideoIframesInit(); 16548 responsiveVideoIframes(); 16549 fullWidthContentColumns(); 16550 setTimeout(fullWidthContentColumns, 1000); 16551 videoBGInit(); 16552 vcFullHeightRowInit(); 16553 $window.off('scroll.parallaxSections').off('resize.parallaxSections'); 16554 parallaxScrollInit(); 16555 masonryBlogInit(); 16556 masonryPortfolioInit(); 16557 16558 if ($portfolio_containers.length > 0) { 16559 for (var i = 0; i < $portfolio_containers.length; i++) { 16560 $portfolio_containers[i].portfolioAccentColor(); 16561 } 16562 } 16563 16564 parallaxItemHoverEffect(); 16565 fsProjectSliderInit(); 16566 16567 setTimeout(function() { 16568 if ($('.nectar_fullscreen_zoom_recent_projects').length > 0) { 16569 16570 if ($fsProjectSliderArr.length > 0) { 16571 for (var i = 0; i < $fsProjectSliderArr.length; i++) { 16572 $fsProjectSliderArr[i].sliderCalcs(); 16573 } 16574 } 16575 16576 } 16577 }, 300); 16578 16579 $window.unbind('.infscr'); 16580 infiniteScrollInit();
16581 mouseParallaxInit(); 16582 16583 //play video BGs 16584 $('.nectar-video-wrap').each(function() { 16585 if ($(this).find('video').length > 0) { 16586 $(this).find('video').css('visibility', 'visible'); 16587 } 16588 }); 16589 16590 //tablet inherits small desktop 16591 $('.wpb_column[data-t-w-inherits]').each(function() { 16592 if ($(this).is('[data-t-w-inherits="small_desktop"]')) { 16593 $(this).parent().addClass('inherits-s-desktop-col'); 16594 } else { 16595 $(this).parent().removeClass('inherits-s-desktop-col'); 16596 } 16597 }); 16598 16599 //full screen page rows 16600 if ($('#nectar_fullscreen_rows').length > 0) { 16601 16602 if ($('#nectar_fullscreen_rows > .vc_element').length == 0) { 16603 $('#nectar_fullscreen_rows').prepend('<div class="vc_element empty_placeholder" />'); 16604 } 16605 16606 16607 if ($('#nectar_fullscreen_rows > .vc_element:not(.empty_placeholder)').length > 0) { 16608 $('#nectar_fullscreen_rows >.vc_element.empty_placeholder').remove(); 16609 } 16610 16611 16612 $.fn.fullpage.destroy('all'); 16613 nectarFullPageInit(); 16614 16615 //keep tooltip active status 16616 var nectarFPOffsets = [{ 16617 el: '', 16618 offset: 0 16619 }]; 16620 16621 ////create list of offsets 16622 $('#nectar_fullscreen_rows > div.vc_element').each(function(i) { 16623 nectarFPOffsets[i] = { 16624 el: $(this), 16625 offset: $(this).offset().top 16626 }; 16627 }); 16628 16629 16630 ////start active on that index 16631 16632 //move back to first section when all have been deleted but one 16633 if ($('#nectar_fullscreen_rows > div.vc_element').length === 1) { 16634 $('#nectar_fullscreen_rows').css({ 16635 'transform': 'translate3d(0,0,0)' 16636 }); 16637 } 16638 16639 $body.scrollTo(0, 0); 16640 16641 16642 } else { 16643 16644 //remove container wrap padding/margin when needded 16645 if ($('body .main-content > .row > .vc_element:first > .wpb_row[class*="full-width-"]').length > 0 || 16646 $('body .main-content > .row > .vc_element:first .nectar-slider-wrap[data-full-width="true"]').length > 0) { 16647 $('.container-wrap').css({ 16648 'padding-top': '0', 16649 'margin-top': '0' 16650 }); 16651 } else { 16652 $('.container-wrap').css({ 16653 'padding-top': '40px' 16654 }); 16655 } 16656 16657 } 16658 16659 //reset svg icon arr 16660 $svgIcons = []; 16661 $('.svg-icon-holder') 16662 .removeClass('animated-in') 16663 .removeClass('bound'); 16664 16665 16666 //gmap 16667 if ($('.vc_nectar_gmap').length > 0) { 16668 16669 setTimeout(function() { 16670 16671 if (typeof google === 'object' && typeof google.maps === 'object') { 16672 window.mapAPI_Loaded(); 16673 } else { 16674 16675 if (window.nectarLove.mapApiKey.length > 0) { 16676 $.getScript('https://maps.google.com/maps/api/js?sensor=false&key=' + window.nectarLove.mapApiKey + '&callback=mapAPI_Loaded'); 16677 } 16678 } 16679 16680 }, 100); 16681 } 16682 16683 16684 stickySidebarInit(); 16685 16686 16687 if (typeof window.Waypoint != 'undefined') { 16688 Waypoint.destroyAll(); 16689 waypoints(); 16690 } 16691 16692 }); 16693 16694 } 16695 16696 16697 16698 16699 16700 16701 16702 16703 /** 16704 * Page transitions and waypoint triggering 16705 * 16706 * @since 10.5 16707 */ 16708 function pageTransitionInit() { 16709 16710 if ($('body[data-ajax-transitions="true"]').length > 0 && $('#ajax-loading-screen[data-method="standard"]').length > 0) { 16711 16712 $('html').addClass('page-trans-loaded'); 16713 16714 // Fade loading animation 16715 if ($('#ajax-loading-screen[data-effect="standard"]').length > 0) { 16716 16717 if ($('.nectar-particles').length == 0) { 16718 16719 $loadingScreenEl.transition({ 16720 'opacity': 0 16721 }, 500, function () { 16722 $(this).css({ 16723 'display': 'none' 16724 }); 16725 }); 16726 $('#ajax-loading-screen .loading-icon').transition({ 16727 'opacity': 0 16728 }, 500); 16729 16730 } 16731 16732 // Bind waypoints after loading screen has left 16733 if ($('.nectar-box-roll').length == 0) { 16734 setTimeout(function () { 16735 waypoints(); 16736 }, 550); 16737 } 16738 16739 } 16740 16741 // Swipe loading animation 16742 else { 16743 16744 if ($('#ajax-loading-screen[data-effect*="horizontal_swipe"]').length > 0) { 16745 setTimeout(function () { 16746 $loadingScreenEl.addClass('loaded'); 16747 }, 60); 16748 } 16749 16750 if ($('#page-header-wrap #page-header-bg[data-animate-in-effect="zoom-out"] .nectar-video-wrap').length == 0) { 16751 setTimeout(function () { 16752 $('#ajax-loading-screen:not(.loaded)').addClass('loaded'); 16753 setTimeout(function () { 16754 $loadingScreenEl.addClass('hidden'); 16755 }, 1000); 16756 }, 150); 16757 } 16758 16759 16760 // Bind waypoints after loading screen has left 16761 if ($('.nectar-box-roll').length == 0 && $('#ajax-loading-screen[data-effect*="horizontal_swipe"]').length > 0) { 16762 setTimeout(function () { 16763 waypoints(); 16764 }, 750); 16765 } else if ($('.nectar-box-roll').length == 0) setTimeout(function () { 16766 waypoints(); 16767 }, 350); 16768 16769 } 16770 16771 16772 // Safari back/prev fix 16773 if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1 || 16774 navigator.userAgent.match(/(iPod|iPhone|iPad)/)) { 16775 16776 window.onunload = function () { 16777 $loadingScreenEl.stop().transition({ 16778 'opacity': 0 16779 }, 800, function () { 16780 $(this).css({ 16781 'display': 'none' 16782 }); 16783 }); 16784 $('#ajax-loading-screen .loading-icon').transition({ 16785 'opacity': 0 16786 }, 600); 16787 }; 16788 window.onpageshow = function (event) { 16789 16790 if (event.persisted) { 16791 16792 $loadingScreenEl.stop().transition({ 16793 'opacity': 0 16794 }, 800, function () { 16795 $(this).css({ 16796 'display': 'none' 16797 }); 16798 }); 16799 $('#ajax-loading-screen .loading-icon').transition({ 16800 'opacity': 0 16801 }, 600); 16802 16803 } 16804 16805 }; 16806 16807 } 16808 16809 else if (navigator.userAgent.indexOf('Firefox') != -1) { 16810 window.onunload = function () {}; 16811 } 16812 16813 16814 // Remove excess loading images if using page transitions. 16815 $('.portfolio-loading, .nectar-slider-loading .loading-icon').remove(); 16816 16817 16818 if ($('#ajax-loading-screen[data-disable-fade-on-click="1"]').length == 0) { 16819 16820 if ($('body.using-mobile-browser #ajax-loading-screen[data-method="standard"][data-disable-mobile="1"]').length == 0) { 16821 16822 var ignore_onbeforeunload = false;
16823 $('a[href^="mailto"], a[href^="tel"]').on('click', function () { 16824 ignore_onbeforeunload = true; 16825 }); 16826 window.addEventListener('beforeunload', function () { 16827 16828 if (!ignore_onbeforeunload) { 16829 $loadingScreenEl.addClass('set-to-fade'); 16830 transitionPage(); 16831 } 16832 ignore_onbeforeunload = false; 16833 }); 16834 } 16835 16836 } 16837 16838 16839 } 16840 16841 // No page transitions 16842 else { 16843 16844 if ($('.nectar-box-roll').length == 0 && !nectarDOMInfo.usingFrontEndEditor) { 16845 16846 // Waypoints. 16847 setTimeout(function () { 16848 waypoints(); 16849 }, 100); 16850 } 16851 16852 } 16853 16854 16855 function transitionPage() { 16856 16857 if ($('#ajax-loading-screen[data-effect*="horizontal_swipe"]').length > 0) { 16858 $loadingScreenEl.removeClass('loaded'); 16859 $loadingScreenEl.addClass('in-from-right'); 16860 16861 setTimeout(function () { 16862 $loadingScreenEl.addClass('loaded'); 16863 }, 30); 16864 16865 } 16866 else { 16867 if ($('#ajax-loading-screen[data-effect="center_mask_reveal"]').length > 0) { 16868 $loadingScreenEl.css('opacity', '0').css('display', 'block').transition({ 16869 'opacity': '1' 16870 }, 450); 16871 } else { 16872 $loadingScreenEl.show().transition({ 16873 'opacity': '1' 16874 }, 450); 16875 } 16876 } 16877 16878 } 16879 16880 } 16881 16882 16883 16884 // Document ready event - starting everything up. 16885 jQuery(document).ready(function ($) { 16886 16887 // Initialize Nectar DOM helper. 16888 nectarDOMInfo.init(); 16889 16890 // Priority calls 16891 nectarBoxRollInit(); 16892 nectarFullPageInit(); 16893 nectarLazyImageLoading(); 16894 16895 // Header navigation. 16896 initSF(); 16897 navigationSearchInit(); 16898 centeredNavBottomBarInit(); 16899 centeredLogoHeaderInit(); 16900 headerNavPreInit(); 16901 headerNavScrollInit(); 16902 headerNavOffsetInit(); 16903 16904 // Page builder elements. 16905 salientPageBuilderElInit(); 16906 16907 // Column related. 16908 columnBGColors(); 16909 vcMobileColumnsInit(); 16910 16911 // Row related. 16912 fullWidthSections(); 16913 fwsClasses(); 16914 fwCarouselLinkFix(); 16915 fullWidthSectionsPreInit(); 16916 firstFWSection(); 16917 parallaxScrollInit(); 16918 parallaxRowsBGCals(); 16919 fullWidthRowPaddingAdjust(); 16920 fullWidthContentColumns(); 16921 oneFourthClasses(); 16922 fixIeFlexbox(); 16923 vcFullHeightRowInit(); 16924 16925 // Media. 16926 lightBoxInit(); 16927 audioVideoVis(); 16928 responsiveVideoIframesInit(); 16929 responsiveVideoIframes(); 16930 videoBGInit(); 16931 blogSingle(); 16932 16933 // Off canvas navigation. 16934 mobileNavMegamenuCorrect(); 16935 materialSkinOCM_Init(); 16936 OCM_dropdownMarkup(); 16937 OCM_dropdownIconPos(); 16938 clickToggleSubmenus(); 16939 OCM_init(); 16940 16941 // Page header 16942 pageHeaderInit(); 16943 16944 // Footer. 16945 footerRevealInit(); 16946 16947 // Third party. 16948 wooCommerceEvents(); 16949 fancySelectStyling(); 16950 16951 // Scrolling 16952 infiniteScrollInit(); 16953 scrollToTopInit(); 16954 animatedAnchorLinks(); 16955 updatePerspectiveOriginInit(); 16956 sectionDownArrowEvent(); 16957 16958 // Cross browser assist. 16959 crossBrowserAdjust(); 16960 bfCacheAssist(); 16961 16962 // Front end editing. 16963 wpBakeryFrontendInit(); 16964 16965 // Page transitions and waypoint activation. 16966 pageTransitionInit(); 16967 16968 16969 16970 // Main Debounced Resize Event. 16971 $window.off('smartresize.srInit'); 16972 $window.on('smartresize.srInit', smartResizeInit); 16973 16974 // Main Resize Event. 16975 $window.off('resize.srInit'); 16976 $window.on('resize.srInit', resizeInit); 16977 16978 // Window Load Event. 16979 $window.on('load', function () { 16980 16981 // Set header space. 16982 if ( $(window).scrollTop() == 0 ) { 16983 headerSpace(); 16984 } 16985 16986 $('video').css('visibility', 'visible'); 16987 16988 // Scroll to anchor 16989 pageLoadHashInit(); 16990 16991 // Row/Column related. 16992 fullWidthContentColumns(); 16993 parallaxRowsBGCals(); 16994 16995 // Video BG 16996 resizeVideoToCover(); 16997 16998 }); 16999 17000 17001 }); 17002 17003 17004 17005}(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.