1/** 2 * Main Salient script file. 3 * 4 * @package Salient 5 * @author ThemeNectar 6 */ 7 /* global jQuery */ 8 /* global Waypoint */ 9 /* global imagesLoaded */ 10 /* global Flickity */ 11 12(function($, window, document) { 13 14 "use strict"; 15 16 // Theme vars. 17 var $window = $(window), 18 $body = $('body'), 19 $offCanvasEl = $('#slide-out-widget-area'), 20 $offCanvasBG = $('#slide-out-widget-area-bg'), 21 $headerOuterEl = $('#header-outer'), 22 $headerSecondaryEl = $('#header-secondary-outer'), 23 $searchButtonEl = $('#header-outer #search-btn a'), 24 $wpAdminBar = $('#wpadminbar'), 25 $loadingScreenEl = $('#ajax-loading-screen'), 26 $bodyBorderTop = $('.body-border-top'), 27 $pageHeaderBG = $('#page-header-bg'), 28 $footerOuterEl = $('#footer-outer'), 29 $bodyBorderWidth = ($('.body-border-right').length > 0) ? $('.body-border-right').width() : 0, 30 $logoHeight = ($headerOuterEl.is('[data-logo-height]')) ? parseInt($headerOuterEl.attr('data-logo-height')) : 30, 31 headerPadding = ($headerOuterEl.is('[data-padding]')) ? parseInt($headerOuterEl.attr('data-padding')) : 28, 32 logoShrinkNum = ($headerOuterEl.is('[data-shrink-num]')) ? $headerOuterEl.attr('data-shrink-num') : 6, 33 condenseHeaderLayout = ($headerOuterEl.is('[data-condense="true"]')) ? true : false, 34 usingLogoImage = ($headerOuterEl.is('[data-using-logo="1"]')) ? true : false, 35 headerResize = ($headerOuterEl.is('[data-header-resize="1"]')) ? true : false, 36 headerTransparent = ($headerOuterEl.is('[data-transparent-header="true"]')) ? true : false, 37 headerLayoutFormat = ($body.is('[data-header-format]')) ? $body.attr('data-header-format') : 'default', 38 headerHideUntilNeeded = ($body.is('[data-hhun]')) ? $body.attr('data-hhun') : '', 39 $animationEasing = ($body.is('[data-cae]') && $body.attr('data-cae') !== 'swing' ) ? $body.attr('data-cae') : 'easeOutCubic', 40 $animationDuration = ($body.is('[data-cad]')) ? $body.attr('data-cad') : '650', 41 bypassAnimations = (!$body.is('[data-m-animate="1"]') && navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) ) ? true : false, 42 $portfolio_containers = [], 43 $svgIcons = [], 44 $nectarCustomSliderRotate = [], 45 $flickitySliders = [], 46 flickityDragArr = [], 47 viewIndicatorArr = [], 48 iconMouseFollowArr = [], 49 postGridImgMouseFollowArr = [], 50 $fsProjectSliderArr = [], 51 $wooFlickityCarousels = [], 52 $liquidBG_EL = [], 53 $testimonialSliders = [], 54 $mouseParallaxScenes = [], 55 $nectarMasonryBlogs = [], 56 $standAnimatedColTimeout = [], 57 $animatedSVGIconTimeout = [], 58 $projectCarouselSliderArr = [], 59 $nectarPostGridArr = [], 60 $verticalScrollingTabs = [], 61 $tabbedClickCount = 0, 62 $fullscreenSelector = '', 63 $fullscreenMarkupBool = false, 64 $bodyBorderHeaderColorMatch = false, 65 nectarBoxRoll = { 66 animating: 'false', 67 perspect: 'not-rolled' 68 }, 69 $nectarFullPage = { 70 $usingFullScreenRows: false 71 }, 72 $svgResizeTimeout, 73 $bodyBorderSizeToRemove; 74 75 if( $bodyBorderTop.length > 0 ) { 76 77 if ( $bodyBorderTop.css('background-color') == '#ffffff' && $body.attr('data-header-color') == 'light' || 78 $bodyBorderTop.css('background-color') == 'rgb(255, 255, 255)' && $body.attr('data-header-color') == 'light' || 79 $bodyBorderTop.css('background-color') == $headerOuterEl.attr('data-user-set-bg')) { 80 $bodyBorderHeaderColorMatch = true; 81 } 82 83 } 84 85 86 87 /** 88 * Nectar DOM info helper. 89 * 90 * @since 9.0 91 */ 92 var nectarDOMInfo = { 93 94 usingMobileBrowser: (navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) ? true : false, 95 usingFrontEndEditor: (typeof window.vc_iframe === 'undefined') ? false : true, 96 getWindowSize: function() { 97 nectarDOMInfo.winH = window.innerHeight; 98 nectarDOMInfo.winW = window.innerWidth; 99 nectarDOMInfo.adminBarHeight = ($wpAdminBar.length > 0) ? $wpAdminBar.height() : 0; 100 nectarDOMInfo.secondaryHeaderHeight = ($headerSecondaryEl.length > 0 && $headerSecondaryEl.css('display') != 'none') ? $headerSecondaryEl.outerHeight() : 0; 101 nectarDOMInfo.footerOuterHeight = ($footerOuterEl.length > 0) ? $footerOuterEl.outerHeight() : 0; 102 }, 103 scrollTop: 0, 104 clientX: 0, 105 clientY: 0, 106 scrollPosMouse: function() { 107 return $window.scrollTop(); 108 }, 109 scrollPosRAF: function() { 110 nectarDOMInfo.scrollTop = $window.scrollTop(); 111 requestAnimationFrame(nectarDOMInfo.scrollPosRAF); 112 }, 113 bindEvents: function() { 114 115 if (!nectarDOMInfo.usingMobileBrowser) { 116 $window.on('scroll', function() { 117 nectarDOMInfo.scrollTop = nectarDOMInfo.scrollPosMouse(); 118 }); 119 } else { 120 requestAnimationFrame(nectarDOMInfo.scrollPosRAF); 121 } 122 123 document.addEventListener("mousemove", function(e) { 124 nectarDOMInfo.clientX = e.clientX; 125 nectarDOMInfo.clientY = e.clientY; 126 }); 127 128 $window.on('resize', nectarDOMInfo.getWindowSize); 129 130 }, 131 init: function() { 132 // Re-cache WP admin bar after DOM ready 133 $wpAdminBar = $('#wpadminbar'); 134 135 // Get values and bind events 136 this.getWindowSize(); 137 this.scrollTop = this.scrollPosMouse(); 138 this.bindEvents(); 139 140 this.usingFrontEndEditor = (typeof window.vc_iframe === 'undefined') ? false : true; 141 } 142 143 }; 144
145 146 147 148 /** 149 * Debounced resize event 150 * 151 * @since 2.0 152 */ 153 154 function smartResizeInit() { 155 fullWidthContentColumns(); 156 parallaxRowsBGCals(); 157 headerSpace(); 158 OCM_overflowState(); 159 showOnLeftSubMenu(); 160 } 161 162 163 164 /** 165 * Main resize event. 166 * 167 * @since 2.0 168 */ 169 function resizeInit() { 170 fullWidthSections(); 171 fullWidthContentColumns(); 172 addOrRemoveSF(); 173 responsiveVideoIframes(); 174 175 if (!nectarDOMInfo.usingMobileBrowser) { 176 parallaxRowsBGCals(); 177 } 178 179 } 180 181 182 183 /** 184 * Flexslider plugin initialization. 185 * 186 * @since 5.0 187 */ 188 function flexsliderInit() { 189 $('.flex-gallery').each(function () { 190 191 if (!$().flexslider) { 192 return; 193 } 194 195 var $that = $(this); 196 197 imagesLoaded($(this), function () { 198 199 $that.flexslider({ 200 animation: 'fade', 201 smoothHeight: false, 202 animationSpeed: 500, 203 useCSS: false, 204 touch: true 205 }); 206 207 //gallery slider add arrows 208 $('.flex-gallery .flex-direction-nav li a.flex-next').html('<i class="fa fa-angle-right"></i>'); 209 $('.flex-gallery .flex-direction-nav li a.flex-prev').html('<i class="fa fa-angle-left"></i>'); 210 211 }); 212 213 }); 214 } 215 216 217 218 /** 219 * Icon follow. 220 * 221 * @since 11.0 222 */ 223 function NectarIconMouseFollow($el, iconType) { 224 225 this.lastX = nectarDOMInfo.clientX; 226 this.lastY = nectarDOMInfo.clientY; 227 this.$el = $el; 228 this.iconType = iconType; 229 this.timeout = false; 230 this.overEl = false; 231 this.$dragEl = ''; 232 this.$viewEl = ''; 233 this.$closeEl = ''; 234 this.lerpDamp = 0.18; 235 236 this.createMarkup(); 237 this.mouseBind(); 238 } 239 240 NectarIconMouseFollow.prototype.createMarkup = function() { 241 242 if( this.iconType === 'horizontal-movement' ) { 243 244 if( $('.nectar-drag-indicator').length == 0 ) { 245 var $usingBoxedClass = ($('body > #boxed').length > 0) ? ' in-boxed' : ''; 246 $('body').append('<div class="nectar-drag-indicator' + $usingBoxedClass + '"><span><i class="fa fa-angle-left"></i><i class="fa fa-angle-right"></i></span></div>'); 247 this.$dragEl = $('.nectar-drag-indicator'); 248 this.dragRAF(); 249 } else { 250 this.$dragEl = $('.nectar-drag-indicator'); 251 } 252 253 254 } 255 256 if( this.iconType === 'view-indicator' ) { 257 258 if( $('.nectar-view-indicator').length == 0 ) { 259 var $usingBoxedClass = ($('body > #boxed').length > 0) ? ' in-boxed' : ''; 260 $('body').append('<div class="nectar-view-indicator' + $usingBoxedClass + '"><div class="color-circle"></div><span></span></div>'); 261 $('.nectar-view-indicator span').text( $('.nectar-post-grid').attr('data-indicator-text') ); 262 this.$viewEl = $('.nectar-view-indicator'); 263 this.viewRAF(); 264 } else { 265 this.$viewEl = $('.nectar-view-indicator'); 266 } 267 268 } 269 270 if( this.iconType === 'close-indicator' ) { 271 if( $('.nectar-view-indicator').length == 0 ) { 272 var $usingBoxedClass = ($('body > #boxed').length > 0) ? ' in-boxed' : ''; 273 $('body').append('<div class="nectar-close-indicator' + $usingBoxedClass + '"><div class="inner"></div></div>'); 274 this.$closeEl = $('.nectar-close-indicator'); 275 this.closeRAF(); 276 } else { 277 this.$closeEl = $('.nectar-close-indicator'); 278 } 279 280 } 281 282 if( this.iconType === 'post-grid-images' ) { 283 284 if( !this.$el.hasClass('mouse-move-bound') ) { 285 this.$viewEl = this.$el.find('.nectar-post-grid-item-bg-wrap'); 286 this.$el.addClass('mouse-move-bound'); 287 this.viewRAF(); 288 } else { 289 this.$viewEl = this.$el.find('.nectar-post-grid-item-bg-wrap'); 290 this.viewRAF(); 291 } 292 293 } 294 295 } 296 297 NectarIconMouseFollow.prototype.mouseBind = function() { 298 299 var that = this; 300 301 if( this.iconType === 'horizontal-movement' ) { 302 303 that.$el.find('.flickity-viewport').on('mouseenter', function() { 304 that.$dragEl.addClass('visible'); 305 }); 306 307 that.$el.find('.flickity-viewport').on('mouseleave', function() { 308 that.$dragEl.removeClass('visible'); 309 }); 310 311 } else if( this.iconType === 'close-indicator' ) { 312 313 $('body').on('click','.team-member[data-style*="bio_fullscreen"]',function(){ 314 315 if ($('.nectar_team_member_overlay:not(.open)').length > 0) { 316 return; 317 } 318 319 that.$closeEl.addClass('visible'); 320 that.$closeEl.find('.inner').addClass('visible'); 321 }); 322 323 $('body').on('click','.nectar_team_member_overlay:not(.animating)',function(){ 324 that.$closeEl.removeClass('visible'); 325 that.$closeEl.find('.inner').removeClass('visible'); 326 }); 327 328 // Handle social links. 329 $('body').on('mouseenter', '.nectar_team_member_overlay .bottom_meta a', function() { 330 that.$closeEl.removeClass('visible'); 331 }); 332 $('body').on('mouseleave', '.nectar_team_member_overlay .bottom_meta a', function() { 333 that.$closeEl.addClass('visible'); 334 }); 335 336 } 337 else if( this.iconType === 'view-indicator' ) { 338 339 var $color = that.$el.attr('data-indicator-color'); 340 var $style = that.$el.attr('data-indicator-style'); 341 342 // unbind first. 343 that.$el.find('.nectar-post-grid-item').off(); 344 345 that.$el.find('.nectar-post-grid-item').on('mouseenter', function() { 346 347 that.$viewEl.addClass('visible'); 348 349 // Handle style class. 350 that.$viewEl.attr('class', function(i, c){ 351 return c.replace(/(^|\s)style-\S+/g, ''); 352 }); 353 that.$viewEl.addClass('style-'+$style); 354 if( $style !== 'see-through' ) {
355 that.$viewEl.find('.color-circle').css('background-color', $color); 356 } 357 358 clearTimeout(that.timeout); 359 }); 360 361 that.$el.find('.nectar-post-grid-item').on('mouseleave', function() { 362 that.timeout = setTimeout(function(){ 363 that.$viewEl.removeClass('visible'); 364 },100); 365 366 }); 367 368 // Handle category links. 369 that.$el.find('.nectar-post-grid-item .meta-category a').on('mouseenter', function() { 370 that.$viewEl.removeClass('visible'); 371 }); 372 that.$el.find('.nectar-post-grid-item .meta-category a').on('mouseleave', function() { 373 that.$viewEl.addClass('visible'); 374 }); 375 376 } 377 378 else if( this.iconType === 'post-grid-images' ) { 379 that.$el.on('mouseenter', function() { 380 $(this).addClass('mouse-over'); 381 }); 382 that.$el.on('mouseleave', function() { 383 $(this).removeClass('mouse-over'); 384 }); 385 } 386 387 }; 388 389 NectarIconMouseFollow.prototype.dragRAF = function() { 390 391 this.lastY = linearInterpolate(this.lastY, nectarDOMInfo.clientY, this.lerpDamp); 392 this.lastX = linearInterpolate(this.lastX, nectarDOMInfo.clientX, this.lerpDamp); 393 394 this.$dragEl.css({ 395 'transform': 'translateX(' + this.lastX + 'px) translateY(' + this.lastY + 'px)' 396 }); 397 398 requestAnimationFrame(this.dragRAF.bind(this)); 399 400 }; 401 402 NectarIconMouseFollow.prototype.viewRAF = function() { 403 404 this.lastY = linearInterpolate(this.lastY, nectarDOMInfo.clientY, this.lerpDamp); 405 this.lastX = linearInterpolate(this.lastX, nectarDOMInfo.clientX, this.lerpDamp); 406 407 this.$viewEl.css({ 408 'transform' : 'translateX(' + this.lastX + 'px) translateY(' + this.lastY + 'px)' 409 }); 410 411 requestAnimationFrame(this.viewRAF.bind(this)); 412 413 }; 414 415 NectarIconMouseFollow.prototype.closeRAF = function() { 416 417 this.lastY = linearInterpolate(this.lastY, nectarDOMInfo.clientY, this.lerpDamp); 418 this.lastX = linearInterpolate(this.lastX, nectarDOMInfo.clientX, this.lerpDamp); 419 420 this.$closeEl.css({ 421 'transform': 'translateX(' + this.lastX + 'px) translateY(' + this.lastY + 'px)' 422 }); 423 424 requestAnimationFrame(this.closeRAF.bind(this)); 425 426 }; 427 428 429 430 /** 431 * Flickity lazy image helper 432 * 433 * Needed to calculate the space which 434 * lazy loaded images will eventually occupy. 435 * 436 * @since 11.0 437 */ 438 function flickityLazyCalcs() { 439 440 $('.wpb_gallery_slidesflickity_static_height_style .cell[data-lazy="true"]').each(function() { 441 442 $(this).css({ 443 'height': '', 444 'width' : '' 445 }); 446 447 var heightAttr = parseInt($(this).find('img').attr('height')); 448 var widthAttr = parseInt($(this).find('img').attr('width')); 449 450 var dimensions = calculateAspectRatio( widthAttr, heightAttr, 2000, parseInt($(this).find('img').height()) ); 451 452 $(this).css({ 453 'height': dimensions.height + 'px', 454 'width' : dimensions.width + 'px' 455 }); 456 457 }); 458 459 } 460 461 462 /** 463 * Flickity lazy initialization. 464 * 465 * @since 11.0 466 */ 467 function flickityLazyInit() { 468 // Lazy assist. 469 if( $('.wpb_gallery_slidesflickity_static_height_style .cell[data-lazy="true"]').length > 0 ) { 470 flickityLazyCalcs(); 471 $window.on('smartresize',flickityLazyCalcs); 472 } 473 } 474 475 476 /** 477 * Flickity plugin initialization. 478 * 479 * @since 7.0 480 */ 481 function flickityInit() { 482 483 if ($('.nectar-flickity:not(.masonry)').length == 0) { 484 return false; 485 } 486 487 $flickitySliders = []; 488 flickityDragArr = []; 489 490 491 $('.nectar-flickity:not(.masonry)').each(function (i) { 492 493 $(this).removeClass(function (index, className) { 494 return (className.match(/(^|\s)instance-\S+/g) || []).join(' '); 495 }); 496 $(this).addClass('instance-' + i); 497 498 var $freeScrollBool = ($(this).is('[data-free-scroll]') && $(this).attr('data-free-scroll') == 'true') ? true : false, 499 $groupCellsBool = true, 500 $flickContainBool = true, 501 $flcikAttr = 0.025, 502 $paginationBool = false, 503 $nextPrevArrowBool = true, 504 $flickCellAlign = 'center'; 505 506 if ($(this).is('[data-format="fixed_text_content_fullwidth"]')) { 507 508 $flickCellAlign = 'left'; 509 $groupCellsBool = false;
510 $flickContainBool = false; 511 $flcikAttr = 0.02; 512 513 if( $(this).parent().is('[data-alignment="right"]') ) { 514 $flickCellAlign = 'right'; 515 } 516 517 } 518 519 if ($freeScrollBool == true ) { 520 $groupCellsBool = false; 521 } 522 523 524 if ($(this).attr('data-controls').length > 0 && 525 $(this).attr('data-controls') == 'next_prev_arrows'|| 526 $(this).attr('data-controls').length > 0 && 527 $(this).attr('data-controls') == 'next_prev_arrows_overlaid') { 528 $paginationBool = false; 529 $nextPrevArrowBool = true; 530 } else { 531 $paginationBool = true; 532 $nextPrevArrowBool = false; 533 } 534 535 536 if ($(this).attr('data-controls').length > 0 && 537 $(this).attr('data-controls') == 'none') { 538 $paginationBool = false; 539 $nextPrevArrowBool = false; 540 } 541 542 var $flickity_autoplay = false; 543 544 if ($(this).is('[data-autoplay]') && 545 $(this).attr('data-autoplay') == 'true') { 546 547 $flickity_autoplay = true; 548 549 if ($(this).is('[data-autoplay-dur]') && 550 $(this).attr('data-autoplay-dur').length > 0) { 551 552 if (parseInt($(this).attr('data-autoplay-dur')) > 100 && 553 parseInt($(this).attr('data-autoplay-dur')) < 30000) { 554 $flickity_autoplay = parseInt($(this).attr('data-autoplay-dur')); 555 } 556 557 } 558 559 } 560 561 var $that = $(this); 562 var $frontEndEditorDrag = ($('body.vc_editor').length > 0) ? false : true; 563 var $frontEndEditorPause = ($('body.vc_editor').length > 0) ? true : false; 564 var $arrowShape = ''; 565 var $wrapAround = ( $(this).is('[data-wrap]') && $(this).attr('data-wrap') == 'no-wrap' ) ? false : true; 566 567 // Adaptive height. 568 var $flickity_adaptive_height = false; 569 if( $(this).is('[data-adaptive-height="true"]') ) { 570 $flickity_adaptive_height = true; 571 } 572 573 // Lazy load. 574 var $lazyload = ($(this).find('img[data-flickity-lazyload]')) ? 1 : false; 575 if( $(this).find('img[data-flickity-lazyload]') && $(this).is('[data-overflow="visible"]') && $(this).is('[data-wrap="no-wrap"]') ) { 576 $lazyload = 2; 577 } 578 579 // RTL. 580 var $flickity_rtl = ( $body.hasClass('rtl') ) ? true : false; 581 582 // Arrow shape. 583 if( $(this).attr('data-controls').length > 0 && $(this).attr('data-controls') == 'next_prev_arrows_overlaid' || 584 $(this).attr('data-controls').length > 0 && $(this).attr('data-controls') == 'touch_total' ) { 585 $arrowShape = { 586 x0: 10, 587 x1: 60, y1: 50, 588 x2: 70, y2: 40, 589 x3: 30 590 } 591 } else { 592 $arrowShape = { 593 x0: 20, 594 x1: 70, 595 y1: 30, 596 x2: 70, 597 y2: 25, 598 x3: 70 599 } 600 } 601 602 $flickitySliders[i] = new Flickity('.nectar-flickity.instance-' + i, { 603 contain: $flickContainBool, 604 draggable: $frontEndEditorDrag, 605 lazyLoad: $lazyload, 606 imagesLoaded: true, 607 percentPosition: true, 608 adaptiveHeight: $flickity_adaptive_height, 609 cellAlign: $flickCellAlign, 610 groupCells: $groupCellsBool, 611 prevNextButtons: $nextPrevArrowBool, 612 freeScroll: $freeScrollBool, 613 pageDots: $paginationBool, 614 resize: true, 615 selectedAttraction: $flcikAttr, 616 autoPlay: $flickity_autoplay, 617 rightToLeft: $flickity_rtl, 618 pauseAutoPlayOnHover: $frontEndEditorPause, 619 setGallerySize: true, 620 wrapAround: $wrapAround, 621 accessibility: false, 622 arrowShape: $arrowShape 623 }); 624 625 626 // Visualized total controls 627 if( $(this).is('[data-controls="touch_total"]') ) { 628 629 // Create markup. 630 if( $(this).find('.visualized-total').length == 0 ) { 631 if( $(this).parents('.full-width-content').length > 0 && $(this).parents('.vc_col-sm-12').length > 0 ) { 632 $(this).append('<div class="container normal-container"><div class="visualized-total"><span></span></div></div>'); 633 } else { 634 $(this).append('<div class="visualized-total"><span></span></div>'); 635 } 636 } 637 638 639 // Init drag indicator. 640 if( !nectarDOMInfo.usingMobileBrowser ) { 641 642 flickityDragArr[i] = new NectarIconMouseFollow($(this),'horizontal-movement'); 643 644 $flickitySliders[i].on('dragMove', function (event, pointer) { 645 nectarDOMInfo.clientY = pointer.clientY; 646 nectarDOMInfo.clientX = pointer.clientX; 647 }); 648 649 $flickitySliders[i].on('pointerDown', function (event, pointer) { 650 $('.nectar-drag-indicator').addClass('pointer-down'); 651 }); 652 $flickitySliders[i].on('pointerUp', function (event, pointer) { 653 $('.nectar-drag-indicator').removeClass('pointer-down'); 654 }); 655 656 } 657 658 var $totalImgs = $(this).find('.flickity-page-dots li').length; 659 var $totalIndicator = $(this).find('.visualized-total span'); 660 var $totalPosition = 1; 661 var $totalWidth = $(this).find('.visualized-total').width(); 662 663 $window.on('smartresize',function() { 664 665 setTimeout(function() { 666 667 $totalImgs = $that.find('.flickity-page-dots li').length; 668 $totalWidth = $that.find('.visualized-total').width(); 669 670 $totalPosition = ($totalWidth / $totalImgs) * $that.find('.flickity-page-dots .is-selected').index(); 671 672 // Update pos on interaction. 673 $totalIndicator.css('width', 100/$totalImgs + '%'); 674 $totalIndicator.css({ 675 'x' : $totalPosition + 'px' 676 }); 677 678 },200); 679 680 }); 681 682 // Set initial total tracker width. 683 setTimeout(function(){ 684 $totalImgs = $that.find('.flickity-page-dots li').length; 685 $totalWidth = $that.find('.visualized-total').width(); 686 687 $totalIndicator.css('width', 100/$totalImgs + '%'); 688 },200); 689 690 $flickitySliders[i].on('change', function (event, progress) { 691 692 $totalPosition = ($totalWidth / $totalImgs) * $that.find('.flickity-page-dots .is-selected').index(); 693 694 // Update pos on interaction. 695 $totalIndicator.css({ 696 'x' : $totalPosition + 'px' 697 }); 698 699 }); 700 701 } 702 703 704 // Fixed text content style 705 if ($(this).is('[data-format="fixed_text_content_fullwidth"]') && !nectarDOMInfo.usingFrontEndEditor) { 706 707 var $onMobileBrowser = nectarDOMInfo.usingMobileBrowser; 708 709 $flickitySliders[i].on('scroll', function () { 710 711 if ($onMobileBrowser) { 712 return; 713 } 714 715 var $flkSlideWidth = $that.find('.cell').outerWidth() + 25, 716 $leftHeaderSize = ($('body[data-header-format="left-header"]').length > 0 && $window.width() > 1000) ? 275 : 0, 717 $extraWindowSpace = (($window.width() + $leftHeaderSize) - $that.parents('.main-content').width()) / 2; 718 719 $extraWindowSpace += parseInt($that.css('margin-left')) + 2; 720
721 $flickitySliders[i].slides.forEach(function (slide, j) { 722 723 var $scaleAmt = 1, 724 $translateXAmt = 0, 725 $rotateAmt = 0, 726 $slideZIndex = 10, 727 $opacityAmt = 1, 728 $slideOffset = $(slide.cells[0].element).offset().left, 729 flkInstanceSlide = $('.nectar-flickity.instance-' + i + ' .cell:nth-child(' + (j + 1) + ')'); 730 731 if ($slideOffset - $extraWindowSpace < 0 && 732 $slideOffset - $extraWindowSpace > $flkSlideWidth * -1) { 733 734 $scaleAmt = 1 + (($slideOffset - $extraWindowSpace) / 1500); 735 $opacityAmt = 1 + (($slideOffset - $extraWindowSpace + 70) / 550); 736 $translateXAmt = (($slideOffset - $extraWindowSpace)) * -1; 737 $rotateAmt = (($slideOffset - $extraWindowSpace) / 25) * -1; 738 739 } else { 740 $scaleAmt = 1; 741 $opacityAmt = 1; 742 $translateXAmt = 0; 743 $rotateAmt = 0; 744 } 745 746 if ($slideOffset + 5 - $extraWindowSpace < 0 && 747 $slideOffset - $extraWindowSpace > $flkSlideWidth * -1) { 748 749 $slideZIndex = 5; 750 } else { 751 $slideZIndex = 10; 752 } 753 754 flkInstanceSlide.css({ 755 'z-index': $slideZIndex 756 }); 757 758 flkInstanceSlide.find('.inner-wrap-outer').css({ 759 'transform': 'perspective(800px) translateX(' + $translateXAmt + 'px) rotateY(' + $rotateAmt + 'deg) translateZ(0)', 760 'opacity': $opacityAmt 761 }); 762 763 flkInstanceSlide.find('.inner-wrap').css({ 764 'transform': 'scale(' + $scaleAmt + ') translateZ(0)' 765 }); 766 767 }); 768 769 }); 770 771 } 772 773 var $removeHiddenTimeout; 774 var $removeMovingTimeout; 775 776 $flickitySliders[i].on('dragStart', function () { 777 778 clearTimeout($removeHiddenTimeout); 779 clearTimeout($removeMovingTimeout); 780 $that.addClass('is-dragging'); 781 $that.addClass('is-moving'); 782 783 $that.find('.flickity-prev-next-button').addClass('hidden'); 784 }); 785 786 $flickitySliders[i].on('dragEnd', function () { 787 788 $that.removeClass('is-dragging'); 789 790 $removeHiddenTimeout = setTimeout(function () { 791 792 $that.removeClass('is-moving'); 793 $that.find('.flickity-prev-next-button').removeClass('hidden'); 794 795 }, 600); 796 797 $removeMovingTimeout = setTimeout(function () { 798 $that.removeClass('is-moving'); 799 }, 300); 800 801 }); 802 803 $('.flickity-prev-next-button').on('click', function () { 804 805 clearTimeout($removeHiddenTimeout); 806 807 $(this).parents('.nectar-flickity') 808 .find('.flickity-prev-next-button') 809 .addClass('hidden'); 810 811 $removeHiddenTimeout = setTimeout(function () { 812 $that 813 .find('.flickity-prev-next-button') 814 .removeClass('hidden'); 815 }, 600); 816 817 }); 818 819 820 // Images loaded. 821 if ($that.hasClass('nectar-carousel')) { 822 imagesLoaded($that, function () { 823 nectarCarouselFlkEH($that); 824 }); 825 } 826 827 }); 828 829 830 // Resize event. 831 var $usingNectarCarouselFlk = ($('.nectar-carousel.nectar-flickity:not(.masonry)').length > 0) ? true : false; 832 833 if ($usingNectarCarouselFlk) { 834 $window.on('resize',setNectarCarouselFlkEH); 835 } 836 837 } 838 839 840 841 842 843 /** 844 * Flickity equal height helper. 845 * 846 * @since 7.0 847 */ 848 function setNectarCarouselFlkEH() { 849 $('.nectar-carousel.nectar-flickity:not(.masonry)').each(function () { 850 nectarCarouselFlkEH($(this)); 851 }); 852 } 853 854 855 856 /** 857 * Flickity equal height calculations. 858 * 859 * @since 7.0 860 */ 861 function nectarCarouselFlkEH($slider_instance) { 862 863 var $tallestSlideCol = 0; 864 865 $slider_instance 866 .find('.flickity-slider > .cell') 867 .css('height', 'auto'); 868 869 $slider_instance.find('.flickity-slider > .cell').each(function () { 870 871 if( $(this).height() > $tallestSlideCol ) { 872 $tallestSlideCol = $(this).height(); 873 } 874 875 }); 876 877 if ($tallestSlideCol < 10) { 878 $tallestSlideCol = 'auto'; 879 } 880 881 //set even height 882 $slider_instance 883 .find('.flickity-slider > .cell') 884 .css('height', $tallestSlideCol + 'px'); 885 886 } 887 888 889 890 /** 891 * twentytwenty plugin initialization. 892 * 893 * @since 7.0 894 */
895 function twentytwentyInit() { 896 $('.twentytwenty-container').each(function () { 897 var $that = $(this); 898 899 if ($that.find('.twentytwenty-handle').length == 0) { 900 $(this).imagesLoaded(function () { 901 $that.twentytwenty(); 902 }); 903 } 904 905 }); 906 } 907 908 909 910 911 912 /** 913 * Superfish initialization and submenu functionality. 914 * 915 * @since 2.0 916 */ 917 function initSF() { 918 919 addOrRemoveSF(); 920 921 if ($('body[data-header-format="left-header"]').length == 0) { 922 923 var $disableHI; 924 925 if (!($('#header-outer[data-megamenu-rt="1"]').length > 0 && 926 $('#header-outer[data-transparent-header="true"]').length > 0)) { 927 $disableHI = true; 928 } else { 929 $disableHI = false; 930 } 931 932 $(".sf-menu:not(.buttons)").superfish({ 933 delay: 650, 934 speed: 'fast', 935 disableHI: $disableHI, 936 speedOut: 'fast', 937 animation: { 938 opacity: 'show' 939 } 940 }); 941 942 // Pull right/left menu 943 $('#header-outer .sf-menu.buttons li.menu-item').on('mouseover',function(){ 944 $(this).addClass('sfHover'); 945 }); 946 $('#header-outer .sf-menu.buttons li.menu-item').on('mouseleave',function(){ 947 var $that = $(this); 948 949 if( $that.is('.menu-item-has-children') ) { 950 setTimeout(function () { 951 if( !$that.is(':hover') ) { 952 $that.removeClass('sfHover'); 953 } 954 }, 200); 955 } else { 956 $that.removeClass('sfHover'); 957 } 958 }); 959 960 // Areas that do not use megamenu. 961 $('#header-secondary-outer li.megamenu, .sf-menu.buttons li.megamenu').removeClass('megamenu'); 962 963 $('#header-outer .sf-menu > li:not(.megamenu) > ul > li > ul').each(function () { 964 965 if ($(this).offset().left + $(this).outerWidth() > $window.width()) { 966 $(this).addClass('on-left-side'); 967 $(this).find('ul').addClass('on-left-side'); 968 } 969 970 }); 971 972 // Megamenu multi section per column title support. 973 $('body:not([data-header-format="left-header"]) header#top nav > ul > li.megamenu > ul > li > ul > li:has("> ul")').addClass('has-ul'); 974 975 // Full width megamenu. 976 if ($('body[data-megamenu-width="full-width"]').length > 0 && $('ul.sub-menu').length > 0) { 977 megamenuFullwidth(); 978 $window.on('smartresize', megamenuFullwidth); 979 $('header#top nav > ul > li.megamenu > .sub-menu').css('box-sizing', 'content-box'); 980 } 981 982 // Extra hover class for megamenu check. 983 $('header#top nav > ul.sf-menu > li.menu-item').on('mouseenter', function () { 984 $(this).addClass('menu-item-over'); 985 }); 986 $('header#top nav > ul.sf-menu > li.menu-item').on('mouseleave', function () { 987 $(this).removeClass('menu-item-over'); 988 }); 989 990 // Remove arrows on mega menu item. 991 $('header#top nav .megamenu .sub-menu a.sf-with-ul .sf-sub-indicator, header#top .megamenu .sub-menu a .sf-sub-indicator').remove(); 992 993 // Blank title megamenu columns. 994 $('header#top nav > ul > li.megamenu > ul.sub-menu > li > a').each(function () { 995 if ($(this).text() == '-' || $(this).text() == '–' || $(this).parent().hasClass('hide-title')) { 996 $(this).remove(); 997 } 998 }); 999 1000 } 1001 1002 1003 // Deactivate hide header until needed effect on phone. 1004 if (nectarDOMInfo.usingMobileBrowser && $('#header-outer[data-remove-fixed="1"]').length == 0) { 1005 $body.attr('data-hhun', '0'); 1006 } 1007 1008 } 1009 1010 1011 1012 /** 1013 * Calculates the "Header Mega Menu Width - Full screen width" theme option. 1014 * 1015 * @since 6.0 1016 */ 1017 function megamenuFullwidth() { 1018 1019 var $windowWidth = $window.width(); 1020 var $headerContainerWidth = $('header#top > .container').width(); 1021 $('header#top nav > ul > li.megamenu > .sub-menu').css({ 1022 'padding-left': ($windowWidth - $headerContainerWidth) / 2 + 'px', 1023 'padding-right': ($windowWidth + 2 - $headerContainerWidth) / 2 + 'px', 1024 'width': $headerContainerWidth, 1025 'left': '-' + ($windowWidth - $headerContainerWidth) / 2 + 'px' 1026 }); 1027 } 1028 1029 1030 /** 1031 * Hide main navigation on mobile. 1032 * 1033 * @since 2.0 1034 */ 1035 function addOrRemoveSF() { 1036 1037 if (nectarDOMInfo.winW < 1000 && $body.attr('data-responsive') == '1') { 1038 $body.addClass('mobile'); 1039 $('header#top nav').css('display', 'none'); 1040 } else { 1041 $body.removeClass('mobile'); 1042 $('header#top nav').css('display', ''); 1043 $('.slide-out-widget-area-toggle #toggle-nav .lines-button').removeClass('close'); 1044 } 1045 1046 1047 } 1048 1049 1050 /** 1051 * Calculates whether submenu needs to display aligned opposite (from lack of space). 1052 * 1053 * @since 2.0 1054 */ 1055 function showOnLeftSubMenu() { 1056 1057 // Show on left class for minimal styling. 1058 $('#header-outer .sf-menu > li:not(.megamenu) > ul > li > ul').each(function () { 1059 1060 $(this).removeClass('on-left-side'); 1061 1062 if ($(this).offset().left + $(this).outerWidth() > $window.width()) { 1063 $(this).addClass('on-left-side'); 1064 $(this).find('ul').addClass('on-left-side'); 1065 } else { 1066 $(this).removeClass('on-left-side'); 1067 $(this).find('ul').removeClass('on-left-side'); 1068 } 1069 1070 }); 1071 } 1072 1073 1074 1075 1076 /** 1077 * Caroufredsel plugin initialization. 1078 * 1079 * @since 2.0 1080 */ 1081 function standardCarouselInit() { 1082 1083 if ($('.carousel').length == 0) { 1084 return; 1085 } 1086 1087 if (typeof SalientRecentProjectsCarousel !== 'undefined') { 1088 $('ul.carousel.portfolio-items').each(function (i) { 1089 $projectCarouselSliderArr[i] = new SalientRecentProjectsCarousel($(this)); 1090 }); 1091 } 1092 1093 $('ul.carousel:not(".clients"):not(.portfolio-items)').each(function () { 1094 1095 var $that = $(this), 1096 maxCols = ($(this).parents('.carousel-wrap').attr('data-full-width') == 'true') ? 'auto' : 3, 1097 scrollNum = ($(this).parents('.carousel-wrap').attr('data-full-width') == 'true') ? 'auto' : '', 1098 colWidth = ($(this).parents('.carousel-wrap').attr('data-full-width') == 'true') ? 500 : 453, 1099 $autoplayBool = ($(this).attr('data-autorotate') == 'true') ? true : false, 1100 $themeSkin = true, 1101 $themeSkin2 = true; 1102 1103 var scrollSpeed, easing; 1104 1105 if ($('body.ascend').length > 0 && $(this).parents('.carousel-wrap').attr('data-full-width') != 'true' || 1106 $('body.material').length > 0 && $(this).parents('.carousel-wrap').attr('data-full-width') != 'true') { 1107 1108 if ($(this).find('li').length % 3 === 0) { 1109 $themeSkin = true; 1110 $themeSkin2 = true; 1111 } else { 1112 $themeSkin = false;
1113 $themeSkin2 = true; 1114 } 1115 1116 } else { 1117 $themeSkin = true; 1118 $themeSkin2 = true; 1119 } 1120 1121 scrollSpeed = (parseInt($(this).attr('data-scroll-speed'))) ? parseInt($(this).attr('data-scroll-speed')) : 700; 1122 easing = ($(this).is('[data-easing]')) ? $(this).attr('data-easing') : 'linear'; 1123 1124 var $element = $that; 1125 if ($that.find('img').length == 0) { 1126 $element = $body; 1127 } 1128 1129 imagesLoaded($element, function () { 1130 1131 $that.carouFredSel({ 1132 circular: $themeSkin, 1133 infinite: $themeSkin2, 1134 height: 'auto', 1135 responsive: true, 1136 items: { 1137 width: colWidth, 1138 visible: { 1139 min: 1, 1140 max: maxCols 1141 } 1142 }, 1143 swipe: { 1144 onTouch: true, 1145 onMouse: true, 1146 options: { 1147 excludedElements: "button, input, select, textarea, .noSwipe", 1148 tap: function (event, target) { 1149 if ($(target).attr('href') && 1150 !$(target).is('[target="_blank"]') && 1151 !$(target).is('[rel^="prettyPhoto"]') && 1152 !$(target).is('.magnific-popup') && 1153 !$(target).is('.magnific')) { 1154 window.open($(target).attr('href'), '_self'); 1155 } 1156 } 1157 }, 1158 onBefore: function () { 1159 // Hover effect. 1160 $that.find('.work-item').trigger('mouseleave'); 1161 $that.find('.work-item .work-info a').trigger('mouseup'); 1162 } 1163 }, 1164 scroll: { 1165 items: scrollNum, 1166 easing: easing, 1167 duration: scrollSpeed, 1168 onBefore: function () { 1169 1170 if ($('body.ascend').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true' || 1171 $('body.material').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true') { 1172 1173 $that.parents('.carousel-wrap') 1174 .find('.item-count .total') 1175 .html(Math.ceil($that.find('> li').length / $that.triggerHandler("currentVisible").length)); 1176 1177 } 1178 }, 1179 onAfter: function () { 1180 if ($('body.ascend').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true' || 1181 $('body.material').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true') { 1182 1183 $that.parents('.carousel-wrap') 1184 .find('.item-count .current') 1185 .html($that.triggerHandler('currentPage') + 1); 1186 1187 $that.parents('.carousel-wrap') 1188 .find('.item-count .total') 1189 .html(Math.ceil($that.find('> li').length / $that.triggerHandler("currentVisible").length)); 1190 1191 } 1192 } 1193 1194 }, 1195 prev: { 1196 button: function () { 1197 return $that.parents('.carousel-wrap').find('.carousel-prev'); 1198 } 1199 }, 1200 next: { 1201 button: function () { 1202 return $that.parents('.carousel-wrap').find('.carousel-next'); 1203 } 1204 }, 1205 auto: { 1206 play: $autoplayBool 1207 } 1208 }, {
1209 transition: true 1210 }).animate({ 1211 'opacity': 1 1212 }, 1300); 1213 1214 $that 1215 .parents('.carousel-wrap') 1216 .wrap('<div class="carousel-outer">'); 1217 1218 if ($that.parents('.carousel-wrap').attr('data-full-width') == 'true') { 1219 $that 1220 .parents('.carousel-outer') 1221 .css('overflow', 'visible'); 1222 } 1223 1224 // Add count for non full width ascend skin. 1225 if ($('body.ascend').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true' || 1226 $('body.material').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true') { 1227 $('<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')); 1228 } 1229 1230 $that.addClass('finished-loading'); 1231 1232 carouselHeightCalcs(); 1233 1234 }); 1235 1236 }); 1237 1238 // Resize 1239 $window.off('smartresize.carouselHeightCalcs'); 1240 $window.on('smartresize.carouselHeightCalcs', carouselHeightCalcs); 1241 1242 } 1243 1244 1245 1246 1247 1248 1249 1250 /** 1251 * Full width carousel link event. 1252 * 1253 * @since 4.0 1254 */ 1255 function fwCarouselLinkFix() { 1256 1257 var $mousePosStart = 0, 1258 $mousePosEnd = 0, 1259 fwCarouselLinkSelector = '.carousel-wrap .portfolio-items .col .work-info a, .woocommerce .products-carousel ul.products li.product a'; 1260 1261 $(fwCarouselLinkSelector).on('mousedown', function (e) { 1262 $mousePosStart = e.clientX; 1263 }); 1264 1265 $(fwCarouselLinkSelector).on('mouseup', function (e) { 1266 $mousePosEnd = e.clientX; 1267 }); 1268 1269 $(fwCarouselLinkSelector).on('click', function () { 1270 if (Math.abs($mousePosStart - $mousePosEnd) > 10) { 1271 return false; 1272 } 1273 }); 1274 1275 } 1276 1277 1278 1279 1280 1281 /** 1282 * Owl carousel plugin initialization. 1283 * 1284 * @since 6.0 1285 */ 1286 function owlCarouselInit() { 1287 1288 if ( $('.owl-carousel').length === 0 ) { 1289 return; 1290 } 1291 1292 $('.owl-carousel').each(function () { 1293 1294 $(this).addClass('owl-theme'); 1295 1296 var $that = $(this), 1297 $autoRotateBool = $that.attr('data-autorotate'), 1298 $autoRotateSpeed = $that.attr('data-autorotation-speed'), 1299 $owlLoopBool = ($that.is('[data-loop="true"]')) ? true : false, 1300 $owlRTL = ( $body.hasClass('rtl') ) ? true : false; 1301 1302 $(this).owlCarousel({ 1303 responsive: { 1304 0: { 1305 items: $(this).attr('data-mobile-cols') 1306 }, 1307 690: { 1308 items: $(this).attr('data-tablet-cols') 1309 }, 1310 1000: { 1311 items: $(this).attr('data-desktop-small-cols') 1312 }, 1313 1300: { 1314 items: $(this).attr('data-desktop-cols') 1315 } 1316 }, 1317 autoplay: $autoRotateBool, 1318 autoplayTimeout: $autoRotateSpeed, 1319 loop: $owlLoopBool, 1320 rtl: $owlRTL, 1321 smartSpeed: 350, 1322 onTranslate: function () { 1323 $that.addClass('moving'); 1324 }, 1325 onTranslated: function () { 1326 $that.removeClass('moving'); 1327 } 1328 1329 }); 1330 1331 $(this).on('changed.owl.carousel', function (event) { 1332 if (event.item.count - event.page.size == event.item.index) { 1333 1334 $(event.target).find('.owl-dots div:last') 1335 .addClass('active') 1336 .siblings() 1337 .removeClass('active'); 1338 } 1339 1340 }); 1341 1342 }); 1343 1344 } 1345 1346 1347 /** 1348 * Owl carousel animate items. 1349 * 1350 * @since 6.0 1351 */ 1352 function owl_carousel_animate() { 1353 1354 $($fullscreenSelector + '.owl-carousel[data-enable-animation="true"]').each(function () { 1355 1356 var $owlOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : 'bottom-in-view'; 1357 var $animationDelay = 0; 1358 1359 if($(this).is('[data-animation-delay]') && 1360 $(this).attr('data-animation-delay').length > 0 && 1361 $(this).attr('data-animation') != 'false') { 1362 $animationDelay = $(this).attr('data-animation-delay'); 1363 } 1364 1365 var $that = $(this); 1366 var waypoint = new Waypoint({ 1367 element: $that, 1368 handler: function () { 1369 1370 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 1371 waypoint.destroy(); 1372 return; 1373 } 1374 1375 setTimeout(function () { 1376 $that.find('.owl-stage > .owl-item').each(function (i) { 1377 1378 var $that = $(this); 1379 $that.delay(i * 200).transition({ 1380 'opacity': '1', 1381 'y': '0' 1382 }, 600, 'easeOutQuart'); 1383 }); 1384 $that.addClass('animated-in'); 1385 1386 }, $animationDelay); 1387 1388 waypoint.destroy(); 1389 }, 1390 offset: $owlOffsetPos 1391 1392 }); 1393 1394 }); 1395 1396 } 1397 1398 1399 /** 1400 * Update WooCommerce Flickity count. 1401 * 1402 * Updates next/prev count for carousels on mobile devices. 1403 * 1404 * @since 9.0 1405 */ 1406 function updateWooFlickityCount(e) {
1407 var slideNumber = e.data.wooFlickity.selectedIndex + 1; 1408 e.data.wooFlickityCount.text(slideNumber + '/' + e.data.wooFlickity.slides.length); 1409 } 1410 1411 1412 1413 /** 1414 * Product carousel initialization. 1415 * 1416 * @since 4.0 1417 */ 1418 function productCarouselInit() { 1419 1420 if ($('.products-carousel').length === 0 && $('.nectar-woo-flickity').length === 0) { 1421 return; 1422 } 1423 1424 $('.products-carousel').each(function () { 1425 1426 var $that = $(this).find('ul'), 1427 maxCols = 'auto', 1428 scrollNum = 'auto', 1429 colWidth = ($(this).parents('.full-width-content ').length > 0) ? 400 : 353, 1430 scrollSpeed = 800, 1431 easing = 'easeInOutQuart'; 1432 1433 var $element = $that; 1434 if ($that.find('img').length == 0) { 1435 $element = $body; 1436 } 1437 1438 // Controls on hover. 1439 $(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>'); 1440 1441 imagesLoaded($element, function () { 1442 1443 $that.carouFredSel({ 1444 circular: true, 1445 responsive: true, 1446 items: { 1447 width: colWidth, 1448 visible: { 1449 min: 1, 1450 max: maxCols 1451 } 1452 }, 1453 swipe: { 1454 onTouch: true, 1455 onMouse: true, 1456 options: { 1457 excludedElements: "button, input, select, textarea, .noSwipe", 1458 tap: function (event, target) { 1459 1460 if ($(target).attr('href') && 1461 !$(target).is('[target="_blank"]') && 1462 !$(target).hasClass('add_to_wishlist') && 1463 !$(target).hasClass('add_to_cart_button') && 1464 !$(target).is('[rel^="prettyPhoto"]')) { 1465 window.open($(target).attr('href'), '_self'); 1466 } 1467 1468 if ($(target).parent().attr('href') && 1469 !$(target).parent().is('[target="_blank"]') && 1470 !$(target).parent().hasClass('add_to_wishlist') && 1471 !$(target).parent().hasClass('add_to_cart_button') && 1472 !$(target).parent().is('[rel^="prettyPhoto"]')) { 1473 window.open($(target).parent().attr('href'), '_self'); 1474 } 1475 1476 } 1477 }, 1478 onBefore: function () { 1479 $that.find('.product-wrap').trigger('mouseleave'); 1480 $that.find('.product a').trigger('mouseup'); 1481 } 1482 }, 1483 scroll: { 1484 items: scrollNum, 1485 easing: easing, 1486 duration: scrollSpeed 1487 }, 1488 prev: { 1489 button: function () { 1490 return $that.parents('.carousel-wrap').find('.carousel-prev'); 1491 } 1492 }, 1493 next: { 1494 button: function () { 1495 return $that.parents('.carousel-wrap').find('.carousel-next'); 1496 } 1497 }, 1498 auto: { 1499 play: false 1500 } 1501 }).animate({ 1502 'opacity': 1 1503 }, 1300); 1504 1505 $that.parents('.carousel-wrap').wrap('<div class="carousel-outer">'); 1506 1507 $that.addClass('finished-loading'); 1508 fullWidthContentColumns(); 1509 $window.trigger('resize'); 1510 1511 }); 1512 1513 1514 }); 1515 1516 1517 1518 $wooFlickityCarousels = []; 1519 $('.nectar-woo-flickity').each(function (i) { 1520 1521 var $that = $(this); 1522 1523 $(this).find('.products > li').each(function () { 1524 $(this).wrap('<div class="flickity-cell"></div>'); 1525 }); 1526 1527 fullWidthSections(); 1528 1529 var pageDotsBool = ($that.is('[data-controls="bottom-pagination"]')) ? true : false, 1530 arrowsBool = ($that.is('[data-controls="bottom-pagination"]')) ? false : true, 1531 $autoplay = ($that.is('[data-autorotate-speed]') && parseInt($that.attr('data-autorotate-speed')) > 800) ? parseInt($that.attr('data-autorotate-speed')) : 5000; 1532 1533 if (!$that.is('[data-autorotate="true"]')) { 1534 $autoplay = false; 1535 } 1536 1537 $(this).find('ul').addClass('generate-markup'); 1538 1539 $wooFlickityCarousels[i] = $(this).find('ul'); 1540 1541 if (arrowsBool == true) { 1542 $wooFlickityCarousels[i].on('ready.flickity', function () { 1543 var flickityPrv = $that.find('.flickity-prev-next-button.previous').detach(); 1544 var flickityNxt = $that.find('.flickity-prev-next-button.next').detach(); 1545 1546 $that.find('.nectar-woo-carousel-top').append(flickityPrv).append(flickityNxt); 1547 }); 1548 } 1549 1550 // RTL. 1551 var $flickity_rtl = false;
1552 var $flickity_rtl_cell_align = 'left'; 1553 1554 if( $body.hasClass('rtl') ) { 1555 $flickity_rtl = true; 1556 $flickity_rtl_cell_align = 'right'; 1557 } 1558 1559 1560 $wooFlickityCarousels[i].flickity({ 1561 draggable: true, 1562 lazyLoad: false, 1563 imagesLoaded: true, 1564 cellAlign: $flickity_rtl_cell_align, 1565 groupCells: pageDotsBool, 1566 prevNextButtons: arrowsBool, 1567 pageDots: pageDotsBool, 1568 resize: true, 1569 percentPosition: true, 1570 setGallerySize: true, 1571 rightToLeft: $flickity_rtl, 1572 wrapAround: true, 1573 autoPlay: $autoplay, 1574 accessibility: false 1575 }); 1576 1577 1578 // Mobile pagination numbers. 1579 if (arrowsBool == true) { 1580 1581 $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>'); 1582 1583 var $wooFlickityCount = $('<div class="woo-flickity-count" />'); 1584 $that.append($wooFlickityCount); 1585 var $wooFlickityData = $wooFlickityCarousels[i].data('flickity'); 1586 1587 var $eventData = { 1588 data: { 1589 wooFlickity: $wooFlickityData, 1590 wooFlickityCount: $wooFlickityCount 1591 } 1592 }; 1593 1594 updateWooFlickityCount($eventData); 1595 1596 $wooFlickityCarousels[i].on('select.flickity', { wooFlickity: $wooFlickityData, wooFlickityCount: $wooFlickityCount }, updateWooFlickityCount ); 1597 } 1598 1599 }); 1600 1601 } 1602 1603 1604 1605 1606 1607 /** 1608 * Standard Carousel Height Calculations. 1609 * 1610 * @since 2.0 1611 */ 1612 function carouselHeightCalcs() { 1613 1614 // Standard carousels 1615 $('.carousel.finished-loading:not(".portfolio-items, .clients"), .caroufredsel_wrapper .products.finished-loading').each(function () { 1616 1617 var tallestColumn = 0; 1618 1619 $(this).find('> li').each(function () { 1620 1621 if( $(this).height() > tallestColumn ) { 1622 tallestColumn = $(this).height(); 1623 } 1624 1625 }); 1626 1627 $(this).css('height', tallestColumn + 5); 1628 $(this).parents('.caroufredsel_wrapper').css('height', tallestColumn + 5); 1629 1630 if ($('body.ascend').length > 0 && $(this).parents('.carousel-wrap').attr('data-full-width') != 'true' || 1631 $('body.material').length > 0 && $(this).parents('.carousel-wrap').attr('data-full-width') != 'true') { 1632 1633 $(this).parents('.carousel-wrap').find('.item-count .current').html(Math.ceil(($(this).triggerHandler("currentPosition") + 1) / $(this).triggerHandler("currentVisible").length)); 1634 $(this).parents('.carousel-wrap').find('.item-count .total').html(Math.ceil($(this).find('> li').length / $(this).triggerHandler("currentVisible").length)); 1635 } 1636 1637 }); 1638 1639 } 1640 1641 1642 1643 /** 1644 * Clients carousel element. 1645 * 1646 * @since 2.0 1647 */ 1648 function clientsCarouselInit() { 1649 1650 if ( $('.carousel.clients').length === 0 ) { 1651 return; 1652 } 1653 1654 $('.carousel.clients').each(function () { 1655 1656 var $that = $(this); 1657 var $autoRotate = (!$(this).hasClass('disable-autorotate')) ? true : false; 1658 var columns; 1659 1660 columns = (parseInt($(this).attr('data-max'))) ? parseInt($(this).attr('data-max')) : 5; 1661 1662 if ($window.width() < 690 && $body.attr('data-responsive') == '1') { 1663 columns = 2; 1664 $(this).addClass('phone'); 1665 } 1666 1667 var $element = $that; 1668 if ($that.find('img').length == 0) { 1669 $element = $body; 1670 } 1671 1672 imagesLoaded($element, function () { 1673 1674 $that.carouFredSel({ 1675 circular: true, 1676 responsive: true, 1677 items: { 1678 1679 height: $that.find('> div:first').height(), 1680 width: $that.find('> div:first').width(), 1681 visible: { 1682 min: 1, 1683 max: columns 1684 } 1685 }, 1686 swipe: { 1687 onTouch: true, 1688 onMouse: true 1689 }, 1690 scroll: { 1691 items: 1, 1692 easing: 'easeInOutCubic', 1693 duration: '800', 1694 pauseOnHover: true 1695 }, 1696 auto: { 1697 play: $autoRotate, 1698 timeoutDuration: 2700 1699 } 1700 }).animate({ 1701 'opacity': 1 1702 }, 1300); 1703 1704 $that.addClass('finished-loading'); 1705 $that.parents('.carousel-wrap').wrap('<div class="carousel-outer">'); 1706 1707 $window.trigger('resize'); 1708 1709 }); 1710 1711 }); 1712 1713 $window.off('smartresize.clientsCarouselHeight',clientsCarouselHeightRecalc); 1714 $window.on('smartresize.clientsCarouselHeight',clientsCarouselHeightRecalc); 1715 } 1716 1717 1718 1719 1720 1721 1722 /** 1723 * Clients carousel height calculations. 1724 * 1725 * @since 2.0 1726 */ 1727 function clientsCarouselHeightRecalc() { 1728 1729 var tallestImage = 0; 1730 1731 $('.carousel.clients.finished-loading').each(function () { 1732 1733 $(this).find('> div').each(function () { 1734 1735 if( $(this).height() > tallestImage ) { 1736 tallestImage = $(this).height(); 1737 } 1738 1739 }); 1740 1741 $(this).css('height', tallestImage); 1742 $(this).parent().css('height', tallestImage); 1743 }); 1744 } 1745 1746 $window.on("orientationchange", function () { 1747 setTimeout(clientsCarouselHeightRecalc, 200); 1748 }); 1749 1750 1751 1752 /** 1753 * Adds grabbing classes onto carousels when dragging. 1754 * 1755 * @since 3.0 1756 */ 1757 function carouselfGrabbingClass() { 1758 1759 $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 () { 1760 $(this).addClass('active'); 1761 }); 1762 1763 $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 () { 1764 $(this).removeClass('active'); 1765 }); 1766 1767 // Arrow hover class. 1768 $('body.ascend, body.material').on('mouseover', '.carousel-next', function () { 1769 $(this).parent().find('.carousel-prev, .item-count').addClass('next-hovered'); 1770 }); 1771 1772 $('body.ascend, body.material').on('mouseleave', '.carousel-next', function () { 1773 $(this).parent().find('.carousel-prev, .item-count').removeClass('next-hovered'); 1774 }); 1775 1776 } 1777 1778 1779 1780 1781 1782 1783 1784 /** 1785 * Client element fade in animation. 1786 * 1787 * @since 3.0 1788 * @see waypoints 1789 */ 1790 function clientsFadeIn() { 1791 1792 var $clientsOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : '95%'; 1793 $($fullscreenSelector + '.clients.fade-in-animation').each(function () { 1794 1795 var $that = $(this), 1796 waypoint = new Waypoint({ 1797 element: $that, 1798 handler: function () { 1799 1800 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 1801 waypoint.destroy(); 1802 return; 1803 } 1804 1805 $that.find('> div').each(function (i) { 1806 $(this).delay(i * 80).transition({ 1807 'opacity': "1" 1808 }, 450); 1809 }); 1810 1811 // Add the css transition class back in after the aniamtion is done. 1812 setTimeout(function () { 1813 $that.addClass('completed'); 1814 }, ($that.find('> div').length * 80) + 450); 1815 1816 1817 $that.addClass('animated-in'); 1818 waypoint.destroy(); 1819 }, 1820 offset: $clientsOffsetPos 1821 1822 }); 1823 }); 1824 } 1825 1826 1827 1828 /*-------------------------------------------------------------------------*/ 1829 /* Helper Functions 1830 /*-------------------------------------------------------------------------*/ 1831 1832 1833 /** 1834 * Cross browser request animation frame. 1835 * 1836 * @since 4.0 1837 */ 1838 window.requestAnimationFrame = window.requestAnimationFrame || 1839 window.mozRequestAnimationFrame || 1840 window.webkitRequestAnimationFrame || 1841 window.msRequestAnimationFrame || 1842 function(f) { 1843 setTimeout(f, 1000 / 60); 1844 } 1845 1846 1847 /** 1848 * Smart resize. 1849 * 1850 * @since 1.0 1851 */ 1852 var $event = $.event, 1853 dispatchMethod = $.event.handle ? 'handle' : 'dispatch', 1854 resizeTimeout; 1855 1856 $event.special.smartresize = { 1857 setup: function() { 1858 $(this).on( "resize", $event.special.smartresize.handler ); 1859 }, 1860 teardown: function() { 1861 $(this).off( "resize", $event.special.smartresize.handler ); 1862 }, 1863 handler: function( event, execAsap ) { 1864 1865 var context = this, 1866 args = arguments; 1867 1868 event.type = "smartresize"; 1869 1870 if ( resizeTimeout ) { 1871 clearTimeout( resizeTimeout ); 1872 } 1873 resizeTimeout = setTimeout(function() { 1874 $event[ dispatchMethod ].apply( context, args ); 1875 }, execAsap === "execAsap"? 0 : 100 ); 1876 } 1877 }; 1878 1879 $.fn.smartresize = function( fn ) { 1880 return fn ? this.on( "smartresize", fn ) : this.trigger( "smartresize", ["execAsap"] ); 1881 }; 1882
1883 1884 /** 1885 * Linear interpolation 1886 * 1887 * @since 11.0 1888 */ 1889 function linearInterpolate(a, b, n) { 1890 return (1 - n) * a + n * b; 1891 } 1892 1893 /** 1894 * Aspect Ratio Calculator 1895 * 1896 * @since 11.0 1897 */ 1898 function calculateAspectRatio(srcWidth, srcHeight, maxWidth, maxHeight) { 1899 var ratio = Math.min(maxWidth / srcWidth, maxHeight / srcHeight); 1900 return { width: srcWidth*ratio, height: srcHeight*ratio }; 1901 } 1902 1903 /** 1904 * Calculate header navigation height 1905 * 1906 * The header nav bar height can change on scrolling from theme option effects/using the secondary 1907 * header, so it is necessary to calculate the reduced height in advance for correct sticky waypoint 1908 * event binding & animated anchor links. 1909 * 1910 * @since 10.5 1911 * @return {number} Height of nav bar. 1912 */ 1913 function calcHeaderNavHeight() { 1914 1915 var navHeight; 1916 1917 // Left header format, no header template, hide header until needed. 1918 if( ($body.is('[data-header-format="left-header"]') && nectarDOMInfo.winW >= 1000) || 1919 $body.is('[data-hhun="1"]') && nectarDOMInfo.winW >= 1000 || 1920 $('.page-template-template-no-header-footer').length > 0 || 1921 $('.page-template-template-no-header').length > 0) { 1922 1923 navHeight = 0; 1924 1925 } 1926 1927 // Regular Header 1928 else { 1929 1930 var headerPadding2 = headerPadding - headerPadding / 1.8; 1931 var $headerNavSpace = $headerOuterEl.outerHeight(); 1932 1933 // Secondary header bar. 1934 if( $headerSecondaryEl.length > 0 && $body.is('.material') || 1935 $headerSecondaryEl.length > 0 && !$body.is('.material') && nectarDOMInfo.winW < 1000) { 1936 $headerNavSpace -= nectarDOMInfo.secondaryHeaderHeight; 1937 } 1938 1939 // Check for header resize effect. 1940 if( $headerOuterEl.is('[data-header-resize="1"]') && !$headerOuterEl.is('.small-nav') && nectarDOMInfo.winW >= 1000 ) { 1941 navHeight = $headerNavSpace - (parseInt(logoShrinkNum) + headerPadding2 * 2); 1942 } else { 1943 navHeight = $headerNavSpace; 1944 } 1945 1946 } 1947 1948 // Condense header effect. 1949 if ( nectarDOMInfo.winW >= 1000 && $('#header-outer[data-condense="true"]').length > 0 ) { 1950 1951 var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'); 1952 navHeight = $headerOuterEl.height() - (parseInt($headerSpan9.position().top) - parseInt($headerOuterEl.find('#logo').css('margin-top'))) - parseInt(nectarDOMInfo.secondaryHeaderHeight); 1953 1954 } 1955 1956 return navHeight; 1957 1958 } 1959 1960 1961 /** 1962 * Removes CSS outlines in an accessible manner. 1963 * 1964 * @since 10.5 1965 */ 1966 (function(d){ 1967 1968 var style_element = d.createElement('STYLE'), 1969 dom_events = 'addEventListener' in d, 1970 add_event_listener = function(type, callback){ 1971 if(dom_events){ 1972 d.addEventListener(type, callback); 1973 }else{ 1974 d.attachEvent('on' + type, callback); 1975 } 1976 }, 1977 set_css = function(css_text){ 1978 !!style_element.styleSheet ? style_element.styleSheet.cssText = css_text : style_element.innerHTML = css_text; 1979 }; 1980 1981 d.getElementsByTagName('HEAD')[0].appendChild(style_element); 1982 1983 add_event_listener('mousedown', function(){ 1984 set_css(':focus{outline:0}::-moz-focus-inner{border:0;}'); 1985 }); 1986 1987 add_event_listener('keydown', function(){ 1988 set_css(''); 1989 }); 1990 1991 })(document); 1992 1993 1994 1995 /** 1996 * Cursor position. 1997 * 1998 * @since 4.0 1999 */ 2000 jQuery.fn.setCursorPosition = function (position) { 2001 2002 if (this.length == 0) { 2003 return this; 2004 } 2005 return $(this).setSelection(position, position); 2006 }; 2007 2008 2009 /** 2010 * Set selection in input. 2011 * 2012 * @since 4.0 2013 */ 2014 jQuery.fn.setSelection = function (selectionStart, selectionEnd) { 2015 if (this.length == 0) { 2016 return this; 2017 } 2018 var input = this[0]; 2019 2020 if (input.createTextRange) { 2021 var range = input.createTextRange(); 2022 range.collapse(true); 2023 range.moveEnd('character', selectionEnd); 2024 range.moveStart('character', selectionStart); 2025 range.select(); 2026 } else if (input.setSelectionRange) { 2027 input.focus(); 2028 input.setSelectionRange(selectionStart, selectionEnd); 2029 } 2030 2031 return this; 2032 }; 2033 2034 $.extend($.expr[':'], { 2035 transparent: function (elem, i, attr) { 2036 return ($(elem).css("opacity") === "0"); 2037 } 2038 }); 2039 2040 2041 2042 /** 2043 * Converts to hex. 2044 * 2045 * @since 3.0 2046 */ 2047 function hex(x) { 2048 return ("0" + parseInt(x).toString(16)).slice(-2); 2049 } 2050 2051 /** 2052 * CSS color RGB helper. 2053 * 2054 * @since 3.0 2055 */ 2056 $.cssHooks.color = { 2057 get: function (elem) { 2058 2059 var color; 2060 2061 if (elem.currentStyle) { 2062 color = elem.currentStyle["color"]; 2063 } else if (window.getComputedStyle) { 2064 color = document.defaultView.getComputedStyle(elem, 2065 null).getPropertyValue("color"); 2066 } 2067 if (color.search("rgb") == -1) { 2068 return color; 2069 } else { 2070 color = color.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/); 2071 2072 if (color) { 2073 return "#" + hex(color[1]) + hex(color[2]) + hex(color[3]); 2074 } 2075 } 2076 } 2077 }; 2078 2079 /** 2080 * CSS background color RGB helper. 2081 * 2082 * @since 3.0 2083 */ 2084 $.cssHooks.backgroundColor = { 2085 get: function (elem) { 2086 2087 var bg; 2088 2089 if (elem.currentStyle) { 2090 bg = elem.currentStyle["backgroundColor"]; 2091 } else if (window.getComputedStyle) { 2092 bg = document.defaultView.getComputedStyle(elem, 2093 null).getPropertyValue("background-color"); 2094 } 2095 if (bg.search("rgb") == -1) { 2096 return bg; 2097 } else { 2098 bg = bg.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/); 2099 2100 if (bg) { 2101 return "#" + hex(bg[1]) + hex(bg[2]) + hex(bg[3]); 2102 } 2103 } 2104 } 2105 }; 2106 2107 2108 /** 2109 * Unique ID generator. 2110 * 2111 * @since 10.5 2112 */ 2113 function uniqueIdGenerate() { 2114 return Math.floor(Math.random() * 10000); 2115 } 2116 2117 2118 2119 2120 /** 2121 * Animated page scroll 2122 * 2123 * @since 9.0 2124 */ 2125 function nectar_scrollToY(scrollTargetY, speed, easing) { 2126 2127 var scrollY = window.scrollY || document.documentElement.scrollTop, 2128 scrollTargetY = scrollTargetY || 0, 2129 speed = speed || 2000, 2130 easing = easing || 'easeOutSine', 2131 currentTime = 0; 2132 2133 var time = Math.max(0.1, Math.min(Math.abs(scrollY - scrollTargetY) / speed, 0.8)); 2134 2135 var easingEquations = { 2136 easeInOutQuint: function (pos) { 2137 if ((pos /= 0.5) < 1) { 2138 return 0.5 * Math.pow(pos, 5); 2139 } 2140 return 0.5 * (Math.pow((pos - 2), 5) + 2); 2141 } 2142 }; 2143 2144 function tick() { 2145 currentTime += 1 / 60; 2146 2147 var p = currentTime / time; 2148 var t = easingEquations[easing](p); 2149 2150 if (p < 1) { 2151 requestAnimationFrame(tick); 2152 2153 window.scrollTo(0, scrollY + ((scrollTargetY - scrollY) * t)); 2154 } else { 2155 window.scrollTo(0, scrollTargetY); 2156 } 2157 } 2158 2159 tick(); 2160 } 2161 2162 2163 /* 2164 * Bootstrap ScrollSpy Component 2165 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) */ 2166 (function ($) { 2167 2168 function s(e, i) { 2169 var r = $.proxy(this.process, this); 2170 this.$body = $("body"), this.$scrollElement = $($(e).is("body") ? window : e), 2171 this.options = $.extend({}, s.DEFAULTS, i), 2172 this.selector = (this.options.target || "") + " ul li > a", 2173 this.offsets = [], 2174 this.targets = [], 2175 this.activeTarget = null, 2176 this.scrollHeight = 0, 2177 this.$scrollElement.on("scroll.bs.scrollspy", r), 2178 this.refresh(), 2179 this.process(); 2180 } 2181 2182 function e(e) { 2183 return this.each(function () { 2184 var i = $(this), 2185 r = i.data("bs.scrollspy"), 2186 o = "object" == typeof e && e; 2187 r || i.data("bs.scrollspy", r = new s(this, o)), "string" == typeof e && r[e]() 2188 }) 2189 } 2190 2191 s.VERSION = "3.2.0", 2192 s.DEFAULTS = { 2193 offset: 10 2194 }, 2195 s.prototype.getScrollHeight = function () { 2196 return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight) 2197 }, 2198 s.prototype.refresh = function () { 2199 var s = "offset", 2200 e = 0; 2201 $.isWindow(this.$scrollElement[0]) || (s = "position", e = this.$scrollElement.scrollTop()), this.offsets = [], this.targets = [], this.scrollHeight = this.get
2201ScrollHeight(); 2202 var i = this; 2203 this.$body.find(this.selector).map(function () { 2204 var i = $(this), 2205 r = i.data("target") || i.attr("href"), 2206 o = /^#./.test(r) && $(r); 2207 return o && o.length && o.is(":visible") && [ 2208 [o[s]().top + e, r] 2209 ] || null 2210 }).sort(function (t, s) { 2211 return t[0] - s[0] 2212 }).each(function () { 2213 i.offsets.push(this[0]), i.targets.push(this[1]) 2214 }) 2215 }, 2216 s.prototype.process = function () { 2217 2218 var $pageSubMenu = 0; 2219 2220 if( $('.page-submenu[data-sticky="true"]').length > 0 && $('body[data-hhun="1"]').length == 0 2221 || $('.page-submenu[data-sticky="true"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length > 0 ) { 2222 $pageSubMenu = $('.page-submenu').height(); 2223 } 2224 2225 var t, s = this.$scrollElement.scrollTop() + this.options.offset + $pageSubMenu, 2226 e = this.getScrollHeight(), 2227 i = this.options.offset + e - this.$scrollElement.height() - $pageSubMenu, 2228 r = this.offsets, 2229 o = this.targets, 2230 l = this.activeTarget; 2231 2232 // remove active when scrolling to first section that does not have an anchor 2233 if (this.activeTarget && s < this.offsets[0] && this.offsets[0] > 0) { 2234 this.activeTarget = null; 2235 $(this.selector).parentsUntil(this.options.target, ".current-menu-item").removeClass("current-menu-item").removeClass('sfHover'); 2236 return; 2237 } 2238 2239 if (this.scrollHeight != e && this.refresh(), s >= i) { 2240 return l != (t = o[o.length - 1]) && this.activate(t); 2241 } 2242 if (l && s <= r[0]) { 2243 return l != (t = o[0]) && this.activate(t); 2244 } 2245 2246 2247 for (t = r.length; t--;) l != o[t] && s >= r[t] && (!r[t + 1] || s <= r[t + 1]) && this.activate(o[t]) 2248 }, 2249 s.prototype.activate = function (s) { 2250 this.activeTarget = s, $(this.selector).parentsUntil(this.options.target, ".current-menu-item").removeClass("current-menu-item").removeClass('sfHover'); 2251 var e = this.selector + '[data-target="' + s + '"],' + this.selector + '[href="' + s + '"]', 2252 i = $(e).parents("li").addClass("current-menu-item"); 2253 i.parent(".dropdown-menu").length && (i = i.closest("li.dropdown").addClass("current-menu-item")), i.trigger("activate.bs.scrollspy") 2254 }; 2255 2256 var i = $.fn.scrollspy; 2257 2258 $.fn.scrollspy = e, 2259 $.fn.scrollspy.Constructor = s, 2260 $.fn.scrollspy.noConflict = function () { 2261 return $.fn.scrollspy = i, this 2262 } 2263 2264 }(jQuery)); 2265 2266 2267 /** 2268 * Mobile break point checker 2269 * 2270 * @since 9.0 2271 */ 2272 function mobileBreakPointCheck() { 2273 2274 var $mobileBreakpoint = ($('body[data-header-breakpoint]').length > 0 && $body.attr('data-header-breakpoint') != '1000') ? parseInt($body.attr('data-header-breakpoint')) : 1000; 2275 var $withinCustomBreakpoint = false; 2276 2277 if ($mobileBreakpoint != 1000) { 2278 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) { 2279 $withinCustomBreakpoint = true; 2280 } 2281 } 2282 2283 return $withinCustomBreakpoint; 2284 } 2285 2286 /** 2287 * Extract a URL 2288 * 2289 * @since 5.0 2290 */ 2291 function extractUrl(input) { 2292 return input.replace(/"/g, "").replace(/url\(|\)$/ig, ""); 2293 } 2294 2295 /** 2296 * Extract query params 2297 * 2298 * @since 10.5 2299 */ 2300 function getQueryParams(qs) { 2301 qs = qs.split("+").join(" "); 2302 var params = {}, 2303 tokens, 2304 re = /[?&]?([^=]+)=([^&]*)/g; 2305 2306 while (tokens = re.exec(qs)) { 2307 params[decodeURIComponent(tokens[1])] = decodeURIComponent(tokens[2]); 2308 } 2309 2310 return params; 2311 } 2312 2313 var nectarGetQueryParam = getQueryParams(document.location.search); 2314 2315 2316 /** 2317 * Check whether an el is visible. 2318 * 2319 * @since 6.0 2320 */ 2321 (function (t) { 2322 var i = t(window); 2323 t.fn.visible = function (t, e, o) { 2324 if (!(this.length < 1)) { 2325 var r = this.length > 1 ? this.eq(0) : this, 2326 n = r.get(0), 2327 f = i.width(), 2328 h = i.height(), 2329 o = o ? o : "both", 2330 l = e === !0 ? n.offsetWidth * n.offsetHeight : !0; 2331 if ("function" == typeof n.getBoundingClientRect) { 2332 var g = n.getBoundingClientRect(), 2333 u = g.top >= 0 && g.top < h, 2334 s = g.bottom > 0 && g.bottom <= h, 2335 c = g.left >= 0 && g.left < f, 2336 a = g.right > 0 && g.right <= f, 2337 v = t ? u || s : u && s, 2338 b = t ? c || a : c && a; 2339 if ("both" === o) { 2340 return l && v && b; 2341 } 2342 if ("vertical" === o) { 2343 return l && v; 2344 } 2345 if ("horizontal" === o) { 2346 return l && b 2347 } 2348 } else { 2349 var d = i.scrollTop(), 2350 p = d + h, 2351 w = i.scrollLeft(), 2352 m = w + f, 2353 y = r.offset(), 2354 z = y.top, 2355 B = z + r.height(), 2356 C = y.left, 2357 R = C + r.width(), 2358 j = t === !0 ? B : z, 2359 q = t === !0 ? z : B, 2360 H = t === !0 ? R : C, 2361 L = t === !0 ? C : R; 2362 if ("both" === o) { 2363 return !!l && p >= q && j >= d && m >= L && H >= w; 2364 } 2365 if ("vertical" === o) { 2366 return !!l && p >= q && j >= d; 2367 } 2368 if ("horizontal" === o) { 2369 return !!l && m >= L && H >= w; 2370 } 2371 } 2372 } 2373 }; 2374 2375 }(jQuery)); 2376 2377 2378 /** 2379 * Count to a specific number 2380 * 2381 * @since 8.0 2382 */ 2383 var CountUp = function (target, startVal, endVal, decimals, duration, options) { 2384 2385 var lastTime = 0; 2386 var vendors = ['webkit', 'moz', 'ms', 'o']; 2387 for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { 2388 window.requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame']; 2389 window.cancelAnimationFrame = 2390 window[vendors[x] + 'CancelAnimationFrame'] || window[vendors[x] + 'CancelRequestAnimationFrame']; 2391 } 2392 if (!window.requestAnimationFrame) { 2393 window.requestAnimationFrame = function (callback) { 2394 var currTime = new Date().getTime(); 2395 var timeToCall = Math.max(0, 16 - (currTime - lastTime)); 2396 var id = window.setTimeout(function () { 2397 callback(currTime + timeToCall); 2398 }, 2399 timeToCall); 2400 lastTime = currTime + timeToCall; 2401 return id; 2402 }; 2403 } 2404 if (!window.cancelAnimationFrame) { 2405 window.cancelAnimationFrame = function (id) { 2406 clearTimeout(id); 2407 }; 2408 } 2409 2410 var self = this; 2411 2412 self.options = { 2413 useEasing: true, 2414 useGrouping: true, 2415 separator: ',',
vendor: 4,182 bytes, lines 2416-2553
2416 decimal: '.', 2417 easingFn: null, 2418 formattingFn: null 2419 }; 2420 // Extend default options with passed options object 2421 for (var key in options) { 2422 if (options.hasOwnProperty(key)) { 2423 self.options[key] = options[key]; 2424 } 2425 } 2426 if (self.options.separator === '') { 2427 self.options.useGrouping = false; 2428 } 2429 if (!self.options.prefix) { 2430 self.options.prefix = ''; 2431 } 2432 if (!self.options.suffix) { 2433 self.options.suffix = ''; 2434 } 2435 2436 self.d = (typeof target === 'string') ? document.getElementById(target) : target; 2437 self.startVal = Number(startVal); 2438 self.endVal = Number(endVal); 2439 self.countDown = (self.startVal > self.endVal); 2440 self.frameVal = self.startVal; 2441 self.decimals = Math.max(0, decimals || 0); 2442 self.dec = Math.pow(10, self.decimals); 2443 self.duration = Number(duration) * 1000 || 2000; 2444 2445 self.formatNumber = function (nStr) { 2446 nStr = nStr.toFixed(self.decimals); 2447 nStr += ''; 2448 var x, x1, x2, rgx; 2449 x = nStr.split('.'); 2450 x1 = x[0]; 2451 x2 = x.length > 1 ? self.options.decimal + x[1] : ''; 2452 rgx = /(\d+)(\d{3})/; 2453 if (self.options.useGrouping) { 2454 while (rgx.test(x1)) { 2455 x1 = x1.replace(rgx, '$1' + self.options.separator + '$2'); 2456 } 2457 } 2458 return self.options.prefix + x1 + x2 + self.options.suffix; 2459 }; 2460 // Robert Penner's easeOutExpo 2461 self.easeOutExpo = function (t, b, c, d) { 2462 return c * (-Math.pow(2, -10 * t / d) + 1) * 1024 / 1023 + b; 2463 }; 2464 2465 self.easingFn = self.options.easingFn ? self.options.easingFn : self.easeOutExpo; 2466 self.formattingFn = self.options.formattingFn ? self.options.formattingFn : self.formatNumber; 2467 2468 self.version = function () { 2469 return '1.7.1'; 2470 }; 2471 2472 // Print value to target 2473 self.printValue = function (value) { 2474 var result = self.formattingFn(value); 2475 2476 if (self.d.tagName === 'INPUT') { 2477 this.d.value = result; 2478 } else if (self.d.tagName === 'text' || self.d.tagName === 'tspan') { 2479 this.d.textContent = result; 2480 } else { 2481 this.d.innerHTML = result; 2482 } 2483 }; 2484 2485 self.count = function (timestamp) { 2486 2487 if (!self.startTime) { 2488 self.startTime = timestamp; 2489 } 2490 2491 self.timestamp = timestamp; 2492 var progress = timestamp - self.startTime; 2493 self.remaining = self.duration - progress; 2494 2495 // To ease or not to ease 2496 if (self.options.useEasing) { 2497 if (self.countDown) { 2498 self.frameVal = self.startVal - self.easingFn(progress, 0, self.startVal - self.endVal, self.duration); 2499 } else { 2500 self.frameVal = self.easingFn(progress, self.startVal, self.endVal - self.startVal, self.duration); 2501 } 2502 } else { 2503 if (self.countDown) { 2504 self.frameVal = self.startVal - ((self.startVal - self.endVal) * (progress / self.duration)); 2505 } else { 2506 self.frameVal = self.startVal + (self.endVal - self.startVal) * (progress / self.duration); 2507 } 2508 } 2509 2510 // Don't go past endVal since progress can exceed duration in the last frame 2511 if (self.countDown) { 2512 self.frameVal = (self.frameVal < self.endVal) ? self.endVal : self.frameVal; 2513 } else { 2514 self.frameVal = (self.frameVal > self.endVal) ? self.endVal : self.frameVal; 2515 } 2516 2517 // Decimal 2518 self.frameVal = Math.round(self.frameVal * self.dec) / self.dec; 2519 2520 // Format and print value 2521 self.printValue(self.frameVal); 2522 2523 // Whether to continue 2524 if (progress < self.duration) { 2525 self.rAF = requestAnimationFrame(self.count); 2526 } else { 2527 if (self.callback) { 2528 self.callback(); 2529 } 2530 } 2531 }; 2532 // Start animation 2533 self.start = function (callback) { 2534 self.callback = callback; 2535 self.rAF = requestAnimationFrame(self.count); 2536 return false; 2537 }; 2538 // Toggles pause/resume animation 2539 self.pauseResume = function () { 2540 if (!self.paused) { 2541 self.paused = true; 2542 cancelAnimationFrame(self.rAF); 2543 } else { 2544 self.paused = false; 2545 delete self.startTime; 2546 self.duration = self.remaining; 2547 self.startVal = self.frameVal; 2548 requestAnimationFrame(self.count); 2549 } 2550 }; 2551 // Reset to startVal so animation can be run again 2552 self.reset = function () { 2553 self.paused = false;
2554 delete self.startTime; 2555 self.startVal = startVal; 2556 cancelAnimationFrame(self.rAF); 2557 self.printValue(self.startVal); 2558 }; 2559 // Pass a new endVal and start animation 2560 self.update = function (newEndVal) { 2561 cancelAnimationFrame(self.rAF); 2562 self.paused = false; 2563 delete self.startTime; 2564 self.startVal = self.frameVal; 2565 self.endVal = Number(newEndVal); 2566 self.countDown = (self.startVal > self.endVal); 2567 self.rAF = requestAnimationFrame(self.count); 2568 }; 2569 2570 // Format startVal on initialization 2571 self.printValue(self.startVal); 2572 }; 2573 2574 var easeOutCubic = function (t, b, c, d) { 2575 return c * ((t = t / d - 1) * t * t + 1) + b; 2576 }; 2577 2578 2579 /** 2580 * Create styles 2581 * 2582 * @since 10.5 2583 */ 2584 function nectarCreateStyle(styles, name) { 2585 2586 if(styles.length > 0) { 2587 2588 var head = document.head || document.getElementsByTagName('head')[0]; 2589 var style = document.createElement('style'); 2590 2591 style.type = 'text/css'; 2592 if (style.styleSheet) { 2593 style.styleSheet.cssText = styles; 2594 } else { 2595 style.appendChild(document.createTextNode(styles)); 2596 } 2597 2598 $(style).attr('id', name); 2599 $('head').find('#'+name).remove(); 2600 head.appendChild(style); 2601 2602 } 2603 2604 } 2605 2606 2607 2608 2609 /** 2610 * FancyBox lightbox. 2611 * 2612 * @since 8.0 2613 */ 2614 function fancyBoxInit() { 2615 2616 // Convert prettyPhoto links 2617 $('a.pp') 2618 .removeClass('pp') 2619 .attr('data-fancybox', ''); 2620 2621 $("a[rel^='prettyPhoto']:not([rel*='_gal']):not([rel*='product-gallery']):not([rel*='prettyPhoto['])") 2622 .removeAttr('rel') 2623 .attr('data-fancybox', ''); 2624 2625 var $unique_id = uniqueIdGenerate(); 2626 2627 // Image gallery nectar. 2628 $('.wpb_gallery .wpb_gallery_slidesnectarslider_style').each(function() { 2629 $unique_id = uniqueIdGenerate(); 2630 $(this).find('.swiper-slide a:not(.ext-url-link)').attr('data-fancybox', 'group_' + $unique_id); 2631 }); 2632 2633 // Flexslider. 2634 $('.wpb_gallery_slides.wpb_flexslider:not([data-onclick="custom_link"])').each(function() { 2635 $unique_id = uniqueIdGenerate(); 2636 $(this).find('.slides > li > a').attr('data-fancybox', 'group_' + $unique_id); 2637 }); 2638 2639 // Touch enabled gallery. 2640 $('.wpb_gallery_slidesflickity_style, .wpb_gallery_slidesflickity_static_height_style').each(function() { 2641 $unique_id = uniqueIdGenerate(); 2642 $(this).find('.cell > a:not(.ext-url-link)').attr('data-fancybox', 'group_' + $unique_id); 2643 }); 2644 2645 // Add galleries to portfolios. 2646 $('.portfolio-items, .wpb_gallery_slidesparallax_image_grid').each(function() { 2647 $unique_id = uniqueIdGenerate(); 2648 if ($(this).find('.pretty_photo').length > 0) { 2649 2650 $(this).find('.pretty_photo') 2651 .removeClass('pretty_photo') 2652 .attr('data-fancybox', 'group_' + $unique_id); 2653 2654 } else if ($(this).find('a[rel*="prettyPhoto["]').length > 0) { 2655 2656 $(this).find('a[rel*="prettyPhoto["]') 2657 .removeAttr('rel') 2658 .attr('data-fancybox', 'group_' + $unique_id); 2659 } 2660 2661 }); 2662 2663 // Nectar auto lightbox theme option. 2664 if ($body.hasClass('nectar-auto-lightbox')) { 2665 2666 $('.gallery').each(function() { 2667 if ($(this).find('.gallery-icon a[rel^="prettyPhoto"]').length == 0) { 2668 var $unique_id = uniqueIdGenerate(); 2669 $(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"]') 2670 .attr('data-fancybox', 'group_' + $unique_id) 2671 .removeClass('pretty_photo'); 2672 } 2673 }); 2674 2675 $('.main-content img').each(function() { 2676 2677 if ($(this).parent().is("[href]") && 2678 !$(this).parent().is(".magnific-popup") && 2679 $(this).parents('.tiled-gallery').length == 0 && 2680 $(this).parents('.product-image').length == 0 && 2681 $(this).parents('.iosSlider.product-slider').length == 0) { 2682 2683 var match = $(this).parent().attr('href').match(/\.(jpg|png|gif)\b/); 2684 if (match) { 2685 $(this).parent().attr('data-fancybox', ''); 2686 } 2687 } 2688 }); 2689 } 2690 2691 // Regular. 2692 var fbMarginArr = ($('body.admin-bar').length > 0) ? [60, 100] : [60, 100]; 2693 if (nectarDOMInfo.winW < 1000) { 2694 fbMarginArr = [0, 0]; 2695 } 2696 $("[data-fancybox]").fancybox({ 2697 animationEffect: "zoom-in-out", 2698 animationDuration: 350, 2699 buttons: [ 2700 'fullScreen', 2701 'zoom', 2702 'close' 2703 ], 2704 margin: fbMarginArr, 2705 loop: true, 2706 caption: function() { 2707 return $(this).attr('title'); 2708 }, 2709 hash: false, 2710 beforeLoad: function(instance) { 2711 2712 if (typeof instance.current.src !== 'string') { 2713 $.fancybox.close(true); 2714 } 2715 2716 }, 2717 mobile: { 2718 margin: 0 2719 } 2720 }); 2721 } 2722 2723 /** 2724 * Magnific lightbox. 2725 * 2726 * @since 6.0 2727 */ 2728 function magnificInit() { 2729 2730 // Convert old pp links 2731 $('a.pp') 2732 .removeClass('pp') 2733 .addClass('magnific-popup'); 2734 2735 $("a[rel^='prettyPhoto']:not([rel*='_gal']):not([rel*='product-gallery']):not([rel*='prettyPhoto['])") 2736 .removeAttr('rel') 2737 .addClass('magnific-popup'); 2738 2739 // Image gallery nectar. 2740 $('.wpb_gallery .wpb_gallery_slidesnectarslider_style').each(function() { 2741 $(this).find('.swiper-slide a:not(.ext-url-link)').addClass('pretty_photo'); 2742 }); 2743 2744 // Flexslider. 2745 $('.wpb_gallery_slides.wpb_flexslider:not([data-onclick="custom_link"])').each(function() { 2746 $(this).find('.slides > li > a').addClass('pretty_photo'); 2747 }); 2748 2749 // Touch enabled gallery. 2750 $('.wpb_gallery_slidesflickity_style, .wpb_gallery_slidesflickity_static_height_style').each(function() { 2751 $(this).find('.cell > a:not(.ext-url-link)').addClass('pretty_photo'); 2752 }); 2753 2754 // Add galleries to portfolios. 2755 $('.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() { 2756 2757 if ($(this).find('.pretty_photo').length > 0) { 2758 2759 $(this) 2760 .find('.pretty_photo') 2761 .removeClass('pretty_photo') 2762 .addClass('gallery') 2763 .addClass('magnific'); 2764 2765 } else if ($(this).find('a[rel*="prettyPhoto["]').length > 0) { 2766 2767 $(this) 2768 .find('a[rel*="prettyPhoto["]') 2769 .removeAttr('rel') 2770 .addClass('gallery') 2771 .addClass('magnific'); 2772 } 2773 2774 }); 2775 2776 $("a[data-rel='prettyPhoto[product-gallery]']").each(function() { 2777 $(this) 2778 .removeAttr('data-rel') 2779 .addClass('magnific') 2780 .addClass('gallery'); 2781 }); 2782 2783 // Nectar auto lightbox theme option. 2784 if ($body.hasClass('nectar-auto-lightbox')) { 2785 $('.gallery').each(function() { 2786 if ($(this).find('.gallery-icon a[rel^="prettyPhoto"]').length == 0) { 2787 2788 $(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"]') 2789 .addClass('magnific') 2790 .addClass('gallery') 2791 .removeClass('pretty_photo'); 2792 } 2793 }); 2794 2795 $('.main-content img').each(function() { 2796 2797 if ($(this).parent().is("[href]") && 2798 !$(this).parent().is(".magnific-popup") && 2799 $(this).parents('.tiled-gallery').length == 0 && 2800 $(this).parents('.product-image').length == 0 && 2801 $(this).parents('.iosSlider.product-slider').length == 0) { 2802 2803 var match = $(this).parent().attr('href').match(/\.(jpg|png|gif)\b/); 2804 if (match) { 2805 2806 $(this).parent() 2807 .addClass('magnific-popup') 2808 .addClass('image-link'); 2809 } 2810 } 2811 2812 }); 2813 2814 } 2815 2816 2817 // Regular. 2818 $('a.magnific-popup:not(.gallery):not(.nectar_video_lightbox)').magnificPopup({ 2819 type: 'image', 2820 callbacks: { 2821 imageLoadComplete: function() { 2822 var $that = this; 2823 setTimeout(function() { 2824 $that.wrap.addClass('mfp-image-loaded'); 2825 }, 10); 2826 }, 2827 beforeOpen: function() { 2828 this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim'); 2829 }, 2830 open: function() { 2831 2832 $.magnificPopup.instance.next = function() { 2833 var $that = this; 2834 2835 this.wrap.removeClass('mfp-image-loaded'); 2836 setTimeout(function() { 2837 $.magnificPopup.proto.next.call($that); 2838 }, 100); 2839 }; 2840 2841 $.magnificPopup.instance.prev = function() { 2842 var $that = this; 2843 2844 this.wrap.removeClass('mfp-image-loaded'); 2845 setTimeout(function() { 2846 $.magnificPopup.proto.prev.call($that); 2847 }, 100); 2848 }; 2849 2850 } 2851 },
2852 fixedContentPos: false, 2853 mainClass: 'mfp-zoom-in', 2854 removalDelay: 400 2855 }); 2856 2857 // Video. 2858 $('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({ 2859 type: 'iframe', 2860 fixedContentPos: false, 2861 mainClass: 'mfp-zoom-in', 2862 removalDelay: 400 2863 }); 2864 2865 2866 // Galleries. 2867 $('a.magnific.gallery').each(function() { 2868 2869 var $parentRow = ($(this).closest('.wpb_column').length > 0) ? $(this).closest('.wpb_column') : $(this).parents('.row'); 2870 2871 if ($parentRow.length > 0 && !$parentRow.hasClass('lightbox-col')) { 2872 2873 $parentRow.magnificPopup({ 2874 type: 'image', 2875 delegate: 'a.magnific', 2876 mainClass: 'mfp-zoom-in', 2877 fixedContentPos: false, 2878 callbacks: { 2879 2880 elementParse: function(item) { 2881 2882 if ($(item.el.context).is('[href]') && $(item.el.context).attr('href').indexOf('iframe=true') != -1 || 2883 $(item.el.context).is('[href]') && $(item.el.context).attr('href').indexOf('https://www.youtube.com/watch') != -1) { 2884 item.type = 'iframe'; 2885 } else if ($(item.el.context).is('[href]') && $(item.el.context).attr('href').indexOf('video-popup-') != -1) { 2886 item.type = 'inline'; 2887 } else { 2888 item.type = 'image'; 2889 } 2890 }, 2891 2892 imageLoadComplete: function() { 2893 var $that = this; 2894 setTimeout(function() { 2895 $that.wrap.addClass('mfp-image-loaded'); 2896 }, 10); 2897 }, 2898 2899 beforeOpen: function() { 2900 this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim'); 2901 }, 2902 2903 open: function() { 2904 2905 // Self hosted video. 2906 if ($(this.content).find('.mejs-video video').length > 0 && $().mediaelementplayer) { 2907 $(this.content).find('.mejs-video video')[0].player.remove(); 2908 2909 var $that = this; 2910 setTimeout(function() { 2911 $($that.content).find('video').mediaelementplayer(); 2912 $($that.content).find('.mejs-video video')[0].player.play(); 2913 }, 50); 2914 2915 } 2916 2917 $.magnificPopup.instance.next = function() { 2918 var $that = this; 2919 2920 this.wrap.removeClass('mfp-image-loaded'); 2921 setTimeout(function() { 2922 $.magnificPopup.proto.next.call($that); 2923 2924 // Self hosted video. 2925 if ($($that.content).find('.mejs-video video').length > 0) { 2926 $($that.content).find('.mejs-video video')[0].play(); 2927 } 2928 2929 }, 100); 2930 }; 2931 2932 $.magnificPopup.instance.prev = function() { 2933 var $that = this; 2934 2935 this.wrap.removeClass('mfp-image-loaded'); 2936 setTimeout(function() { 2937 $.magnificPopup.proto.prev.call($that); 2938 2939 // Self hosted video. 2940 if ($($that.content).find('.mejs-video video').length > 0) { 2941 $($that.content).find('.mejs-video video')[0].play(); 2942 } 2943 }, 100); 2944 }; 2945 2946 }, 2947 2948 close: function() { 2949 // Self hosted video. 2950 if ($(this.content).find('.mejs-video video').length > 0) { 2951 $(this.content).find('.mejs-video video')[0].load(); 2952 } 2953 } 2954 }, 2955 removalDelay: 400, 2956 gallery: { 2957 enabled: true 2958 } 2959 }); 2960 2961 $parentRow.addClass('lightbox-col'); 2962 } 2963 2964 }); 2965 2966 } 2967 2968 2969 /** 2970 * Lightbox initialization. 2971 * 2972 * Determines which lightbox to use based on theme option. 2973 * 2974 * @since 8.0 2975 */ 2976 function lightBoxInit() { 2977 2978 setTimeout(function(){ 2979 if ($('body[data-ls="magnific"]').length > 0 || $('body[data-ls="pretty_photo"]').length > 0) { 2980 magnificInit(); 2981 } else if ($('body[data-ls="fancybox"]').length > 0) { 2982 fancyBoxInit(); 2983 } 2984 },100); 2985 2986 } 2987 2988 2989 /** 2990 * WPBakery page builder standard animations. 2991 * 2992 * @since 7.0 2993 * @see waypoints 2994 */ 2995 function vcWaypoints() { 2996 2997 $($fullscreenSelector + ' .wpb_animate_when_almost_visible').each(function () { 2998 2999 var $that = $(this), 3000 $vcOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : '90%', 3001 waypoint = new Waypoint({ 3002 element: $that, 3003 handler: function () { 3004 3005 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated')) { 3006 waypoint.destroy(); 3007 return; 3008 } 3009 3010 $that.addClass("animated"); 3011 $that.addClass("wpb_start_animation"); 3012 waypoint.destroy(); 3013 3014 if ($that.is('.nectar-button') && $('body[data-button-style*="rounded_shadow"]').length > 0) { 3015 setTimeout(function () { 3016 $that.removeClass('wpb_start_animation'); 3017 }, 1100); 3018 } 3019 3020 }, 3021 offset: $vcOffsetPos 3022 3023 }); 3024 3025 }); 3026 } 3027 3028 3029 3030 /** 3031 * Milestone element initialization. 3032 * 3033 * @since 4.0 3034 * @see waypoints 3035 */ 3036 function milestoneInit() { 3037 3038 $('.nectar-milestone').each(function () { 3039 3040 // Symbol 3041 if ($(this).is('[data-symbol]')) { 3042 3043 if ($(this).find('.symbol-wrap').length == 0) { 3044 3045 if ($(this).attr('data-symbol-pos') == 'before') { 3046 $(this) 3047 .find('.number') 3048 .prepend('<div class="symbol-wrap"><span class="symbol">' + $(this).attr('data-symbol') + '</span></div>'); 3049 } else { 3050 $(this) 3051 .find('.number') 3052 .append('<div class="symbol-wrap"><span class="symbol">' + $(this).attr('data-symbol') + '</span></div>'); 3053 } 3054 } 3055 3056 var $symbol_size; 3057 3058 if ($(this).attr('data-symbol-size') == $(this).find('.number').attr('data-number-size') && $(this).attr('data-symbol-alignment') == 'superscript') { 3059 $symbol_size = 32; 3060 } else { 3061 $symbol_size = parseInt($(this).attr('data-symbol-size')); 3062 } 3063 3064 $(this).find('.symbol-wrap').css({ 3065 'font-size': $symbol_size + 'px', 3066 'line-height': $symbol_size + 'px' 3067 }); 3068 } 3069 3070 $(this).find('.number').css({ 3071 'font-size': $(this).find('.number').attr('data-number-size') + 'px', 3072 'line-height': $(this).find('.number').attr('data-number-size') + 'px' 3073 }); 3074 }); 3075 3076 if (!bypassAnimations && $('.nectar-milestone').length > 0 || $body.hasClass('rtl') && $('.nectar-milestone').length > 0) { 3077 3078 // Blur effect
3079 var $blurCssString = ''; 3080 $($fullscreenSelector + '.nectar-milestone.motion_blur').each(function (i) { 3081 3082 $(this).removeClass(function (index, className) { 3083 return (className.match(/(^|\s)instance-\S+/g) || []).join(' '); 3084 }); 3085 3086 $(this).addClass('instance-' + i); 3087 3088 var $currentColor = $(this).find('.number').css('color'), 3089 colorInt = parseInt($currentColor.substring(1), 16); 3090 3091 var R = (colorInt & 0xFF0000) >> 16, 3092 G = (colorInt & 0x00FF00) >> 8, 3093 B = (colorInt & 0x0000FF) >> 0; 3094 3095 var $rgbaColorStart = 'rgba(' + R + ',' + G + ',' + B + ',0.2)', 3096 $rgbaColorEnd = 'rgba(' + R + ',' + G + ',' + B + ',1)', 3097 $numberSize = parseInt($(this).find('.number').attr('data-number-size')); 3098 3099 $blurCssString += '@keyframes motion-blur-number-' + i + ' { ' + 3100 ' 0% { ' + 3101 'opacity: 0;' + 3102 'color: ' + $rgbaColorStart + '; ' + 3103 '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 + '; ' + 3104 'transform: translateZ(0px) translateY(-100%); ' + 3105 '-webkit-transform: translateZ(0px) translateY(-100%); ' + 3106 '} ' + 3107 '33% { opacity: 1 }' + 3108 '100% { ' + 3109 'color: ' + $rgbaColorEnd + '; ' + 3110 'text-shadow: none; ' + 3111 'transform: translateZ(0px) translateY(0px); ' + 3112 '-webkit-transform: translateZ(0px) translateY(0px); ' + 3113 '} ' + 3114 '} ' + 3115 '@-webkit-keyframes motion-blur-number-' + i + ' { ' + 3116 ' 0% { ' + 3117 'opacity: 0;' + 3118 'color: ' + $rgbaColorStart + '; ' + 3119 '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 + '; ' + 3120 'transform: translateZ(0px) translateY(-100%); ' + 3121 '-webkit-transform: translateZ(0px) translateY(-100%); ' + 3122 '} ' + 3123 '33% { opacity: 1 }' + 3124 '100% { ' + 3125 'color: ' + $rgbaColorEnd + '; ' + 3126 'text-shadow: none; ' + 3127 'transform: translateZ(0px) translateY(0px); ' + 3128 '-webkit-transform: translateZ(0px) translateY(0px); ' + 3129 '} ' + 3130 '} ' + 3131 '.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 + '; } '; 3132 3133 if( $nectarFullPage.$usingFullScreenRows != false || $(this).find('.number > span').length == 0 ) { 3134 3135 // Separate each character into spans 3136 var $symbol = $(this).find('.symbol-wrap').clone(); 3137 $(this).find('.symbol-wrap').remove(); 3138 3139 var characters = $(this).find('.number').text().split(""); 3140 var $this = $(this).find('.number'); 3141 3142 $this.empty(); 3143 $.each(characters, function (i, el) { 3144 $this.append("<span>" + el + "</span"); 3145 }); 3146 3147 // Handle symbol 3148 if ($(this).has('[data-symbol]')) { 3149 if ($(this).attr('data-symbol-pos') == 'after') { 3150 $this.append($symbol); 3151 } else { 3152 $this.prepend($symbol); 3153 } 3154 } 3155 3156 } // already made markup 3157 3158 }); 3159 3160 // Style 3161 nectarCreateStyle($blurCssString, 'milestone-blur'); 3162 3163 // Activate 3164 milestoneWaypoint(); 3165 3166 } 3167 3168 } 3169 3170 3171 /** 3172 * Milestone animation 3173 * 3174 * @since 4.0 3175 */ 3176 function milestoneWaypoint() { 3177 3178 $($fullscreenSelector + '.nectar-milestone').each(function () { 3179 3180 // Animation 3181 var $offset = ($fullscreenMarkupBool == true) ? '250%' : '98%'; 3182 3183 if( nectarDOMInfo.usingMobileBrowser && $offset == '98%') { 3184 $offset = '110%'; 3185 } 3186 3187 var $that = $(this), 3188 waypoint = new Waypoint({ 3189 element: $that, 3190 handler: function () { 3191 3192 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 3193 waypoint.destroy(); 3194 return; 3195 } 3196 3197 var $endNum = parseInt($that.find('.number span:not(.symbol)').text().replace(/,/g, '')); 3198 3199 if (!$that.hasClass('motion_blur')) { 3200 3201 var countOptions = { 3202 easingFn: easeOutCubic 3203 }; 3204 var $countEle = $that.find('.number span:not(.symbol)')[0]; 3205 var numAnim = new CountUp($countEle, 0, $endNum, 0, 2.2, countOptions); 3206 numAnim.start(); 3207 3208 } else { 3209 $that.find('span').each(function (i) { 3210 var $that = $(this); 3211 setTimeout(function () { 3212 $that.addClass('in-sight'); 3213 }, 200 * i); 3214 }); 3215 } 3216 3217 3218 $that.addClass('animated-in'); 3219 waypoint.destroy(); 3220 }, 3221 offset: $offset 3222 3223 }); 3224 3225 }); 3226 } 3227 3228 3229 3230 /** 3231 * Tabbed element change section event. 3232 * 3233 * @since 10.5 3234 */ 3235 function tabbedChangeSection(clickedTab) { 3236 3237 var $id = clickedTab.parents('li').index() + 1; 3238 var $frontEndEditorTabDiv = ($('body.vc_editor').length > 0) ? '> .wpb_tab ' : ''; 3239 3240 if (!clickedTab.hasClass('active-tab') && !clickedTab.hasClass('loading')) { 3241 3242 clickedTab.parents('ul') 3243 .find('a') 3244 .removeClass('active-tab'); 3245 3246 clickedTab 3247 .addClass('active-tab'); 3248 3249 clickedTab.parents('.tabbed').find('>
3249 div:not(.clear)' + $frontEndEditorTabDiv).css({ 3250 'visibility': 'hidden', 3251 'position': 'absolute', 3252 'opacity': '0', 3253 'left': '-9999px', 3254 'display': 'none' 3255 }).removeClass('visible-tab'); 3256 3257 if ($('body.vc_editor').length > 0) { 3258 3259 var $data_m_id = (clickedTab.parent().is('[data-m-id]')) ? clickedTab.parent().attr('data-m-id') : ''; 3260 3261 clickedTab.parents('.tabbed').find('> div[data-model-id="' + $data_m_id + '"]' + $frontEndEditorTabDiv).css({ 3262 'visibility': 'visible', 3263 'position': 'relative', 3264 'left': '0', 3265 'display': 'block' 3266 }).stop().transition({ 3267 'opacity': 1 3268 }, 400).addClass('visible-tab'); 3269 3270 if( !$body.is('[data-flex-cols="true"]') ) { 3271 convertFrontEndPadding(); 3272 } 3273 3274 } else { 3275 clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ')' + $frontEndEditorTabDiv).css({ 3276 'visibility': 'visible', 3277 'position': 'relative', 3278 'left': '0', 3279 'display': 'block' 3280 }).stop().transition({ 3281 'opacity': 1 3282 }, 400).addClass('visible-tab'); 3283 } 3284 3285 if (clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ') .iframe-embed').length > 0 || 3286 clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ') .portfolio-items').length > 0) { 3287 setTimeout(function () { 3288 $window.trigger('resize'); 3289 }, 10); 3290 } 3291 } 3292 3293 // Waypoint checking 3294 if ($tabbedClickCount != 0) { 3295 3296 var $currentVisTab = clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ')' + $frontEndEditorTabDiv); 3297 3298 if ($currentVisTab.find('.nectar-progress-bar').length > 0) { 3299 progressBars(); 3300 } 3301 if ($currentVisTab.find('.divider-small-border [data-animate="yes"]').length > 0 || 3302 $currentVisTab.find('.divider-border [data-animate="yes"]').length > 0) { 3303 dividers(); 3304 } 3305 if ($currentVisTab.find('img.img-with-animation').length > 0 || 3306 $currentVisTab.find('.col.has-animation').length > 0 || 3307 $currentVisTab.find('.nectar_cascading_images').length > 0 || 3308 $currentVisTab.find('.wpb_column.has-animation').length > 0) { 3309 colAndImgAnimations(); 3310 cascadingImageBGSizing(); 3311 } 3312 if ($currentVisTab.find('.column-image-bg-wrap[data-bg-animation="displace-filter-fade"]').length > 0) { 3313 3314 for (var k = 0; k < $liquidBG_EL.length; k++) { 3315 3316 if ($($liquidBG_EL[k].canvasContainer).parents('.wpb_tab').length > 0 && 3317 $($liquidBG_EL[k].canvasContainer).parents('.wpb_tab').css('visibility') != 'hidden') { 3318 3319 // Add bg to container 3320 if ($($liquidBG_EL[k].canvasContainer).find('.image-added-to-stage').length == 0) { 3321 $liquidBG_EL[k].imgContainer.addChild($liquidBG_EL[k].bg); 3322 } 3323 $($liquidBG_EL[k].canvasContainer).find('.nectar-liquid-bg').addClass('image-added-to-stage'); 3324
3325 // Resize calcs 3326 $liquidBG_EL[k].resize(); 3327 3328 // Animate 3329 if ($($liquidBG_EL[k].canvasContainer).find('.nectar-liquid-bg.animated-in').length == 0) { 3330 $liquidBG_EL[k].animateProps($liquidBG_EL[k]); 3331 } 3332 3333 } 3334 } 3335 } 3336 if ($currentVisTab.find('.nectar-milestone').length > 0) { 3337 milestoneWaypoint(); 3338 } 3339 if ($currentVisTab.find('.nectar_image_with_hotspots[data-animation="true"]').length > 0) { 3340 imageWithHotspots(); 3341 setTimeout(function(){ 3342 $window.trigger('resize'); 3343 },100); 3344 } 3345 if ($currentVisTab.find('.nectar-fancy-ul').length > 0) { 3346 nectarFancyUlInit(); 3347 } 3348 if ($currentVisTab.find('.nectar-split-heading').length > 0) { 3349 splitLineHeadings(); 3350 } 3351 if ($currentVisTab.find('.wpb_column[data-border-animation="true"]').length > 0) { 3352 animatedColBorders(); 3353 } 3354 if ($currentVisTab.find('.wpb_animate_when_almost_visible').length > 0) { 3355 vcWaypoints(); 3356 } 3357 if ($currentVisTab.find('.nectar-animated-title').length > 0) { 3358 animatedTitles(); 3359 } 3360 if ($currentVisTab.find('.nectar-highlighted-text').length > 0) { 3361 highlightedText(); 3362 } 3363 if ($currentVisTab.find('.nectar_food_menu_item').length > 0) { 3364 foodMenuItems(); 3365 } 3366 if ($currentVisTab.find('.nectar-post-grid:not([data-animation="none"])').length > 0) { 3367 NectarPostGridWaypoint(); 3368 } 3369 3370 if (clickedTab.parents('.wpb_row').length > 0) { 3371 3372 if ($currentVisTab.find('.vc_pie_chart').length > 0 || 3373 $currentVisTab.find('.wp-video-shortcode').length > 0 || 3374 $currentVisTab.find('.post-area.masonry .posts-container').length > 0 || 3375 $currentVisTab.find('.twentytwenty-container').length > 0 || 3376 clickedTab.parents('#nectar_fullscreen_rows[data-content-overflow="scrollbar"]').length > 0 || 3377 clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ')').find('.wpb_gallery').length > 0 || 3378 clickedTab.parents('.wpb_row').next().hasClass('parallax_section')) { 3379 $window.trigger('resize'); 3380 } 3381 3382 if ($currentVisTab.find('.nectar-flickity').length > 0 && typeof Flickity != 'undefined') { 3383 var tabbedFlkty = Flickity.data(clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ')').find('.nectar-flickity')[0]); 3384 tabbedFlkty.resize(); 3385 } 3386 3387 if ($currentVisTab.find('.nectar-woo-flickity').length > 0 && typeof Flickity != 'undefined') { 3388 var wootabbedFlkty = Flickity.data(clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ')').find('.nectar-woo-flickity > ul')[0]); 3389 wootabbedFlkty.resize(); 3390 } 3391 3392 } 3393 3394 //SVG icons 3395 $currentVisTab.find('.svg-icon-holder').each(function (i) { 3396 3397 var $that = $(this); 3398 3399 setTimeout(function () { 3400 3401 var $animationDelay = 0; 3402 3403 if($that.is('[data-animation-delay]') && 3404 $that.attr('data-animation-delay').length > 0 && 3405 $that.attr('data-animation') != 'false') { 3406 $animationDelay = $that.attr('data-animation-delay'); 3407 } 3408 3409 clearTimeout($animatedSVGIconTimeout[i]); 3410 3411 if ($that.attr('data-animation') == 'false') { 3412 $that.css('opacity', '1'); 3413 $svgIcons[$that.find('svg').attr('id').slice(-1)].finish(); 3414 } else { 3415 3416 $svgIcons[$that.find('svg').attr('id').slice(-1)].reset(); 3417 $animatedSVGIconTimeout[i] = setTimeout(function () { 3418 $svgIcons[$that.find('svg').attr('id').slice(-1)].play(); 3419 }, $animationDelay); 3420 3421 } 3422 }, 150); 3423 }); 3424 3425 } 3426 3427 // Fix columns inside tabs 3428 clickedTab.parents('.tabbed').find('.wpb_row').each(function () { 3429 if (typeof $(this).find('[class*="vc_col-"]').first().offset() != 'undefined') { 3430 3431 var $firstChildOffset = $(this).find('[class*="vc_col-"]').first().offset().left; 3432 3433 $(this).find('[class*="vc_col-"]').each(function () { 3434 $(this).removeClass('no-left-margin'); 3435 if ($(this).offset().left < $firstChildOffset + 15) { 3436 $(this).addClass('no-left-margin'); 3437 } else { 3438 $(this).removeClass('no-left-margin'); 3439 } 3440 }); 3441 } 3442 3443 }); 3444 3445 $tabbedClickCount++; 3446 3447 // Magic line 3448 if (clickedTab.parent().parent().find('.magic-line').length > 0) { 3449 magicLineCalc(clickedTab); 3450 } 3451 3452 } 3453 3454 3455 /** 3456 * Tabbed element magic line - used for style "Minimal alt" 3457 * 3458 * @since 7.0 3459 */ 3460 function magicLineCalc($ele) { 3461 3462 var el, leftPos, ratio; 3463 3464 el = $ele.parent(); 3465 if (el.length) { 3466 leftPos = el.position().left; 3467 ratio = el.width(); 3468 } else { 3469 leftPos = ratio = 0; 3470 } 3471 3472 3473 $ele.parent().parent() 3474 .find('.magic-line') 3475 .css('transform', 'translateX(' + leftPos + 'px) scaleX(' + ratio + ')'); 3476 } 3477 3478 3479 /** 3480 * Tabbed element deep linking. 3481 * 3482 * @since 3.0 3483 */ 3484 function tabbbedDeepLinking() { 3485 3486 if (typeof nectarGetQueryParam['tab'] != 'undefined') { 3487 $('.wpb_tabs_nav').each(function () { 3488 3489 $(this).find('li').each(function () { 3490 3491 var $currentText = $(this).find('a').clone(), 3492 $getText = nectarGetQueryParam['tab'], 3493 $that = $(this); 3494 3495 $currentText.find('svg').remove(); 3496 $currentText = $currentText.text(); 3497 $currentText = $currentText.replace(/\s+/g, '-').toLowerCase(); 3498 3499 // SVG icons. 3500 if( $currentText.length > 0 && $currentText.substring(0,1) === '-' ) { 3501 $currentText = $currentText.substring(1); 3502 } 3503 3504 $getText = $getText.replace(/\s+/g, '-').replace(/</g, '<').replace(/"/g, '"').toLowerCase(); 3505 3506 if ($currentText == $getText) { 3507 3508 $(this).find('a').trigger('click'); 3509 3510 setTimeout(function () { 3511 $that.find('a').trigger('click'); 3512 }, 501); 3513 } 3514 3515 }); 3516 3517 }); 3518 3519 } 3520 3521 } 3522 3523 3524 3525 /** 3526 * Tabbed element initialization. 3527 * 3528 * @since 3.0 3529 */ 3530 function tabbedInit() { 3531 3532 // Click event 3533 $body.on('click', '.tabbed > ul li:not(.cta-button) a', function(){ 3534 tabbedChangeSection($(this)); 3535 return false;
3536 }); 3537 3538 $('.tabbed').each(function () { 3539 3540 var $that; 3541 3542 // Handle icons 3543 $(this).find('.wpb_tab').each(function (i) { 3544 3545 if ($(this).is('[data-tab-icon]') && $(this).attr('data-tab-icon').length > 0) { 3546 3547 $(this) 3548 .parents('.tabbed') 3549 .addClass('using-icons'); 3550 3551 $(this) 3552 .parents('.tabbed') 3553 .find('.wpb_tabs_nav li:nth-child(' + (i + 1) + ') > a') 3554 .prepend('<i class="' + $(this).attr("data-tab-icon") + '"></i>'); 3555 3556 } 3557 3558 // SVG icons 3559 if ($(this).find('.im-icon-wrap.tab-icon').length > 0) { 3560 3561 var $svg_icon_markup = $(this).find('.im-icon-wrap.tab-icon').detach(); 3562 $(this).parents('.tabbed') 3563 .find('.wpb_tabs_nav li:nth-child(' + (i + 1) + ') > a') 3564 .prepend($svg_icon_markup); 3565 } 3566 3567 }); 3568 3569 3570 if ($(this).find('.swiper-container').length == 0 && 3571 $(this).find('.testimonial_slider').length == 0 && 3572 $(this).find('.portfolio-items:not(".carousel")').length == 0 && 3573 $(this).find('.wpb_gallery .portfolio-items').length == 0 && 3574 $(this).find('iframe').length == 0) { 3575 $(this).find('> ul li:first-child a').trigger('click'); 3576 } 3577 3578 if ($(this).find('.testimonial_slider').length > 0 || 3579 $(this).find('.portfolio-items:not(".carousel")').length > 0 || 3580 $(this).find('.wpb_gallery .portfolio-items').length > 0 || 3581 $(this).find('iframe').length > 0) { 3582 3583 $that = $(this); 3584 $(this).find('.wpb_tab').show().css({ 3585 'opacity': 0, 3586 'height': '1px' 3587 }); 3588 3589 $(this).find('> ul li a').addClass('loading'); 3590 3591 setTimeout(function () { 3592 $that.find('.wpb_tab').hide().css({ 3593 'opacity': 1, 3594 'height': 'auto' 3595 }); 3596 3597 $that.find('> ul li a').removeClass('loading'); 3598 $that.find('> ul li:first-child a').trigger('click'); 3599 tabbbedDeepLinking(); 3600 3601 }, 900); 3602 } 3603 3604 $that = $(this); 3605 3606 // Minimal alt effect 3607 setTimeout(function () { 3608 if ($that.is('[data-style="minimal_alt"]')) { 3609 $that.find('> ul').append('<li class="magic-line" />'); 3610 magicLineCalc($that.find('> ul > li:first-child > a')); 3611 } 3612 }, 100); 3613 3614 3615 }); 3616 3617 // Minimal alt resize event. 3618 if ( $('.tabbed[data-style="minimal_alt"]').length > 0 ) { 3619 $window.on('smartresize',function(){ 3620 3621 $('.tabbed[data-style="minimal_alt"]').each(function(){ 3622 3623 if( $(this).find('a.active-tab').length > 0 ) { 3624 magicLineCalc( $(this).find('a.active-tab') ); 3625 } 3626 3627 }); 3628 3629 3630 }); 3631 3632 } 3633 3634 3635 tabbbedDeepLinking(); 3636 3637 // Vertical scrolling 3638 $('.nectar-scrolling-tabs').each(function(i) { 3639 if(!nectarDOMInfo.usingFrontEndEditor) { 3640 $verticalScrollingTabs[i] = new VerticalScrollingTabs($(this)); 3641 } 3642 }); 3643 3644 3645 } 3646 3647 3648 /** 3649 * Vertical Scrolling Tabs 3650 * 3651 * @since 12.0 3652 */ 3653 3654 function VerticalScrollingTabs(el) { 3655 3656 this.$el = el; 3657 this.$tabContent = el.find('.scrolling-tab-content'); 3658 this.$lineEl = el.find('.scrolling-tab-nav .line'); 3659 this.observer = null; 3660 3661 this.domSetup(); 3662 this.highlightObserve(); 3663 // Sticky handled in stickySidebarInit(); 3664 3665 } 3666 3667 VerticalScrollingTabs.prototype.domSetup = function() { 3668 3669 var that = this; 3670 var href = ''; 3671 3672 3673 // Icons 3674 this.$el.find('.wpb_tab').each(function (i) { 3675 3676 if ($(this).is('[data-tab-icon]') && $(this).attr('data-tab-icon').length > 0) { 3677 that.$el.addClass('using-icons'); 3678 3679 href = that.$el.find('.wpb_tabs_nav li:nth-child(' + (i + 1) + ') a').attr('href'); 3680 3681 that.$el 3682 .find('.wpb_tabs_nav li:nth-child(' + (i + 1) + ')') 3683 .addClass('has-icon') 3684 .prepend('<a class="skip-hash" href="'+href+'"><i class="' + $(this).attr("data-tab-icon") + '"></i></a>'); 3685 } 3686 3687 // SVG icons 3688 if ($(this).find('.im-icon-wrap.tab-icon').length > 0) { 3689 3690 href = that.$el.find('.wpb_tabs_nav li:nth-child(' + (i + 1) + ') a').attr('href'); 3691 3692 var $svg_icon_markup = $(this).find('.im-icon-wrap.tab-icon').detach(); 3693 that.$el 3694 .find('.wpb_tabs_nav li:nth-child(' + (i + 1) + ')') 3695 .addClass('has-icon') 3696 .prepend('<a class="skip-hash svg-icon-link" href="'+href+'"></a>'); 3697 3698 that.$el.find('.wpb_tabs_nav li:nth-child(' + (i + 1) + ') .svg-icon-link').append($svg_icon_markup); 3699 3700 } 3701 3702 }); 3703 3704 3705 // First active 3706 this.$el.find('.scrolling-tab-nav .menu-item:first').addClass('active'); 3707 this.lineAnimation(); 3708 3709 // Only tab 3710 if( this.$el.find('.scrolling-tab-nav .menu-item').length == 1 ) { 3711 this.$el.find('.scrolling-tab-nav').addClass('single-tab'); 3712 } 3713 3714 var $tabContent = this.$el.find('.scrolling-tab-content'); 3715 3716 this.$el.find('.scrolling-tab-nav .menu-item').each(function(i) { 3717 3718 i = i+1; 3719 var $tab = $tabContent.find('> div:nth-child('+i+')'); 3720 3721 // Add titles to mobile 3722 var $title = $(this).html(); 3723 $tab.prepend('<div class="scrolling-tab-mobile-title"><div class="inner">' + $title + '</div></div>'); 3724 $tab.find('.scrolling-tab-mobile-title a').contents().unwrap(); 3725
3726 // Create normal anchor relation. 3727 if( $tab ) { 3728 var id = $(this).find('a').attr('href'); 3729 id = id.substr(1); 3730 $tab.find('> .scrolling-tab-mobile-title').attr('id',id); 3731 $tab.removeAttr('id'); 3732 } 3733 3734 }); 3735 3736 3737 3738 }; 3739 3740 VerticalScrollingTabs.prototype.highlightObserve = function() { 3741 3742 var that = this; 3743 3744 if( !(nectarDOMInfo.usingMobileBrowser && nectarDOMInfo.winW < 1000) ) { 3745 3746 if( 'IntersectionObserver' in window ) { 3747 3748 var options = { 3749 rootMargin: '0px', 3750 threshold: 1 3751 } 3752 3753 this.observer = new IntersectionObserver(function(entries) { 3754 3755 entries.forEach(function(entry) { 3756 3757 var href = '#' + $(entry.target).attr('id'); 3758 var $menuItem = that.$el.find('.scrolling-tab-nav a[href="'+href+'"]'); 3759 3760 if (entry.isIntersecting && entry.intersectionRatio >= 1) { 3761 3762 $menuItem.parents('.menu-item').addClass('visible'); 3763 3764 } else { 3765 $menuItem.parents('.menu-item').removeClass('visible'); 3766 } 3767 3768 // Highlight 3769 var $firstVisLink = that.$el.find('.scrolling-tab-nav .menu-item.visible:first'); 3770 3771 // a link is visible 3772 if( $firstVisLink.length > 0 ) { 3773 that.$el.find('.scrolling-tab-nav .menu-item').removeClass('active'); 3774 $firstVisLink.addClass('active'); 3775 that.lineAnimation(); 3776 } 3777 3778 3779 }); 3780 3781 }, options); 3782 3783 // Observe each section. 3784 this.$tabContent.find('> div > .scrolling-tab-mobile-title[id]').each(function() { 3785 that.observer.observe($(this)[0]); 3786 }); 3787 3788 } // if intersection observer. 3789 3790 } // don't trigger on mobile. 3791 3792 }; 3793 3794 VerticalScrollingTabs.prototype.lineAnimation = function() { 3795 3796 var activeItem = this.$el.find('.scrolling-tab-nav .active'); 3797 3798 if( activeItem.length == 0 ) { 3799 return; 3800 } 3801 3802 var itemOffset = parseInt(activeItem.position().top); 3803 var itemHeight = parseInt(activeItem.height()); 3804 3805 this.$lineEl.css({ 3806 'max-height': itemHeight + 'px', 3807 'transform' : 'translate3d(0px, '+itemOffset+'px, 0px)' 3808 }); 3809 3810 }; 3811 3812 3813 3814 3815 3816 3817 3818 3819 /** 3820 * Toggle Panels element deep linking. 3821 * 3822 * @since 3.0 3823 */ 3824 function accordionDeepLinking() { 3825 3826 if (typeof nectarGetQueryParam['toggle'] != 'undefined') { 3827 $('.toggles').each(function () { 3828 3829 $(this).find('.toggle').each(function () { 3830 var $currentText = $(this).find('h3 a').clone(); 3831 var $getText = nectarGetQueryParam['toggle']; 3832 3833 $($currentText).find('i').remove(); 3834 $currentText = $currentText.text(); 3835 $currentText = $currentText.replace(/\s+/g, '-').toLowerCase(); 3836 $getText = $getText.replace(/\s+/g, '-').replace(/</g, '<').replace(/"/g, '"').toLowerCase(); 3837 3838 if ($currentText == $getText) { 3839 $(this).find('h3 a').trigger('click'); 3840 } 3841 }); 3842 }); 3843 } 3844 3845 } 3846 3847 3848 3849 3850 function accordionSizing() { 3851 3852 $('.toggles').each(function(){ 3853 3854 var openToggle = $(this).find('.toggle.open'); 3855 if( openToggle.length > 0 ) { 3856 var openToggleInner = openToggle.find('> div')[0]; 3857 3858 openToggleInner.style.maxHeight = openToggleInner.scrollHeight + "px"; 3859 } 3860 3861 3862 }); 3863 3864 } 3865 3866 /** 3867 * Toggle Panels element initialization. 3868 * 3869 * @since 3.0 3870 */ 3871 function accordionInit() { 3872 3873 setTimeout(function() { 3874 3875 $('.accordion').each(function () { 3876 3877 // Legacy. 3878 if( $(this).find('.toggle[data-inner-wrap="true"]').length == 0 ) { 3879 $(this).find('> .toggle').first().addClass('open').find('> div').show(); 3880 } else if(!nectarDOMInfo.usingFrontEndEditor) { 3881 var $firstToggle = $(this).find('> .toggle').first(); 3882 $firstToggle.addClass('open'); 3883 $firstToggle.find('> div')[0].style.maxHeight = $firstToggle.find('> div')[0].scrollHeight + "px"; 3884 } 3885 3886 $(this).find('> .toggle').first().find('a:not(.nectar-button) i').attr('class', 'icon-minus-sign'); 3887 3888 }); 3889 3890 accordionDeepLinking(); 3891 3892 }, 60); 3893 3894 if( $('.toggle[data-inner-wrap="true"]').length > 0 ) { 3895 $window.on('smartresize', accordionSizing); 3896 } 3897 3898 } 3899
3900 function accordionClickEvents() { 3901 3902 // Regular toggle click event 3903 $body.on('click', '.toggle h3 a', function () { 3904 3905 if (!$(this).parents('.toggles').hasClass('accordion')) { 3906 3907 // Legacy. 3908 if( $(this).parents('.toggle[data-inner-wrap="true"]').length == 0 ) { 3909 3910 $(this).parents('.toggle') 3911 .find('> div') 3912 .slideToggle(300); 3913 3914 } else { 3915 3916 var parentEl = $(this).parents('.toggle').find('> div')[0]; 3917 3918 if (parentEl.style.maxHeight) { 3919 parentEl.style.maxHeight = null; 3920 } else { 3921 parentEl.style.maxHeight = parentEl.scrollHeight + "px"; 3922 } 3923 3924 } 3925 3926 3927 $(this).parents('.toggle') 3928 .toggleClass('open'); 3929 3930 // Switch icon 3931 if ($(this).parents('.toggle').hasClass('open')) { 3932 $(this) 3933 .find('i') 3934 .attr('class', 'icon-minus-sign'); 3935 } else { 3936 $(this) 3937 .find('i') 3938 .attr('class', 'icon-plus-sign'); 3939 } 3940 3941 if ($(this).parents('.toggle').find('> div .iframe-embed').length > 0 && 3942 $(this).parents('.toggle').find('> div iframe.iframe-embed').height() == '0') { 3943 responsiveVideoIframes(); 3944 } 3945 3946 if ($(this).parents('.full-width-content').length > 0) { 3947 setTimeout(function () { 3948 fullWidthContentColumns(); 3949 }, 300); 3950 } 3951 3952 if ($('#nectar_fullscreen_rows').length > 0) { 3953 setTimeout(function () { 3954 $window.trigger('smartresize'); 3955 }, 300); 3956 } 3957 return false; 3958 } 3959 }); 3960 3961 // Accordion click event 3962 $body.on('click', '.accordion .toggle h3 a', function () { 3963 3964 if ($(this).parents('.toggle').hasClass('open')) { 3965 return false; 3966 } 3967 3968 var $t; 3969 var $parentToggles = $(this).parents('.toggles'); 3970 var $parentToggle = $(this).parents('.toggle'); 3971 3972 3973 // Legacy. 3974 if( $(this).parents('.toggle[data-inner-wrap="true"]').length == 0 ) { 3975 3976 $parentToggles.find('.toggle > div').slideUp(300); 3977 $parentToggles.find('.toggle h3 a i').attr('class', 'icon-plus-sign'); 3978 $parentToggles.find('.toggle').removeClass('open'); 3979 $parentToggle.find('> div').slideDown(300); 3980 $parentToggle.addClass('open'); 3981 3982 } else { 3983 3984 var parentEl = $parentToggle.find('> div')[0]; 3985 3986 $parentToggles.find('.toggle > div').each(function(){ 3987 $(this)[0].style.maxHeight = null; 3988 }); 3989 3990 $parentToggles.find('.toggle h3 a i').attr('class', 'icon-plus-sign'); 3991 $parentToggles.find('.toggle').removeClass('open'); 3992 3993 parentEl.style.maxHeight = parentEl.scrollHeight + "px"; 3994 3995 $parentToggle.addClass('open'); 3996 3997 } 3998 3999 // Switch icon 4000 if ($parentToggle.hasClass('open')) { 4001 $(this).find('i').attr('class', 'icon-minus-sign'); 4002 } else { 4003 $(this).find('i').attr('class', 'icon-plus-sign'); 4004 } 4005 4006 if ($(this).parents('.full-width-content').length > 0) { 4007 clearTimeout($t); 4008 $t = setTimeout(function () { 4009 fullWidthContentColumns(); 4010 }, 400); 4011 } 4012 if ($('#nectar_fullscreen_rows').length > 0) { 4013 clearTimeout($t); 4014 $t = setTimeout(function () { 4015 $window.trigger('smartresize'); 4016 }, 400); 4017 } 4018 4019 return false; 4020 4021 }); 4022 4023 } 4024 4025 4026 4027 4028 4029 /** 4030 * Color hex to rgb 4031 * 4032 * @since 3.0 4033 */ 4034 function shadeColor(hex, lum) { 4035 4036 // Validate hex string 4037 hex = String(hex).replace(/[^0-9a-f]/gi, ''); 4038 if (hex.length < 6) { 4039 hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2]; 4040 } 4041 lum = lum || 0; 4042 4043 // Convert to decimal and change luminosity 4044 var rgb = "#", 4045 c, i; 4046 for (i = 0; i < 3; i++) { 4047 c = parseInt(hex.substr(i * 2, 2), 16); 4048 c = Math.round(Math.min(Math.max(0, c + (c * lum)), 255)).toString(16); 4049 rgb += ("00" + c).substr(c.length); 4050 } 4051 4052 return rgb; 4053 } 4054 4055 /** 4056 * Jumbo size 3D nectar button. 4057 * 4058 * @since 3.0 4059 */ 4060 function createExtraJumboSize() { 4061 4062 $('.nectar-3d-transparent-button').each(function () { 4063 4064 if ($(this).css('visibility') != 'visible') { 4065 return; 4066 } 4067 4068 var $that = $(this), 4069 $size = $that.attr('data-size'), 4070 $padding = 0; 4071 4072 var $vert_height_divider = 1.7; 4073 4074 if ($size == 'extra_jumbo') { 4075 4076 var $font_size; 4077 4078 if (nectarDOMInfo.winW < 1000 && nectarDOMInfo.winW > 690) { 4079 $padding = 64; 4080 $font_size = 34; 4081 $that.find('.back-3d rect').attr('stroke-width', '12'); 4082 $vert_height_divider = 1.7; 4083 } else if (nectarDOMInfo.winW <= 690) { 4084 $padding = 46; 4085 $font_size = 16; 4086 $that.find('.back-3d rect').attr('stroke-width', '10'); 4087 $vert_height_divider = 1.7; 4088 } else { 4089 $padding = 100; 4090 $font_size = 64; 4091 $that.find('.back-3d rect').attr('stroke-width', '20'); 4092 $vert_height_divider = 1.6; 4093 } 4094 4095 4096 $that.find('svg text').attr('font-size', $font_size); 4097 4098 var $boundingRect = $(this).find('.back-3d .button-text')[0].getBoundingClientRect(), 4099 $text_width = $boundingRect.width, 4100 $text_height = $font_size * 1.5; 4101 4102 $that.css({ 4103 'width': ($text_width + $padding * 1.5) + 'px', 4104 'height': ($text_height + $padding) + 'px' 4105 }); 4106 4107 $that.find('> a').css({ 4108 'height': ($text_height + $padding) + 'px' 4109 }); 4110 4111 $that.find('.back-3d svg, .front-3d svg').css({ 4112 'width': ($text_width + $padding * 1.5) + 'px', 4113 'height': ($text_height + $padding) + 'px' 4114 }).attr('viewBox', '0 0 ' + ($text_width + $padding) + ' ' + ($text_height + $padding)); 4115 4116 $that.find('svg text').attr('transform', 'matrix(1 0 0 1 ' + ($text_width + $padding * 1.6) / 2 + ' ' + (($text_height + $padding) / $vert_height_divider) + ')'); 4117 $that.find('.front-3d ').css('transform-origin', '50% 50% -' + ($text_height + $padding) / 2 + 'px'); 4118 $that.find('.back-3d').css('transform-origin', '50% 50% -' + ($text_height + $padding) / 2 + 'px'); 4119 4120 } 4121 4122 }); 4123 4124 } 4125 4126 4127 /** 4128 * Nectar Button custom coloring 4129 * 4130 * @since 3.0 4131 */ 4132 function coloredButtons() { 4133 4134 $('.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 () { 4135 4136 var $usingMaterialSkin = ($('body.material[data-button-style^="rounded"]').length > 0) ? true : false;
4137 $(this).css('visibility', 'visible'); 4138 4139 if ($(this).hasClass('see-through-3') && $(this).attr('data-color-override') == 'false') { 4140 return true; 4141 } 4142 4143 var $color; 4144 var $that; 4145 4146 if ($(this).attr('data-color-override') != 'false') { 4147 $color = $(this).attr('data-color-override'); 4148 } else { 4149 4150 if ($(this).parents('.dark').length > 0) { 4151 $color = '#000000'; 4152 } else { 4153 $color = '#ffffff'; 4154 } 4155 4156 } 4157 4158 if (!$(this).hasClass('see-through-3')) { 4159 $(this).css('color', $color); 4160 } 4161 4162 $(this).find('i').css('color', $color); 4163 4164 var colorInt = parseInt($color.substring(1), 16); 4165 var $hoverColor = ($(this).has('[data-hover-color-override]')) ? $(this).attr('data-hover-color-override') : 'no-override'; 4166 var $hoverTextColor = ($(this).has('[data-hover-text-color-override]')) ? $(this).attr('data-hover-text-color-override') : '#fff'; 4167 4168 var R = (colorInt & 0xFF0000) >> 16; 4169 var G = (colorInt & 0x00FF00) >> 8; 4170 var B = (colorInt & 0x0000FF) >> 0; 4171 4172 var $opacityStr = ($(this).hasClass('see-through-3')) ? '1' : '0.75'; 4173 4174 $(this).css('border-color', 'rgba(' + R + ',' + G + ',' + B + ',' + $opacityStr + ')'); 4175 4176 // Material theme skin buttons w/ icons starting 4177 if ($usingMaterialSkin) { 4178 $(this).find('i').css({ 4179 'background-color': 'rgba(' + R + ',' + G + ',' + B + ',1)', 4180 'box-shadow': '0px 8px 15px rgba(' + R + ',' + G + ',' + B + ',0.24)' 4181 }); 4182 } 4183 4184 if ($(this).hasClass('see-through')) { 4185 4186 $that = $(this); 4187 4188 $(this).on('mouseenter touchstart', function () { 4189 $that.css('border-color', 'rgba(' + R + ',' + G + ',' + B + ',1)'); 4190 }); 4191 4192 $(this).on('mouseleave touchtouchend', function () { 4193 $that.css('border-color', 'rgba(' + R + ',' + G + ',' + B + ',1)'); 4194 $opacityStr = ($(this).hasClass('see-through-3')) ? '1' : '0.75'; 4195 $that.css('border-color', 'rgba(' + R + ',' + G + ',' + B + ',' + $opacityStr + ')'); 4196 }); 4197 4198 } else { 4199 4200 $(this).find('i').css('color', $hoverTextColor); 4201 4202 if ($hoverColor != 'no-override') { 4203 4204 $that = $(this); 4205 4206 $(this).on('mouseenter touchstart', function () { 4207 4208 $that.css({ 4209 'border-color': $hoverColor, 4210 'background-color': $hoverColor, 4211 'color': $hoverTextColor 4212 }); 4213 4214 // Material buttons w/ icons over 4215 if ($usingMaterialSkin) { 4216 $that.find('i').css({ 4217 'background-color': '', 4218 'box-shadow': '' 4219 }); 4220 } 4221 }); 4222 4223 $(this).on('mouseleave touchtouchend', function () { 4224 4225 $opacityStr = ($(this).hasClass('see-through-3')) ? '1' : '0.75'; 4226 4227 if ($usingMaterialSkin) { 4228 $that.find('i').css({ 4229 'background-color': 'rgba(' + R + ',' + G + ',' + B + ',1)', 4230 'box-shadow': '0px 8px 15px rgba(' + R + ',' + G + ',' + B + ',0.24)' 4231 }); 4232 } 4233 4234 if (!$that.hasClass('see-through-3')) { 4235 $that.css({ 4236 'border-color': 'rgba(' + R + ',' + G + ',' + B + ',' + $opacityStr + ')', 4237 'background-color': 'transparent', 4238 'color': $color 4239 }); 4240 } else { 4241 $that.css({ 4242 'border-color': 'rgba(' + R + ',' + G + ',' + B + ',' + $opacityStr + ')', 4243 'background-color': 'transparent' 4244 }); 4245 } 4246 4247 }); 4248 4249 } else { 4250 4251 $that = $(this); 4252 4253 $(this).on('mouseenter touchstart', function () { 4254 4255 $that.css({ 4256 'border-color': $hoverColor, 4257 'color': $hoverTextColor 4258 }); 4259 4260 }); 4261 4262 $(this).on('mouseleave touchtouchend', function () { 4263 4264 $opacityStr = ($that.hasClass('see-through-3')) ? '1' : '0.75'; 4265 $that.css({ 4266 'border-color': 'rgba(' + R + ',' + G + ',' + B + ',' + $opacityStr + ')', 4267 'color': $hoverTextColor 4268 }); 4269 4270 }); 4271 4272 } 4273 } 4274 }); 4275 4276 $('.nectar-button:not(.see-through):not(.see-through-2):not(.see-through-3)[data-color-override]').each(function () { 4277 4278 $(this).css('visibility', 'visible'); 4279 4280 if ($(this).attr('data-color-override') != 'false') { 4281 4282 var $color = $(this).attr('data-color-override'); 4283 4284 $(this) 4285 .removeClass('accent-color') 4286 .removeClass('extra-color-1') 4287 .removeClass('extra-color-2') 4288 .removeClass('extra-color-3') 4289 .css('background-color', $color); 4290 } 4291 4292 }); 4293 4294 4295 // Solid color tilt 4296 if ($('.swiper-slide .solid_color_2').length > 0 || $('.tilt-button-inner').length > 0) { 4297 4298 var $tiltButtonCssString = ''; 4299 var $color; 4300 4301 $('.swiper-slide .solid_color_2 a').each(function (i) { 4302 4303 $(this).addClass('instance-' + i); 4304 4305 if ($(this).attr('data-color-override') != 'false') { 4306 $color = $(this).attr('data-color-override'); 4307 } else {
4308 if ($(this).parents('.dark').length > 0) { 4309 $color = '#000000'; 4310 } 4311 else { 4312 $color = '#ffffff'; 4313 } 4314 } 4315 4316 $(this).css('color', $color); 4317 $(this).find('i').css('color', $color); 4318 4319 var $currentColor = $(this).css('background-color'), 4320 $topColor = shadeColor($currentColor, 0.13), 4321 $bottomColor = shadeColor($currentColor, -0.15); 4322 4323 $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 + '; } '; 4324 4325 }); 4326 4327 4328 $('.tilt-button-wrap a').each(function (i) { 4329 4330 $(this).addClass('instance-' + i); 4331 4332 var $currentColor = $(this).css('background-color'); 4333 var $color; 4334 4335 if ($(this).attr('data-color-override') != 'false') { 4336 $color = $(this).attr('data-color-override'); 4337 $(this).css('background-color', $color); 4338 $currentColor = $color; 4339 } 4340 4341 var $topColor = shadeColor($currentColor, 0.13), 4342 $bottomColor = shadeColor($currentColor, -0.15); 4343 4344 $tiltButtonCssString += '.tilt-button-wrap a.instance-' + i + ':after { background-color: ' + $topColor + '; }' + ' .tilt-button-wrap a.instance-' + i + ':before { background-color: ' + $bottomColor + '; } '; 4345 4346 }); 4347 4348 // Style 4349 nectarCreateStyle($tiltButtonCssString, 'tilt-button'); 4350 4351 } 4352 4353 4354 // Transparent 3D 4355 if ($('.nectar-3d-transparent-button').length > 0) { 4356 4357 var $3dTransButtonCssString = ''; 4358 $('.nectar-3d-transparent-button').each(function (i) { 4359 4360 var $that = $(this), 4361 $size = $that.attr('data-size'), 4362 $padding = 0, 4363 v1 = 1.5, 4364 v2 = 1.65, 4365 $font_size; 4366 4367 // Size 4368 if ($size == 'large') { 4369 $padding = 46; 4370 $font_size = 16; 4371 v1 = 1.5; 4372 v2 = 1.7; 4373 } else if ($size == 'medium') { 4374 $padding = 30; 4375 $font_size = 16; 4376 } else if ($size == 'small') { 4377 $padding = 20; 4378 $font_size = 12; 4379 } else if ($size == 'jumbo') { 4380 $padding = 54; 4381 $font_size = 24; 4382 v1 = 1.5; 4383 v2 = 1.68; 4384 } else if ($size == 'extra_jumbo') { 4385 $padding = 100; 4386 $font_size = 64; 4387 v1 = 1.6; 4388 v2 = 1.6; 4389 } 4390 4391 $that.find('svg text').attr('font-size', $font_size); 4392 4393 var $boundingRect = $(this).find('.back-3d .button-text')[0].getBoundingClientRect(), 4394 $text_width = $boundingRect.width, 4395 $text_height = $font_size * 1.5; 4396 4397 $that.css({ 4398 'width': ($text_width + $padding * 1.5) + 'px', 4399 'height': ($text_height + $padding) + 'px' 4400 }); 4401 4402 $that.find('> a').css({ 4403 'height': ($text_height + $padding) + 'px' 4404 }); 4405 4406 $that.find('.back-3d svg, .front-3d svg').css({ 4407 'width': ($text_width + $padding * 1.5) + 'px', 4408 'height': ($text_height + $padding) + 'px' 4409 }).attr('viewBox', '0 0 ' + ($text_width + $padding) + ' ' + ($text_height + $padding)); 4410 4411 $that.find('svg text').attr('transform', 'matrix(1 0 0 1 ' + ($text_width + $padding * v1) / 2 + ' ' + (($text_height + $padding) / v2) + ')'); 4412 $that.find('.front-3d, .back-3d').css('transform-origin', '50% 50% -' + ($text_height + $padding) / 2 + 'px'); 4413 4414 // Mask 4415 $(this).find('.front-3d svg > rect').attr('id', 'masked-rect-id-' + i); 4416 $(this).find('.front-3d defs mask').attr('id', 'button-text-mask-' + i); 4417 4418 $that.css('visibility', 'visible'); 4419 $3dTransButtonCssString += '#masked-rect-id-' + i + ' { mask: url(#button-text-mask-' + i + '); -webkit-mask: url(#button-text-mask-' + i + ')} '; 4420 4421 }); 4422 4423 // Extra jumbo resize 4424 createExtraJumboSize(); 4425 $window.on('smartresize', createExtraJumboSize); 4426 4427 // Style 4428 nectarCreateStyle($3dTransButtonCssString, 'nectar-td-button'); 4429 4430 } 4431 4432 // Gradient btn init 4433 setTimeout(function () { 4434 $('.nectar-button[class*="color-gradient"] .start').removeClass('loading'); 4435 }, 150); 4436 // No grad for ff 4437 if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1 || 4438 navigator.userAgent.indexOf("MSIE ") > -1 || 4439 navigator.userAgent.match(/Trident\/7\./)) { 4440 $('.nectar-button[class*="color-gradient"] .start').addClass('no-text-grad'); 4441 } 4442 } 4443 4444 4445 4446 4447 /** 4448 * Shortcode icon large style 4449 * 4450 * @since 1.0 4451 */ 4452 function largeIconHover() { 4453 $('.icon-3x').each(function () { 4454 $(this).closest('.col').on('mouseenter', function () { 4455 $(this).find('.icon-3x').addClass('hovered'); 4456 }); 4457 4458 $(this).closest('.col').on('mouseleave', function () { 4459 $(this).find('.icon-3x').removeClass('hovered'); 4460 }); 4461 }); 4462 4463 if (navigator.userAgent.indexOf("MSIE ") > -1 || navigator.userAgent.match(/Trident\/7\./)) { 4464 $('[class^="icon-"][class*="color-gradient"], .nectar_icon_wrap[data-color*="extra-color-gradient"] .nectar_icon, .nectar-gradient-text').addClass('no-grad'); 4465 } 4466 } 4467 4468 4469 4470 /** 4471 * Team member element - fullscreen style. 4472 * 4473 * @since 7.0 4474 */ 4475 function teamMemberFullscreen() { 4476 4477 if ( $('.team-member').length === 0 ) { 4478 return; 4479 } 4480 4481 // Open click event 4482 $body.on('click', '.team-member[data-style="bio_fullscreen"], .team-member[data-style="bio_fullscreen_alt"]', function () { 4483 4484 if ($('.nectar_team_member_overlay').length > 0) { 4485 return; 4486 } 4487 4488 var $usingBoxedClass = ($('body > #boxed').length > 0) ? 'in-boxed' : '', 4489 $teamMemberMeta = $(this).find('.nectar_team_bio').html(), 4490 $teamMemberTitle = ($(this).is('[data-style="bio_fullscreen_alt"]')) ? $(this).find('.team-meta h5').html() : $(this).find('.team-meta p').html(), 4491 $teamMemberImg = ($(this).find('.nectar_team_bio_img[data-img-src]').length > 0) ? $(this).find('.nectar_team_bio_img').attr('data-img-src') : '', 4492 $teamMemberStyle = ($(this).is('[data-style="bio_fullscreen_alt"]')) ? 'bio-fullscreen-alt' : 'bio-fullscreen', 4493 $teamName = ''; 4494 4495 if($(this).is('[data-style="bio_fullscreen_alt"]')) { 4496 $teamName = '<div class="title">' + $teamMemberTitle + '</div><h2>' + $(this).find('.team-meta h3').html() + '</h2>'; 4497 } else { 4498 $teamName = '<h2>' + $(this).find('.team-meta h3').html() + '</h2><div class="title">' + $teamMemberTitle + '</div>'; 4499 } 4500 4501 $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>'); 4502 4503 if ($teamMemberImg.length > 0) { 4504
4505 // Fade in img on load 4506 var teamTmpImg = new Image(); 4507 teamTmpImg.src = $teamMemberImg; 4508 teamTmpImg.onload = function () { 4509 $('.nectar_team_member_overlay .team_member_image').css('opacity', '1'); 4510 }; 4511 $('.nectar_team_member_overlay .team_member_image').css({ 4512 'background-image': 'url("' + $teamMemberImg + '")' 4513 }); 4514 } 4515 4516 var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $window.width() > 1000) ? 0 : $headerOuterEl.height(); 4517 $('.nectar_team_member_overlay .inner-wrap').css({ 4518 'padding-top': $headerNavSpace 4519 }); 4520 4521 // No-scroll class - ios ready 4522 if ($('.using-mobile-browser').length > 0) { 4523 $('body,html').addClass('nectar-no-scrolling'); 4524 } 4525 4526 teamFullscreenResize(); 4527 4528 // Transition in 4529 $('.nectar_team_member_overlay') 4530 .addClass('open') 4531 .addClass('animating'); 4532 4533 setTimeout(function () { 4534 $('.nectar_team_member_close').addClass('visible'); 4535 $('.nectar_team_member_overlay').removeClass('animating'); 4536 }, 500); 4537 4538 // Bind overflow 4539 if ($('.using-mobile-browser').length == 0) { 4540 fullscreenBioScrolling(); 4541 } 4542 4543 if ($('.team-member[data-style="bio_fullscreen"]').length > 0 && nectarDOMInfo.usingMobileBrowser) { 4544 $('.nectar_team_member_overlay').addClass('on-mobile'); 4545 } 4546 4547 }); 4548 4549 // Close click event 4550 $body.on('click', '.nectar_team_member_overlay', function () { 4551 4552 if (!$(this).hasClass('animating')) { 4553 4554 $('.nectar_team_member_overlay').removeClass('open'); 4555 $('.nectar_team_member_close').removeClass('visible'); 4556 4557 if ($('.using-mobile-browser').length > 0) { 4558 $('body,html').removeClass('nectar-no-scrolling'); 4559 } 4560 4561 setTimeout(function () { 4562 4563 $('.nectar_team_member_overlay, .nectar_team_member_close').remove(); 4564 4565 }, 820); 4566 } 4567 }); 4568 4569 if ($('.team-member[data-style="bio_fullscreen"]').length > 0 || $('.team-member[data-style="bio_fullscreen_alt"]').length > 0) { 4570 $window.on('resize', teamFullscreenResize); 4571 if( !nectarDOMInfo.usingMobileBrowser ) { 4572 var closeIndicator = new NectarIconMouseFollow('','close-indicator'); 4573 } 4574 4575 } 4576 4577 } 4578 4579 4580 /** 4581 * Team member element fullscreen resize event. 4582 * 4583 * @since 7.0 4584 */ 4585 function teamFullscreenResize() { 4586 var $leftHeaderSize = ($('body[data-header-format="left-header"]').length > 0 && $window.width() > 1000) ? 275 : 0; 4587 $('.nectar_team_member_overlay').css({ 4588 'width': $window.width() - $leftHeaderSize, 4589 'left': $leftHeaderSize 4590 }); 4591 } 4592 4593 /** 4594 * Team member element fullscreen overflow scrolling event. 4595 * 4596 * @since 7.0 4597 */ 4598 function fullscreenBioScrolling() { 4599 $('.nectar_team_member_overlay .inner-wrap').mousewheel(function (event, delta) { 4600 this.scrollTop -= (delta * 30); 4601 event.preventDefault(); 4602 }); 4603 4604 } 4605 4606 4607 4608 /** 4609 * WPBakery column element BG hover 4610 * 4611 * @since 5.0 4612 */ 4613 function columnBGColors() { 4614 4615 var $columnColorCSS = ''; 4616 4617 $('.wpb_column').each(function (i) { 4618 4619 $(this).removeClass(function (index, className) { 4620 return (className.match(/(^|\s)instance-\S+/g) || []).join(' '); 4621 }); 4622 4623 $(this).addClass('instance-' + i); 4624 4625 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 ' : ''; 4626 var $innerWrapSelector = ( $(this).find($innerSelector + ' > .column-bg-overlay-wrap').length > 0 ) ? '> .column-bg-overlay-wrap ' : ''; 4627 4628 // BG color 4629 if ($(this).attr('data-has-bg-color') == 'true') { 4630 $columnColorCSS += '.wpb_column.instance-' + i + $innerSelector + $innerWrapSelector + ' > .column-bg-overlay { background-color:' + $(this).attr('data-bg-color') + '; opacity: ' + $(this).attr('data-bg-opacity') + '; }'; 4631 } 4632 4633 // Hover bg color 4634 if ($(this).is('[data-hover-bg^="#"]')) { 4635 $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; }'; 4636 } 4637 }); 4638 4639 // Style 4640 nectarCreateStyle($columnColorCSS, 'column-bg-colors'); 4641 4642 } 4643 4644 4645 4646 /**
4647 * Displace filter column/row BG effect 4648 * 4649 * @since 10.5 4650 */ 4651 function nectarLiquidBGs() { 4652 $liquidBG_EL = []; 4653 4654 if (typeof NectarLiquid == 'undefined' || nectarDOMInfo.usingFrontEndEditor) { 4655 return; 4656 } 4657 4658 $('.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) { 4659 4660 var $that_el = $(this); 4661 var $type; 4662 var $el_type; 4663 4664 if ($(this).is('.row-bg')) { 4665 $type = $(this).parents('.row-bg-wrap').attr('data-bg-animation'); 4666 $el_type = 'row'; 4667 } 4668 else if ($(this).is('.column-image-bg')) { 4669 $type = $(this).parents('.column-image-bg-wrap').attr('data-bg-animation'); 4670 $el_type = 'col'; 4671 } 4672 4673 $liquidBG_EL[i] = new NectarLiquid($that_el, $type, $el_type); 4674 4675 }); 4676 } 4677 4678 4679 4680 /** 4681 * Morphing outline element creation. 4682 * 4683 * @since 5.0 4684 */ 4685 function morphingOutlines() { 4686 4687 if ($('.morphing-outline').length > 0) { 4688 4689 var $morphingOutlineCSS = '', 4690 $frontEndEditorMOSelector = ($('body.vc_editor').length > 0) ? '' : '>'; 4691 4692 $('.morphing-outline').each(function (i) { 4693 4694 $(this).removeClass(function (index, className) { 4695 return (className.match(/(^|\s)instance-\S+/g) || []).join(' '); 4696 }); 4697 4698 $(this).addClass('instance-' + i).css({ 4699 'visibility': 'visible' 4700 }); 4701 4702 var $width = $(this).find('.inner').width(), 4703 $height = $(this).find('.inner').height(), 4704 $border = parseInt($(this).attr("data-border-thickness")), 4705 $hover = ($('body[data-button-style*="rounded"]').length > 0) ? ':hover' : '', 4706 $hover2 = ($('body[data-button-style*="rounded"]').length > 0) ? '' : ':hover'; 4707 4708 $morphingOutlineCSS += 'body .morphing-outline.instance-' + i + ' .inner > * { color: ' + $(this).attr("data-starting-color") + '; } '; 4709 $morphingOutlineCSS += 'body .morphing-outline.instance-' + i + ' .inner:after { border-width:' + $(this).attr("data-border-thickness") + 'px ; border-color: ' + $(this).attr("data-starting-color") + '; } '; 4710 4711 $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") + '; } '; 4712 $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") + '; } '; 4713 4714 // Padding calcs 4715 $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}'; 4716 $morphingOutlineCSS += '.morphing-outline.instance-' + i + ' { padding: ' + (30 + ($width + 80 + $border * 2 - $height) / 2 - $border) + 'px 50px}'; 4717 $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 }'; 4718 4719 $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 }'; 4720 4721 // Hover 4722 $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}'; 4723 $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 }'; 4724 4725 }); 4726 4727 // Style 4728 nectarCreateStyle($morphingOutlineCSS, 'morphing-outlines'); 4729 4730 } 4731 4732 } 4733 4734 4735 /**
4736 * Morphing outline element initialization. 4737 * 4738 * @since 5.0 4739 */ 4740 function morphingOutlinesInit() { 4741 4742 if($('.morphing-outline').length > 0) { 4743 4744 // Create style. 4745 setTimeout(morphingOutlines, 100); 4746 setTimeout(fullWidthContentColumns, 125); 4747 4748 // Handle resize. 4749 $window.on('smartresize', morphingOutlines); 4750 4751 } 4752 4753 } 4754 4755 4756 4757 4758 /** 4759 * SVG icon element animations 4760 * 4761 * @since 6.0 4762 * @see waypoints 4763 */ 4764 function svgAnimations() { 4765 4766 var $svgOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : 'bottom-in-view'; 4767 4768 if ($svgIcons.length == 0) { 4769 4770 $('.svg-icon-holder:not(.animated-in)').has('svg').each(function (i) { 4771 4772 var $that = $(this); 4773 4774 if (bypassAnimations) { 4775 $that.attr('data-animation', 'false'); 4776 } 4777 // Size 4778 $that.find('svg').css({ 4779 'height': parseInt($that.attr('data-size')) + 'px', 4780 'width': parseInt($that.attr('data-size')) + 'px' 4781 }); 4782 4783 // Animation 4784 $(this).find('svg').attr('id', 'nectar-svg-animation-instance-' + i); 4785 4786 var $animationSpeed = ($that.is('[data-animation-speed]') && $that.attr('data-animation-speed').length > 0) ? $that.attr('data-animation-speed') : 200; 4787 4788 if ($that.attr('data-animation') == 'false') { 4789 $animationSpeed = 1; 4790 $that.css('opacity', '1'); 4791 } 4792 4793 if (!$that.hasClass('bound')) { 4794 $svgIcons[i] = new Vivus($that.find('svg').attr('id'), { 4795 type: 'delayed', 4796 pathTimingFunction: Vivus.EASE_OUT, 4797 animTimingFunction: Vivus.LINEAR, 4798 duration: $animationSpeed, 4799 onReady: svgInit 4800 }); 4801 } 4802 4803 if ($animationSpeed !== 1) { 4804 4805 var waypoint = new Waypoint({ 4806 element: $that, 4807 handler: function () { 4808 if ($that.hasClass('animated-in')) { 4809 waypoint.destroy(); 4810 return; 4811 } 4812 4813 checkIfReady(); 4814 $that.addClass('animated-in'); 4815 waypoint.destroy(); 4816 }, 4817 offset: $svgOffsetPos 4818 4819 }); 4820 4821 } else { 4822 checkIfReady(); 4823 } 4824 4825 function checkIfReady() { 4826 4827 var $animationDelay = 0; 4828 4829 if($that.is('[data-animation-delay]') && 4830 $that.attr('data-animation-delay').length > 0 && 4831 $that.attr('data-animation') != 'false') { 4832 $animationDelay = $that.attr('data-animation-delay'); 4833 } 4834 4835 var $iconID = $that.find('svg').attr('id').replace(/[^0-9]/g, ''); 4836 4837 if ($svgIcons[$iconID].isReady == true) { 4838 setTimeout(function () { 4839 $that.css('opacity', '1'); 4840 $svgIcons[$iconID].reset().play(); 4841 }, $animationDelay); 4842 } else { 4843 setTimeout(checkIfReady, 50); 4844 } 4845 } 4846 4847 function svgInit() { 4848 4849 //set size 4850 $that.css({ 4851 'height': parseInt($that.attr('data-size')) + 'px', 4852 'width': parseInt($that.attr('data-size')) + 'px' 4853 }); 4854 4855 } 4856 4857 $that.addClass('bound'); 4858 4859 }); 4860 4861 4862 // SVG in equal height column resize 4863 if ($('.vc_row-o-equal-height .svg-icon-holder[data-animation="true"]').length > 0 && 4864 $('#nectar_fullscreen_rows').length == 0) { 4865 4866 $window.on('smartresize', function () { 4867 clearTimeout($svgResizeTimeout); 4868 $svgResizeTimeout = setTimeout(function () { 4869 4870 if ($svgIcons.length > 0) { 4871 $('.svg-icon-holder.animated-in').each(function () { 4872 4873 $(this).css('opacity', '1'); 4874 if ($(this).is('[id]')) { 4875 var $iconID = $(this).attr('id').replace(/[^0-9]/g, ''); 4876 $svgIcons[$iconID].finish(); 4877 } 4878 4879 }); 4880 } 4881 4882 }, 300); 4883 4884 }); 4885 4886 } 4887 4888 } 4889 4890 // After svg animated icons initalized 4891 else { 4892 $('.svg-icon-holder').addClass('animated-in').css('opacity', '1'); 4893 } 4894 4895 // Full vc row support 4896 $('#nectar_fullscreen_rows .svg-icon-holder.animated-in').has('svg').each(function (i) { 4897 4898 var $animationDelay = 0; 4899 4900 if($(this).is('[data-animation-delay]') && 4901 $(this).attr('data-animation-delay').length > 0 && 4902 $(this).attr('data-animation') != 'false') { 4903 $animationDelay = $(this).attr('data-animation-delay'); 4904 } 4905 4906 var $that = $(this); 4907 4908 var $iconID = $that.find('svg').attr('id').replace(/[^0-9]/g, ''); 4909 4910 clearTimeout($animatedSVGIconTimeout[i]); 4911 4912 if ($that.attr('data-animation') == 'false') { 4913 4914 $that.css('opacity', '1'); 4915 $svgIcons[$iconID].finish(); 4916 4917 } else { 4918 4919 if ($(this).parents('.active').length > 0 || 4920 $(this).parents('#footer-outer').length > 0 || 4921 $('body.mobile').length > 0) { 4922 4923 $svgIcons[$iconID].reset(); 4924 $animatedSVGIconTimeout[i] = setTimeout(function () { 4925 $svgIcons[$iconID].play(); 4926 }, $animationDelay); 4927 4928 } else { 4929 $svgIcons[$iconID].reset().stop(); 4930 } 4931 } 4932 }); 4933 4934 } 4935 4936 4937 4938 /** 4939 * Fancy unordered list element initialization. 4940 * 4941 * @since 4.0 4942 * @see waypoints 4943 */ 4944 function nectarFancyUlInit() { 4945 4946 $($fullscreenSelector + '.nectar-fancy-ul').each(function () { 4947 4948 var $animation = $(this).attr('data-animation'), 4949 $animationDelay = 0; 4950 4951 if($(this).is('[data-animation-delay]') && 4952 $(this).attr('data-animation-delay').length > 0 && 4953 $(this).attr('data-animation') != 'false') { 4954 $animationDelay = $(this).attr('data-animation-delay'); 4955 } 4956 4957 if ($animation == 'true') { 4958 4959 var $that = $(this), 4960 waypoint = new Waypoint({ 4961 element: $that, 4962 handler: function () { 4963 4964 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 4965 waypoint.destroy(); 4966 return; 4967 } 4968 4969 setTimeout(function () { 4970 $that.find('li').each(function (i) { 4971 var $that = $(this); 4972 $that.delay(i * 220).transition({ 4973 'opacity': '1', 4974 'left': '0' 4975 }, 220, 'easeOutCubic'); 4976 }); 4977 }, $animationDelay); 4978 4979 $that.addClass('animated-in'); 4980 waypoint.destroy(); 4981 }, 4982 offset: 'bottom-in-view' 4983 4984 }); 4985 4986 } 4987 4988 }); 4989 4990 } 4991 4992 4993 /** 4994 * Fancy unordered list element icons. 4995 * 4996 * @since 11.0 4997 */ 4998 function nectarFancyUlIcons() { 4999 5000 $('.nectar-fancy-ul:not([data-list-icon="dot"])').each(function () { 5001 5002 var $icon = $(this).attr('data-list-icon'), 5003 $color = $(this).attr('data-color'); 5004 5005 $(this).find('li').each(function () { 5006 $(this).find('> i').remove(); 5007 $(this).prepend('<i class="icon-default-style ' + $icon + ' ' + $color + '"></i> '); 5008 }); 5009 5010 }); 5011 5012 } 5013 5014 5015 /** 5016 * Flipbox element height calculations. 5017 * 5018 * @since 7.0 5019 */ 5020 function flipBoxHeights() { 5021 5022 $('.nectar-flip-box').each(function () { 5023
5024 var $flipBoxMinHeight = parseInt($(this).attr('data-min-height')), 5025 $flipBoxHeight = $(this).find('.flip-box-front .inner').height(); 5026 5027 if ($(this).find('.flip-box-back .inner').height() > $(this).find('.flip-box-front .inner').height()) { 5028 $flipBoxHeight = $(this).find('.flip-box-back .inner').height(); 5029 } 5030 5031 if ($flipBoxHeight >= $flipBoxMinHeight - 80) { 5032 $(this).find('> div').css('height', $flipBoxHeight + 80); 5033 } else { 5034 $(this).find('> div').css('height', 'auto'); 5035 } 5036 5037 // Safari needs 3D translate. 5038 if ($(this).parent().hasClass('wpb_wrapper')) { 5039 $(this).parent().css('transform', 'translateZ(0)'); 5040 } 5041 5042 }); 5043 } 5044 5045 5046 5047 5048 /** 5049 * Flipbox element events. 5050 * 5051 * @since 7.0 5052 */ 5053 function flipBoxInit() { 5054 5055 if( $('.nectar-flip-box').length > 0 ) { 5056 5057 // Mobile gets click. 5058 if (nectarDOMInfo.usingMobileBrowser) { 5059 $body.on('click', '.nectar-flip-box', function () { 5060 $(this).toggleClass('flipped'); 5061 }); 5062 } 5063 5064 flipBoxHeights(); 5065 5066 // Handle resize. 5067 $window.on('smartresize', flipBoxHeights); 5068 } 5069 5070 } 5071 5072 5073 5074 5075 /** 5076 * Parallax Scrolling 5077 * 5078 * @since 3.0 5079 */ 5080 $.fn.parallaxScroll = function (xpos, speedFactor, outerHeight) { 5081 5082 var $windowDOMWidth = nectarDOMInfo.winW, 5083 $windowDOMHeight = nectarDOMInfo.winH, 5084 $orientationChange = 0, 5085 $this = $(this), 5086 firstTop = $this.offset().top; 5087 5088 // Get the starting position of each element to have parallax applied to it 5089 $this.each(function () { 5090 firstTop = $this.offset().top; 5091 }); 5092 5093 var getHeight = function (jqo) { 5094 return jqo.outerHeight(true); 5095 }; 5096 5097 // setup defaults if arguments aren't specified 5098 if (arguments.length < 1 || xpos === null) { 5099 xpos = "50%"; 5100 } 5101 if (arguments.length < 2 || speedFactor === null) { 5102 speedFactor = 0.25; 5103 } 5104 if (arguments.length < 3 || outerHeight === null) { 5105 outerHeight = true; 5106 } 5107 5108 var $onMobileBrowser = nectarDOMInfo.usingMobileBrowser, 5109 classic_mobile_menu_open = false, 5110 firstSection = false, 5111 $element = $this, 5112 height = getHeight($element); 5113 5114 5115 $this.find('.row-bg.using-image, .page-header-bg-image, .image-bg, .video-wrap').addClass('translate'); 5116 5117 setInterval(function () { 5118 5119 height = getHeight($element); 5120 classic_mobile_menu_open = ($('body.classic_mobile_menu_open.mobile').length > 0) ? true : false; 5121 5122 }, 600); 5123 5124 5125 if($element.parents('.top-level').length > 0 && $element.parents('.parallax_slider_outer').length > 0 || 5126 $element.parents('.top-level').length > 0 && $element.is('.nectar-recent-posts-single_featured') || 5127 $element.is('.wpb_row.top-level') || 5128 $('.wpb_row').length == 0) { 5129 firstSection = true; 5130 } 5131 5132 if ($('.wpb_row').length == 0 && $element.parents('.parallax_slider_outer').length > 0 && $element.is('[data-full-width="true"]') || 5133 ($('#portfolio-extra').length > 0 && $element.parents('.parallax_slider_outer').length > 0 && $element.parents('.wpb_row').length > 0 && $element.parents('.wpb_row').index() == '0')) { 5134 firstSection = true; 5135 } 5136 5137 if (nectarDOMInfo.usingFrontEndEditor) { 5138 firstSection = false; 5139 } 5140 5141 var nectarSliderElBool = $this.is('.nectar-slider-wrap'); 5142 var pageHeaderBool = ($this.find('.page-header-bg-image').length > 0) ? true : false; 5143 var $elToParallax = false; 5144 5145 if (nectarSliderElBool) { 5146 5147 if ($this.find('.video-wrap').length > 0 || $this.find('.image-bg').length > 0) { 5148 $elToParallax = $this.find('.video-wrap, .image-bg'); 5149 } 5150 5151 } else { 5152 5153 if ($this.find('.row-bg.using-image').length > 0) { 5154 $elToParallax = $this.find('.row-bg.using-image'); 5155 } else if ($this.find('.page-header-bg-image').length > 0) { 5156 $elToParallax = $this.find('.page-header-bg-image'); 5157 } 5158 5159 } 5160 5161
5162 function update() { 5163 5164 firstTop = $element.offset().top; 5165 5166 // Check if totally above or totally below viewport. 5167 if ($elToParallax == false || 5168 firstTop + height < nectarDOMInfo.scrollTop || 5169 firstTop > nectarDOMInfo.scrollTop + nectarDOMInfo.winH || 5170 $('body.material-ocm-open').length > 0) { 5171 // Skip processing. 5172 } else { 5173 5174 // Nectar slider 5175 if (nectarSliderElBool) { 5176 5177 if (firstSection) { 5178 // Top level row 5179 if (!classic_mobile_menu_open) { 5180 $this.find('.video-wrap, .image-bg').css({ 5181 'transform': 'translate3d(0, ' + parseFloat(nectarDOMInfo.scrollTop * speedFactor) + 'px, 0)' 5182 }); 5183 } 5184 } else { 5185 $this.find('.video-wrap, .image-bg').css({ 5186 'transform': 'translate3d(0, ' + parseFloat((($windowDOMHeight + nectarDOMInfo.scrollTop - firstTop) * speedFactor)) + 'px, 0)' 5187 }); 5188 } 5189 5190 } else { 5191 5192 // Rows 5193 if (firstSection) { 5194 // Top level row 5195 if (!classic_mobile_menu_open) { 5196 $elToParallax.css({ 5197 'transform': 'translate3d(0, ' + parseFloat(nectarDOMInfo.scrollTop * speedFactor) + 'px, 0)' 5198 }); 5199 } 5200 } else { 5201 // Regular rows further down page 5202 $elToParallax.css({ 5203 'transform': 'translate3d(0, ' + parseFloat((($windowDOMHeight + nectarDOMInfo.scrollTop - firstTop) * speedFactor)) + 'px, 0), scale(1.005)' 5204 }); 5205 } 5206 5207 // Page header 5208 if (pageHeaderBool && !classic_mobile_menu_open) { 5209 $elToParallax.css({ 5210 'transform': 'translate3d(0, ' + parseFloat(nectarDOMInfo.scrollTop * speedFactor) + 'px, 0)' 5211 }); 5212 } 5213 5214 } 5215 5216 } 5217 5218 5219 //if on mobile, auto RAF 5220 if ($onMobileBrowser) { 5221 requestAnimationFrame(update); 5222 } 5223 5224 } 5225 5226 if (window.addEventListener) { 5227 5228 if (nectarDOMInfo.usingFrontEndEditor || !nectarDOMInfo.usingMobileBrowser) { 5229 $window.on('resize', function () { 5230 $windowDOMWidth = nectarDOMInfo.winW; 5231 $windowDOMHeight = nectarDOMInfo.winH; 5232 }); 5233 } 5234 5235 if (nectarDOMInfo.usingFrontEndEditor) { 5236 5237 $window.on('scroll.parallaxSections', update); 5238 5239 } else if (!nectarDOMInfo.usingMobileBrowser) { 5240 5241 window.addEventListener('scroll', function () { 5242 requestAnimationFrame(update); 5243 }, false); 5244 5245 } else { 5246 5247 //if on mobile, auto RAF 5248 requestAnimationFrame(update); 5249 5250 window.addEventListener("orientationchange", function () { 5251 $orientationChange = 1; 5252 }); 5253 5254 $window.on('resize', function () { 5255 if (($window.width() != $windowDOMWidth && $window.height != $windowDOMHeight) || $orientationChange == 1) { 5256 5257 //store the current window dimensions 5258 $windowDOMWidth = nectarDOMInfo.winW; 5259 $windowDOMHeight = nectarDOMInfo.winH; 5260 5261 $orientationChange = 0; 5262 } 5263 }); 5264 5265 } 5266 5267 } 5268 5269 $window.on('resize.parallaxSections', update); 5270 5271 update(); 5272 5273 }; 5274 5275 5276 5277 5278 /** 5279 * Runs before other full width section calculations. 5280 * 5281 * @since 4.0 5282 */ 5283 function fullWidthSectionsPreInit() { 5284 5285 // Nectar Slider force full width parent row when using full width element option. 5286 $('.wpb_row .vc_col-sm-12 .nectar-slider-wrap[data-full-width="true"]').each(function () { 5287 if ($(this).parents('.wpb_row.full-width-section').length == 0 && $(this).parents('.wpb_row.full-width-content').length == 0) { 5288 $(this).parents('.wpb_row').addClass('full-width-section'); 5289 } 5290 }); 5291 5292 // Handle percent row padding values when using the boxed theme option. 5293 if( !nectarDOMInfo.usingMobileBrowser && $('body[data-boxed-style="1"]').length > 0 && $('#boxed').length > 0 ) { 5294 fullWidthRowPaddingAdjustCalcBoxed(); 5295 } 5296 5297 } 5298 5299 5300 5301 /** 5302 * Full width section calculations. 5303 * 5304 * @since 4.0 5305 */ 5306 function fullWidthSections() { 5307 5308 var $windowInnerWidth = nectarDOMInfo.winW, 5309 $bodyBorderWidth = ($('.body-border-right').length > 0 && $windowInnerWidth > 1000) ? parseInt($('.body-border-right').width()) * 2 : 0, 5310 $container_width = ($('.container-wrap').length > 0) ? parseInt($('.container-wrap').outerWidth()) : $window.width(); 5311 5312 var $windowWidth, 5313 $justOutOfSight, 5314 $mainContentWidth; 5315 5316 if ($('#boxed').length == 1) { 5317 $justOutOfSight = ((parseInt($('.container-wrap').width())
5317- parseInt($('.main-content').width())) / 2) + 4; 5318 } else { 5319 5320 // Ext responsive mode is on - add the extra padding into the calcs 5321 var $extResponsivePadding = ($('body[data-ext-responsive="true"]').length > 0 && $windowInnerWidth >= 1000) ? 180 : 0; 5322 5323 if ($container_width - $bodyBorderWidth <= parseInt($('.main-content').css('max-width'))) { 5324 $windowWidth = parseInt($('.main-content').css('max-width')); 5325 } else { 5326 $windowWidth = $container_width - $bodyBorderWidth; 5327 } 5328 5329 5330 var $contentWidth = parseInt($('.main-content').css('max-width')); 5331 5332 // Single post fullwidth 5333 if ($('body.single-post[data-ext-responsive="true"]').length > 0 && $('.container-wrap.no-sidebar').length > 0) { 5334 $contentWidth = $('.post-area').width(); 5335 $extResponsivePadding = 0; 5336 } 5337 5338 $justOutOfSight = Math.ceil((($windowWidth + $extResponsivePadding - $contentWidth) / 2)); 5339 } 5340 5341 5342 // Full width content row type. 5343 $('.carousel-outer').has('.carousel-wrap[data-full-width="true"]').css('overflow', 'visible'); 5344 5345 $('.carousel-wrap[data-full-width="true"], .portfolio-items[data-col-num="elastic"]:not(.fullwidth-constrained), .full-width-content').each(function () { 5346 5347 var $leftHeaderSize = ($('#header-outer[data-format="left-header"]').length > 0 && $windowInnerWidth >= 1000) ? parseInt($('#header-outer[data-format="left-header"]').width()) : 0; 5348 var $bodyBorderWidth = ($('.body-border-right').length > 0 && $windowInnerWidth > 1000) ? (parseInt($('.body-border-right').width()) * 2) - 2 : 0; 5349 5350 // Single post fullwidth. 5351 if ($('#boxed').length == 1) { 5352 5353 $mainContentWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').width()) : parseInt($(this).parents('.container').width()); 5354 5355 if ($('body.single-post[data-ext-responsive="true"]').length > 0 && $('.container-wrap.no-sidebar').length > 0 && $(this).parents('.post-area').length > 0) { 5356 $contentWidth = $('.post-area').width(); 5357 $extResponsivePadding = 0; 5358 $windowWidth = $container_width - $bodyBorderWidth; 5359 $justOutOfSight = Math.ceil((($windowWidth + $extResponsivePadding - $contentWidth) / 2)); 5360 } else { 5361 if ($(this).parents('.page-submenu').length > 0) { 5362 $justOutOfSight = ((parseInt($('.container-wrap').width()) - $mainContentWidth) / 2); 5363 } 5364 else { 5365 $justOutOfSight = ((parseInt($('.container-wrap').width()) - $mainContentWidth) / 2) + 4; 5366 } 5367 } 5368 } else { 5369 5370 if ($('body.single-post[data-ext-responsive="true"]').length > 0 && $('.container-wrap.no-sidebar').length > 0 && $(this).parents('.post-area').length > 0) { 5371 5372 $contentWidth = $('.post-area').width(); 5373 $extResponsivePadding = 0; 5374 $windowWidth = $container_width - $bodyBorderWidth; 5375 5376 } else { 5377 5378 var $mainContentMaxWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').css('max-width')) : parseInt($(this).parents('.container').css('max-width')); 5379 5380 if ($container_width - $bodyBorderWidth <= $mainContentMaxWidth) { 5381 $windowWidth = $mainContentMaxWidth; 5382 } 5383 5384 $contentWidth = $mainContentMaxWidth; 5385 $extResponsivePadding = ($('body[data-ext-responsive="true"]').length > 0 && nectarDOMInfo.winW >= 1000) ? 180 : 0; 5386 5387 if ($leftHeaderSize > 0) { 5388 $extResponsivePadding = ($('body[data-ext-responsive="true"]').length > 0 && nectarDOMInfo.winW >= 1000) ? 120 : 0; 5389 } 5390 5391 } 5392 5393 $justOutOfSight = Math.ceil((($windowWidth + $extResponsivePadding - $contentWidth) / 2)); 5394 } 5395 5396 var $extraSpace = 0; 5397 if ($(this).hasClass('carousel-wrap')) { 5398 $extraSpace = 1; 5399 } 5400 if ($(this).hasClass('portfolio-items')) { 5401 $extraSpace = 5; 5402 } 5403 5404 var $carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight * 2) : $container_width - $bodyBorderWidth + $extraSpace; 5405 5406 // When using gutter on portfolio don't add extra space 5407 if ($('#boxed').length == 0 && $(this).hasClass('portfolio-items') && $(this).is('[data-gutter*="px"]') && $(this).attr('data-gutter').length > 0 && $(this).attr('data-gutter') != 'none') { 5408 if ($container_width > 1000) { 5409 $carouselWidth = $container_width - $bodyBorderWidth + 3; 5410 } 5411 else { 5412 $carouselWidth = $container_width - $bodyBorderWidth; 5413 } 5414 } 5415 5416 if ($(this).parent().hasClass('default-style')) { 5417 5418 $mainContentWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').width()) : parseInt($(this).parents('.container').width()); 5419 5420 if ($('#boxed').length != 0) { 5421 $carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight * 2) : $container_width + $extraSpace; 5422 } else { 5423 $carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight * 2) : ($container_width - $bodyBorderWidth) - (($container_width - $bodyBorderWidth) * 0.025) + $extraSpace; 5424 $windowWidth = ($container_width - $bodyBorderWidth <= $mainContentWidth) ? $mainContentWidth : ($container_width - $bodyBorderWidth) - (($container_width - $bodyBorderWidth) * 0.025);
5425 $justOutOfSight = Math.ceil((($windowWidth - $mainContentWidth) / 2)); 5426 } 5427 5428 } 5429 5430 else if ($(this).parent().hasClass('spaced')) { 5431 5432 $mainContentWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').width()) : parseInt($(this).parents('.container').width()); 5433 5434 if ($('#boxed').length != 0) { 5435 $carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight * 2) - ($container_width * 0.02) : $container_width + $extraSpace; 5436 } else { 5437 $carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight * 2) : ($container_width - $bodyBorderWidth) - Math.ceil(($container_width - $bodyBorderWidth) * 0.02) + $extraSpace; 5438 var $windowWidth2 = ($container_width - $bodyBorderWidth <= $mainContentWidth) ? $mainContentWidth : ($container_width - $bodyBorderWidth) - (($container_width - $bodyBorderWidth) * 0.02); 5439 $justOutOfSight = Math.ceil((($windowWidth2 - $mainContentWidth) / 2) + 2); 5440 } 5441 } 5442 5443 // Make sure the element/row is capable of going full width. 5444 if (!$(this).parents('.span_9').length > 0 && 5445 !$(this).parent().hasClass('span_3') && 5446 $(this).parent().attr('id') != 'sidebar-inner' && 5447 $(this).parent().attr('id') != 'portfolio-extra' && 5448 !$(this).find('.carousel-wrap[data-full-width="true"]').length > 0 && 5449 !$(this).find('.nectar-carousel-flickity-fixed-content').length > 0 && 5450 !$(this).find('.portfolio-items:not(".carousel")[data-col-num="elastic"]').length > 0) { 5451 5452 // Escape if inside woocoommerce page and not using applicable layout 5453 if ($('.single-product').length > 0 && 5454 $(this).parents('#tab-description').length > 0 && 5455 $(this).parents('.full-width-tabs').length == 0) { 5456 5457 $(this).css({ 5458 'visibility': 'visible' 5459 }); 5460 5461 } else { 5462 // Portfolio. 5463 if ($(this).hasClass('portfolio-items')) { 5464 $(this).css({ 5465 'margin-left': -$justOutOfSight, 5466 'left': 0, 5467 'width': $carouselWidth, 5468 'visibility': 'visible' 5469 }); 5470 5471 } else { 5472 5473 // Fullscreen page rows left. 5474 if ($('#nectar_fullscreen_rows').length > 0 && $(this).hasClass('wpb_row')) { 5475 5476 $(this).css({ 5477 'margin-left': -$justOutOfSight, 5478 'width': $carouselWidth, 5479 'visibility': 'visible' 5480 }); 5481 5482 } else { 5483 // Regular rows. 5484 $(this).css({ 5485 'left': 0, 5486 'margin-left': -$justOutOfSight, 5487 'width': $carouselWidth, 5488 'visibility': 'visible' 5489 }); 5490 } 5491 5492 } 5493 5494 } 5495 } 5496 5497 else if ($(this).parent().attr('id') == 'portfolio-extra' && $('#full_width_portfolio').length != 0) { 5498 5499 $(this).css({ 5500 'left': 0, 5501 'margin-left': -$justOutOfSight, 5502 'width': $carouselWidth, 5503 'visibility': 'visible' 5504 }); 5505 5506 } else { 5507 5508 $(this).css({ 5509 'margin-left': 0, 5510 'width': 'auto', 5511 'left': '0', 5512 'visibility': 'visible' 5513 }); 5514 } 5515 5516 }); 5517 5518 } 5519 5520 5521 5522 /** 5523 * Parallax scroll speed helper. 5524 * 5525 * @since 4.0 5526 */ 5527 function parallaxSrollSpeed(speedString) { 5528 5529 var speed; 5530 switch (speedString) { 5531 case 'slow': 5532 speed = 0.6; 5533 break; 5534 case 'medium': 5535 speed = 0.4; 5536 break; 5537 case 'fast': 5538 speed = 0.25; 5539 break; 5540 } 5541 5542 return speed; 5543 } 5544 5545 5546 /** 5547 * Parallax scroll initialization. 5548 * 5549 * @since 4.0 5550 */ 5551 function parallaxScrollInit() { 5552 5553 if (nectarDOMInfo.usingMobileBrowser && $('body[data-remove-m-parallax="1"]').length > 0) { 5554 return; 5555 } 5556 5557 parallaxRowsBGCals(); 5558 5559 $('.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 () { 5560 var $id = $(this).attr('id'); 5561 5562 if ( $(this).find('[data-parallax-speed="fixed"]').length == 0) { 5563 5564 if ($(this).find('.row-bg').length == 0) { 5565 //set default scroll speed if not defined 5566 $('#' + $id).parallaxScroll("50%", 0.25); 5567 } else { 5568 $('#' + $id + ".parallax_section").parallaxScroll("50%", parallaxSrollSpeed($(this).find('.row-bg').attr('data-parallax-speed'))); 5569 } 5570 5571 } 5572 5573 $(this).addClass('nectar-parallax-enabled'); 5574 5575 }); 5576 5577 } 5578 5579 5580 /** 5581 * First full width row on page 5582 * 5583 * @since 4.0 5584 */ 5585 function firstFWSection() { 5586 $('.full-width-section.wpb_row, .full-width-content.wpb_row').each(function () { 5587 5588 if (!$(this).parent().hasClass('span_9') && 5589 !$(this).parent().hasClass('span_3') && 5590 $(this).parent().attr('id') != 'sidebar-inner') { 5591 5592 if ($(this).parents('#portfolio-extra').length > 0 && $('#full_width_portfolio').length == 0) { 5593 return false;
5594 } 5595 5596 if ($(this).index() == '0' && 5597 $pageHeaderBG.length == 0 && 5598 $('.page-header-no-bg').length == 0 && 5599 $('.project-title').length == 0 && 5600 $('body.single').length == 0 && 5601 $('.project-title').length == 0) { 5602 5603 $(this).addClass('first-section'); 5604 var $that = $(this); 5605 setTimeout(function () { 5606 $that.addClass('loaded'); 5607 }, 50); 5608 5609 } 5610 5611 } 5612 5613 }); 5614 } 5615 5616 5617 5618 5619 5620 /** 5621 * Parallax row background height calculations. 5622 * 5623 * @since 6.0 5624 */ 5625 function parallaxRowsBGCals() { 5626 5627 if (nectarDOMInfo.usingMobileBrowser && $('body[data-remove-m-parallax="1"]').length > 0) { 5628 return; 5629 } 5630 5631 $('.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 () { 5632 5633 var $non_page_builder_slider; 5634 5635 if ($(this).find('.row-bg').length == 0 && $(this).find('.page-header-bg-image').length > 0) { 5636 //skip processing. 5637 } else if ($(this).find('.row-bg').length == 0 && $(this).find('.image-bg').length > 0) { 5638 5639 $non_page_builder_slider = false;
5640 5641 // First nectar slider shortcode without page builder 5642 if ($('.wpb_row').length == 0 && 5643 $(this).parents('.nectar-slider-wrap[data-full-width="true"]').length > 0 && 5644 $(this).parents('.parallax_slider_outer').length > 0 && 5645 $(this).parents('.parallax_slider_outer').index() == '1') { 5646 $non_page_builder_slider = true; 5647 } 5648 5649 // Portfolio first 5650 if ($('#portfolio-extra').length > 0 && 5651 $(this).parents('.wpb_row').length > 0 && 5652 $(this).parents('.parallax_slider_outer').length > 0 && 5653 $(this).parents('.wpb_row').index() == '0') { 5654 $non_page_builder_slider = true; 5655 } 5656 5657 // Set heights. 5658 if ($(this).parents('.top-level').length > 0 && !nectarDOMInfo.usingFrontEndEditor || 5659 $non_page_builder_slider && !nectarDOMInfo.usingFrontEndEditor) { 5660 $(this).find('.image-bg').css({ 5661 'height': Math.ceil($(this).parent().offset().top * 0.25) + $(this).outerHeight(true) 5662 }); 5663 } else { 5664 $(this).find('.image-bg').css({ 5665 'height': Math.ceil($window.height() * 0.25) + $(this).outerHeight(true) 5666 }); 5667 } 5668 5669 } 5670 5671 // Video backgrounds. 5672 else if ($(this).find('.row-bg').length == 0 && $(this).find('.video-wrap').length > 0) { 5673 5674 $non_page_builder_slider = false;
5675 // First nectar slider shortcode without page builder 5676 if ($('.wpb_row').length == 0 && 5677 $(this).parents('.nectar-slider-wrap[data-full-width="true"]').length > 0 && 5678 $(this).parents('.parallax_slider_outer').length > 0 && 5679 $(this).parents('.parallax_slider_outer').index() == '1') { 5680 $non_page_builder_slider = true; 5681 } 5682 // Portfolio first 5683 if ($('#portfolio-extra').length > 0 && 5684 $(this).parents('.wpb_row').length > 0 && 5685 $(this).parents('.parallax_slider_outer').length > 0 && 5686 $(this).parents('.wpb_row').index() == '0') { 5687 $non_page_builder_slider = true; 5688 } 5689 5690 // Set heights. 5691 if ($(this).parents('.top-level').length > 0 && !nectarDOMInfo.usingFrontEndEditor || 5692 $non_page_builder_slider && !nectarDOMInfo.usingFrontEndEditor) { 5693 5694 $(this).find('.video-wrap').css({ 5695 'height': Math.ceil($(this).parent().offset().top * 0.25) + $(this).outerHeight(true) 5696 }); 5697 } 5698 5699 else { 5700 $(this).find('.video-wrap').css({ 5701 'height': Math.ceil($window.height() * 0.25) + $(this).outerHeight(true) 5702 }); 5703 } 5704 5705 var vid = $(this).find('.video-wrap video'), 5706 vid_w_orig = 1280, 5707 vid_h_orig = 720; 5708 5709 // Get the parent element size 5710 var container_w = vid.parent().width(), 5711 container_h = vid.parent().height(), 5712 scale_w = container_w / vid_w_orig, 5713 scale_h = container_h / vid_h_orig; 5714 5715 var scale = scale_w > scale_h ? scale_w : scale_h; 5716 5717 // Scale the video. 5718 vid.width(scale * vid_w_orig); 5719 vid.height(scale * vid_h_orig); 5720 5721 } else { 5722 5723 if ($(this).is('.nectar-recent-posts-single_featured') && $(this).parents('.top-level').length > 0 && !nectarDOMInfo.usingFrontEndEditor) { 5724 //skip processing. 5725 } else if (!$(this).hasClass('top-level') || nectarDOMInfo.usingFrontEndEditor) { 5726 5727 var $ifFast = ($(this).find('.row-bg[data-parallax-speed="fast"]').length > 0) ? 60 : 0; 5728 $(this).find('.row-bg').css({ 5729 'height': Math.ceil($window.height() * parallaxSrollSpeed($(this).find('.row-bg').attr('data-parallax-speed'))) + $(this).outerHeight(true) + $ifFast 5730 }); 5731 5732 } 5733 5734 } 5735 5736 }); 5737 5738 } 5739 5740 5741 /** 5742 * Class names added for specific full width section rows at top 5743 * 5744 * @since 3.0 5745 */ 5746 function fwsClasses() { 5747 5748 $('.wpb_wrapper > .nectar-slider-wrap[data-full-width="true"]').each(function () { 5749 if (!$(this).parent().hasClass('span_9') && !$(this).parent().hasClass('span_3') && $(this).parent().attr('id') != 'sidebar-inner') { 5750 if ($(this).parents('.wpb_row').index() == '0') { 5751 $(this).addClass('first-nectar-slider'); 5752 } 5753 } 5754 }); 5755 5756 var $contentElementsNum = ($('#portfolio-extra').length == 0) ? $('.main-content > .row > *').length : $('.main-content > .row #portfolio-extra > *').length; 5757 5758 if ($('#portfolio-extra').length == 0) { 5759 $contentElementsNum = ($('.main-content > .row > .wpb_row').length > 0) ? $('.main-content > .row > .wpb_row').length : $('.main-content > .row > *').length; 5760 } else { 5761 $contentElementsNum = $('.main-content > .row #portfolio-extra > *').length; 5762 } 5763 5764 $('.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 () { 5765 5766 if (!$(this).parent().hasClass('span_9') && !$(this).parent().hasClass('span_3') && $(this).parent().attr('id') != 'sidebar-inner') { 5767 5768 if ($(this).parents('.wpb_row').length > 0) { 5769 5770 if ($(this).parents('#portfolio-extra').length > 0 && 5771 $('#full_width_portfolio').length == 0) { 5772 return false; 5773 } 5774 5775 ////first 5776 if ($(this).parents('.wpb_row').index() == '0' && $pageHeaderBG.length != 0) { 5777 //skip processing. 5778 } 5779 else if ($(this).parents('.wpb_row').index() == '0' && 5780 $pageHeaderBG.length == 0 && $('.page-header-no-bg').length == 0 && 5781 $('.project-title').length == 0 && $(this).parents('.wpb_row').index() == '0' && 5782 $('.project-title').length == 0 && $('body[data-bg-header="true"]').length == 0) { 5783 5784 if ($('.single').length == 0) { 5785 $('.container-wrap').css('padding-top', '0px'); 5786 } else { 5787 $(this).addClass('first-section'); 5788 } 5789 5790 } 5791 5792 // Check if it's also last (i.e. the only fws) 5793 if ($(this).parents('.wpb_row').index() == $contentElementsNum - 1 && $('#respond').length == 0) { 5794 if ($(this).attr('id') != 'portfolio-filters-inline') { 5795 $('.container-wrap').css('padding-bottom', '0px'); 5796 $('#call-to-action .triangle').remove(); 5797 } 5798 } 5799 5800 } else { 5801 5802 if ($(this).parents('#portfolio-extra').length > 0 && $('#full_width_portfolio').length == 0) { 5803 return false;
5804 } 5805 5806 if ($(this).find('.portfolio-filters-inline').length == 0 && $(this).attr('id') != 'post-area') { 5807 5808 ////first 5809 if ($(this).index() == '0' && $pageHeaderBG.length != 0) { 5810 //skip processing. 5811 } 5812 else if ($(this).index() == '0' && $pageHeaderBG.length == 0 && 5813 $(this).index() == '0' && $('.page-header-no-bg').length == 0 && 5814 $(this).index() == '0' && !$(this).hasClass('blog_next_prev_buttons') && 5815 !$(this).hasClass('nectar-shop-outer') && $(this).parents('.pum-container').length == 0) { 5816 5817 if ($('body[data-header-resize="0"]').length == 1 && $('.single').length == 0 || $('body.material').length > 0 && $('.single').length == 0) { 5818 5819 if (!$('body.blog .blog-fullwidth-wrap > .masonry:not(.meta-overlaid)').length > 0) { 5820 $('.container-wrap').css('padding-top', '0px'); 5821 } 5822 5823 } 5824 5825 else { 5826 $(this).addClass('first-section'); 5827 } 5828 5829 } 5830 5831 //check if it's also last (i.e. the only fws) 5832 if ($(this).index() == $contentElementsNum - 1 && $('#respond').length == 0 && $('body.woocommerce-checkout').length == 0) { 5833 $('.container-wrap').css('padding-bottom', '0px'); 5834 $('.bottom_controls').css('margin-top', '0px'); 5835 $('#call-to-action .triangle').remove(); 5836 } 5837 5838 } 5839 } 5840 } 5841 5842 }); 5843 5844 5845 $('#portfolio-extra > .nectar-slider-wrap[data-full-width="true"], .portfolio-wrap').each(function () { 5846 //check if it's last 5847 if ($(this).index() == $contentElementsNum - 1 && $('#commentform').length == 0 && $('#pagination').length == 0) { 5848 if (parseInt($('.container-wrap').css('padding-bottom')) > 0) { 5849 $(this).css('margin-bottom', '-40px'); 5850 } 5851 $('#call-to-action .triangle').remove(); 5852 } 5853 }); 5854 5855 5856 $('.portfolio-filters').each(function () { 5857 ////first 5858 if ($(this).index() == '0' && $pageHeaderBG.length != 0 || $(this).index() == '0') { 5859 $(this).addClass('first-section nder-page-header'); 5860 } else if ($(this).index() == '0' && $pageHeaderBG.length == 0 || $(this).index() == '0') { 5861 $(this).css({ 5862 'margin-top': '0px' 5863 }).addClass('first-section'); 5864 } 5865 }); 5866 5867 5868 $('.portfolio-filters-inline').each(function () { 5869 ////first 5870 if ($(this).parents('.wpb_row').length > 0) { 5871 //skip processing. 5872 } else { 5873 if ($(this).index() == '0' && $pageHeaderBG.length != 0 || $(this).index() == '0') { 5874 $(this).addClass('first-section nder-page-header'); 5875 } else if ($(this).index() == '0' && $pageHeaderBG.length == 0 || $(this).index() == '0') { 5876 5877 $(this).css({ 5878 'margin-top': '-30px', 5879 'padding-top': '50px' 5880 }).addClass('first-section'); 5881 5882 } 5883 } 5884 5885 }); 5886 5887 5888 } 5889 5890 5891 5892 5893 5894 5895 /** 5896 * Full width row padding adjust calculations. 5897 * 5898 * @since 3.0 5899 */ 5900 function fullWidthRowPaddingAdjustCalc() { 5901 5902 if ($('#boxed').length == 0) { 5903 5904 $('.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 () { 5905 5906 var $windowHeight = $window.width(), 5907 $topPadding = ($(this).attr('data-top-percent')) ? $(this).attr('data-top-percent') : 'skip', 5908 $bottomPadding = ($(this).attr('data-bottom-percent')) ? $(this).attr('data-bottom-percent') : 'skip'; 5909 5910 //top 5911 if ($topPadding != 'skip') { 5912 $(this).css('padding-top', $windowHeight * (parseInt($topPadding) / 100)); 5913 } 5914 5915 //bottom 5916 if ($bottomPadding != 'skip') { 5917 $(this).css('padding-bottom', $windowHeight * (parseInt($bottomPadding) / 100)); 5918 } 5919 5920 }); 5921 } 5922 } 5923 5924 /** 5925 * Full width row padding adjust calculations for boxed theme option. 5926 * 5927 * @since 11.0.4 5928 */ 5929 function fullWidthRowPaddingAdjustCalcBoxed() { 5930 5931 if ($('#boxed').length > 0) { 5932 5933 $('.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 () { 5934 5935 var $topPadding = ($(this).attr('data-top-percent')) ? $(this).attr('data-top-percent') : 'skip', 5936 $bottomPadding = ($(this).attr('data-bottom-percent')) ? $(this).attr('data-bottom-percent') : 'skip'; 5937 5938 //top 5939 if ($topPadding != 'skip') { 5940 $(this).css('padding-top', $topPadding); 5941 } 5942 5943 //bottom 5944 if ($bottomPadding != 'skip') { 5945 $(this).css('padding-bottom', $bottomPadding); 5946 } 5947 5948 }); 5949 } 5950 5951 } 5952 5953 5954 /** 5955 * Full width row padding adjust initialization 5956 * 5957 * @since 10.5 5958 */ 5959 function fullWidthRowPaddingAdjust() { 5960 5961 if (nectarDOMInfo.usingMobileBrowser) { 5962 fullWidthRowPaddingAdjustCalc(); 5963 } 5964 5965 $window.on('resize', fullWidthRowPaddingAdjustCalc); 5966 5967 } 5968 5969 5970 5971 5972 5973 /** 5974 * Full width content row auto equal height cols. 5975 * 5976 * @since 4.0 5977 */ 5978 function fullWidthContentColumns() { 5979 5980 var $frontEndEditorElDiv = ($('body.vc_editor').length > 0) ? '.vc_element > ' : ''; 5981 5982 $('.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 () { 5983 5984 // Only set the height if more than one column 5985 if ($(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col').length > 1) { 5986 5987 var tallestColumn = 0;
5988 var $columnInnerHeight = 0; 5989 var $column_inner_selector; 5990 5991 $(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col').each(function () { 5992 5993 $column_inner_selector = ($(this).find('> .vc_column-inner > .wpb_wrapper').length > 0) ? '.vc_column-inner' : '.column-inner-wrap > .column-inner'; 5994 5995 var $padding = ( $body.is('[data-flex-cols="true"]') ) ? parseInt($(this).find('> .vc_column-inner').css('padding-top')) : parseInt($(this).css('padding-top')); 5996 var $frontEndEditorElPadding = ($frontEndEditorElDiv.length > 2 && $(this).find('> .vc_column-inner').length > 0) ? parseInt($(this).find('> .vc_column-inner').css('padding-top')) : 0; 5997 5998 if( $(this).find('> ' + $column_inner_selector + ' > .wpb_wrapper').height() + ($padding * 2) + $frontEndEditorElPadding > tallestColumn ) { 5999 tallestColumn = $(this).find('> ' + $column_inner_selector + ' > .wpb_wrapper').height() + ($padding * 2) + $frontEndEditorElPadding; 6000 } 6001 6002 }); 6003 6004 $(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col').each(function () { 6005 6006 $column_inner_selector = ($(this).find('> .vc_column-inner > .wpb_wrapper').length > 0) ? '.vc_column-inner' : '.column-inner-wrap > .column-inner'; 6007 6008 // Columns with content 6009 if ($(this).find('> ' + $column_inner_selector + ' > .wpb_wrapper > *').length > 0) { 6010 6011 // Added in 7.6 to fix equal height columns 6012 if ($frontEndEditorElDiv.length < 2 && !$(this).parent().parent().hasClass('vc_row-o-equal-height')) { 6013 $(this).css('height', tallestColumn); 6014 6015 if( $body.is('[data-flex-cols="true"]') ) { 6016 $(this).find('> .vc_column-inner').css('height', tallestColumn); 6017 } 6018 6019 } else if ($frontEndEditorElDiv.length > 2 && !$(this).parent().parent().parent().hasClass('vc_row-o-equal-height')) { 6020 $(this).css('height', tallestColumn); 6021 6022 if( $body.is('[data-flex-cols="true"]') ) { 6023 $(this).find('> .vc_column-inner').css('height', tallestColumn); 6024 } 6025 6026 } 6027 } 6028 6029 // Empty columns 6030 else { 6031 if ($(this).is('[data-using-bg="true"]')) { 6032 6033 $(this).css('min-height', tallestColumn); 6034 6035 if( $body.is('[data-flex-cols="true"]') ) { 6036 $(this).find('> .vc_column-inner').css('min-height', tallestColumn); 6037 } 6038 6039 if ($(this).is('[data-animation*="reveal"]')) { 6040 $(this).find('.column-inner') 6041 .css('min-height', tallestColumn); 6042 } 6043 6044 } 6045 } 6046 6047 }); 6048 6049 // Nested column height 6050 if (nectarDOMInfo.winW < 1000) { 6051 $(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col .wpb_row .col').css('min-height', '0px'); 6052 } 6053 6054 // Vertically center 6055 if ($(this).hasClass('vertically-align-columns') && 6056 nectarDOMInfo.winW > 1000 && 6057 !$(this).hasClass('vc_row-o-equal-height')) { 6058 6059 // Parent columns 6060 $(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col').each(function () { 6061 6062 $column_inner_selector = ($(this).find('> .vc_column-inner > .wpb_wrapper').length > 0) ? '.vc_column-inner' : '.column-inner-wrap > .column-inner'; 6063
6064 $columnInnerHeight = $(this).find('> ' + $column_inner_selector + ' > .wpb_wrapper').height(); 6065 6066 var $marginCalc = ($(this).height() / 2) - ($columnInnerHeight / 2); 6067 6068 if ($marginCalc <= 0) { 6069 $marginCalc = 0; 6070 } 6071 6072 $(this).find('> ' + $column_inner_selector + ' > .wpb_wrapper') 6073 .css('margin-top', $marginCalc) 6074 .css('margin-bottom', $marginCalc); 6075 6076 }); 6077 6078 6079 } 6080 6081 } 6082 6083 }); 6084 6085 6086 if( $('body[data-flex-cols="true"]').length == 0 ) { 6087 6088 // Equal height columns in container type with reveal columns 6089 $('.main-content > .row > .wpb_row:not(.full-width-content).vc_row-o-equal-height').each(function () { 6090 if ($(this).find('>.span_12 > ' + $frontEndEditorElDiv + ' .wpb_column[data-animation*="reveal"]').length > 0) { 6091 6092 var tallestColumn = 0; 6093 6094 $(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col').each(function () { 6095 6096 var $padding = parseInt($(this).find('> .column-inner-wrap > .column-inner').css('padding-top')); 6097 6098 if( $(this).find('> .column-inner-wrap > .column-inner').height() + ($padding * 2) > tallestColumn ) { 6099 tallestColumn = $(this).find('> .column-inner-wrap > .column-inner').height() + ($padding * 2); 6100 } 6101 6102 }); 6103 6104 $(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col').each(function () { 6105 6106 // Columns with content 6107 if ($(this).find('> .column-inner-wrap > .column-inner .wpb_wrapper > *').length > 0) { 6108 $(this).find('> .column-inner-wrap').css('height', tallestColumn); 6109 } 6110 // Empty columns 6111 else { 6112 $(this).css('min-height', tallestColumn); 6113 if ($(this).is('[data-animation*="reveal"]')) { 6114 $(this).find('.column-inner').css('min-height', tallestColumn); 6115 } 6116 } 6117 }); 6118 6119 } 6120 }); 6121 6122 // Using equal height option, top/bottom padding % needs to be convered into px for cross browser (flex bug) 6123 $('.wpb_row.vc_row-o-equal-height>.span_12> ' + $frontEndEditorElDiv + '.wpb_column[class*="padding-"][data-padding-pos="all"]').each(function () { 6124 if ($(this).parents('.tabbed').length == 0) { 6125 $(this).css({ 6126 'padding-top': $(this).css('padding-left'), 6127 'padding-bottom': $(this).css('padding-left') 6128 }); 6129 } 6130 }); 6131 6132 } // endif; Not using modern grid system. 6133 6134 } 6135 6136 6137 6138 6139 /** 6140 * Mouse parallax row option. 6141 * 6142 * @since 4.0 6143 */ 6144 function mouseParallaxInit() { 6145 6146 $('.wpb_row:has(.nectar-parallax-scene)').each(function (i) { 6147 6148 var $strength = parseInt($(this).find('.nectar-parallax-scene').attr('data-scene-strength')); 6149 6150 $mouseParallaxScenes[i] = $(this).find('.nectar-parallax-scene').parallax({ 6151 scalarX: $strength, 6152 scalarY: $strength 6153 }); 6154 6155 // Wait until the images in the scene have loaded. 6156 var images = $(this).find('.nectar-parallax-scene li'); 6157 6158 $.each(images, function () { 6159 if ($(this).find('div').length > 0) { 6160 var el = $(this).find('div'), 6161 image = el.css('background-image').replace(/"/g, '').replace(/url\(|\)$/ig, ''); 6162 if (image && image !== '' && image !== 'none') { 6163 images = images.add($('<img>').attr('src', image)); 6164 } 6165 } 6166 }); 6167 6168 }); 6169 6170 } 6171 6172 6173 6174 6175 6176 6177 /** 6178 * Add checkmark icons to unorder list with checkmark class. 6179 * 6180 * @since 2.0 6181 */ 6182 function ulCheckmarks() { 6183 $('ul.checks li').each(function () { 6184 if ($(this).find('i.fa-check-circle').length == 0) { 6185 $(this).prepend('<i class="fa fa-check-circle"></i>'); 6186 } 6187 }); 6188 } 6189 6190 6191 6192 6193 /** 6194 * Allow CTA element BG color to also act as a link. 6195 * 6196 * @since 11.0 6197 */ 6198 function ctaLinkBG() { 6199 6200 $body.on('click','.nectar-cta[data-using-bg="true"]:not([data-style="material"]) .link_wrap', function() { 6201 6202 $(this).find('a.link_text')[0].click(); 6203 6204 }); 6205 6206 } 6207 6208 6209 6210 /** 6211 * Add CSS default animation classes through JS to 6212 * avoid inital animation on page load. 6213 * 6214 * @since 11.0 6215 */ 6216 function nectarKeyframeAssist() { 6217 6218 $('.nectar-cta[data-style="arrow-animation"]').addClass('loaded'); 6219 6220 } 6221 6222 6223 6224 6225 /** 6226 * Page builder row background layer animations. 6227 * 6228 * @since 9.0 6229 * @see waypoints 6230 */ 6231 function rowBGAnimations() { 6232 6233 var $rowBGAnimationsOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : '93%'; 6234 var $rowBGAnimationsRevealOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : '75%'; 6235 var $rowBGOffset; 6236 6237 $($fullscreenSelector + '.row-bg-wrap[data-bg-animation]:not([data-bg-animation="none"]):not([data-bg-animation*="displace-filter"]) .row-bg').each(function () { 6238 6239 var $animation = $(this).parents('.row-bg-wrap').attr('data-bg-animation'); 6240 6241 if( $animation != 'zoom-out-reveal' && $animation.indexOf('reveal-from-') == -1 ) { 6242 $rowBGOffset = $rowBGAnimationsOffsetPos; 6243 } else { 6244 $rowBGOffset = $rowBGAnimationsRevealOffsetPos; 6245 } 6246 6247 if( !$(this).hasClass('using-image') && $(this).parents('.nectar-scrolling-text').length == 0 ) { 6248 6249 if( $animation != 'zoom-out-reveal' && $animation.indexOf('reveal-from-') == -1 ) { 6250 return; 6251 } 6252 6253 } 6254 6255 var $that = $(this); 6256 var waypoint = new Waypoint({ 6257 element: $that.parents('.row-bg-wrap'), 6258 handler: function () { 6259 6260 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 6261 waypoint.destroy(); 6262 return; 6263 } 6264 6265 $that.parents('.inner-wrap').addClass('animated-in'); 6266 6267 if( $animation == 'zoom-out-reveal' || $animation.indexOf('reveal-from-') > -1 || $that.parents('.nectar-scrolling-text').length > 0 ) { 6268 $that.parents('.row-bg-wrap').addClass('animated-in'); 6269 } 6270 6271 waypoint.destroy(); 6272 }, 6273 offset: $rowBGOffset 6274 }); 6275 6276 }); 6277 6278 } 6279 6280 6281 /** 6282 * Page builder column background layer animations. 6283 * 6284 * @since 9.0 6285 * @see waypoints 6286 */ 6287 function columnBGAnimations() { 6288 6289 var $colBGAnimationsOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : '93%'; 6290 var $colBGAnimationsRevealOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : '80%'; 6291 var $colBGOffset; 6292 6293 $($fullscreenSelector + '.column-image-bg-wrap[data-bg-animation]:not([data-bg-animation="none"]):not([data-bg-animation*="displace-filter"]) .column-image-bg').each(function () { 6294 6295 var $animation = $(this).parents('.column-image-bg-wrap').attr('data-bg-animation'); 6296 6297 if( $animation != 'zoom-out-reveal' && $animation.indexOf('reveal-from-') == -1 ) { 6298 $colBGOffset = $colBGAnimationsOffsetPos; 6299 } else { 6300 6301 if( $animation == 'ro-reveal-from-bottom' && $fullscreenMarkupBool == false ) { 6302 $colBGOffset = '95%'; 6303 } else if( $animation == 'ro-reveal-from-top' && $fullscreenMarkupBool == false ) { 6304 $colBGOffset = '65%'; 6305 } else { 6306 $colBGOffset = $colBGAnimationsRevealOffsetPos; 6307 } 6308 } 6309 6310 var $that = $(this); 6311 6312 var waypoint = new Waypoint({ 6313 element: $that.parents('.column-image-bg-wrap'), 6314 handler: function () { 6315 6316 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 6317 waypoint.destroy(); 6318 return; 6319 } 6320 6321 $that.parents('.inner-wrap').addClass('animated-in'); 6322 if( $animation == 'zoom-out-reveal' || $animation.indexOf('reveal-from-') > -1 ) { 6323 $that.parents('.column-image-bg-wrap').addClass('animated-in'); 6324 $that.parents('.column-image-bg-wrap').siblings('.column-bg-overlay-wrap').addClass('animated-in'); 6325 $that.parents('.vc_column-inner').addClass('revealed-bg'); 6326 } 6327 waypoint.destroy(); 6328 }, 6329 offset: $colBGOffset 6330 }); 6331 6332 }); 6333 6334 // Zoom out reveal with BG color only 6335 $($fullscreenSelector + '.column-bg-overlay-wrap[data-bg-animation]').each(function () { 6336 6337 $colBGOffset = $colBGAnimationsRevealOffsetPos; 6338 6339 var $that = $(this); 6340 var $animation = $(this).attr('data-bg-animation'); 6341 6342 if( $animation == 'zoom-out-reveal' || $animation.indexOf('reveal-from-') > 0 ) { 6343 6344 if( $that.parent().find('.column-image-bg-wrap').length == 0 ) { 6345 6346 var waypoint = new Waypoint({ 6347 element: $that, 6348 handler: function () { 6349 6350 if ( $that.hasClass('animated-in') ) { 6351 waypoint.destroy(); 6352 return; 6353 } 6354 6355 $that.addClass('animated-in'); 6356 $that.parents('.vc_column-inner').addClass('revealed-bg'); 6357 waypoint.destroy(); 6358 6359 }, 6360 offset: $colBGOffset 6361 }); 6362 6363 } 6364 6365 } 6366 6367 }); 6368 6369 } 6370 6371 6372 6373 /** 6374 * Page builder column and image animations. 6375 * 6376 * @since 4.0 6377 * @see waypoints 6378 */ 6379 function colAndImgAnimations() { 6380 6381 var $colAndImgOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : '88%'; 6382 var $cascadingOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : '70%'; 6383 var $colAndImgRevealOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : '70%'; 6384 6385 $($fullscreenSelector + '.img-with-animation').each(function () { 6386 6387 var $that = $(this); 6388 6389 var $animationType = ($that.is('[data-animation]')) ? $that.attr('data-animation') : 'fade-in'; 6390 6391 // reveal images alters offset 6392 if( $animationType == 'ro-reveal-from-right' && $colAndImgOffsetPos == '88%' || 6393 $animationType == 'ro-reveal-from-left' && $colAndImgOffsetPos == '88%' ) { 6394 $colAndImgOffsetPos = '75%'; 6395 } 6396 6397 // initiate waypoint. 6398 var waypoint = new Waypoint({ 6399 element: $that, 6400 handler: function () { 6401 6402 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 6403 waypoint.destroy(); 6404 return; 6405 } 6406 6407 if (!bypassAnimations || $('body[data-responsive="0"]').length > 0) { 6408 6409 var $delay = ($that.is('[data-delay]')) ? $that.attr('data-delay') : 0; 6410 var $elToAnimate = ($that.parents('.hover-wrap').length > 0) ? $that.parents('.hover-wrap') : $that; 6411 6412 6413 if ($animationType == 'fade-in-from-left' || $animationType == 'fade-in-from-right') { 6414 6415 $elToAnimate.delay($delay).transition({ 6416 'opacity': 1, 6417 'x': '0px' 6418 }, $animationDuration, $animationEasing); 6419 6420 } else if ($animationType == 'fade-in-from-bottom') { 6421 6422 $elToAnimate.delay($delay).transition({ 6423 'opacity': 1, 6424 'y': '0px' 6425 }, $animationDuration, $animationEasing); 6426 6427 } else if ($animationType == 'fade-in') { 6428 6429 $elToAnimate.delay($delay).transition({ 6430 'opacity': 1 6431 }, $animationDuration, $animationEasing); 6432 6433 } else if ($animationType == 'grow-in') { 6434 6435 setTimeout(function () { 6436 $elToAnimate.transition({ 6437 scale: 1, 6438 'opacity': 1 6439 }, $animationDuration, $animationEasing); 6440 }, $delay); 6441 6442 } else if ($animationType == 'flip-in') { 6443 6444 setTimeout(function () { 6445 $elToAnimate.transition({ 6446 rotateY: 0, 6447 'opacity': 1 6448 }, $animationDuration, $animationEasing); 6449 }, $delay); 6450 6451 } else if ($animationType == 'flip-in-vertical') { 6452 6453 setTimeout(function () { 6454 $elToAnimate.transition({ 6455 rotateX: 0, 6456 'opacity': 1 6457 }, $animationDuration, $animationEasing); 6458 }, $delay); 6459 6460 } 6461 else if ($animationType == 'ro-reveal-from-left' || 6462 $animationType == 'ro-reveal-from-right' || 6463 $animationType == 'ro-reveal-from-bottom' || 6464 $animationType == 'ro-reveal-from-top') { 6465 $that.parents('.img-with-aniamtion-wrap').addClass('animated-in'); 6466 } 6467 6468 $that.addClass('animated-in'); 6469 6470 } 6471 6472 waypoint.destroy(); 6473 6474 }, 6475 offset: $colAndImgOffsetPos 6476 }); 6477 6478 6479 6480 }); 6481 6482 6483 $($fullscreenSelector + '.nectar_cascading_images').each(function () { 6484 6485 var $that = $(this); 6486 var $animationDelay = ($(this).is('[data-animation-timing]')) ? $(this).attr('data-animation-timing') : 175; 6487 $animationDelay = parseInt($animationDelay); 6488 6489 var waypoint = new Waypoint({ 6490 element: $that, 6491 handler: function () { 6492 6493 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 6494 waypoint.destroy(); 6495 return; 6496 } 6497 6498 if (!bypassAnimations || $('body[data-responsive="0"]').length > 0) { 6499 6500 $that.find('.cascading-image').each(function (i) { 6501 6502 var $that2 = $(this); 6503 6504 if ($that2.attr('data-animation') == 'flip-in' || $that2.attr('data-animation') == 'flip-in-vertical') { 6505 setTimeout(function () { 6506 $that2.find('.inner-wrap').css({ 6507 'opacity': 1, 6508 'transform': 'rotate(0deg) translateZ(0px)' 6509 }); 6510 }, i * $animationDelay); 6511 } else if( $that2.attr('data-animation') == 'grow-in-reveal' ) { 6512 setTimeout(function () { 6513 $that2.find('.inner-wrap').css({ 6514 'opacity': 1, 6515 'transform': 'translateX(0px) translateY(0px) scale(1,1) translateZ(0px)' 6516 }); 6517 $that2.find('.inner-wrap img').css({ 6518 'transform': 'translateX(0px) translateY(0px) scale(1,1) translateZ(0px)' 6519 }); 6520 }, i * $animationDelay); 6521 } 6522 else { 6523 setTimeout(function () { 6524 $that2.find('.inner-wrap').css({ 6525 'opacity': 1, 6526 'transform': 'translateX(0px) translateY(0px) scale(1,1) translateZ(0px)' 6527 }); 6528 }, i * $animationDelay); 6529 } 6530 6531 6532 }); 6533 6534 $that.addClass('animated-in'); 6535 6536 } 6537 6538 waypoint.destroy(); 6539 6540 }, 6541 offset: $cascadingOffsetPos 6542 }); 6543 6544 }); 6545 6546 6547 $($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) { 6548 6549 var $that = $(this); 6550 6551 //set perspective for vertical flip 6552 if ($that.is('[data-animation="flip-in-vertical"]') || $that.is('[data-animation="slight-twist"]')) { 6553 if( $('.page-submenu[data-sticky="true"]').length == 0 && $that.parents('.nectar-scrolling-tabs').length == 0 ) { 6554 $that.parents('.col.span_12').addClass('flip-in-vertical-wrap'); 6555 } 6556 } 6557 6558 var waypoint = new Waypoint({ 6559 element: $that, 6560 handler: function () { 6561 6562 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 6563 waypoint.destroy(); 6564 return; 6565 } 6566 6567 if (!bypassAnimations || $('body[data-responsive="0"]').length > 0) { 6568 6569 var $delay = $that.attr('data-delay'); 6570 6571 if ($that.attr('data-animation') == 'fade-in-from-left' || $that.attr('data-animation') == 'fade-in-from-right') { 6572 6573 $standAnimatedColTimeout[i] =
6573setTimeout(function () { 6574 $that.transition({ 6575 'opacity': 1, 6576 'x': '0px' 6577 }, $animationDuration, $animationEasing); 6578 }, $delay); 6579 6580 } else if ($that.attr('data-animation') == 'fade-in-from-bottom') { 6581 6582 $standAnimatedColTimeout[i] = setTimeout(function () { 6583 $that.transition({ 6584 'opacity': 1, 6585 'y': '0px' 6586 }, $animationDuration, $animationEasing); 6587 }, $delay); 6588 6589 } else if ($that.attr('data-animation') == 'fade-in') { 6590 6591 $standAnimatedColTimeout[i] = setTimeout(function () { 6592 $that.transition({ 6593 'opacity': 1 6594 }, $animationDuration, $animationEasing); 6595 }, $delay); 6596 6597 } else if ($that.attr('data-animation') == 'grow-in' || $that.attr('data-animation') == 'zoom-out') { 6598 6599 $standAnimatedColTimeout[i] = setTimeout(function () { 6600 $that.transition({ 6601 scale: 1, 6602 'opacity': 1 6603 }, $animationDuration, $animationEasing); 6604 }, $delay); 6605 6606 } else if ($that.attr('data-animation') == 'flip-in') { 6607 6608 $standAnimatedColTimeout[i] = setTimeout(function () { 6609 $that.transition({ 6610 rotateY: 0, 6611 'opacity': 1 6612 }, $animationDuration, $animationEasing); 6613 }, $delay); 6614 6615 } else if ($that.attr('data-animation') == 'flip-in-vertical') { 6616 6617 $standAnimatedColTimeout[i] = setTimeout(function () { 6618 $that.transition({ 6619 rotateX: 0, 6620 y: 0, 6621 'opacity': 1 6622 }, $animationDuration, $animationEasing); 6623 }, $delay); 6624 6625 } else if ($that.attr('data-animation') == 'slight-twist') { 6626 6627 $standAnimatedColTimeout[i] = setTimeout(function () { 6628 anime({ 6629 targets: $that[0], 6630 rotateY: [20, 0], 6631 rotateZ: [-4, 0], 6632 opacity: 1, 6633 easing: $animationEasing, 6634 duration: $animationDuration 6635 }); 6636 }, $delay); 6637 6638 } 6639 6640 //boxed column hover fix 6641 if ($that.hasClass('boxed')) { 6642 $that.addClass('no-pointer-events'); 6643 setTimeout(function () { 6644 $that.removeClass('no-pointer-events'); 6645 }, parseInt($animationDuration) + parseInt($delay) + 30); 6646 } 6647 6648 if ($that.find('.nectar-post-grid-wrap[data-style="mouse_follow_image"]')) { 6649 setTimeout(function() { 6650 $that[0].style.transform = 'none'; 6651 }, parseInt($animationDuration) + parseInt($delay) + 30 ); 6652 } 6653 6654 $that.addClass('animated-in'); 6655 6656 } 6657 6658 waypoint.destroy(); 6659 }, 6660 offset: $colAndImgOffsetPos 6661 }); 6662 6663 }); 6664 6665 6666 $($fullscreenSelector + '.wpb_column.has-animation[data-animation*="reveal"]').each(function () { 6667 6668 var $that = $(this), 6669 waypoint = new Waypoint({ 6670 element: $that, 6671 handler: function () { 6672 6673 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 6674 waypoint.destroy(); 6675 return; 6676 } 6677 6678 var $delay = $that.attr('data-delay'); 6679 6680 if (!bypassAnimations || $('body[data-responsive="0"]').length > 0) { 6681 6682 var $columnInnerSelector = ( $that.find('> .vc_column-inner').length > 0 ) ? true : false; 6683 6684 if ($that.attr('data-animation') == 'reveal-from-bottom' || $that.attr('data-animation') == 'reveal-from-top') { 6685 6686 setTimeout(function () { 6687 6688 if ($that.hasClass('animated-in')) { 6689 6690 if( $columnInnerSelector == true ) { 6691 6692 // Modern. 6693 $that.find('> .vc_column-inner').transition({ 6694 'y': 0 6695 }, $animationDuration, $animationEasing ); 6696 6697 } else { 6698 6699 // Legacy. 6700 $that.find('.column-inner-wrap, .column-inner').transition({ 6701 'y': 0 6702 }, $animationDuration, $animationEasing, function () { 6703 $that.find('.column-inner-wrap, .column-inner').addClass('no-transform'); 6704 }); 6705 } 6706 6707 } 6708 6709 }, $delay); 6710 6711 } else if ($that.attr('data-animation') == 'reveal-from-right' || $that.attr('data-animation') == 'reveal-from-left') { 6712 setTimeout(function () { 6713 if ($that.hasClass('animated-in')) { 6714 6715 if( $columnInnerSelector == true ) { 6716 6717 // Modern. 6718 $that.find('> .vc_column-inner').transition({ 6719 'x': 0 6720 }, $animationDuration, $animationEasing); 6721 6722 6723 } else { 6724 // Legacy. 6725 $that.find('.column-inner-wrap, .column-inner').transition({ 6726 'x': 0 6727 }, $animationDuration, $animationEasing, function () { 6728 $that.find('.column-inner-wrap, .column-inner').addClass('no-transform'); 6729 }); 6730 6731 } 6732 6733 6734 } 6735 }, $delay); 6736 } 6737 6738 $that.addClass('animated-in'); 6739 6740 } 6741 6742 waypoint.destroy(); 6743 }, 6744 offset: $colAndImgRevealOffsetPos 6745 }); 6746 6747 }); 6748 6749 } 6750 6751 6752 6753 /** 6754 * Cascading images element sizing 6755 * 6756 * @since 6.0 6757 */
6758 function cascadingImageBGSizing() { 6759 6760 $('.nectar_cascading_images').each(function () { 6761 6762 //handle max width for cascading images in equal height columns 6763 if ($(this).parents('.vc_row-o-equal-height').length > 0 && $(this).parents('.wpb_column').length > 0) { 6764 $(this).css('max-width', $(this).parents('.wpb_column').width()); 6765 } 6766 6767 //set size for layers with no images 6768 $(this).find('.bg-color').each(function () { 6769 6770 var $bgColorHeight = 0; 6771 var $bgColorWidth = 0; 6772 6773 if ($(this).parent().find('.img-wrap').length == 0) { 6774 6775 var $firstSibling = $(this).parents('.cascading-image').siblings('.cascading-image[data-has-img="true"]').first(); 6776 6777 $firstSibling.css({ 6778 'position': 'relative', 6779 'visiblity': 'hidden' 6780 }); 6781 6782 $bgColorHeight = $firstSibling.find('.img-wrap').height(); 6783 $bgColorWidth = $firstSibling.find('.img-wrap').width(); 6784 6785 if ($firstSibling.index() == 0) { 6786 $firstSibling.css({ 6787 'visiblity': 'visible' 6788 }); 6789 } else { 6790 $firstSibling.css({ 6791 'position': 'absolute', 6792 'visiblity': 'visible' 6793 }); 6794 } 6795 } else { 6796 $bgColorHeight = $(this).parent().find('.img-wrap').height(); 6797 $bgColorWidth = $(this).parent().find('.img-wrap').width(); 6798 } 6799 6800 $(this).css({ 6801 'height': $bgColorHeight, 6802 'width': $bgColorWidth 6803 }); 6804 }); 6805 }); 6806 6807 } 6808 6809 6810 6811 6812 /** 6813 * Cascading images element initialization. 6814 * 6815 * @since 10.5 6816 */ 6817 function cascadingImageInit() { 6818 6819 if ($('.nectar_cascading_images').length > 0) { 6820 6821 var cascadingParallax = []; 6822 6823 $('.nectar_cascading_images').each(function(i){ 6824 6825 imagesLoaded($(this), function (instance) { 6826 6827 // Create sizes. 6828 cascadingImageBGSizing(); 6829 6830 // Parallax scrolling. 6831 if( $(instance.elements[0]).is('[data-parallax="yes"]') && !nectarDOMInfo.usingMobileBrowser && $('#nectar_fullscreen_rows').length == 0 ) { 6832 cascadingParallax[i] = new CascadingParallax($(instance.elements[0]), $(instance.elements[0]).attr('data-parallax-intensity')); 6833 } 6834 6835 }); 6836 6837 }); 6838 6839 // BG Sizing Resize. 6840 $window.on('resize', cascadingImageBGSizing); 6841 6842 } 6843 6844 } 6845 6846 6847 6848 6849 function CascadingParallax(el, intensity) { 6850 6851 this.$element = el; 6852 this.inView = false; 6853 this.topLevel = false; 6854 this.lastY = 0; 6855 6856 this.layer1Parallax = ( this.$element.is('[data-layer-1-parallax="yes"]') ) ? true : false; 6857 6858 switch(intensity) { 6859 case 'subtle': 6860 this.intensity = 0.09; 6861 break; 6862 case 'medium': 6863 this.intensity = 0.15; 6864 break; 6865 case 'high': 6866 this.intensity = 0.25; 6867 break; 6868 } 6869 this.calculatePos(); 6870 this.trackView(); 6871 this.animate(); 6872 6873 if( $('.portfolio-filters').length > 0 || 6874 $('.portfolio-filters-inline').length > 0 ) { 6875 setInterval(this.calculatePos.bind(this),700); 6876 } 6877 6878 $window.on('resize', this.calculatePos.bind(this)); 6879 } 6880 6881 CascadingParallax.prototype.calculatePos = function() { 6882 this.offsetTop = this.$element.offset().top; 6883 this.height = this.$element.outerHeight(); 6884 this.vertCenter = nectarDOMInfo.winH/2 - this.height/2; 6885 }; 6886 6887 CascadingParallax.prototype.trackView = function() { 6888 6889 var that = this; 6890 6891 if( this.$element.parents('.top-level').length > 0 ) { 6892 this.topLevel = true; 6893 } 6894 6895 if( 'IntersectionObserver' in window ) { 6896 6897 var options = { 6898 rootMargin: '250px', 6899 } 6900 var observer = new IntersectionObserver(function(entries) { 6901 6902 entries.forEach(function(entry){ 6903 var isIntersecting = entry.isIntersecting; 6904 6905 if (isIntersecting) { 6906 that.inView = true; 6907 } else { 6908 that.inView = false;
6909 } 6910 }); 6911 6912 }, options); 6913 6914 observer.observe(this.$element[0]); 6915 6916 } 6917 6918 }; 6919 6920 CascadingParallax.prototype.animate = function() { 6921 6922 if( this.inView ) { 6923 6924 var that = this; 6925 6926 this.lastY = linearInterpolate(this.lastY, nectarDOMInfo.scrollTop, 0.18); 6927 6928 this.$element.find('.bg-layer').each(function(i) { 6929 6930 var $scale = $(this).attr('data-scale'); 6931 6932 if( that.layer1Parallax ) { 6933 i = (i/1.5)+1; 6934 } 6935 6936 if( that.topLevel === true && nectarDOMInfo.winW > 1000) { 6937 $(this).css('transform','translateY(' + -(that.lastY * that.intensity * i) + 'px) translateZ(0) scale(' + $scale + ')'); 6938 } else { 6939 $(this).css('transform','translateY(' + -((that.lastY - that.offsetTop + that.vertCenter ) * that.intensity * i ) + 'px) translateZ(0) scale(' + $scale + ')'); 6940 } 6941 6942 }); 6943 } 6944 6945 window.requestAnimationFrame(this.animate.bind(this)); 6946 }; 6947 6948 6949 6950 6951 /** 6952 * Split line heading element initialization. 6953 * 6954 * @since 10.5 6955 * @see waypoints 6956 */ 6957 function splitLineHeadings() { 6958 6959 // Create waypoint. 6960 var $splitLineOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : 'bottom-in-view'; 6961 $($fullscreenSelector + '.nectar-split-heading').each(function () { 6962 6963 var $that = $(this); 6964 var $delay = ( $that.is('[data-animation-delay]') ) ? parseInt($that.attr('data-animation-delay')) : 0; 6965 6966 var waypoint = new Waypoint({ 6967 element: $that, 6968 handler: function () { 6969 6970 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 6971 waypoint.destroy(); 6972 return; 6973 } 6974 6975 if (!bypassAnimations || $('body[data-responsive="0"]').length > 0) { 6976 6977 var $animationDurationCap; 6978 6979 setTimeout(function() { 6980 6981 if( $that.is('[data-animation-type="line-reveal-by-space"]') ) { 6982 6983 $animationDurationCap = (parseInt($animationDuration) < 900) ? $animationDuration : '900'; 6984 $that.find('> * > span').each(function (i) { 6985 6986 $(this).find('> .inner').transition({ 6987 'y': '0px' 6988 }, $animationDuration, $animationEasing); 6989 6990 }); 6991 6992 } else if( $that.is('[data-animation-type="letter-fade-reveal"]') ) { 6993 6994 $animationDurationCap = (parseInt($animationDuration) < 1000) ? $animationDuration : '1000'; 6995 $that.find('> * > span span').each(function (i) { 6996 6997 $(this).delay(i * 8).transition({ 6998 'y': '0px', 6999 'opacity': '1' 7000 }, $animationDurationCap, $animationEasing); 7001 7002 }); 7003 7004 } else { 7005 $that.find('.heading-line').each(function (i) { 7006 7007 $(this).find('> div').delay(i * 70).transition({ 7008 'y': '0px' 7009 }, $animationDuration, $animationEasing); 7010 7011 }); 7012 } 7013 7014 $that.addClass('animated-in'); 7015 7016 }, $delay); 7017 7018 } 7019 7020 waypoint.destroy(); 7021 }, 7022 offset: $splitLineOffsetPos 7023 }); 7024 7025 }); 7026 } 7027 7028 7029 7030 /** 7031 * Progress bar element initialization. 7032 * 7033 * @since 3.0 7034 * @see waypoints 7035 */ 7036 7037 function progressBars() { 7038 7039 var $progressBarsOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : 'bottom-in-view'; 7040 var $progressSelector = ($('#nectar_fullscreen_rows[data-mobile-disable="on"]').length > 0 && nectarDOMInfo.usingMobileBrowser) ? '.nectar-progress-bar' : $fullscreenSelector + '.nectar-progress-bar'; 7041 7042 if( nectarDOMInfo.usingMobileBrowser && $progressBarsOffsetPos == 'bottom-in-view') { 7043 $progressBarsOffsetPos = '70%'; 7044 } 7045 7046 $($progressSelector).parent().each(function () { 7047 7048 var $that = $(this), 7049 waypoint = new Waypoint({ 7050 element: $that, 7051 handler: function () { 7052 7053 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 7054 waypoint.destroy(); 7055 return; 7056 } 7057 7058 if ($progressBarsOffsetPos == '100%') { 7059 $that.find('.nectar-progress-bar .bar-wrap').css('opacity', '1'); 7060 } 7061 7062 $that.find('.nectar-progress-bar').each(function (i) { 7063 7064 var percent = $(this).find('span').attr('data-width'), 7065 $endNum = parseInt($(this).find('span strong i').text()), 7066 $that = $(this); 7067 7068 $that.find('span').delay(i * 90).transition({ 7069 'width': percent + '%' 7070 }, 1050, 'easeInOutQuint', function () {}); 7071 7072 setTimeout(function () { 7073 7074 var countOptions = {
7075 useEasing: false 7076 }; 7077 var $countEle = $that.find('span strong i')[0]; 7078 var numAnim = new CountUp($countEle, 0, $endNum, 0, 1, countOptions); 7079 numAnim.start(); 7080 7081 $that.find('span strong').transition({ 7082 'opacity': 1 7083 }, 550, 'easeInCirc'); 7084 }, (i * 90)); 7085 7086 ////100% progress bar 7087 if (percent == '100') { 7088 $that.find('span strong').addClass('full'); 7089 } 7090 }); 7091 7092 $that.addClass('completed'); 7093 7094 waypoint.destroy(); 7095 7096 }, 7097 offset: $progressBarsOffsetPos 7098 }); 7099 7100 }); 7101 } 7102 7103 7104 7105 /** 7106 * Page builder column border animations. 7107 * 7108 * @since 8.0 7109 * @see waypoints 7110 */ 7111 function animatedColBorders() { 7112 7113 var $progressBarsOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : '75%'; 7114 $($fullscreenSelector + '.wpb_column[data-border-animation="true"]').each(function () { 7115 7116 var $that = $(this), 7117 waypoint = new Waypoint({ 7118 element: $that, 7119 handler: function () { 7120 7121 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 7122 waypoint.destroy(); 7123 return; 7124 } 7125 7126 var $borderDelay = ($that.attr('data-border-animation-delay').length > 0) ? parseInt($that.attr('data-border-animation-delay')) : 0; 7127 setTimeout(function () { 7128 $that.find('.border-wrap').addClass('animation'); 7129 $that.find('.border-wrap').addClass('completed'); 7130 }, $borderDelay); 7131 7132 waypoint.destroy(); 7133 7134 }, 7135 offset: $progressBarsOffsetPos 7136 }); 7137 7138 }); 7139 } 7140 7141 7142 7143 /** 7144 * Food menu item element. 7145 * 7146 * @since 8.0 7147 * @see waypoints 7148 */ 7149 function foodMenuItems() { 7150 7151 var $foodItemOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : '80%'; 7152 $($fullscreenSelector + '.nectar_food_menu_item').parent().each(function () { 7153 7154 var $that = $(this), 7155 waypoint = new Waypoint({ 7156 element: $that, 7157 handler: function () { 7158 7159 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 7160 waypoint.destroy(); 7161 return; 7162 } 7163 7164 $that.find('.nectar_food_menu_item').each(function (i) { 7165 7166 var $that = $(this); 7167 7168 setTimeout(function () { 7169 $that.addClass('animated-in'); 7170 }, i * 150); 7171 7172 }); 7173 7174 waypoint.destroy(); 7175 7176 }, 7177 offset: $foodItemOffsetPos 7178 }); 7179 7180 }); 7181 } 7182 7183 7184 7185 /** 7186 * Divider element 7187 * 7188 * @since 3.0 7189 * @see waypoints 7190 */ 7191 function dividers() { 7192 7193 var $dividerOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : 'bottom-in-view'; 7194 7195 $($fullscreenSelector + '.divider-small-border[data-animate="yes"], ' + $fullscreenSelector + '.divider-border[data-animate="yes"]').each(function () { 7196 7197 var $lineDur = ($(this).hasClass('divider-small-border')) ? 1300 : 1500, 7198 $that = $(this), 7199 waypoint = new Waypoint({ 7200 element: $that, 7201 handler: function () { 7202 7203 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 7204 waypoint.destroy(); 7205 return; 7206 } 7207 7208 $that.each(function () { 7209 7210 $(this).css({ 7211 'transform': 'scale(0,1)', 7212 'visibility': 'visible' 7213 }); 7214 var $that = $(this); 7215 7216 $that.delay($that.attr('data-animation-delay')).transition({ 7217 'transform': 'scale(1, 1)' 7218 }, $lineDur, 'cubic-bezier(.18,1,.22,1)'); 7219 7220 }); 7221 7222 $that.addClass('completed'); 7223 7224 waypoint.destroy(); 7225 7226 }, 7227 offset: $dividerOffsetPos 7228 }); 7229 7230 }); 7231 } 7232 7233 7234 7235 /** 7236 * Image with hotspots element hover event 7237 * 7238 * @since 7.0 7239 */ 7240 function hotSpotHoverBind() { 7241 7242 //add pulse animation 7243 $('.nectar_image_with_hotspots[data-hotspot-icon="numerical"]').each(function () { 7244 $(this).find('.nectar_hotspot_wrap').each(function (i) { 7245 var $that = $(this); 7246 setTimeout(function () { 7247 $that.find('.nectar_hotspot').addClass('pulse'); 7248 }, i * 300); 7249 }); 7250 }); 7251 7252 7253 var hotSpotHoverTimeout = []; 7254 7255 $('.nectar_image_with_hotspots:not([data-tooltip-func="click"]) .nectar_hotspot').each(function (i) { 7256 7257 hotSpotHoverTimeout[i] = ''; 7258 7259 $(this).on('mouseover', function () { 7260 clearTimeout(hotSpotHoverTimeout[i]); 7261 $(this).parent().css({ 7262 'z-index': '400', 7263 'height': 'auto', 7264 'width': 'auto' 7265 }); 7266 }); 7267 7268 $(this).on('mouseleave', function () { 7269 7270 var $that = $(this); 7271 $that.parent().css({ 7272 'z-index': 'auto' 7273 }); 7274 7275 hotSpotHoverTimeout[i] = setTimeout(function () { 7276 $that.parent().css({ 7277 'height': '30px', 7278 'width': '30px' 7279 }); 7280 }, 300); 7281 7282 }); 7283 7284 }); 7285 7286 } 7287 7288 7289 7290 /** 7291 * Image with hotspots element responsive behavior. 7292 * 7293 * @since 7.0 7294 */ 7295 function responsiveTooltips() { 7296 7297 $('.nectar_image_with_hotspots').each(function () { 7298 7299 $(this).find('.nectar_hotspot_wrap').each(function () { 7300 7301 if (nectarDOMInfo.winW > 690) { 7302 7303 // Remove click if applicable 7304 if ($(this).parents('.nectar_image_with_hotspots[data-tooltip-func="hover"]').length > 0) { 7305 $(this).find('.nectar_hotspot').removeClass('click'); 7306 $(this).find('.nttip').removeClass('open'); 7307 } 7308 7309 $(this).find('.nttip .inner a.tipclose').remove(); 7310 $('.nttip').css('height', 'auto'); 7311 7312 // Reset for positioning 7313 $(this).css({ 7314 'width': 'auto', 7315 'height': 'auto' 7316 }); 7317 7318 $(this).find('.nttip') 7319 .removeClass('force-right') 7320 .removeClass('force-left') 7321 .removeClass('force-top') 7322 .css('width', 'auto'); 7323 7324 var $tipOffset = $(this).find('.nttip').offset(); 7325 7326 // Against right side 7327 if ($tipOffset.left > $(this).parents('.nectar_image_with_hotspots').width() - 200) { 7328 $(this).find('.nttip').css('width', '250px'); 7329 } 7330 else { 7331 $(this).find('.nttip').css('width', 'auto'); 7332 } 7333 7334 // Responsive 7335 if ($tipOffset.left < 0) { 7336 $(this).find('.nttip').addClass('force-right'); 7337 } 7338 else if ($tipOffset.left + $(this).find('.nttip').outerWidth(true) > nectarDOMInfo.winW) { 7339 $(this).find('.nttip').addClass('force-left').css('width', '250px'); 7340 } 7341 else if ($tipOffset.top + $(this).find('.nttip').height() + 35 > $window.height() && $('#nectar_fullscreen_rows').length > 0) { 7342 $(this).find('.nttip').addClass('force-top'); 7343 } 7344 7345 if ($(this).find('> .open').length == 0) { 7346 7347 $(this).css({ 7348 'width': '30px', 7349 'height': '30px' 7350 }); 7351 } 7352 7353 } else { 7354 7355 //fixed position 7356 $(this).find('.nttip') 7357 .removeClass('force-left') 7358 .removeClass('force-right') 7359 .removeClass('force-top'); 7360 7361 $(this).find('.nectar_hotspot').addClass('click'); 7362 7363 if ($(this).find('.nttip a.tipclose').length == 0) { 7364 $(this).find('.nttip .inner').append('<a href="#" class="tipclose"><span></span></a>'); 7365 } 7366 7367 // Change height of fixed 7368 $('.nttip').css('height', $window.height()); 7369 } 7370 }); 7371 }); 7372 7373 } 7374 7375 7376 /** 7377 * Image with hotspots events 7378 * 7379 * @since 10.5 7380 */ 7381 function imageWithHotspotEvents() { 7382 7383 if( $('.nectar_image_with_hotspots').length == 0 ) { 7384 return; 7385 } 7386 7387 // Hover 7388 hotSpotHoverBind(); 7389 7390 // Click 7391 $body.on('click', '.nectar_hotspot.click', function () { 7392 $(this).parents('.nectar_image_with_hotspots').find('.nttip').removeClass('open'); 7393 $(this).parent().find('.nttip').addClass('open'); 7394 7395 $(this).parents('.nectar_image_with_hotspots').find('.nectar_hotspot').removeClass('open'); 7396 $(this).parent().find('.nectar_hotspot').addClass('open'); 7397 7398 if (nectarDOMInfo.winW > 690) { 7399 $(this).parent().css({ 7400 'z-index': '120', 7401 'height': 'auto', 7402 'width': 'auto' 7403 }); 7404 7405 var $that = $(this); 7406 7407 setTimeout(function () { 7408 $that.parents('.nectar_image_with_hotspots').find('.nectar_hotspot_wrap').each(function () { 7409 7410 if ($(this).find('> .open').length == 0) { 7411 $(this).css({ 7412 'height': '30px', 7413 'width': '30px', 7414 'z-index': 'auto' 7415 }); 7416 } 7417 }); 7418 }, 300); 7419 } 7420 7421 if (nectarDOMInfo.winW <= 690) { 7422 $(this).parents('.wpb_row, [class*="vc_col-"]').css('z-index', '200'); 7423 } 7424 7425 return false;
7426 }); 7427 7428 $body.on('click', '.nectar_hotspot.open', function () { 7429 $(this).parent().find('.nttip').removeClass('open'); 7430 $(this).parent().find('.nectar_hotspot').removeClass('open'); 7431 7432 $(this).parents('.wpb_row').css('z-index', 'auto'); 7433 7434 return false; 7435 }); 7436 7437 $body.on('click', '.nttip.open', function () { 7438 if (nectarDOMInfo.winW < 690) { 7439 $(this).parents('.nectar_image_with_hotspots').find('.nttip').removeClass('open'); 7440 $(this).parents('.nectar_image_with_hotspots').find('.nectar_hotspot').removeClass('open'); 7441 $(this).parents('.wpb_row').css('z-index', 'auto'); 7442 return false; 7443 } 7444 }); 7445 7446 7447 // Calculate on init. 7448 responsiveTooltips(); 7449 7450 // Resize event. 7451 $window.on('resize',responsiveTooltips); 7452 7453 } 7454 7455 7456 7457 /** 7458 * Image with hotspots initialization. 7459 * 7460 * @since 7.0 7461 * @see waypoints 7462 */ 7463 function imageWithHotspots() { 7464 7465 var $imageWithHotspotsOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : '50%'; 7466 7467 $($fullscreenSelector + '.nectar_image_with_hotspots[data-animation="true"]').each(function () { 7468 7469 var $that = $(this); 7470 var waypoint = new Waypoint({ 7471 element: $that, 7472 handler: function () { 7473 7474 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 7475 waypoint.destroy(); 7476 return; 7477 } 7478 7479 $that.addClass('completed'); 7480 $that.find('.nectar_hotspot_wrap').each(function (i) { 7481 var $that2 = $(this); 7482 var $extrai = ($that2.parents('.col.has-animation').length > 0) ? 1 : 0; 7483 setTimeout(function () { 7484 $that2.addClass('animated-in'); 7485 }, 175 * (i + $extrai)); 7486 }); 7487 7488 waypoint.destroy(); 7489 7490 }, 7491 offset: $imageWithHotspotsOffsetPos 7492 }); 7493 7494 }); 7495 7496 7497 } 7498 7499 7500 /** 7501 * Nectar Lazy Loading 7502 * 7503 * @since 11.0 7504 */ 7505 function nectarLazyImageLoading() { 7506 7507 var lazyItems = [].slice.call(document.querySelectorAll('[data-nectar-img-src]')); 7508 7509 if ('IntersectionObserver' in window) { 7510 7511 var options = { 7512 rootMargin: '500px', 7513 } 7514 7515 nectarLazyImageSizing(); 7516 $window.off('resize.nectarLazySizing', nectarLazyImageSizing); 7517 $window.on('resize.nectarLazySizing', nectarLazyImageSizing); 7518 7519 var lazyItemObserver = new IntersectionObserver(function(entries) { 7520 7521 entries.forEach(function(entry) { 7522 if (entry.isIntersecting) { 7523 var lazyItem = entry.target; 7524 7525 var imgSrc = lazyItem.getAttribute('data-nectar-img-src'); 7526 7527 // img tags. 7528 if( lazyItem.classList.contains('nectar-lazy') ) { 7529 lazyItem.addEventListener( 'load', function() { 7530 lazyItem.style.height = ""; 7531 lazyItem.style.width = ""; 7532 lazyItem.classList.add('loaded'); 7533 lazyItem.removeAttribute('data-nectar-img-src'); 7534 lazyItemObserver.unobserve(lazyItem); 7535 }); 7536 lazyItem.src = imgSrc; 7537 var srcset = lazyItem.getAttribute('data-nectar-img-srcset'); 7538 if( srcset ) { 7539 lazyItem.setAttribute( 'srcset', srcset ); 7540 lazyItem.removeAttribute('data-nectar-img-srcset'); 7541 } 7542 } 7543 // BGs. 7544 else { 7545 lazyItem.style.backgroundImage = "url('" + imgSrc + "')"; 7546 lazyItem.classList.add('loaded'); 7547 lazyItem.removeAttribute('data-nectar-img-src'); 7548 lazyItemObserver.unobserve(lazyItem); 7549 } 7550 7551 } 7552 7553 }); 7554 7555 }, options); 7556 7557 lazyItems.forEach(function(lazyItem) { 7558 lazyItemObserver.observe(lazyItem); 7559 }); 7560 7561 } 7562 else { 7563 // load all the images when intersection observer is not supported. 7564 lazyItems.forEach(function(lazyItem) { 7565 7566 // img tags. 7567 if( lazyItem.classList.contains('nectar-lazy') ) { 7568 lazyItem.style.height = ""; 7569 lazyItem.style.width = ""; 7570 lazyItem.src = lazyItem.getAttribute('data-nectar-img-src'); 7571 var srcset = lazyItem.getAttribute('data-nectar-img-srcset'); 7572 if( srcset ) { 7573 lazyItem.setAttribute( 'srcset', srcset ); 7574 lazyItem.removeAttribute('data-nectar-img-srcset'); 7575 } 7576 lazyItem.classList.add('loaded'); 7577 lazyItem.removeAttribute('data-nectar-img-src'); 7578 } 7579 // BGs. 7580 else { 7581 lazyItem.style.backgroundImage = "url('" + lazyItem.getAttribute('data-nectar-img-src') + "')"; 7582 lazyItem.classList.add('loaded'); 7583 lazyItem.removeAttribute('data-nectar-img-src'); 7584 } 7585 7586 }); 7587 } 7588 7589 7590 } 7591 7592 7593 /** 7594 * Nectar lazy img size helper. 7595 * 7596 * @since 11.0 7597 */ 7598
7599 function nectarLazyImageSizing() { 7600 7601 $('img.nectar-lazy:not(.loaded)').each(function() { 7602 7603 $(this).css({ 7604 'height': '', 7605 'width' : '' 7606 }); 7607 7608 var heightAttr = parseInt($(this).attr('height')); 7609 var widthAttr = parseInt($(this).attr('width')); 7610 7611 var width = ($(this).parents('.nectar_cascading_images').length > 0) ? $(this).parents('.bg-layer').width() : $(this).width(); 7612 7613 // Shadow img. 7614 if( $(this).parents('.img-with-aniamtion-wrap[data-shadow*="depth"]').length > 0 ) { 7615 width = $(this).parents('.img-with-aniamtion-wrap').width(); 7616 } 7617 7618 // Post grid. 7619 if( $(this).parents('.nectar-post-grid-item-bg-wrap-inner').length > 0 ) { 7620 width = $(this).parents('.nectar-post-grid-item-bg-wrap-inner').width(); 7621 } 7622 7623 var dimensions = calculateAspectRatio( widthAttr, heightAttr, width, 2000 ); 7624 7625 $(this).css({ 7626 'height': dimensions.height + 'px', 7627 'width' : dimensions.width + 'px' 7628 }); 7629 7630 }); 7631 7632 } 7633 7634 7635 /** 7636 * Nectar Post Grid Mouse Follow Init 7637 * 7638 * @since 11.0 7639 */ 7640 function nectarPostGridMouse() { 7641 7642 viewIndicatorArr = []; 7643 postGridImgMouseFollowArr = []; 7644 7645 if( !nectarDOMInfo.usingMobileBrowser ) { 7646 7647 $('.nectar-post-grid[data-indicator="yes"]').each(function(i) { 7648 viewIndicatorArr[i] = new NectarIconMouseFollow($(this),'view-indicator'); 7649 }); 7650 7651 $('.nectar-post-grid-wrap[data-style="mouse_follow_image"] .nectar-post-grid').each(function(i) { 7652 postGridImgMouseFollowArr[i] = new NectarIconMouseFollow($(this), 'post-grid-images'); 7653 }); 7654 7655 } 7656 7657 } 7658 7659 7660 7661 7662 7663 /** 7664 * Nectar Post Grid 7665 * 7666 * @since 11.0 7667 */ 7668 function nectarPostGridInit() { 7669 7670 $nectarPostGridArr = []; 7671 7672 // Mouse follow. 7673 nectarPostGridMouse(); 7674 7675 // Create grid instances. 7676 $('.nectar-post-grid-wrap').each(function(i) { 7677 $nectarPostGridArr[i] = new NectarPostGrid($(this)); 7678 }); 7679 7680 7681 } 7682 7683 7684 7685 function NectarPostGrid(el) { 7686 7687 this.el = el; 7688 this.currentPage = 0; 7689 this.activeFilter = 1; 7690 this.activeCatTotal = 0; 7691 this.settingsData = JSON.parse(this.el.attr('data-el-settings')); 7692 this.queryData = JSON.parse(this.el.attr('data-query')); 7693 this.sortable = this.el.find('.nectar-post-grid-filters').attr('data-sortable'); 7694 7695 this.initialMarkup(); 7696 this.clickEvents(); 7697 } 7698 7699 NectarPostGrid.prototype.initialMarkup = function() { 7700 7701 // Start Filter Active. 7702 if( this.el.find('.nectar-post-grid-filters a.active').length == 0 ) { 7703 this.el.find('.nectar-post-grid-filters a:first-child').addClass('active'); 7704 } 7705 7706 // Load More Markup. 7707 if( this.settingsData.pagination === 'load-more' && this.el.find('.load-more-wrap').length == 0 ) { 7708 7709 this.activeCatTotal = parseInt(this.el.find('.nectar-post-grid-filters a:nth-child(' + this.activeFilter + ')').attr('data-total-count')); 7710 7711 // Start hidden? 7712 if( this.el.find('.nectar-post-grid-item').length >= this.activeCatTotal ) { 7713 this.el.append('<div class="load-more-wrap inactive"><a href="#" class="load-more">'+ this.el.attr('data-load-more-text') + '</a></div>'); 7714 } else { 7715 this.el.append('<div class="load-more-wrap"><a href="#" class="load-more">'+ this.el.attr('data-load-more-text') + '</a></div>'); 7716 } 7717 7718 } 7719 7720 }; 7721 7722 7723 7724 NectarPostGrid.prototype.clickEvents = function() { 7725 7726 // Sortable Mobile Toggle. 7727 this.el.find('.nectar-post-grid-filters h4').on('click', function(){ 7728 $(this).parent().find('div').toggleClass('visible'); 7729 $(this).toggleClass('visible'); 7730 }); 7731 7732 // Sortable/Pagination. 7733 var settingsData = this.settingsData; 7734 var queryData = this.queryData; 7735 var instance = this; 7736 7737 this.el.find('.nectar-post-grid-filters a, .load-more-wrap:not(.inactive) .load-more').on('click', function() { 7738 7739 var $that = $(this); 7740 7741 // Filter active. 7742 if($that.parents('.nectar-post-grid-wrap.loading').length > 0 || $(this).hasClass('active')) { 7743 return false;
7744 } 7745 7746 7747 if( $(this).parents('.nectar-post-grid-filters').length > 0 ) { 7748 // Filter specific. 7749 $that.parent().find('a').removeClass('active'); 7750 $that.addClass('active'); 7751 instance.currentPage = 0; 7752 instance.activeFilter = $that.index() + 1; 7753 } else { 7754 // Load More specific. 7755 instance.currentPage++; 7756 } 7757 7758 var $gridEl = $that.parents('.nectar-post-grid-wrap').find('.nectar-post-grid') 7759 var $pagination = settingsData.pagination; 7760 var $action = ($that.hasClass('load-more') && $pagination === 'load-more') ? 'load-more' : 'filter'; 7761 var $category = ''; 7762 7763 // Determine what category to load from. 7764 if( instance.sortable === 'yes' ) { 7765 $category = $that.parents('.nectar-post-grid-wrap').find('.nectar-post-grid-filters a.active').attr('data-filter'); 7766 } else { 7767 7768 var skipAll = ( $that.parents('.nectar-post-grid-wrap').find('.nectar-post-grid-filters a').length > 1 ) ? ':not(.all-filter)' : ''; 7769 7770 $that.parents('.nectar-post-grid-wrap').find('.nectar-post-grid-filters a' + skipAll).each(function(){ 7771 $category += $(this).attr('data-filter') + ', '; 7772 }); 7773 7774 $category = $category.substring(0, $category.length - 2); 7775 7776 } 7777 7778 7779 var $dataToPass = { 7780 action: 'nectar_get_post_grid_segment', 7781 post_type: queryData.post_type, 7782 category: $category, 7783 posts_per_page: queryData.posts_per_page, 7784 current_page: instance.currentPage, 7785 offset: queryData.offset, 7786 order: queryData.order, 7787 orderby: queryData.orderby, 7788 load_action: $action, 7789 settings: { 7790 pagination: $pagination, 7791 post_type: settingsData.post_type, 7792 image_size: settingsData.image_size, 7793 aspect_ratio_image_size: settingsData.aspect_ratio_image_size, 7794 card_bg_color: settingsData.card_bg_color, 7795 display_categories: settingsData.display_categories, 7796 display_excerpt: settingsData.display_excerpt, 7797 display_date: settingsData.display_date, 7798 color_overlay: settingsData.color_overlay, 7799 color_overlay_opacity: settingsData.color_overlay_opacity, 7800 color_overlay_hover_opacity: settingsData.color_overlay_hover_opacity, 7801 grid_style: settingsData.grid_style, 7802 heading_tag: settingsData.heading_tag, 7803 post_title_overlay: settingsData.post_title_overlay 7804 } 7805 }; 7806 7807 $that.parents('.nectar-post-grid-wrap').addClass('loading'); 7808 7809 $.post(window.nectarLove.ajaxurl, $dataToPass, function (data) { 7810 7811 // Update markup. 7812 if( $action === 'load-more' ) { 7813 $gridEl.append(data); 7814 } else { 7815 $gridEl.html(data); 7816 } 7817 7818 // Load in animation. 7819 if( $gridEl.is('[data-animation="fade-in-from-bottom"]') ) { 7820 7821 $that.parents('.nectar-post-grid-wrap').removeClass('finished-animating'); 7822 7823 $gridEl.find('.nectar-post-grid-item:not(.animated-in)').each(function(i) { 7824 var $storedEl = $(this); 7825 setTimeout(function() { 7826 $storedEl.addClass('animated-in'); 7827 }, i * 90); 7828 7829 }); 7830 7831 setTimeout(function(){ 7832 $that.parents('.nectar-post-grid-wrap').addClass('finished-animating'); 7833 }, 950); 7834 } 7835 7836 if( $pagination === 'load-more' ) { 7837 7838 instance.activeCatTotal = parseInt(instance.el.find('.nectar-post-grid-filters a:nth-child(' + instance.activeFilter + ')').attr('data-total-count')); 7839 7840 if( $gridEl.find('.nectar-post-grid-item').length >= instance.activeCatTotal ) { 7841 instance.el.find('.load-more-wrap').addClass('inactive'); 7842 } else { 7843 instance.el.find('.load-more-wrap').removeClass('inactive'); 7844 } 7845 7846 } 7847 7848 $that.parents('.nectar-post-grid-wrap').removeClass('loading'); 7849 7850 // Resize. 7851 $window.trigger('resize'); 7852 7853 // Mouse follow. 7854 nectarPostGridMouse(); 7855 7856 }); // end POST 7857 7858 return false;
7859 7860 }); 7861 7862 // External project links 7863 if( this.el.hasClass('target-blank-external-urls') ) { 7864 this.el.find(".nectar-post-grid-item a[href*='http://']:not([href*='" + window.location.hostname + "'])").attr("target", "_blank"); 7865 } 7866 7867 7868 }; 7869 7870 7871 function NectarPostGridWaypoint() { 7872 7873 var postGridOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : '75%'; 7874 7875 $($fullscreenSelector + '.nectar-post-grid-wrap').each(function () { 7876 7877 var $that = $(this), 7878 waypoint = new Waypoint({ 7879 element: $that, 7880 handler: function () { 7881 7882 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 7883 waypoint.destroy(); 7884 return; 7885 } 7886 7887 $that.find('.nectar-post-grid-filters').addClass('animated-in'); 7888 $that.find('.nectar-post-grid-item').each(function(i) { 7889 7890 var $item = $(this); 7891 7892 setTimeout(function() { 7893 7894 $item.addClass('animated-in'); 7895 7896 }, i * 90); 7897 7898 }); 7899 7900 setTimeout(function(){ 7901 $that.addClass('finished-animating'); 7902 }, 950); 7903 7904 7905 waypoint.destroy(); 7906 7907 }, 7908 offset: postGridOffsetPos 7909 }); 7910 7911 }); 7912 7913 } 7914 7915 7916 7917 /** 7918 * Animated title element initialization. 7919 * 7920 * @since 7.0 7921 * @see waypoints 7922 */ 7923 function animatedTitles() { 7924 7925 var $animatedTitlesOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : 'bottom-in-view'; 7926 7927 $($fullscreenSelector + '.nectar-animated-title').each(function () { 7928 7929 var $that = $(this), 7930 waypoint = new Waypoint({ 7931 element: $that, 7932 handler: function () { 7933 7934 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 7935 waypoint.destroy(); 7936 return; 7937 } 7938 7939 $that.addClass('completed'); 7940 7941 waypoint.destroy(); 7942 7943 }, 7944 offset: $animatedTitlesOffsetPos 7945 }); 7946 7947 }); 7948 } 7949 7950 7951 7952 7953 /** 7954 * Highlighted Text element initialization. 7955 * 7956 * @since 9.0 7957 * @see waypoints 7958 */ 7959 function highlightedText() { 7960 7961 var $highlightedTextOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : 'bottom-in-view'; 7962 var highlightedColorCss = ''; 7963 7964 if( nectarDOMInfo.usingMobileBrowser && $highlightedTextOffsetPos == 'bottom-in-view' ) { 7965 $highlightedTextOffsetPos = '85%'; 7966 } 7967 7968 $($fullscreenSelector + '.nectar-highlighted-text').each(function (i) { 7969 7970 var $animationDelay = 0; 7971 7972 if($(this).is('[data-animation-delay]') && 7973 $(this).attr('data-animation-delay').length > 0 && 7974 $(this).attr('data-animation') != 'false') { 7975 $animationDelay = $(this).attr('data-animation-delay'); 7976 } 7977 7978 // Custom color 7979 if ($(this).is('[data-using-custom-color="true"]')) { 7980 7981 var $custom_highlight_color = $(this).attr('data-color'); 7982 var $custom_highlight_color_2 = ( $(this).is('[data-color-gradient]') && $(this).attr('data-color-gradient').length > 0 ) ? $(this).attr('data-color-gradient') : false; 7983 7984 $(this).addClass('instance-' + i); 7985 7986 if( $custom_highlight_color_2 !== false && $custom_highlight_color_2.length > 0 ) { 7987 highlightedColorCss += '.nectar-highlighted-text.instance-' + i + ' em:before { background: linear-gradient(90deg, '+ $custom_highlight_color +', '+ $custom_highlight_color_2 +'); }'; 7988 7989 if( $(this).is('[data-style="regular_underline"]') ) { 7990 highlightedColorCss += '.nectar-highlighted-text[data-style="regular_underline"].instance-' + i + ' a em:after { background: linear-gradient(90deg, '+ $custom_highlight_color +', '+ $custom_highlight_color_2 +'); }'; 7991 highlightedColorCss += '.nectar-highlighted-text[data-style="regular_underline"].instance-' + i + ' em a:after { background: linear-gradient(90deg, '+ $custom_highlight_color +', '+ $custom_highlight_color_2 +'); }'; 7992 } 7993 7994 } else { 7995 highlightedColorCss += '.nectar-highlighted-text.instance-' + i + ' em:before { background-color: ' + $custom_highlight_color + '; }'; 7996 7997 if( $(this).is('[data-style="regular_underline"]') ) { 7998 highlightedColorCss += '.nectar-highlighted-text[data-style="regular_underline"].instance-' + i + ' a em:after { background-color: ' + $custom_highlight_color + '; }'; 7999 highlightedColorCss += '.nectar-highlighted-text[data-style="regular_underline"].instance-' + i + ' em a:after { background-color: ' + $custom_highlight_color + '; }'; 8000 } 8001 8002 } 8003 8004 8005 } 8006 8007 if (bypassAnimations) { 8008 $(this).find('em').addClass('animated'); 8009 } 8010 8011 // Waypoint 8012 var $that = $(this); 8013 var waypoint = new Waypoint({ 8014 element: $that, 8015 handler: function () { 8016 8017 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated')) { 8018 waypoint.destroy(); 8019 return; 8020 } 8021 8022 setTimeout(function() { 8023 8024 $that.find('em').each(function (i) { 8025 var $highlighted_em = $(this); 8026 setTimeout(function () { 8027 $highlighted_em.addClass('animated'); 8028 }, i * 300); 8029 8030 }); 8031 8032 }, $animationDelay); 8033 8034 waypoint.destroy(); 8035 8036 }, 8037 offset: $highlightedTextOffsetPos 8038 }); 8039 8040 }); 8041 8042 // Style 8043 nectarCreateStyle(highlightedColorCss, 'highlighted-text'); 8044 8045 } 8046 8047 8048 8049 8050 /** 8051 * Pricing table element height calculations. 8052 * 8053 * @since 2.0 8054 */ 8055 function pricingTableHeight() { 8056 8057 var $tallestCol; 8058 8059 $('.pricing-table[data-style="default"]').each(function () { 8060 $tallestCol = 0; 8061 8062 $(this).find('> div ul').each(function () { 8063 8064 if( $(this).height() > $tallestCol ) { 8065 $tallestCol = $(this).height(); 8066 } 8067 8068 }); 8069 8070 //safety net incase pricing tables height couldn't be determined 8071 if ($tallestCol == 0) { 8072 $tallestCol = 'auto'; 8073 } 8074 8075 //set even height 8076 $(this).find('> div ul').css('height', $tallestCol); 8077 8078 }); 8079 } 8080 8081 8082 8083 8084 /** 8085 * Testimonial slider element initialization. 8086 * 8087 * @since 10.5 8088 */ 8089 function nectarTestimonialSliders() { 8090 8091 $testimonialSliders = []; 8092 8093 if (typeof NectarTestimonialSlider == 'undefined') { 8094 return; 8095 } 8096 8097 $('.testimonial_slider').each(function (i) { 8098 8099 var $that_el = $(this), 8100 $type = ($(this).is('[data-style]')) ? $(this).attr('data-style') : 'none'; 8101 8102 $testimonialSliders[i] = new NectarTestimonialSlider($that_el, $type, resizeVideoToCover, fullWidthContentColumns); 8103 8104 8105 if ($(this).is('.disable-height-animation:not([data-style*="multiple_visible"])')) { 8106 $testimonialSliders[i].testimonialSliderHeight(); 8107 setTimeout($testimonialSliders[i].testimonialSliderHeight.bind($testimonialSliders[i]), 500); 8108 } 8109 8110 if ($(this).is('.testimonial_slider[data-style="multiple_visible_minimal"]')) { 8111 $testimonialSliders[i].testimonialSliderHeightMinimalMult(); 8112 setTimeout($testimonialSliders[i].testimonialSliderHeightMinimalMult.bind($testimonialSliders[i]), 500); 8113 } 8114 8115 }); 8116 8117 8118 } 8119 8120 8121 /** 8122 * Testimonial slider element resize binding. 8123 * 8124 * @since 10.5 8125 */ 8126 function nectarTestimonialSlidersEvents() { 8127 8128 $window.off('smartresize.nectarTestimonials'); 8129 $window.off('resize.nectarTestimonialsMin'); 8130 8131 if($testimonialSliders.length > 0) { 8132 $window.on('smartresize.nectarTestimonials',nectarTestimonialMainResize); 8133 } 8134 8135 if( $('.testimonial_slider[data-style="multiple_visible_minimal"]').length > 0 ) { 8136 $window.on('resize.nectarTestimonialsMin',nectarTestimonialMiniamlResize); 8137 } 8138 8139 } 8140 8141 function nectarTestimonialMainResize() { 8142 for (var i = 0; i < $testimonialSliders.length; i++) { 8143 $testimonialSliders[i].testimonialSliderHeight(); 8144 $testimonialSliders[i].testimonialHeightResize(); 8145 } 8146 } 8147 function nectarTestimonialMiniamlResize() { 8148 for (var i = 0; i < $testimonialSliders.length; i++) { 8149 $testimonialSliders[i].testimonialSliderHeightMinimalMult(); 8150 } 8151 } 8152 8153 8154 8155 /** 8156 * Icon list element initialization. 8157 * 8158 * @since 6.0 8159 * @see waypoints 8160 */ 8161 function iconList() { 8162 8163 var $iconListOffsetPos = ($fullscreenMarkupBool == true) ? '250%' : '75%'; 8164 8165 $($fullscreenSelector + '.nectar-icon-list[data-animate="true"]').each(function () { 8166 8167 var $that = $(this), 8168 waypoint = new Waypoint({ 8169 element: $that, 8170 handler: function () { 8171 8172 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 8173 waypoint.destroy(); 8174 return; 8175 } 8176 8177 $that.each(function () { 8178 8179 var $listItemAnimationDelay = ($that.is('[data-direction="horizontal"]')) ? 100 : 300; 8180 8181 $(this).find('.nectar-icon-list-item').each(function (i) { 8182 var $thatt = $(this); 8183 setTimeout(function () { 8184 $thatt.addClass('animated'); 8185 }, i * $listItemAnimationDelay); 8186 }); 8187 8188 }); 8189 8190 $that.addClass('completed'); 8191 8192 waypoint.destroy(); 8193 8194 }, 8195 offset: $iconListOffsetPos 8196 }); 8197 8198 }); 8199 } 8200 8201 8202 8203 /** 8204 * Get the BG color of parent column/row. 8205 * 8206 * @since 6.0 8207 */ 8208 function narrowParentBGC(element) { 8209 8210 var narrowedBGC; 8211 8212 if (element.parents('.wpb_column[data-bg-color*="#"]').length > 0 && element.parents('.wpb_column[data-bg-opacity="1"]').length > 0) { 8213 narrowedBGC = element.parents('.wpb_column').attr('data-bg-color'); 8214 } 8215 else if (element.parents('.wpb_row').length > 0 && element.parents('.wpb_row').find('.row-bg.using-bg-color').length > 0 || 8216 element.parents('.wpb_row').length > 0 && element.parents('.wpb_row').find('.row-bg.using-bg-color-excluded').length > 0) { 8217 narrowedBGC = element.parents('.wpb_row').find('.row-bg').css('background-color'); 8218 } 8219 else { 8220 if ($('#nectar_fullscreen_rows').length > 0) { 8221 narrowedBGC = $('#nectar_fullscreen_rows > .wpb_row .full-page-inner-wrap').css('background-color'); 8222 } 8223 else { 8224 narrowedBGC = $('.container-wrap').css('background-color'); 8225 } 8226 } 8227 8228 return narrowedBGC; 8229 8230 } 8231 8232 8233 /** 8234 * Icon BG matching row BG 8235 * 8236 * @since 6.0 8237 */ 8238 function nectarIconMatchColoring() { 8239 8240 var nectarMatchingBGCss = ''; 8241 8242 // Icon list 8243 $('.nectar-icon-list[data-icon-style="border"], .nectar_icon_wrap[data-style="border-animation"][data-color*="extra-color-gradient-"]').each(function (i) { 8244 8245 var $bgColorToSet = narrowParentBGC($(this)); 8246 8247 if( $(this).hasClass('nectar-icon-list') ) { 8248 $(this).find('.list-icon-holder').css('background-color', $bgColorToSet); 8249 } 8250 else { 8251 8252 $(this).removeClass(function (index, className) { 8253 return (className.match(/(^|\s)instance-\S+/g) || []).join(' '); 8254 }); 8255 8256 $(this).addClass('instance-' + i); 8257 nectarMatchingBGCss += '.nectar_icon_wrap.instance-' + i + ' .nectar_icon:before { background-color: ' + $bgColorToSet + '!important; }'; 8258 } 8259 8260 }); 8261 8262 // Material gradient btns 8263 $('body.material .nectar-button.see-through[class*="m-extra-color-gradient"]').each(function (i) { 8264 8265 var $bgColorToSet = narrowParentBGC($(this)); 8266 8267 $(this).removeClass(function (index, className) { 8268 return (className.match(/(^|\s)instance-\S+/g) || []).join(' '); 8269 }); 8270 8271 $(this).addClass('instance-' + i); 8272 nectarMatchingBGCss += '.nectar-button.see-through.instance-' + i + ':after { background-color: ' + $bgColorToSet + '!important; }'; 8273 8274 }); 8275 8276 // Style 8277 nectarCreateStyle(nectarMatchingBGCss, 'nectaricon-color-match'); 8278 8279 } 8280 8281 8282 8283 8284 8285 /** 8286 * One fourth column classes. 8287 * 8288 * @since 2.0 8289 */ 8290 function oneFourthClasses() { 8291 8292 $('.col.span_3, .vc_span3, .vc_col-sm-3').each(function () { 8293 if (!$(this).is('[data-t-w-inherits="small_desktop"]')) { 8294 8295 var $currentDiv = $(this); 8296 var $nextDiv = $(this).next('div'); 8297 8298 if ($nextDiv.hasClass('span_3') && !$currentDiv.hasClass('one-fourths') || 8299 $nextDiv.hasClass('vc_span3') && !$currentDiv.hasClass('one-fourths') || 8300 $nextDiv.hasClass('vc_col-sm-3') && !$currentDiv.hasClass('one-fourths')) { 8301 $currentDiv.addClass('one-fourths clear-both'); 8302 $nextDiv.addClass('one-fourths right-edge'); 8303 } 8304 } 8305 }); 8306 8307 // Make empty second 1/2 half columns display right on iPad 8308 $('.span_12 .col.span_6').each(function () { 8309 if ($(this).next('div').hasClass('span_6') && $.trim($(this).next('div').html()).length == 0) { 8310 $(this).addClass('empty-second'); 8311 } 8312 }); 8313 8314 } 8315 8316 8317 8318 8319 /** 8320 * Responsive video iframes initialization. 8321 * 8322 * @since 3.0 8323 */ 8324 function responsiveVideoIframesInit() { 8325 8326 $('iframe').each(function () { 8327 8328 // Make sure the iframe has a src 8329 if (typeof $(this).attr('src') != 'undefined' && 8330 !$(this).hasClass('skip-nectar-video-size') && 8331 !$(this).hasClass('iframe-embed') && 8332 $(this).parents('.ult_modal').length == 0 && 8333 $(this).parents('.ls-slide').length == 0 && 8334 $(this).parents('.esg-entry-media').length == 0 && 8335 $(this).parents('.wpb_video_widget.wpb_content_element').length == 0) { 8336 8337 var embedSrcLower = $(this).attr('src').toLowerCase(); 8338 8339 if (embedSrcLower.indexOf("youtube") >= 0 || 8340 embedSrcLower.indexOf("vimeo") >= 0 || 8341 embedSrcLower.indexOf("twitch.tv") >= 0 || 8342 embedSrcLower.indexOf("kickstarter") >= 0 || 8343 embedSrcLower.indexOf("embed-ssl.ted") >= 0 || 8344 embedSrcLower.indexOf("dailymotion") >= 0) { 8345 8346 $(this).addClass('iframe-embed'); 8347 8348 if ($(this).width() < $(this).parent().width()) { 8349 $(this) 8350 .attr('data-aspectRatio', $(this).height() / $(this).width()) 8351 .removeAttr('height') 8352 .removeAttr('width'); 8353 } else { 8354 $(this) 8355 .attr('data-aspectRatio', '0.56') 8356 .removeAttr('height') 8357 .removeAttr('width'); 8358 } 8359 8360 if ($(this).parents('.post-area.masonry.classic').length > 0) { 8361 $(this) 8362 .attr('data-aspectRatio', '0.56') 8363 .removeAttr('height') 8364 .removeAttr('width'); 8365 } 8366 8367 } 8368 8369 } 8370 8371 }); 8372 8373 } 8374 8375 8376 /** 8377 * Responsive video iframes. 8378 * 8379 * @since 3.0 8380 */ 8381 function responsiveVideoIframes() { 8382 8383 $('iframe[data-aspectRatio]').each(function () { 8384 8385 var $el = $(this), 8386 newWidth = $el.parent().width(); 8387 8388 // In nectar slider 8389 if ($(this).parents('.swiper-slide').length > 0) { 8390 if ($(this).is(':visible')) { 8391 $el 8392 .width(newWidth) 8393 .height(newWidth * $el.attr('data-aspectRatio')); 8394 } 8395 } 8396 // All others 8397 else { 8398 $el 8399 .width(newWidth) 8400 .height(newWidth * $el.attr('data-aspectRatio')); 8401 } 8402 8403 }); 8404 8405 } 8406 8407 8408 /** 8409 * Reveal the audio/video elements after the size has been calculated. 8410 * 8411 * @since 10.5 8412 */ 8413 function audioVideoVis() { 8414 8415 //unwrap post and protfolio videos 8416 $('.video-wrap iframe').unwrap(); 8417 $('#sidebar iframe[src]').unwrap(); 8418 8419 $('audio') 8420 .attr('width', '100%') 8421
8421.attr('height', '100%') 8422 .css('visibility', 'visible'); 8423 8424 if ($body.hasClass('mobile')) { 8425 $('video').css('visibility', 'hidden'); 8426 } else { 8427 $('video').css('visibility', 'visible'); 8428 } 8429 8430 8431 $('.wp-video').each(function () { 8432 var video = $(this).find('video').get(0); 8433 video.addEventListener('loadeddata', function () { 8434 $window.trigger('resize'); 8435 }, false); 8436 }); 8437 8438 //webkit video back button fix 8439 $('.main-content iframe[src]').each(function () { 8440 $(this).css({ 8441 'opacity': '1', 8442 'visibility': 'visible' 8443 }); 8444 }); 8445 8446 } 8447 8448 8449 8450 8451 8452 /** 8453 * Nectar video background size calculations 8454 * 8455 * @since 5.0 8456 */ 8457 function resizeVideoToCover() { 8458 8459 var vid_w_orig = 1280, 8460 vid_h_orig = 720, 8461 min_w = 1200; 8462 8463 $('.nectar-video-wrap').each(function () { 8464 8465 var $containerHeight, $containerWidth; 8466 8467 if ($(this).find('video').length == 0) { 8468 return; 8469 } 8470 8471 if ($(this).parents('#page-header-bg').length > 0) { 8472 8473 if ($('.container-wrap.auto-height').length > 0) { 8474 return false; 8475 } 8476 8477 $containerHeight = $(this).parents('#page-header-bg').outerHeight(); 8478 $containerWidth = $(this).parents('#page-header-bg').outerWidth(); 8479 } else { 8480 8481 if ($(this).hasClass('column-video')) { 8482 if( $body.is('[data-flex-cols="true"]') ) { 8483 $containerHeight = $(this).parents('.vc_column-inner').outerHeight(); 8484 $containerWidth = $(this).parents('.vc_column-inner').outerWidth(); 8485 } else { 8486 $containerHeight = $(this).parents('.wpb_column').outerHeight(); 8487 $containerWidth = $(this).parents('.wpb_column').outerWidth(); 8488 } 8489 } else { 8490 $containerHeight = $(this).parents('.wpb_row').outerHeight(); 8491 $containerWidth = ($(this).parents('.full-width-section').length > 0) ? nectarDOMInfo.winW : $(this).parents('.wpb_row').outerWidth(); 8492 } 8493 } 8494 8495 // Set the video viewport to the window size 8496 $(this).width($containerWidth); 8497 if ($(this).parents('#page-header-bg').length > 0) { 8498 $(this).height($containerHeight); 8499 } 8500 8501 // Use largest scale factor of horizontal/vertical 8502 var scale_h = $containerWidth / vid_w_orig, 8503 scale_v = ($containerHeight - $containerHeight) / vid_h_orig, 8504 scale = scale_h > scale_v ? scale_h : scale_v; 8505 8506 // Update minium width to never allow excess space 8507 min_w = 1280 / 720 * ($containerHeight + 40); 8508 8509 // Don't allow scaled width < minimum video width 8510 if (scale * vid_w_orig < min_w) { 8511 scale = min_w / vid_w_orig; 8512 } 8513 8514 // Now scale the video 8515 $(this).find('video, .mejs-overlay, .mejs-poster').width(Math.ceil(scale * vid_w_orig + 0)); 8516 $(this).find('video, .mejs-overlay, .mejs-poster').height(Math.ceil(scale * vid_h_orig + 0)); 8517 8518 // And center it by scrolling the video viewport 8519 $(this).scrollLeft(($(this).find('video').width() - $containerWidth) / 2); 8520 $(this).scrollTop(($(this).find('video').height() - ($containerHeight)) / 2); 8521 $(this).find('.mejs-overlay, .mejs-poster').scrollTop(($(this).find('video').height() - ($containerHeight)) / 2); 8522 8523 8524 // Align bottom 8525 if ($(this).attr('data-bg-alignment') == 'center bottom' || $(this).attr('data-bg-alignment') == 'bottom') { 8526 $(this).scrollTop(($(this).find('video').height() - ($containerHeight + 6))); 8527 } 8528 // Align top 8529 else if ($(this).attr('data-bg-alignment') == 'center top' || $(this).attr('data-bg-alignment') == 'top') { 8530 $(this).scrollTop(0); 8531 } 8532 8533 // Add loaded class 8534 $(this).addClass('position-loaded'); 8535 }); 8536 8537 } 8538 8539 8540 8541 /** 8542 * Nectar video background initialization. 8543 * 8544 * @since 5.0 8545 */ 8546 function videoBGInit() { 8547 8548 if ($('.nectar-video-wrap').length == 0 && $('.nectar-youtube-bg').length == 0) { 8549 return; 8550 } 8551 8552 setTimeout(function () { 8553 8554 resizeVideoToCover(); 8555 8556 // Resize 8557 $window.on('resize',resizeVideoToCover); 8558 8559 $('.video-color-overlay').each(function () { 8560 $(this).css('background-color', $(this).attr('data-color')); 8561 }); 8562 8563 $('.nectar-video-wrap').each(function () { 8564 8565 if ($(this).find('video').length == 0) { 8566 return; 8567 } 8568 8569 var $headerVideo = ($(this).parents('#page-header-bg').length > 0) ? true : false;
8570 var $that = $(this); 8571 var videoReady = setInterval(function () { 8572 8573 if ($that.find('video').get(0).readyState > 3) { 8574 8575 if (!nectarDOMInfo.usingMobileBrowser) { 8576 $that.transition({ 8577 'opacity': '1' 8578 }, 400); 8579 $that.find('video').transition({ 8580 'opacity': '1' 8581 }, 400); 8582 $that.parent().find('.video-color-overlay').transition({ 8583 'opacity': '0.7' 8584 }, 400); 8585 if ($headerVideo == true) { 8586 pageHeaderTextEffect(); 8587 } 8588 } 8589 8590 // Remove page loading screen 8591 $loadingScreenEl.addClass('loaded'); 8592 setTimeout(function () { 8593 $loadingScreenEl.addClass('hidden'); 8594 }, 1000); 8595 8596 8597 clearInterval(videoReady); 8598 } 8599 8600 }, 60); 8601 8602 if (nectarDOMInfo.usingMobileBrowser) { 8603 if ($that.parents('.full-width-section').length > 0 && $that.parents('#nectar_fullscreen_rows').length == 0) { 8604 $that.css('left', '50%'); 8605 } else { 8606 $that.css('left', '0px'); 8607 } 8608 8609 if ($headerVideo == true) { 8610 pageHeaderTextEffect(); 8611 } 8612 $that.find('video')[0].onplay = function () { 8613 $that.transition({ 8614 'opacity': '1' 8615 }, 400); 8616 $that.find('video').transition({ 8617 'opacity': '1' 8618 }, 400); 8619 $that.parent().find('.video-color-overlay').transition({ 8620 'opacity': '0.7' 8621 }, 400); 8622 }; 8623 } 8624 8625 }); 8626 }, 300); 8627 8628 8629 if (nectarDOMInfo.usingMobileBrowser) { 8630 8631 $('.nectar-video-wrap').each(function () { 8632 8633 if (!$(this).find('video').is('[muted]')) { 8634 8635 // Autoplay not supported unless muted 8636 $(this).parent().find('.mobile-video-image').show(); 8637 $(this).remove(); 8638 } 8639 8640 }); 8641 8642 } 8643 8644 8645 $('.wpb_row:has(".nectar-video-wrap"):not(.fp-section)').each(function (i) { 8646 $(this).css('z-index', 100 + i); 8647 }); 8648 8649 8650 $(".vc_row").each(function () { 8651 var youtubeUrl, youtubeId, $row = jQuery(this); 8652 $row.find('.nectar-youtube-bg').length > 0 ? (youtubeUrl = $row.find('.nectar-youtube-bg span').text(), youtubeId = nectarExtractYoutubeId(youtubeUrl), youtubeId && ($row.find(".vc_video-bg").remove(), nectarInsertYoutubeVideoAsBackground($row.find('.nectar-youtube-bg'), youtubeId))) : $row.find(".nectar-youtube-bg").remove(); 8653 8654 // Remove yt url 8655 $row.find('.nectar-youtube-bg span').remove(); 8656 8657 if (!nectarDOMInfo.usingMobileBrowser) { 8658 $row.find('.nectar-video-wrap, .nectar-youtube-bg').css({ 8659 'opacity': '1', 8660 'width': '100%', 8661 'height': '100%' 8662 }); 8663 } 8664 $row.find('.video-color-overlay').transition({ 8665 'opacity': '0.7' 8666 }, 400); 8667 }); 8668 8669 8670 function nectarInsertYoutubeVideoAsBackground($element, youtubeId, counter) { 8671 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 () { 8672 nectarInsertYoutubeVideoAsBackground($element, youtubeId, counter++) 8673 }, 100); 8674 var $container = $element.prepend('<div class="vc_video-bg"><div class="inner"></div></div>').find(".inner"); 8675 new YT.Player($container[0], { 8676 width: "100%", 8677 height: "100%", 8678 videoId: youtubeId, 8679 playerVars: { 8680 playlist: youtubeId, 8681 iv_load_policy: 3, 8682 enablejsapi: 1, 8683 disablekb: 1, 8684 autoplay: 1, 8685 controls: 0, 8686 showinfo: 0, 8687 rel: 0, 8688 loop: 1 8689 }, 8690 events: { 8691 onReady: function (event) { 8692 event.target.mute().setLoop(!0); 8693 nectarResizeVideoBackground($element); 8694 } 8695 } 8696 }), nectarResizeVideoBackground($element), jQuery(window).on("resize", function () { 8697 nectarResizeVideoBackground($element); 8698 }); 8699 8700 setTimeout(function () {
8701 nectarResizeVideoBackground($element); 8702 }, 100); 8703 } 8704 8705 function nectarResizeVideoBackground($element) { 8706 var iframeW, iframeH, marginLeft, marginTop, containerW = $element.innerWidth(), 8707 containerH = $element.innerHeight(), 8708 ratio1 = 16, 8709 ratio2 = 9; 8710 ratio1 / ratio2 > containerW / containerH ? (iframeW = containerH * (ratio1 / ratio2), 8711 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", 8712 marginLeft = -Math.round((iframeW - containerW) / 2) + "px", iframeW += "px", iframeH += "px"), 8713 $element.find(".vc_video-bg iframe").css({ 8714 maxWidth: "1000%", 8715 marginLeft: marginLeft, 8716 marginTop: marginTop, 8717 width: iframeW, 8718 height: iframeH 8719 }); 8720 } 8721 8722 function nectarExtractYoutubeId(url) { 8723 8724 if ("undefined" == typeof url) { 8725 return !1; 8726 } 8727 8728 var id = url.match(/(?:https?:\/{2})?(?:w{3}\.)?youtu(?:be)?\.(?:com|be)(?:\/watch\?v=|\/)([^\s&]+)/); 8729 return null !== id ? id[1] : !1 8730 } 8731 8732 8733 } 8734 8735 8736 8737 8738 /** 8739 * Single Blog Posts 8740 * 8741 * @since 11.0 8742 */ 8743 function blogSingle() { 8744 8745 // Remove first gallery on post when using the gallery slider option. 8746 if( $body.hasClass('single-post') && $('.content-inner[data-has-gallery]').length > 0 ) { 8747 8748 8749 if($('.wp-block-gallery').length > 0) { 8750 // Gutenberg. 8751 $('.content-inner').find('.wp-block-gallery').each(function(i) { 8752 if(i !== 0) { 8753 $(this).css('display','flex'); 8754 } 8755 }); 8756 8757 } else { 8758 // Classic Editor. 8759 $('.content-inner').find('.gallery').each(function(i) { 8760 if(i !== 0) { 8761 $(this).css('display','block'); 8762 } 8763 }); 8764 8765 } 8766 8767 } // If using gallery slider on single conditional end. 8768 8769 } 8770 8771 8772 8773 8774 8775 /*-------------------------------------------------------------------------*/ 8776 /* Header + Search 8777 /*-------------------------------------------------------------------------*/ 8778 8779 /** 8780 * Correct megamenus in mobile navigation. 8781 * 8782 * @since 8.0 8783 */ 8784 function mobileNavMegamenuCorrect() { 8785 8786 ////mobile megamenus without titles / nested groupings 8787 var $mobileNavSelector = ( $('#top #mobile-menu').length > 0 ) ? '#top #mobile-menu ' : '.off-canvas-menu-container.mobile-only '; 8788 8789 $($mobileNavSelector + '.megamenu > ul > li > a').each(function () { 8790 if ($(this).text() == '-' || $(this).text() == '–' || $(this).parent().hasClass('hide-title')) { 8791 var $navLIs = $(this).parent().find('> ul > li').clone(); 8792 $(this).parent().find('ul').remove(); 8793 $(this).parent().parent().append($navLIs); 8794 $(this).parent().remove(); 8795 } 8796 }); 8797 8798 } 8799 8800 8801 8802 8803 8804 8805 8806 8807 /** 8808 * Material theme skin off canvas menu initialization. 8809 * 8810 * @since 10.5 8811 */ 8812 function materialSkinOCM_Init() { 8813 8814 if ($('body.material[data-slide-out-widget-area-style="slide-out-from-right"]').length > 0) { 8815 OCM_materialWidth(); 8816 8817 if( $wpAdminBar.length > 0 ) { 8818 var $topToolBar = $wpAdminBar.detach(); 8819 $('.ocm-effect-wrap-inner').append($topToolBar); 8820 } 8821 8822 } 8823 8824 OCM_materialIconMarkup(); 8825 materialSkinTransition(); 8826 8827 $window.on('resize', OCM_materialSize); 8828 8829 } 8830 8831 8832 8833 8834 /** 8835 * Material theme skin transition helper 8836 * 8837 * @since 10.5 8838 */ 8839 function materialSkinTransition() { 8840 8841 if ($('body.material[data-header-search="true"]').length > 0 || 8842 $('body.material .ocm-effect-wrap').length > 0) { 8843 8844 var materialTransTO, 8845 allowMaterialResizeCalc = false, 8846 orientTrack = 0, 8847 $winDOMWidth = nectarDOMInfo.winW, 8848 $winDOMHeight = nectarDOMInfo.winH; 8849 8850 // For mobile make sure the orientation has changed. 8851 window.addEventListener("orientationchange", function () { 8852 orientTrack = 1; 8853 }); 8854 8855 // Resize. 8856 $window.on('resize', function () { 8857 8858 if( nectarDOMInfo.usingMobileBrowser ) { 8859 // Mobile. 8860 if (($window.width() != $winDOMWidth && $window.height != $winDOMHeight) || orientTrack === 1) { 8861 8862 // Store the current window dimensions. 8863 $winDOMWidth = nectarDOMInfo.winW; 8864 $winDOMHeight = nectarDOMInfo.winH; 8865 8866 // Reset orientation change tracker. 8867 orientTrack = 0; 8868 8869 // Set to allow. 8870 allowMaterialResizeCalc = true; 8871 8872 } 8873 } else { 8874 // Desktop always allows. 8875 allowMaterialResizeCalc = true; 8876 } 8877 8878 if(allowMaterialResizeCalc) { 8879 8880 clearTimeout(materialTransTO); 8881
8882 $('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') 8883 .addClass('no-material-transition'); 8884 8885 materialTransTO = setTimeout(function () { 8886 $('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') 8887 .removeClass('no-material-transition'); 8888 }, 250); 8889 8890 OCM_materialWidth(); 8891 8892 // Reset allow. 8893 allowMaterialResizeCalc = false; 8894 8895 } // endif for allow. 8896 8897 }); // end resize. 8898 8899 } 8900 8901 } 8902 8903 8904 8905 /** 8906 * Calculate off canvas menu slide out from right on hover 8907 * 8908 * @since 8.0 8909 */ 8910 function calculateHoverNavMinHeight() { 8911 8912 var $widgetHeights = 0; 8913 $('#slide-out-widget-area > .widget').each(function () { 8914 $widgetHeights += $(this).height(); 8915 }); 8916 8917 var $menuHeight; 8918 8919 if(($offCanvasEl.height() - 25 - $('.bottom-meta-wrap').outerHeight(true) - $widgetHeights) > $('#slide-out-widget-area .off-canvas-menu-container:last-child').height()) { 8920 $menuHeight = $offCanvasEl.height() - 25 - $('.bottom-meta-wrap').outerHeight(true) - $widgetHeights; 8921 } else { 8922 $menuHeight = $('#slide-out-widget-area .off-canvas-menu-container:last-child').height(); 8923 } 8924 8925 $('#slide-out-widget-area .inner').css({ 8926 'height': 'auto', 8927 'min-height': $menuHeight 8928 }); 8929 8930 $('#slide-out-widget-area > .inner .off-canvas-menu-container').transition({ 8931 y: '-' + ($('#slide-out-widget-area > .inner .off-canvas-menu-container:last-child').height() / 2) + 'px' 8932 }, 0); 8933 8934 } 8935 8936 8937 /** 8938 * Material theme skin off canvas menu width. 8939 * 8940 * @since 8.0 8941 */ 8942 function OCM_materialWidth() { 8943 8944 $('#slide-out-widget-area.slide-out-from-right').css({ 8945 'padding-top': $window.height() * 0.1, 8946 'padding-bottom': $window.height() * 0.1 8947 }); 8948 8949 OCM_overflowState(); 8950 } 8951 8952 8953 8954 /** 8955 * Material theme skin off canvas menu icon markup 8956 * 8957 * @since 8.0 8958 */ 8959 function OCM_materialIconMarkup() { 8960 8961 if ($('body.material').length > 0 && $('body[data-slide-out-widget-area-style="slide-out-from-right-hover"]').length == 0 ) { 8962 8963 if ($('body[data-slide-out-widget-area-style*="fullscreen"]').length == 0 && $('#mobile-menu').length == 0) { 8964 var $menuIconClone = $('header#top nav ul .slide-out-widget-area-toggle a > span > i').clone(); 8965 $menuIconClone.addClass('hover-effect'); 8966 $('header#top nav ul .slide-out-widget-area-toggle a > span').append($menuIconClone); 8967 8968 var $menuIconClone2 = $('header#top .slide-out-widget-area-toggle.mobile-icon a > span > i').clone(); 8969 $menuIconClone2.addClass('hover-effect'); 8970 $('header#top .slide-out-widget-area-toggle.mobile-icon a > span').append($menuIconClone2); 8971 } 8972 8973 $('body:not([data-slide-out-widget-area-style="slide-out-from-right"]) header#top .slide-out-widget-area-toggle a > span') 8974 .append($('<span class="close-wrap"> <span class="close-line close-line1"></span> <span class="close-line close-line2"></span> </span>')); 8975 8976 setTimeout(function(){ 8977 $('header#top .slide-out-widget-area-toggle a > span .close-wrap').addClass('loaded'); 8978 },200); 8979 8980 } 8981 8982 if ($('body.material #boxed').length > 0 && $('body[data-slide-out-widget-area-style="slide-out-from-right-hover"]').length > 0) { 8983 $('#ajax-content-wrap > .slide-out-widget-area-toggle.slide-out-hover-icon-effect').insertAfter('.ocm-effect-wrap'); 8984 } 8985 8986 //move material skin default ocm 8987 if ($('body.material').length > 0 && $('body[data-slide-out-widget-area-style*="fullscreen"]').length == 0) { 8988 $('body.material #slide-out-widget-area.slide-out-from-right .slide_out_area_close').insertAfter('.ocm-effect-wrap'); 8989 $('#slide-out-widget-area-bg').insertAfter('.ocm-effect-wrap'); 8990 $offCanvasEl.insertAfter('.ocm-effect-wrap'); 8991 } 8992 8993 } 8994 8995 8996 8997 /** 8998 * Material theme skin off canvas menu height 8999 * 9000 * @since 8.0 9001 */ 9002 function OCM_materialSize() { 9003 if ($('.ocm-effect-wrap.material-ocm-open').length > 0) { 9004 9005 $('.ocm-effect-wrap').css({ 9006 'height': $window.height() 9007 }); 9008 9009 $('.ocm-effect-wrap-inner').css({ 9010 'padding-top': nectarDOMInfo.adminBarHeight 9011 }); 9012 9013 } 9014 } 9015 9016 9017 9018 /** 9019 * Off canvas menu dropdown markup 9020 * 9021 * @since 8.0 9022 */ 9023 function OCM_dropdownMarkup() { 9024 var $nectar_ocm_dropdown_func = ($('#slide-out-widget-area[data-dropdown-func]').length > 0) ? $offCanvasEl.attr('data-dropdown-func') : 'default'; 9025 if ($nectar_ocm_dropdown_func == 'separate-dropdown-parent-link') { 9026 $('#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>'); 9027 } 9028 } 9029 9030 9031 9032 /** 9033 * Off canvas menu dropdown icon position. 9034 * 9035 * @since 8.0 9036 */ 9037 function OCM_dropdownIconPos() { 9038 9039 $('#slide-out-widget-area[class*="slide-out-from-right"] .off-canvas-menu-container li.menu-item-has-children').each(function () { 9040 $(this).find('.ocm-dropdown-arrow').css({ 9041 'top': $(this).find('a').height() / 2 9042 }); 9043 }); 9044 $('#slide-out-widget-area.fullscreen-split .off-canvas-menu-container li.menu-item-has-children').each(function () { 9045 $(this).find('.ocm-dropdown-arrow').css({ 9046 'top': $(this).find('a').height() / 2 9047 }); 9048 }); 9049 9050 } 9051 9052 9053 9054 9055 /** 9056 * Off canvas menu overflow scrolling. 9057 * 9058 * @since 8.0 9059 */ 9060 function OCM_overflowState() { 9061 9062 //switch position of social media/extra info based on screen size 9063 if (nectarDOMInfo.winW < 1000 || 9064 $('body > #boxed').length > 0 || 9065 $('.ocm-effect-wrap-inner > #boxed').length > 0) { 9066 9067 $('#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'); 9068 $('#slide-out-widget-area.fullscreen .bottom-text, #slide-out-widget-area.fullscreen-alt .bottom-text').appendTo('#slide-out-widget-area .inner'); 9069 9070 } else { 9071 $('#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'); 9072 $('#slide-out-widget-area.fullscreen .bottom-text, #slide-out-widget-area.fullscreen-alt .bottom-text').appendTo('#slide-out-widget-area .inner-wrap'); 9073 } 9074 9075 //add overflow 9076 if( !$offCanvasEl.hasClass('fullscreen-split') ) { 9077 9078 if ($('#slide-out-widget-area[class*="fullscreen"] .inner').height() >= $window.height() - 100) { 9079 $('#slide-out-widget-area[class*="fullscreen"] .inner, #slide-out-widget-area[class*="fullscreen"]').addClass('overflow-state'); 9080 } else { 9081 $('#slide-out-widget-area[class*="fullscreen"] .inner, #slide-out-widget-area[class*="fullscreen"]').removeClass('overflow-state'); 9082 } 9083 9084 $('#slide-out-widget-area[class*="fullscreen"] .inner').transition({ 9085 y: '-' + ($('#slide-out-widget-area[class*="fullscreen"] .inner').height() / 2) + 'px' 9086 }, 0); 9087 9088 } 9089 9090 //close mobile only slide out widget area if switching back to desktop 9091 if ($('.slide-out-from-right.open .off-canvas-menu-container.mobile-only').length > 0 && $('body.mobile').length == 0) { 9092 $('#slide-out-widget-area .slide_out_area_close').trigger('click'); 9093 } 9094 9095 //sizing for dropdown 9096 OCM_dropdownIconPos(); 9097 9098 } 9099 9100 9101 9102 /** 9103 * Off canvas menu: slide out from right hover open. 9104 * 9105 * @since 10.5 9106 */ 9107 function OCM_slideOutRightHoverOpen() { 9108 9109 calculateHoverNavMinHeight(); 9110 9111 if ( nectarDOMInfo.usingMobileBrowser && $('#slide-out-widget-area.open').length > 0 ) { 9112 OCM_mobileSlideOutRightHoverCloseCheck(); 9113 return false;
9114 } 9115 9116 if( nectarDOMInfo.usingMobileBrowser ) { 9117 $('.slide-out-widget-area-toggle a').attr('aria-expanded','true'); 9118 } 9119 9120 $offCanvasEl.css({ 9121 'transform': 'translate3d(0,0,0)' 9122 }).addClass('open'); 9123 9124 // Icon effect 9125 // Set position 9126 if ($('header#top .container .span_9 > .slide-out-widget-area-toggle').length > 0) { 9127 9128 var $hIconEl = $('.slide-out-hover-icon-effect'), 9129 secondaryBarHeight = nectarDOMInfo.secondaryHeaderHeight; 9130 9131 var $nectarHamMenuPos; 9132 9133 if ($('body.mobile').length > 0) { 9134 9135 $hIconEl.css({ 9136 'top': $('header#top .span_9 > .slide-out-widget-area-toggle a').offset().top - nectarDOMInfo.scrollTop, 9137 'right': parseInt($('#header-outer header > .container').css('padding-right')) + 1 9138 }); 9139 9140 } else { 9141 9142 if ($bodyBorderHeaderColorMatch) { 9143 9144 var $extraCushion = ($('#header-outer[data-has-menu="false"]').length > 0) ? 2 : 1; 9145 $hIconEl.css({ 9146 'top': nectarDOMInfo.adminBarHeight + secondaryBarHeight + parseInt($('header#top nav >ul .slide-out-widget-area-toggle a').css('padding-top')), 9147 'right': 29 + $extraCushion 9148 }); 9149 9150 } else { 9151 9152 if ($('#header-outer[data-format="centered-menu-bottom-bar"]').length > 0) { 9153 $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(); 9154 9155 $hIconEl.css({ 9156 'top': parseInt($nectarHamMenuPos.top) - nectarDOMInfo.scrollTop, 9157 'right': parseInt($('#header-outer header >.container').css('padding-right')) + 2 9158 }); 9159 } else { 9160 9161 if( $body.hasClass('ascend') ) { 9162 $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(); 9163 } else { 9164 $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(); 9165 } 9166 9167 9168 if ($('#header-secondary-outer.hide-up').length > 0) { 9169 secondaryBarHeight = 0; 9170 } 9171 9172 $hIconEl.css({ 9173 'top': nectarDOMInfo.adminBarHeight + secondaryBarHeight + parseInt($nectarHamMenuPos.top), 9174 'right': parseInt($('#header-outer header >.container').css('padding-right')) + 2 9175 }); 9176 } 9177 9178 } // No body border color match. 9179 9180 } //Not on mobile. 9181 9182 } 9183 9184 ////Open 9185 $('.slide-out-hover-icon-effect .lines-button') 9186 .removeClass('no-delay') 9187 .addClass('unhidden-line'); 9188 9189 if ($('#header-outer[data-permanent-transparent="1"]').length == 0 && 9190 $('#nectar_fullscreen_rows').length == 0 && 9191 !nectarDOMInfo.usingFrontEndEditor && 9192 nectarDOMInfo.winW > 1000) { 9193 9194 if (!(nectarDOMInfo.scrollTop == 0 && $('#header-outer.transparent').length > 0)) { 9195 9196 if ($('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) { 9197 9198 $headerOuterEl.attr('data-transparent', 'true').addClass('no-bg-color').addClass('slide-out-hover'); 9199 $('#header-outer header, #header-outer > .cart-outer').addClass('all-hidden'); 9200 } 9201 9202 } 9203 9204 if ($('#header-outer[data-remove-fixed="1"]').length == 0 && $('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) { 9205 9206 if (headerResize == true) { 9207 9208 $window.off('scroll', bigNav); 9209 $window.off('scroll', smallNav); 9210 9211 } else { 9212 $window.off('scroll', opaqueCheck); 9213 $window.off('scroll', transparentCheck); 9214 } 9215 } 9216 9217 } 9218 9219 if (!nectarDOMInfo.usingMobileBrowser) { 9220 $window.on('mousemove.rightOffsetCheck', OCM_slideOutRightHoverCloseCheck); 9221 } else { 9222 return false;
9223 } 9224 9225 } 9226 9227 9228 /** 9229 * Off canvas menu: slide out from right hover close 9230 * 9231 * @since 10.5 9232 */ 9233 function OCM_slideOutRightHoverCloseCheck(e) { 9234 9235 var $windowWidth = $window.width(); 9236 var $ocmHoverWidth = $offCanvasEl.outerWidth(); 9237 9238 if (e.clientX < $windowWidth - parseInt($ocmHoverWidth) - $bodyBorderWidth && $offCanvasEl.hasClass('mouse-accessed')) { 9239 9240 $offCanvasEl.removeClass('mouse-accessed'); 9241 $window.off('mousemove.rightOffsetCheck', OCM_slideOutRightHoverCloseCheck); 9242 9243 $offCanvasEl.css({ 9244 'transform': 'translate3d(101%,0,0)' 9245 }).removeClass('open'); 9246 9247 $headerOuterEl.removeClass('style-slide-out-from-right'); 9248 9249 $('.slide-out-hover-icon-effect .lines-button') 9250 .removeClass('unhidden-line') 9251 .addClass('no-delay'); 9252 9253 if ($('#header-outer[data-permanent-transparent="1"]').length == 0) { 9254 9255 if ($('#header-outer[data-remove-fixed="1"]').length == 0 && $('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) { 9256 9257 if ($('body.mobile').length == 0) { 9258 $headerOuterEl.removeClass('no-bg-color'); 9259 $('#header-outer header, #header-outer > .cart-outer').removeClass('all-hidden'); 9260 } 9261 } 9262 9263 if ($('#header-outer[data-remove-fixed="1"]').length == 0 && $('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) { 9264 9265 if (headerResize == true) { 9266 9267 $window.off('scroll.headerResizeEffect'); 9268 9269 if (nectarDOMInfo.scrollTop == 0) { 9270 9271 $window.on('scroll.headerResizeEffect', smallNav); 9272 9273 if ($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 && 9274 $bodyBorderTop.length > 0 && 9275 $bodyBorderHeaderColorMatch == true && 9276 $('#header-outer.pseudo-data-transparent').length > 0) { 9277 9278 $('#header-outer[data-full-width="true"] header > .container').stop(true, true).animate({ 9279 'padding': '0' 9280 }, { 9281 queue: false, 9282 duration: 250, 9283 easing: 'easeOutCubic' 9284 }); 9285 9286 } 9287 } else { 9288 $window.on('scroll.headerResizeEffect', bigNav); 9289 } 9290 9291 } else { 9292 9293 $window.off('scroll.headerResizeEffectOpaque'); 9294 $window.on('scroll.headerResizeEffectOpaque', opaqueCheck); 9295 } 9296 } 9297 } 9298 } 9299 9300 } 9301 9302 9303 /** 9304 * Off canvas menu: mobile slide out from right hover close. 9305 * 9306 * @since 10.5 9307 */ 9308 function OCM_mobileSlideOutRightHoverCloseCheck() { 9309 9310 if(nectarDOMInfo.usingMobileBrowser) { 9311 $('.slide-out-widget-area-toggle a').attr('aria-expanded','false'); 9312 } 9313 9314 $offCanvasEl.css({ 9315 'transform': 'translate3d(101%,0,0)' 9316 }).removeClass('open'); 9317 9318 $headerOuterEl.removeClass('style-slide-out-from-right'); 9319 9320 $('.slide-out-hover-icon-effect .lines-button') 9321 .removeClass('unhidden-line') 9322 .addClass('no-delay'); 9323 9324 if ($('#header-outer[data-permanent-transparent="1"]').length == 0) { 9325 9326 $headerOuterEl.removeClass('no-bg-color'); 9327 $('#header-outer header').removeClass('all-hidden'); 9328 9329 } 9330 9331 9332 if ($('#header-outer[data-remove-fixed="1"]').length == 0 && $('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) { 9333 9334 if (headerResize == true) { 9335 9336 $window.off('scroll.headerResizeEffect'); 9337 9338 if (nectarDOMInfo.scrollTop == 0) { 9339 9340 $window.on('scroll.headerResizeEffect', smallNav); 9341 9342 if ($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 && 9343 $bodyBorderTop.length > 0 && 9344 $bodyBorderHeaderColorMatch == true && 9345 $('#header-outer.pseudo-data-transparent').length > 0) { 9346 9347 $('#header-outer[data-full-width="true"] header > .container').stop(true, true).animate({ 9348 'padding': '0' 9349 }, { 9350 queue: false, 9351 duration: 250, 9352 easing: 'easeOutCubic' 9353 }); 9354 9355 } 9356 } 9357 9358 else { 9359 $window.on('scroll.headerResizeEffect', bigNav); 9360 } 9361 9362 } else { 9363 9364 $window.off('scroll.headerResizeEffectOpaque'); 9365 $window.on('scroll.headerResizeEffectOpaque', opaqueCheck); 9366 9367 } 9368 9369 } 9370 9371 } 9372 9373 9374 9375 /** 9376 * Off canvas menu: slide out from right hover initialization. 9377 * 9378 * @since 10.5 9379 */ 9380 function OCM_slideOutRightHoverInit() { 9381 9382 if ($('#ajax-content-wrap > .slide-out-widget-area-toggle').length == 0) { 9383 9384 //icon effect html creation 9385 var $iconInsertLocation = ( $('.slide-out-widget-area-toggle[data-custom-color="true"]').length > 0 ) ? '#slide-out-widget-area > div' : '#slide-out-widget-area'; 9386 9387 $('<div class="slide-out-widget-area-toggle slide-out-hover-icon-effect" data-icon-animation="simple-transform"><div> <a href="#sidewidgetarea" class="closed"> <span> <i class="lines-button x2"> <i class="lines"></i> </i> </span> </a> </div> </div>').insertAfter($iconInsertLocation); 9388 9389 if ($('#header-outer[data-has-menu="true"]').length > 0 || 9390 $('body[data-header-search="true"]').length > 0 || 9391 $('.slide-out-widget-area-toggle a.using-label').length > 0 || 9392 $('.slide-out-widget-area-toggle[data-custom-color="true"]').length > 0 ) { 9393 $('.slide-out-widget-area-toggle').addClass('small'); 9394 } 9395 } 9396 9397 9398 //hover triggered 9399 if (!nectarDOMInfo.usingMobileBrowser) { 9400 $body.on('mouseenter', '#header-outer .slide-out-widget-area-toggle:not(.std-menu) a', OCM_slideOutRightHoverOpen); 9401 $offCanvasEl.on('mouseenter', function () { 9402 $(this).addClass('mouse-accessed'); 9403 }); 9404 9405 } else { 9406 $body.on('click', '.slide-out-widget-area-toggle:not(.std-menu) a', OCM_slideOutRightHoverOpen); 9407 } 9408 9409 $window.on('smartresize', calculateHoverNavMinHeight); 9410 9411 9412 } 9413 9414 9415 /** 9416 * Off canvas menu: slide out from right open. 9417 * 9418 * @since 10.5 9419 */ 9420 function OCM_slideOutRightOpen() { 9421 9422 var $slideOutAmount = ($bodyBorderTop.length > 0 && $('body.mobile').length == 0) ? $bodyBorderTop.height() : 0; 9423 9424 if ($('body.material').length == 0) { 9425
9426 // Calc height if used bottom meta. 9427 $('#slide-out-widget-area .inner').css({ 9428 'height': 'auto', 9429 'min-height': $offCanvasEl.height() - 25 - $('.bottom-meta-wrap').height() 9430 }); 9431 9432 // First item dropdown? 9433 if($('#slide-out-widget-area[data-dropdown-func="separate-dropdown-parent-link"] .inner > div:first-of-type > .menu > li:first-child').length > 0 && 9434 $('#slide-out-widget-area .inner > div:first-of-type > .menu > li:first-child').hasClass('menu-item-has-children')) { 9435 $('#slide-out-widget-area .inner > div:first-of-type').css({'margin-top':'50px'}); 9436 } 9437 9438 if ($('#boxed').length == 0) { 9439 9440 $('.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({ 9441 x: '-300px' 9442 }, 700, 'easeInOutCubic'); 9443 9444 var $withinCustomBreakpoint = mobileBreakPointCheck(); 9445 9446 if ($('#header-outer[data-format="centered-logo-between-menu"]').length == 0 || $withinCustomBreakpoint) { 9447 9448 if ($('#header-outer[data-transparency-option="1"]').length == 0 || 9449 ($('#header-outer[data-transparency-option="1"]').length > 0 && $('#header-outer[data-full-width="true"]').length == 0) || 9450 $('body.mobile').length > 0) { 9451 9452 $headerOuterEl.stop(true).css('transform', 'translateY(0)').transition({ 9453 x: '-' + (300 + $slideOutAmount) + 'px' 9454 }, 700, 'easeInOutCubic'); 9455 9456 } else { 9457 9458 $headerOuterEl.stop(true).css('transform', 'translateY(0)').transition({ 9459 x: '-' + (300 + $slideOutAmount) + 'px', 9460 'background-color': 'transparent', 9461 'border-bottom': '1px solid rgba(255,255,255,0.22)' 9462 }, 700, 'easeInOutCubic'); 9463 9464 } 9465 } else { 9466 $('#header-outer header#top nav > ul.buttons, body:not(.material) #header-outer:not([data-format="centered-logo-between-menu"]) .cart-outer .cart-menu-wrap').transition({ 9467 x: '-300px' 9468 }, 700, 'easeInOutCubic'); 9469 } 9470 9471 } 9472 9473 $offCanvasEl.stop(true).transition({ 9474 x: '-' + $slideOutAmount + 'px' 9475 }, 700, 'easeInOutCubic').addClass('open'); 9476 9477 9478 if ($('#boxed').length == 0) { 9479 9480 // Full width menu adjustments 9481 if ($('#header-outer[data-full-width="true"]').length > 0 && !$body.hasClass('mobile')) { 9482 $headerOuterEl.addClass('highzI'); 9483 $('#ascrail2000').addClass('z-index-adj'); 9484 9485 if ($('#header-outer[data-format="centered-logo-between-menu"]').length == 0) { 9486 9487 if ($bodyBorderWidth == 0) { 9488 $('header#top #logo').stop(true).transition({ 9489 x: (300 + $slideOutAmount) + 'px' 9490 }, 700, 'easeInOutCubic'); 9491 } 9492 9493 } 9494 9495 $('header#top .slide-out-widget-area-toggle .lines-button').addClass('close'); 9496 9497 $('body #header-outer nav > ul > li > a').css({ 9498 'margin-bottom': '0' 9499 }); 9500 9501 } 9502 9503 } 9504 9505 $headerOuterEl.addClass('style-slide-out-from-right'); 9506 9507 // Fade In BG Overlay 9508 $offCanvasBG.css({ 9509 'height': '100%', 9510 'width': '100%' 9511 }).stop(true).transition({ 9512 'opacity': 1 9513 }, 700, 'easeInOutCubic', function () { 9514 $('.slide-out-widget-area-toggle:not(.std-menu) > div > a').removeClass('animating'); 9515 }); 9516 9517 // Hide menu if no space 9518 if ($('#header-outer[data-format="centered-logo-between-menu"]').length == 0) { 9519 9520 var $logoWidth = ($('#logo img:visible').length > 0) ? $('#logo img:visible').width() : $('#logo').width(); 9521 9522 if ($('header#top nav > .sf-menu').offset().left - $logoWidth - 300 < 20) { 9523 $headerOuterEl.addClass('hidden-menu'); 9524 } 9525 9526 } else { 9527 $headerOuterEl.addClass('hidden-menu-items'); 9528 } 9529 9530 9531 if ($('#header-outer[data-remove-fixed="1"]').length == 0 && nectarDOMInfo.winW > 1000) { 9532 9533 if ($bodyBorderHeaderColorMatch == true && headerResize == true) { 9534 9535 $headerOuterEl.stop(true).transition({ 9536 y: '0' 9537 }, 0).addClass('transparent').css('transition', 'transform'); 9538 if ($headerOuterEl.attr('data-transparent-header') != 'true') { 9539 $headerOuterEl.attr('data-transparent-header', 'true').addClass('pseudo-data-transparent'); 9540 } 9541 9542 $window.off('scroll', bigNav); 9543 $window.off('scroll', smallNav); 9544 9545 } else if ($bodyBorderHeaderColorMatch == true) { 9546 9547 $headerOuterEl.addClass('transparent'); 9548 $window.off('scroll', opaqueCheck); 9549 $window.off('scroll', transparentCheck); 9550 9551 if ($headerOuterEl.attr('data-transparent-header') != 'true') { 9552 $headerOuterEl.attr('data-transparent-header', 'true').addClass('pseudo-data-transparent'); 9553 } 9554 } 9555 } 9556 9557 } else if ($('body.material').length > 0) { 9558 9559 // Material theme skin slide out from right 9560 9561 //move ajax loading outside 9562 if ($loadingScreenEl.length > 0 && $('.ocm-effect-wrap #ajax-loading-screen').length > 0) { 9563 $loadingScreenEl.insertBefore('.ocm-effect-wrap'); 9564 } 9565 9566 // Hide secondary header when not at top with hhun 9567 if (nectarDOMInfo.scrollTop > 40) { 9568 9569 $('body[data-hhun="1"] #header-secondary-outer').addClass('hidden'); 9570 } 9571 9572 9573 setTimeout(function () { 9574 $('.slide-out-widget-area-toggle:not(.std-menu) > div > a').removeClass('animating'); 9575 }, 300); 9576 $('#slide-out-widget-area, #slide-out-widget-area-bg, #header-outer .slide-out-widget-area-toggle').addClass('material-open'); 9577 9578 9579 // Handle bottom bar nav 9580 if ($('body:not(.mobile) #header-outer[data-format="centered-menu-bottom-bar"][data-condense="true"]').length > 0 && 9581 $('#header-outer[data-format="centered-menu-bottom-bar"] .span_9').css('display') != 'none') { 9582 9583 $('#header-outer:not(.fixed-menu)').css('top', nectarDOMInfo.adminBarHeight - nectarDOMInfo.scrollTop + 'px'); 9584 9585 if ($headerSecondaryEl.length > 0 && $('#header-outer.fixed-menu').length > 0) { 9586 $headerSecondaryEl.css('visibility', 'hidden'); 9587 } 9588 9589 } 9590 9591 $('#ajax-content-wrap').css({ 9592 'position': 'relative', 9593 'top': '-' + nectarDOMInfo.scrollTop + 'px' 9594 }); 9595 9596 $('.ocm-effect-wrap-inner').css({ 9597 'padding-top': nectarDOMInfo.adminBarHeight 9598 }); 9599 9600 $('#fp-nav').addClass('material-ocm-open'); 9601 9602 $body.addClass('material-ocm-open'); 9603 $body.addClass('nectar-no-flex-height'); 9604 9605 $('.ocm-effect-wrap').css({ 9606 'height': nectarDOMInfo.winH 9607 }); 9608 9609 setTimeout(function () { 9610 $('.ocm-effect-wrap').addClass('material-ocm-open'); 9611 }, 40); 9612 9613 9614 $('body > .slide_out_area_close').addClass('follow-body'); 9615 9616 //icon effect 9617 $('#header-outer:not([data-format="left-header"]) header#top .slide-out-widget-area-toggle a').addClass('effect-shown'); 9618 9619 //handle hhun when at top 9620 $('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({ 9621 'transition': 'none', 9622 'transform': 'translateY(' + nectarDOMInfo.adminBarHeight + 'px)' 9623 }); 9624 9625 setTimeout(function () { 9626 $('body > .slide_out_area_close').addClass('material-ocm-open'); 9627 }, 350); 9628 9629 9630 } 9631 9632 } 9633 9634 9635 /** 9636 * Off canvas menu: slide out from right close. 9637 * 9638 * @since 10.5 9639 */ 9640 function OCM_slideOutRightClose() { 9641 9642 if ($('body.material').length == 0) { 9643 9644 $('.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({ 9645 x: '0px' 9646 }, 700, 'easeInOutCubic'); 9647 9648 if ($('#header-outer[data-transparency-option="1"]').length > 0 && $('#boxed').length == 0) { 9649 var $currentRowBG = ($('#header-outer[data-current-row-bg-color]').length > 0) ? $headerOuterEl.attr('data-current-row-bg-color') : $headerOuterEl.attr('data-user-set-bg'); 9650 $headerOuterEl.stop(true).transition({ 9651 x: '0px', 9652 'background-color': $currentRowBG 9653 }, 700, 'easeInOutCubic'); 9654 } else { 9655 $headerOuterEl.stop(true).transition({ 9656 x: '0px' 9657 }, 700, 'easeInOutCubic'); 9658 } 9659 9660 $offCanvasEl.stop(true).transition({ 9661 x: '301px' 9662 }, 700, 'easeInOutCubic').removeClass('open'); 9663 9664 9665 if ($('#boxed').length == 0) { 9666 if ($('#header-outer[data-full-width="true"]').length > 0) { 9667 $headerOuterEl.removeClass('highzI'); 9668 $('header#top #logo').stop(true).transition({ 9669 x: '0px' 9670 }, 700, 'easeInOutCubic'); 9671 $('.lines-button').removeClass('close'); 9672 9673 } 9674 } 9675 9676 if ($('#header-outer[data-format="centered-logo-between-menu"]').length > 0) { 9677 $('#header-outer header#top nav > ul.buttons, #header-outer .cart-outer .cart-menu-wrap').stop(true).transition({ 9678 x: '0px' 9679 }, 700, 'easeInOutCubic'); 9680 } 9681 9682 //fade out overlay 9683 $offCanvasBG.stop(true).transition({ 9684 'opacity': 0 9685 }, 700, 'easeInOutCubic', function () { 9686 9687 $('.slide-out-widget-area-toggle a').removeClass('animating'); 9688 9689 $(this).css({ 9690 'height': '1px', 9691 'width': '1px' 9692 }); 9693 9694 if ($('#header-outer[data-remove-fixed="1"]').length == 0) { 9695 9696 //hide menu if transparent, user has scrolled down and hhun is on 9697 if ($headerOuterEl.hasClass('parallax-contained') && 9698 nectarDOMInfo.scrollTop > 0 && 9699 $('#header-outer[data-permanent-transparent="1"]').length == 0) { 9700 $headerOuterEl.removeClass('parallax-contained').addClass('detached').removeClass('transparent'); 9701 } 9702 else if (nectarDOMInfo.scrollTop == 0 && $('body[data-hhun="1"]').length >
9702 0 && $('#page-header-bg[data-parallax="1"]').length > 0 || 9703 nectarDOMInfo.scrollTop == 0 && $('body[data-hhun="1"]').length > 0 && $('.parallax_slider_outer').length > 0) { 9704 9705 if ($('#header-outer[data-transparency-option="1"]').length > 0) { 9706 $headerOuterEl.addClass('transparent'); 9707 } 9708 9709 $headerOuterEl 9710 .addClass('parallax-contained') 9711 .removeClass('detached'); 9712 9713 } 9714 9715 } 9716 9717 //fix for fixed subpage menu 9718 $('.container-wrap').css('transform', 'none'); 9719 9720 }); 9721 9722 9723 $headerOuterEl.removeClass('style-slide-out-from-right'); 9724 9725 9726 if ($('#header-outer[data-remove-fixed="1"]').length == 0) { 9727 9728 if ($bodyBorderHeaderColorMatch == true && 9729 headerResize == true && 9730 nectarDOMInfo.winW > 1000) { 9731 9732 $window.off('scroll.headerResizeEffect'); 9733 if (nectarDOMInfo.scrollTop == 0) { 9734 9735 $window.on('scroll.headerResizeEffect', smallNav); 9736 9737 if ($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 && 9738 $bodyBorderTop.length > 0 && 9739 $bodyBorderHeaderColorMatch == true && 9740 $('#header-outer.pseudo-data-transparent').length > 0) { 9741 9742 $('#header-outer[data-full-width="true"] header > .container').stop(true, true).animate({ 9743 'padding': '0' 9744 }, { 9745 queue: false, 9746 duration: 250, 9747 easing: 'easeOutCubic' 9748 }); 9749 9750 } 9751 } else { 9752 $window.on('scroll.headerResizeEffect', bigNav); 9753 } 9754 9755 if ($headerOuterEl.hasClass('pseudo-data-transparent')) { 9756 9757 $headerOuterEl.attr('data-transparent-header', 'false') 9758 .removeClass('pseudo-data-transparent') 9759 .removeClass('transparent'); 9760 } 9761 9762 $headerOuterEl.css('transition', 'transform'); 9763 9764 } else if ($bodyBorderHeaderColorMatch == true && nectarDOMInfo.winW > 1000) { 9765 9766 $window.off('scroll.headerResizeEffectOpaque'); 9767 $window.on('scroll.headerResizeEffectOpaque', opaqueCheck); 9768 9769 $headerOuterEl.css('transition', 'transform'); 9770 9771 if ($headerOuterEl.hasClass('pseudo-data-transparent')) { 9772 $headerOuterEl.attr('data-transparent-header', 'false') 9773 .removeClass('pseudo-data-transparent') 9774 .removeClass('transparent'); 9775 } 9776 } 9777 } 9778 } 9779 9780 else if ($('body.material').length > 0) { 9781 9782 //material 9783 $offCanvasEl.removeClass('open'); 9784 9785 $('#slide-out-widget-area, #slide-out-widget-area-bg, #header-outer .slide-out-widget-area-toggle').removeClass('material-open'); 9786 $('.ocm-effect-wrap, .ocm-effect-wrap-shadow, body > .slide_out_area_close, #fp-nav').removeClass('material-ocm-open'); 9787 9788 $('body > .slide_out_area_close').removeClass('follow-body'); 9789 9790 setTimeout(function () { 9791 $('.slide-out-widget-area-toggle a').removeClass('animating'); 9792 9793 $body.removeClass('material-ocm-open'); 9794 $body.removeClass('nectar-no-flex-height'); 9795 9796 $('.ocm-effect-wrap').css({ 9797 'height': '100%' 9798 }); 9799 9800 $('.ocm-effect-wrap-inner').css({ 9801 'padding-top': '0' 9802 }); 9803 9804 $window.scrollTop(Math.abs(parseInt($('#ajax-content-wrap').css('top')))); 9805 9806 $('#ajax-content-wrap').css({ 9807 'position': '', 9808 'top': '' 9809 }); 9810 9811 9812 //handle bottom bar nav 9813 if ($('#header-outer[data-format="centered-menu-bottom-bar"]').length > 0 && 9814 $('#header-outer[data-format="centered-menu-bottom-bar"] .span_9').css('display') != 'none' && 9815 $('body.mobile').length == 0) { 9816 9817 $('#header-outer:not(.fixed-menu)').css('top', ''); 9818 $headerSecondaryEl.css('visibility', ''); 9819 9820 } 9821 9822 //handle hhun when at top 9823 $('body[data-hhun="1"]:not(.no-scroll) #header-outer[data-permanent-transparent="false"]:not(.detached):not(.parallax-contained):not(.at-top-before-box)').css({ 9824 'transform': '' 9825 }); 9826 setTimeout(function () { 9827 $('body[data-hhun="1"]:not(.no-scroll) #header-outer[data-permanent-transparent="false"]:not(.detached):not(.parallax-contained):not(.at-top-before-box)').css({ 9828 'transition': '' 9829 }); 9830 }, 30); 9831 9832 9833 $('body[data-hhun="1"] #header-secondary-outer.hidden').removeClass('hidden'); 9834 9835 }, 900); 9836 9837 setTimeout(function () { 9838 9839 //icon effect 9840 $('#header-outer:not([data-format="left-header"]) header#top .slide-out-widget-area-toggle a') 9841 .addClass('no-trans') 9842 .removeClass('effect-shown'); 9843 9844 }, 200); 9845 9846 setTimeout(function () { 9847 //icon 9848 $('#header-outer:not([data-format="left-header"]) header#top .slide-out-widget-area-toggle a').removeClass('no-trans'); 9849 }, 500); 9850 9851 } 9852 9853 } 9854 9855 9856 9857 9858 /** 9859 * Off canvas menu: fullscreen open. 9860 * 9861 * @since 10.5 9862 */ 9863 function OCM_fullscreenOpen() { 9864 9865 if ($('body.material').length > 0) { 9866 $('header#top .slide-out-widget-area-toggle a').addClass('menu-push-out'); 9867 } 9868 9869 // Scroll away from fixed reveal footer if shown (firefox bug with bluring over it)
9870 var $scrollDelay = 0; 9871 var $scrollDelay2 = 0; 9872 9873 if (nectarDOMInfo.scrollTop + $window.height() > $('.blurred-wrap').height() && $('#nectar_fullscreen_rows').length == 0) { 9874 $('body,html').stop().animate({ 9875 scrollTop: $('.blurred-wrap').height() - $window.height() 9876 }, 600, 'easeInOutCubic'); 9877 $scrollDelay = 550; 9878 $scrollDelay2 = 200; 9879 } 9880 9881 $('header#top .slide-out-widget-area-toggle:not(.std-menu) .lines-button').addClass('close'); 9882 setTimeout(function () { 9883 $('.blurred-wrap').addClass('blurred'); 9884 }, $scrollDelay); 9885 $('#slide-out-widget-area.fullscreen').show().addClass('open'); 9886 9887 if ($('.nectar-social.fixed').length == 0) { 9888 hideToTop(); 9889 } 9890 9891 // Remove box shadow incase at the top of the page with nectar box roll above 9892 $('.container-wrap').addClass('no-shadow'); 9893 $headerOuterEl.stop(true).css('transform', 'translateY(0)'); 9894 9895 setTimeout(function () { 9896 9897 $('.off-canvas-menu-container .menu > li').each(function (i) { 9898 $(this).delay(i * 50).transition({ 9899 y: 0, 9900 'opacity': 1 9901 }, 800, 'easeOutExpo'); 9902 }); 9903 9904 $('#slide-out-widget-area.fullscreen .widget').each(function (i) { 9905 $(this).delay(i * 100).transition({ 9906 y: 0, 9907 'opacity': 1 9908 }, 800, 'easeOutExpo'); 9909 }); 9910 }, 370 + $scrollDelay2); 9911 9912 setTimeout(function () { 9913 $('#slide-out-widget-area .off-canvas-social-links').addClass('line-shown'); 9914 9915 $('#slide-out-widget-area .off-canvas-social-links li').each(function (i) { 9916 $(this).delay(i * 50).transition({ 9917 'scale': 1 9918 }, 400, 'easeOutCubic'); 9919 }); 9920 9921 $('#slide-out-widget-area .bottom-text').transition({ 9922 'opacity': 0.7 9923 }, 400, 'easeOutCubic'); 9924 }, 750 + $scrollDelay2); 9925 9926 // Fade In BG Overlay 9927 setTimeout(function () { 9928 var $easing = ($('body.mobile').length > 0) ? 'easeOutCubic' : 'easeInOutQuint'; 9929 $offCanvasBG.css({ 9930 'height': '100%', 9931 'width': '100%' 9932 }).show().stop(true).transition({ 9933 'y': '0%' 9934 }, 920, $easing, function () { 9935 $('.slide-out-widget-area-toggle > div > a').removeClass('animating'); 9936 }); 9937 }, 50 + $scrollDelay2); 9938 9939 // Overflow state 9940 OCM_overflowState(); 9941 9942 if ($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && $('.container-wrap').hasClass('no-scroll')) { 9943 $('#ajax-content-wrap').addClass('at-content'); 9944 } 9945 9946 if ($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 || $('.mobile').length == 0 && $('#header-outer.transparent').length == 0) { 9947 $('#slide-out-widget-area.fullscreen .inner-wrap').css('padding-top', $headerOuterEl.height()); 9948 } 9949 9950 } 9951 9952 9953 /** 9954 * Off canvas menu: fullscreen close. 9955 * 9956 * @since 10.5 9957 */ 9958 function OCM_fullscreenClose() { 9959 9960 if ($('body.material').length > 0) { 9961 setTimeout(function () { 9962 $('header#top .slide-out-widget-area-toggle a').removeClass('menu-push-out'); 9963 }, 350); 9964 } 9965 9966 $('.slide-out-widget-area-toggle:not(.std-menu) .lines-button').removeClass('close'); 9967 $('.blurred-wrap').removeClass('blurred'); 9968 $('#slide-out-widget-area.fullscreen').transition({ 9969 'opacity': 0 9970 }, 700, 'easeOutQuad', function () { 9971 $('#slide-out-widget-area.fullscreen').hide().css('opacity', '1'); 9972 }).removeClass('open'); 9973 $('#slide-out-widget-area.fullscreen .widget').transition({ 9974 'opacity': 0 9975 }, 700, 'easeOutQuad', function () { 9976 $(this).transition({ 9977 y: '110px' 9978 }, 0); 9979 }); 9980 9981 setTimeout(function () { 9982 $('.off-canvas-menu-container .menu > li').transition({ 9983 y: '80px', 9984 'opacity': 0 9985 }, 0); 9986 $('#slide-out-widget-area .off-canvas-social-links li').transition({ 9987 'scale': 0 9988 }, 0); 9989 $('#slide-out-widget-area .off-canvas-social-links').removeClass('line-shown'); 9990 $('#slide-out-widget-area .bottom-text').transition({ 9991 'opacity': 0 9992 }, 0); 9993 9994 // Close submenu items 9995 $('#slide-out-widget-area .menuwrapper .menu').removeClass('subview'); 9996 $('#slide-out-widget-area .menuwrapper .menu li').removeClass('subview subviewopen'); 9997 $('#slide-out-widget-area.fullscreen .inner .off-canvas-menu-container').css('height', 'auto'); 9998 }, 800); 9999 10000 setTimeout(function () { 10001 if ($('.nectar-social.fixed').length == 0) { 10002 showToTop(); 10003 } 10004 $('.container-wrap').removeClass('no-shadow'); 10005 }, 500); 10006 10007 // Fade out overlay 10008 $offCanvasBG.stop(true).transition({ 10009 'opacity': 0 10010 }, 900, 'easeOutQuad', function () { 10011 10012 if ($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && $('.container-wrap').hasClass('no-scroll')) { 10013 $('#ajax-content-wrap').removeClass('at-content'); 10014 } 10015 if ($('.mobile #header-outer[data-permanent-transparent="false"]').length == 0) { 10016 $('#slide-out-widget-area.fullscreen .inner-wrap').css('padding-top', '0'); 10017 } 10018 10019 $('.slide-out-widget-area-toggle a').removeClass('animating'); 10020 10021 var $opacity = 0.4; 10022 10023 if ($offCanvasBG.hasClass('solid')) { 10024 $opacity = 1; 10025 } 10026 if ($offCanvasBG.hasClass('dark')) { 10027 $opacity = 0.93; 10028 } 10029 if ($offCanvasBG.hasClass('medium')) { 10030 $opacity = 0.6; 10031 } 10032 if ($offCanvasBG.hasClass('light')) { 10033 $opacity = 0.4; 10034 } 10035 $(this).css({ 10036 'height': '1px', 10037 'width': '1px', 10038 'opacity': $opacity 10039 }).transition({ 10040 y: '-100%' 10041 }, 0); 10042 }); 10043 10044 } 10045 10046 10047 /** 10048 * Off canvas menu: fullscreen alt open. 10049 * 10050 * @since 10.5 10051 */ 10052 function OCM_fullscreenAltOpen() { 10053 10054 var $ocm_fullscreen_class = ( $offCanvasEl.hasClass('fullscreen-alt') ) ? '.fullscreen-alt' : '.fullscreen-split'; 10055 10056 if ($('body.material').length > 0) { 10057 $('header#top .slide-out-widget-area-toggle a').addClass('menu-push-out'); 10058 } 10059 10060 $('header#top .slide-out-widget-area-toggle:not(.std-menu) .lines-button').addClass('close'); 10061 10062 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 10063 $('#slide-out-widget-area'+$ocm_fullscreen_class).show().addClass('open'); 10064 } else { 10065 $('#slide-out-widget-area'+$ocm_fullscreen_class).addClass('open').removeClass('hidden'); 10066 } 10067 10068 $offCanvasBG.addClass('open').removeClass('hidden'); 10069 10070 $('body > div[class*="body-border"]').css('z-index', '9995'); 10071 10072 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 10073 $('.off-canvas-menu-container .menu').transition({ 10074 y: '0px', 10075 'opacity': 1 10076 }, 0); 10077 } 10078 10079 if ($('.nectar-social.fixed').length == 0) { 10080 hideToTop(); 10081 } 10082 10083 if ($('#header-outer.transparent').length > 0) { 10084 10085 if ($bodyBorderTop.length > 0) { 10086 $('.admin-bar #slide-out-widget-area-bg'+$ocm_fullscreen_class).css({ 10087 'padding-top': ($bodyBorderTop.outerHeight(true) + 32) + 'px' 10088 }); 10089 $('body:not(.admin-bar) #slide-out-widget-area-bg'+$ocm_fullscreen_class).css({ 10090 'padding-top': ($bodyBorderTop.outerHeight(true)) + 'px' 10091 }); 10092 } 10093 } 10094 10095 // Set translateY to 0 in all cases 10096 $headerOuterEl.stop(true).css('transform', 'translateY(0)'); 10097 10098 if ($('#logo .starting-logo').length > 0 && 10099 $window.width() > 1000 && 10100 $('#header-outer[data-format="centered-menu-bottom-bar"].fixed-menu').length == 0 && 10101 $('body.material #header-outer[data-condense="true"]').length == 0 && 10102 !nectarDOMInfo.usingFrontEndEditor) { 10103 10104 $headerOuterEl.stop(true).css('transform', 'translateY(0)').addClass('transparent'); 10105 if ($headerOuterEl.attr('data-transparent-header') != 'true') { 10106 $headerOuterEl.attr('data-transparent-header', 'true').addClass('pseudo-data-transparent'); 10107 } 10108 10109 } 10110 10111 $('.off-canvas-menu-container .clip-wrap').css('transition-duration', '0s'); 10112 10113 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 10114 10115 setTimeout(function () { 10116 10117 $('.off-canvas-menu-container .menu > li').each(function (i) { 10118 $(this).delay(i * 50).transition({ 10119 y: 0, 10120 'opacity': 1 10121 }, 750, 'easeOutCubic').addClass('no-pointer-events'); 10122 }); 10123 10124 setTimeout(function () { 10125 $('.off-canvas-menu-container .menu > li').removeClass('no-pointer-events'); 10126 $('.off-canvas-menu-container .clip-wrap').css('transition-duration', '.45s'); 10127 }, 500); 10128 10129 $('#slide-out-widget-area.fullscreen-alt .widget').each(function (i) { 10130 $(this).delay(i * 100).transition({ 10131 y: 0, 10132 'opacity': 1 10133 }, 650, 'easeOutCubic'); 10134 }); 10135 10136 }, 200); 10137 10138 setTimeout(function () { 10139 $('#slide-out-widget-area .off-canvas-social-links').addClass('line-shown'); 10140 10141 $('#slide-out-widget-area .off-canvas-social-links li').css('opacity', '1').each(function (i) { 10142 $(this).delay(i * 50).transition({ 10143 'scale': 1 10144 }, 400, 'easeOutCubic'); 10145 }); 10146 $('#slide-out-widget-area .bottom-text').transition({ 10147 'opacity': 1 10148 }, 600, 'easeOutCubic'); 10149 }, 200); 10150 10151 } 10152 10153 // Fade In BG Overlay 10154 var $opacity = 0.4; 10155 10156 if ($offCanvasBG.hasClass('solid')) { 10157 $opacity = 1; 10158 } 10159 if ($offCanvasBG.hasClass('dark')) { 10160 $opacity = 0.97; 10161 } 10162 if ($offCanvasBG.hasClass('medium')) { 10163 $opacity = 0.6; 10164 } 10165 if ($offCanvasBG.hasClass('light')) { 10166 $opacity = 0.4; 10167 } 10168 $offCanvasBG.removeClass('no-transition'); 10169 10170 10171 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 10172 10173 $offCanvasBG.addClass('padding-removed').css({ 10174 'height': '100%', 10175 'width': '100%', 10176 'left': '0', 10177 'opacity': $opacity 10178 }); 10179 10180 // Overflow state 10181 OCM_overflowState(); 10182 10183 } 10184 10185 setTimeout(function () { 10186 $('.slide-out-widget-area-toggle > div > a').removeClass('animating'); 10187 }, 600); 10188 10189 10190 if ($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && 10191 $('.container-wrap').hasClass('no-scroll')) { 10192 $('#ajax-content-wrap').addClass('at-content'); 10193 } 10194 10195 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 10196 if ($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 || 10197 $('.mobile').length == 0 && $('#header-outer.transparent').length == 0) { 10198 $('#slide-out-widget-area'+$ocm_fullscreen_class+' .inner-wrap').css('padding-top', $headerOuterEl.height()); 10199 } 10200 } else { 10201 $('#slide-out-widget-area'+$ocm_fullscreen_class+' .inner-wrap').css('padding-top', $headerOuterEl.outerHeight()); 10202 } 10203 10204 } 10205 10206 10207 /** 10208 * Off canvas menu: fullscreen alt close. 10209 * 10210 * @since 10.5 10211 */ 10212 function OCM_fullscreenAltClose() { 10213 10214 var $ocm_fullscreen_class = ( $offCanvasEl.hasClass('fullscreen-alt') ) ? '.fullscreen-alt' : '.fullscreen-split'; 10215 10216 if ($('body.material').length > 0) { 10217 setTimeout(function () { 10218 $('header#top .slide-out-widget-area-toggle a').removeClass('menu-push-out'); 10219 }, 350); 10220 } 10221 10222 $('.slide-out-widget-area-toggle:not(.std-menu) .lines-button').removeClass('close'); 10223 10224 10225 $offCanvasBG.removeClass('open'); 10226 10227 if( $ocm_fullscreen_class === '.fullscreen-split' ) { 10228 setTimeout(function () { 10229 $offCanvasBG.addClass('hidden'); 10230 $('#slide-out-widget-area'+$ocm_fullscreen_class).addClass('hidden'); 10231 },600); 10232 } 10233 10234 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 10235 10236 $('.blurred-wrap').removeClass('blurred'); 10237 10238 $('#slide-out-widget-area.fullscreen-alt .widget').transition({ 10239 'opacity': 0 10240 }, 500, 'easeOutQuad', function () { 10241 $(this).transition({ 10242 y: '40px' 10243 }, 0); 10244 }); 10245 $('#slide-out-widget-area .bottom-text, #slide-out-widget-area .off-canvas-social-links li').transition({ 10246 'opacity': 0 10247 }, 250, 'easeOutQuad'); 10248 $('#slide-out-widget-area .off-canvas-social-links').removeClass('line-shown'); 10249 10250 $('.off-canvas-menu-container .menu').transition({ 10251 y: '-13px', 10252 'opacity': 0 10253 }, 400); 10254 10255 } 10256 10257 10258 setTimeout(function () { 10259 10260 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 10261 10262 $('.off-canvas-menu-container .menu > li').stop(true, true).transition({ 10263 y: '40px', 10264 'opacity': 0 10265 }, 0); 10266 $('#slide-out-widget-area .off-canvas-social-links li').transition({ 10267 'scale': 0 10268 }, 0); 10269 $('#slide-out-widget-area .off-canvas-social-links').removeClass('line-shown'); 10270 10271 // Close submenu items 10272 $('#slide-out-widget-area .menuwrapper .menu').removeClass('subview'); 10273 $('#slide-out-widget-area .menuwrapper .menu li').removeClass('subview subviewopen'); 10274 $('#slide-out-widget-area.fullscreen-alt .inner .off-canvas-menu-container').css('height', 'auto'); 10275 10276 $offCanvasBG.css({ 10277 'height': '1px', 10278 'width': '1px', 10279 'left': '-100%' 10280 }); 10281 10282 } 10283 10284 if ($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && $('.container-wrap').hasClass('no-scroll')) { 10285 $('#ajax-content-wrap').removeClass('at-content'); 10286 } 10287 10288 if ($('.mobile #header-outer[data-permanent-transparent="false"]').length == 0) { 10289 $('#slide-out-widget-area'+$ocm_fullscreen_class+' .inner-wrap').css('padding-top', '0'); 10290 } 10291 10292 $('.slide-out-widget-area-toggle a').removeClass('animating'); 10293 10294 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 10295 $('#slide-out-widget-area'+$ocm_fullscreen_class).hide().removeClass('open'); 10296 } 10297 10298 }, 550); 10299 10300 if( $ocm_fullscreen_class === '.fullscreen-split' ) { 10301 $('#slide-out-widget-area'+$ocm_fullscreen_class).removeClass('open'); 10302 } 10303 10304 setTimeout(function () { 10305 if ($('.nectar-social.fixed').length == 0) { 10306 showToTop(); 10307 } 10308 }, 600); 10309 10310 // Fade out overlay 10311 setTimeout(function () { 10312 $offCanvasBG.removeClass('padding-removed'); 10313 }, 50); 10314 10315 10316 var borderDelay = ($bodyBorderHeaderColorMatch == true) ? 150 : 50; 10317 10318 setTimeout(function () { 10319 10320 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 10321 $offCanvasBG.stop(true).css({ 10322 'opacity': 0 10323 }); 10324 } 10325 if ($('#header-outer[data-transparent-header="true"]').length > 0) { 10326 $('body > div[class*="body-border"]').css('z-index', '10000'); 10327 } 10328 }, borderDelay); 10329 10330 setTimeout(function () { 10331 $('#header-outer.transparent.small-nav, #header-outer.transparent.detached, #header-outer:not([data-permanent-transparent="1"]).transparent.scrolled-down').removeClass('transparent'); 10332 10333 if ($headerOuterEl.hasClass('pseudo-data-transparent')) { 10334 10335 $headerOuterEl.attr('data-transparent-header', 'false') 10336 .removeClass('pseudo-data-transparent') 10337 .removeClass('transparent'); 10338 } 10339 10340 }, 100); 10341 10342 } 10343 10344 10345 /** 10346 * Off canvas menu: simple dropdown open. 10347 * 10348 * @since 10.5 10349 */ 10350 function OCM_simpleDropdownOpen() { 10351 10352 $('#mobile-menu').show(); 10353 10354 $('header#top .slide-out-widget-area-toggle:not(.std-menu) .lines-button').addClass('close'); 10355 10356 if ($('body.material').length > 0) { 10357 $('header#top .slide-out-widget-area-toggle a').addClass('menu-push-out'); 10358 } 10359 10360 setTimeout(function () { 10361 $('.slide-out-widget-area-toggle > div > a').removeClass('animating'); 10362 }, 100); 10363 10364 } 10365 10366 /** 10367 * Off canvas menu: simple dropdown close. 10368 * 10369 * @since 10.5 10370 */ 10371 function OCM_simpleDropdownClose() { 10372 $('#mobile-menu').hide(); 10373 10374 $('.slide-out-widget-area-toggle:not(.std-menu) .lines-button').removeClass('close'); 10375 10376 setTimeout(function () { 10377 if ($('body.material').length > 0) { 10378 $('header#top .slide-out-widget-area-toggle a').removeClass('menu-push-out'); 10379 } 10380 $('.slide-out-w
10380idget-area-toggle a').removeClass('animating'); 10381 }, 350); 10382 } 10383 10384 10385 /** 10386 * Off canvas menu: simple dropdown click events. 10387 * 10388 * @since 10.5 10389 */ 10390 function OCM_simpleStyleInit() { 10391 10392 if( $('#header-outer #mobile-menu').length == 0 ) { 10393 return; 10394 } 10395 10396 $('#header-outer #mobile-menu li.megamenu').removeClass('megamenu'); 10397 10398 // Add icons/markup. 10399 $('#header-outer #mobile-menu ul li').each(function(){ 10400 $(this).find('a').wrapInner('<span></span>'); 10401 if($(this).find('> ul').length > 0) { 10402 $(this).find('> a').append('<span class="sf-sub-indicator"><i class="fa fa-angle-down"></i></span>'); 10403 } 10404 }); 10405 10406 // Click event. 10407 $('#header-outer #mobile-menu .sf-sub-indicator').on('click', function(){ 10408 10409 var $parentLI = $(this).parent().parent(); 10410 10411 $parentLI.toggleClass('current-open-item'); 10412 10413 // Open. 10414 if( $parentLI.hasClass('current-open-item') ) { 10415 $parentLI.find('> ul').show(); 10416 setTimeout(function(){ 10417 $parentLI.addClass('visible'); 10418 },30); 10419 } else { 10420 // Close. 10421 $parentLI.find('ul').hide(); 10422 // Ensure open children also close. 10423 $parentLI.find('li').removeClass('visible').removeClass('current-open-item'); 10424 $parentLI.removeClass('visible'); 10425 } 10426 10427 return false; 10428 10429 }); 10430 10431 // Resize event. 10432 $window.on('smartresize', function(){ 10433 10434 if( nectarDOMInfo.winW > 1000 && $('.slide-out-widget-area-toggle.mobile-icon a.open').length > 0 ) { 10435 10436 $('.slide-out-widget-area-toggle.mobile-icon a') 10437 .addClass('non-human-allowed') 10438 .trigger('click'); 10439 10440 setTimeout(function () { 10441 $('.slide-out-widget-area-toggle.mobile-icon a').removeClass('non-human-allowed'); 10442 }, 100); 10443 10444 } 10445 10446 }); 10447 10448 } 10449 10450 10451 /** 10452 * Off canvas menu click triggered styles initialization 10453 * 10454 * @since 10.5 10455 */ 10456 function OCM_clickTriggeredStylesInit() { 10457 10458 // Click triggered open bind. 10459 $body.on('click', '.slide-out-widget-area-toggle:not(.std-menu) a.closed:not(.animating), .nectar-ocm-trigger-open', function () { 10460 10461 if (nectarBoxRoll.animating == 'true' || $('.slide-out-from-right-hover').length > 0) { 10462 return false; 10463 } 10464 10465 $headerOuterEl.removeClass('no-transition'); 10466 10467 // Slide out from right. 10468 if ($offCanvasEl.hasClass('slide-out-from-right')) { 10469 OCM_slideOutRightOpen(); 10470 } 10471 // Fullscreen. 10472 else if ($offCanvasEl.hasClass('fullscreen')) { 10473 OCM_fullscreenOpen(); 10474 } 10475 // Fullscreen Alt. 10476 else if ($offCanvasEl.hasClass('fullscreen-alt') || $offCanvasEl.hasClass('fullscreen-split')) { 10477 OCM_fullscreenAltOpen(); 10478 } 10479 // Simple dropdown. 10480 else if( $('#header-outer #mobile-menu').length > 0 ) { 10481 OCM_simpleDropdownOpen(); 10482 } 10483 10484 10485 // Add open class 10486 if( $('#header-outer #mobile-menu').length == 0 ) { 10487 10488 $headerOuterEl 10489 .removeClass('side-widget-closed') 10490 .addClass('side-widget-open'); 10491 10492 10493 // Give header transparent state 10494 if ($('#header-outer[data-transparency-option="1"]').length > 0 && 10495 $('#boxed').length == 0 && 10496 $('#header-outer[data-full-width="true"]').length > 0 && 10497 !nectarDOMInfo.usingFrontEndEditor) { 10498 10499 if ($('body.material[data-slide-out-widget-area-style="slide-out-from-right"]').length == 0 && 10500 $('body.material #header-outer[data-condense="true"]').length == 0) { 10501 10502 $headerOuterEl.addClass('transparent'); 10503 10504 } 10505 10506 } 10507 10508 // Dark slide transparent nav 10509 if ($('#header-outer.dark-slide.transparent').length > 0 && 10510 $('#boxed').length == 0 && 10511 $('body.material-ocm-open').length == 0) { 10512 $headerOuterEl 10513 .removeClass('dark-slide') 10514 .addClass('temp-removed-dark-slide'); 10515 } 10516 10517 } // Not using simple OCM. 10518 10519 10520 $('.slide-out-widget-area-toggle > div > a') 10521 .removeClass('closed') 10522 .addClass('open') 10523 .attr('aria-expanded','true'); 10524 10525 $('.slide-out-widget-area-toggle > div > a').addClass('animating'); 10526 10527 return false;
10528 10529 }); 10530 10531 10532 10533 // Close event bind. 10534 $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) { 10535 10536 if (e.originalEvent == undefined && 10537 $('.slide_out_area_close.non-human-allowed').length == 0 && 10538 $('.slide-out-widget-area-toggle.mobile-icon a.non-human-allowed').length == 0) { 10539 return; 10540 } 10541 10542 if ($('.slide-out-widget-area-toggle:not(.std-menu) a.animating').length > 0) { 10543 return; 10544 } 10545 10546 $headerOuterEl.removeClass('no-transition'); 10547 10548 $('.slide-out-widget-area-toggle:not(.std-menu) a') 10549 .removeClass('open') 10550 .addClass('closed') 10551 .attr('aria-expanded','false'); 10552 10553 $('.slide-out-widget-area-toggle:not(.std-menu) a') 10554 .addClass('animating'); 10555 10556 // Slide out from right. 10557 if ($offCanvasEl.hasClass('slide-out-from-right')) { 10558 OCM_slideOutRightClose(); 10559 } 10560 10561 // Fullscreen. 10562 else if ($offCanvasEl.hasClass('fullscreen')) { 10563 OCM_fullscreenClose(); 10564 } 10565 // Fullscreen alt. 10566 else if ($offCanvasEl.hasClass('fullscreen-alt') || $offCanvasEl.hasClass('fullscreen-split')) { 10567 OCM_fullscreenAltClose(); 10568 } 10569 // Simple dropdown. 10570 else if( $('#header-outer #mobile-menu').length > 0 ) { 10571 OCM_simpleDropdownClose(); 10572 } 10573 10574 if( $('#header-outer #mobile-menu').length == 0 ) { 10575 10576 // Dark slide transparent nav 10577 if ($('#header-outer.temp-removed-dark-slide.transparent').length > 0 && $('#boxed').length == 0) { 10578 $headerOuterEl 10579 .removeClass('temp-removed-dark-slide') 10580 .addClass('dark-slide'); 10581 } 10582 10583 // Remove header transparent state 10584 if ($('#header-outer[data-permanent-transparent="1"]').length == 0 && $('#slide-out-widget-area.fullscreen-alt').length == 0) { 10585 10586 if ($('.nectar-box-roll').length == 0) { 10587 if ($('#header-outer.small-nav').length > 0 || 10588 $('#header-outer.scrolled-down').length > 0) { 10589 $headerOuterEl.removeClass('transparent'); 10590 } 10591 } 10592 else { 10593 if ($('#header-outer.small-nav').length > 0 || 10594 $('#header-outer.scrolled-down').length > 0 || 10595 $('.container-wrap.auto-height').length > 0) { 10596 $headerOuterEl.removeClass('transparent'); 10597 } 10598 } 10599 10600 } 10601 10602 // Remove hidden menu 10603 $headerOuterEl.removeClass('hidden-menu'); 10604 10605 $headerOuterEl 10606 .removeClass('side-widget-open') 10607 .addClass('side-widget-closed'); 10608 10609 } // Not using simple OCM. 10610 10611 return false; 10612 10613 }); 10614 10615 } 10616 10617 10618 /** 10619 * Off canvas menu main initialization. 10620 * 10621 * @since 10.5 10622 */ 10623 function OCM_init() { 10624 10625 if ($('#slide-out-widget-area.slide-out-from-right-hover').length > 0) { 10626 OCM_slideOutRightHoverInit(); 10627 } else { 10628 OCM_clickTriggeredStylesInit(); 10629 OCM_simpleStyleInit(); 10630 } 10631 10632 10633 if ($('#slide-out-widget-area.fullscreen-split').length == 0 && 10634 $('body.material[data-slide-out-widget-area-style*="slide-out-from-right"]').length == 0 && 10635 $('#slide-out-widget-area[data-dropdown-func="separate-dropdown-parent-link"]').length == 0) { 10636 10637 fullscreenMenuInit(); 10638 10639 } else if ($('body.using-mobile-browser[data-slide-out-widget-area-style="slide-out-from-right-hover"]').length > 0) { 10640 10641 // Close OCM on mobile when clicking anchor on same page 10642 $('body #slide-out-widget-area .inner .off-canvas-menu-container li a[href]').on('click', function () { 10643 10644 if ($(this).attr('href') != '#') { 10645 OCM_close($(this).parent()); 10646 } 10647 10648 }); 10649 10650 } 10651 10652 // Page fullscreen row close OCM fullscreen 10653 if ($('#nectar_fullscreen_rows').length > 0 && $('body[data-slide-out-widget-area-style*="fullscreen"]').length > 0) { 10654 10655 $('body #slide-out-widget-area .inner .off-canvas-menu-container li a[href]').on('click', function () { 10656 var $link_href = ($(this).is('[href*="#"]')) ? $(this).attr('href') : ''; 10657 if ($link_href != '#' && $('div[data-fullscreen-anchor-id="' + $link_href.substr($link_href.indexOf("#") + 1) + '"]').length > 0) { 10658 10659 setTimeout(function () { 10660 10661 $('#slide-out-widget-area .slide_out_area_close') 10662 .addClass('non-human-allowed') 10663 .trigger('click'); 10664 10665 }, 100); 10666 10667 setTimeout(function () { 10668 $('#slide-out-widget-area .slide_out_area_close').removeClass('non-human-allowed'); 10669 }, 150); 10670 10671 } 10672 10673 }); 10674 } 10675 10676 10677 // Submenu link hover fix 10678 $body.on('mouseover', '#slide-out-widget-area .off-canvas-menu-container .menuwrapper > .sub-menu li > a', function () { 10679 var $currentTxt = $(this).text(); 10680 $('.off-canvas-menu-container .menuwrapper .menu li > a').removeClass('hovered'); 10681 $('.off-canvas-menu-container .menuwrapper .menu li > a:contains(' + $currentTxt + ')').addClass('hovered'); 10682 }); 10683 10684 $body.on('mouseover', '.off-canvas-menu-container .menuwrapper .menu li > a', function () { 10685 $('.off-canvas-menu-container .menuwrapper .menu li > a').removeClass('hovered'); 10686 }); 10687 10688 10689 // Bind mousewheel. 10690 setTimeout(OCM_scrolling, 500); 10691 10692 // Handle mobile scrolling. 10693 if (nectarDOMInfo.usingMobileBrowser) { 10694 $offCanvasEl.addClass('mobile'); 10695 } 10696 10697 10698 } 10699 10700 10701 10702 10703 /** 10704 * Off canvas menu scrolling. 10705 * 10706 * @since 10.5 10707 */ 10708 function OCM_scrolling() { 10709 10710 $offCanvasEl.mousewheel(function (event, delta) { 10711 10712 this.scrollTop -= (delta * 30); 10713 10714 event.preventDefault(); 10715 }); 10716 10717 } 10718 10719 10720 10721 /** 10722 * Off canvas menu close. 10723 * 10724 * @since 10.5 10725 */ 10726 function OCM_close(item) { 10727 10728 if ($('#slide-out-widget-area.open').length > 0) { 10729 10730 var $windowCurrentLocation = window.location.href.split("#")[0]; 10731 var $windowClickedLocation = item.find('> a').attr('href').split("#")[0]; 10732 10733 if ($windowCurrentLocation == $windowClickedLocation || item.find('a[href^="#"]').length > 0) { 10734 if (item.parents('.slide-out-from-right-hover').length > 0) { 10735 $('.slide-out-widget-area-toggle.slide-out-hover-icon-effect a').trigger('click'); 10736 } else { 10737 $('.slide-out-widget-area-toggle a').trigger('click'); 10738 } 10739 10740 } 10741 } 10742 10743 } 10744 10745 10746 10747 10748 /** 10749 * Click based submenus. 10750 * 10751 * Used by left header layout and off canvas menu. 10752 * 10753 * @since 10.5 10754 */ 10755 function clickToggleSubmenus() { 10756 10757 if (!$('#header-outer[data-format="left-header"]').length > 0 &&
10758 !$('body.material[data-slide-out-widget-area-style*="slide-out-from-right"]').length > 0 && 10759 !$('#slide-out-widget-area.fullscreen-split').length > 0 && 10760 !$('#slide-out-widget-area[data-dropdown-func="separate-dropdown-parent-link"]').length > 0) { 10761 return; 10762 } 10763 10764 // Remove megamenu class. 10765 $('#header-outer[data-format="left-header"] nav li.megamenu').removeClass('megamenu'); 10766 10767 var $ocm_link_selector; 10768 10769 if ($('#slide-out-widget-area[data-dropdown-func="separate-dropdown-parent-link"]').length > 0) { 10770 $ocm_link_selector = '#slide-out-widget-area .off-canvas-menu-container li.menu-item-has-children > .ocm-dropdown-arrow'; 10771 } else { 10772 $ocm_link_selector = 'body.material #slide-out-widget-area[class*="slide-out-from-right"] .off-canvas-menu-container li.menu-item-has-children > a, #slide-out-widget-area.fullscreen-split .off-canvas-menu-container li.menu-item-has-children > a'; 10773 } 10774 10775 // Click event. 10776 $('#header-outer[data-format="left-header"] nav li.menu-item-has-children > a, ' + $ocm_link_selector).on('click', function () { 10777 10778 if ($(this).parent().hasClass('open-submenu')) { 10779 $(this).parent().find('.sub-menu').css({ 10780 'max-height': '0' 10781 }); 10782 $(this).parent().removeClass('open-submenu'); 10783 } else { 10784 10785 // Get max height. 10786 var $that = $(this); 10787 var $maxSubMenuHeight; 10788 10789 $that.parent() 10790 .find('> .sub-menu') 10791 .addClass('no-trans'); 10792 10793 setTimeout(function () { 10794 10795 $that.parent().find('> .sub-menu').css({ 10796 'max-height': 'none', 10797 'position': 'absolute', 10798 'visibility': 'hidden' 10799 }); 10800 10801 $maxSubMenuHeight = $that.parent().find('> .sub-menu').height(); 10802 10803 $that.parent() 10804 .find('> .sub-menu') 10805 .removeClass('no-trans'); 10806 10807 $that.parent().find('> .sub-menu').css({ 10808 'max-height': '0', 10809 'position': 'relative', 10810 'visibility': 'visible' 10811 }); 10812 10813 }, 25); 10814 10815 setTimeout(function () { 10816 10817 // Reset Max Height. 10818 $that.closest('ul') 10819 .find('li.menu-item-has-children') 10820 .removeClass('open-submenu'); 10821 10822 $that.closest('ul').find('li.menu-item-has-children > .sub-menu').css({ 10823 'max-height': '0' 10824 }); 10825 10826 $that.parent().addClass('open-submenu'); 10827 10828 $that.parent() 10829 .find('> .sub-menu') 10830 .css('max-height', $maxSubMenuHeight); 10831 10832 // Add height to open parents. 10833 if ($that.parents('ul').length > 0) { 10834 10835 $that.parents('ul:not(.sf-menu)').each(function () { 10836 $(this).css('max-height'); 10837 $(this).css('max-height', parseInt($(this).height() + parseInt($(this).css('padding-top')) * 2 + $maxSubMenuHeight) + 'px'); 10838 }); 10839 } 10840 10841 10842 }, 50); 10843 } 10844 10845 return false; 10846 10847 }); 10848 10849 // Start open for current page items. 10850 if($('#header-outer[data-format="left-header"] nav .sf-menu > .current-menu-ancestor.menu-item-has-children > ul > li.current-menu-item').length > 0) { 10851 $('#header-outer[data-format="left-header"] nav .sf-menu > .current-menu-ancestor.menu-item-has-children > a').trigger('click'); 10852 } 10853 10854 10855 } 10856 10857 10858 10859 10860 10861 10862 10863 10864 /** 10865 * DLMenu - plugin used for submenus in off canvas menu. 10866 * 10867 * @since 6.0 10868 */ 10869 $.DLMenu = function (options, element) { 10870 this.$el = $(element); 10871 this._init(options); 10872 }; 10873 10874 // the options 10875 $.DLMenu.defaults = { 10876 // classes for the animation effects 10877 animationClasses: { 10878 classin: 'dl-animate-in-1', 10879 classout: 'dl-animate-out-1' 10880 }, 10881 onLevelClick: function () { 10882 return false; 10883 }, 10884 onLinkClick: function () { 10885 return false; 10886 } 10887 }; 10888 10889 $.DLMenu.prototype = { 10890 _init: function (options) { 10891 10892 // options 10893 this.options = $.extend(true, {}, $.DLMenu.defaults, options); 10894 this._config(); 10895 10896 var animEndEventNames = { 10897 'WebkitAnimation': 'webkitAnimationEnd', 10898 'OAnimation': 'oAnimationEnd', 10899 'msAnimation': 'MSAnimationEnd', 10900 'animation': 'animationend' 10901 }, 10902 transEndEventNames = { 10903 'WebkitTransition': 'webkitTransitionEnd', 10904 'MozTransition': 'transitionend', 10905 'OTransition': 'oTransitionEnd', 10906 'msTransition': 'MSTransitionEnd', 10907 'transition': 'transitionend' 10908 }; 10909 // animation end event name 10910 this.animEndEventName = animEndEventNames['animation'] + '.menu'; 10911 // transition end event name 10912 this.transEndEventName = transEndEventNames['transition'] + '.menu', 10913 // support for css animations and css transitions 10914 this.supportAnimations = true, 10915 this.supportTransitions = true; 10916 this._initEvents(); 10917 10918 }, 10919 _config: function () { 10920 this.open = false;
10921 this.$trigger = this.$el.children('.trigger'); 10922 this.$menu = this.$el.children('ul.menu'); 10923 this.$menuitems = this.$menu.find('li:not(.back) > a'); 10924 10925 this.$el.find('ul.sub-menu') 10926 .prepend('<li class="back"><a href="#"> ' + $offCanvasEl.attr('data-back-txt') + ' </a></li>'); 10927 10928 this.$back = this.$menu.find('li.back'); 10929 }, 10930 _initEvents: function () { 10931 10932 var self = this; 10933 10934 this.$trigger.on('click.menu', function () { 10935 10936 if (self.open) { 10937 self._closeMenu(); 10938 } else { 10939 self._openMenu(); 10940 } 10941 return false; 10942 10943 }); 10944 10945 this.$menuitems.on('click.menu', function (event) { 10946 10947 10948 var $item = $(this).parent('li'), 10949 $submenu = $item.children('ul.sub-menu'); 10950 10951 $('.fullscreen-alt .off-canvas-menu-container .clip-wrap, .fullscreen-alt .off-canvas-menu-container .clip-wrap span').css('transition-duration', '0s'); 10952 10953 if ($submenu.length > 0) { 10954 10955 var $flyin = $submenu.clone().css('opacity', 0).insertAfter(self.$menu), 10956 onAnimationEndFn = function () { 10957 self.$menu.off(self.animEndEventName).removeClass(self.options.animationClasses.classout).addClass('subview'); 10958 $item.addClass('subviewopen').parents('.subviewopen:first').removeClass('subviewopen').addClass('subview'); 10959 $flyin.remove(); 10960 setTimeout(function () { 10961 $('.off-canvas-menu-container .menu > li').removeClass('no-pointer-events'); 10962 $('.off-canvas-menu-container .clip-wrap, .off-canvas-menu-container .clip-wrap span').css('transition-duration', '.45s'); 10963 }, 300); 10964 10965 }; 10966 10967 setTimeout(function () { 10968 $flyin.addClass(self.options.animationClasses.classin); 10969 self.$menu.addClass(self.options.animationClasses.classout); 10970 if (self.supportAnimations) { 10971 self.$menu.on(self.animEndEventName, onAnimationEndFn); 10972 } else { 10973 onAnimationEndFn.call(); 10974 } 10975 10976 self.options.onLevelClick($item, $item.children('a:first').text()); 10977 }); 10978 10979 10980 $item.parents('.off-canvas-menu-container').css('height', $item.parents('.off-canvas-menu-container').find('.menuwrapper .menu').height()).transition({ 10981 'height': $flyin.height() 10982 }, 500, 'easeInOutQuad'); 10983 10984 10985 return false; 10986 10987 } else { 10988 10989 self.options.onLinkClick($item.find('> a'), event); 10990 } 10991 10992 OCM_close($item); 10993 10994 }); 10995 10996 10997 10998 this.$back.on('click.menu', function () { 10999 11000 var $this = $(this), 11001 $submenu = $this.parents('ul.sub-menu:first'), 11002 $item = $submenu.parent(), 11003 $flyin = $submenu.clone().insertAfter(self.$menu); 11004 11005 var onAnimationEndFn = function () { 11006 self.$menu.off(self.animEndEventName).removeClass(self.options.animationClasses.classin); 11007 $flyin.remove(); 11008 }; 11009 11010 setTimeout(function () { 11011 $flyin.addClass(self.options.animationClasses.classout); 11012 self.$menu.addClass(self.options.animationClasses.classin); 11013 if (self.supportAnimations) { 11014 self.$menu.on(self.animEndEventName, onAnimationEndFn); 11015 } else { 11016 onAnimationEndFn.call(); 11017 } 11018 11019 $item.removeClass('subviewopen'); 11020 11021 var $subview = $this.parents('.subview:first'); 11022 if ($subview.is('li')) { 11023 $subview.addClass('subviewopen'); 11024 } 11025 $subview.removeClass('subview'); 11026 }); 11027 11028 11029 $item.parents('.off-canvas-menu-container').css('height', $item.parents('.off-canvas-menu-container').find('.menuwrapper .menu').height()); 11030 11031 setTimeout(function () { 11032 $item.parents('.off-canvas-menu-container').transition({ 11033 'height': $item.parent().height() 11034 }, 500, 'easeInOutQuad'); 11035 }, 50); 11036 11037 11038 return false; 11039 11040 }); 11041 11042 }, 11043 closeMenu: function () { 11044 if (this.open) { 11045 this._closeMenu(); 11046 } 11047 }, 11048 _closeMenu: function () { 11049 var self = this, 11050 onTransitionEndFn = function () { 11051 self.$menu.off(self.transEndEventName); 11052 self._resetMenu(); 11053 }; 11054 11055 this.$menu.removeClass('menuopen'); 11056 this.$menu.addClass('menu-toggle'); 11057 this.$trigger.removeClass('active'); 11058 11059 if (this.supportTransitions) { 11060 this.$menu.on(this.transEndEventName, onTransitionEndFn); 11061 } else { 11062 onTransitionEndFn.call(); 11063 } 11064 11065 this.open = false;
11066 }, 11067 openMenu: function () { 11068 if (!this.open) { 11069 this._openMenu(); 11070 } 11071 }, 11072 _openMenu: function () { 11073 var self = this; 11074 $body.off('click').on('click.menu', function () { 11075 self._closeMenu(); 11076 }); 11077 this.$menu.addClass('menuopen menu-toggle').on(this.transEndEventName, function () { 11078 $(this).removeClass('menu-toggle'); 11079 }); 11080 this.$trigger.addClass('active'); 11081 this.open = true; 11082 }, 11083 _resetMenu: function () { 11084 this.$menu.removeClass('subview'); 11085 this.$menuitems.removeClass('subview subviewopen'); 11086 } 11087 }; 11088 11089 var logError = function (message) { 11090 if (window.console) { 11091 window.console.error(message); 11092 } 11093 }; 11094 11095 $.fn.dlmenu = function (options) { 11096 if (typeof options === 'string') { 11097 var args = Array.prototype.slice.call(arguments, 1); 11098 this.each(function () { 11099 var instance = $.data(this, 'menu'); 11100 if (!instance) { 11101 logError("cannot call methods on menu prior to initialization; " + 11102 "attempted to call method '" + options + "'"); 11103 return; 11104 } 11105 if (!$.isFunction(instance[options]) || options.charAt(0) === "_") { 11106 logError("no such method '" + options + "' for menu instance"); 11107 return; 11108 } 11109 instance[options].apply(instance, args); 11110 }); 11111 } else { 11112 this.each(function () { 11113 var instance = $.data(this, 'menu'); 11114 if (instance) { 11115 instance._init(); 11116 } else { 11117 instance = $.data(this, 'menu', new $.DLMenu(options, this)); 11118 } 11119 }); 11120 } 11121 return this; 11122 }; 11123 11124 11125 /** 11126 * Initialize DL menu. 11127 * 11128 * @since 6.0 11129 */ 11130 function fullscreenMenuInit() { 11131 11132 $('#slide-out-widget-area .off-canvas-menu-container .menu').wrap('<div class="menu-wrap menuwrapper" />'); 11133 $('#slide-out-widget-area .off-canvas-menu-container .menu').addClass('menuopen'); 11134 11135 var $ocmAnimationClassNum = ($('#slide-out-widget-area.fullscreen-alt').length > 0) ? '4' : '5'; 11136 $('#slide-out-widget-area .off-canvas-menu-container .menu-wrap').dlmenu({ 11137 animationClasses: { 11138 classin: 'dl-animate-in-' + $ocmAnimationClassNum, 11139 classout: 'dl-animate-out-' + $ocmAnimationClassNum 11140 } 11141 }); 11142 11143 } 11144 11145 11146 11147 11148 11149 11150 11151 11152 11153 /** 11154 * Set the page header height when using "slide down" theme option effect. 11155 * 11156 * @since 2.0 11157 */ 11158 function pageHeaderSlideInHeight() { 11159 11160 var pageHeaderHeight = parseInt($pageHeaderBG.height()); 11161 $('body[data-aie="slide-down"] #page-header-wrap:not(.fullscreen-header):not([data-responsive="true"])').css('height', pageHeaderHeight + 'px'); 11162 11163 } 11164 11165 11166 /** 11167 * Fired after page header image has loaded. 11168 * 11169 * @since 2.0 11170 */ 11171 function pageHeaderAfterLoad() { 11172 11173 11174 // Transparent 11175 if ($('#header-outer[data-transparent-header="true"]').length > 0) { 11176 $('#page-header-bg[data-parallax="1"]').css({ 11177 'top': nectarDOMInfo.adminBarHeight 11178 }); 11179 } else { 11180 11181 if ($('body[data-header-resize="0"]').length == 0 && $('body.material').length == 0) { 11182 $('#page-header-bg[data-parallax="1"]').css({ 11183 'top': ($('#page-header-wrap').offset().top) + 'px' 11184 }); 11185 } 11186 } 11187 11188 //fade in header 11189 if ($('#ajax-content-wrap').length == 0 || !$body.hasClass('ajax-loaded')) { 11190 $('#page-header-bg[data-parallax="1"]').animate({ 11191 'opacity': 1 11192 }, 350, 'easeInCubic'); 11193 } else if ($('#ajax-content-wrap').length == 1) { 11194 $('#page-header-bg[data-parallax="1"]').css({ 11195 'opacity': 1 11196 }); 11197 } 11198 11199 $('#page-header-bg[data-parallax="1"] .nectar-particles').append('<div class="fade-out" />'); 11200 11201 } 11202 11203 11204 11205 /** 11206 * Page header unload event. 11207 * 11208 * @since 2.0 11209 */ 11210 function pageHeaderUnload() { 11211 11212 if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1 || navigator.userAgent.match(/(iPod|iPhone|iPad)/)) { 11213 window.onunload = function () { 11214 11215 pageHeaderInit(); 11216
11217 $('#page-header-bg[data-parallax="1"] .span_6').css({ 11218 'opacity': 1 11219 }); 11220 11221 }; 11222 } 11223 11224 } 11225 11226 11227 /** 11228 * Page header initialization. 11229 * 11230 * @since 2.0 11231 */ 11232 function pageHeaderInit() { 11233 11234 var $headerRemoveStickyness = ($('body[data-hhun="1"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length > 0) ? 1 : 0; 11235 11236 if ($('#page-header-bg[data-parallax="1"]').length > 0) { 11237 11238 // Fade in 11239 var img = new Image(), 11240 pageHeaderHeight = parseInt($pageHeaderBG.height()), 11241 $initialImgCheck = extractUrl($('#page-header-bg[data-parallax="1"]').css('background-image')); 11242 11243 if ($initialImgCheck && $initialImgCheck.indexOf('.') !== -1) { 11244 img.onload = function () { 11245 pageHeaderAfterLoad(); 11246 }; 11247 11248 img.src = extractUrl($('#page-header-bg[data-parallax="1"]').css('background-image')); 11249 11250 } else { 11251 pageHeaderAfterLoad(); 11252 } 11253 11254 11255 if ($('body[data-hhun="1"]').length > 0 && !$('#header-outer[data-remove-fixed="1"]').length > 0) { 11256 $headerOuterEl.addClass('parallax-contained'); 11257 } 11258 11259 // Calculate on scroll. 11260 window.addEventListener('scroll', function () { 11261 if( nectarDOMInfo.winW > 1000 ) { 11262 window.requestAnimationFrame(parallaxPageHeaderCalc); 11263 } 11264 }, false); 11265 11266 } 11267 11268 var $pt_timeout = ($('body[data-ajax-transitions="true"]').length > 0 && $('#page-header-bg[data-animate-in-effect="slide-down"]').length > 0) ? 350 : 0; 11269 11270 if ($pageHeaderBG.length > 0) { 11271 11272 // Slide in height effect. 11273 setTimeout(function () { 11274 pageHeaderSlideInHeight(); 11275 }, $pt_timeout); 11276 11277 $('#page-header-bg[data-animate-in-effect="fade-in"]').addClass('loaded'); 11278 11279 // Using bg classname. 11280 var $initialImgCheckAscend = extractUrl($pageHeaderBG.css('background-image')); 11281 if ($initialImgCheckAscend && $initialImgCheckAscend.indexOf('.') !== -1) { 11282 $pageHeaderBG.addClass('has-bg'); 11283 } 11284 11285 // Resize slide in height. 11286 $window.on('smartresize',pageHeaderSlideInHeight); 11287 11288 } 11289 11290 function parallaxPageHeaderCalc() { 11291 11292 var $scrollTop = nectarDOMInfo.scrollTop, 11293 $multiplier1 = 0.4, 11294 $multiplier2 = 0.09; 11295 11296 if (!$body.hasClass('mobile') && 11297 navigator.userAgent.match(/iPad/i) == null && 11298 $('body.material-ocm-open').length == 0) { 11299 11300 if( headerLayoutFormat != 'left-header' ) { 11301 11302 if (nectarDOMInfo.winW > 1000) { 11303 $('#page-header-bg').css('top', $('#ajax-content-wrap').offset().top); 11304 } else { 11305 $('#page-header-bg').css('top', '0'); 11306 } 11307 } 11308 11309 // Calc bg pos. 11310 if ($('#page-header-bg.out-of-sight').length == 0) { 11311 11312 if ($headerRemoveStickyness) { 11313 $pageHeaderBG.css({ 11314 'transform': 'translateY(' + $scrollTop * -0.55 + 'px)' 11315 }); 11316 $('#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({ 11317 'transform': 'translateY(' + $scrollTop * -0.45 + 'px)' 11318 }); 11319 11320 } else { 11321 $pageHeaderBG.css({ 11322 'transform': 'translateY(' + $scrollTop * -$multiplier1 + 'px)' 11323 }); 11324 $('#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({ 11325 'transform': 'translateY(' + $scrollTop * -$multiplier2 + 'px)' 11326 }); 11327 $('#page-header-bg .span_6 .inner-wrap, #page-header-bg[data-post-hs="default_minimal"] .author-section').css({ 11328 'opacity': 1 - ($scrollTop / (pageHeaderHeight - 60)) 11329 }); 11330 } 11331 11332 11333 if ($('#page-header-bg .span_6 .inner-wrap').css('opacity') == 0) { 11334 $('#page-header-bg .span_6 .inner-wrap, #page-header-bg .portfolio-filters').hide(); 11335 } else { 11336 $('#page-header-bg .span_6 .inner-wrap, #page-header-bg .portfolio-filters').show(); 11337 } 11338 11339 11340 } 11341 11342 // Hide elements to allow other parallax sections to work in webkit browsers. 11343 if (($scrollTop / (pageHeaderHeight + $('#header-space').height() + nectarDOMInfo.adminBarHeight)) > 1) { 11344 $('#page-header-bg, .nectar-particles, #page-header-bg .fade-out').css('visibility', 'hidden').hide().addClass('out-of-sight'); 11345 } 11346 else { 11347 $('#page-header-bg, .nectar-particles, #page-header-bg .fade-out').css('visibility', 'visible').show().removeClass('out-of-sight'); 11348 11349 // Ensure header is centered. 11350 pageHeaderHeight = parseInt($pageHeaderBG.height()); 11351 $('#page-header-bg .container > .row').css('top', 0); 11352 11353 } 11354 11355 } 11356 11357 } 11358 11359 if ($pageHeaderBG.length > 0) { 11360 11361 // Bind unload event 11362 pageHeaderUnload(); 11363 11364 // Initialize text effects. 11365 if( $('.nectar-box-roll').length == 0 ) { 11366 pageHeaderTextEffectInit(); 11367 } 11368 11369 } 11370 11371 } 11372 11373 11374 11375 11376 11377 11378 11379 /** 11380 * Page header text effect markup creation. 11381 * 11382 * @since 6.0 11383 */ 11384 function pageHeaderTextEffectMarkup() { 11385 11386 $pageHeaderBG.each(function () { 11387 11388 if ($(this).attr('data-text-effect') == 'rotate_in') { 11389 11390 var $topHeading = 'none'; 11391 11392 if ($(this).find('.span_6 h1').length > 0) { 11393 $topHeading = 'h1'; 11394 } 11395 11396 if ($topHeading != 'none') { 11397 11398 var $selector = ($(this).find('.nectar-particles').length > 0) ? '.inner-wrap.shape-1' : '.span_6'; 11399 11400 $(this).find($selector).find($topHeading).addClass('top-heading').contents().filter(function () { 11401 return this.nodeType === 3 && typeof this.data != 'undefined' && this.data.replace(/\s+/, ""); 11402 }).wrap('<span class="wraped"></span>'); 11403 11404 $(this).find($selector).find('.wraped').each(function () { 11405 11406 var textNode = $(this), 11407 text = textNode.text().split(' '), 11408 replace = ''; 11409 11410 $.each(text, function (index, value) { 11411 if (value.replace(/\s+/, "")) { 11412 replace += '<span class="wraped"><span>' + value + '</span></span> '; 11413 } 11414 }); 11415 11416 textNode.replaceWith($(replace)); 11417 11418 }); 11419 11420 } 11421 11422 } 11423 11424 }); 11425 11426 } 11427 11428 11429 /** 11430 * Page header text effect animation. 11431 * 11432 * @since 6.0 11433 */ 11434 function pageHeaderTextEffect() { 11435 11436 if ($('#page-header-bg .nectar-particles').length == 0 && $('#page-header-bg[data-text-effect="none"]').length == 0 || 11437 $('.nectar-box-roll').length > 0 && $('#page-header-bg .nectar-particles').length == 0) { 11438 11439 var $selector = ($('.nectar-box-roll').length == 0) ? '#page-header-bg .span_6' : '.nectar-box-roll .overlaid-content .span_6'; 11440 11441 $($selector).find('.wraped').each(function (i) { 11442 $(this).find('span').delay(i * 370).transition({ 11443 rotateX: '0', 11444 'opacity': 1, 11445 y: 0 11446 }, 400, 'easeOutQuad'); 11447 }); 11448 11449 setTimeout(function () { 11450 11451 $($selector).find('.inner-wrap > *:not(.top-heading)').each(function (i) { 11452 $(this).delay(i * 370).transition({ 11453 rotateX: '0', 11454 'opacity': 1, 11455 y: 0 11456 }, 650, 'easeOutQuad'); 11457 }); 11458 11459 $('.scroll-down-wrap, .scroll-down-wrap .section-down-arrow').removeClass('hidden'); 11460 11461 }, $($selector).find('.wraped').length * 370); 11462 } 11463 11464 } 11465 11466 11467 /** 11468 * Page header text effect initialization. 11469 * 11470 * @since 6.0 11471 */ 11472 function pageHeaderTextEffectInit() { 11473 11474 pageHeaderTextEffectMarkup(); 11475 11476 var $effectTimeout = ($loadingScreenEl.length > 0) ? 800 : 0; 11477 11478 if ($('#page-header-bg .nectar-video-wrap video').length == 0) { 11479 setTimeout(pageHeaderTextEffect, $effectTimeout); 11480 } 11481 11482 } 11483 11484 11485 11486 11487 11488 11489 11490 /** 11491 * Permanent transparent header effect. 11492 * 11493 * @since 6.0 11494 */ 11495 function midnightInit() { 11496 11497 if ($('#header-outer[data-permanent-transparent="1"]').length > 0 && 11498 $('body[data-bg-header="true"]').length > 0) { 11499 11500 11501 // Pages that set no midnight coloring. 11502 if ($('.container-wrap div[data-midnight]').length == 0) { 11503 $('.container-wrap').attr('data-midnight', 'dark'); 11504 } 11505 11506 //// Cache midnight compat divs. 11507 var $midnightCompatArr = []; 11508 $('div[data-midnight]').each(function () { 11509 11510 if ($(this).attr('data-midnight') == 'light' && $(this).parents('.pum-content').length == 0 ||
11511 $(this).attr('data-midnight') == 'dark' && $(this).parents('.pum-content').length == 0) { 11512 11513 if( $(this).is('#page-header-bg') && $(this).parents('#page-header-wrap[data-midnight]').length > 0 ) { 11514 // skip. 11515 } else { 11516 $midnightCompatArr.push($(this)); 11517 } 11518 11519 } 11520 11521 }); 11522 11523 11524 if ($midnightCompatArr.length > 0) { 11525 11526 $.each($midnightCompatArr, function (k, v) { 11527 11528 if (v.attr('data-midnight') == 'light' || v.attr('data-midnight') == 'dark') { 11529 11530 var $that = v; 11531 var waypoint = new Waypoint({ 11532 element: $that, 11533 handler: function (direction) { 11534 11535 11536 if ($('body.material-ocm-open').length > 0 || $that.css('display') == 'none' ) { 11537 return; 11538 } 11539 11540 11541 var $textColor; 11542 11543 if (direction == 'down') { 11544 $textColor = ($that.attr('data-midnight') == 'light') ? '' : 'dark-slide'; 11545 $headerOuterEl.removeClass('dark-slide').addClass($textColor); 11546 11547 } else { 11548 11549 var $prevMidItem; 11550 11551 if (k - 1 >= 0) { 11552 $prevMidItem = k - 1; 11553 } else { 11554 $prevMidItem = k; 11555 } 11556 11557 $textColor = ($midnightCompatArr[$prevMidItem].attr('data-midnight') == 'light') ? '' : 'dark-slide'; 11558 $headerOuterEl.removeClass('dark-slide').addClass($textColor); 11559 11560 } 11561 11562 }, 11563 offset: $headerOuterEl.height() 11564 11565 }); 11566 11567 } 11568 11569 }); 11570 11571 } 11572 11573 } 11574 11575 11576 } 11577 11578 11579 11580 11581 /** 11582 * Box roll header effect initialization. 11583 * 11584 * @since 6.0 11585 */ 11586 function nectarBoxRollInit() { 11587 if ($('.nectar-box-roll').length > 0 && typeof NectarBoxRoll !== 'undefined') { 11588 pageHeaderTextEffectInit(); 11589 nectarBoxRoll = new NectarBoxRoll(nectarDOMInfo, waypoints, midnightInit, pageLoadHash, resizeVideoToCover); 11590 } 11591 } 11592 11593 11594 11595 11596 /** 11597 * Create all waypoints. 11598 * 11599 * @since 6.0 11600 */ 11601 function waypoints() { 11602 rowBGAnimations(); 11603 columnBGAnimations(); 11604 colAndImgAnimations(); 11605 progressBars(); 11606 dividers(); 11607 iconList(); 11608 animatedTitles(); 11609 highlightedText(); 11610 imageWithHotspots(); 11611 clientsFadeIn(); 11612 splitLineHeadings(); 11613 svgAnimations(); 11614 milestoneInit(); 11615 nectarFancyUlInit(); 11616 owl_carousel_animate(); 11617 headerRowColorInheritInit(); 11618 morphingOutlines(); 11619 animatedColBorders(); 11620 foodMenuItems(); 11621 vcWaypoints(); 11622 NectarPostGridWaypoint(); 11623 } 11624 11625 11626 11627 /** 11628 * Salient page builder elements initialization. 11629 * 11630 * @since 10.5 11631 */ 11632 function salientPageBuilderElInit() { 11633 flexsliderInit(); 11634 flickityLazyInit(); 11635 setTimeout(flickityInit, 100); 11636 twentytwentyInit(); 11637 standardCarouselInit(); 11638 productCarouselInit(); 11639 clientsCarouselInit(); 11640 carouselfGrabbingClass(); 11641 setTimeout(tabbedInit, 60); 11642 accordionInit(); 11643 accordionClickEvents(); 11644 largeIconHover(); 11645 nectarIconMatchColoring(); 11646 coloredButtons(); 11647 ctaLinkBG(); 11648 teamMemberFullscreen(); 11649 flipBoxInit(); 11650 owlCarouselInit(); 11651 mouseParallaxInit(); 11652 ulCheckmarks(); 11653 nectarFancyUlIcons(); 11654 nectarFancyBoxHover(); 11655 nectarVideoLightbox(); 11656 nectarKeyframeAssist(); 11657 morphingOutlinesInit(); 11658 nectarPostGridInit(); 11659 cascadingImageInit(); 11660 imageWithHotspotEvents(); 11661 pricingTableHeight(); 11662 pageSubmenuInit(); 11663 nectarLiquidBGs(); 11664 nectarTestimonialSliders(); 11665 nectarTestimonialSlidersEvents(); 11666 recentPostsTitleOnlyEqualHeight(); 11667 recentPostsInit(); 11668 parallaxItemHoverEffect(); 11669 fsProjectSliderInit(); 11670 postMouseEvents(); 11671 masonryPortfolioInit(); 11672 masonryBlogInit(); 11673 portfolioCustomColoring(); 11674 searchResultMasonryInit(); 11675 stickySidebarInit(); 11676 portfolioSidebarFollow(); 11677 splitLineHeadingInit(); 11678 } 11679 11680 11681 11682 11683 /***************** WooCommerce *****************/ 11684 11685 11686 /** 11687 * Add quantity buttons to WooCommerce pages 11688 * 11689 * @since 10.5 11690 */ 11691 function wooQauntityBtns() { 11692 11693 jQuery(document.body).on('updated_cart_totals', function () { 11694 11695 if ($('.plus').length == 0) { 11696 $('div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)') 11697 .addClass('buttons_added') 11698 .append('<input type="button" value="+" class="plus" />') 11699 .prepend('<input type="button" value="-" class="minus" />'); 11700 } 11701 }); 11702 11703 11704 // Quantity buttons 11705 if ($('.plus').length == 0) { 11706 11707 $('div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)') 11708 .addClass('buttons_added') 11709 .append('<input type="button" value="+" class="plus" />') 11710 .prepend('<input type="button" value="-" class="minus" />'); 11711 11712 $(document).on('click', '.plus, .minus', function () { 11713 11714 // Get values 11715 var $qty = $(this).closest('.quantity').find('.qty'), 11716 currentVal = parseFloat($qty.val()), 11717 max = parseFloat($qty.attr('max')), 11718 min = parseFloat($qty.attr('min')), 11719 step = $qty.attr('step'); 11720 11721 // Format values 11722 if (!currentVal || currentVal === '' || currentVal === 'NaN') { 11723 currentVal = 0; 11724 } 11725 if (max === '' || max === 'NaN') { 11726 max = ''; 11727 } 11728 if (min === '' || min === 'NaN') { 11729 min = 0; 11730 } 11731 if (step === 'any' || step === '' || step === undefined || parseFloat(step) === 'NaN') { 11732 step = 1; 11733 } 11734 11735 // Change the value 11736 if ($(this).is('.plus')) { 11737 11738 if (max && (max == currentVal || currentVal > max)) { 11739 $qty.val(max); 11740 } else { 11741 $qty.val(currentVal + parseFloat(step)); 11742 } 11743 11744 } else { 11745 11746 if (min && (min == currentVal || currentVal < min)) { 11747 $qty.val(min); 11748 } else if (currentVal > 0) { 11749 $qty.val(currentVal - parseFloat(step)); 11750 } 11751 11752 } 11753 11754 // Trigger change event 11755 $qty.trigger('change'); 11756 11757 }); 11758 } 11759 11760 } 11761 11762 11763 11764 /** 11765 * WooCommerce plugin events. 11766 * 11767 * @since 10.5 11768 */ 11769 function wooCommerceEvents() { 11770 11771 var wooCartTimeout; 11772 11773 // Notification. 11774 $body.on('click', '.product .add_to_cart_button', function () { 11775 11776 var $productHeading = ($(this).parents('li').find('h2').length > 0) ? 'h2' : 'h3', 11777 productToAdd = $(this).parents('li').find($productHeading).text(); 11778 11779 $('#header-outer .cart-notification span.item-name').html(productToAdd); 11780 11781 }); 11782 11783 // Notification hover. 11784 $body.on('mouseenter', '#header-outer .cart-notification', function () { 11785 11786 $(this).hide(); 11787 11788 $('#header-outer .widget_shopping_cart') 11789 .addClass('open') 11790 .stop(true, true) 11791 .show(); 11792 11793 $('#header-outer .cart_list') 11794 .stop(true, true) 11795 .show(); 11796 11797 clearTimeout(wooCartTimeout); 11798 11799 }); 11800 11801 11802 // Cart dropdown. 11803 var $headerCartSelector = '#header-outer .nectar-woo-cart'; 11804 11805 if ($($headerCartSelector).length > 0) { 11806 11807 $($headerCartSelector).hoverIntent(function () { 11808 11809 $('#header-outer .widget_shopping_cart') 11810 .addClass('open') 11811 .stop(true, true) 11812 .show(); 11813 11814 $('#header-outer .cart_list') 11815 .stop(true, true) 11816 .show(); 11817 11818 clearTimeout(wooCartTimeout); 11819 11820 $('#header-outer .cart-notification').hide(); 11821 11822 }); 11823 } 11824 11825 11826 $body.on('mouseleave', $headerCartSelector, function () { 11827 var $that = $(this); 11828 setTimeout(function () { 11829 if (!$that.is(':hover')) { 11830 $('#header-outer .widget_shopping_cart') 11831 .removeClass('open') 11832 .stop(true, true) 11833 .fadeOut(300); 11834 11835 $('#header-outer .cart_list') 11836 .stop(true, true) 11837 .fadeOut(300); 11838 } 11839 }, 200); 11840 }); 11841 11842 if ($('#header-outer[data-cart="false"]').length == 0) { 11843 11844 $body.on('added_to_cart', shopping_cart_dropdown_show); 11845 $body.on('added_to_cart', shopping_cart_dropdown); 11846
11847 // Update header cart markup after ajax remove. 11848 $body.on('removed_from_cart', wooCartImgPos); 11849 } 11850 11851 function shopping_cart_dropdown() { 11852 11853 if (!$('.widget_shopping_cart .widget_shopping_cart_content .cart_list .empty').length && 11854 $('.widget_shopping_cart .widget_shopping_cart_content .cart_list').length > 0) { 11855 11856 $('.cart-menu-wrap').addClass('has_products'); 11857 $('header#top nav > ul, #search-outer #search #close a, header#top .span_9 >.slide-out-widget-area-toggle').addClass('product_added'); 11858 11859 if (!$('.cart-menu-wrap').hasClass('static')) { 11860 $('.cart-menu-wrap, #mobile-cart-link').addClass('first-load'); 11861 } 11862 11863 // Change position of img in cart nav dropdown. 11864 wooCartImgPos(); 11865 11866 } 11867 11868 } 11869 11870 11871 function shopping_cart_dropdown_show(e) { 11872 11873 clearTimeout(wooCartTimeout); 11874 11875 if (!$('.widget_shopping_cart .widget_shopping_cart_content .cart_list .empty').length && 11876 $('.widget_shopping_cart .widget_shopping_cart_content .cart_list').length > 0 && 11877 typeof e.type != 'undefined') { 11878 11879 // Standalone woocommerce add to cart buttons. 11880 if ($('#header-outer .cart-notification .item-name').length > 0 && 11881 $('#header-outer .cart-notification .item-name').text().length == 0) { 11882 return; 11883 } 11884 11885 // Before cart has slide in. 11886 if (!$('#header-outer .cart-menu-wrap').hasClass('has_products')) { 11887 11888 setTimeout(function () { 11889 $('#header-outer .cart-notification').fadeIn(400); 11890 }, 400); 11891 11892 } else if (!$('#header-outer .cart-notification').is(':visible')) { 11893 $('#header-outer .cart-notification').fadeIn(400); 11894 } else { 11895 $('#header-outer .cart-notification').show(); 11896 } 11897 wooCartTimeout = setTimeout(hideCart, 2700); 11898 11899 } 11900 } 11901 11902 function hideCart() { 11903 $('#header-outer .cart-notification').stop(true, true).fadeOut(); 11904 } 11905 11906 function checkForWooItems() { 11907 11908 var checkForCartItems = setInterval(shopping_cart_dropdown, 250); 11909 setTimeout(function () { 11910 clearInterval(checkForCartItems); 11911 }, 4500); 11912 11913 } 11914 11915 function wooCartImgPos() { 11916 $('#header-outer .widget_shopping_cart .cart_list li, #slide-out-widget-area .widget_shopping_cart .cart_list li').each(function () { 11917 11918 if ($(this).find('> img').length == 0 && $(this).find('.product-meta').length == 0) { 11919 11920 var productCartImgLinkSrc = ($(this).find('> a[href]:not(.remove)').length > 0) ? $(this).find('> a[href]:not(.remove)').attr('href') : ''; 11921 var productCartImg = $(this).find('> a > img').clone(); 11922 11923 $(this).wrapInner('<div class="product-meta" />'); 11924 $(this).prepend(productCartImg); 11925 11926 if (productCartImgLinkSrc.length > 0) { 11927 productCartImg.wrap('<a href="' + productCartImgLinkSrc + '"></a>'); 11928 } 11929 11930 } 11931 11932 }); 11933 } 11934 11935 if ($('#header-outer[data-cart="false"]').length == 0) { 11936 checkForWooItems(); 11937 } 11938 11939 function nectarAccountPageTabs() { 11940 11941 // Not on account page. 11942 if ($('body.woocommerce-account #customer_login').length == 0) { 11943 return; 11944 } 11945 11946 // Create HTML. 11947 $('.woocommerce-account .woocommerce > #customer_login').prepend('<div class="nectar-form-controls" />'); 11948 11949 $('.woocommerce-account .woocommerce > #customer_login > div:not(.nectar-form-controls)').each(function () { 11950 var $title = $(this).find('> h2').text(); 11951 $('#customer_login .nectar-form-controls').append('<div class="control">' + $title + '</div>'); 11952 }); 11953 11954 // Click event. 11955 $('.woocommerce-account .woocommerce > #customer_login .nectar-form-controls .control').on('click', function () { 11956 11957 $('.woocommerce-account .woocommerce > #customer_login .nectar-form-controls .control').removeClass('active'); 11958 $(this).addClass('active'); 11959 11960 var formIndex = $(this).index() + 1; 11961 $('#customer_login div[class*="u-column"]').hide(); 11962 $('#customer_login div[class*="u-column"].col-' + formIndex).show(); 11963 11964 setTimeout(function () { 11965 $('#customer_login div[class*="u-column"]').removeClass('visible'); 11966 $('#customer_login div[class*="u-column"].col-' + formIndex).addClass('visible'); 11967 }, 30); 11968 11969 }); 11970 11971 // Starting. 11972 $('.woocommerce-account .woocommerce >
11972 #customer_login .nectar-form-controls .control:nth-child(1)').trigger('click'); 11973 11974 } 11975 11976 nectarAccountPageTabs(); 11977 11978 // Text on hover effect. 11979 $body.on('mouseover', '.text_on_hover .product-wrap, .text_on_hover > a:first-child', function () { 11980 $(this).parent().addClass('hovered'); 11981 }); 11982 11983 $body.on('mouseout', '.text_on_hover .product-wrap, .text_on_hover > a:first-child', function () { 11984 $(this).parent().removeClass('hovered'); 11985 }); 11986 11987 11988 // Material/fancy parallax hover effect zindex. 11989 if ($('.material.product').length > 0 || 11990 $('.minimal.product').length > 0 || 11991 $('.nectar-fancy-box[data-style="parallax_hover"]').length > 0 || 11992 $('.nectar-category-grid[data-shadow-hover="yes"]').length > 0 || 11993 $('.nectar-post-grid[data-shadow-hover="yes"]').length > 0) { 11994 11995 var $productZindex = 101; 11996 11997 $body.on('mouseenter', '.material.product, .minimal.product, .nectar-fancy-box[data-style="parallax_hover"], .nectar-post-grid[data-shadow-hover="yes"] .nectar-post-grid-item, .nectar-category-grid[data-shadow-hover="yes"] .nectar-category-grid-item', function () { 11998 $productZindex++; 11999 $(this).css('z-index', $productZindex + 1); 12000 }); 12001 12002 $body.on('mouseleave', '.material.product, .minimal.product, .nectar-fancy-box[data-style="parallax_hover"], .nectar-post-grid[data-shadow-hover="yes"] .nectar-post-grid-item, .nectar-category-grid[data-shadow-hover="yes"] .nectar-category-grid-item', function () { 12003 12004 var $that = $(this); 12005 setTimeout(function () { 12006 if (!$that.is(':hover')) { 12007 $that.css('z-index', 100); 12008 } 12009 }, 350); 12010 }); 12011 12012 // Reset to stop zindex from getting too high. 12013 setInterval(function () { 12014 if ($('.nectar-fancy-box[data-style="parallax_hover"]:hover').length > 0 || 12015 $('.minimal.product:hover').length > 0) { 12016 return; 12017 } 12018 12019 $('.material.product:not(:hover), .minimal.product:not(:hover), .nectar-fancy-box[data-style="parallax_hover"]:not(:hover), .nectar-post-grid[data-shadow-hover="yes"] .nectar-post-grid-item:not(:hover), .nectar-category-grid[data-shadow-hover="yes"] .nectar-category-grid-item:not(:hover)').css('z-index', 100); 12020 $productZindex = 101; 12021 }, 10000); 12022 12023 } 12024 12025 function minimalProductHover() { 12026 12027 // Add icons. 12028 $('.products .classic .product-wrap .add_to_cart_button').wrapInner('<span />'); 12029 $('.products .classic .product-wrap .add_to_cart_button').prepend('<i class="normal icon-salient-cart"></i>'); 12030 12031 // Bind hover. 12032 $body.on('mouseover', '.products .minimal.product', function () { 12033 minimalProductCalc($(this)); 12034 }); 12035 12036 $body.on('mouseleave', '.products .minimal.product', function () { 12037 12038 $(this).find('.background-color-expand').css({ 12039 'transform': 'scale(1)' 12040 }); 12041 12042 }); 12043 12044 // Starting trigger mouse over. 12045 $('.products .minimal.product').each(function () { 12046 if ($(this).is(':hover')) { 12047 $(this).trigger('mouseover'); 12048 } 12049 }); 12050 } 12051 12052 function minimalProductCalc(el) { 12053 12054 var $item = el, 12055 $itemWidth = $item.width(), 12056 $itemHeight = $item.height(), 12057 $wChange = (parseInt($itemWidth) + 40) / parseInt($itemWidth), 12058 $hChange = (parseInt($itemHeight) + 40) / parseInt($itemHeight); 12059 12060 $item.addClass('hover-bound'); 12061 12062 $item.find('.background-color-expand').css({ 12063 'transform': 'scale(' + $wChange + ',' + $hChange + ') translateY(0px)' 12064 }); 12065 12066 } 12067 12068 minimalProductHover(); 12069 12070 12071 12072 // Mobile widget filters. 12073 $('.woocommerce #sidebar .widget.woocommerce').each(function () { 12074 12075 // Skip widgets without any titles. 12076 if ($(this).find('> h4').length == 0) { 12077 $(this).addClass('no-widget-title'); 12078 } 12079 }); 12080 12081 $body.on('click', '#sidebar .widget.woocommerce:not(.widget_price_filter) h4', function () { 12082 12083 if ($window.width() < 1000) { 12084
12085 if ($(this).parent().is('.widget_product_tag_cloud')) { 12086 $(this).parent().find('> div').slideToggle(); 12087 } 12088 if ($(this).parent().is('.woocommerce-widget-layered-nav') && $(this).parent().find('> .woocommerce-widget-layered-nav-dropdown').length > 0) { 12089 $(this).parent().find('> .woocommerce-widget-layered-nav-dropdown').slideToggle(); 12090 } 12091 12092 $(this).parent().find('> ul').slideToggle(); 12093 12094 $(this).parent().toggleClass('open-filter'); 12095 } 12096 12097 }); 12098 12099 // Slide in cart event. 12100 $body.on('mouseenter', '#header-outer [data-cart-style="slide_in"] .cart-menu-wrap', openRightCart); 12101 12102 function openRightCart() { 12103 12104 if ($('.nectar-slide-in-cart ul.cart_list li:not(.empty)').length > 0) { 12105 12106 $('.nectar-slide-in-cart').addClass('open'); 12107 $window.on('mousemove.rightCartOffsetCheck', closeCartCheck); 12108 12109 } 12110 } 12111 12112 function closeCartCheck(e) { 12113 12114 var $windowWidth = $window.width(); 12115 if (e.clientX < $windowWidth - 370 - $bodyBorderWidth) { 12116 12117 $window.off('mousemove.rightCartOffsetCheck', closeCartCheck); 12118 12119 $('.nectar-slide-in-cart').removeClass('open'); 12120 12121 } 12122 12123 } 12124 12125 // Add quantity buttons if needed. 12126 wooQauntityBtns(); 12127 12128 } 12129 12130 12131 12132 12133 12134 /** 12135 * Search in navigation functionality. 12136 * 12137 * @since 10.5 12138 */ 12139 12140 function navigationSearchInit() { 12141 12142 var $placeholder = ($('#search-outer #search input[type=text][data-placeholder]').length > 0) ? $('#search-outer #search input[type=text]').attr('data-placeholder') : ''; 12143 12144 // Material skin add search BG markup. 12145 if ($body.hasClass('material') && $('#header-outer .bg-color-stripe').length == 0) { 12146 $headerOuterEl.append('<div class="bg-color-stripe" />'); 12147 } 12148 12149 // Prevent jumping on click. 12150 $body.on('click', '#search-btn a', function () { 12151 return false; 12152 }); 12153 12154 // Open search on mouseup. 12155 $body.on('click', '#search-btn a:not(.inactive), #header-outer .mobile-search', function () { 12156 12157 if ($(this).hasClass('open-search')) { 12158 return false; 12159 } 12160 12161 // Close menu on original skin. 12162 if( $body.hasClass('original') && $('.slide-out-widget-area-toggle.mobile-icon a.open').length > 0 ) { 12163 $('.slide-out-widget-area-toggle.mobile-icon a') 12164 .addClass('non-human-allowed') 12165 .trigger('click'); 12166 12167 setTimeout(function () { 12168 $('.slide-out-widget-area-toggle.mobile-icon a').removeClass('non-human-allowed'); 12169 }, 100); 12170 } 12171 12172 if ($body.hasClass('ascend') || 12173 $('body[data-header-format="left-header"]').length > 0 && $('body.material').length == 0) { 12174 12175 // Ascend theme skin. 12176 $('#search-outer > #search form, #search-outer #search .span_12 span, #search-outer #search #close').css('opacity', 0); 12177 12178 $('#search-outer > #search form').css('transform', 'translateY(-30px)'); 12179 $('#search-outer #search .span_12 span').css('transform', 'translateY(20px)'); 12180 12181 $('#search-outer').show(); 12182 $('#search-outer').stop().transition({ 12183 scale: '1,0', 12184 'opacity': 1 12185 }, 0).transition({ 12186 scale: '1,1' 12187 }, 700, 'cubic-bezier(0.2, 1, 0.3, 1)'); 12188 12189 $('#search-outer > #search form').delay(350).transition({ 12190 'opacity': 1, 12191 'transform': 'translateY(0)' 12192 }, 700, 'cubic-bezier(0.2, 1, 0.3, 1)'); 12193 12194 $('#search-outer #search #close').delay(500).transition({ 12195 'opacity': 1 12196 }, 700, 'cubic-bezier(0.2, 1, 0.3, 1)'); 12197 12198 12199 $('#search-outer #search .span_12 span').delay(450).transition({ 12200 'opacity': 1, 12201 'transform': 'translateY(0)' 12202 }, 700, 'cubic-bezier(0.2, 1, 0.3, 1)'); 12203 12204 } 12205 12206 else if (!$body.hasClass('material')) { 12207 // Original theme skin. 12208 $('#search-outer').stop(true).fadeIn(600, 'easeOutExpo'); 12209 } 12210 else { 12211 12212 // Material theme skin. 12213 $('#header-outer[data-transparent-header="true"] .bg-color-stripe').css('transition', ''); 12214 $('#search-outer, #ajax-content-wrap').addClass('material-open'); 12215 $headerOuterEl.addClass('material-search-open'); 12216 $('#fp-nav').addClass('material-ocm-open'); 12217 12218 } 12219 12220 12221 setTimeout(function () { 12222 12223 $('#search input[type=text]').trigger('focus'); 12224 12225 if ($('#search input[type=text]').val() == $placeholder) { 12226 $('#search input[type=text]').setCursorPosition(0); 12227 } 12228 12229 }, 300); 12230 12231 12232 $(this).toggleClass('open-search'); 12233 12234 // Close slide out widget area. 12235 $('.slide-out-widget-area-toggle a:not(#toggle-nav).open:not(.animating)').trigger('click'); 12236 12237 return false;
12238 12239 }); 12240 12241 // Handle the placeholder value. 12242 $('body:not(.material)').on('keydown', '#search input[type=text]', function () { 12243 if ($(this).val() == $placeholder) { 12244 $(this).val(''); 12245 } 12246 }); 12247 12248 $('body:not(.material)').on('keyup', '#search input[type=text]', function () { 12249 if ($(this).val().length == 0 ) { 12250 $(this).val($placeholder); 12251 $(this).setCursorPosition(0); 12252 } 12253 }); 12254 12255 12256 // Close search btn event. 12257 $body.on('click', '#close', function () { 12258 closeSearch(); 12259 $searchButtonEl.removeClass('open-search'); 12260 $('#header-outer .mobile-search').removeClass('open-search'); 12261 return false; 12262 }); 12263 12264 // Original and Ascend skin close search when clicking off. 12265 $('body:not(.material)').on('blur', '#search-box input[type=text]', function () { 12266 closeSearch(); 12267 $searchButtonEl.removeClass('open-search'); 12268 $('#header-outer .mobile-search').removeClass('open-search'); 12269 }); 12270 12271 12272 // Material skin close when clicking off the search. 12273 $('body.material').on('click', '#ajax-content-wrap', function (e) { 12274 if (e.originalEvent !== undefined) { 12275 closeSearch(); 12276 $searchButtonEl.removeClass('open-search'); 12277 $('#header-outer .mobile-search').removeClass('open-search'); 12278 } 12279 }); 12280 12281 // Material skin close on esc button event. 12282 if ($('body.material').length > 0) { 12283 $(document).on('keyup', function (e) { 12284 12285 if (e.keyCode == 27) { 12286 closeSearch(); 12287 $searchButtonEl.removeClass('open-search'); 12288 12289 // Close ocm material 12290 if ($('.ocm-effect-wrap.material-ocm-open').length > 0) { 12291 $('.slide-out-widget-area-toggle.material-open a').trigger('click'); 12292 } 12293 } 12294 12295 }); 12296 } 12297 12298 12299 12300 // Called to hide the search bar. 12301 function closeSearch() { 12302 12303 if ($body.hasClass('ascend') || $('body[data-header-format="left-header"]').length > 0 && $('body.material').length == 0) { 12304 $('#search-outer').stop().transition({ 12305 'opacity': 0 12306 }, 300, 'cubic-bezier(0.2, 1, 0.3, 1)'); 12307 $searchButtonEl.addClass('inactive'); 12308 setTimeout(function () { 12309 $('#search-outer').hide(); 12310 $searchButtonEl.removeClass('inactive'); 12311 }, 300); 12312 } else if ($('body.material').length == 0) { 12313 $('#search-outer').stop(true).fadeOut(450, 'easeOutExpo'); 12314 } 12315 12316 if ($body.hasClass('material')) { 12317 $('#ajax-content-wrap').removeClass('material-open'); 12318 $headerOuterEl.removeClass('material-search-open'); 12319 $('#search-outer').removeClass('material-open'); 12320 $('#fp-nav').removeClass('material-ocm-open'); 12321 } 12322 12323 } 12324 12325 } 12326 12327 12328 12329 12330 12331 12332 /** 12333 * Header layout "Centered header bottom bar" functionality. 12334 * 12335 * @since 9.0 12336 */ 12337 function centeredNavBottomBarReposition() { 12338 12339 var $headerOuter = $headerOuterEl, 12340 $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'), 12341 $headerSpan3 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_3'), 12342 $secondaryHeader = $headerSecondaryEl, 12343 $headerBtns = $headerSpan3.find('nav >ul.buttons'), 12344 $navLogoMargin = parseInt($('body.material #header-outer').attr('data-padding')), 12345 $navLogoHeight = parseInt($('body.material #header-outer').attr('data-logo-height')), 12346 $triggerCondition = ($navLogoMargin*2) + $navLogoHeight - parseInt(nectarDOMInfo.adminBarHeight) + parseInt(nectarDOMInfo.secondaryHeaderHeight); 12347 12348 if ($secondaryHeader.length > 0) { 12349 12350 if ($('#header-outer[data-remove-fixed="1"]').length == 0 && $('#header-outer[data-condense="true"]').length > 0) { 12351 12352 setTimeout(function () { 12353 if( $headerSecondaryEl.css('display') != 'none' ) { 12354 nectarDOMInfo.secondaryHeaderHeight = $headerSecondaryEl.outerHeight(); 12355 } 12356 12357 }, 50); 12358 } 12359 12360 } 12361 12362 // Helper to determine if custom mobile breakpoint is active. 12363 function condenseCustomBreakPointHelper() { 12364 var $withinCustomBreakpoint = mobileBreakPointCheck(); 12365 12366 // Adding class to prevent logo from hiding when opening OCM 12367 if ( $withinCustomBreakpoint ) { 12368 $headerOuterEl.addClass('within-custom-breakpoint'); 12369 } else { 12370 $headerOuterEl.removeClass('within-custom-breakpoint'); 12371 } 12372 } 12373 12374 12375 // Bind events if "Condense Header On Scroll" effect is enabled. 12376 if ($('#header-outer[data-condense="true"]').length > 0) { 12377 12378 $window.on('scroll.centeredNavCondense', centeredNavBottomFixed_Scroll); 12379 $window.trigger('scroll'); 12380 12381 $window.on('resize', function(){ 12382 if(nectarDOMInfo.winW < 1000 ) { 12383 $headerOuter.addClass('force-condense-remove'); 12384 $window.off('scroll.centeredNavCondense'); 12385 } 12386 }); 12387 12388 $window.smartresize(function () { 12389 condenseCustomBreakPointHelper(); 12390 12391 if(nectarDOMInfo.winW >= 1000 ) { 12392 12393 // Coming from mobile. 12394 if($headerOuter.hasClass('force-condense-remove')) { 12395
12396 // Remove condense effect. 12397 centeredNavBottomFixed_Scroll(); 12398 $headerOuter.removeClass('force-condense-remove'); 12399 12400 // See if the condense effect needs to be reapplied. 12401 setTimeout(function() { 12402 12403 if(nectarDOMInfo.scrollTop >= $triggerCondition) { 12404 $headerOuter.addClass('force-condense'); 12405 centeredNavBottomFixed_Scroll(); 12406 $headerOuter.removeClass('force-condense'); 12407 } 12408 // Bind scroll event. 12409 $window.on('scroll.centeredNavCondense', centeredNavBottomFixed_Scroll); 12410 },200); 12411 12412 } 12413 } 12414 12415 }); 12416 12417 condenseCustomBreakPointHelper(); 12418 12419 } 12420 12421 12422 12423 function centeredNavBottomFixed_Scroll() { 12424 12425 // Bypass calculating. 12426 if (nectarDOMInfo.winW < 1000 || 12427 $('body.material-ocm-open').length > 0 || 12428 $('#header-outer[data-has-menu="true"][data-format="centered-menu-bottom-bar"] .span_9').css('display') == 'none') { 12429 return; 12430 } 12431 12432 $bodyBorderTop = ($bodyBorderTop.length > 0 && nectarDOMInfo.secondaryHeaderHeight > 0) ? $bodyBorderTop.height() : 0; 12433 12434 // Add condense effect. 12435 if ($headerOuter.hasClass('force-condense') || !$headerOuter.hasClass('fixed-menu') && nectarDOMInfo.scrollTop >= $triggerCondition) { 12436 12437 var amountToMove = (parseInt($headerSpan9.position().top) - $navLogoMargin - parseInt(nectarDOMInfo.adminBarHeight)) + parseInt(nectarDOMInfo.secondaryHeaderHeight) - $bodyBorderTop; 12438 12439 // Megamenu removes transparency option 12440 if ($('#header-outer[data-megamenu-rt="1"]').length > 0 && $('#header-outer .megamenu').length > 0 && $('#header-outer[data-transparent-header="true"]').length > 0) { 12441 $headerOuterEl.removeClass('no-transition'); 12442 } 12443 12444 $headerOuter.addClass('fixed-menu').removeClass('transparent').css({ 12445 'top': '-' + amountToMove + 'px', 12446 'position': 'fixed' 12447 }); 12448 12449 var $headerNavBarOffset = $('header#top .span_9 nav >ul').offset().top; 12450 var $headerButtonsOffset = $headerBtns.offset().top; 12451 12452 12453 var $headerButtonsHeight = ($headerSpan9.find('.sf-menu > li > a').length > 0) ? (20 - parseInt($headerSpan9.find('.sf-menu > li > a').height())) / 2 : 2; 12454 12455 $headerBtns.css('transform', 'translateY(' + (parseInt($headerNavBarOffset) - parseInt($headerButtonsOffset) - $headerButtonsHeight - 1) + 'px)'); 12456 $headerBtns.find('.nectar-woo-cart').css('height', $headerOuter.height() + parseInt($headerOuter.css('top')) - parseInt(nectarDOMInfo.adminBarHeight)); 12457 12458 } 12459 12460 // Remove condense effect. 12461 else if ($headerOuter.hasClass('force-condense-remove') || $headerOuter.hasClass('fixed-menu') && nectarDOMInfo.scrollTop < $triggerCondition ) { 12462 12463 $headerOuter.removeClass('fixed-menu').css({ 12464 'top': '0', 12465 'position': 'absolute' 12466 }); 12467 12468 $headerBtns.css('transform', 'translateY(0px)'); 12469 $headerBtns.find('.nectar-woo-cart').css('height', ''); 12470 12471 if ($('#header-outer.transparent').length == 0) { 12472 12473 if ($('#header-outer[data-megamenu-rt="1"]').length > 0 && 12474 $('#header-outer .megamenu').length > 0) { 12475 $headerOuterEl.removeClass('no-transition'); 12476 } 12477 12478 if ($('#header-outer[data-megamenu-rt="1"]').length > 0 && 12479 $('#header-outer[data-transparent-header="true"]').length > 0 && 12480 $('#header-outer .megamenu').length > 0) { 12481 12482 if ($headerOuterEl.attr('data-transparent-header') == 'true' && 12483 $('.nectar-box-roll').length == 0 && 12484 $('.megamenu.sfHover').length == 0) { 12485 12486 $headerOuterEl.addClass('transparent'); 12487 $headerOuterEl.removeClass('no-transition'); 12488 12489 } 12490 else if ($headerOuterEl.attr('data-transparent-header') == 'true' && 12491 $('.nectar-box-roll').length == 0 && 12492 $('.megamenu.sfHover').length > 0) { 12493 12494 $headerOuterEl.addClass('no-transition'); 12495 } 12496 12497 } 12498 12499 else { 12500 if ($headerOuterEl.attr('data-transparent-header') == 'true' && $('.nectar-box-roll').length == 0) { 12501 $headerOuterEl.addClass('transparent'); 12502 } 12503 } 12504 12505 } // endif transparent header conditional. 12506 12507 12508 }
12508 // End Remove condense effect. 12509 12510 } // End centeredNavBottomFixed_Scroll. 12511 12512 12513 12514 } 12515 12516 12517 12518 12519 /** 12520 * Header layout "Centered header bottom bar" initialization. 12521 * 12522 * @since 10.5 12523 */ 12524 function centeredNavBottomBarInit() { 12525 12526 if ($('#header-outer[data-format="centered-menu-bottom-bar"]').length > 0) { 12527 centeredNavBottomBarReposition(); 12528 } 12529 12530 } 12531 12532 12533 12534 12535 12536 /** 12537 * Header layout "Centered logo between menu". 12538 * 12539 * Splits the main navigation menu into two sections placed on each side of logo. 12540 * 12541 * @since 8.0 12542 */ 12543 function centeredLogoMargins() { 12544 12545 if (nectarDOMInfo.winW > 1000) { 12546 12547 var $navItemLength = $('#header-outer[data-format="centered-logo-between-menu"] #top nav > .sf-menu:not(.buttons) > li').length; 12548 12549 if ($('#header-outer #social-in-menu').length > 0) { 12550 $navItemLength--; 12551 } 12552 12553 var $centerLogoWidth, 12554 $extraMenuSpace; 12555 12556 if ($('#header-outer #top .row .col.span_3 #logo img:visible').length == 0) { 12557 $centerLogoWidth = parseInt($('#header-outer #top .row .col.span_3').width()); 12558 } else { 12559 $centerLogoWidth = parseInt($('#header-outer #top .row .col.span_3 img:visible').width()); 12560 } 12561 12562 if ($('#header-outer[data-lhe="animated_underline"]').length > 0) { 12563 $extraMenuSpace = parseInt($('header#top nav > ul > li:first-child > a').css('margin-right')); 12564 } else { 12565 $extraMenuSpace = parseInt($('header#top nav > ul > li:first-child > a').css('padding-right')); 12566 } 12567 12568 if ($extraMenuSpace > 30) { 12569 $extraMenuSpace += 45; 12570 } else if ($extraMenuSpace > 20) { 12571 $extraMenuSpace += 40; 12572 } else { 12573 $extraMenuSpace += 30; 12574 } 12575 12576 if (!$body.hasClass('rtl')) { 12577 $('#header-outer[data-format="centered-logo-between-menu"] #top nav > .sf-menu:not(.buttons) > li:nth-child(' + Math.floor($navItemLength / 2) + ')').css({ 12578 'margin-right': ($centerLogoWidth + $extraMenuSpace) + 'px' 12579 }).addClass('menu-item-with-margin'); 12580 } else { 12581 $('#header-outer[data-format="centered-logo-between-menu"] #top nav > .sf-menu:not(.buttons) > li:nth-child(' + Math.floor($navItemLength / 2) + ')').css({ 12582 'margin-left': ($centerLogoWidth + $extraMenuSpace) + 'px' 12583 }).addClass('menu-item-with-margin'); 12584 } 12585 12586 var $leftMenuWidth = 0; 12587 var $rightMenuWidth = 0; 12588 12589 $('#header-outer[data-format="centered-logo-between-menu"] #top nav > .sf-menu:not(.buttons) > li:not(#social-in-menu)').each(function (i) { 12590 if (i + 1 <= Math.floor($navItemLength / 2)) { 12591 $leftMenuWidth += $(this).width(); 12592 } else { 12593 $rightMenuWidth += $(this).width(); 12594 } 12595 12596 }); 12597 12598 var $menuDiff = Math.abs($rightMenuWidth - $leftMenuWidth); 12599 12600 if ($leftMenuWidth > $rightMenuWidth || ($body.hasClass('rtl') && $leftMenuWidth < $rightMenuWidth) ) { 12601 $('#header-outer #top .row > .col.span_9').css('padding-right', $menuDiff); 12602 } else { 12603 $('#header-outer #top .row > .col.span_9').css('padding-left', $menuDiff); 12604 } 12605 12606 $('#header-outer[data-format="centered-logo-between-menu"] nav').css('visibility', 'visible'); 12607 12608 } 12609 12610 else if ($('#header-outer[data-format="centered-logo-between-menu"]').length > 0 && nectarDOMInfo.winW < 1000) { 12611 $('#header-outer .row > .col.span_9').css({ 12612 'padding-right': '0', 12613 'padding-left': '0' 12614 }); 12615 } 12616 12617 } 12618 12619 12620 /** 12621 * Header layout "Centered logo between menu" initialization. 12622 * 12623 * @since 10.5 12624 */ 12625 function centeredLogoHeaderInit() { 12626 12627 if($('#header-outer[data-format="centered-logo-between-menu"]').length > 0) { 12628 12629 if(!usingLogoImage) { 12630 centeredLogoMargins(); 12631 } 12632 else if(usingLogoImage && $('#header-outer[data-format="centered-logo-between-menu"]').length > 0 && $('header#top #logo img:first[src]').length > 0) { 12633 12634 //fadein img on load 12635 var tempLogoImg = new Image(); 12636 tempLogoImg.src = $('header#top #logo img:first').attr('src'); 12637 12638 tempLogoImg.onload = function() { 12639 centeredLogoMargins(); 12640 }; 12641 12642 } 12643 12644 // Resize event. 12645 $window.on('smartresize', centeredLogoMargins); 12646 12647 } 12648 12649 } 12650 12651 12652 12653 12654 12655 12656 12657 12658 /** 12659 * Handle basic items before initializing effects. 12660 * 12661 * @since 10.5 12662 */ 12663 function headerNavPreInit() { 12664 12665 // Deactivate hide header until needed effect on mobile. 12666 if (nectarDOMInfo.usingMobileBrowser && $('#header-outer[data-remove-fixed="1"]').length == 0) { 12667 $body.attr('data-hhun', '0'); 12668 } 12669 12670 // Page fullscreen rows does not need permanent transparent. 12671 if ($('#nectar_fullscreen_rows').length > 0) { 12672 ($headerOuterEl.attr('data-permanent-transparent', 'false')); 12673 } 12674 12675 // Set mobile header height. 12676 if (nectarDOMInfo.usingMobileBrowser && $('#header-outer[data-mobile-fixed="1"]').length > 0 && 12677 $('#header-outer[data-transparent-header="true"]').length == 0) { 12678 $('#header-space').css('height', $headerOuterEl.outerHeight()); 12679 } 12680 12681 } 12682 12683 12684 12685 12686 12687 12688 /** 12689 * Hide header until needed. 12690 * 12691 * Used when "Header Hide Until Needed" is active. 12692 * 12693 * @since 10.5 12694 */ 12695 function hhunHeaderEffect() { 12696 12697 var previousScroll = 0, // previous scroll position
12698 menuOffset = 250, // height of menu (once scroll passed it, menu is hidden) 12699 hideShowOffset = 6; // scrolling value after which triggers hide/show menu 12700 12701 // Called in RAF loop to calculate the header visibility. 12702 function hhunCalcs() { 12703 12704 $headerOuterEl.addClass('detached'); 12705 12706 var currentScroll = nectarDOMInfo.scrollTop, // Gets current scroll position 12707 scrollDifference = Math.abs(currentScroll - previousScroll); // Calculates how fast user is scrolling 12708 12709 // Stop scrolling while animated anchors / box roll 12710 if ($('body.animated-scrolling').length > 0 && $('#header-outer.detached').length > 0 || $('body.no-scroll').length > 0) { 12711 12712 if (nectarDOMInfo.winW > 999) { 12713 12714 if (currentScroll > menuOffset) { 12715 12716 // Alter scroll tracking to continue hiding menu. 12717 previousScroll = nectarDOMInfo.scrollTop; 12718 currentScroll = nectarDOMInfo.scrollTop; 12719 12720 } 12721 12722 requestAnimationFrame(hhunCalcs); 12723 return; 12724 } 12725 } 12726 12727 // Stop when material ocm or material search is open 12728 if ($('body.material-ocm-open').length > 0 || $('#search-outer.material-open').length > 0) { 12729 if (nectarDOMInfo.winW > 999) { 12730 requestAnimationFrame(hhunCalcs); 12731 return; 12732 } 12733 } 12734 12735 // Stop on mobile if not using sticky option 12736 if ($('#header-outer[data-mobile-fixed="false"]').length > 0 && $('body.mobile').length > 0) { 12737 $headerOuterEl.removeClass('detached'); 12738 return; 12739 } 12740 12741 12742 12743 if (!$headerOuterEl.hasClass('side-widget-open') && !$('#header-outer .slide-out-widget-area-toggle a').hasClass('animating')) { 12744 12745 var heightToAdjust; 12746 12747 // Remove transparent and body border margin 12748 if (currentScroll > 1) { 12749 if ($('#header-outer[data-permanent-transparent="1"]').length == 0) { 12750 $headerOuterEl.removeClass('transparent'); 12751 $headerOuterEl.addClass('scrolling'); 12752 } 12753 12754 // Handle secondary header 12755 if ($headerSecondaryEl.length > 0) { 12756 if (currentScroll > menuOffset) { 12757 $headerSecondaryEl.addClass('hide-up'); 12758 $headerOuterEl.css('transform', 'translateY(-' + nectarDOMInfo.secondaryHeaderHeight + 'px)'); 12759 } else { 12760 $headerSecondaryEl.removeClass('hide-up'); 12761 $headerOuterEl.css('transform', '0px)'); 12762 } 12763 } 12764 12765 } 12766 12767 // Scrolled past menu 12768 if (currentScroll > menuOffset) { 12769 12770 // Scrolled past detach point add class to fix menu 12771 if (!$headerOuterEl.hasClass('detached')) { 12772 12773 $headerOuterEl 12774 .addClass('detached') 12775 .removeClass('parallax-contained'); 12776 } 12777 12778 $headerOuterEl.removeClass('no-transition'); 12779 12780 12781 // Scrolling faster than hideShowOffset hide/show menu 12782 if (scrollDifference >= hideShowOffset) { 12783 12784 if (currentScroll > previousScroll) { 12785 12786 // Hide menu 12787 if (!$headerOuterEl.hasClass('invisible')) { 12788 12789 $headerOuterEl 12790 .addClass('invisible') 12791 .removeClass('at-top'); 12792 12793 // Close submenus 12794 if ($(".sf-menu").length > 0 && $().superfish) { 12795 $(".sf-menu").superfish('hide'); 12796 $('header#top nav > ul.sf-menu > li.menu-item-over').removeClass('menu-item-over'); 12797 } 12798 12799 } 12800 12801 $('.page-submenu.stuck') 12802 .css('transform', 'translateY(0px)') 12803 .addClass('header-not-visible'); 12804 12805 } else { 12806 12807 // Show menu 12808 if ($headerOuterEl.hasClass('invisible')) { 12809 $headerOuterEl.removeClass('invisible'); 12810 } 12811 12812 // Page submenu adjust 12813 heightToAdjust = $headerOuterEl.outerHeight(); 12814 12815 if( $headerSecondaryEl.length > 0) { 12816 heightToAdjust -= nectarDOMInfo.secondaryHeaderHeight; 12817 } 12818 12819 if ($bodyBorderTop.length > 0 && $('body.mobile').length == 0) { 12820 12821 $bodyBorderSizeToRemove = ($bodyBorderHeaderColorMatch) ? $bodyBorderTop.height() : 0; 12822 12823 $('.page-submenu.stuck') 12824 .css('transform', 'translateY(' + (heightToAdjust - $bodyBorderSizeToRemove) + 'px)') 12825 .removeClass('header-not-visible'); 12826 12827 } else { 12828 $('.page-submenu.stuck') 12829 .css('transform', 'translateY(' + heightToAdjust + 'px)') 12830 .removeClass('header-not-visible'); 12831 } 12832 12833 } 12834 } 12835 12836 } else { 12837 12838 12839 var $topDetachNum = ($('#header-outer[data-using-secondary="1"]').length > 0) ? 32 : 0; 12840 if ($bodyBorderTop.length > 0) { 12841 $topDetachNum = ($('#header-outer[data-using-secondary="1"]').length > 0) ? 32 + $bodyBorderTop.height() : $bodyBorderTop.height(); 12842 } 12843 12844 if (currentScroll <= $topDetachNum) { 12845 12846 $headerOuterEl 12847 .addClass('at-top') 12848 .removeClass('invisible') 12849 .removeClass('scrolling'); 12850 12851 if ($('#header-outer[data-megamenu-rt="1"]').length > 0 && 12852 $('#header-outer[data-transparent-header="true"]').length > 0 && 12853 $('#header-outer .megamenu').length > 0) { 12854 12855 if ($('#header-outer[data-transparent-header="true"]').length > 0 && 12856 $('.nectar-box-roll').length == 0 && 12857 $('.megamenu.sfHover').length == 0) { 12858 12859 $headerOuterEl 12860 .addClass('transparent') 12861 .css('transform', 'translateY(0)') 12862 .removeClass('no-transition'); 12863 12864 } else if ($('.nectar-box-roll').length > 0) { 12865 12866 $headerOuterEl 12867 .css('transform', 'translateY(0)') 12868 .addClass('at-top-before-box'); 12869 } 12870 12871 } else { 12872 12873 if ($('#header-outer[data-transparent-header="true"]').length > 0 && 12874 $('.nectar-box-roll').length == 0) { 12875 12876 $headerOuterEl 12877 .addClass('transparent') 12878 .css('transform', 'translateY(0)'); 12879 12880 } else if ($('.nectar-box-roll').length > 0) { 12881 12882 $headerOuterEl 12883 .css('transform', 'translateY(0)') 12884 .addClass('at-top-before-box'); 12885 } 12886 } 12887
12888 if ($('#page-header-bg[data-parallax="1"]').length > 0) { 12889 12890 $headerOuterEl 12891 .addClass('parallax-contained') 12892 .css('transform', 'translateY(0)'); 12893 } 12894 12895 } 12896 12897 } 12898 12899 // At the bottom of document - show menu 12900 if ((nectarDOMInfo.winH + window.scrollY) >= document.body.offsetHeight) { 12901 12902 $headerOuterEl.removeClass('invisible'); 12903 12904 // Page submenu adjust 12905 heightToAdjust = $headerOuterEl.outerHeight(); 12906 if( $headerSecondaryEl.length > 0) { 12907 heightToAdjust -= nectarDOMInfo.secondaryHeaderHeight; 12908 } 12909 12910 if ($bodyBorderTop.length > 0 && $('body.mobile').length == 0) { 12911 12912 $bodyBorderSizeToRemove = ($bodyBorderHeaderColorMatch) ? $bodyBorderTop.height() : 0; 12913 $('.page-submenu.stuck') 12914 .css('transform', 'translateY(' + (heightToAdjust - $bodyBorderSizeToRemove) + 'px)') 12915 .removeClass('header-not-visible'); 12916 } else { 12917 12918 $('.page-submenu.stuck') 12919 .css('transform', 'translateY(' + heightToAdjust + 'px)') 12920 .removeClass('header-not-visible'); 12921 } 12922 12923 } 12924 12925 } 12926 12927 // Keep track of current scroll position 12928 previousScroll = currentScroll; 12929 12930 if (nectarDOMInfo.winW > 999) { 12931 requestAnimationFrame(hhunCalcs); 12932 } 12933 12934 } 12935 12936 // Start the animation loop. 12937 hhunCalcs(); 12938 12939 } 12940 12941 12942 12943 /** 12944 * Shrink the header navigation size. 12945 * 12946 * Used when "Header Resize On Scroll" is active. 12947 * 12948 * @since 1.0 12949 */ 12950 function smallNav() { 12951 12952 var $offset = nectarDOMInfo.scrollTop, 12953 $windowWidth = nectarDOMInfo.winW, 12954 $scrollTriggerOffset = ($body.hasClass('material')) ? 150 : 30; 12955 12956 if( headerTransparent == true ) { 12957 $scrollTriggerOffset = 0; 12958 } 12959 12960 if ($offset > $scrollTriggerOffset && $windowWidth >= 1000 && $('body.material-ocm-open').length == 0) { 12961 12962 12963 // Going to small when material search is closing, it must be closed immediately 12964 if ($body.is('.material')) { 12965 12966 if ($('#search-outer.material-open').length == 0) { 12967 $('#header-outer[data-transparent-header="true"] .bg-color-stripe').css('transition', 'none'); 12968 } 12969 12970 // Secondary header 12971 if ($headerSecondaryEl.length > 0) { 12972 $headerSecondaryEl.addClass('hide-up'); 12973 $headerOuterEl.css('transform', 'translateY(-' + nectarDOMInfo.secondaryHeaderHeight + 'px)'); 12974 } 12975 12976 } 12977 12978 if ($('#header-outer[data-megamenu-rt="1"]').length > 0 && 12979 $('#header-outer[data-transparent-header="true"]').length > 0 && 12980 $('#header-outer .megamenu').length > 0) { 12981 12982 if ($headerOuterEl.attr('data-transparent-header') == 'true' && 12983 $('#header-outer.side-widget-open').length == 0 && 12984 $('#header-outer[data-permanent-transparent="1"]').length == 0 && 12985 $('.megamenu.sfHover').length == 0) { 12986 $headerOuterEl.removeClass('transparent'); 12987 $headerOuterEl.removeClass('no-transition'); 12988 } 12989 12990 } else { 12991 12992 if ($headerOuterEl.attr('data-transparent-header') == 'true' && 12993 $('#header-outer.side-widget-open').length == 0 && 12994 $('#header-outer[data-permanent-transparent="1"]').length == 0) { 12995 $headerOuterEl.removeClass('transparent'); 12996 } 12997 12998 } 12999 13000 $('#header-outer, #search-outer').addClass('small-nav'); 13001 13002 // Body border full width side padding 13003 if ($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 && 13004 $bodyBorderTop.length > 0 && 13005 $bodyBorderHeaderColorMatch == true) { 13006 13007 $('#header-outer[data-full-width="true"] header > .container').stop(true, true).animate({ 13008 'padding': '0' 13009 }, { 13010 queue: false, 13011 duration: 250, 13012 easing: 'easeOutCubic' 13013 }); 13014 13015 } 13016 13017 if ($('body.material').length > 0) { 13018 $('header#top nav > ul > li.menu-item-with-margin').stop(true, true).animate({ 13019 'margin-right': (parseInt($('header#top nav > ul > li.menu-item-with-margin').css('margin-right')) - parseInt(logoShrinkNum) * 3) + 'px' 13020 }, {
13021 queue: false, 13022 duration: 310, 13023 easing: 'easeOutQuad' 13024 }); 13025 } 13026 13027 // Box roll effect 13028 if ($('.nectar-box-roll').length > 0 && $('#header-outer[data-permanent-transparent="1"]').length == 0) { 13029 $('#ajax-content-wrap').animate({ 13030 'margin-top': (Math.floor(($logoHeight - logoShrinkNum) + (headerPadding * 2) / 1.8 + nectarDOMInfo.adminBarHeight + nectarDOMInfo.secondaryHeaderHeight)) 13031 }, { 13032 queue: false, 13033 duration: 250, 13034 easing: 'easeOutCubic' 13035 }); 13036 } 13037 13038 $window.off('scroll.headerResizeEffect', smallNav); 13039 $window.on('scroll.headerResizeEffect', bigNav); 13040 13041 // Dark slider coloring border 13042 $('#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'); 13043 $('#header-outer[data-transparent-header="true"] .cart-menu').css('transition', 'none'); 13044 setTimeout(function () { 13045 $('#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'); 13046 $('#header-outer[data-transparent-header="true"] .cart-menu').css('transition', 'border-color 0.30s ease'); 13047 }, 300); 13048 13049 } 13050 13051 } 13052 13053 13054 /** 13055 * Return header navigation size to full. 13056 * 13057 * Used when "Header Resize On Scroll" is active. 13058 * 13059 * @since 1.0 13060 */ 13061 function bigNav() { 13062 13063 var $offset = nectarDOMInfo.scrollTop, 13064 $windowWidth = nectarDOMInfo.winW, 13065 $scrollTriggerOffset = ($body.hasClass('material')) ? 150 : 30; 13066 13067 if ($body.is('.material-ocm-open')) { 13068 return false; 13069 } 13070 13071 if( headerTransparent == true ) { 13072 $scrollTriggerOffset = 0; 13073 } 13074 13075 if ($offset <= $scrollTriggerOffset && $windowWidth >= 1000 || $('.small-nav').length > 0 && $('#ajax-content-wrap.no-scroll').length > 0) { 13076 13077 $('#header-outer, #search-outer').removeClass('small-nav'); 13078 13079 if ($('#header-outer[data-megamenu-rt="1"]').length > 0 && 13080 $('#header-outer[data-transparent-header="true"]').length > 0 && 13081 $('#header-outer .megamenu').length > 0) { 13082 13083 if ($headerOuterEl.attr('data-transparent-header') == 'true' && 13084 $('.nectar-box-roll').length == 0 && 13085 $('.megamenu.sfHover').length == 0) { 13086 13087 $headerOuterEl.addClass('transparent'); 13088 $headerOuterEl.removeClass('no-transition'); 13089 } 13090 13091 } else { 13092 13093 if ($headerOuterEl.attr('data-transparent-header') == 'true' && $('.nectar-box-roll').length == 0) { 13094 $headerOuterEl.addClass('transparent'); 13095 } 13096 13097 } 13098 13099 // Body border full width side padding 13100 if ($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 && 13101 $bodyBorderTop.length > 0 && 13102 $bodyBorderHeaderColorMatch == true) { 13103 13104 $('#header-outer[data-full-width="true"] header > .container').stop(true, true).animate({ 13105 'padding': '0 28px' 13106 }, { 13107 queue: false, 13108 duration: 250, 13109 easing: 'easeOutCubic' 13110 }); 13111 13112 } 13113 13114 13115 if ($('body.material').length > 0) { 13116 13117 $('header#top nav > ul > li.menu-item-with-margin').stop(true, true).animate({ 13118 'margin-right': (parseInt($('header#top nav > ul > li.menu-item-with-margin').css('margin-right')) + parseInt(logoShrinkNum) * 3) + 'px' 13119 }, { 13120 queue: false, 13121 duration: 140, 13122 easing: 'easeOutQuad' 13123 }); 13124 13125 } 13126 13127 13128 // Secondary header 13129 if ($headerSecondaryEl.length > 0) { 13130 13131 $headerSecondaryEl.removeClass('hide-up'); 13132 $headerOuterEl 13133 .removeClass('hide-up') 13134 .css('transform', 'translateY(0%)'); 13135 13136 } 13137 13138 // Box roll 13139 if ($('.nectar-box-roll').length > 0 && $('#header-outer[data-permanent-transparent="1"]').length == 0) { 13140 $('#ajax-content-wrap').animate({ 13141 'margin-top': (Math.floor(($logoHeight) + (headerPadding * 2) + nectarDOMInfo.adminBarHeight + nectarDOMInfo.secondaryHeaderHeight)) 13142 }, {
13143 queue: false, 13144 duration: 250, 13145 easing: 'easeOutCubic' 13146 }); 13147 } 13148 13149 $window.off('scroll.headerResizeEffect', bigNav); 13150 $window.on('scroll.headerResizeEffect', smallNav); 13151 13152 // Dark slider coloring border 13153 $('#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'); 13154 $('#header-outer[data-transparent-header="true"] .cart-menu').css('transition', 'none'); 13155 setTimeout(function () { 13156 $('#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'); 13157 $('#header-outer[data-transparent-header="true"] .cart-menu').css('transition', 'border-color 0.30s ease'); 13158 }, 300); 13159 } 13160 13161 } 13162 13163 13164 13165 /** 13166 * Default scroll event to handle transparency/secondary header when no header effects are enabled. 13167 * 13168 * @since 4.0 13169 */ 13170 function opaqueCheck() { 13171 13172 // The condense header effect will bypass this unless in the custom mobile breakpoint (which is defined in theme options). 13173 if ($('#header-outer[data-format="centered-menu-bottom-bar"][data-condense="true"]').length > 0 && !$headerOuterEl.hasClass('within-custom-breakpoint') ) { 13174 return; 13175 } 13176 13177 if (nectarDOMInfo.scrollTop > 0) { 13178 13179 if ($('body.material').length > 0) { 13180 $headerOuterEl.addClass('scrolled-down'); 13181 13182 // Secondary header 13183 if ($headerSecondaryEl.length > 0 && nectarDOMInfo.winW > 1000) { 13184 $headerSecondaryEl.addClass('hide-up'); 13185 $headerOuterEl.css('transform', 'translateY(-' + nectarDOMInfo.secondaryHeaderHeight + 'px)'); 13186 } 13187 } 13188 13189 if ($headerOuterEl.attr('data-transparent-header') == 'true' && $('#header-outer[data-permanent-transparent="1"]').length == 0) { 13190 $headerOuterEl.removeClass('transparent').addClass('scrolled-down'); 13191 } 13192 13193 // Switch event to watch. 13194 $window.off('scroll.headerResizeEffectOpaque', opaqueCheck); 13195 $window.on('scroll.headerResizeEffectOpaque', transparentCheck); 13196 } 13197 } 13198 13199 13200 /** 13201 * Default scroll event to handle transparency/secondary header when no header effects are enabled. 13202 * 13203 * @since 4.0 13204 */ 13205 function transparentCheck() { 13206 13207 // The condense header effect will bypass this unless in the custom mobile breakpoint (which is defined in theme options). 13208 if ($('#header-outer[data-format="centered-menu-bottom-bar"][data-condense="true"]').length > 0 && !$headerOuterEl.hasClass('within-custom-breakpoint') ) { 13209 return; 13210 } 13211 13212 if (nectarDOMInfo.scrollTop == 0 && $('body.material-ocm-open').length == 0) { 13213 13214 if ($('#header-outer[data-megamenu-rt="1"]').length > 0 && 13215 $('#header-outer[data-transparent-header="true"]').length > 0 && 13216 $('#header-outer .megamenu').length > 0) { 13217 13218 if ($headerOuterEl.attr('data-transparent-header') == 'true' && $('.megamenu.sfHover').length == 0) { 13219 13220 $headerOuterEl 13221 .addClass('transparent') 13222 .removeClass('scrolled-down'); 13223 13224 $headerOuterEl.removeClass('no-transition'); 13225 13226 } else if ($headerOuterEl.attr('data-transparent-header') == 'true') { 13227 13228 $headerOuterEl.removeClass('scrolled-down'); 13229 } 13230 13231 } else { 13232 13233 if ($headerOuterEl.attr('data-transparent-header') == 'true') { 13234 $headerOuterEl 13235 .addClass('transparent') 13236 .removeClass('scrolled-down'); 13237 } 13238 13239 } 13240 13241 if ($('body.material').length > 0) { 13242 $headerOuterEl.removeClass('scrolled-down'); 13243 13244 // Secondary header 13245 if ($headerSecondaryEl.length > 0 && nectarDOMInfo.winW > 1000) { 13246 13247 $headerSecondaryEl.removeClass('hide-up'); 13248 $headerOuterEl 13249 .removeClass('hide-up') 13250 .css('transform', 'translateY(0%)'); 13251 } 13252 } 13253 13254 // Switch event to watch. 13255 $window.off('scroll.headerResizeEffectOpaque', transparentCheck); 13256 $window.on('scroll.headerResizeEffectOpaque', opaqueCheck); 13257 } 13258 13259 } 13260 13261 13262 13263 13264 /** 13265 * Mobile header event for handling transparency/secondary header. 13266 * 13267 * @since 10.5 13268 * @see bindScrollEffectsMobile 13269 */ 13270 function mobileHeaderRAF() { 13271 13272 if ($('body.material-ocm-open').length > 0) { 13273 requestAnimationFrame(mobileHeaderRAF); 13274 return; 13275 } 13276 // Scrolled down. 13277 if (nectarDOMInfo.scrollTop > 5) { 13278 13279 if (!$headerOuterEl.is('[data-permanent-transparent="1"]')) { 13280 $headerOuterEl.removeClass('transparent'); 13281 } 13282 13283 if (nectarDOMInfo.secondaryHeaderHeight > 0) { 13284 $headerSecondaryEl.addClass('hide-up'); 13285 $headerOuterEl.css('transform', 'translateY(-' + nectarDOMInfo.secondaryHeaderHeight + 'px)').addClass('hidden-secondary'); 13286 } else { 13287 $headerOuterEl.removeClass('hidden-secondary'); 13288 } 13289 13290 } 13291 // At top. 13292 else { 13293 13294 if ($headerOuterEl.is('[data-transparent-header="true"]')) { 13295 $headerOuterEl.addClass('transparent'); 13296 } 13297 13298 if (nectarDOMInfo.secondaryHeaderHeight > 0) { 13299 $headerSecondaryEl.removeClass('hide-up'); 13300 $headerOuterEl.css('transform', 'translateY(0px)'); 13301 } 13302 $headerOuterEl.removeClass('hidden-secondary'); 13303 13304 } 13305 13306 if (nectarDOMInfo.winW < 1000) { 13307 requestAnimationFrame(mobileHeaderRAF); 13308 } 13309 } 13310 13311 13312 13313 /** 13314 * Bind mobile header scroll effects. 13315 * 13316 * @since 10.5 13317 * @see headerNavScrollInit 13318 */ 13319 function bindScrollEffectsMobile() { 13320 13321 if (nectarDOMInfo.winW > 999) { 13322 return; 13323 } 13324 13325 // Unbind desktop effects. 13326 $window.off('scroll.headerResizeEffect'); 13327 $window.off('scroll.headerResizeEffectOpaque'); 13328 13329 // Remove HHUN classes. 13330 $headerOuterEl 13331 .removeClass('scrolled-down') 13332 .removeClass('detached') 13333 .removeClass('invisible') 13334 .removeClass('at-top') 13335 .css('transform', 'none'); 13336 13337 // Handle mobile transparent class. 13338 if ($('#header-outer[data-mobile-fixed="1"]').length > 0) { 13339 requestAnimationFrame(mobileHeaderRAF); 13340 } else if ($headerOuterEl.attr('data-transparent-header') == 'true') { 13341 $headerOuterEl.addClass('transparent'); 13342 } 13343 13344 $window.off('smartresize.nectarNavScrollEffects'); 13345 $window.on('smartresize.nectarNavScrollEffects', bindScrollEffectsDesktop); 13346 13347 } 13348 13349 /** 13350 * Bind deaktop header scroll effects. 13351 * 13352 * @since 10.5 13353 * @see headerNavScrollInit 13354 */ 13355 function bindScrollEffectsDesktop() { 13356 13357 if (nectarDOMInfo.winW < 1000) { 13358 return; 13359 } 13360 13361 if (headerResize == true && headerHideUntilNeeded != '1') { 13362 13363 $window.off('scroll.headerResizeEffect'); 13364 13365 if ($('#nectar_fullscreen_rows').length == 0) { 13366 $window.on('scroll.headerResizeEffect', smallNav); 13367 } else if ($('#nectar_fullscreen_rows[data-mobile-disable="on"]').length > 0 && nectarDOMInfo.usingMobileBrowser) { 13368 $window.on('scroll.headerResizeEffect', smallNav); 13369 } 13370 13371 } else if (headerHideUntilNeeded != '1') { 13372 13373 $window.off('scroll.headerResizeEffectOpaque'); 13374 $window.on('scroll.headerResizeEffectOpaque', opaqueCheck); 13375 13376 }
13376 else if (headerHideUntilNeeded == '1') { 13377 13378 13379 if ($('.nectar-box-roll').length > 0) { 13380 $headerOuterEl.addClass('at-top-before-box'); 13381 } 13382 13383 // Don't trigger for header remove stickiness. 13384 if ($('#header-outer[data-remove-fixed="1"]').length == 0) { 13385 hhunHeaderEffect(); 13386 } 13387 13388 } //end if hhun 13389 13390 // Condense header effect coming from mobile. 13391 if ($('#header-outer[data-format="centered-menu-bottom-bar"][data-condense="true"]').length > 0 ) { 13392 13393 if( $headerSecondaryEl.length > 0 ) { 13394 // Remove transform. 13395 $headerOuterEl.css('transform',''); 13396 } 13397 13398 if ( nectarDOMInfo.scrollTop > 200 && !$headerOuterEl.hasClass('fixed-menu') ) { 13399 $headerOuterEl.addClass('fixed-menu'); 13400 } 13401 13402 } 13403 13404 // Only bind mobile if applicable. 13405 13406 $window.off('smartresize.nectarNavScrollEffects'); 13407 $window.on('smartresize.nectarNavScrollEffects', bindScrollEffectsMobile); 13408 13409 } 13410 13411 13412 13413 /** 13414 * Header Navigation scroll events initialization. 13415 * 13416 * @since 10.5 13417 */ 13418 function headerNavScrollInit() { 13419 13420 // Remove transparent class if page loaded further down. 13421 if ($('#header-outer[data-remove-fixed="1"]').length == 0 && nectarDOMInfo.winW > 1000) { 13422 if ( $(window).scrollTop() != 0 && $('#header-outer.transparent[data-permanent-transparent="false"]').length == 1) { 13423 $headerOuterEl.removeClass('transparent'); 13424 } 13425 } 13426 13427 // Permanent transparent header. 13428 if ($('#nectar_fullscreen_rows').length == 0 && $('.nectar-box-roll').length == 0) { 13429 midnightInit(); 13430 } 13431 13432 // Determine which events to bind at start. 13433 if (nectarDOMInfo.winW < 1000 && $('.nectar-box-roll').length == 0) { 13434 bindScrollEffectsMobile(); 13435 $window.on('smartresize.nectarNavScrollEffects', bindScrollEffectsMobile); 13436 } else { 13437 bindScrollEffectsDesktop(); 13438 $window.on('smartresize.nectarNavScrollEffects', bindScrollEffectsDesktop); 13439 } 13440 13441 } 13442 13443 13444 13445 13446 13447 13448 /** 13449 * Set the header space div height. 13450 * 13451 * @since 10.5 13452 */ 13453 function headerSpace() { 13454 13455 if ($('.mobile').length > 0) { 13456 13457 if (nectarDOMInfo.winH < nectarDOMInfo.winW && nectarDOMInfo.winW > 1000) { 13458 if ($('#header-outer.small-nav').length == 0) { 13459 $('#header-space').css('height', $headerOuterEl.outerHeight()); 13460 } 13461 } else { 13462 $('#header-space').css('height', $headerOuterEl.outerHeight()); 13463 } 13464 13465 } else { 13466 13467 if ($('.nectar-parallax-scene.first-section').length == 0) { 13468 13469 var headerPadding2 = headerPadding - headerPadding / 1.8; 13470 var $headerHeight = ($('#header-outer[data-header-resize="1"]').length > 0 && $('.small-nav').length > 0) ? $headerOuterEl.outerHeight() + (parseInt(logoShrinkNum) + headerPadding2 * 2) : $headerOuterEl.outerHeight(); 13471 13472 $('#header-space').css('height', $headerHeight); 13473 13474 } 13475 13476 } 13477 13478 } 13479 13480 13481 13482 /** 13483 * Handle header nav distance away from top to account for admin bar. 13484 * 13485 * @since 10.5 13486 */ 13487 13488 function headerNavOffsetInit() { 13489 13490 var lastPosition = -1; 13491 var $headerScrollTop = nectarDOMInfo.scrollTop; 13492 13493 // Verify scroll pos has changed before calculating. 13494 function headerOffsetAdjust() { 13495 13496 if ( $body.hasClass('compose-mode') ) { 13497 return; 13498 } 13499 13500 $headerScrollTop = nectarDOMInfo.scrollTop; 13501 13502 if (lastPosition == $headerScrollTop) { 13503 requestAnimationFrame(headerOffsetAdjust); 13504 return false; 13505 } else { 13506 lastPosition = $headerScrollTop; 13507 } 13508 13509 headerOffsetAdjustCalc(); 13510 requestAnimationFrame(headerOffsetAdjust); 13511 13512 } 13513 13514 // Called when scrolling occurs. 13515 function headerOffsetAdjustCalc() { 13516 13517 var $eleHeight = 0; 13518 13519 // Mobile. 13520 if ($('body.mobile').length > 0 || (condenseHeaderLayout == true && $('#header-outer .span_9').css('display') == 'none')) { 13521 13522 $eleHeight = 0; 13523 var $endOffset = ($wpAdminBar.css('position') == 'fixed') ? $wpAdminBar.height() : 0; 13524 13525 $eleHeight += nectarDOMInfo.adminBarHeight; 13526 13527 if ($eleHeight - $headerScrollTop > $endOffset) { 13528 $headerOuterEl.css('top', $eleHeight - $headerScrollTop + 'px'); 13529 } else { 13530 $headerOuterEl.css('top', $endOffset); 13531 } 13532 13533 } 13534 // Desktop 13535 else { 13536 if ( condenseHeaderLayout == false ) { 13537 13538 $eleHeight = 0; 13539 13540 if( !$headerOuterEl.is('[data-remove-fixed="1"]') ) { 13541 $eleHeight += nectarDOMInfo.adminBarHeight; 13542 } 13543 $headerOuterEl.css('top', $eleHeight + 'px'); 13544 } 13545 } 13546 13547 } 13548 13549 // Bind event and begin if needed. 13550 if ($('#header-outer[data-mobile-fixed="1"]').length > 0 && $wpAdminBar.length > 0) { 13551 13552 if ($('#nectar_fullscreen_rows').length == 0) { 13553 requestAnimationFrame(headerOffsetAdjust); 13554 } else if ($('#nectar_fullscreen_rows').length > 0 && nectarDOMInfo.usingMobileBrowser) { 13555 requestAnimationFrame(headerOffsetAdjust); 13556 } 13557 13558 $window.smartresize(headerOffsetAdjustCalc); 13559 13560 } 13561 13562 } 13563 13564 13565 13566 13567 13568 13569 13570 /** 13571 * Calculate the minimum body height when using the footer reveal effect or material OCM 13572 * 13573 * @since 7.0 13574 */ 13575 function footerRevealCalcs() { 13576 13577 var $headerNavSpace = ''; 13578 13579 if( $headerOuterEl.is('[data-logo-height]') && $headerOuterEl.is('[data-padding]') ) { 13580 13581 if( $headerOuterEl.find('#logo.no-image').length > 0 ) { 13582 $headerNavSpace = ( headerLayoutFormat == 'left-header' && nectarDOMInfo.winW > 1000) ? 0 : parseInt($headerOuterEl.find('#logo.no-image').height()) + (parseInt($headerOuterEl.attr('data-padding')*2)); 13583 } else { 13584 $headerNavSpace = ( headerLayoutFormat == 'left-header' && nectarDOMInfo.winW > 1000) ? 0 : parseInt($headerOuterEl.attr('data-logo-height')) + (parseInt($headerOuterEl.attr('data-padding')*2)); 13585 } 13586 13587 } else { 13588 $headerNavSpace = ( headerLayoutFormat == 'left-header' && nectarDOMInfo.winW > 1000) ? 0 : $headerOuterEl.outerHeight(); 13589 } 13590 13591 13592 if (nectarDOMInfo.winH - nectarDOMInfo.adminBarHeight - $headerNavSpace - nectarDOMInfo.footerOuterHeight - 1 - $pageHeaderBG.height() - $('.page-header-no-bg').height() > 0) { 13593 13594 var $resizeExtra = ($('body:not(.material) #header-outer[data-header-resize="1"]').length > 0) ? 55 : 0; 13595 13596 $('body[data-footer-reveal="1"] .container-wrap').css({ 13597 'margin-bottom': nectarDOMInfo.footerOuterHeight 13598 }); 13599 13600 $('.container-wrap').css({ 13601 'min-height': nectarDOMInfo.winH - nectarDOMInfo.adminBarHeight - $headerNavSpace - nectarDOMInfo.footerOuterHeight - $('.page-header-no-bg').height() - $pageHeaderBG.height() + $resizeExtra 13602 }); 13603 13604 } else { 13605 $('body[data-footer-reveal="1"] .container-wrap').css({ 13606 'margin-bottom': nectarDOMInfo.footerOuterHeight 13607 }); 13608 } 13609 13610 if (nectarDOMInfo.winW < 1000) { 13611 $footerOuterEl.attr('data-midnight', 'light'); 13612 } 13613 else { 13614 $footerOuterEl.removeAttr('data-midnight'); 13615 } 13616 } 13617 13618 13619 /** 13620 * Initialize footer reveal and bind event 13621 * 13622 * @since 10.5 13623 */ 13624 function footerRevealInit() { 13625 13626 if ($('body[data-footer-reveal="1"]').length >
13626 0 || $('body.material[data-slide-out-widget-area-style="slide-out-from-right"]').length > 0) { 13627 13628 // Don't add on mobile 13629 if( !$body.hasClass('mobile') ) { 13630 $body.addClass('nectar-no-flex-height'); 13631 } 13632 13633 setTimeout(footerRevealCalcs, 60); 13634 footerRevealCalcs(); 13635 13636 $window.on('resize', footerRevealCalcs); 13637 13638 if ($('body[data-footer-reveal="1"][data-footer-reveal-shadow="large_2"]').length > 0) { 13639 $('.container-wrap').css({ 13640 boxShadow: '0 70px 110px -30px ' + $footerOuterEl.css('backgroundColor') 13641 }); 13642 } 13643 13644 } 13645 13646 } 13647 13648 13649 13650 13651 13652 /** 13653 * Switch header navigation BG color to match row BG color that is passes. 13654 * 13655 * Only called when using "Header Inherit Row Color" option. 13656 * 13657 * @since 5.0 13658 */ 13659 function headerRowColorInheritInit() { 13660 13661 if ($('body[data-header-inherit-rc="true"]').length > 0 && $('.mobile').length == 0 && $('#header-outer[data-transparent-header="true"]').length > 0 ) { 13662 13663 var headerOffset = $logoHeight / 2 + headerPadding + nectarDOMInfo.adminBarHeight; 13664 13665 if( $('#header-outer[data-permanent-transparent="1"]').length == 0 ) { 13666 headerOffset = ($logoHeight - logoShrinkNum) + Math.ceil((headerPadding * 2) / 1.8) + nectarDOMInfo.adminBarHeight; 13667 } 13668 13669 $('.main-content > .row > .wpb_row').each(function () { 13670 13671 var $that = $(this); 13672 var $textColor; 13673 13674 var waypoint = new Waypoint({ 13675 element: $that, 13676 handler: function (direction) { 13677 13678 //User is scrolling down. 13679 if (direction == 'down') { 13680 13681 if ($that.find('.row-bg.using-bg-color').length > 0) { 13682 13683 $textColor = ($that.find('> .col.span_12.light').length > 0) ? 'light-text' : 'dark-text'; 13684 13685 $headerOuterEl 13686 .css('background-color', $that.find('.row-bg').css('background-color')) 13687 .removeClass('light-text') 13688 .removeClass('dark-text') 13689 .addClass($textColor); 13690 13691 $headerOuterEl.attr('data-current-row-bg-color', $that.find('.row-bg').css('background-color')); 13692 $('body.material #header-outer .bg-color-stripe').css('background-color', $that.find('.row-bg').css('background-color')); 13693 13694 } else { 13695 13696 $headerOuterEl 13697 .css('background-color', $headerOuterEl.attr('data-user-set-bg')) 13698 .removeClass('light-text') 13699 .removeClass('dark-text'); 13700 13701 $headerOuterEl.attr('data-current-row-bg-color', $headerOuterEl.attr('data-user-set-bg')); 13702 $('body.material #header-outer .bg-color-stripe').css('background-color', ''); 13703 13704 } 13705 13706 } 13707 13708 //User is scrolling up. 13709 else { 13710 13711 if ($that.prev('div.wpb_row').find('.row-bg.using-bg-color').length > 0) { 13712 13713 $textColor = ($that.prev('div.wpb_row').find('> .col.span_12.light').length > 0) ? 'light-text' : 'dark-text'; 13714 13715 $headerOuterEl 13716 .css('background-color', $that.prev('div.wpb_row').find('.row-bg').css('background-color')) 13717 .removeClass('light-text') 13718 .removeClass('dark-text') 13719 .addClass($textColor); 13720 13721 $headerOuterEl.attr('data-current-row-bg-color', $that.prev('div.wpb_row').find('.row-bg').css('background-color')); 13722 $('body.material #header-outer .bg-color-stripe').css('background-color', $that.prev('div.wpb_row').find('.row-bg').css('background-color')); 13723 13724 } else { 13725 13726 $headerOuterEl 13727 .css('background-color', $headerOuterEl.attr('data-user-set-bg')) 13728 .removeClass('light-text') 13729 .removeClass('dark-text'); 13730 13731 $headerOuterEl.attr('data-current-row-bg-color', $headerOuterEl.attr('data-user-set-bg')); 13732 $('body.material #header-outer .bg-color-stripe').css('background-color', ''); 13733 13734 } 13735 13736 } 13737 13738 }, 13739 offset: headerOffset 13740 13741 }); // End of waypoint bind. 13742 13743 }); // End of loop through rows. 13744 13745 } 13746 13747 } 13748 13749 13750 13751 /** 13752 * Page submenu sticky functionality 13753 * 13754 * @since 10.5.2 13755 */ 13756 13757 function stickyPageSubmenuInit() { 13758 13759 var $ = window.jQuery, 13760 Waypoint = window.Waypoint, 13761 $offsetHeight = calcHeaderNavHeight(), 13762 $headerHeight = calcHeaderNavHeight(); 13763 13764 $window.on('smartresize', function () { 13765 13766 $offsetHeight = calcHeaderNavHeight(); 13767 13768 if ($wpAdminBar.length > 0 && 13769 $wpAdminBar.css('position') == 'fixed') { 13770 $offsetHeight += $wpAdminBar.height(); 13771 } 13772 13773 if ($bodyBorderTop.length > 0 && 13774 $window.width() > 1000 && 13775 $('body[data-hhun="1"]').length > 0) { 13776 $offsetHeight += $bodyBorderTop.height(); 13777 } 13778 13779 // Recalc for resizing (same as stuck/unstuck logic below) 13780 if ($('.page-submenu.stuck').length > 0) { 13781 13782 $('.page-submenu.stuck') 13783 .addClass('no-trans') 13784 .css('top', $offsetHeight) 13785 .css('transform', 'translateY(0)').addClass('stuck'); 13786 13787 setTimeout(function () { 13788 $('.page-submenu.stuck').removeClass('no-trans'); 13789 }, 50); 13790 13791 $('.page-submenu.stuck') 13792 .parents('.wpb_row') 13793 .css('z-index', 10000); 13794 13795 // Boxed layout 13796 if ($('#boxed').length > 0) { 13797 13798 var $negMargin = ($window.width() > 1000) ? $('.container-wrap').width() * 0.04 : 39; 13799 13800 $('.page-submenu.stuck').css({ 13801 'margin-left': '-' + $negMargin + 'px', 13802 'width': $('.container-wrap').width() 13803 }); 13804 13805 } 13806 13807 } else { 13808 13809 $('.page-submenu.stuck') 13810 .css('top', '0') 13811 .removeClass('stuck'); 13812 13813 $('.page-submenu.stuck') 13814 .parents('.wpb_row') 13815 .css('z-index', 'auto'); 13816 13817 if ($('#boxed').length > 0) { 13818 $('.page-submenu.stuck').css({ 13819 'margin-left': '0px', 13820 'width': '100%' 13821 }); 13822 } 13823 13824 } 13825 13826 }); 13827 13828 /* http://imakewebthings.com/waypoints/shortcuts/sticky-elements */ 13829 function Sticky(options) { 13830 this.options = $.extend({}, Waypoint.defaults, Sticky.defaults, options); 13831 this.element = this.options.element; 13832 this.$element = $(this.element); 13833 this.createWrapper(); 13834 this.createWaypoint(); 13835 } 13836 13837 /* Private */ 13838 Sticky.prototype.createWaypoint = function () { 13839 13840 var originalHandler = this.options.handler; 13841 13842 $offsetHeight = calcHeaderNavHeight(); 13843 13844 if ($wpAdminBar.length > 0 && $wpAdminBar.css('position') == 'fixed') { 13845 $offsetHeight += $wpAdminBar.height(); 13846 } 13847 13848 if ($bodyBorderTop.length > 0 && $window.width() > 1000 && $('body[data-hhun="1"]').length > 0) { 13849 $offsetHeight += $bodyBorderTop.height(); 13850 } 13851 13852 this.waypoint = new Waypoint($.extend({}, this.options, { 13853 element: this.wrapper, 13854 handler: $.proxy(function (direction) { 13855 var shouldBeStuck = this.options.direction.indexOf(direction) > -1; 13856 var wrapperHeight = shouldBeStuck ? this.$element.outerHeight(true) : ''; 13857 13858 this.$wrapper.height(wrapperHeight); 13859 if (shouldBeStuck) { 13860 13861 this.$element 13862 .addClass('no-trans') 13863 .css('top', $offsetHeight) 13864 .css('transform', 'translateY(0)') 13865 .addClass('stuck'); 13866 13867 var $that = this; 13868 13869 setTimeout(function () { 13870 $that.$element.removeClass('no-trans'); 13871 }, 50); 13872 13873 this.$element.parents('.wpb_row').css('z-index', 10000); 13874 13875 //boxed 13876 if ($('#boxed').length > 0) { 13877 var $negMargin = ($window.width() > 1000) ? $('.container-wrap').width() * 0.04 : 39; 13878 this.$element.css({ 13879 'margin-left': '-' + $negMargin + 'px', 13880 'width': $('.container-wrap').width() 13881 }); 13882 } 13883 13884 } else { 13885 this.$element.css('top', '0').removeClass('stuck'); 13886 13887 if ($('#boxed').length > 0) this.$element.css({ 13888 'margin-left': '0px', 13889 'width': '100%' 13890 }); 13891 } 13892 13893 if (originalHandler) { 13894 originalHandler.call(this, direction); 13895 } 13896 }, this), 13897 offset: $offsetHeight 13898 })); 13899 13900 var $that = this; 13901 13902 13903 setInterval(function () { 13904 13905 if ($('body[data-hhun="1"] #header-outer.detached:not(.invisible)').length > 0) { 13906 13907 var heightToAdjust = $headerOuterEl.outerHeight(); 13908 13909 if( $headerSecondaryEl.length > 0) { 13910 heightToAdjust -= nectarDOMInfo.secondaryHeaderHeight; 13911 } 13912 13913 $that.waypoint.options.offset = $offsetHeight + heightToAdjust; 13914 } 13915 else { 13916 $that.waypoint.options.offset = $offsetHeight; 13917 } 13918 13919 Waypoint.refreshAll(); 13920 13921 }, 100); 13922 13923 13924 }; 13925 13926 /* Private */ 13927 Sticky.prototype.createWrapper = function () { 13928 if (this.options.wrapper) { 13929 this.$element.wrap(this.options.wrapper); 13930 } 13931 this.$wrapper = this.$element.parent(); 13932 this.wrapper = this.$wrapper[0]; 13933 }; 13934 13935 /* Public */ 13936 Sticky.prototype.destroy = function () { 13937 13938 if (this.$element.parent()[0] === this.wrapper) { 13939 this.waypoint.destroy(); 13940 this.$element.removeClass(this.options.stuckClass); 13941 if (this.options.wrapper) { 13942 this.$element.unwrap(); 13943 } 13944 } 13945 13946 }; 13947 13948 Sticky.defaults = { 13949 wrapper: '<div class="sticky-wrapper" />', 13950 stuckClass: 'stuck', 13951 direction: 'down right' 13952 }; 13953
13954 Waypoint.Sticky = Sticky; 13955 13956 } 13957 13958 13959 13960 /** 13961 * Page submenu page builder element. 13962 * 13963 * @since 10.5 13964 */ 13965 13966 function pageSubmenuInit() { 13967 13968 if ($('.page-submenu[data-sticky="true"]').length > 0 && $('#nectar_fullscreen_rows').length == 0) { 13969 13970 stickyPageSubmenuInit(); 13971 13972 // Remove outside of column setups 13973 if ($('.page-submenu').parents('.span_12').find('> .wpb_column').length > 1) { 13974 13975 var pageMenu = $('.page-submenu').clone(), 13976 pageMenuParentRow = $('.page-submenu').parents('.wpb_row'); 13977 13978 $('.page-submenu').remove(); 13979 pageMenuParentRow.before(pageMenu); 13980 } 13981 13982 var sticky = new Waypoint.Sticky({ 13983 element: $('.page-submenu[data-sticky="true"]')[0] 13984 }); 13985 13986 } 13987 13988 // Adjust to be higher. 13989 if ($('#nectar_fullscreen_rows').length == 0) { 13990 13991 $('.page-submenu') 13992 .parents('.wpb_row') 13993 .css('z-index', 10000); 13994 } 13995 13996 // Bind events. 13997 $('.page-submenu .mobile-menu-link').on('click', function () { 13998 13999 $(this).parents('.page-submenu') 14000 .find('ul') 14001 .stop(true) 14002 .slideToggle(350); 14003 14004 return false; 14005 14006 }); 14007 14008 $('.page-submenu ul li a').on('click', function () { 14009 14010 if ($('body.mobile').length > 0) { 14011 $(this).parents('.page-submenu') 14012 .find('ul') 14013 .stop(true) 14014 .slideToggle(350); 14015 } 14016 14017 }); 14018 14019 } 14020 14021 14022 14023 14024 /** 14025 * Page builder full height row option. 14026 * 14027 * @since 8.0 14028 */ 14029 14030 function vcFullHeightRow() { 14031 14032 var $element = $(".vc_row-o-full-height:first"); 14033 if ($element.length) { 14034 14035 var windowHeight, offsetTop, fullHeight; 14036 windowHeight = $window.height(); 14037 14038 $(".vc_row-o-full-height").each(function () { 14039 14040 offsetTop = $(this).offset().top; 14041 14042 if (offsetTop < windowHeight && 14043 $(this).hasClass('top-level') && 14044 !nectarDOMInfo.usingFrontEndEditor) { 14045 14046 fullHeight = 100 - offsetTop / (windowHeight / 100); 14047 $(this).css("min-height", fullHeight + "vh"); 14048 $(this).find('> .col.span_12').css("min-height", fullHeight + "vh"); 14049 14050 } else { 14051 14052 $(this).css("min-height", windowHeight); 14053 $(this).find('> .col.span_12').css("min-height", windowHeight); 14054 14055 } 14056 14057 }); 14058 14059 } 14060 14061 } 14062 14063 14064 /** 14065 * Page builder full height row init. 14066 * 14067 * @since 10.5 14068 */ 14069 14070 function vcFullHeightRowInit() { 14071 14072 if( $('.vc_row-o-full-height').length > 0 ) { 14073 vcFullHeightRow(); 14074 $window.on('smartresize', vcFullHeightRow); 14075 } 14076 14077 } 14078 14079 14080 /** 14081 * Page builder equal height row IE helper. 14082 * 14083 * @since 8.0 14084 */ 14085 function fixIeFlexbox() { 14086 var ua = window.navigator.userAgent, 14087 msie = ua.indexOf("MSIE "); 14088 (msie > 0 || navigator.userAgent.match(/Trident.*rv\:11\./)) && $(".vc_row-o-full-height").each(function () { 14089 "flex" === $(this).find('> .span_12').css("display") && $(this).wrap('<div class="vc_ie-flexbox-fixer"></div>') 14090 }); 14091 14092 if( msie > 0 || navigator.userAgent.match(/Trident.*rv\:11\./)) { 14093 fixIE11Images(); 14094 $(window).on('resize',fixIE11Images); 14095 } 14096 14097 } 14098 14099 /** 14100 * Fix the IE11 bug with max-width 100% on imgs 14101 * 14102 * @since 11.0 14103 */ 14104 function fixIE11Images() { 14105 14106 $('.img-with-aniamtion-wrap img.img-with-animation').each(function() { 14107 14108 if( $(this).parents('.tabbed').length == 0 && $(this).parents('.toggle').length == 0 ) { 14109 14110 var $parentWrap = $(this).parents('.img-with-aniamtion-wrap'); 14111 $parentWrap.css({ 14112 'height' : '' 14113 }); 14114 var height = $(this).height(); 14115 14116 $parentWrap.css({ 14117 'height' : height 14118 }); 14119 14120 } 14121 14122 }); 14123 14124 } 14125 14126 14127 14128 14129 14130 14131 14132 14133 14134 /** 14135 * Recent post height 14136 * 14137 * @since 10.5 14138 */ 14139 function recentPostsTitleOnlyEqualHeight() { 14140 14141 function recentPostHeight() { 14142 14143 $('.blog-recent[data-style="title_only"]').each(function () { 14144 14145 if ($(this).find('> .col').length > 1) { 14146 return false;
14147 } 14148 var $parentsSeletor = $(this).parent().parent().parent(); 14149 14150 if ($parentsSeletor.hasClass('vc_col-sm-3') || 14151 $parentsSeletor.hasClass('vc_col-sm-4') || 14152 $parentsSeletor.hasClass('vc_col-sm-6') || 14153 $parentsSeletor.hasClass('vc_col-sm-8') || 14154 $parentsSeletor.hasClass('vc_col-sm-9')) { 14155 14156 if ($('body.mobile').length == 0 && $(this).next('div').length == 0) { 14157 var tallestColumn = 0; 14158 14159 $(this).find('> .col').css('padding', '50px 20px'); 14160 14161 $(this).parents('.span_12').find(' > .wpb_column').each(function () { 14162 14163 if( Math.floor($(this).height()) > tallestColumn ) { 14164 tallestColumn = Math.floor($(this).height()); 14165 } 14166 14167 }); 14168 14169 if (Math.floor($(this).find('> .col').outerHeight(true)) < Math.floor($(this).parents('.wpb_row').height()) - 1) { 14170 $(this).find('> .col').css('padding-top', (tallestColumn - $(this).find('> .col').height()) / 2 + 'px'); 14171 $(this).find('> .col').css('padding-bottom', (tallestColumn - $(this).find('> .col').height()) / 2 + 'px'); 14172 } 14173 14174 } else { 14175 $(this).find('> .col').css('padding', '50px 20px'); 14176 } 14177 } 14178 }); 14179 14180 } 14181 14182 // Set heights. 14183 if( $('.blog-recent[data-style="title_only"]').length > 0 ) { 14184 recentPostHeight(); 14185 $window.on('smartresize',recentPostHeight); 14186 } 14187 14188 } 14189 14190 14191 14192 14193 14194 /** 14195 * Helper to calculate recent post slider height 14196 * 14197 * @since 7.0 14198 */ 14199 function recentPostSliderHeight() { 14200 14201 $('.nectar-recent-posts-slider').each(function () { 14202 14203 var $minHeight = 250, 14204 $definedHeight = parseInt($(this).attr('data-height')), 14205 dif = ($('body[data-ext-responsive="true"]').length > 0) ? $window.width() / 1400 : $window.width() / 1100, 14206 $sliderSelectors = $(this).find('.nectar-recent-post-slide, .flickity-viewport'); 14207 14208 if (nectarDOMInfo.winW > 1000 && $('#boxed').length == 0) { 14209 14210 if ($(this).parents('.full-width-content').length == 0) { 14211 14212 if ($('body[data-ext-responsive="true"]').length > 0 && nectarDOMInfo.winW >= 1400) { 14213 $sliderSelectors.css('height', Math.ceil($definedHeight)); 14214 } else if ($('body[data-ext-responsive="true"]').length == 0 && nectarDOMInfo.winW >= 1100) { 14215 $sliderSelectors.css('height', Math.ceil($definedHeight)); 14216 } else { 14217 $sliderSelectors.css('height', Math.ceil($definedHeight * dif)); 14218 } 14219 14220 } else { 14221 $sliderSelectors.css('height', Math.ceil($definedHeight * dif)); 14222 } 14223 14224 } else { 14225 14226 // Column sliders 14227 var $parentCol = ($(this).parents('.wpb_column').length > 0) ? $(this).parents('.wpb_column') : $(this).parents('.col'); 14228 14229 if ($parentCol.length == 0) { 14230 $parentCol = $('.main-content'); 14231 } 14232 14233 if (!$parentCol.hasClass('vc_span12') && 14234 !$parentCol.hasClass('main-content') && 14235 !$parentCol.hasClass('span_12') && 14236 !$parentCol.hasClass('vc_col-sm-12')) { 14237 14238 var $parentColWidth = sliderColumnDesktopWidth($parentCol), 14239 $aspectRatio = $definedHeight / $parentColWidth; 14240 14241 // Min height 14242 if ($aspectRatio * $parentCol.width() <= $minHeight) { 14243 $sliderSelectors.css('height', $minHeight); 14244 } else { 14245 $sliderSelectors.css('height', $aspectRatio * $parentCol.width()); 14246 } 14247 14248 } 14249 14250 // Regular 14251 else { 14252 14253 // Min height 14254 if ($definedHeight * dif <= $minHeight) { 14255 $sliderSelectors.css('height', $minHeight); 14256 } else { 14257 $sliderSelectors.css('height', Math.ceil($definedHeight * dif)); 14258 } 14259 14260 } 14261 14262 } 14263 14264 }); 14265 14266 } 14267 14268 14269 function sliderColumnDesktopWidth(parentCol) { 14270 14271 var $parentColWidth = 1100, 14272 $columnNumberParsed = $(parentCol).attr('class').match(/\d+/); 14273 14274 if ($columnNumberParsed == '2') { 14275 $parentColWidth = 170 14276 } else if ($columnNumberParsed == '3') { 14277 $parentColWidth = 260 14278 } else if ($columnNumberParsed == '4') { 14279 $parentColWidth = 340 14280 } else if ($columnNumberParsed == '6') { 14281 $parentColWidth = 530 14282 } else if ($columnNumberParsed == '8') { 14283 $parentColWidth = 700 14284 } else if ($columnNumberParsed == '9') { 14285 $parentColWidth = 805 14286 } else if ($columnNumberParsed == '10') { 14287 $parentColWidth = 916.3 14288 } else if ($columnNumberParsed == '12') { 14289 $parentColWidth = 1100 14290 } 14291 14292 return $parentColWidth; 14293 } 14294 14295 14296 /** 14297 * Spit text into separate lines to animate in 14298 * 14299 * @since 7.0 14300 */ 14301 14302 function splitLineText() { 14303 $('.nectar-recent-posts-single_featured.multiple_featured').each(function () { 14304 14305 var $slideClass = ($(this).find('.project-slides').length > 0) ? '.project-slide' : '.nectar-recent-post-slide', 14306 $slideInfoClass = ($(this).find('.project-slides').length > 0) ? '.project-info h1' : '.inner-wrap h2 a'; 14307 14308 $(this).find($slideClass).each(function () { 14309 14310 $(this).find($slideInfoClass).each(function () { 14311 14312 var textArr = $(this).text(); 14313 textArr = textArr.trim(); 14314 textArr = textArr.split(' '); 14315 14316 $(this)[0].innerHTML = ''; 14317 14318 for (var i = 0; i < textArr.length; i++) { 14319 $(this)[0].innerHTML += '<span>' + textArr[i] + '</span> '; 14320 } 14321 14322 }); 14323 14324 $(this).find($slideInfoClass + ' > span').wrapInner('<span class="inner" />'); 14325 14326 }); 14327 14328 }); 14329 14330 } 14331 14332 14333 /** 14334 * Spit text into separate lines to animate in 14335 * 14336 * @since 7.0 14337 */ 14338 14339 function splitLineHeadingMarkup() { 14340 14341 $('.nectar-split-heading[data-animation-type="line-reveal-by-space"]').each(function () { 14342 14343 $(this).find('> *').each(function () { 14344 14345 var textArr = $(this).text(); 14346 textArr = textArr.trim(); 14347 textArr = textArr.split(' '); 14348 14349 $(this)[0].innerHTML = ''; 14350 14351 for (var i = 0; i < textArr.length; i++) { 14352 $(this)[0].innerHTML += '<span>' + textArr[i] + '</span> '; 14353 } 14354 14355 }); 14356 14357 if( !$(this).hasClass('animated-in') ) { 14358 $(this).find('> * > span').wrapInner('<span class="inner" />'); 14359 } else { 14360 $(this).find('> * > span').wrapInner('<span class="inner animated" />'); 14361 } 14362 14363 $(this).addClass('markup-generated'); 14364 14365 }); 14366 14367 $('.nectar-split-heading[data-animation-type="letter-fade-reveal"]').each(function () { 14368 14369 14370 $(this).find('> *').each(function () { 14371 14372 var textArr = $(this).text(); 14373 textArr = textArr.trim(); 14374 textArr = textArr.split(' '); 14375 14376 $(this)[0].innerHTML = ''; 14377 14378 for (var i = 0; i < textArr.length; i++) { 14379 $(this)[0].innerHTML += '<span>' + textArr[i] + '</span> '; 14380 } 14381 14382 }); 14383 14384 14385 $(this).find('span').each(function () { 14386 14387 var $this = $(this); 14388 var textArr = $(this).text().split(''); 14389 14390 $this.empty(); 14391 14392 $.each(textArr, function (i, el) { 14393 $this.append("<span>" + el + "</span"); 14394 }); 14395 14396 }); 14397 14398 $(this).addClass('markup-generated'); 14399 14400 }); 14401 14402 } 14403 14404 function splitLineHeadingInit() { 14405 14406 if( $('.nectar-split-heading[data-animation-type="line-reveal-by-space"]').length > 0 || $('.nectar-split-heading[data-animation-type="letter-fade-reveal"]').length > 0 ) { 14407 // Generate markup. 14408 splitLineHeadingMarkup(); 14409 } 14410 14411 } 14412 14413 14414 /** 14415 * Create recent post sliders 14416 * 14417 * @since 7.0 14418 */ 14419 function recentPostsFlickityInit() { 14420 14421 14422 if ($('.nectar-recent-posts-slider-inner').length > 0) { 14423 14424 var $rpFGroupCells = ($('.nectar-recent-posts-slider_multiple_visible').length > 0) ? '90%' : false;
14425 14426 var $rpF = $('.nectar-recent-posts-slider-inner').flickity({ 14427 contain: true, 14428 groupCells: $rpFGroupCells, 14429 draggable: true, 14430 lazyLoad: false, 14431 imagesLoaded: true, 14432 percentPosition: true, 14433 prevNextButtons: false, 14434 pageDots: true, 14435 resize: true, 14436 setGallerySize: true, 14437 wrapAround: true, 14438 accessibility: false 14439 }); 14440 14441 setTimeout(function () { 14442 $('.nectar-recent-posts-slider-inner').addClass('loaded'); 14443 }, 1150); 14444 var flkty = $rpF.data('flickity'); 14445 14446 $rpF.on('dragStart.flickity', function () { 14447 $('.flickity-viewport').addClass('is-moving'); 14448 }); 14449 14450 $rpF.on('dragEnd.flickity', function () { 14451 $('.flickity-viewport').removeClass('is-moving'); 14452 }); 14453 14454 var $dragTimeout; 14455 14456 $rpF.on('select.flickity', function () { 14457 14458 $('.flickity-viewport').addClass('no-hover'); 14459 clearTimeout($dragTimeout); 14460 $dragTimeout = setTimeout(function () { 14461 $('.flickity-viewport').removeClass('no-hover'); 14462 }, 400); 14463 14464 }); 14465 14466 recentPostSliderHeight(); 14467 $window.on('resize', recentPostSliderHeight); 14468 14469 if (!nectarDOMInfo.usingMobileBrowser && !nectarDOMInfo.usingFrontEndEditor) { 14470 $window.on('resize', recentPostSliderParallaxMargins); 14471 } 14472 14473 14474 } 14475 14476 14477 14478 // Multiple featured controls 14479 function multipleLargeFeaturedInit() { 14480 $('.nectar-recent-posts-single_featured.multiple_featured').each(function (sliderIndex) { 14481 14482 if ($(this).find('> .normal-container').length > 0) { 14483 $(this).find('> .normal-container').remove(); 14484 } 14485 14486 $(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>'); 14487 var $that = $(this); 14488 var tallestFeaturedSlide = 0; 14489 var $slideClickTimeout; 14490 14491 // Store instance 14492 $nectarCustomSliderRotate[sliderIndex] = { 14493 autorotate: '' 14494 }; 14495 14496 $(this).find('.nectar-recent-post-slide').each(function (i) { 14497 14498 if ($(this).find('.recent-post-container').height() > tallestFeaturedSlide) { 14499 $(this).siblings().removeClass('tallest'); 14500 $(this).addClass('tallest'); 14501 tallestFeaturedSlide = $(this).find('.recent-post-container').height(); 14502 } 14503 14504 var $activeClass = (i == 0 && $(this).parents('.nectar-recent-posts-single_featured.multiple_featured[data-autorotate="none"]').length > 0) ? 'class="active"' : ''; 14505 $that.find('.controls').append('<li ' + $activeClass + '><span class="title">' + $(this).find('h2').text() + '</span></li>'); 14506 }); 14507 14508 $(this).addClass('js-loaded'); 14509 14510 14511 // Click event 14512 $(this).find('.controls li').on('click', function (e) { 14513 14514 if ($(this).hasClass('active')) { 14515 return; 14516 } 14517 14518 if (e.originalEvent !== undefined) { 14519 $(this).parent().find('.active').addClass('trans-out'); 14520 } 14521 14522 var $index = $(this).index(), 14523 $oldIndex = $(this).parent().find('.active').index(), 14524 $that = $(this); 14525 14526 clearTimeout($slideClickTimeout); 14527 14528 $(this).siblings().removeClass('active'); 14529 $(this).addClass('active'); 14530 14531 $slideClickTimeout = setTimeout(function () { 14532 14533 $that.parents('.multiple_featured') 14534 .find('.nectar-recent-post-slide:not(:eq(' + $index + '))') 14535 .css('opacity', '0') 14536 .removeClass('active'); 14537 14538 $that.parent() 14539 .find('.trans-out') 14540 .removeClass('trans-out'); 14541 14542 }, 300); 14543 14544 $that.parents('.multiple_featured') 14545 .find('.nectar-recent-post-slide:not(:eq(' + $index + '))') 14546 .css('z-index', '10'); 14547 14548 $that.parents('.multiple_featured') 14549 .find('.nectar-recent-post-slide:eq(' + $oldIndex + ')') 14550 .css('z-index', '15'); 14551 14552 $(this).parents('.multiple_featured').find('.nectar-recent-post-slide').eq($index).css({ 14553 'opacity': '1', 14554 'z-index': '20' 14555 }).addClass('active'); 14556 14557 if ($(this).parents('.multiple_featured').attr('data-autorotate') != 'none') { 14558 nectarCustomSliderResetRotate($that.parents('.nectar-recent-posts-single_featured.multiple_featured'), sliderIndex); 14559 } 14560 }); 14561 14562 14563 // Autorotate 14564 $that = $(this); 14565 14566 if ($(this).attr('data-autorotate').length > 0 && 14567 $(this).attr('data-autorotate') != 'none' && 14568 $('body.vc_editor').length == 0) { 14569 14570 setTimeout(function () { 14571 var slide_interval = (parseInt($that.attr('data-autorotate')) < 100) ? 4000 : parseInt($that.attr('data-autorotate')); 14572 14573 $nectarCustomSliderRotate[sliderIndex].autorotate = setInterval(function () { 14574 nectarCustomSliderRotate($that) 14575 }, slide_interval); 14576 14577 // Set first active class 14578 $that 14579 .find('.controls > li:first-child') 14580 .addClass('active'); 14581 14582 }, 30); 14583 14584 } 14585 14586 }); 14587 14588 splitLineText(); 14589 $window.on('resize', splitLineText); 14590 14591 } 14592 14593 multipleLargeFeaturedInit(); 14594 14595 } 14596 14597 14598 14599 /** 14600 * Default recent post slider parallax RAF loop. 14601 * 14602 * @since 7.0 14603 */ 14604 function recentPostSliderParallax() { 14605 14606 $('.nectar-recent-posts-slider').each(function () { 14607 14608 var $offset = parseInt($(this).find('.flickity-slider').position().left), 14609 $slides = $(this).find('.nectar-recent-post-slide'), 14610 $slideLength = $slides.length, 14611 $slideWidth = $slides.width(), 14612 $lastChildIndex = $(this).find('.nectar-recent-post-slide:last-child').index(), 14613 $slideFirstChildBG = $(this).find('.nectar-recent-post-slide:first-child .nectar-recent-post-bg'), 14614 $slideLastChildBG = $(this).find('.nectar-recent-post-slide:last-child .nectar-recent-post-bg'); 14615 14616 // First going to last 14617 if ($offset >= -3) { 14618 $slideLastChildBG.css('margin-left', parseInt(Math.ceil($slideWidth / 3.5)) + 'px'); 14619 } else { 14620 $slideLastChildBG.css('margin-left', '-' + parseInt(Math.ceil($slideWidth / 3.5 * $lastChildIndex)) + 'px'); 14621 } 14622 14623 // Last going to first 14624 if (Math.abs($offset) >= ($slideLength - 1) * $slideWidth) { 14625 $slideFirstChildBG.css('margin-left', '-' + parseInt(Math.ceil(($slideWidth / 3.5) * $slideLength)) + 'px'); 14626 } else { 14627 $slideFirstChildBG.css('margin-left', '0px'); 14628 } 14629 14630 $(this) 14631 .find('.nectar-recent-post-bg') 14632 .css('transform', 'translateX(' + Math.ceil($(this).find('.flickity-slider').position().left / -3.5) + 'px)'); 14633 14634 }); 14635 14636 requestAnimationFrame(recentPostSliderParallax); 14637 14638 } 14639 14640 /** 14641 * Default recent post slider margin calculations. 14642 * 14643 * @since 7.0 14644 */ 14645 function recentPostSliderParallaxMargins() { 14646 14647 $('.nectar-recent-posts-slider').each(function () { 14648 14649 var $slideWidth = $(this).find('.nectar-recent-post-slide').width(); 14650 14651 $(this).find('.nectar-recent-post-slide').each(function (i) { 14652 $(this).find('.nectar-recent-post-bg').css('margin-left', '-' + parseInt(Math.ceil($slideWidth / 3.5) * i) + 'px'); 14653 }); 14654 14655 }); 14656 14657 } 14658 14659 14660 14661 /** 14662 * Initialize all recent post elements. 14663 * 14664 * @since 7.0 14665 */
14666 function recentPostsInit() { 14667 14668 // Start flickity based sliders. 14669 recentPostsFlickityInit(); 14670 14671 14672 // Classic enhanced specific 14673 $('.blog-recent[data-style="classic_enhanced_alt"] .inner-wrap').each(function () { 14674 $(this).find('.post-featured-img').each(function () { 14675 var $src = $(this).find('img').attr('src'); 14676 $(this).css('background-image', 'url(' + $src + ')'); 14677 }); 14678 }); 14679 14680 $('.blog-recent[data-style="classic_enhanced"]').each(function () { 14681 if ($(this).find('.inner-wrap.has-post-thumbnail').length == 0) { 14682 $(this).addClass('no-thumbs'); 14683 } 14684 }); 14685 14686 // Regular recent posts slider. 14687 if (!nectarDOMInfo.usingMobileBrowser) { 14688 if ($('.nectar-recent-posts-slider').length > 0 && !nectarDOMInfo.usingFrontEndEditor) { 14689 window.requestAnimationFrame(recentPostSliderParallax); 14690 } 14691 } 14692 14693 if (!nectarDOMInfo.usingMobileBrowser && !nectarDOMInfo.usingFrontEndEditor) { 14694 recentPostSliderParallaxMargins(); 14695 } 14696 14697 } 14698 14699 14700 14701 14702 /** 14703 * Parallax on mousemove effect 14704 * 14705 * @since 10.5 14706 */ 14707 function parallaxItemHoverEffect() { 14708 14709 //change sizer pos 14710 $('.style-5').each(function () { 14711 $(this) 14712 .find('.sizer') 14713 .insertBefore($(this).find('.parallaxImg')); 14714 }); 14715 14716 // Set parent zindex 14717 $('.style-5') 14718 .parents('.wpb_row') 14719 .css('z-index', '100'); 14720 14721 var d = document, 14722 bd = d.getElementsByTagName('body')[0], 14723 win = window, 14724 imgs = d.querySelectorAll('.parallaxImg'), 14725 totalImgs = imgs.length, 14726 supportsTouch = 'ontouchstart' in win || navigator.msMaxTouchPoints; 14727 14728 if (totalImgs <= 0) { 14729 return; 14730 } 14731 14732 // Build HTML 14733 for (var l = 0; l < totalImgs; l++) { 14734 14735 var thisImg = imgs[l], 14736 layerElems = thisImg.querySelectorAll('.parallaxImg-layer'), 14737 totalLayerElems = layerElems.length; 14738 14739 if (totalLayerElems <= 0) { 14740 continue; 14741 } 14742 14743 while (thisImg.firstChild) { 14744 thisImg.removeChild(thisImg.firstChild); 14745 } 14746 14747 var lastMove = 0; 14748 14749 //throttle performance old browsers 14750 var eventThrottle = 80; 14751 if ( navigator.userAgent.indexOf("Chrome") > -1 && navigator.userAgent.indexOf("Edge/") < 1 ) { 14752 eventThrottle = 1; 14753 $('html').addClass('cssreflections'); 14754 } else { 14755 $body.addClass('cssreflections'); 14756 } 14757 14758 var containerHTML = d.createElement('div'), 14759 shineHTML = d.createElement('div'), 14760 shadowHTML = d.createElement('div'), 14761 layersHTML = d.createElement('div'), 14762 layers = []; 14763 14764 thisImg.id = 'parallaxImg__' + l; 14765 containerHTML.className = 'parallaxImg-container'; 14766 shadowHTML.className = 'parallaxImg-shadow'; 14767 layersHTML.className = 'parallaxImg-layers'; 14768 14769 for (var i = 0; i < totalLayerElems; i++) { 14770 14771 var layer = d.createElement('div'), 14772 layerInner = d.createElement('div'), 14773 imgSrc = layerElems[i].getAttribute('data-img'); 14774 14775 $(layer).html($(layerElems[i]).html()); 14776 layer.className = 'parallaxImg-rendered-layer'; 14777 layer.setAttribute('data-layer', i); 14778 14779 if (i == 0 && $(thisImg).parents('.wpb_gallery').length == 0) { 14780 layerInner.className = 'bg-img'; 14781 layerInner.style.backgroundImage = 'url(' + imgSrc + ')'; 14782 layer.appendChild(layerInner); 14783 } 14784 layersHTML.appendChild(layer); 14785 14786 layers.push(layer); 14787 } 14788 14789 containerHTML.appendChild(layersHTML); 14790 thisImg.appendChild(containerHTML); 14791 $(thisImg).wrap('<div class="parallaxImg-wrap" />'); 14792 if (!(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1)) { 14793 $(thisImg).parent().append(shadowHTML); 14794 } 14795 14796 if (supportsTouch && $('body.using-mobile-browser').length > 0) { 14797 // Stop processing. 14798 } else { 14799 (function (_thisImg, _layers, _totalLayers, _shine) { 14800 $(thisImg).parents('.style-5').on('mousemove', function (e) { 14801 14802 var parentEl = $(this); 14803 var parallaxContainer = parentEl.find('.parallaxImg-container'); 14804 var parallaxShad = parentEl.find('.parallaxImg-shadow'); 14805 14806 var now = Date.now(); 14807 14808 var usingGallery = ($(_thisImg).parents('.wpb_gallery').length > 0) ? true : false;
14809 14810 if (now > lastMove + eventThrottle) { 14811 lastMove = now; 14812 window.requestAnimationFrame(function () { 14813 processMovement(e, false, _thisImg, _layers, _totalLayers, _shine, parentEl, parallaxContainer, parallaxShad, usingGallery); 14814 }); 14815 } 14816 14817 14818 }); 14819 $(thisImg).parents('.style-5').on('mouseenter', function (e) { 14820 processEnter(e, _thisImg, _layers, _totalLayers, _shine); 14821 }); 14822 $(thisImg).parents('.style-5').on('mouseleave', function (e) { 14823 processExit(e, _thisImg, _layers, _totalLayers, _shine); 14824 }); 14825 })(thisImg, layers, totalLayerElems, shineHTML); 14826 } 14827 14828 // Set the depths 14829 (function (_thisImg, _layers, _totalLayers, _shine) { 14830 depths(false, _thisImg, _layers, _totalLayers, _shine); 14831 window.addEventListener('resize', function () { 14832 depths(false, _thisImg, _layers, _totalLayers, _shine); 14833 }); 14834 })(thisImg, layers, totalLayerElems, shineHTML); 14835 } 14836 14837 function processMovement(e, touchEnabled, elem, layers, totalLayers, shine, parentEl, parallaxContainer, parallaxShad, usingGal) { 14838 14839 // Stop raf if exit already called 14840 if (!$(elem.firstChild).hasClass('over')) { 14841 processExit(e, elem, layers, totalLayers, shine); 14842 return false 14843 } 14844 14845 // Set up multipliers 14846 var yMult = 0.03; 14847 var xMult = 0.063; 14848 14849 var scaleAmount = '1.03'; 14850 var offsetAmount = '-10'; 14851 var usingMasonrySize = false; 14852 14853 if ($(elem).parents('.col.wide').length > 0) { 14854 yMult = 0.03; 14855 xMult = 0.063; 14856 usingMasonrySize = true; 14857 } else if ($(elem).parents('.col.regular').length > 0 || $(elem).parents('.wpb_gallery').length > 0) { 14858 yMult = 0.045; 14859 xMult = 0.045; 14860 } else if ($(elem).parents('.col.tall').length > 0) { 14861 yMult = 0.05; 14862 xMult = 0.015; 14863 usingMasonrySize = true; 14864 } else if ($(elem).parents('.col.wide_tall').length > 0) { 14865 yMult = 0.04; 14866 xMult = 0.04; 14867 usingMasonrySize = true; 14868 } else if (parentEl.hasClass('nectar-fancy-box')) { 14869 yMult = 0.045; 14870 xMult = 0.022; 14871 scaleAmount = '1.06'; 14872 offsetAmount = '-2'; 14873 } else { 14874 yMult = 0.045; 14875 xMult = 0.075; 14876 } 14877 14878 var bdst = nectarDOMInfo.scrollTop, 14879 bdsl = 0, 14880 pageX = (touchEnabled) ? e.touches[0].pageX : e.pageX, 14881 pageY = (touchEnabled) ? e.touches[0].pageY : e.pageY, 14882 offsets = elem.getBoundingClientRect(), 14883 w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth, 14884 h = elem.clientHeight || elem.offsetHeight || elem.scrollHeight, 14885 wMultiple = 320 / w, 14886 offsetX = 0.52 - (pageX - offsets.left - bdsl) / w, 14887 offsetY = 0.52 - (pageY - offsets.top - bdst) / h, 14888 dy = (pageY - offsets.top - bdst) - h / 2, 14889 dx = (pageX - offsets.left - bdsl) - w / 2, 14890 yRotate = (offsetX - dx) * (yMult * wMultiple), 14891 xRotate = (dy - offsetY) * (xMult * wMultiple); 14892 14893 var imgCSS; 14894 14895 if (usingGal == true) { 14896 imgCSS = ' perspective(' + w * 3 + 'px) rotateX(' + -xRotate * 1.9 + 'deg) rotateY(' + -yRotate * 1.3 + 'deg)'; 14897 } else { 14898 14899 if (usingMasonrySize == false) { 14900 imgCSS = ' perspective(' + w * 3 + 'px) rotateX(' + xRotate + 'deg) rotateY(' + yRotate + 'deg) translateY(' + offsetY * offsetAmount + 'px) translateX(' + offsetX * offsetAmount + 'px) scale(' + scaleAmount + ')'; 14901 } else { 14902 imgCSS = ' perspective(' + w * 3 + 'px) rotateX(' + xRotate + 'deg) rotateY(' + yRotate + 'deg) translateY(' + offsetY * -10 + 'px) translateX(' + offsetX * -10 + 'px) scale(1.013)'; 14903 } 14904 14905 } 14906 14907 14908 // Container transform 14909 parallaxContainer.css('transform', imgCSS); 14910 14911 if (!(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1)) { 14912 parallaxShad.css('transform', imgCSS); 14913 } 14914 14915 14916 } 14917 14918 14919 function processEnter(e, elem) { 14920 14921 elem.firstChild.className += ' over'; 14922 elem.className += ' over'; 14923 14924 $(elem).addClass('transition'); 14925 14926 if ($(elem).parents('.wpb_gallery').length > 0) { 14927 setTimeout(function () { 14928 $(elem).removeClass('transition'); 14929 }, 450); 14930 } else { 14931 setTimeout(function () { 14932 $(elem).removeClass('transition'); 14933 }, 200); 14934 } 14935 14936 } 14937 14938 14939 function processExit(e, elem) { 14940 14941 var w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth; 14942 var container = elem.firstChild; 14943 14944 container.className = container.className.replace(' over', ''); 14945 elem.className = elem.className.replace(' over', ''); 14946 $(container).css('transform', 'perspective(' + w * 3 + 'px) rotateX(0deg) rotateY(0deg) translateZ(0)'); 14947 $(elem).parents('.parallaxImg-wrap').find('.parallaxImg-shadow').css('transform', 'perspective(' + w * 3 + 'px) rotateX(0deg) rotateY(0deg) translateZ(0)'); 14948 14949 $(elem).addClass('transition'); 14950 setTimeout(function () { 14951 $(elem).removeClass('transition'); 14952 }, 200); 14953 14954 } 14955 14956 14957 function depths(touchEnabled, elem, layers, totalLayers) { 14958 14959 var w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth; 14960 var container = elem.firstChild; 14961 14962 // Set z 14963 for (var ly = 0; ly < totalLayers; ly++) { 14964 if (ly == 0) { 14965 $(layers[ly]).css('transform', 'translateZ(0px)'); 14966 } 14967 else { 14968 $(layers[ly]).css('transform', 'translateZ(' + (w * 3) / 27 * (ly * 1.1) + 'px) '); 14969 } 14970 14971 } 14972 14973 totalLayers = totalLayers + 3; 14974 14975 // Set perspective from beginning 14976 $(container).css('transform', 'perspective(' + w * 3 + 'px)'); 14977 14978 } 14979 14980 } 14981 14982 14983 /** 14984 * Fancy Box 14985 * 14986 * @since 11.0 14987 */ 14988 function nectarFancyBoxHover() { 14989 14990 if( $('.nectar-fancy-box[data-style="hover_desc"]').length == 0 ) { 14991 return false;
14992 } 14993 14994 var $hoverContentHeight = 0; 14995 14996 $('body').on('mouseenter touchstart','.nectar-fancy-box[data-style="hover_desc"]', function() { 14997 $hoverContentHeight = parseInt($(this).find('.hover-content').outerHeight(true)); 14998 $(this).addClass('hovered'); 14999 $(this).find('.heading-wrap').css('transform','translateY(-'+ $hoverContentHeight +'px)'); 15000 }); 15001 15002 $('body').on('mouseleave touchend','.nectar-fancy-box[data-style="hover_desc"]', function() { 15003 $(this).removeClass('hovered'); 15004 $(this).find('.heading-wrap').css('transform','translateY(0)'); 15005 }); 15006 15007 } 15008 15009 15010 15011 /** 15012 * Mouse Follow Icon 15013 * 15014 * @since 11.0 15015 */ 15016 function NectarMouseFollowIcon(el,iconSelector) { 15017 15018 this.$el = el; 15019 this.$iconEl = this.$el.find(iconSelector); 15020 15021 this.elX = 0; 15022 this.elY = 0; 15023 15024 this.initialX = this.$el.width() / 2; 15025 this.initialY = this.$el.height() / 2; 15026 15027 this.elX = 0; 15028 this.elY = 0; 15029 15030 this.lastScroll = 0; 15031 this.scrollAdjust = 0; 15032 15033 this.lastX = this.initialX; 15034 this.lastY = this.initialY; 15035 this.activeFollow = false; 15036 15037 this.percentage = 0.13; 15038 this.percentageTimeout; 15039 15040 $window.on('resize', this.resizeEvent.bind(this)); 15041 this.mouseEvents(); 15042 this.rafLoop(); 15043 15044 } 15045 15046 NectarMouseFollowIcon.prototype.resizeEvent = function() { 15047 this.initialX = this.$el.width() / 2; 15048 this.initialY = this.$el.height() / 2; 15049 }; 15050 15051 NectarMouseFollowIcon.prototype.mouseEvents = function() { 15052 15053 var that = this; 15054 15055 that.$el.on('mouseenter', function(e) { 15056 15057 that.activeFollow = true; 15058 15059 that.elX = e.offsetX; 15060 that.elY = e.offsetY; 15061 15062 that.lastScroll = 0; 15063 15064 clearTimeout(that.percentageTimeout); 15065 that.percentageTimeout = setTimeout(function(){ 15066 that.percentage = 0.2; 15067 },700); 15068 }); 15069 15070 that.$el.on('mouseleave', function() { 15071 15072 that.activeFollow = false; 15073 that.lastScroll = 0; 15074 15075 clearTimeout(that.percentageTimeout); 15076 that.percentage = 0.13; 15077 }); 15078 15079 that.$el.on('mousemove', function(e){ 15080 that.elX = e.offsetX; 15081 that.elY = e.offsetY; 15082 that.lastScroll = 0; 15083 }); 15084 15085 $(window).on('scroll',function() { 15086 if( that.activeFollow == true && that.lastScroll == 0) { 15087 that.lastScroll = nectarDOMInfo.scrollTop; 15088 } 15089 }); 15090 15091 }; 15092 15093 15094 NectarMouseFollowIcon.prototype.rafLoop = function() { 15095 15096 if( this.activeFollow == true ) { 15097 15098 this.scrollAdjust = ( this.lastScroll > 0 ) ? nectarDOMInfo.scrollTop - this.lastScroll : 0; 15099 15100 this.lastY = linearInterpolate(this.lastY, this.elY + this.scrollAdjust, this.percentage); 15101 this.lastX = linearInterpolate(this.lastX, this.elX, this.percentage); 15102 } else { 15103 this.lastY = linearInterpolate(this.lastY, this.initialY, 0.13); 15104 this.lastX = linearInterpolate(this.lastX, this.initialX, 0.13); 15105 } 15106 15107 this.$iconEl.css({ 15108 'transform': 'translateX(' + this.lastX + 'px) translateY(' + this.lastY + 'px)' 15109 }); 15110 15111 requestAnimationFrame(this.rafLoop.bind(this)); 15112 15113 }; 15114 15115 15116 15117 15118 /** 15119 * Video Lightbox 15120 * 15121 * @since 11.0 15122 */ 15123 function nectarVideoLightbox() { 15124 15125 iconMouseFollowArr = []; 15126 15127 // Parent hover relationship. 15128 $body.on('mouseenter','.nectar_video_lightbox[data-parent-hover="1"]', function() { 15129 var $parentRow = $(this).parents('.wpb_row'); 15130 $parentRow.find('> .row-bg-wrap .row-bg, > .nectar-video-wrap .nectar-video-inner').addClass('transition'); 15131 $parentRow.find('> .row-bg-wrap .row-bg, > .nectar-video-wrap .nectar-video-inner').css({ 15132 'transform' : 'scale(1.08)' 15133 }); 15134 }); 15135 15136 $body.on('mouseleave','.nectar_video_lightbox[data-parent-hover="1"]', function() { 15137 var $parentRow = $(this).parents('.wpb_row'); 15138 $parentRow.find('> .row-bg-wrap .row-bg, > .nectar-video-wrap .nectar-video-inner').css({ 15139 'transform' : 'scale(1)' 15140 }); 15141 }); 15142 15143 // Mouse Indicator. 15144 $('.nectar-video-box').each(function(i){ 15145 15146 if( $(this).find('.play_button_mouse_follow') ) { 15147 15148 var $that = $(this); 15149 15150 $(this).imagesLoaded(function () { 15151 15152 // Follow mouse. 15153 if( !nectarDOMInfo.usingMobileBrowser ) { 15154 iconMouseFollowArr[i] = new NectarMouseFollowIcon($that, '.play_button_mouse_follow'); 15155 } 15156 15157 // Initial setup. 15158 var $playColor = ( $that.is('[data-mouse-icon-color]') && $that.attr('data-mouse-icon-color').length > 0 ) ? $that.attr('data-mouse-icon-color') : '#000'; 15159 15160 if( $that.is('[data-mouse-style="solid_color"]') ) { 15161 15162 $that.find('.play_button_mouse_follow').css({ 15163 'background-color': $playColor 15164 }); 15165 } 15166 15167 $that.find('.play_button_mouse_follow').addClass('visible'); 15168 15169 }); 15170 15171 } 15172 15173 }); 15174 15175 } 15176 15177 15178 15179 /** 15180 * Salient slider rotation 15181 * 15182 * @since 10.5 15183 */ 15184 function nectarCustomSliderRotate(slider) { 15185 15186 if ($('body.vc_editor').length > 0) { 15187 return; 15188 } 15189 15190 var $controlSelector = (slider.find('.project-slides').length > 0) ? '.dot-nav > span' : '.controls > li', 15191 $controlSelectorInd = (slider.find('.project-slides').length > 0) ? 'span' : ' li', 15192 $slideLength = slider.find($controlSelector).length, 15193 $currentSlide = slider.find($controlSelector + '.active').index(); 15194 15195 if ($currentSlide + 1 == $slideLength) { 15196 slider.find($controlSelector + ':first-child').trigger('click'); 15197 } else { 15198 slider.find($controlSelector + '.active').next($controlSelectorInd).trigger('click'); 15199 } 15200 } 15201 15202 15203 /** 15204 * Salient slider rotation reset 15205 * 15206 * @since 10.5 15207 */ 15208 function nectarCustomSliderResetRotate(slider, index) { 15209 clearInterval($nectarCustomSliderRotate[index].autorotate); 15210 15211 // Reinit autorotate 15212 if (slider.attr('data-autorotate').length > 0) { 15213 var slide_interval = (parseInt(slider.attr('data-autorotate')) < 100) ? 4000 : parseInt(slider.attr('data-autorotate')); 15214 $nectarCustomSliderRotate[index].autorotate = setInterval(function () { 15215 nectarCustomSliderRotate(slider) 15216 }, slide_interval); 15217 } 15218 } 15219 15220 15221 15222 /** 15223 * Fullscreen recent project slider 15224 * 15225 * @since 10.5 15226 */ 15227 function fsProjectSliderInit() { 15228 15229 $fsProjectSliderArr = []; 15230 15231 if (typeof SalientRecentProjectsFullScreen === 'undefined') { 15232 return; 15233 } 15234 15235 $('.nectar_fullscreen_zoom_recent_projects').each(function (i) { 15236 $fsProjectSliderArr[i] = new SalientRecentProjectsFullScreen($(this)); 15237 }); 15238 15239 } 15240 15241 15242 15243 15244 15245 /**
15246 * Portfolio single template sticky sidebar 15247 * 15248 * @since 6.0 15249 */ 15250 function portfolioSidebarFollow() { 15251 15252 var sidebarFollow = $('.single-portfolio #sidebar').attr('data-follow-on-scroll'); 15253 15254 if ($('body.single-portfolio').length == 0 || $('#sidebar[data-follow-on-scroll]').length == 0) { 15255 return; 15256 } 15257 15258 sidebarFollow = $('.single-portfolio #sidebar').attr('data-follow-on-scroll'); 15259 15260 if (sidebarFollow == 1 && 15261 !$body.hasClass('mobile') && 15262 parseInt($('#sidebar').height()) + 50 <= parseInt($('.post-area').height())) { 15263 15264 //padding from top of screen 15265 var $ssExtraTopSpace = 50; 15266 15267 if ($('#header-outer[data-remove-fixed="0"]').length > 0 && 15268 $('body[data-hhun="1"]').length == 0) { 15269 15270 $ssExtraTopSpace += $headerOuterEl.outerHeight(); 15271 15272 // Resize effect 15273 if ($('#header-outer[data-shrink-num][data-header-resize="1"]').length > 0) { 15274 var headerPadding2 = parseInt($headerOuterEl.attr('data-padding')) - parseInt($headerOuterEl.attr('data-padding')) / 1.8; 15275 $ssExtraTopSpace -= logoShrinkNum; 15276 $ssExtraTopSpace -= headerPadding2; 15277 } 15278 15279 // Condense 15280 if ($('body.mobile').length == 0 && $('#header-outer[data-condense="true"]').length > 0) { 15281 15282 var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'); 15283 15284 $ssExtraTopSpace = 50; 15285 $ssExtraTopSpace += $headerOuterEl.height() - (parseInt($headerSpan9.position().top) - parseInt($('#header-outer #logo').css('margin-top'))) - parseInt(nectarDOMInfo.secondaryHeaderHeight); 15286 } 15287 15288 } 15289 15290 if ($wpAdminBar.length > 0) { 15291 $ssExtraTopSpace += $wpAdminBar.outerHeight(); 15292 } 15293 15294 15295 $('.single-portfolio #sidebar').theiaStickySidebar({ 15296 additionalMarginTop: $ssExtraTopSpace, 15297 updateSidebarHeight: false 15298 }); 15299 15300 15301 } 15302 15303 } 15304 15305 15306 15307 15308 15309 /** 15310 * Infinite scroll pagination 15311 * 15312 * @since 6.0 15313 */ 15314 function infiniteScrollInit() { 15315 15316 if ($('.infinite_scroll').length > 0) { 15317 15318 // Portfolio 15319 $('.portfolio-items.infinite_scroll').infinitescroll({ 15320 navSelector: "div#pagination", 15321 nextSelector: "div#pagination a:first", 15322 itemSelector: ".portfolio-items.infinite_scroll .element", 15323 finishedMsg: "<em>Congratulations, you've reached the end of the internet.</em>", 15324 msgText: " ", 15325 }, function (newElements) { 15326 15327 15328 var $container = $('.portfolio-items.infinite_scroll:not(.carousel)'), 15329 $newElems = $(newElements).css('opacity', 0); 15330 15331 // Ensure that images load before adding to masonry layout 15332 $newElems.imagesLoaded(function () { 15333 15334 $(newElements).css('opacity', 1); 15335 15336 $container.isotope('appended', $(newElements)); 15337 15338 $(newElements).find('.work-item').addClass('ajax-loaded'); 15339 $(newElements).addClass('ajax-loaded'); 15340
15341 // Show elems now they're ready 15342 $(newElements).find('.work-meta, .nectar-love-wrap').css({ 15343 'opacity': 1 15344 }); 15345 15346 // Keep current filtering 15347 if ($('.portfolio-filters-inline').length > 0 || $('.portfolio-filters').length > 0) { 15348 15349 var selector; 15350 15351 if ($('.portfolio-filters-inline').length > 0) { 15352 selector = $('.portfolio-filters-inline a.active').attr('data-filter'); 15353 } else { 15354 selector = $('.portfolio-filters a.active').attr('data-filter'); 15355 } 15356 15357 $('.portfolio-filters-inline a.active').attr('data-filter'); 15358 $container.isotope({ 15359 filter: selector 15360 }); 15361 } 15362 15363 // Set width 15364 for (var i = 0; i < $portfolio_containers.length; i++) { 15365 $portfolio_containers[i].reLayout(); 15366 } 15367 15368 if ($(newElements).find('.work-item.style-5').length > 0) { 15369 parallaxItemHoverEffect(); 15370 } 15371 15372 if ($(newElements).find('.inner-wrap').attr('data-animation') == 'none') { 15373 $('.portfolio-items .col .inner-wrap').removeClass('animated'); 15374 } else { 15375 15376 for (var i = 0; i < $portfolio_containers.length; i++) { 15377 $portfolio_containers[i].masonryZindex(); 15378 $portfolio_containers[i].portfolioAccentColor(); 15379 } 15380 15381 $(newElements).each(function () { 15382 15383 var $portfolioOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '90%'; 15384 15385 // Not already visible 15386 var $that = $(this); 15387 var waypoint = new Waypoint({ 15388 element: $that, 15389 handler: function () { 15390 15391 var $portfolioAnimationDelay = ($that.is('[data-masonry-type="photography"].masonry-items')) ? 85 : 115; 15392 15393 setTimeout(function () { 15394 $that.addClass("animated-in"); 15395 }, $portfolioAnimationDelay * $that.attr('data-delay-amount')); 15396 15397 15398 waypoint.destroy(); 15399 }, 15400 offset: $portfolioOffsetPos 15401 15402 }); 15403 15404 15405 }); 15406 } 15407 15408 15409 // Lightbox reinit. 15410 $('.portfolio-items').each(function () { 15411 var $unique_id = uniqueIdGenerate(); 15412 $(this).find('a[rel^="prettyPhoto"], a.pretty_photo').attr('rel', 'prettyPhoto[' + $unique_id + '_gal]').removeClass('pretty_photo'); 15413 }); 15414 15415 15416 $('.portfolio-items').each(function () { 15417 var $unique_id = uniqueIdGenerate(); 15418 $(this).find('a[data-fancybox^="group_"]').attr('data-fancybox', 'group_' + $unique_id); 15419 }); 15420 15421 lightBoxInit(); 15422 15423 setTimeout(function () { 15424 15425 for (var i = 0; i < $portfolio_containers.length; i++) { 15426 $portfolio_containers[i].masonryZindex(); 15427 $portfolio_containers[i].reLayout(); 15428 $portfolio_containers[i].isotopeCatSelection(); 15429 } 15430 $(newElements).removeClass('ajax-loaded'); 15431 }, 700); 15432 15433 parallaxRowsBGCals(); 15434 15435 }); 15436 15437 15438 }); 15439 15440 // Blog 15441 $('.post-area.infinite_scroll .posts-container').infinitescroll({ 15442 navSelector: "div#pagination", 15443 nextSelector: "div#pagination a:first", 15444 itemSelector: ".post-area.infinite_scroll .posts-container .post", 15445 finishedMsg: "<em>Congratulations, you've reached the end of the internet.</em>", 15446 msgText: " " 15447 }, function (newElements) { 15448 15449 if($(newElements).find('[data-nectar-img-src]').length > 0) { 15450 nectarLazyImageLoading(); 15451 } 15452 15453 // Only trigger recalc of waypoints and elements if needed 15454 if ($('.masonry.classic').length > 0 || $('.post-area:not(.masonry):not(.featured_img_left)').length > 0 || $('.post-area.standard-minimal').length > 0) { 15455 15456 // Gallery 15457 flexsliderInit(); 15458 15459 15460 // Media players 15461 if ($().mediaelementplayer) { 15462 $(newElements).find('.wp-audio-shortcode, .wp-video-shortcode').mediaelementplayer(); 15463 } 15464 15465 15466 // Lightbox 15467 lightBoxInit(); 15468 15469 // Carousels 15470 if ($('.carousel').length > 0) { 15471 standardCarouselInit(); 15472 clientsCarouselInit(); 15473 } 15474 15475 // Waypoints 15476 waypoints(); 15477 15478 // Testimonial slider 15479 $('.testimonial_slider').animate({ 15480 'opacity': '1' 15481 }, 800); 15482 nectarTestimonialSliders(); 15483 nectarTestimonialSlidersEvents(); 15484 15485 setTimeout(function () { 15486 responsiveVideoIframesInit(); 15487 responsiveVideoIframes(); 15488 $window.trigger('resize'); 15489 }, 500); 15490 15491
15492 parallaxRowsBGCals(); 15493 15494 $window.trigger('resize'); 15495 15496 } // Non meta overlaid style 15497 else { 15498 parallaxRowsBGCals(); 15499 15500 $window.trigger('resize'); 15501 } 15502 15503 // Trigger Masonry as a callback 15504 var $container = $('.infinite_scroll .posts-container'); 15505 if ($container.parent().hasClass('masonry')) { 15506 15507 $(newElements).addClass('masonry-blog-item'); 15508 15509 15510 } //if masonry 15511 15512 15513 // Loading effect 15514 15515 //// hide new items while they are loading 15516 var $newElems = $(newElements); 15517 //// ensure that images load before adding to masonry layout 15518 15519 if ($newElems.find('img').length == 0) { 15520 $newElems = $('body'); 15521 } 15522 15523 $newElems.imagesLoaded(function () { 15524 15525 if ($container.parent().hasClass('masonry') && 15526 !$container.parent().hasClass('auto_meta_overlaid_spaced')) { 15527 $container.isotope('appended', $(newElements)); 15528 } 15529 15530 for (var i = 0; i < $nectarMasonryBlogs.length; i++) { 15531 $nectarMasonryBlogs[i].flickityBlogInit(); 15532 } 15533 15534 $(newElements).addClass('ajax-loaded');
15535 // Show elems now they're ready 15536 15537 15538 // Classic enhanced specific 15539 if ($container.parent().hasClass('classic_enhanced')) { 15540 $container.find('.large_featured.has-post-thumbnail.ajax-loaded .post-featured-img, .wide_tall.has-post-thumbnail.ajax-loaded .post-featured-img').each(function () { 15541 var $src = $(this).find('img').attr('src'); 15542 $(this).css('background-image', 'url(' + $src + ')'); 15543 }); 15544 15545 $container.find('.large_featured.ajax-loaded .nectar-flickity, .wide_tall.ajax-loaded .nectar-flickity').each(function () { 15546 15547 $(this).find('.cell').each(function () { 15548 var $src = $(this).find('img').attr('src'); 15549 $(this).css('background-image', 'url(' + $src + ')'); 15550 }); 15551 15552 }); 15553 } 15554 15555 15556 if ($(newElements).parents('.posts-container').attr('data-animation') == 'none') { 15557 $(newElements).find('.inner-wrap').removeClass('animated'); 15558 } else { 15559 15560 for (var i = 0; i < $nectarMasonryBlogs.length; i++) { 15561 $nectarMasonryBlogs[i].blogMasonryZindex(); 15562 } 15563 15564 $(newElements).each(function () { 15565 15566 var $that = $(this); 15567 var waypoint = new Waypoint({ 15568 15569 element: $that, 15570 handler: function () { 15571 15572 setTimeout(function () { 15573 $that.addClass("animated-in"); 15574 }, 80 * $that.attr('data-delay-amount')); 15575 15576 waypoint.destroy(); 15577 }, 15578 offset: '90%' 15579 15580 }); 15581 15582 15583 }); 15584 } 15585 15586 setTimeout(function () { 15587 $(newElements).removeClass('ajax-loaded'); 15588 }, 700); 15589 15590 15591 }); 15592 15593 15594 }); 15595 15596 } 15597 15598 } 15599 15600 15601 15602 15603 15604 15605 /** 15606 * Scroll to top scroll bind. 15607 * 15608 * @since 2.0 15609 */ 15610 function toTopBind() { 15611 15612 if ($('#to-top').length > 0 && $window.width() > 1020 || 15613 $('#to-top').length > 0 && $('#to-top.mobile-enabled').length > 0) { 15614 15615 if (nectarDOMInfo.scrollTop > 350) { 15616 $window.on('scroll', hideToTop); 15617 } else { 15618 $window.on('scroll', showToTop); 15619 } 15620 } 15621 15622 } 15623 15624 /** 15625 * Scroll to top show. 15626 * 15627 * @since 2.0 15628 */ 15629 function showToTop() { 15630 15631 if (nectarDOMInfo.scrollTop > 350 && !$offCanvasEl.is('.fullscreen.open') ) { 15632 15633 $('#to-top').stop().transition({ 15634 'bottom': '17px' 15635 }, 350, 'easeInOutCubic'); 15636 15637 $window.off('scroll', showToTop); 15638 $window.on('scroll', hideToTop); 15639 } 15640 15641 } 15642 15643 15644 /** 15645 * Scroll to top hide. 15646 * 15647 * @since 2.0 15648 */ 15649 function hideToTop() { 15650 15651 if (nectarDOMInfo.scrollTop < 350 || $offCanvasEl.is('.fullscreen.open') ) { 15652 15653 var $animationTiming = ($('#slide-out-widget-area.fullscreen.open').length > 0) ? 1150 : 350; 15654 15655 $('#to-top').stop().transition({ 15656 'bottom': '-30px' 15657 }, $animationTiming, 'easeInOutQuint'); 15658 15659 $window.off('scroll', hideToTop); 15660 $window.on('scroll', showToTop); 15661 15662 } 15663 } 15664 15665 15666 /** 15667 * Scroll to top initialization. 15668 * 15669 * @since 10.5 15670 */ 15671 function scrollToTopInit() { 15672 15673 // Show/hide based on scroll pos 15674 if ($('.nectar-social.fixed').length == 0) { 15675 toTopBind(); 15676 } 15677 15678 15679 // Rounded style 15680 if ($('body[data-button-style*="rounded"]').length > 0) { 15681 var $clone = $('#to-top .fa-angle-up').clone(); 15682 $clone.addClass('top-icon'); 15683 $('#to-top').prepend($clone); 15684 } 15685 15686 // Scroll up click event 15687 $body.on('click', '#to-top, a[href="#top"]', function () { 15688 $('body,html').stop().animate({ 15689 scrollTop: 0 15690 }, 800, 'easeOutQuad', function () { 15691 if ($('.nectar-box-roll').length > 0) { 15692 $body.trigger('mousewheel', [1, 0, 0]); 15693 } 15694 }); 15695 return false; 15696 }); 15697 15698 } 15699 15700 15701 15702 15703 15704 15705 15706 15707 15708 /** 15709 * Scrollspy plugin initialization. 15710 * 15711 * @since 5.0 15712 */ 15713 function scrollSpyInit() { 15714 15715 var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $window.width() > 1000) ? 0 : $headerOuterEl.outerHeight(); 15716 15717 if ($('.page-template-template-no-header-footer').length > 0 || $('.page-template-template-no-header').length > 0) { 15718 $headerNavSpace = 0; 15719 } 15720 15721 //prevent jump to rop on empty items 15722 $('header#top .sf-menu li a[href="#"]').on('click', function (e) { 15723 e.preventDefault(); 15724 }); 15725 15726 if ($('#nectar_fullscreen_rows').length == 0 || $nectarFullPage.$usingFullScreenRows == false) { 15727 15728 $('a.nectar-next-section').each(function () { 15729 15730 if ($(this).parents('.wpb_row:not(.inner_row)').length > 0) { 15731 15732 var $parentRow = $(this).parents('.wpb_row:not(.inner_row)'), 15733 $parentRowIndex = $(this).parents('.wpb_row:not(.inner_row)').index(); 15734 15735 if ($parentRow.parent().find('> .wpb_row[id]:eq(' + ($parentRowIndex + 1) + ')').length > 0) { 15736 var $nextRowID = $parentRow.parent().find('> .wpb_row:eq(' + ($parentRowIndex + 1) + ')').attr('id'); 15737 $(this).attr('href', '#' + $nextRowID); 15738 } 15739 15740 } 15741 15742 }); 15743 } 15744 15745 else if ($().fullpage) { 15746 $('a.nectar-next-section').on('click', function () { 15747 $.fn.fullpage.moveSectionDown(); 15748 return false;
15749 }); 15750 } 15751 15752 15753 // Links in off canvas menu. 15754 if ($('#slide-out-widget-area .off-canvas-menu-container').length > 0) { 15755 $('#slide-out-widget-area .off-canvas-menu-container').find("a[href*='" + location.pathname + "']").each(function () { 15756 15757 var $href = $(this).attr('href'); 15758 15759 // Regular animated anchors. 15760 if ($href != '#' && 15761 $href.indexOf("#") != -1 && 15762 $href.substr($href.indexOf("#")) !== '#' && 15763 $('div' + $href.substr($href.indexOf("#"))).length > 0) { 15764 15765 $(this).attr('href', $href.substr($href.indexOf("#"))); 15766 15767 $(this).parent() 15768 .removeClass('current_page_item') 15769 .removeClass('current-menu-item'); 15770 } 15771 15772 // Fullpage is a little different. 15773 if ($('div[data-fullscreen-anchor-id="' + $href.substr($href.indexOf("#") + 1) + '"]').length > 0) { 15774 15775 $(this).parent() 15776 .removeClass('current_page_item') 15777 .removeClass('current-menu-item'); 15778 } 15779 15780 }); 15781 } 15782 15783 // Links in header navigation. 15784 $("#header-outer").find("a[href*='" + location.pathname + "']").each(function () { 15785 15786 var $href = $(this).attr('href'); 15787 15788 // Regular animated anchors 15789 if ($href.indexOf("#") != -1 && 15790 $href.substr($href.indexOf("#")) !== '#' && 15791 $('div' + $href.substr($href.indexOf("#"))).length > 0) { 15792 15793 $(this).attr('href', $href.substr($href.indexOf("#"))); 15794 $(this).parent() 15795 .removeClass('current_page_item') 15796 .removeClass('current-menu-item'); 15797 } 15798 15799 // Fullpage is a little different 15800 if ($('div[data-fullscreen-anchor-id="' + $href.substr($href.indexOf("#") + 1) + '"]').length > 0) { 15801 15802 $(this).parent() 15803 .removeClass('current_page_item') 15804 .removeClass('current-menu-item'); 15805 } 15806 15807 }); 15808 15809 // Start scrollspy. 15810 var $target = ($('.page-submenu[data-sticky="true"]').length == 0) ? '#header-outer nav' : '.page-submenu'; 15811 $body.scrollspy({ 15812 target: $target, 15813 offset: $headerNavSpace + nectarDOMInfo.adminBarHeight + 40 15814 }); 15815 15816 } 15817 15818 15819 15820 15821 /** 15822 * Called to scroll to hash link on page load 15823 * 15824 * @since 5.0 15825 */ 15826 function pageLoadHash() { 15827 15828 var $hash = window.location.hash; 15829 15830 if( $hash && $hash.length > 0 ) { 15831 $hash = $hash.replace(/<|>/g,''); 15832 } 15833 15834 var $hashSubstrng = ($hash && $hash.length > 0) ? $hash.substring(1, $hash.length) : 0, 15835 headerPadding2 = parseInt($headerOuterEl.attr('data-padding')) * 2, 15836 $hasSlashLength = 0; 15837 15838 // If the hash has slashes 15839 if ($hashSubstrng) { 15840 $hasSlashLength = $hashSubstrng.split("/"); 15841 $hasSlashLength = $hasSlashLength.length; 15842 } 15843 15844 if ($hashSubstrng && $hasSlashLength > 1) { 15845 $hashSubstrng = $hashSubstrng.replace(/\//g, ""); 15846 $hash = $hash.replace(/\//g, ""); 15847 } 15848 15849 if ($hash && $('.main-content').find($hash).length > 0 || 15850 $hash && $('.main-content').find('[data-fullscreen-anchor-id="' + $hashSubstrng + '"]').length > 0) { 15851 15852 var $hashObj = ($('.main-content').find($hash).length > 0) ? $('.main-content').find($hash) : $('.main-content').find('[data-fullscreen-anchor-id="' + $hashSubstrng + '"]'), 15853 $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $window.width() > 1000) ? 0 : $('#header-space').outerHeight(); 15854 15855 if ($('.page-template-template-no-header-footer').length > 0 || $('.page-template-template-no-header').length > 0) { 15856 $headerNavSpace = 0; 15857 } 15858 15859 var $timeoutVar = 0; 15860 15861 if ($('.nectar-box-roll').length > 0 && $('.container-wrap.bottomBoxOut').length > 0) { 15862 nectarBoxRoll.boxRoll(null, -1); 15863 $timeoutVar = 2050; 15864 } 15865 15866 setTimeout(function () { 15867 15868 var $scrollTopDistance; 15869 15870 if ($('body[data-permanent-transparent="1"]').length == 0) { 15871 15872 if (!$body.hasClass('mobile')) { 15873 var $resize = ($('#header-outer[data-header-resize="0"]').length > 0) ? 0 : parseInt(logoShrinkNum) + headerPadding2 * 2; 15874 if ($('#header-outer[data-remove-fixed="1"]').length > 0) { 15875 $headerNavSpace = 0; 15876 } 15877 $scrollTopDistance = $hashObj.offset().top - parseInt($headerNavSpace) + $resize + 3 - nectarDOMInfo.adminBarHeight; 15878 15879 15880 // Condense 15881 if ($('body.mobile').length == 0 && $('#header-outer[data-condense="true"]').length > 0) { 15882 15883 var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'), 15884 $headerHeightStored = $headerOuterEl.height(),
15885 $headerHeightCondensed = $headerHeightStored - (parseInt($headerSpan9.height()) + parseInt($('#header-outer #logo').css('margin-top'))); 15886 15887 $scrollTopDistance = $hashObj.offset().top - parseInt($headerNavSpace) + $headerHeightCondensed - nectarDOMInfo.adminBarHeight; 15888 } 15889 15890 } else { 15891 $scrollTopDistance = ($('#header-outer[data-mobile-fixed="1"]').length > 0) ? $hashObj.offset().top + 2 - $headerNavSpace + nectarDOMInfo.adminBarHeight : $hashObj.offset().top - nectarDOMInfo.adminBarHeight + 1; 15892 } 15893 15894 } else { 15895 $scrollTopDistance = $hashObj.offset().top - nectarDOMInfo.adminBarHeight + 1; 15896 } 15897 15898 if ($('body[data-hhun="1"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length == 0) { 15899 15900 // Alter offset 15901 if ($('#header-outer.detached').length == 0) { 15902 $scrollTopDistance = $scrollTopDistance + $headerNavSpace; 15903 } 15904 } 15905 15906 var $pageSubMenu = ($('.page-submenu[data-sticky="true"]').length > 0) ? $('.page-submenu').height() : 0; 15907 var $headerSecondary; 15908 15909 if ($('body.material').length > 0 && 15910 $headerSecondaryEl.length > 0 && 15911 $('body[data-hhun="1"]').length == 0 && 15912 $('#header-outer[data-remove-fixed="1"]').length == 0 && 15913 !$body.hasClass('mobile')) { 15914 15915 $headerSecondary = $headerSecondaryEl.height(); 15916 15917 } else { 15918 $headerSecondary = 0; 15919 } 15920 15921 nectar_scrollToY($scrollTopDistance - $pageSubMenu + $headerSecondary, 700, 'easeInOutQuint'); 15922 15923 }, $timeoutVar); 15924 } 15925 } 15926 15927 15928 /** 15929 * Initialize page load hash functionality 15930 * 15931 * @since 10.5 15932 */ 15933 function pageLoadHashInit() { 15934 15935 if ($('body[data-animated-anchors="true"]').length > 0) { 15936 if ($('.nectar-box-roll').length == 0 && $('#nectar_fullscreen_rows').length == 0) { 15937 15938 // Inside tabs 15939 if (typeof nectarGetQueryParam['tab'] != 'undefined') { 15940 setTimeout(function () { 15941 pageLoadHash(); 15942 }, 800); 15943 } 15944 // Regular 15945 else { 15946 pageLoadHash(); 15947 } 15948 15949 } 15950 15951 if ($('#nectar_fullscreen_rows[data-mobile-disable="on"]').length > 0 && $('.nectar-box-roll').length == 0 && 15952 nectarDOMInfo.usingMobileBrowser) { 15953 pageLoadHash(); 15954 } 15955 15956 } 15957 15958 } 15959 15960 15961 /** 15962 * Animated anchor link theme option. 15963 * 15964 * @since 10.5 15965 */ 15966 function animatedAnchorLinks() { 15967 15968 if ($('body[data-animated-anchors="true"]').length > 0 || 15969 $('.single-product [data-gallery-style="left_thumb_sticky"]').length > 0) { 15970 15971 var headerPadding2 = headerPadding - headerPadding / 1.8; 15972 15973 setTimeout(scrollSpyInit, 200); 15974 15975 var $animatedScrollingTimeout; 15976 15977 $body.on('click', '#header-outer nav .sf-menu a, #footer-outer .nectar-button, #footer-outer .widget_nav_menu a, #mobile-menu li a, .nectar-scrolling-tabs .scrolling-tab-nav a, .container-wrap a:not(.wpb_tabs_nav a):not(.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) { 15978 15979 var $hash = $(this).prop("hash"); 15980 15981 if( !$(this).hasClass('nectar-next-section') && headerHideUntilNeeded == '1' ) { 15982 $body.addClass('animated-scrolling'); 15983 } 15984 15985 clearTimeout($animatedScrollingTimeout); 15986 15987 $animatedScrollingTimeout = setTimeout(function () { 15988 $body.removeClass('animated-scrolling'); 15989 }, 850); 15990 15991 var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $window.width() > 1000) ? 0 : $('#header-space').outerHeight(); 15992 15993 if ($('.page-template-template-no-header-footer').length > 0 || $('.page-template-template-no-header').length > 0) { 15994 $headerNavSpace = 0; 15995 } 15996 15997 if ($hash && $body.find($hash).length > 0 && $hash != '#top' && $hash != '' && $(this).attr('href').indexOf(window.location.href.split("#")[0]) !== -1 || 15998 $(this).is('[href^="#"]') && $hash != '' && $body.find($hash).length > 0 && $hash != '#top') { 15999 16000 //update hash 16001 if (!$(this).hasClass('skip-hash')) { 16002 if (history.pushState) { 16003 history.pushState(null, null, $hash); 16004 } else { 16005 location.hash = $hash; 16006 } 16007 } 16008 16009 if ($(this).parents('ul').length > 0) { 16010 16011 $(this) 16012 .parents('ul') 16013 .find('li') 16014 .removeClass('current-menu-item'); 16015 } 16016 16017 // Side widget area click 16018 if ($(this).parents('#slide-out-widget-area').length > 0) { 16019
16020 if ($('body.material[data-slide-out-widget-area-style="slide-out-from-right"].material-ocm-open').length > 0) { 16021 16022 $('body > .slide_out_area_close') 16023 .addClass('non-human-allowed') 16024 .trigger('click'); 16025 16026 // Sroll 16027 var $clickedLinkStore = $(this); 16028 16029 setTimeout(function () { 16030 $clickedLinkStore.trigger('click'); 16031 }, 1000); 16032 16033 } else { 16034 $('#slide-out-widget-area .slide_out_area_close') 16035 .addClass('non-human-allowed') 16036 .trigger('click'); 16037 } 16038 16039 setTimeout(function () { 16040 if ($('body.material[data-slide-out-widget-area-style="slide-out-from-right"]').length > 0) { 16041 $('body > .slide_out_area_close').removeClass('non-human-allowed'); 16042 16043 } else { 16044 $('#slide-out-widget-area .slide_out_area_close').removeClass('non-human-allowed'); 16045 } 16046 }, 100); 16047 } 16048 16049 // Mobile menu click 16050 if ( $(this).parents('#mobile-menu').length > 0 ) { 16051 $('.slide-out-widget-area-toggle.mobile-icon a') 16052 .addClass('non-human-allowed') 16053 .trigger('click'); 16054 16055 setTimeout(function () { 16056 $('.slide-out-widget-area-toggle.mobile-icon a').removeClass('non-human-allowed'); 16057 }, 100); 16058 } 16059 16060 var $mobileMenuHeight = ($(this).parents('#mobile-menu').length > 0) ? $(this).parents('#mobile-menu').height() : null; 16061 var $timeoutVar = 1; 16062 var $that = $(this); 16063 16064 if ($('.nectar-box-roll').length > 0 && $('.container-wrap.bottomBoxOut').length > 0) { 16065 nectarBoxRoll.boxRoll(null, -1); 16066 $timeoutVar = 2050; 16067 } 16068 16069 16070 setTimeout(function () { 16071 16072 var $scrollTopDistance; 16073 16074 // Scrolling 16075 if ($('body[data-permanent-transparent="1"]').length == 0) { 16076 16077 if (!$body.hasClass('mobile')) { 16078 var $resize = ($('#header-outer[data-header-resize="0"]').length > 0) ? 0 : parseInt(logoShrinkNum) + headerPadding2 * 2; 16079 if ($('#header-outer[data-remove-fixed="1"]').length > 0) { 16080 $headerNavSpace = 0; 16081 } 16082 16083 $scrollTopDistance = $($hash).offset().top - $mobileMenuHeight - parseInt($headerNavSpace) + $resize + 3 - nectarDOMInfo.adminBarHeight; 16084 16085 // Condense 16086 if ($('body.mobile').length == 0 && $('#header-outer[data-condense="true"]').length > 0) { 16087 16088 var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'), 16089 $headerHeightStored = $headerOuterEl.height(),
16090 $headerHeightCondensed = $headerHeightStored - (parseInt($headerSpan9.height()) + parseInt($('#header-outer #logo').css('margin-top'))); 16091 $scrollTopDistance = $($hash).offset().top - parseInt($headerNavSpace) + $headerHeightCondensed - nectarDOMInfo.adminBarHeight; 16092 16093 } 16094 16095 16096 } else { 16097 $scrollTopDistance = ($('#header-outer[data-mobile-fixed="1"]').length > 0) ? $($hash).offset().top + 2 - $headerNavSpace + nectarDOMInfo.adminBarHeight : $($hash).offset().top - $mobileMenuHeight - nectarDOMInfo.adminBarHeight + 1; 16098 } 16099 16100 } else { 16101 $scrollTopDistance = $($hash).offset().top - nectarDOMInfo.adminBarHeight + 1; 16102 } 16103 16104 if ($('body[data-hhun="1"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length == 0) { 16105 16106 // Alter offset 16107 if ($('#header-outer.detached').length == 0 || $that.parents('.page-submenu[data-sticky="true"]').length > 0) { 16108 $scrollTopDistance = $scrollTopDistance + $headerNavSpace; 16109 } 16110 16111 // Hide top header 16112 if ($that.parents('.page-submenu[data-sticky="true"]').length > 0) { 16113 16114 $('#header-outer.detached').addClass('invisible'); 16115 $('.page-submenu') 16116 .addClass('header-not-visible') 16117 .css('transform', 'translateY(0px)'); 16118 16119 } 16120 } 16121 16122 var $pageSubMenu = ($that.parents('.page-submenu[data-sticky="true"]').length > 0) ? $that.parents('.page-submenu').height() : 0; 16123 var $headerSecondary; 16124 16125 if ($('body.material').length > 0 && 16126 $headerSecondaryEl.length > 0 && 16127 $('body[data-hhun="1"]').length == 0 && 16128 $('#header-outer[data-remove-fixed="1"]').length == 0 && 16129 !$body.hasClass('mobile')) { 16130 16131 $headerSecondary = $headerSecondaryEl.height(); 16132 16133 } else { 16134 16135 if($('body[data-hhun="1"]').length > 0 && 16136 $headerSecondaryEl.length > 0 && 16137 !$body.hasClass('mobile') && 16138 $('#header-outer[data-remove-fixed="1"]').length == 0) { 16139 $headerSecondary = $headerSecondaryEl.height(); 16140 } else { 16141 $headerSecondary = 0; 16142 } 16143 16144 } 16145 16146 16147 nectar_scrollToY($scrollTopDistance - $pageSubMenu + $headerSecondary, 700, 'easeInOutQuint'); 16148 16149 }, $timeoutVar); 16150 16151 e.preventDefault(); 16152 16153 } 16154 16155 if ($hash == '#top') { 16156 // Side widget area click 16157 if ($(this).parents('#slide-out-widget-area').length > 0) { 16158 $('#slide-out-widget-area .slide_out_area_close').trigger('click'); 16159 } 16160 } 16161 16162 }); 16163 16164 16165 } 16166 16167 } 16168 16169 16170 16171 16172 16173 16174 /** 16175 * Search results masonry layout. 16176 * 16177 * @since 10.0 16178 */ 16179 function searchResultMasonry() { 16180 16181 var $searchContainer = $('#search-results'), 16182 $dividerNum = ($searchContainer.is('[data-layout="masonry-no-sidebar"]')) ? 4 : 3; 16183 16184 $searchContainer.imagesLoaded(function () { 16185 16186 $searchContainer.isotope({ 16187 itemSelector: '.result', 16188 layoutMode: 'packery', 16189 packery: { 16190 columnWidth: $('#search-results').width() / $dividerNum 16191 } 16192 }); 16193 16194 $searchContainer 16195 .find('article') 16196 .css('opacity', '1'); 16197 16198 }); 16199 16200 $window.on('resize', function () { 16201 $searchContainer.isotope({ 16202 layoutMode: 'packery', 16203 packery: { 16204 columnWidth: $('#search-results').width() / $dividerNum 16205 } 16206 }); 16207 }); 16208 16209 } 16210 16211 16212 /** 16213 * Search results masonry layout initialization. 16214 * 16215 * @since 10.5 16216 */ 16217 function searchResultMasonryInit() { 16218 if ($('body.search-results').length > 0 && 16219 $('#search-results article').length > 0 && 16220 $('#search-results[data-layout="list-no-sidebar"]').length == 0) { 16221 searchResultMasonry(); 16222 } 16223 } 16224 16225 16226 16227 16228 /** 16229 * Custom colors for portfolio grid elements. 16230 * 16231 * @since 10.5 16232 */ 16233 function portfolioCustomColoring() { 16234 16235 //portfolio colors 16236 if ($('.portfolio-items .col .style-3-alt').length > 0 || 16237 $('.portfolio-items .col .style-3').length > 0 || 16238 $('.portfolio-items .col .style-2').length > 0 || 16239 $('.portfolio-items .col .style-5').length > 0) { 16240 16241 var portfolioColorCss = ''; 16242 16243 $('.portfolio-items .col').each(function () { 16244 16245 var $titleColor = $(this).attr('data-title-color'), 16246 $subTitleColor = $(this).attr('data-subtitle-color'); 16247 16248 if ($titleColor.length > 0) { 16249 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; } '; 16250 portfolioColorCss += ' .portfolio-items[data-ps="8"] .col[data-title-color="' + $titleColor + '"] .line { background-color: ' + $titleColor + '; }'; 16251 portfolioColorCss += '.portfolio-items[data-ps="8"] .col[data-title-color="' + $titleColor + '"] .next-arrow line { stroke: ' + $titleColor + '; } '; 16252 } 16253 if ($subTitleColor.length > 0) { 16254 portfolioColorCss += '.col[data-subtitle-color="' + $subTitleColor + '"] .vert-center p, .portfolio-items[data-ps="6"] .col[data-title-color="' + $titleColor + '"] .work-meta p { color: ' + $subTitleColor + '!important; } '; 16255 } 16256 16257 }); 16258 16259 //style 16260 nectarCreateStyle(portfolioColorCss, 'nectar-portfolio-colors'); 16261 16262 } 16263 16264 } 16265 16266 16267 16268 16269 /** 16270 * Single post pagination/recent post mouse events 16271 * 16272 * @since 10.5 16273 */ 16274 function postMouseEvents() { 16275 16276 16277 $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 () { 16278 $(this).parents('.grav-wrap') 16279 .find('img') 16280 .addClass('hovered'); 16281 }); 16282 16283 $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 () { 16284 $(this).parents('.grav-wrap') 16285 .find('img') 16286 .removeClass('hovered'); 16287 }); 16288 16289 $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 () { 16290 $(this).addClass('mouse-leaving'); 16291 }); 16292 16293 } 16294 16295 16296 16297 16298 /** 16299 * Masonry portfolio initialization. 16300 * 16301 * @since 10.5 16302 */ 16303 function masonryPortfolioInit() { 16304 16305 $portfolio_containers = []; 16306 16307 $('.portfolio-items:not(.carousel)').each(function (i) { 16308 16309 $(this).attr('instance', i); 16310 $(this).parent().parent().find('div[class^=portfolio-filters]').attr('instance', i); 16311 16312 if (typeof SalientPortfolio !== 'undefined') { 16313 $portfolio_containers[i] = new SalientPortfolio($(this), fullWidthContentColumns); 16314 } 16315 16316 }); 16317 16318 } 16319 16320 16321 16322 16323 /** 16324 * Perspective load in styling. 16325 * 16326 * @since 8.0 16327 */ 16328 function updatePerspectiveOrigin() { 16329 16330 if( nectarDOMInfo.winW > 690 ) { 16331 $('.posts-container[data-load-animation="perspective"]').css('perspective-origin', '50% ' + (nectarDOMInfo.scrollTop + nectarDOMInfo.winH) + 'px'); 16332 } 16333 requestAnimationFrame(updatePerspectiveOrigin); 16334 16335 } 16336 16337 16338 /** 16339 * Perspective load in styling. 16340 * 16341 * @since 8.0 16342 */ 16343 function updatePerspectiveOriginInit() { 16344 16345 if ($('.posts-container[data-load-animation="perspective"]').length > 0) { 16346 requestAnimationFrame(updatePerspectiveOrigin); 16347 } 16348 16349 } 16350 16351 16352 16353 /** 16354 * Blog load in animation. 16355 * 16356 * @since 3.0 16357 */ 16358 function blogLoadIn(post_container) { 16359 16360 if (post_container.attr('data-load-animation') == 'none') { 16361 16362 post_container 16363 .find('.inner-wrap') 16364 .removeClass('animated'); 16365 16366 } else { 16367 16368 post_container.find('article').each(function (i) { 16369 16370 // Loaded visible 16371 if ($(this).visible(true)) { 16372 16373 $(this).delay(110 * i).queue(function (next) { 16374 $(this).addClass("animated-in"); 16375 next(); 16376 }); 16377 16378 16379 } else { 16380 16381 // Not already visible 16382 var $that = $(this); 16383 var waypoint = new Waypoint({ 16384 16385 element: $that, 16386 handler: function () { 16387 16388 setTimeout(function () { 16389 $that.addClass("animated-in"); 16390 }, 80 * $that.attr('data-delay-amount')); 16391 16392 waypoint.destroy(); 16393 }, 16394 offset: '90%' 16395 16396 }); 16397 } 16398 16399 }); 16400 16401 } 16402 16403 } 16404 16405 16406 /** 16407 * Masonry blog initialization. 16408 * 16409 * @since 10.5 16410 */ 16411 function masonryBlogInit() { 16412 16413 $nectarMasonryBlogs = []; 16414 16415 $('.posts-container').each(function (i) { 16416 16417 if ($(this).parent().hasClass('masonry') && !$(this).parent().hasClass('auto_meta_overlaid_spaced')) { 16418 16419 if (typeof NectarMasonryBlog == 'undefined') { 16420 return; 16421 } 16422 16423 $nectarMasonryBlogs[i] = new NectarMasonryBlog($(this), fullWidthSections, blogLoadIn); 16424 16425 } else { 16426 16427 blogLoadIn($(this)); 16428 16429 } 16430 16431 }); 16432 } 16433 16434 16435 16436 /** 16437 * Sticky Sidebar initialization. 16438 * 16439 * @since 10.5 16440 */ 16441 function stickySidebarInit() { 16442 16443 if (!$().theiaStickySidebar || nectarDOMInfo.usingMobileBrowser && nectarDOMInfo.winW < 1000 ) { 16444 return; 16445 } 16446 16447 $('#sidebar[data-nectar-ss="true"], #sidebar[data-nectar-ss="1"], .nectar-scrolling-tabs .scrolling-tab-nav').each(function () { 16448 16449 // Padding from top of screen 16450 var $ssExtraTopSpace = 50; 16451 16452 if ($('#header-outer[data-remove-fixed="0"]').length > 0 && 16453 $('body[data-hhun="1"]').length == 0 && 16454 $('#header-outer[data-format="left-header"]').length == 0) { 16455 16456 $ssExtraTopSpace += $headerOuterEl.outerHeight(); 16457 16458 // Resize effect 16459 if ($('#header-outer[data-shrink-num][data-header-resize="1"]').length > 0) { 16460 var headerPadding2 = parseInt($headerOuterEl.attr('data-padding')) - parseInt($headerOuterEl.attr('data-padding')) / 1.8; 16461 $ssExtraTopSpace -= logoShrinkNum; 16462 $ssExtraTopSpace -= headerPadding2; 16463 } 16464 16465 // Condense 16466 if ($('body.mobile').length == 0 && $('#header-outer[data-condense="true"]').length > 0) { 16467 16468 var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'); 16469 $ssExtraTopSpace = 50; 16470 $ssExtraTopSpace += $headerOuterEl.height() - (parseInt($headerSpan9.position().top) - parseInt($('#header-outer #logo').css('margin-top'))) - parseInt(nectarDOMInfo.secondaryHeaderHeight); 16471 } 16472 16473 } 16474 16475 if ($wpAdminBar.length > 0) {
16476 $ssExtraTopSpace += $wpAdminBar.outerHeight(); 16477 } 16478 16479 16480 if ($(this).parents('.wpb_widgetised_column').length > 0) { 16481 16482 if ($('body.vc_editor').length > 0) { 16483 // Skip processing. 16484 } else { 16485 $(this).parents('.wpb_column').theiaStickySidebar({ 16486 additionalMarginTop: $ssExtraTopSpace, 16487 updateSidebarHeight: false 16488 }); 16489 } 16490 16491 } else { 16492 $(this).theiaStickySidebar({ 16493 additionalMarginTop: $ssExtraTopSpace, 16494 updateSidebarHeight: false 16495 }); 16496 } 16497 16498 }); 16499 } 16500 16501 16502 16503 16504 16505 /** 16506 * Section down arrow animated link 16507 * 16508 * @since 10.5 16509 */ 16510 function sectionDownArrowEvent() { 16511 16512 var headerPadding2 = headerPadding - headerPadding / 1.8; 16513 16514 $body.on('click', '.section-down-arrow, .scroll-down-wrap > .minimal-arrow', function () { 16515 16516 if ($(this).parents('.nectar-box-roll').length > 0) { 16517 return false; 16518 } 16519 16520 var $currentSection = $(this).parents('#page-header-bg'), 16521 $topDistance = $currentSection.height(), 16522 $offset = ($currentSection.parents('.first-section').length == 0 || $('body[data-transparent-header="false"]').length > 0) ? $currentSection.offset().top : 0, 16523 $bodyBorderSize = ($bodyBorderTop.length > 0 && $window.width() > 1000) ? $bodyBorderTop.height() : 0, 16524 $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0) ? 0 : $('#header-space').height(), 16525 $materialSecondary = 0; 16526 16527 if ($('body.material').length > 0 && $headerSecondaryEl.length > 0) { 16528 $materialSecondary = $headerSecondaryEl.height(); 16529 } 16530 16531 if ($('body[data-permanent-transparent="1"]').length == 0) { 16532 16533 // Regular 16534 if (!$body.hasClass('mobile')) { 16535 16536 if ($('body[data-hhun="1"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length == 0) { 16537 $('body,html').stop().animate({ 16538 scrollTop: parseInt($topDistance) + $offset + 2 - $bodyBorderSize * 2 16539 }, 1000, 'easeInOutCubic'); 16540 } else { 16541 16542 var $resize = ($('#header-outer[data-header-resize="0"]').length > 0) ? 0 : parseInt(logoShrinkNum) + headerPadding2 * 2; 16543 if ($('#header-outer[data-remove-fixed="1"]').length > 0) { 16544 $headerNavSpace = 0; 16545 $offset = 0; 16546 } 16547 16548 // Condense 16549 if ($('body.mobile').length == 0 && $('#header-outer[data-condense="true"]').length > 0) { 16550 var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'); 16551 $headerNavSpace = $headerOuterEl.height() - (parseInt($headerSpan9.position().top) - parseInt($('#header-outer #logo').css('margin-top'))) - parseInt(nectarDOMInfo.secondaryHeaderHeight); 16552 } 16553 16554 $('body,html').stop().animate({ 16555 scrollTop: parseInt($topDistance - $headerNavSpace) + $resize + 3 + $offset + $materialSecondary 16556 }, 1000, 'easeInOutCubic'); 16557 16558 } 16559 16560 } else { 16561 16562 var $scrollPos; 16563 16564 if($('#header-outer[data-mobile-fixed="1"]').length > 0) { 16565 $scrollPos = parseInt($topDistance) - $headerNavSpace + parseInt($currentSection.offset().top) + 2; 16566 } else { 16567 $scrollPos = parseInt($topDistance) + parseInt($currentSection.offset().top) + 2; 16568 } 16569 16570 $('body,html').stop().animate({ 16571 scrollTop: $scrollPos - $bodyBorderSize * 2 16572 }, 1000, 'easeInOutCubic'); 16573 } 16574 16575 } else { 16576 // Permanent transparent 16577 $('body,html').stop().animate({ 16578 scrollTop: parseInt($topDistance) + parseInt($currentSection.offset().top) + 2 - $bodyBorderSize * 2 16579 }, 1000, 'easeInOutCubic'); 16580 } 16581 return false; 16582 }); 16583 16584 } 16585 16586 16587 16588 16589 16590 /** 16591 * Displace filter column/row BG effect - fullpage 16592 * 16593 * @since 10.5 16594 */ 16595 function nectarLiquidBGFP() { 16596 16597 $('.nectar-liquid-bg').removeClass('animated-in'); 16598 16599 for (var k = 0; k < $liquidBG_EL.length; k++) { 16600 16601 if ($liquidBG_EL[k].animationType == 'displace-filter-fade' && $($liquidBG_EL[k].canvasContainer).parents('.fp-section.active').length > 0) { 16602 16603 //add bg to container 16604 if ($($liquidBG_EL[k].canvasContainer).find('.image-added-to-stage').length == 0) { 16605 $liquidBG_EL[k].imgContainer.addChild($liquidBG_EL[k].bg); 16606 } 16607 16608 $($liquidBG_EL[k].canvasContainer) 16609 .find('.nectar-liquid-bg') 16610 .addClass('image-added-to-stage'); 16611 16612 $liquidBG_EL[k].animateProps($liquidBG_EL[k]); 16613 16614 } 16615 } 16616 } 16617 16618 16619 /** 16620 * Page Full Screen Rows 16621 * 16622 * @since 10.5 16623 */ 16624 function nectarFullPageInit() { 16625 16626 if ($('#nectar_fullscreen_rows').length > 0 && $().fullpage) { 16627 16628 $fullscreenSelector = (window.vc_iframe) ? '.vc_element.vc_vc_row.active ' : '.wpb_row.active ';
16629 16630 var $disableFPonMobile = ($('#nectar_fullscreen_rows[data-mobile-disable]').length > 0) ? $('#nectar_fullscreen_rows').attr('data-mobile-disable') : 'off'; 16631 if( !nectarDOMInfo.usingMobileBrowser ) { 16632 $disableFPonMobile = 'off'; 16633 } 16634 // Support for mobile animation theme option. 16635 if( $disableFPonMobile != 'on' ) { 16636 $fullscreenMarkupBool = true; 16637 } else { 16638 $fullscreenSelector = ''; 16639 } 16640 16641 $nectarFullPage = new NectarFullScreenRows(waypoints, $mouseParallaxScenes, nectarLiquidBGFP, nectarDOMInfo, responsiveTooltips, $standAnimatedColTimeout, $svgIcons); 16642 16643 } 16644 16645 } 16646 16647 16648 16649 16650 /** 16651 * Cross browser adjustments. 16652 * 16653 * @since 1.0 16654 */ 16655 function crossBrowserAdjust() { 16656 16657 // Add specific class if on device for better tablet tracking. 16658 if (nectarDOMInfo.usingMobileBrowser) { 16659 $body.addClass('using-mobile-browser'); 16660 } 16661 16662 // Add class for old IE. 16663 var ua = window.navigator.userAgent; 16664 var msie = ua.indexOf("Edge/"); 16665 if (msie > 0) { 16666 $body.addClass('msie'); 16667 } 16668 16669 // For users updating to 8 with a custom, old header template file 16670 if ($('html.js').length == 0) { 16671 $('html').removeClass('no-js').addClass('js'); 16672 } 16673 16674 //remove br's from code tag 16675 $('code').find('br').remove(); 16676 16677 // Contact form 7. 16678 $('.wpcf7-form p:has(input[type=submit])').css('padding-bottom', '0px'); 16679 16680 $('.full-width-content .wpcf7-submit').on('click', function () { 16681 setTimeout(function () { 16682 fullWidthContentColumns(); 16683 }, 1000); 16684 setTimeout(function () { 16685 fullWidthContentColumns(); 16686 }, 2000); 16687 }); 16688 16689 // Gravity form inside fw content row 16690 $('.gform_body').on('click', function () { 16691 setTimeout(function () { 16692 fullWidthContentColumns(); 16693 }, 200); 16694 }); 16695 16696 // Popup Maker. 16697 $('.pum.pum-theme-salient-page-builder-optimized button.pum-close').wrapInner('<span />'); 16698 16699 // pum inside fspr 16700 if ($('#nectar_fullscreen_rows').length > 0 && 16701 $('.pum-container .pum-content > .wpb_row .full-page-inner > .container > .span_12').length > 0) { 16702 $('.pum-container .pum-content > .wpb_row .full-page-inner > .container > .span_12').unwrap(); 16703 } 16704 16705 // Blog bottom padding 16706 if ($('.single .blog_next_prev_buttons').length > 0) { 16707 $('.container-wrap').css('padding-bottom', 0); 16708 } 16709 16710 // Remove margin on last cols inside of full width sections 16711 $('.full-width-section').each(function () { 16712 $(this).find('> .span_12 > div.col_last').last().css('margin-bottom', '0'); 16713 }); 16714 16715 // Remove boxed style from full width content 16716 $('.full-width-content .col.boxed').removeClass('boxed'); 16717 16718 // Neg marg z-index adjust 16719 $('.wpb_column.neg-marg').parents('.wpb_row').css('z-index', '110'); 16720 16721 16722 } 16723 16724 16725 16726 16727 //vc col mobile fixes 16728 function vcMobileColumns() { 16729 16730 $('.wpb_row').each(function () { 16731 if (typeof $(this).find('.span_12').offset() != 'undefined') { 16732 16733 $(this).find('[class*="vc_col-"]').each(function () { 16734 16735 var $firstChildOffset = $(this).parents('.span_12').offset().left; 16736 16737 $(this).removeClass('no-left-margin'); 16738 16739 if ($(this).offset().left < $firstChildOffset + 27) { 16740 $(this).addClass('no-left-margin'); 16741 } else { 16742 $(this).removeClass('no-left-margin'); 16743 } 16744 }); 16745 } 16746 }); 16747 } 16748 16749 function vcMobileColumnsInit() { 16750 16751 var $winDOMWidth = nectarDOMInfo.winW, 16752 $winDOMHeight = nectarDOMInfo.winH, 16753 $orientChangeTrack = 0; 16754 16755 // Only needed in legacy column setups. 16756 if( $body.is('[data-flex-cols="true"]') ) { 16757 return; 16758 } 16759 16760 if ($('[class*="vc_col-xs-"], [class*="vc_col-md-"], [class*="vc_col-lg-"]').length > 0) { 16761 16762 // Trigger immediately. 16763 vcMobileColumns(); 16764 16765 // Resize. 16766 if( !nectarDOMInfo.usingMobileBrowser ) { 16767 // Bind normally for desktop. 16768 $window.on('resize',vcMobileColumns); 16769 } 16770 else { 16771 16772 // For mobile make sure the orientation has changed. 16773 window.addEventListener("orientationchange", function () { 16774 $orientChangeTrack = 1; 16775 }); 16776 16777 $window.on('resize', function () { 16778 16779 if (($window.width() != $winDOMWidth && $window.height != $winDOMHeight) || $orientChangeTrack === 1) { 16780 16781 vcMobileColumns(); 16782 16783 // Store the current window dimensions. 16784 $winDOMWidth = nectarDOMInfo.winW; 16785 $winDOMHeight = nectarDOMInfo.winH; 16786 16787 // Reset orientation change tracker. 16788 $orientChangeTrack = 0; 16789 } 16790 16791 }); 16792 16793 16794 } // end mobile only. 16795 16796 } // endif vc offset cols found. 16797 16798 16799 } 16800 16801 16802 16803 16804 /** 16805 * Select2 plugin initialization. 16806 * 16807 * @since 5.0 16808 */ 16809 function select2Init() { 16810 16811 $('select:not(.state_select):not(.country_select):not(.comment-form-rating #rating):not(#tribe-bar-form select):not(.woocommerce-currency-switcher)').each(function () { 16812 16813 // Prevent search from triggering on small devices. 16814 var $minimumToSearch = ( nectarDOMInfo.winW > 690 ) ? 7 : 200; 16815 16816 // Skip search class 16817 if( $(this).hasClass('skip-select2-search') || $(this).parents('.skip-select2-search').length > 0 ) { 16818 $minimumToSearch = 1000; 16819 } 16820 16821 if ($(this).parents('#buddypress').length == 0) { 16822 16823 if ($(this).parents('.woocommerce-ordering').length == 0) { 16824 $(this).select2({ 16825 minimumResultsForSearch: $minimumToSearch, 16826 width: '100%' 16827 }); 16828 } else { 16829 $(this).select2({ 16830 minimumResultsForSearch: $minimumToSearch, 16831 dropdownAutoWidth: true 16832 }); 16833 } 16834 } 16835 16836 }); 16837 } 16838 16839 16840 /** 16841 * Fancy select styling theme option. 16842 * 16843 * @since 10.5 16844 */ 16845 function fancySelectStyling() { 16846 16847 if ( $('body[data-fancy-form-rcs="1"]').length > 0 ) { 16848 16849 $('select:not(.comment-form-rating #rating)').each(function () { 16850 16851 var $selector; 16852 16853 //cf7 16854 if ($(this).parents('.wpcf7-form-control-wrap').length > 0) { 16855 16856 //select 2 already initialized 16857 if ($(this).parents('.wpcf7-form-control-wrap').find('.select2-container').length > 0) { 16858 $selector = $($(this).prev('.select2-container')); 16859 } else { 16860 $selector = $(this); 16861 } 16862 16863 //if label is found 16864 if ($selector.parents('.wpcf7-form-control-wrap').parent().find('label').length == 1) { 16865 $selector.parents('.wpcf7-form-control-wrap').parent().wrapInner('<div class="fancy-select-wrap" />'); 16866 } else { 16867 //default wrap 16868 $selector.wrap('<div class="fancy-select-wrap" />'); 16869 } 16870 } 16871 //default 16872 else { 16873 16874 //select 2 already initialized 16875 if ($(this).prev('.select2-container').length > 0) { 16876 $selector = $(this).prev('.select2-container'); 16877 } else { 16878 $selector = $(this); 16879 } 16880 16881 if ($(this).parents('#buddypress').length == 0 && $(this).parents('.widget_categories').length == 0) { 16882 //if label is found 16883 if ($selector.prev('label').length == 1) { 16884 $selector.prev('label').andSelf().wrapAll('<div class="fancy-select-wrap" />'); 16885 } else if ($selector.next('label').length == 1) { 16886 $selector.next('label').andSelf().wrapAll('<div class="fancy-select-wrap" />'); 16887 } else { 16888 //default wrap 16889 $selector.wrap('<div class="fancy-select-wrap" />'); 16890 } 16891 } 16892 16893 } 16894 }); 16895 16896 select2Init(); 16897 16898 } 16899 16900 } 16901 16902 16903 16904 16905 16906 /** 16907 * Back/Forward Safari cache assist. 16908 * 16909 * @since 10.5 16910 */ 16911 function bfCacheAssist() { 16912 16913 //Back/forward cache OCM close 16914 if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1 || 16915 navigator.userAgent.match(/(iPod|iPhone|iPad)/)) { 16916 16917 window.onpageshow = function (event) { 16918 16919 if (event.persisted) { 16920 16921 // Play video BGs 16922 $('.nectar-video-wrap, .nectar-slider-wrap .swiper-slide .video-wrap').each(function () { 16923 16924 if ($(this).find('video').length > 0) { 16925 $(this).find('video')[0].play(); 16926 } 16927 16928 }); 16929 16930 16931 // Close mobile nav 16932 16933 //// Material Skin. 16934 if ($('body.material-ocm-open').length > 0) { 16935 $('body > .slide_out_area_close').addClass('non-human-allowed').trigger('click'); 16936 16937 setTimeout(function () { 16938 $('body > .slide_out_area_close').removeClass('non-human-allowed'); 16939 }, 100); 16940 16941 } else if ($('#slide-out-widget-area.slide-out-from-right-hover.open').length > 0 && navigator.userAgent.match(/(iPod|iPhone|iPad)/)) { 16942 OCM_mobileSlideOutRightHoverCloseCheck(); 16943 } 16944 // Others 16945 else if ($('#slide-out-widget-area.fullscreen.open').length > 0 || 16946 $('#slide-out-widget-area.fullscreen-alt.open').length > 0 || 16947 $('#slide-out-widget-area.slide-out-from-right.open').length > 0) { 16948 16949 $('#slide-out-widget-area .slide_out_area_close').addClass('non-human-allowed'); 16950 $('.slide-out-widget-area-toggle:not(.std-menu) a.open') 16951 .addClass('non-human-allowed') 16952 .trigger('click'); 16953 16954 setTimeout(function () { 16955 $('#slide-out-widget-area .slide_out_area_close').removeClass('non-human-allowed'); 16956 }, 100); 16957 16958 } 16959 16960 }
16960 // Loaded from bf cache 16961 16962 }; // onpage show 16963 16964 } 16965 16966 } 16967 16968 16969 16970 16971 16972 16973 /*-------------------------------------------------------------------------*/ 16974 /* WPBakery Frontend Editor 16975 /*-------------------------------------------------------------------------*/ 16976 16977 /** 16978 * Control adjustments 16979 * 16980 * @since 10.0 16981 */ 16982 function addRowCtrls() { 16983 16984 //remove padding for rows with only fullwidth ns 16985 $('.wpb_row').removeClass('only-ns'); 16986 16987 $('.nectar-slider-wrap[data-full-width="true"], .page-submenu, .portfolio-items[data-col-num="elastic"]:not(.fullwidth-constrained), .blog-fullwidth-wrap') 16988 .parents('.wpb_row') 16989 .addClass('only-ns'); 16990 16991 //padding when column contains item that could get lost under column controls 16992 $('body.vc_editor.compose-mode .wpb_row .vc_vc_column > .wpb_column > .vc_column-inner').each(function() { 16993 16994 if ($(this).find('> .vc_element-container > div').length > 0) { 16995 16996 if ($(this).find('> .vc_element-container > div:first-child').is('.vc_vc_row_inner')) { 16997 $(this).find('> .vc_element-container > div:first-child').addClass('first-inner-row-el'); 16998 } else { 16999 $(this).find('> .vc_element-container > div:first-child').removeClass('first-inner-row-el'); 17000 } 17001 17002 } 17003 17004 }); 17005 17006 } //addRowCtrl end 17007 17008 17009 /** 17010 * Convert front end padding 17011 * 17012 * Needed when the flexbox grid is not active due to 17013 * different markup in front end page builder view. 17014 * 17015 * @since 10.0 17016 */ 17017 function convertFrontEndPadding() { 17018 17019 $('.vc_element > .wpb_column[class*="padding-"][class*="-percent"]').each(function() { 17020 17021 var $elPaddingPercent = 4; 17022 17023 var elclassName = this.className.match(/padding-\d+/); 17024 if (elclassName) { 17025 $elPaddingPercent = elclassName[0].match(/\d+/); 17026 if ($elPaddingPercent) { 17027 $elPaddingPercent = $elPaddingPercent[0] / 100; 17028 } else { 17029 $elPaddingPercent = 0; 17030 } 17031 } 17032 17033 if ($elPaddingPercent) { 17034 var $parentRowWidth = $(this).parents('.span_12').width(); 17035 17036 if ($(this).is('[data-padding-pos="all"]')) { 17037 $(this).css('padding', $parentRowWidth * $elPaddingPercent); 17038 } else if ($(this).is('[data-padding-pos="top"]')) { 17039 $(this).css('padding-top', $parentRowWidth * $elPaddingPercent); 17040 } else if ($(this).is('[data-padding-pos="bottom"]')) { 17041 $(this).css('padding-bottom', $parentRowWidth * $elPaddingPercent); 17042 } else if ($(this).is('[data-padding-pos="left"]')) { 17043 $(this).css('padding-left', $parentRowWidth * $elPaddingPercent); 17044 } else if ($(this).is('[data-padding-pos="right"]')) { 17045 $(this).css('padding-right', $parentRowWidth * $elPaddingPercent); 17046 } else if ($(this).is('[data-padding-pos="top-bottom"]')) { 17047 $(this).css({ 17048 'padding-top': $parentRowWidth * $elPaddingPercent, 17049 'padding-bottom': $parentRowWidth * $elPaddingPercent, 17050 }); 17051 } else if ($(this).is('[data-padding-pos="top-right"]')) { 17052 $(this).css({ 17053 'padding-top': $parentRowWidth * $elPaddingPercent, 17054 'padding-right': $parentRowWidth * $elPaddingPercent, 17055 }); 17056 } else if ($(this).is('[data-padding-pos="bottom-right"]')) { 17057 $(this).css({ 17058 'padding-right': $parentRowWidth * $elPaddingPercent, 17059 'padding-bottom': $parentRowWidth * $elPaddingPercent, 17060 }); 17061 } else if ($(this).is('[data-padding-pos="bottom-left"]')) { 17062 $(this).css({ 17063 'padding-left': $parentRowWidth * $elPaddingPercent, 17064 'padding-bottom': $parentRowWidth * $elPaddingPercent, 17065 }); 17066 } else if ($(this).is('[data-padding-pos="left-right"]')) { 17067 $(this).css({ 17068 'padding-left': $parentRowWidth * $elPaddingPercent, 17069 'padding-right': $parentRowWidth * $elPaddingPercent, 17070 }); 17071 } 17072 } 17073 17074 }); 17075 17076 $('.wpb_row[class*="vc_custom_"]').each(function() { 17077 17078 $(this).parent().addClass('no-bottom-margin'); 17079 17080 }); 17081 17082 } 17083 17084 17085 /** 17086 * WPBakery Front end editor integration 17087 * 17088 * @since 10.0 17089 */ 17090 function wpBakeryFrontendInit() { 17091 17092 // Set up controls/column padding. 17093 setTimeout(function() { 17094 17095 if ($('body.compose-mode').length > 0) {
17096 $('.container-wrap').addClass('visible-editor-controls'); 17097 } 17098 17099 if (nectarDOMInfo.usingFrontEndEditor) { 17100 addRowCtrls(); 17101 17102 if( !$body.is('[data-flex-cols="true"]') ) { 17103 convertFrontEndPadding(); 17104 $window.smartresize(convertFrontEndPadding); 17105 } 17106 17107 } 17108 17109 }, 200); 17110 17111 // Bind reload event 17112 $window.on('vc_reload', function() { 17113 17114 addRowCtrls(); 17115 columnBGColors(); 17116 coloredButtons(); 17117 twentytwentyInit(); 17118 parallaxRowsBGCals(); 17119 flexsliderInit(); 17120 accordionInit(); 17121 ulCheckmarks(); 17122 nectarFancyUlIcons(); 17123 nectarFancyBoxHover(); 17124 oneFourthClasses(); 17125 carouselfGrabbingClass(); 17126 nectarPostGridInit(); 17127 splitLineHeadingInit(); 17128 nectarVideoLightbox(); 17129 nectarKeyframeAssist(); 17130 nectarLazyImageLoading(); 17131 17132 if ($('.carousel').length > 0) { 17133 standardCarouselInit(); 17134 clientsCarouselInit(); 17135 carouselHeightCalcs(); 17136 } 17137 17138 if ($('.owl-carousel').length > 0) { 17139 $('.owl-carousel').each(function() { 17140 $(this).trigger('destroy.owl.carousel').removeClass('owl-loaded'); 17141 $(this).find('.owl-stage-outer .owl-stage > *').unwrap(); 17142 $(this).find('.owl-stage-outer > *').unwrap(); 17143 $(this).find('.owl-item > *').unwrap(); 17144 $(this).find('.owl-dots').remove(); 17145 $(this).find('.owl-nav').remove(); 17146 }); 17147 owlCarouselInit(); 17148 } 17149 17150 if ($('.nectar_cascading_images').length > 0) { 17151 imagesLoaded($('.nectar_cascading_images'), function() { 17152 cascadingImageBGSizing(); 17153 }); 17154 } 17155 17156 fullWidthSections(); 17157 fwsClasses(); 17158 recentPostsInit(); 17159 fullWidthRowPaddingAdjust(); 17160 17161 /*flickity carousels*/ 17162 if ($flickitySliders.length > 0) { 17163 for (var i = 0; i < $flickitySliders.length; i++) { 17164 17165 $flickitySliders[i].reloadCells(); 17166 $flickitySliders[i].off('scroll.flickity'); 17167 $flickitySliders[i].off('dragStart.flickity'); 17168 $flickitySliders[i].off('dragEnd.flickity'); 17169 17170 } 17171 } 17172 17173 flickityLazyInit(); 17174 17175 setTimeout(function() { 17176 17177 flickityInit(); 17178 if ($flickitySliders.length > 0) { 17179 for (var i = 0; i < $flickitySliders.length; i++) { 17180 $flickitySliders[i].reloadCells(); 17181 $flickitySliders[i].resize(); 17182 } 17183 } 17184 17185 }, 100); 17186 17187 /*flickity product carousels*/ 17188 if ($wooFlickityCarousels.length > 0) { 17189 for (var i = 0; i < $wooFlickityCarousels.length; i++) { 17190 17191 $wooFlickityCarousels[i].flickity('reloadCells'); 17192 $wooFlickityCarousels[i].off('scroll.flickity'); 17193 $wooFlickityCarousels[i].off('dragStart.flickity'); 17194 $wooFlickityCarousels[i].off('dragEnd.flickity'); 17195 17196 } 17197 } 17198 17199 setTimeout(function() { 17200 17201 if ($('.nectar-woo-flickity').length > 0) { 17202 productCarouselInit(); 17203 } 17204 if ($wooFlickityCarousels.length > 0) { 17205 for (var i = 0; i < $wooFlickityCarousels.length; i++) { 17206 $wooFlickityCarousels[i].flickity('reloadCells'); 17207 $wooFlickityCarousels[i].flickity('resize'); 17208 } 17209 } 17210 17211 }, 100); 17212 17213 nectarTestimonialSliders(); 17214 17215 for (var i = 0; i < $testimonialSliders.length; i++) { 17216 17217 if ($testimonialSliders[i].type == 'multiple_visible' || 17218 $testimonialSliders[i].type == 'multiple_visible_minimal') { 17219 17220 $testimonialSliders[i].flickityEl.flickity('reloadCells'); 17221 $testimonialSliders[i].flickityEl.off('select.flickity'); 17222 nectarTestimonialSliders(); 17223 $testimonialSliders[i].flickityEl.resize(); 17224 } 17225 17226 $testimonialSliders[i].testimonialSliderHeight(); 17227 } 17228 nectarTestimonialSlidersEvents(); 17229 17230 pricingTableHeight(); 17231 nectarIconMatchColoring(); 17232 lightBoxInit(); 17233 imageWithHotspotEvents(); 17234 largeIconHover(); 17235 nectarBoxRollInit(); 17236 midnightInit(); 17237 responsiveVideoIframesInit(); 17238 responsiveVideoIframes(); 17239 fullWidthContentColumns(); 17240 setTimeout(fullWidthContentColumns, 1000); 17241 videoBGInit(); 17242 vcFullHeightRowInit(); 17243 $window.off('scroll.parallaxSections').off('resize.parallaxSections'); 17244 parallaxScrollInit(); 17245 masonryBlogInit(); 17246 masonryPortfolioInit(); 17247 17248 if ($portfolio_containers.length > 0) { 17249 for (var i = 0; i < $portfolio_containers.length; i++) { 17250 $portfolio_containers[i].portfolioAccentColor(); 17251 } 17252 } 17253 17254 parallaxItemHoverEffect(); 17255 fsProjectSliderInit(); 17256 17257 setTimeout(function() { 17258 if ($('.nectar_fullscreen_zoom_recent_projects').length > 0) { 17259 17260 if ($fsProjectSliderArr.length > 0) { 17261 for (var i = 0; i < $fsProjectSliderArr.length; i++) { 17262 $fsProjectSliderArr[i].sliderCalcs(); 17263 } 17264 } 17265 17266 } 17267 }, 300); 17268 17269 $window.unbind('.infscr'); 17270 infiniteScrollInit();
17271 mouseParallaxInit(); 17272 17273 //play video BGs 17274 $('.nectar-video-wrap').each(function() { 17275 if ($(this).find('video').length > 0) { 17276 $(this).find('video').css('visibility', 'visible'); 17277 } 17278 }); 17279 17280 //tablet inherits small desktop 17281 $('.wpb_column[data-t-w-inherits]').each(function() { 17282 if ($(this).is('[data-t-w-inherits="small_desktop"]')) { 17283 $(this).parent().addClass('inherits-s-desktop-col'); 17284 } else { 17285 $(this).parent().removeClass('inherits-s-desktop-col'); 17286 } 17287 }); 17288 17289 //full screen page rows 17290 if ($('#nectar_fullscreen_rows').length > 0) { 17291 17292 if ($('#nectar_fullscreen_rows > .vc_element').length == 0) { 17293 $('#nectar_fullscreen_rows').prepend('<div class="vc_element empty_placeholder" />'); 17294 } 17295 17296 17297 if ($('#nectar_fullscreen_rows > .vc_element:not(.empty_placeholder)').length > 0) { 17298 $('#nectar_fullscreen_rows >.vc_element.empty_placeholder').remove(); 17299 } 17300 17301 17302 $.fn.fullpage.destroy('all'); 17303 nectarFullPageInit(); 17304 17305 //keep tooltip active status 17306 var nectarFPOffsets = [{ 17307 el: '', 17308 offset: 0 17309 }]; 17310 17311 ////create list of offsets 17312 $('#nectar_fullscreen_rows > div.vc_element').each(function(i) { 17313 nectarFPOffsets[i] = { 17314 el: $(this), 17315 offset: $(this).offset().top 17316 }; 17317 }); 17318 17319 17320 ////start active on that index 17321 17322 //move back to first section when all have been deleted but one 17323 if ($('#nectar_fullscreen_rows > div.vc_element').length === 1) { 17324 $('#nectar_fullscreen_rows').css({ 17325 'transform': 'translate3d(0,0,0)' 17326 }); 17327 } 17328 17329 $body.scrollTo(0, 0); 17330 17331 17332 } else { 17333 17334 //remove container wrap padding/margin when needded 17335 if ($('body .main-content > .row > .vc_element:first > .wpb_row[class*="full-width-"]').length > 0 || 17336 $('body .main-content > .row > .vc_element:first .nectar-slider-wrap[data-full-width="true"]').length > 0) { 17337 $('.container-wrap').css({ 17338 'padding-top': '0', 17339 'margin-top': '0' 17340 }); 17341 } else { 17342 $('.container-wrap').css({ 17343 'padding-top': '40px' 17344 }); 17345 } 17346 17347 } 17348 17349 //reset svg icon arr 17350 $svgIcons = []; 17351 $('.svg-icon-holder') 17352 .removeClass('animated-in') 17353 .removeClass('bound'); 17354 17355 17356 //gmap 17357 if ($('.vc_nectar_gmap').length > 0) { 17358 17359 setTimeout(function() { 17360 17361 if (typeof google === 'object' && typeof google.maps === 'object') { 17362 window.mapAPI_Loaded(); 17363 } else { 17364 17365 if (window.nectarLove.mapApiKey.length > 0) { 17366 $.getScript('https://maps.google.com/maps/api/js?sensor=false&key=' + window.nectarLove.mapApiKey + '&callback=mapAPI_Loaded'); 17367 } 17368 } 17369 17370 }, 100); 17371 } 17372 17373 17374 stickySidebarInit(); 17375 17376 17377 if (typeof window.Waypoint != 'undefined') { 17378 Waypoint.destroyAll(); 17379 waypoints(); 17380 } 17381 17382 }); 17383 17384 } 17385 17386 17387 17388 17389 17390 17391 17392 17393 /** 17394 * Page transitions and waypoint triggering 17395 * 17396 * @since 10.5 17397 */ 17398 function pageTransitionInit() { 17399 17400 var mobileDisabledCondition = false; 17401 17402 if( $('body[data-ajax-transitions="true"]').length > 0 && 17403 $('#ajax-loading-screen[data-disable-mobile="1"]').length > 0 && 17404 nectarDOMInfo.winW < 1000 ) { 17405 17406 mobileDisabledCondition = true; 17407 17408 } 17409 17410 if ($('body[data-ajax-transitions="true"]').length > 0 && $('#ajax-loading-screen[data-method="standard"]').length > 0 && mobileDisabledCondition == false) { 17411 17412 $('html').addClass('page-trans-loaded'); 17413 17414 // Fade loading animation 17415 if ($('#ajax-loading-screen[data-effect="standard"]').length > 0) { 17416 17417 if ($('.nectar-particles').length == 0) { 17418 17419 $loadingScreenEl.transition({ 17420 'opacity': 0 17421 }, 500, function () { 17422 $(this).css({ 17423 'display': 'none' 17424 }); 17425 }); 17426 $('#ajax-loading-screen .loading-icon').transition({ 17427 'opacity': 0 17428 }, 500); 17429 17430 } 17431 17432 // Bind waypoints after loading screen has left 17433 if ($('.nectar-box-roll').length == 0) { 17434 setTimeout(function () { 17435 waypoints(); 17436 }, 550); 17437 } 17438 17439 } 17440 17441 // Swipe loading animation 17442 else { 17443 17444 if ($('#ajax-loading-screen[data-effect*="horizontal_swipe"]').length > 0) { 17445 setTimeout(function () { 17446 $loadingScreenEl.addClass('loaded'); 17447 }, 60); 17448 } 17449 17450 if ($('#page-header-wrap #page-header-bg[data-animate-in-effect="zoom-out"] .nectar-video-wrap').length == 0) { 17451 setTimeout(function () { 17452 $('#ajax-loading-screen:not(.loaded)').addClass('loaded'); 17453 setTimeout(function () { 17454 $loadingScreenEl.addClass('hidden'); 17455 }, 1000); 17456 }, 150); 17457 } 17458 17459 17460 // Bind waypoints after loading screen has left 17461 if ($('.nectar-box-roll').length == 0 && $('#ajax-loading-screen[data-effect*="horizontal_swipe"]').length > 0) { 17462 setTimeout(function () { 17463 waypoints(); 17464 }, 750); 17465 } else if ($('.nectar-box-roll').length == 0) setTimeout(function () { 17466 waypoints(); 17467 }, 350); 17468 17469 } 17470 17471 17472 // Safari back/prev fix 17473 if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1 || 17474 navigator.userAgent.match(/(iPod|iPhone|iPad)/)) { 17475 17476 window.onunload = function () { 17477 $loadingScreenEl.stop().transition({ 17478 'opacity': 0 17479 }, 800, function () { 17480 $(this).css({ 17481 'display': 'none' 17482 }); 17483 }); 17484 $('#ajax-loading-screen .loading-icon').transition({ 17485 'opacity': 0 17486 }, 600); 17487 }; 17488 window.onpageshow = function (event) { 17489 17490 if (event.persisted) { 17491 17492 $loadingScreenEl.stop().transition({ 17493 'opacity': 0 17494 }, 800, function () { 17495 $(this).css({ 17496 'display': 'none' 17497 }); 17498 }); 17499 $('#ajax-loading-screen .loading-icon').transition({ 17500 'opacity': 0 17501 }, 600); 17502 17503 } 17504 17505 }; 17506 17507 } 17508 17509 else if (navigator.userAgent.indexOf('Firefox') != -1) { 17510 window.onunload = function () {}; 17511 } 17512 17513 17514 // Remove excess loading images if using page transitions. 17515 $('.portfolio-loading, .nectar-slider-loading .loading-icon').remove(); 17516 17517 17518 if ($('#ajax-loading-screen[data-disable-fade-on-click="1"]').length == 0) { 17519 17520 if ($('body.using-mobile-browser #ajax-loading-screen[data-method="standard"][data-disable-mobile="1"]').length == 0) { 17521 17522 var ignore_onbeforeunload = false;
17523 $('a[href^="mailto"], a[href^="tel"], .woocommerce-order-downloads a[class*="downloads-file"]').on('click', function () { 17524 ignore_onbeforeunload = true; 17525 }); 17526 window.addEventListener('beforeunload', function () { 17527 17528 if (!ignore_onbeforeunload) { 17529 $loadingScreenEl.addClass('set-to-fade'); 17530 transitionPage(); 17531 } 17532 ignore_onbeforeunload = false; 17533 }); 17534 } 17535 17536 } 17537 17538 } 17539 17540 // No page transitions 17541 else { 17542 17543 // Mobile disabled. 17544 if( mobileDisabledCondition == true ) { 17545 $loadingScreenEl.css({ 17546 'opacity': '0', 17547 'display': 'none' 17548 }).addClass('loaded').addClass('hidden'); 17549 } 17550 17551 if ($('.nectar-box-roll').length == 0 && !nectarDOMInfo.usingFrontEndEditor) { 17552 17553 // Waypoints. 17554 setTimeout(function () { 17555 waypoints(); 17556 }, 80); 17557 17558 } 17559 17560 } 17561 17562 17563 function transitionPage() { 17564 17565 if ($('#ajax-loading-screen[data-effect*="horizontal_swipe"]').length > 0) { 17566 $loadingScreenEl.removeClass('loaded'); 17567 $loadingScreenEl.addClass('in-from-right'); 17568 17569 setTimeout(function () { 17570 $loadingScreenEl.addClass('loaded'); 17571 }, 30); 17572 17573 } 17574 else { 17575 if ($('#ajax-loading-screen[data-effect="center_mask_reveal"]').length > 0) { 17576 $loadingScreenEl.css('opacity', '0').css('display', 'block').transition({ 17577 'opacity': '1' 17578 }, 450); 17579 } else { 17580 $loadingScreenEl.show().transition({ 17581 'opacity': '1' 17582 }, 450); 17583 } 17584 } 17585 17586 } 17587 17588 } 17589 17590 17591 17592 // Document ready event - starting everything up. 17593 jQuery(document).ready(function ($) { 17594 17595 // Initialize Nectar DOM helper. 17596 nectarDOMInfo.init(); 17597 17598 // Priority calls 17599 nectarBoxRollInit(); 17600 nectarFullPageInit(); 17601 nectarLazyImageLoading(); 17602 17603 // Header navigation. 17604 initSF(); 17605 navigationSearchInit(); 17606 centeredNavBottomBarInit(); 17607 centeredLogoHeaderInit(); 17608 headerNavPreInit(); 17609 headerNavScrollInit(); 17610 headerNavOffsetInit(); 17611 17612 // Page builder elements. 17613 salientPageBuilderElInit(); 17614 17615 // Column related. 17616 columnBGColors(); 17617 vcMobileColumnsInit(); 17618 17619 // Row related. 17620 fullWidthSections(); 17621 fwsClasses(); 17622 fwCarouselLinkFix(); 17623 fullWidthSectionsPreInit(); 17624 firstFWSection(); 17625 parallaxScrollInit(); 17626 parallaxRowsBGCals(); 17627 fullWidthRowPaddingAdjust(); 17628 fullWidthContentColumns(); 17629 oneFourthClasses(); 17630 fixIeFlexbox(); 17631 vcFullHeightRowInit(); 17632 17633 // Media. 17634 lightBoxInit(); 17635 audioVideoVis(); 17636 responsiveVideoIframesInit(); 17637 responsiveVideoIframes(); 17638 videoBGInit(); 17639 blogSingle(); 17640 17641 // Off canvas navigation. 17642 mobileNavMegamenuCorrect(); 17643 materialSkinOCM_Init(); 17644 OCM_dropdownMarkup(); 17645 OCM_dropdownIconPos(); 17646 clickToggleSubmenus(); 17647 OCM_init(); 17648 17649 // Page header 17650 pageHeaderInit(); 17651 17652 // Footer. 17653 footerRevealInit(); 17654 17655 // Third party. 17656 wooCommerceEvents(); 17657 fancySelectStyling(); 17658 17659 // Scrolling 17660 infiniteScrollInit(); 17661 scrollToTopInit(); 17662 animatedAnchorLinks(); 17663 updatePerspectiveOriginInit(); 17664 sectionDownArrowEvent(); 17665 17666 // Cross browser assist. 17667 crossBrowserAdjust(); 17668 bfCacheAssist(); 17669 17670 // Front end editing. 17671 wpBakeryFrontendInit(); 17672 17673 // Page transitions and waypoint activation. 17674 pageTransitionInit(); 17675 17676 17677 17678 // Main Debounced Resize Event. 17679 $window.off('smartresize.srInit'); 17680 $window.on('smartresize.srInit', smartResizeInit); 17681 17682 // Main Resize Event. 17683 $window.off('resize.srInit'); 17684 $window.on('resize.srInit', resizeInit); 17685 17686 // Window Load Event. 17687 $window.on('load', function () { 17688 17689 // Set header space. 17690 if ( $(window).scrollTop() == 0 ) { 17691 headerSpace(); 17692 } 17693 17694 $('video').css('visibility', 'visible'); 17695 17696 // Scroll to anchor 17697 pageLoadHashInit(); 17698 17699 // Row/Column related. 17700 fullWidthContentColumns();
17701 parallaxRowsBGCals(); 17702 17703 // Video BG 17704 resizeVideoToCover(); 17705 17706 }); 17707 17708 17709 }); 17710 17711 17712 17713}(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.