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">
1227' + ($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 function isWindow( obj ) { 1894 return obj != null && obj === obj.window; 1895 } 1896 1897 /** 1898 * Aspect Ratio Calculator 1899 * 1900 * @since 11.0 1901 */ 1902 function calculateAspectRatio(srcWidth, srcHeight, maxWidth, maxHeight) { 1903 var ratio = Math.min(maxWidth / srcWidth, maxHeight / srcHeight); 1904 return { width: srcWidth*ratio, height: srcHeight*ratio }; 1905 } 1906 1907 /** 1908 * Calculate header navigation height 1909 * 1910 * The header nav bar height can change on scrolling from theme option effects/using the secondary 1911 * header, so it is necessary to calculate the reduced height in advance for correct sticky waypoint 1912 * event binding & animated anchor links. 1913 * 1914 * @since 10.5 1915 * @return {number} Height of nav bar. 1916 */ 1917 function calcHeaderNavHeight() { 1918 1919 var navHeight; 1920 1921 // Left header format, no header template, hide header until needed. 1922 if( ($body.is('[data-header-format="left-header"]') && nectarDOMInfo.winW >= 1000) || 1923 $body.is('[data-hhun="1"]') && nectarDOMInfo.winW >= 1000 || 1924 $('.page-template-template-no-header-footer').length > 0 || 1925 $('.page-template-template-no-header').length > 0) { 1926 1927 navHeight = 0; 1928 1929 } 1930 1931 // Regular Header 1932 else { 1933 1934 var headerPadding2 = headerPadding - headerPadding / 1.8; 1935 var $headerNavSpace = $headerOuterEl.outerHeight(); 1936 1937 // Secondary header bar. 1938 if( $headerSecondaryEl.length > 0 && $body.is('.material') || 1939 $headerSecondaryEl.length > 0 && !$body.is('.material') && nectarDOMInfo.winW < 1000) { 1940 $headerNavSpace -= nectarDOMInfo.secondaryHeaderHeight; 1941 } 1942 1943 // Check for header resize effect. 1944 if( $headerOuterEl.is('[data-header-resize="1"]') && !$headerOuterEl.is('.small-nav') && nectarDOMInfo.winW >= 1000 ) { 1945 navHeight = $headerNavSpace - (parseInt(logoShrinkNum) + headerPadding2 * 2); 1946 } else { 1947 navHeight = $headerNavSpace; 1948 } 1949 1950 } 1951 1952 // Condense header effect. 1953 if ( nectarDOMInfo.winW >= 1000 && $('#header-outer[data-condense="true"]').length > 0 ) { 1954 1955 var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'); 1956 navHeight = $headerOuterEl.height() - (parseInt($headerSpan9.position().top) - parseInt($headerOuterEl.find('#logo').css('margin-top'))) - parseInt(nectarDOMInfo.secondaryHeaderHeight); 1957 1958 } 1959 1960 return navHeight; 1961 1962 } 1963 1964 1965 /** 1966 * Removes CSS outlines in an accessible manner. 1967 * 1968 * @since 10.5 1969 */ 1970 (function(d){ 1971 1972 var style_element = d.createElement('STYLE'), 1973 dom_events = 'addEventListener' in d, 1974 add_event_listener = function(type, callback){ 1975 if(dom_events){ 1976 d.addEventListener(type, callback); 1977 }else{ 1978 d.attachEvent('on' + type, callback); 1979 } 1980 }, 1981 set_css = function(css_text){ 1982 !!style_element.styleSheet ? style_element.styleSheet.cssText = css_text : style_element.innerHTML = css_text; 1983 }; 1984 1985 d.getElementsByTagName('HEAD')[0].appendChild(style_element); 1986 1987 add_event_listener('mousedown', function(){ 1988 set_css(':focus{outline:0}::-moz-focus-inner{border:0;}'); 1989 }); 1990 1991 add_event_listener('keydown', function(){ 1992 set_css(''); 1993 }); 1994 1995 })(document); 1996 1997 1998 1999 /** 2000 * Cursor position. 2001 * 2002 * @since 4.0 2003 */ 2004 jQuery.fn.setCursorPosition = function (position) { 2005 2006 if (this.length == 0) { 2007 return this; 2008 } 2009 return $(this).setSelection(position, position); 2010 }; 2011 2012 2013 /** 2014 * Set selection in input. 2015 * 2016 * @since 4.0 2017 */ 2018 jQuery.fn.setSelection = function (selectionStart, selectionEnd) { 2019 if (this.length == 0) { 2020 return this; 2021 } 2022 var input = this[0]; 2023 2024 if (input.createTextRange) { 2025 var range = input.createTextRange(); 2026 range.collapse(true); 2027 range.moveEnd('character', selectionEnd); 2028 range.moveStart('character', selectionStart); 2029 range.select(); 2030 } else if (input.setSelectionRange) { 2031 input.focus(); 2032 input.setSelectionRange(selectionStart, selectionEnd); 2033 } 2034 2035 return this; 2036 }; 2037 2038 $.extend(jQuery.expr.pseudos, { 2039 transparent: function (elem, i, attr) { 2040 return ($(elem).css("opacity") === "0"); 2041 } 2042 }); 2043 2044 2045 2046 /** 2047 * Converts to hex. 2048 * 2049 * @since 3.0 2050 */ 2051 function hex(x) { 2052 return ("0" + parseInt(x).toString(16)).slice(-2); 2053 } 2054 2055 /** 2056 * CSS color RGB helper. 2057 * 2058 * @since 3.0 2059 */ 2060 $.cssHooks.color = { 2061 get: function (elem) { 2062 2063 var color; 2064 2065 if (elem.currentStyle) { 2066 color = elem.currentStyle["color"]; 2067 } else if (window.getComputedStyle) { 2068 color = document.defaultView.getComputedStyle(elem, 2069 null).getPropertyValue("color"); 2070 } 2071 if (color.search("rgb") == -1) { 2072 return color; 2073 } else { 2074 color = color.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/); 2075 2076 if (color) { 2077 return "#" + hex(color[1]) + hex(color[2]) + hex(color[3]); 2078 } 2079 } 2080 } 2081 }; 2082 2083 /** 2084 * CSS background color RGB helper. 2085 * 2086 * @since 3.0 2087 */ 2088 $.cssHooks.backgroundColor = { 2089 get: function (elem) { 2090 2091 var bg; 2092 2093 if (elem.currentStyle) { 2094 bg = elem.currentStyle["backgroundColor"]; 2095 } else if (window.getComputedStyle) { 2096 bg = document.defaultView.getComputedStyle(elem, 2097 null).getPropertyValue("background-color"); 2098 } 2099 if (bg.search("rgb") == -1) { 2100 return bg; 2101 } else { 2102 bg = bg.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/); 2103 2104 if (bg) { 2105 return "#" + hex(bg[1]) + hex(bg[2]) + hex(bg[3]);
2106 } 2107 } 2108 } 2109 }; 2110 2111 2112 /** 2113 * Unique ID generator. 2114 * 2115 * @since 10.5 2116 */ 2117 function uniqueIdGenerate() { 2118 return Math.floor(Math.random() * 10000); 2119 } 2120 2121 2122 2123 2124 /** 2125 * Animated page scroll 2126 * 2127 * @since 9.0 2128 */ 2129 function nectar_scrollToY(scrollTargetY, speed, easing) { 2130 2131 var scrollY = window.scrollY || document.documentElement.scrollTop, 2132 scrollTargetY = scrollTargetY || 0, 2133 speed = speed || 2000, 2134 easing = easing || 'easeOutSine', 2135 currentTime = 0; 2136 2137 var time = Math.max(0.1, Math.min(Math.abs(scrollY - scrollTargetY) / speed, 0.8)); 2138 2139 var easingEquations = { 2140 easeInOutQuint: function (pos) { 2141 if ((pos /= 0.5) < 1) { 2142 return 0.5 * Math.pow(pos, 5); 2143 } 2144 return 0.5 * (Math.pow((pos - 2), 5) + 2); 2145 } 2146 }; 2147 2148 function tick() { 2149 currentTime += 1 / 60; 2150 2151 var p = currentTime / time; 2152 var t = easingEquations[easing](p); 2153 2154 if (p < 1) { 2155 requestAnimationFrame(tick); 2156 2157 window.scrollTo(0, scrollY + ((scrollTargetY - scrollY) * t)); 2158 } else { 2159 window.scrollTo(0, scrollTargetY); 2160 } 2161 } 2162 2163 tick(); 2164 } 2165 2166 2167 /* 2168 * Bootstrap ScrollSpy Component 2169 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) */ 2170 (function ($) { 2171 2172 function s(e, i) { 2173 var r = $.proxy(this.process, this); 2174 this.$body = $("body"), this.$scrollElement = $($(e).is("body") ? window : e), 2175 this.options = $.extend({}, s.DEFAULTS, i), 2176 this.selector = (this.options.target || "") + " ul li > a", 2177 this.offsets = [], 2178 this.targets = [], 2179 this.activeTarget = null, 2180 this.scrollHeight = 0, 2181 this.$scrollElement.on("scroll.bs.scrollspy", r), 2182 this.refresh(), 2183 this.process(); 2184 } 2185 2186 function e(e) { 2187 return this.each(function () { 2188 var i = $(this), 2189 r = i.data("bs.scrollspy"), 2190 o = "object" == typeof e && e; 2191 r || i.data("bs.scrollspy", r = new s(this, o)), "string" == typeof e && r[e]() 2192 }) 2193 } 2194 2195 s.VERSION = "3.2.0", 2196 s.DEFAULTS = { 2197 offset: 10 2198 }, 2199 s.prototype.getScrollHeight = function () { 2200 return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight) 2201 }, 2202 s.prototype.refresh = function () { 2203 var s = "offset", 2204 e = 0; 2205 isWindow(this.$scrollElement[0]) || (s = "position", e = this.$scrollElement.scrollTop()), this.offsets = [], this.targets = [], this.scrollHeight = this.getScrollHeight(); 2206 var i = this; 2207 this.$body.find(this.selector).map(function () { 2208 var i = $(this), 2209 r = i.data("target") || i.attr("href"), 2210 o = /^#./.test(r) && $(r); 2211 return o && o.length && o.is(":visible") && [ 2212 [o[s]().top + e, r] 2213 ] || null 2214 }).sort(function (t, s) { 2215 return t[0] - s[0] 2216 }).each(function () { 2217 i.offsets.push(this[0]), i.targets.push(this[1]) 2218 }) 2219 }, 2220 s.prototype.process = function () { 2221 2222 var $pageSubMenu = 0; 2223 2224 if( $('.page-submenu[data-sticky="true"]').length > 0 && $('body[data-hhun="1"]').length == 0 2225 || $('.page-submenu[data-sticky="true"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length > 0 ) { 2226 $pageSubMenu = $('.page-submenu').height(); 2227 } 2228 2229 var t, s = this.$scrollElement.scrollTop() + this.options.offset + $pageSubMenu, 2230 e = this.getScrollHeight(), 2231 i = this.options.offset + e - this.$scrollElement.height() - $pageSubMenu, 2232 r = this.offsets, 2233 o = this.targets, 2234 l = this.activeTarget; 2235 2236 // remove active when scrolling to first section that does not have an anchor 2237 if (this.activeTarget && s < this.offsets[0] && this.offsets[0] > 0) { 2238 this.activeTarget = null; 2239 $(this.selector).parentsUntil(this.options.target, ".current-menu-item").removeClass("current-menu-item").removeClass('sfHover'); 2240 return; 2241 } 2242 2243 if (this.scrollHeight != e && this.refresh(), s >= i) { 2244 return l != (t = o[o.length - 1]) && this.activate(t); 2245 } 2246 if (l && s <= r[0]) { 2247 return l != (t = o[0]) && this.activate(t); 2248 } 2249 2250 2251 for (t = r.length; t--;) l != o[t] && s >= r[t] && (!r[t + 1] || s <= r[t + 1]) && this.activate(o[t]) 2252 }, 2253 s.prototype.activate = function (s) { 2254 this.activeTarget = s, $(this.selector).parentsUntil(this.options.target, ".current-menu-item").removeClass("current-menu-item").removeClass('sfHover'); 2255 var e = this.selector + '[data-target="' + s + '"],' + this.selector + '[href="' + s + '"]', 2256 i = $(e).parents("li").addClass("current-menu-item"); 2257 i.parent(".dropdown-menu").length && (i = i.closest("li.dropdown").addClass("current-menu-item")), i.trigger("activate.bs.scrollspy") 2258 }; 2259 2260 var i = $.fn.scrollspy; 2261 2262 $.fn.scrollspy = e, 2263 $.fn.scrollspy.Constructor = s, 2264 $.fn.scrollspy.noConflict = function () { 2265 return $.fn.scrollspy = i, this 2266 } 2267 2268 }(jQuery)); 2269 2270 2271 /** 2272 * Mobile break point checker 2273 * 2274 * @since 9.0 2275 */ 2276 function mobileBreakPointCheck() { 2277 2278 var $mobileBreakpoint = ($('body[data-header-breakpoint]').length > 0 && $body.attr('data-header-breakpoint') != '1000') ? parseInt($body.attr('data-header-breakpoint')) : 1000; 2279 var $withinCustomBreakpoint = false; 2280 2281 if ($mobileBreakpoint != 1000) {
2282 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) { 2283 $withinCustomBreakpoint = true; 2284 } 2285 } 2286 2287 return $withinCustomBreakpoint; 2288 } 2289 2290 /** 2291 * Extract a URL 2292 * 2293 * @since 5.0 2294 */ 2295 function extractUrl(input) { 2296 return input.replace(/"/g, "").replace(/url\(|\)$/ig, ""); 2297 } 2298 2299 /** 2300 * Extract query params 2301 * 2302 * @since 10.5 2303 */ 2304 function getQueryParams(qs) { 2305 qs = qs.split("+").join(" "); 2306 var params = {}, 2307 tokens, 2308 re = /[?&]?([^=]+)=([^&]*)/g; 2309 2310 while (tokens = re.exec(qs)) { 2311 params[decodeURIComponent(tokens[1])] = decodeURIComponent(tokens[2]); 2312 } 2313 2314 return params; 2315 } 2316 2317 var nectarGetQueryParam = getQueryParams(document.location.search); 2318 2319 2320 /** 2321 * Check whether an el is visible. 2322 * 2323 * @since 6.0 2324 */ 2325 (function (t) { 2326 var i = t(window); 2327 t.fn.visible = function (t, e, o) { 2328 if (!(this.length < 1)) { 2329 var r = this.length > 1 ? this.eq(0) : this, 2330 n = r.get(0), 2331 f = i.width(), 2332 h = i.height(), 2333 o = o ? o : "both", 2334 l = e === !0 ? n.offsetWidth * n.offsetHeight : !0; 2335 if ("function" == typeof n.getBoundingClientRect) { 2336 var g = n.getBoundingClientRect(), 2337 u = g.top >= 0 && g.top < h, 2338 s = g.bottom > 0 && g.bottom <= h, 2339 c = g.left >= 0 && g.left < f, 2340 a = g.right > 0 && g.right <= f, 2341 v = t ? u || s : u && s, 2342 b = t ? c || a : c && a; 2343 if ("both" === o) { 2344 return l && v && b; 2345 } 2346 if ("vertical" === o) { 2347 return l && v; 2348 } 2349 if ("horizontal" === o) { 2350 return l && b 2351 } 2352 } else { 2353 var d = i.scrollTop(), 2354 p = d + h, 2355 w = i.scrollLeft(), 2356 m = w + f, 2357 y = r.offset(), 2358 z = y.top, 2359 B = z + r.height(), 2360 C = y.left, 2361 R = C + r.width(), 2362 j = t === !0 ? B : z, 2363 q = t === !0 ? z : B, 2364 H = t === !0 ? R : C, 2365 L = t === !0 ? C : R; 2366 if ("both" === o) { 2367 return !!l && p >= q && j >= d && m >= L && H >= w; 2368 } 2369 if ("vertical" === o) { 2370 return !!l && p >= q && j >= d; 2371 } 2372 if ("horizontal" === o) { 2373 return !!l && m >= L && H >= w; 2374 } 2375 } 2376 } 2377 }; 2378 2379 }(jQuery)); 2380 2381 2382 /** 2383 * Count to a specific number 2384 * 2385 * @since 8.0 2386 */ 2387 var CountUp = function (target, startVal, endVal, decimals, duration, options) { 2388 2389 var lastTime = 0; 2390 var vendors = ['webkit', 'moz', 'ms', 'o']; 2391 for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { 2392 window.requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame']; 2393 window.cancelAnimationFrame = 2394 window[vendors[x] + 'CancelAnimationFrame'] || window[vendors[x] + 'CancelRequestAnimationFrame']; 2395 } 2396 if (!window.requestAnimationFrame) { 2397 window.requestAnimationFrame = function (callback) { 2398 var currTime = new Date().getTime(); 2399 var timeToCall = Math.max(0, 16 - (currTime - lastTime)); 2400 var id = window.setTimeout(function () { 2401 callback(currTime + timeToCall); 2402 }, 2403 timeToCall); 2404 lastTime = currTime + timeToCall; 2405 return id; 2406 }; 2407 } 2408 if (!window.cancelAnimationFrame) { 2409 window.cancelAnimationFrame = function (id) { 2410 clearTimeout(id); 2411 }; 2412 } 2413 2414 var self = this; 2415 2416 self.options = { 2417 useEasing: true, 2418 useGrouping: true, 2419 separator: ',', 2420 decimal: '.', 2421 easingFn: null, 2422 formattingFn: null 2423 }; 2424 // Extend default options with passed options object 2425 for (var key in options) { 2426 if (options.hasOwnProperty(key)) { 2427 self.options[key] = options[key]; 2428 } 2429 } 2430 if (self.options.separator === '') { 2431 self.options.useGrouping = false; 2432 } 2433 if (!self.options.prefix) { 2434 self.options.prefix = ''; 2435 } 2436 if (!self.options.suffix) { 2437 self.options.suffix = ''; 2438 } 2439 2440 self.d = (typeof target === 'string') ? document.getElementById(target) : target; 2441 self.startVal = Number(startVal); 2442 self.endVal = Number(endVal); 2443 self.countDown = (self.startVal > self.endVal); 2444 self.frameVal = self.startVal; 2445 self.decimals = Math.max(0, decimals || 0); 2446 self.dec = Math.pow(10, self.decimals); 2447 self.duration = Number(duration) * 1000 || 2000; 2448 2449 self.formatNumber = function (nStr) { 2450 nStr = nStr.toFixed(self.decimals); 2451 nStr += ''; 2452 var x, x1, x2, rgx; 2453 x = nStr.split('.'); 2454 x1 = x[0]; 2455 x2 = x.length > 1 ? self.options.decimal + x[1] : ''; 2456 rgx = /(\d+)(\d{3})/; 2457 if (self.options.useGrouping) { 2458 while (rgx.test(x1)) { 2459 x1 = x1.replace(rgx, '$1' + self.options.separator + '$2'); 2460 } 2461 } 2462 return self.options.prefix + x1 + x2 + self.options.suffix; 2463 }; 2464 // Robert Penner's easeOutExpo 2465 self.easeOutExpo = function (t, b, c, d) { 2466 return c * (-Math.pow(2, -10 * t / d) + 1) * 1024 / 1023 + b; 2467 }; 2468 2469 self.easingFn = self.options.easingFn ? self.options.easingFn : self.easeOutExpo; 2470 self.formattingFn = self.options.formattingFn ? self.options.formattingFn : self.formatNumber; 2471 2472 self.version = function () { 2473 return '1.7.1'; 2474 }; 2475 2476 // Print value to target 2477 self.printValue = function (value) { 2478 var result = self.formattingFn(value); 2479 2480 if (self.d.tagName === 'INPUT') { 2481 this.d.value = result; 2482 } else if (self.d.tagName === 'text' || self.d.tagName === 'tspan') { 2483 this.d.textContent = result; 2484 } else { 2485 this.d.innerHTML = result; 2486 } 2487 }; 2488 2489 self.count = function (timestamp) { 2490 2491 if (!self.startTime) { 2492 self.startTime = timestamp; 2493 } 2494 2495 self.timestamp = timestamp; 2496 var progress = timestamp - self.startTime; 2497 self.remaining = self.duration - progress; 2498 2499 // To ease or not to ease 2500 if (self.options.useEasing) { 2501 if (self.countDown) { 2502 self.frameVal = self.startVal - self.easingFn(progress, 0, self.startVal - self.endVal, self.duration); 2503 } else { 2504 self.frameVal = self.easingFn(progress, self.startVal, self.endVal - self.startVal, self.duration); 2505 } 2506 } else { 2507 if (self.countDown) { 2508 self.frameVal = self.startVal - ((self.startVal - self.endVal) * (progress / self.duration)); 2509 } else { 2510 self.frameVal = self.startVal + (self.endVal - self.startVal) * (progress / self.duration); 2511 } 2512 } 2513 2514 // Don't go past endVal since progress can exceed duration in the last frame 2515 if (self.countDown) { 2516 self.frameVal = (self.frameVal < self.endVal) ? self.endVal : self.frameVal; 2517 } else { 2518 self.frameVal = (self.frameVal > self.endVal) ? self.endVal : self.frameVal; 2519 } 2520 2521 // Decimal 2522 self.frameVal = Math.round(self.frameVal * self.dec) / self.dec; 2523 2524 // Format and print value 2525 self.printValue(self.frameVal); 2526 2527 // Whether to continue 2528 if (progress < self.duration) { 2529 self.rAF = requestAnimationFrame(self.count); 2530 } else { 2531 if (self.callback) { 2532 self.callback(); 2533 } 2534 } 2535 }; 2536 // Start animation 2537 self.start = function (callback) { 2538 self.callback = callback; 2539 self.rAF = requestAnimationFrame(self.count); 2540 return false; 2541 }; 2542 // Toggles pause/resume animation 2543 self.pauseResume = function () { 2544 if (!self.paused) { 2545 self.paused = true; 2546 cancelAnimationFrame(self.rAF); 2547 } else { 2548 self.paused = false; 2549 delete self.startTime; 2550 self.duration = self.remaining; 2551 self.startVal = self.frameVal; 2552 requestAnimationFrame(self.count); 2553 } 2554 }; 2555 // Reset to startVal so animation can be run again 2556 self.reset = function () { 2557 self.paused = false; 2558 delete self.startTime; 2559 self.startVal = startVal; 2560 cancelAnimationFrame(self.rAF); 2561 self.printValue(self.startVal); 2562 }; 2563 // Pass a new endVal and start animation 2564 self.update = function (newEndVal) { 2565 cancelAnimationFrame(self.rAF); 2566 self.paused = false; 2567 delete self.startTime; 2568 self.startVal = self.frameVal; 2569 self.endVal = Number(newEndVal); 2570 self.countDown = (self.startVal > self.endVal); 2571 self.rAF = requestAnimationFrame(self.count); 2572 }; 2573 2574 // Format startVal on initialization 2575 self.printValue(self.startVal); 2576 }; 2577 2578 var easeOutCubic = function (t, b, c, d) { 2579 return c * ((t = t / d - 1) * t * t + 1) + b; 2580 }; 2581 2582 2583 /** 2584 * Create styles 2585 * 2586 * @since 10.5 2587 */ 2588 function nectarCreateStyle(styles, name) { 2589 2590 if(styles.length > 0) { 2591 2592 var head = document.head || document.getElementsByTagName('head')[0]; 2593 var style = document.createElement('style'); 2594 2595 style.type = 'text/css'; 2596 if (style.styleSheet) { 2597 style.styleSheet.cssText = styles; 2598 } else { 2599 style.appendChild(document.createTextNode(styles)); 2600 } 2601 2602 $(style).attr('id', name); 2603 $('head').find('#'+name).remove(); 2604 head.appendChild(style); 2605 2606 } 2607 2608 } 2609 2610 2611 2612 2613 /** 2614 * FancyBox lightbox. 2615 * 2616 * @since 8.0 2617 */ 2618 function fancyBoxInit() { 2619 2620 // Convert prettyPhoto links 2621 $('a.pp') 2622 .removeClass('pp') 2623 .attr('data-fancybox', ''); 2624 2625 $("a[rel^='prettyPhoto']:not([rel*='_gal']):not([rel*='product-gallery']):not([rel*='prettyPhoto['])") 2626 .removeAttr('rel') 2627 .attr('data-fancybox', ''); 2628 2629 var $unique_id = uniqueIdGenerate(); 2630 2631 // Image gallery nectar. 2632 $('.wpb_gallery .wpb_gallery_slidesnectarslider_style').each(function() { 2633 $unique_id = uniqueIdGenerate(); 2634 $(this).find('.swiper-slide a:not(.ext-url-link)').attr('data-fancybox', 'group_' + $unique_id); 2635 }); 2636 2637 // Flexslider. 2638 $('.wpb_gallery_slides.wpb_flexslider:not([data-onclick="custom_link"])').each(function() { 2639 $unique_id = uniqueIdGenerate(); 2640 $(this).find('.slides > li > a').attr('data-fancybox', 'group_' + $unique_id); 2641 }); 2642 2643 // Touch enabled gallery. 2644 $('.wpb_gallery_slidesflickity_style, .wpb_gallery_slidesflickity_static_height_style').each(function() { 2645 $unique_id = uniqueIdGenerate(); 2646 $(this).find('.cell > a:not(.ext-url-link)').attr('data-fancybox', 'group_' + $unique_id); 2647 }); 2648 2649 // Add galleries to portfolios. 2650 $('.portfolio-items, .wpb_gallery_slidesparallax_image_grid').each(function() { 2651 $unique_id = uniqueIdGenerate(); 2652 if ($(this).find('.pretty_photo').length > 0) { 2653 2654 $(this).find('.pretty_photo') 2655 .removeClass('pretty_photo') 2656 .attr('data-fancybox', 'group_' + $unique_id); 2657 2658 } else if ($(this).find('a[rel*="prettyPhoto["]').length > 0) { 2659 2660 $(this).find('a[rel*="prettyPhoto["]') 2661 .removeAttr('rel') 2662 .attr('data-fancybox', 'group_' + $unique_id); 2663 } 2664 2665 }); 2666 2667 // Nectar auto lightbox theme option. 2668 if ($body.hasClass('nectar-auto-lightbox')) { 2669 2670 $('.gallery').each(function() { 2671 if ($(this).find('.gallery-icon a[rel^="prettyPhoto"]').length == 0) { 2672 var $unique_id = uniqueIdGenerate(); 2673 $(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"]') 2674 .attr('data-fancybox', 'group_' + $unique_id) 2675 .removeClass('pretty_photo'); 2676 } 2677 }); 2678 2679 $('.main-content img').each(function() { 2680 2681 if ($(this).parent().is("[href]") && 2682 !$(this).parent().is(".magnific-popup") && 2683 $(this).parents('.tiled-gallery').length == 0 && 2684 $(this).parents('.product-image').length == 0 && 2685 $(this).parents('.iosSlider.product-slider').length == 0) { 2686 2687 var match = $(this).parent().attr('href').match(/\.(jpg|png|gif)\b/); 2688 if (match) { 2689 $(this).parent().attr('data-fancybox', ''); 2690 } 2691 } 2692 }); 2693 } 2694 2695 // Regular. 2696 var fbMarginArr = ($('body.admin-bar').length > 0) ? [60, 100] : [60, 100]; 2697 if (nectarDOMInfo.winW < 1000) { 2698 fbMarginArr = [0, 0]; 2699 } 2700 $("[data-fancybox]").fancybox({ 2701 animationEffect: "zoom-in-out", 2702 animationDuration: 350, 2703 buttons: [ 2704 'fullScreen', 2705 'zoom', 2706 'close' 2707 ], 2708 margin: fbMarginArr, 2709 backFocus: false, 2710 loop: true, 2711 caption: function() { 2712 return $(this).attr('title'); 2713 }, 2714 hash: false, 2715 beforeLoad: function(instance) { 2716 2717 if (typeof instance.current.src !== 'string') { 2718 $.fancybox.close(true); 2719 } 2720 2721 }, 2722 mobile: { 2723 margin: 0 2724 } 2725 }); 2726 } 2727 2728 /** 2729 * Magnific lightbox. 2730 * 2731 * @since 6.0 2732 */ 2733 function magnificInit() { 2734 2735 // Convert old pp links 2736 $('a.pp') 2737 .removeClass('pp') 2738 .addClass('magnific-popup'); 2739 2740 $("a[rel^='prettyPhoto']:not([rel*='_gal']):not([rel*='product-gallery']):not([rel*='prettyPhoto['])") 2741 .removeAttr('rel') 2742 .addClass('magnific-popup'); 2743 2744 // Image gallery nectar. 2745 $('.wpb_gallery .wpb_gallery_slidesnectarslider_style').each(function() { 2746 $(this).find('.swiper-slide a:not(.ext-url-link)').addClass('pretty_photo'); 2747 }); 2748 2749 // Flexslider. 2750 $('.wpb_gallery_slides.wpb_flexslider:not([data-onclick="custom_link"])').each(function() { 2751 $(this).find('.slides > li > a').addClass('pretty_photo'); 2752 }); 2753 2754 // Touch enabled gallery. 2755 $('.wpb_gallery_slidesflickity_style, .wpb_gallery_slidesflickity_static_height_style').each(function() { 2756 $(this).find('.cell > a:not(.ext-url-link)').addClass('pretty_photo'); 2757 }); 2758 2759 // Add galleries to portfolios. 2760 $('.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() { 2761 2762 if ($(this).find('.pretty_photo').length > 0) { 2763 2764 $(this) 2765 .find('.pretty_photo') 2766 .removeClass('pretty_photo') 2767 .addClass('gallery') 2768 .addClass('magnific'); 2769 2770 } else if ($(this).find('a[rel*="prettyPhoto["]').length > 0) { 2771 2772 $(this) 2773 .find('a[rel*="prettyPhoto["]') 2774 .removeAttr('rel') 2775 .addClass('gallery') 2776 .addClass('magnific'); 2777 } 2778 2779 }); 2780 2781 $("a[data-rel='prettyPhoto[product-gallery]']").each(function() { 2782 $(this) 2783 .removeAttr('data-rel') 2784 .addClass('magnific') 2785 .addClass('gallery'); 2786 }); 2787 2788 // Nectar auto lightbox theme option. 2789 if ($body.hasClass('nectar-auto-lightbox')) { 2790 $('.gallery').each(function() { 2791 if ($(this).find('.gallery-icon a[rel^="prettyPhoto"]').length == 0) { 2792 2793 $(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"]') 2794 .addClass('magnific') 2795 .addClass('gallery') 2796 .removeClass('pretty_photo'); 2797 } 2798 }); 2799 2800 $('.main-content img').each(function() { 2801 2802 if ($(this).parent().is("[href]") && 2803 !$(this).parent().is(".magnific-popup") && 2804 $(this).parents('.tiled-gallery').length == 0 && 2805 $(this).parents('.product-image').length == 0 && 2806 $(this).parents('.iosSlider.product-slider').length == 0) { 2807 2808 var match = $(this).parent().attr('href').match(/\.(jpg|png|gif)\b/); 2809 if (match) { 2810 2811 $(this).parent() 2812 .addClass('magnific-popup') 2813 .addClass('image-link'); 2814 } 2815 } 2816 2817 }); 2818 2819 } 2820 2821 2822 // Regular. 2823 $('a.magnific-popup:not(.gallery):not(.nectar_video_lightbox)').magnificPopup({ 2824 type: 'image', 2825 callbacks: { 2826 imageLoadComplete: function() { 2827 var $that = this; 2828 setTimeout(function() { 2829 $that.wrap.addClass('mfp-image-loaded'); 2830 }, 10); 2831 }, 2832 beforeOpen: function() { 2833 this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim'); 2834 }, 2835 open: function() { 2836 2837 $.magnificPopup.instance.next = function() { 2838 var $that =
2838 this; 2839 2840 this.wrap.removeClass('mfp-image-loaded'); 2841 setTimeout(function() { 2842 $.magnificPopup.proto.next.call($that); 2843 }, 100); 2844 }; 2845 2846 $.magnificPopup.instance.prev = function() { 2847 var $that = this; 2848 2849 this.wrap.removeClass('mfp-image-loaded'); 2850 setTimeout(function() { 2851 $.magnificPopup.proto.prev.call($that); 2852 }, 100); 2853 }; 2854 2855 } 2856 }, 2857 fixedContentPos: false, 2858 mainClass: 'mfp-zoom-in', 2859 removalDelay: 400 2860 }); 2861 2862 // Video. 2863 $('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({ 2864 type: 'iframe', 2865 fixedContentPos: false, 2866 mainClass: 'mfp-zoom-in', 2867 removalDelay: 400 2868 }); 2869 2870 2871 // Galleries. 2872 $('a.magnific.gallery').each(function() { 2873 2874 var $parentRow = ($(this).closest('.wpb_column').length > 0) ? $(this).closest('.wpb_column') : $(this).parents('.row'); 2875 2876 if ($parentRow.length > 0 && !$parentRow.hasClass('lightbox-col')) { 2877 2878 $parentRow.magnificPopup({ 2879 type: 'image', 2880 delegate: 'a.magnific', 2881 mainClass: 'mfp-zoom-in', 2882 fixedContentPos: false, 2883 callbacks: { 2884 2885 elementParse: function(item) { 2886 2887 if ($(item.el).is('[href]') && $(item.el).attr('href').indexOf('iframe=true') != -1 || 2888 $(item.el).is('[href]') && $(item.el).attr('href').indexOf('https://www.youtube.com/watch') != -1) { 2889 item.type = 'iframe'; 2890 } else if ($(item.el).is('[href]') && $(item.el).attr('href').indexOf('video-popup-') != -1) { 2891 item.type = 'inline'; 2892 } else { 2893 item.type = 'image'; 2894 } 2895 }, 2896 2897 imageLoadComplete: function() { 2898 var $that = this; 2899 setTimeout(function() { 2900 $that.wrap.addClass('mfp-image-loaded'); 2901 }, 10); 2902 }, 2903 2904 beforeOpen: function() { 2905 this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim'); 2906 }, 2907 2908 open: function() { 2909 2910 // Self hosted video. 2911 if ($(this.content).find('.mejs-video video').length > 0 && $().mediaelementplayer) { 2912 $(this.content).find('.mejs-video video')[0].player.remove(); 2913 2914 var $that = this; 2915 setTimeout(function() { 2916 $($that.content).find('video').mediaelementplayer(); 2917 $($that.content).find('.mejs-video video')[0].player.play(); 2918 }, 50); 2919 2920 } 2921 2922 $.magnificPopup.instance.next = function() { 2923 var $that = this; 2924 2925 this.wrap.removeClass('mfp-image-loaded'); 2926 setTimeout(function() { 2927 $.magnificPopup.proto.next.call($that); 2928 2929 // Self hosted video. 2930 if ($($that.content).find('.mejs-video video').length > 0) { 2931 $($that.content).find('.mejs-video video')[0].play(); 2932 } 2933 2934 }, 100); 2935 }; 2936 2937 $.magnificPopup.instance.prev = function() { 2938 var $that = this; 2939 2940 this.wrap.removeClass('mfp-image-loaded'); 2941 setTimeout(function() { 2942 $.magnificPopup.proto.prev.call($that); 2943 2944 // Self hosted video. 2945 if ($($that.content).find('.mejs-video video').length > 0) { 2946 $($that.content).find('.mejs-video video')[0].play(); 2947 } 2948 }, 100); 2949 }; 2950 2951 }, 2952 2953 close: function() { 2954 // Self hosted video. 2955 if ($(this.content).find('.mejs-video video').length > 0) { 2956 $(this.content).find('.mejs-video video')[0].load(); 2957 } 2958 } 2959 }, 2960 removalDelay: 400, 2961 gallery: { 2962 enabled: true 2963 } 2964 }); 2965 2966 $parentRow.addClass('lightbox-col'); 2967 } 2968 2969 }); 2970 2971 } 2972 2973 2974 /** 2975 * Lightbox initialization. 2976 * 2977 * Determines which lightbox to use based on theme option. 2978 * 2979 * @since 8.0 2980 */ 2981 function lightBoxInit() { 2982 2983 setTimeout(function(){ 2984 if ($('body[data-ls="magnific"]').length > 0 || $('body[data-ls="pretty_photo"]').length > 0) { 2985 magnificInit(); 2986 } else if ($('body[data-ls="fancybox"]').length > 0) { 2987 fancyBoxInit(); 2988 } 2989 },100); 2990 2991 } 2992 2993 2994 /** 2995 * WPBakery page builder standard animations. 2996 * 2997 * @since 7.0 2998 * @see waypoints 2999 */ 3000 function vcWaypoints() { 3001 3002 $($fullscreenSelector + ' .wpb_animate_when_almost_visible').each(function () { 3003 3004 var $that = $(this), 3005 $vcOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : '90%', 3006 waypoint = new Waypoint({ 3007 element: $that, 3008 handler: function () { 3009 3010 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated')) { 3011 waypoint.destroy(); 3012 return; 3013 } 3014 3015 $that.addClass("animated"); 3016 $that.addClass("wpb_start_animation"); 3017 waypoint.destroy(); 3018 3019 if ($that.is('.nectar-button') && $('body[data-button-style*="rounded_shadow"]').length > 0) { 3020 setTimeout(function () { 3021 $that.removeClass('wpb_start_animation'); 3022 }, 1100); 3023 } 3024 3025 }, 3026 offset: $vcOffsetPos 3027 3028 }); 3029 3030 }); 3031 } 3032 3033 3034 3035 /** 3036 * Milestone element initialization. 3037 * 3038 * @since 4.0 3039 * @see waypoints 3040 */ 3041 function milestoneInit() { 3042 3043 $('.nectar-milestone').each(function () { 3044 3045 // Symbol 3046 if ($(this).is('[data-symbol]')) { 3047 3048 if ($(this).find('.symbol-wrap').length == 0) { 3049 3050 if ($(this).attr('data-symbol-pos') == 'before') { 3051 $(this) 3052 .find('.number') 3053 .prepend('<div class="symbol-wrap"><span class="symbol">' + $(this).attr('data-symbol') + '</span></div>'); 3054 } else { 3055 $(this) 3056 .find('.number') 3057 .append('<div class="symbol-wrap"><span class="symbol">' + $(this).attr('data-symbol') + '</span></div>'); 3058 } 3059 } 3060 3061 var $symbol_size; 3062 3063 if ($(this).attr('data-symbol-size') == $(this).find('.number').attr('data-number-size') && $(this).attr('data-symbol-alignment') == 'superscript') { 3064 $symbol_size = 32; 3065 } else { 3066 $symbol_size = parseInt($(this).attr('data-symbol-size'));
3067 } 3068 3069 $(this).find('.symbol-wrap').css({ 3070 'font-size': $symbol_size + 'px', 3071 'line-height': $symbol_size + 'px' 3072 }); 3073 } 3074 3075 $(this).find('.number').css({ 3076 'font-size': $(this).find('.number').attr('data-number-size') + 'px', 3077 'line-height': $(this).find('.number').attr('data-number-size') + 'px' 3078 }); 3079 }); 3080 3081 if (!bypassAnimations && $('.nectar-milestone').length > 0 || $body.hasClass('rtl') && $('.nectar-milestone').length > 0) { 3082 3083 // Blur effect 3084 var $blurCssString = ''; 3085 $($fullscreenSelector + '.nectar-milestone.motion_blur').each(function (i) { 3086 3087 $(this).removeClass(function (index, className) { 3088 return (className.match(/(^|\s)instance-\S+/g) || []).join(' '); 3089 }); 3090 3091 $(this).addClass('instance-' + i); 3092 3093 var $currentColor = $(this).find('.number').css('color'), 3094 colorInt = parseInt($currentColor.substring(1), 16); 3095 3096 var R = (colorInt & 0xFF0000) >> 16, 3097 G = (colorInt & 0x00FF00) >> 8, 3098 B = (colorInt & 0x0000FF) >> 0; 3099 3100 var $rgbaColorStart = 'rgba(' + R + ',' + G + ',' + B + ',0.2)', 3101 $rgbaColorEnd = 'rgba(' + R + ',' + G + ',' + B + ',1)', 3102 $numberSize = parseInt($(this).find('.number').attr('data-number-size')); 3103 3104 $blurCssString += '@keyframes motion-blur-number-' + i + ' { ' + 3105 ' 0% { ' + 3106 'opacity: 0;' + 3107 'color: ' + $rgbaColorStart + '; ' + 3108 '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 + '; ' + 3109 'transform: translateZ(0px) translateY(-100%); ' + 3110 '-webkit-transform: translateZ(0px) translateY(-100%); ' + 3111 '} ' + 3112 '33% { opacity: 1 }' + 3113 '100% { ' + 3114 'color: ' + $rgbaColorEnd + '; ' + 3115 'text-shadow: none; ' + 3116 'transform: translateZ(0px) translateY(0px); ' + 3117 '-webkit-transform: translateZ(0px) translateY(0px); ' + 3118 '} ' + 3119 '} ' + 3120 '@-webkit-keyframes motion-blur-number-' + i + ' { ' + 3121 ' 0% { ' + 3122 'opacity: 0;' + 3123 'color: ' + $rgbaColorStart + '; ' + 3124 '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 + '; ' + 3125 'transform: translateZ(0px) translateY(-100%); ' + 3126 '-webkit-transform: translateZ(0px) translateY(-100%); ' + 3127 '} ' + 3128 '33% { opacity: 1 }' + 3129 '100% { ' + 3130 'color: ' + $rgbaColorEnd + '; ' + 3131 'text-shadow: none; ' + 3132 'transform: translateZ(0px) translateY(0px); ' + 3133 '-webkit-transform: translateZ(0px) translateY(0px); ' + 3134 '} ' + 3135 '} ' + 3136 '.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 + '; } '; 3137 3138 if( $nectarFullPage.$usingFullScreenRows != false || $(this).find('.number > span').length == 0 ) { 3139 3140 // Separate each character into spans 3141 var $symbol = $(this).find('.symbol-wrap').clone(); 3142 $(this).find('.symbol-wrap').remove(); 3143 3144 var characters = $(this).find('.number').text().split(""); 3145 var $this = $(this).find('.number'); 3146 3147 $this.empty(); 3148 $.each(characters, function (i, el) { 3149 $this.append("<span>" + el + "</span"); 3150 });
3151 3152 // Handle symbol 3153 if ($(this).has('[data-symbol]')) { 3154 if ($(this).attr('data-symbol-pos') == 'after') { 3155 $this.append($symbol); 3156 } else { 3157 $this.prepend($symbol); 3158 } 3159 } 3160 3161 } // already made markup 3162 3163 }); 3164 3165 // Style 3166 nectarCreateStyle($blurCssString, 'milestone-blur'); 3167 3168 // Activate 3169 milestoneWaypoint(); 3170 3171 } 3172 3173 } 3174 3175 3176 /** 3177 * Milestone animation 3178 * 3179 * @since 4.0 3180 */ 3181 function milestoneWaypoint() { 3182 3183 $($fullscreenSelector + '.nectar-milestone').each(function () { 3184 3185 // Animation 3186 var $offset = ($fullscreenMarkupBool == true) ? '250%' : '98%'; 3187 3188 if( nectarDOMInfo.usingMobileBrowser && $offset == '98%') { 3189 $offset = '110%'; 3190 } 3191 3192 var $that = $(this), 3193 waypoint = new Waypoint({ 3194 element: $that, 3195 handler: function () { 3196 3197 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 3198 waypoint.destroy(); 3199 return; 3200 } 3201 3202 var $endNum = parseInt($that.find('.number span:not(.symbol)').text().replace(/,/g, '')); 3203 3204 if (!$that.hasClass('motion_blur')) { 3205 3206 var countOptions = { 3207 easingFn: easeOutCubic 3208 }; 3209 var $countEle = $that.find('.number span:not(.symbol)')[0]; 3210 var numAnim = new CountUp($countEle, 0, $endNum, 0, 2.2, countOptions); 3211 numAnim.start(); 3212 3213 } else { 3214 $that.find('span').each(function (i) { 3215 var $that = $(this); 3216 setTimeout(function () { 3217 $that.addClass('in-sight'); 3218 }, 200 * i); 3219 }); 3220 } 3221 3222 3223 $that.addClass('animated-in'); 3224 waypoint.destroy(); 3225 }, 3226 offset: $offset 3227 3228 }); 3229 3230 }); 3231 } 3232 3233 3234 3235 /** 3236 * Tabbed element change section event. 3237 * 3238 * @since 10.5 3239 */ 3240 function tabbedChangeSection(clickedTab) { 3241 3242 var $id = clickedTab.parents('li').index() + 1; 3243 var $frontEndEditorTabDiv = ($('body.vc_editor').length > 0) ? '> .wpb_tab ' : ''; 3244 3245 if (!clickedTab.hasClass('active-tab') && !clickedTab.hasClass('loading')) { 3246 3247 clickedTab.parents('ul') 3248 .find('a') 3249 .removeClass('active-tab'); 3250 3251 clickedTab 3252 .addClass('active-tab'); 3253 3254 clickedTab.parents('.tabbed').find('> div:not(.clear)' + $frontEndEditorTabDiv).css({ 3255 'visibility': 'hidden', 3256 'position': 'absolute', 3257 'opacity': '0', 3258 'left': '-9999px', 3259 'display': 'none' 3260 }).removeClass('visible-tab'); 3261 3262 if ($('body.vc_editor').length > 0) { 3263 3264 var $data_m_id = (clickedTab.parent().is('[data-m-id]')) ? clickedTab.parent().attr('data-m-id') : ''; 3265 3266 clickedTab.parents('.tabbed').find('> div[data-model-id="' + $data_m_id + '"]' + $frontEndEditorTabDiv).css({ 3267 'visibility': 'visible', 3268 'position': 'relative', 3269 'left': '0', 3270 'display': 'block' 3271 }).stop().transition({ 3272 'opacity': 1 3273 }, 400).addClass('visible-tab'); 3274 3275 if( !$body.is('[data-flex-cols="true"]') ) { 3276 convertFrontEndPadding(); 3277 } 3278 3279 } else { 3280 clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ')' + $frontEndEditorTabDiv).css({ 3281 'visibility': 'visible', 3282 'position': 'relative', 3283 'left': '0', 3284 'display': 'block' 3285 }).stop().transition({ 3286 'opacity': 1 3287 }, 400).addClass('visible-tab'); 3288 } 3289 3290 if (clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ') .iframe-embed').length > 0 || 3291 clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ') .portfolio-items').length > 0) { 3292 setTimeout(function () { 3293 $window.trigger('resize'); 3294 }, 10); 3295 } 3296 } 3297 3298 // Waypoint checking 3299 if ($tabbedClickCount != 0) { 3300 3301 var $currentVisTab = clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ')' + $frontEndEditorTabDiv); 3302 3303 if ($currentVisTab.find('.nectar-progress-bar').length > 0) { 3304 progressBars();
3305 } 3306 if ($currentVisTab.find('.divider-small-border [data-animate="yes"]').length > 0 || 3307 $currentVisTab.find('.divider-border [data-animate="yes"]').length > 0) { 3308 dividers(); 3309 } 3310 if ($currentVisTab.find('img.img-with-animation').length > 0 || 3311 $currentVisTab.find('.col.has-animation').length > 0 || 3312 $currentVisTab.find('.nectar_cascading_images').length > 0 || 3313 $currentVisTab.find('.wpb_column.has-animation').length > 0) { 3314 colAndImgAnimations(); 3315 cascadingImageBGSizing(); 3316 } 3317 if ($currentVisTab.find('.column-image-bg-wrap[data-bg-animation="displace-filter-fade"]').length > 0) { 3318 3319 for (var k = 0; k < $liquidBG_EL.length; k++) { 3320 3321 if ($($liquidBG_EL[k].canvasContainer).parents('.wpb_tab').length > 0 && 3322 $($liquidBG_EL[k].canvasContainer).parents('.wpb_tab').css('visibility') != 'hidden') { 3323 3324 // Add bg to container 3325 if ($($liquidBG_EL[k].canvasContainer).find('.image-added-to-stage').length == 0) { 3326 $liquidBG_EL[k].imgContainer.addChild($liquidBG_EL[k].bg); 3327 } 3328 $($liquidBG_EL[k].canvasContainer).find('.nectar-liquid-bg').addClass('image-added-to-stage'); 3329
3330 // Resize calcs 3331 $liquidBG_EL[k].resize(); 3332 3333 // Animate 3334 if ($($liquidBG_EL[k].canvasContainer).find('.nectar-liquid-bg.animated-in').length == 0) { 3335 $liquidBG_EL[k].animateProps($liquidBG_EL[k]); 3336 } 3337 3338 } 3339 } 3340 } 3341 if ($currentVisTab.find('.nectar-milestone').length > 0) { 3342 milestoneWaypoint(); 3343 } 3344 if ($currentVisTab.find('.nectar_image_with_hotspots[data-animation="true"]').length > 0) { 3345 imageWithHotspots(); 3346 setTimeout(function(){ 3347 $window.trigger('resize'); 3348 },100); 3349 } 3350 if ($currentVisTab.find('.nectar-fancy-ul').length > 0) { 3351 nectarFancyUlInit(); 3352 } 3353 if ($currentVisTab.find('.nectar-split-heading').length > 0) { 3354 splitLineHeadings(); 3355 } 3356 if ($currentVisTab.find('.wpb_column[data-border-animation="true"]').length > 0) { 3357 animatedColBorders(); 3358 } 3359 if ($currentVisTab.find('.wpb_animate_when_almost_visible').length > 0) { 3360 vcWaypoints(); 3361 } 3362 if ($currentVisTab.find('.nectar-animated-title').length > 0) { 3363 animatedTitles(); 3364 } 3365 if ($currentVisTab.find('.nectar-highlighted-text').length > 0) { 3366 highlightedText(); 3367 } 3368 if ($currentVisTab.find('.nectar_food_menu_item').length > 0) { 3369 foodMenuItems(); 3370 } 3371 if ($currentVisTab.find('.nectar-post-grid:not([data-animation="none"])').length > 0) { 3372 NectarPostGridWaypoint(); 3373 } 3374 3375 if (clickedTab.parents('.wpb_row').length > 0) { 3376 3377 if ($currentVisTab.find('.vc_pie_chart').length > 0 || 3378 $currentVisTab.find('.wp-video-shortcode').length > 0 || 3379 $currentVisTab.find('.post-area.masonry .posts-container').length > 0 || 3380 $currentVisTab.find('.twentytwenty-container').length > 0 || 3381 clickedTab.parents('#nectar_fullscreen_rows[data-content-overflow="scrollbar"]').length > 0 || 3382 clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ')').find('.wpb_gallery').length > 0 || 3383 clickedTab.parents('.wpb_row').next().hasClass('parallax_section')) { 3384 $window.trigger('resize'); 3385 } 3386 3387 if ($currentVisTab.find('.nectar-flickity').length > 0 && typeof Flickity != 'undefined') { 3388 var tabbedFlkty = Flickity.data(clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ')').find('.nectar-flickity')[0]); 3389 tabbedFlkty.resize(); 3390 } 3391 3392 if ($currentVisTab.find('.nectar-woo-flickity').length > 0 && typeof Flickity != 'undefined') { 3393 var wootabbedFlkty = Flickity.data(clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ')').find('.nectar-woo-flickity > ul')[0]); 3394 wootabbedFlkty.resize(); 3395 } 3396 3397 } 3398 3399 //SVG icons 3400 $currentVisTab.find('.svg-icon-holder').each(function (i) { 3401 3402 var $that = $(this); 3403 3404 setTimeout(function () { 3405 3406 var $animationDelay = 0; 3407 3408 if($that.is('[data-animation-delay]') && 3409 $that.attr('data-animation-delay').length > 0 && 3410 $that.attr('data-animation') != 'false') { 3411 $animationDelay = $that.attr('data-animation-delay'); 3412 } 3413 3414 clearTimeout($animatedSVGIconTimeout[i]); 3415 3416 if ($that.attr('data-animation') == 'false') { 3417 $that.css('opacity', '1'); 3418 $svgIcons[$that.find('svg').attr('id').slice(-1)].finish(); 3419 } else { 3420 3421 $svgIcons[$that.find('svg').attr('id').slice(-1)].reset(); 3422 $animatedSVGIconTimeout[i] = setTimeout(function () { 3423 $svgIcons[$that.find('svg').attr('id').slice(-1)].play(); 3424 }, $animationDelay); 3425 3426 } 3427 }, 150); 3428 }); 3429 3430 } 3431 3432 // Fix columns inside tabs 3433 clickedTab.parents('.tabbed').find('.wpb_row').each(function () { 3434 if (typeof $(this).find('[class*="vc_col-"]').first().offset() != 'undefined') { 3435 3436 var $firstChildOffset = $(this).find('[class*="vc_col-"]').first().offset().left; 3437 3438 $(this).find('[class*="vc_col-"]').each(function () { 3439 $(this).removeClass('no-left-margin'); 3440 if ($(this).offset().left < $firstChildOffset + 15) { 3441 $(this).addClass('no-left-margin'); 3442 } else { 3443 $(this).removeClass('no-left-margin'); 3444 } 3445 });
3446 } 3447 3448 }); 3449 3450 $tabbedClickCount++; 3451 3452 // Magic line 3453 if (clickedTab.parent().parent().find('.magic-line').length > 0) { 3454 magicLineCalc(clickedTab); 3455 } 3456 3457 } 3458 3459 3460 /** 3461 * Tabbed element magic line - used for style "Minimal alt" 3462 * 3463 * @since 7.0 3464 */ 3465 function magicLineCalc($ele) { 3466 3467 var el, leftPos, ratio; 3468 3469 el = $ele.parent(); 3470 if (el.length) { 3471 leftPos = el.position().left; 3472 ratio = el.width(); 3473 } else { 3474 leftPos = ratio = 0; 3475 } 3476 3477 3478 $ele.parent().parent() 3479 .find('.magic-line') 3480 .css('transform', 'translateX(' + leftPos + 'px) scaleX(' + ratio + ')'); 3481 } 3482 3483 3484 /** 3485 * Tabbed element deep linking. 3486 * 3487 * @since 3.0 3488 */ 3489 function tabbbedDeepLinking() { 3490 3491 if (typeof nectarGetQueryParam['tab'] != 'undefined') { 3492 $('.wpb_tabs_nav').each(function () { 3493 3494 $(this).find('li').each(function () { 3495 3496 var $currentText = $(this).find('a').clone(), 3497 $getText = nectarGetQueryParam['tab'], 3498 $that = $(this); 3499 3500 $currentText.find('svg').remove(); 3501 $currentText = $currentText.text(); 3502 $currentText = $currentText.replace(/\s+/g, '-').toLowerCase(); 3503 3504 // SVG icons. 3505 if( $currentText.length > 0 && $currentText.substring(0,1) === '-' ) { 3506 $currentText = $currentText.substring(1); 3507 } 3508 3509 $getText = $getText.replace(/\s+/g, '-').replace(/</g, '<').replace(/"/g, '"').toLowerCase(); 3510 3511 if ($currentText == $getText) { 3512 3513 $(this).find('a').trigger('click'); 3514 3515 setTimeout(function () { 3516 $that.find('a').trigger('click'); 3517 }, 501); 3518 } 3519 3520 }); 3521 3522 }); 3523 3524 } 3525 3526 } 3527 3528 3529 3530 /** 3531 * Tabbed element initialization. 3532 * 3533 * @since 3.0 3534 */ 3535 function tabbedInit() { 3536 3537 // Click event 3538 $body.on('click', '.tabbed > ul li:not(.cta-button) a', function(){ 3539 tabbedChangeSection($(this)); 3540 return false; 3541 }); 3542 3543 $('.tabbed').each(function () { 3544 3545 var $that; 3546 3547 // Handle icons 3548 $(this).find('.wpb_tab').each(function (i) { 3549 3550 if ($(this).is('[data-tab-icon]') && $(this).attr('data-tab-icon').length > 0) { 3551 3552 $(this) 3553 .parents('.tabbed') 3554 .addClass('using-icons'); 3555 3556 $(this) 3557 .parents('.tabbed') 3558 .find('.wpb_tabs_nav li:nth-child(' + (i + 1) + ') > a') 3559 .prepend('<i class="' + $(this).attr("data-tab-icon") + '"></i>'); 3560 3561 } 3562 3563 // SVG icons 3564 if ($(this).find('.im-icon-wrap.tab-icon').length > 0) { 3565 3566 var $svg_icon_markup = $(this).find('.im-icon-wrap.tab-icon').detach(); 3567 $(this).parents('.tabbed') 3568 .find('.wpb_tabs_nav li:nth-child(' + (i + 1) + ') > a') 3569 .prepend($svg_icon_markup); 3570 } 3571 3572 }); 3573 3574 3575 if ($(this).find('.swiper-container').length == 0 && 3576 $(this).find('.testimonial_slider').length == 0 && 3577 $(this).find('.portfolio-items:not(".carousel")').length == 0 && 3578 $(this).find('.wpb_gallery .portfolio-items').length == 0 && 3579 $(this).find('iframe').length == 0) { 3580 $(this).find('> ul li:first-child a').trigger('click'); 3581 } 3582 3583 if ($(this).find('.testimonial_slider').length > 0 || 3584 $(this).find('.portfolio-items:not(".carousel")').length > 0 || 3585 $(this).find('.wpb_gallery .portfolio-items').length > 0 || 3586 $(this).find('iframe').length > 0) { 3587 3588 $that = $(this); 3589 $(this).find('.wpb_tab').show().css({ 3590 'opacity': 0, 3591 'height': '1px' 3592 }); 3593 3594 $(this).find('> ul li a').addClass('loading'); 3595 3596 setTimeout(function () { 3597 $that.find('.wpb_tab').hide().css({ 3598 'opacity': 1, 3599 'height': 'auto' 3600 }); 3601 3602 $that.find('> ul li a').removeClass('loading'); 3603 $that.find('> ul li:first-child a').trigger('click'); 3604 tabbbedDeepLinking(); 3605 3606 }, 900); 3607 } 3608 3609 $that = $(this); 3610 3611 // Minimal alt effect 3612 setTimeout(function () { 3613 if ($that.is('[data-style="minimal_alt"]')) { 3614 $that.find('> ul').append('<li class="magic-line" />'); 3615 magicLineCalc($that.find('> ul > li:first-child > a')); 3616 } 3617 }, 100); 3618 3619 3620 }); 3621 3622 // Minimal alt resize event. 3623 if ( $('.tabbed[data-style="minimal_alt"]').length > 0 ) { 3624 $window.on('smartresize',function(){ 3625 3626 $('.tabbed[data-style="minimal_alt"]').each(function(){ 3627 3628 if( $(this).find('a.active-tab').length > 0 ) { 3629 magicLineCalc( $(this).find('a.active-tab') ); 3630 } 3631 3632 });
3633 3634 3635 }); 3636 3637 } 3638 3639 3640 tabbbedDeepLinking(); 3641 3642 // Vertical scrolling 3643 $('.nectar-scrolling-tabs').each(function(i) { 3644 if(!nectarDOMInfo.usingFrontEndEditor) { 3645 $verticalScrollingTabs[i] = new VerticalScrollingTabs($(this)); 3646 } 3647 }); 3648 3649 3650 } 3651 3652 3653 /** 3654 * Vertical Scrolling Tabs 3655 * 3656 * @since 12.0 3657 */ 3658 3659 function VerticalScrollingTabs(el) { 3660 3661 this.$el = el; 3662 this.$tabContent = el.find('.scrolling-tab-content'); 3663 this.$lineEl = el.find('.scrolling-tab-nav .line'); 3664 this.observer = null; 3665 3666 this.domSetup(); 3667 this.highlightObserve(); 3668 // Sticky handled in stickySidebarInit(); 3669 3670 } 3671 3672 VerticalScrollingTabs.prototype.domSetup = function() { 3673 3674 var that = this; 3675 var href = ''; 3676 3677 3678 // Icons 3679 this.$el.find('.wpb_tab').each(function (i) { 3680 3681 if ($(this).is('[data-tab-icon]') && $(this).attr('data-tab-icon').length > 0) { 3682 that.$el.addClass('using-icons'); 3683 3684 href = that.$el.find('.wpb_tabs_nav li:nth-child(' + (i + 1) + ') a').attr('href'); 3685 3686 that.$el 3687 .find('.wpb_tabs_nav li:nth-child(' + (i + 1) + ')') 3688 .addClass('has-icon') 3689 .prepend('<a class="skip-hash" href="'+href+'"><i class="' + $(this).attr("data-tab-icon") + '"></i></a>'); 3690 } 3691 3692 // SVG icons 3693 if ($(this).find('.im-icon-wrap.tab-icon').length > 0) { 3694 3695 href = that.$el.find('.wpb_tabs_nav li:nth-child(' + (i + 1) + ') a').attr('href'); 3696 3697 var $svg_icon_markup = $(this).find('.im-icon-wrap.tab-icon').detach(); 3698 that.$el 3699 .find('.wpb_tabs_nav li:nth-child(' + (i + 1) + ')') 3700 .addClass('has-icon') 3701 .prepend('<a class="skip-hash svg-icon-link" href="'+href+'"></a>'); 3702 3703 that.$el.find('.wpb_tabs_nav li:nth-child(' + (i + 1) + ') .svg-icon-link').append($svg_icon_markup); 3704 3705 } 3706 3707 }); 3708 3709 3710 // First active 3711 this.$el.find('.scrolling-tab-nav .menu-item:first').addClass('active'); 3712 this.lineAnimation(); 3713 3714 // Only tab 3715 if( this.$el.find('.scrolling-tab-nav .menu-item').length == 1 ) { 3716 this.$el.find('.scrolling-tab-nav').addClass('single-tab'); 3717 } 3718 3719 var $tabContent = this.$el.find('.scrolling-tab-content'); 3720 3721 this.$el.find('.scrolling-tab-nav .menu-item').each(function(i) { 3722 3723 i = i+1; 3724 var $tab = $tabContent.find('> div:nth-child('+i+')'); 3725 3726 // Add titles to mobile 3727 var $title = $(this).html(); 3728 $tab.prepend('<div class="scrolling-tab-mobile-title"><div class="inner">' + $title + '</div></div>'); 3729 $tab.find('.scrolling-tab-mobile-title a').contents().unwrap(); 3730 3731 // Create normal anchor relation. 3732 if( $tab ) { 3733 var id = $(this).find('a').attr('href'); 3734 id = id.substr(1); 3735 $tab.find('> .scrolling-tab-mobile-title').attr('id',id); 3736 $tab.removeAttr('id'); 3737 } 3738 3739 }); 3740 3741 3742 3743 }; 3744 3745 VerticalScrollingTabs.prototype.highlightObserve = function() { 3746 3747 var that = this; 3748 3749 if( !(nectarDOMInfo.usingMobileBrowser && nectarDOMInfo.winW < 1000) ) { 3750 3751 if( 'IntersectionObserver' in window ) { 3752 3753 var options = { 3754 rootMargin: '0px', 3755 threshold: 1 3756 } 3757 3758 this.observer = new IntersectionObserver(function(entries) { 3759 3760 entries.forEach(function(entry) { 3761 3762 var href = '#' + $(entry.target).attr('id'); 3763 var $menuItem = that.$el.find('.scrolling-tab-nav a[href="'+href+'"]'); 3764 3765 if (entry.isIntersecting && entry.intersectionRatio >= 1) { 3766 3767 $menuItem.parents('.menu-item').addClass('visible'); 3768 3769 } else { 3770 $menuItem.parents('.menu-item').removeClass('visible'); 3771 } 3772 3773 // Highlight 3774 var $firstVisLink = that.$el.find('.scrolling-tab-nav .menu-item.visible:first'); 3775 3776 // a link is visible 3777 if( $firstVisLink.length > 0 ) { 3778 that.$el.find('.scrolling-tab-nav .menu-item').removeClass('active'); 3779 $firstVisLink.addClass('active'); 3780 that.lineAnimation(); 3781 } 3782 3783 3784 });
3785 3786 }, options); 3787 3788 // Observe each section. 3789 this.$tabContent.find('> div > .scrolling-tab-mobile-title[id]').each(function() { 3790 that.observer.observe($(this)[0]); 3791 }); 3792 3793 } // if intersection observer. 3794 3795 } // don't trigger on mobile. 3796 3797 }; 3798 3799 VerticalScrollingTabs.prototype.lineAnimation = function() { 3800 3801 var activeItem = this.$el.find('.scrolling-tab-nav .active'); 3802 3803 if( activeItem.length == 0 ) { 3804 return; 3805 } 3806 3807 var itemOffset = parseInt(activeItem.position().top); 3808 var itemHeight = parseInt(activeItem.height()); 3809 3810 this.$lineEl.css({ 3811 'max-height': itemHeight + 'px', 3812 'transform' : 'translate3d(0px, '+itemOffset+'px, 0px)' 3813 }); 3814 3815 }; 3816 3817 3818 3819 3820 3821 3822 3823 3824 /** 3825 * Toggle Panels element deep linking. 3826 * 3827 * @since 3.0 3828 */ 3829 function accordionDeepLinking() { 3830 3831 if (typeof nectarGetQueryParam['toggle'] != 'undefined') { 3832 $('.toggles').each(function () { 3833 3834 $(this).find('.toggle').each(function () { 3835 var $currentText = $(this).find('h3 a').clone(); 3836 var $getText = nectarGetQueryParam['toggle']; 3837 3838 $($currentText).find('i').remove(); 3839 $currentText = $currentText.text(); 3840 $currentText = $currentText.replace(/\s+/g, '-').toLowerCase(); 3841 $getText = $getText.replace(/\s+/g, '-').replace(/</g, '<').replace(/"/g, '"').toLowerCase(); 3842 3843 if ($currentText == $getText) { 3844 $(this).find('h3 a').trigger('click'); 3845 } 3846 }); 3847 }); 3848 } 3849 3850 } 3851 3852 3853 3854 3855 function accordionSizing() { 3856 3857 $('.toggles').each(function(){ 3858 3859 var openToggle = $(this).find('.toggle.open'); 3860 if( openToggle.length > 0 ) { 3861 var openToggleInner = openToggle.find('> div')[0]; 3862 3863 openToggleInner.style.maxHeight = openToggleInner.scrollHeight + "px"; 3864 } 3865 3866 3867 }); 3868 3869 } 3870 3871 /** 3872 * Toggle Panels element initialization. 3873 * 3874 * @since 3.0 3875 */ 3876 function accordionInit() { 3877 3878 setTimeout(function() { 3879 3880 $('.accordion').each(function () { 3881 3882 // Legacy. 3883 if( $(this).find('.toggle[data-inner-wrap="true"]').length == 0 ) { 3884 $(this).find('> .toggle').first().addClass('open').find('> div').show(); 3885 } else if(!nectarDOMInfo.usingFrontEndEditor) { 3886 var $firstToggle = $(this).find('> .toggle').first(); 3887 $firstToggle.addClass('open'); 3888 $firstToggle.find('> div')[0].style.maxHeight = $firstToggle.find('> div')[0].scrollHeight + "px"; 3889 } 3890 3891 $(this).find('> .toggle').first().find('a:not(.nectar-button) i').attr('class', 'icon-minus-sign'); 3892 3893 }); 3894 3895 accordionDeepLinking(); 3896 3897 }, 60); 3898 3899 if( $('.toggle[data-inner-wrap="true"]').length > 0 ) { 3900 $window.on('smartresize', accordionSizing); 3901 } 3902 3903 } 3904 3905 function accordionClickEvents() { 3906 3907 // Regular toggle click event 3908 $body.on('click', '.toggle h3 a', function () { 3909 3910 if (!$(this).parents('.toggles').hasClass('accordion')) { 3911 3912 // Legacy. 3913 if( $(this).parents('.toggle[data-inner-wrap="true"]').length == 0 ) { 3914 3915 $(this).parents('.toggle') 3916 .find('> div') 3917 .slideToggle(300); 3918 3919 } else { 3920 3921 var parentEl = $(this).parents('.toggle').find('> div')[0]; 3922 3923 if (parentEl.style.maxHeight) { 3924 parentEl.style.maxHeight = null; 3925 } else { 3926 parentEl.style.maxHeight = parentEl.scrollHeight + "px"; 3927 } 3928 3929 } 3930 3931 3932 $(this).parents('.toggle') 3933 .toggleClass('open'); 3934 3935 // Switch icon 3936 if ($(this).parents('.toggle').hasClass('open')) { 3937 $(this) 3938 .find('i') 3939 .attr('class', 'icon-minus-sign'); 3940 } else { 3941 $(this) 3942 .find('i') 3943 .attr('class', 'icon-plus-sign'); 3944 } 3945 3946 if ($(this).parents('.toggle').find('> div .iframe-embed').length > 0 && 3947 $(this).parents('.toggle').find('> div iframe.iframe-embed').height() == '0') { 3948 responsiveVideoIframes(); 3949 } 3950 3951 if ($(this).parents('.full-width-content').length > 0) { 3952 setTimeout(function () { 3953 fullWidthContentColumns(); 3954 }, 300); 3955 } 3956 3957 if ($('#nectar_fullscreen_rows').length > 0) { 3958 setTimeout(function () { 3959 $window.trigger('smartresize'); 3960 }, 300); 3961 } 3962 return false; 3963 } 3964 }); 3965 3966 // Accordion click event 3967 $body.on('click', '.accordion .toggle h3 a', function () { 3968 3969 if ($(this).parents('.toggle').hasClass('open')) { 3970 return false; 3971 } 3972 3973 var $t; 3974 var $parentToggles = $(this).parents('.toggles'); 3975 var $parentToggle = $(this).parents('.toggle'); 3976 3977 3978 // Legacy. 3979 if( $(this).parents('.toggle[data-inner-wrap="true"]').length == 0 ) { 3980 3981 $parentToggles.find('.toggle > div').slideUp(300); 3982 $parentToggles.find('.toggle h3 a i').attr('class', 'icon-plus-sign'); 3983 $parentToggles.find('.toggle').removeClass('open'); 3984 $parentToggle.find('> div').slideDown(300); 3985 $parentToggle.addClass('open'); 3986 3987 } else { 3988 3989 var parentEl = $parentToggle.find('> div')[0]; 3990 3991 $parentToggles.find('.toggle > div').each(function(){ 3992 $(this)[0].style.maxHeight = null; 3993 });
3994 3995 $parentToggles.find('.toggle h3 a i').attr('class', 'icon-plus-sign'); 3996 $parentToggles.find('.toggle').removeClass('open'); 3997 3998 parentEl.style.maxHeight = parentEl.scrollHeight + "px"; 3999 4000 $parentToggle.addClass('open'); 4001 4002 } 4003 4004 // Switch icon 4005 if ($parentToggle.hasClass('open')) { 4006 $(this).find('i').attr('class', 'icon-minus-sign'); 4007 } else { 4008 $(this).find('i').attr('class', 'icon-plus-sign'); 4009 } 4010 4011 if ($(this).parents('.full-width-content').length > 0) { 4012 clearTimeout($t); 4013 $t = setTimeout(function () { 4014 fullWidthContentColumns(); 4015 }, 400); 4016 } 4017 if ($('#nectar_fullscreen_rows').length > 0) { 4018 clearTimeout($t); 4019 $t = setTimeout(function () { 4020 $window.trigger('smartresize'); 4021 }, 400); 4022 } 4023 4024 return false; 4025 4026 }); 4027 4028 } 4029 4030 4031 4032 4033 4034 /** 4035 * Color hex to rgb 4036 * 4037 * @since 3.0 4038 */ 4039 function shadeColor(hex, lum) { 4040 4041 // Validate hex string 4042 hex = String(hex).replace(/[^0-9a-f]/gi, ''); 4043 if (hex.length < 6) { 4044 hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2]; 4045 } 4046 lum = lum || 0; 4047 4048 // Convert to decimal and change luminosity 4049 var rgb = "#", 4050 c, i; 4051 for (i = 0; i < 3; i++) { 4052 c = parseInt(hex.substr(i * 2, 2), 16); 4053 c = Math.round(Math.min(Math.max(0, c + (c * lum)), 255)).toString(16); 4054 rgb += ("00" + c).substr(c.length); 4055 } 4056 4057 return rgb; 4058 } 4059 4060 /** 4061 * Jumbo size 3D nectar button. 4062 * 4063 * @since 3.0 4064 */ 4065 function createExtraJumboSize() { 4066 4067 $('.nectar-3d-transparent-button').each(function () { 4068 4069 if ($(this).css('visibility') != 'visible') { 4070 return; 4071 } 4072 4073 var $that = $(this), 4074 $size = $that.attr('data-size'), 4075 $padding = 0; 4076 4077 var $vert_height_divider = 1.7; 4078 4079 if ($size == 'extra_jumbo') { 4080 4081 var $font_size; 4082 4083 if (nectarDOMInfo.winW < 1000 && nectarDOMInfo.winW > 690) { 4084 $padding = 64; 4085 $font_size = 34; 4086 $that.find('.back-3d rect').attr('stroke-width', '12'); 4087 $vert_height_divider = 1.7; 4088 } else if (nectarDOMInfo.winW <= 690) { 4089 $padding = 46; 4090 $font_size = 16; 4091 $that.find('.back-3d rect').attr('stroke-width', '10'); 4092 $vert_height_divider = 1.7; 4093 } else { 4094 $padding = 100; 4095 $font_size = 64; 4096 $that.find('.back-3d rect').attr('stroke-width', '20'); 4097 $vert_height_divider = 1.6; 4098 } 4099 4100 4101 $that.find('svg text').attr('font-size', $font_size); 4102 4103 var $boundingRect = $(this).find('.back-3d .button-text')[0].getBoundingClientRect(), 4104 $text_width = $boundingRect.width, 4105 $text_height = $font_size * 1.5; 4106 4107 $that.css({ 4108 'width': ($text_width + $padding * 1.5) + 'px', 4109 'height': ($text_height + $padding) + 'px' 4110 }); 4111 4112 $that.find('> a').css({ 4113 'height': ($text_height + $padding) + 'px' 4114 }); 4115 4116 $that.find('.back-3d svg, .front-3d svg').css({ 4117 'width': ($text_width + $padding * 1.5) + 'px', 4118 'height': ($text_height + $padding) + 'px' 4119 }).attr('viewBox', '0 0 ' + ($text_width + $padding * 1.5) + ' ' + ($text_height + $padding)); 4120 4121 $that.find('svg text').attr('transform', 'matrix(1 0 0 1 ' + ($text_width + $padding * 1.6) / 2 + ' ' + (($text_height + $padding) / $vert_height_divider) + ')'); 4122 $that.find('.front-3d ').css('transform-origin', '50% 50% -' + ($text_height + $padding) / 2 + 'px'); 4123 $that.find('.back-3d').css('transform-origin', '50% 50% -' + ($text_height + $padding) / 2 + 'px'); 4124 4125 } 4126 4127 }); 4128 4129 } 4130 4131 4132 /** 4133 * Nectar Button custom coloring 4134 * 4135 * @since 3.0 4136 */ 4137 function coloredButtons() { 4138 4139 $('.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 () { 4140 4141 var $usingMaterialSkin = ($('body.material[data-button-style^="rounded"]').length > 0) ? true : false; 4142 $(this).css('visibility', 'visible'); 4143 4144 if ($(this).hasClass('see-through-3') && $(this).attr('data-color-override') == 'false') { 4145 return true; 4146 } 4147 4148 var $color; 4149 var $that; 4150 4151 if ($(this).attr('data-color-override') != 'false') { 4152 $color = $(this).attr('data-color-override'); 4153 } else { 4154
4155 if ($(this).parents('.dark').length > 0) { 4156 $color = '#000000'; 4157 } else { 4158 $color = '#ffffff'; 4159 } 4160 4161 } 4162 4163 if (!$(this).hasClass('see-through-3')) { 4164 $(this).css('color', $color); 4165 } 4166 4167 $(this).find('i').css('color', $color); 4168 4169 var colorInt = parseInt($color.substring(1), 16); 4170 var $hoverColor = ($(this).has('[data-hover-color-override]')) ? $(this).attr('data-hover-color-override') : 'no-override'; 4171 var $hoverTextColor = ($(this).has('[data-hover-text-color-override]')) ? $(this).attr('data-hover-text-color-override') : '#fff'; 4172 4173 var R = (colorInt & 0xFF0000) >> 16; 4174 var G = (colorInt & 0x00FF00) >> 8; 4175 var B = (colorInt & 0x0000FF) >> 0; 4176 4177 var $opacityStr = ($(this).hasClass('see-through-3')) ? '1' : '0.75'; 4178 4179 $(this).css('border-color', 'rgba(' + R + ',' + G + ',' + B + ',' + $opacityStr + ')'); 4180 4181 // Material theme skin buttons w/ icons starting 4182 if ($usingMaterialSkin) { 4183 $(this).find('i').css({ 4184 'background-color': 'rgba(' + R + ',' + G + ',' + B + ',1)', 4185 'box-shadow': '0px 8px 15px rgba(' + R + ',' + G + ',' + B + ',0.24)' 4186 }); 4187 } 4188 4189 if ($(this).hasClass('see-through')) { 4190 4191 $that = $(this); 4192 4193 $(this).on('mouseenter touchstart', function () { 4194 $that.css('border-color', 'rgba(' + R + ',' + G + ',' + B + ',1)'); 4195 }); 4196 4197 $(this).on('mouseleave touchtouchend', function () { 4198 $that.css('border-color', 'rgba(' + R + ',' + G + ',' + B + ',1)'); 4199 $opacityStr = ($(this).hasClass('see-through-3')) ? '1' : '0.75'; 4200 $that.css('border-color', 'rgba(' + R + ',' + G + ',' + B + ',' + $opacityStr + ')'); 4201 }); 4202 4203 } else { 4204 4205 $(this).find('i').css('color', $hoverTextColor); 4206 4207 if ($hoverColor != 'no-override') { 4208 4209 $that = $(this); 4210 4211 $(this).on('mouseenter touchstart', function () { 4212 4213 $that.css({ 4214 'border-color': $hoverColor, 4215 'background-color': $hoverColor, 4216 'color': $hoverTextColor 4217 });
4218 4219 // Material buttons w/ icons over 4220 if ($usingMaterialSkin) { 4221 $that.find('i').css({ 4222 'background-color': '', 4223 'box-shadow': '' 4224 }); 4225 } 4226 }); 4227 4228 $(this).on('mouseleave touchtouchend', function () { 4229 4230 $opacityStr = ($(this).hasClass('see-through-3')) ? '1' : '0.75'; 4231 4232 if ($usingMaterialSkin) { 4233 $that.find('i').css({ 4234 'background-color': 'rgba(' + R + ',' + G + ',' + B + ',1)', 4235 'box-shadow': '0px 8px 15px rgba(' + R + ',' + G + ',' + B + ',0.24)' 4236 }); 4237 } 4238 4239 if (!$that.hasClass('see-through-3')) { 4240 $that.css({ 4241 'border-color': 'rgba(' + R + ',' + G + ',' + B + ',' + $opacityStr + ')', 4242 'background-color': 'transparent', 4243 'color': $color 4244 }); 4245 } else { 4246 $that.css({ 4247 'border-color': 'rgba(' + R + ',' + G + ',' + B + ',' + $opacityStr + ')', 4248 'background-color': 'transparent' 4249 }); 4250 } 4251 4252 }); 4253 4254 } else { 4255 4256 $that = $(this); 4257 4258 $(this).on('mouseenter touchstart', function () { 4259 4260 $that.css({ 4261 'border-color': $hoverColor, 4262 'color': $hoverTextColor 4263 });
4264 4265 }); 4266 4267 $(this).on('mouseleave touchtouchend', function () { 4268 4269 $opacityStr = ($that.hasClass('see-through-3')) ? '1' : '0.75'; 4270 $that.css({ 4271 'border-color': 'rgba(' + R + ',' + G + ',' + B + ',' + $opacityStr + ')', 4272 'color': $hoverTextColor 4273 }); 4274 4275 }); 4276 4277 } 4278 } 4279 }); 4280 4281 $('.nectar-button:not(.see-through):not(.see-through-2):not(.see-through-3)[data-color-override]').each(function () { 4282 4283 $(this).css('visibility', 'visible'); 4284 4285 if ($(this).attr('data-color-override') != 'false') { 4286 4287 var $color = $(this).attr('data-color-override'); 4288 4289 $(this) 4290 .removeClass('accent-color') 4291 .removeClass('extra-color-1') 4292 .removeClass('extra-color-2') 4293 .removeClass('extra-color-3') 4294 .css('background-color', $color); 4295 } 4296 4297 }); 4298 4299 4300 // Solid color tilt 4301 if ($('.swiper-slide .solid_color_2').length > 0 || $('.tilt-button-inner').length > 0) { 4302 4303 var $tiltButtonCssString = ''; 4304 var $color; 4305 4306 $('.swiper-slide .solid_color_2 a').each(function (i) { 4307 4308 $(this).addClass('instance-' + i); 4309 4310 if ($(this).attr('data-color-override') != 'false') { 4311 $color = $(this).attr('data-color-override'); 4312 } else { 4313 if ($(this).parents('.dark').length > 0) { 4314 $color = '#000000'; 4315 } 4316 else { 4317 $color = '#ffffff'; 4318 } 4319 } 4320 4321 $(this).css('color', $color); 4322 $(this).find('i').css('color', $color); 4323 4324 var $currentColor = $(this).css('background-color'), 4325 $topColor = shadeColor($currentColor, 0.13), 4326 $bottomColor = shadeColor($currentColor, -0.15); 4327 4328 $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 + '; } '; 4329 4330 }); 4331 4332 4333 $('.tilt-button-wrap a').each(function (i) { 4334 4335 $(this).addClass('instance-' + i); 4336 4337 var $currentColor = $(this).css('background-color'); 4338 var $color; 4339 4340 if ($(this).attr('data-color-override') != 'false') { 4341 $color = $(this).attr('data-color-override'); 4342 $(this).css('background-color', $color); 4343 $currentColor = $color; 4344 } 4345 4346 var $topColor = shadeColor($currentColor, 0.13), 4347 $bottomColor = shadeColor($currentColor, -0.15); 4348 4349 $tiltButtonCssString += '.tilt-button-wrap a.instance-' + i + ':after { background-color: ' + $topColor + '; }' + ' .tilt-button-wrap a.instance-' + i + ':before { background-color: ' + $bottomColor + '; } '; 4350 4351 }); 4352 4353 // Style 4354 nectarCreateStyle($tiltButtonCssString, 'tilt-button'); 4355 4356 } 4357 4358 4359 // Transparent 3D 4360 if ($('.nectar-3d-transparent-button').length > 0) { 4361 4362 var $3dTransButtonCssString = ''; 4363 $('.nectar-3d-transparent-button').each(function (i) { 4364 4365 var $that = $(this), 4366 $size = $that.attr('data-size'), 4367 $padding = 0, 4368 v1 = 1.5, 4369 v2 = 1.65, 4370 $font_size; 4371 4372 // Size 4373 if ($size == 'large') { 4374 $padding = 46; 4375 $font_size = 16; 4376 v1 = 1.5; 4377 v2 = 1.7; 4378 } else if ($size == 'medium') { 4379 $padding = 30; 4380 $font_size = 16; 4381 } else if ($size == 'small') { 4382 $padding = 20; 4383 $font_size = 12; 4384 } else if ($size == 'jumbo') { 4385 $padding = 54; 4386 $font_size = 24; 4387 v1 = 1.5; 4388 v2 = 1.68; 4389 } else if ($size == 'extra_jumbo') { 4390 $padding = 100; 4391 $font_size = 64; 4392 v1 = 1.6; 4393 v2 = 1.6; 4394 } 4395 4396 $that.find('svg text').attr('font-size', $font_size); 4397 4398 var $boundingRect = $(this).find('.back-3d .button-text')[0].getBoundingClientRect(), 4399 $text_width = $boundingRect.width, 4400 $text_height = $font_size * 1.5; 4401 4402 $that.css({ 4403 'width': ($text_width + $padding * 1.5) + 'px', 4404 'height': ($text_height + $padding) + 'px' 4405 });
4406 4407 $that.find('> a').css({ 4408 'height': ($text_height + $padding) + 'px' 4409 }); 4410 4411 $that.find('.back-3d svg, .front-3d svg').css({ 4412 'width': ($text_width + $padding * 1.5) + 'px', 4413 'height': ($text_height + $padding) + 'px' 4414 }).attr('viewBox', '0 0 ' + ($text_width + $padding * 1.5) + ' ' + ($text_height + $padding)); 4415 4416 $that.find('svg text').attr('transform', 'matrix(1 0 0 1 ' + ($text_width + $padding * v1) / 2 + ' ' + (($text_height + $padding) / v2) + ')'); 4417 $that.find('.front-3d, .back-3d').css('transform-origin', '50% 50% -' + ($text_height + $padding) / 2 + 'px'); 4418 4419 // Mask 4420 $(this).find('.front-3d svg > rect').attr('id', 'masked-rect-id-' + i); 4421 $(this).find('.front-3d defs mask').attr('id', 'button-text-mask-' + i); 4422 4423 $that.css('visibility', 'visible'); 4424 $3dTransButtonCssString += '#masked-rect-id-' + i + ' { mask: url(#button-text-mask-' + i + '); -webkit-mask: url(#button-text-mask-' + i + ')} '; 4425 4426 }); 4427 4428 // Extra jumbo resize 4429 createExtraJumboSize(); 4430 $window.on('smartresize', createExtraJumboSize); 4431 4432 // Style 4433 nectarCreateStyle($3dTransButtonCssString, 'nectar-td-button'); 4434 4435 } 4436 4437 // Gradient btn init 4438 setTimeout(function () { 4439 $('.nectar-button[class*="color-gradient"] .start').removeClass('loading'); 4440 }, 150); 4441 // No grad for ff 4442 if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1 || 4443 navigator.userAgent.indexOf("MSIE ") > -1 || 4444 navigator.userAgent.match(/Trident\/7\./)) { 4445 $('.nectar-button[class*="color-gradient"] .start').addClass('no-text-grad'); 4446 } 4447 } 4448 4449 4450 4451 4452 /** 4453 * Shortcode icon large style 4454 * 4455 * @since 1.0 4456 */ 4457 function largeIconHover() { 4458 $('.icon-3x').each(function () { 4459 $(this).closest('.col').on('mouseenter', function () { 4460 $(this).find('.icon-3x').addClass('hovered'); 4461 }); 4462 4463 $(this).closest('.col').on('mouseleave', function () { 4464 $(this).find('.icon-3x').removeClass('hovered'); 4465 }); 4466 }); 4467 4468 if (navigator.userAgent.indexOf("MSIE ") > -1 || navigator.userAgent.match(/Trident\/7\./)) { 4469 $('[class^="icon-"][class*="color-gradient"], .nectar_icon_wrap[data-color*="extra-color-gradient"] .nectar_icon, .nectar-gradient-text').addClass('no-grad'); 4470 } 4471 } 4472 4473 4474 4475 /** 4476 * Team member element - fullscreen style. 4477 * 4478 * @since 7.0 4479 */ 4480 function teamMemberFullscreen() { 4481 4482 if ( $('.team-member').length === 0 ) { 4483 return; 4484 } 4485 4486 // Open click event 4487 $body.on('click', '.team-member[data-style="bio_fullscreen"], .team-member[data-style="bio_fullscreen_alt"]', function () { 4488 4489 if ($('.nectar_team_member_overlay').length > 0) { 4490 return; 4491 } 4492 4493 var $usingBoxedClass = ($('body > #boxed').length > 0) ? 'in-boxed' : '', 4494 $teamMemberMeta = $(this).find('.nectar_team_bio').html(), 4495 $teamMemberTitle = ($(this).is('[data-style="bio_fullscreen_alt"]')) ? $(this).find('.team-meta h5').html() : $(this).find('.team-meta p').html(), 4496 $teamMemberImg = ($(this).find('.nectar_team_bio_img[data-img-src]').length > 0) ? $(this).find('.nectar_team_bio_img').attr('data-img-src') : '', 4497 $teamMemberStyle = ($(this).is('[data-style="bio_fullscreen_alt"]')) ? 'bio-fullscreen-alt' : 'bio-fullscreen', 4498 $teamName = ''; 4499 4500 if($(this).is('[data-style="bio_fullscreen_alt"]')) { 4501 $teamName = '<div class="title">' + $teamMemberTitle + '</div><h2>' + $(this).find('.team-meta h3').html() + '</h2>'; 4502 } else { 4503 $teamName = '<h2>' + $(this).find('.team-meta h3').html() + '</h2><div class="title">' + $teamMemberTitle + '</div>'; 4504 } 4505 4506 $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>'); 4507 4508 if ($teamMemberImg.length > 0) { 4509
4510 // Fade in img on load 4511 var teamTmpImg = new Image(); 4512 teamTmpImg.src = $teamMemberImg; 4513 teamTmpImg.onload = function () { 4514 $('.nectar_team_member_overlay .team_member_image').css('opacity', '1'); 4515 }; 4516 $('.nectar_team_member_overlay .team_member_image').css({ 4517 'background-image': 'url("' + $teamMemberImg + '")' 4518 }); 4519 } 4520 4521 var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $window.width() > 1000) ? 0 : $headerOuterEl.height(); 4522 $('.nectar_team_member_overlay .inner-wrap').css({ 4523 'padding-top': $headerNavSpace 4524 }); 4525 4526 // No-scroll class - ios ready 4527 if ($('.using-mobile-browser').length > 0) { 4528 $('body,html').addClass('nectar-no-scrolling'); 4529 } 4530 4531 teamFullscreenResize(); 4532 4533 // Transition in 4534 $('.nectar_team_member_overlay') 4535 .addClass('open') 4536 .addClass('animating'); 4537 4538 setTimeout(function () { 4539 $('.nectar_team_member_close').addClass('visible'); 4540 $('.nectar_team_member_overlay').removeClass('animating'); 4541 }, 500); 4542 4543 // Bind overflow 4544 if ($('.using-mobile-browser').length == 0) { 4545 fullscreenBioScrolling(); 4546 } 4547 4548 if ($('.team-member[data-style="bio_fullscreen"]').length > 0 && nectarDOMInfo.usingMobileBrowser) { 4549 $('.nectar_team_member_overlay').addClass('on-mobile'); 4550 } 4551 4552 }); 4553 4554 // Close click event 4555 $body.on('click', '.nectar_team_member_overlay', function () { 4556 4557 if (!$(this).hasClass('animating')) { 4558 4559 $('.nectar_team_member_overlay').removeClass('open'); 4560 $('.nectar_team_member_close').removeClass('visible'); 4561 4562 if ($('.using-mobile-browser').length > 0) { 4563 $('body,html').removeClass('nectar-no-scrolling'); 4564 } 4565 4566 setTimeout(function () { 4567 4568 $('.nectar_team_member_overlay, .nectar_team_member_close').remove(); 4569 4570 }, 820); 4571 } 4572 }); 4573 4574 if ($('.team-member[data-style="bio_fullscreen"]').length > 0 || $('.team-member[data-style="bio_fullscreen_alt"]').length > 0) { 4575 $window.on('resize', teamFullscreenResize); 4576 if( !nectarDOMInfo.usingMobileBrowser ) { 4577 var closeIndicator = new NectarIconMouseFollow('','close-indicator'); 4578 } 4579 4580 } 4581 4582 } 4583 4584 4585 /** 4586 * Team member element fullscreen resize event. 4587 * 4588 * @since 7.0 4589 */ 4590 function teamFullscreenResize() { 4591 var $leftHeaderSize = ($('body[data-header-format="left-header"]').length > 0 && $window.width() > 1000) ? 275 : 0; 4592 $('.nectar_team_member_overlay').css({ 4593 'width': $window.width() - $leftHeaderSize, 4594 'left': $leftHeaderSize 4595 }); 4596 } 4597 4598 /** 4599 * Team member element fullscreen overflow scrolling event. 4600 * 4601 * @since 7.0 4602 */ 4603 function fullscreenBioScrolling() { 4604 $('.nectar_team_member_overlay .inner-wrap').mousewheel(function (event, delta) { 4605 this.scrollTop -= (delta * 30); 4606 event.preventDefault(); 4607 }); 4608 4609 } 4610 4611 4612 4613 /** 4614 * WPBakery column element BG hover 4615 * 4616 * @since 5.0 4617 */ 4618 function columnBGColors() { 4619 4620 var $columnColorCSS = ''; 4621 4622 $('.wpb_column').each(function (i) { 4623 4624 $(this).removeClass(function (index, className) { 4625 return (className.match(/(^|\s)instance-\S+/g) || []).join(' '); 4626 }); 4627 4628 $(this).addClass('instance-' + i); 4629 4630 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 ' : ''; 4631 var $innerWrapSelector = ( $(this).find($innerSelector + ' > .column-bg-overlay-wrap').length > 0 ) ? '> .column-bg-overlay-wrap ' : ''; 4632 4633 // BG color 4634 if ($(this).attr('data-has-bg-color') == 'true') { 4635 $columnColorCSS += '.wpb_column.instance-' + i + $innerSelector + $innerWrapSelector + ' > .column-bg-overlay { background-color:' + $(this).attr('data-bg-color') + '; opacity: ' + $(this).attr('data-bg-opacity') + '; }'; 4636 } 4637 4638 // Hover bg color 4639 if ($(this).is('[data-hover-bg^="#"]')) { 4640 $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; }'; 4641 } 4642 });
4643 4644 // Style 4645 nectarCreateStyle($columnColorCSS, 'column-bg-colors'); 4646 4647 } 4648 4649 4650 4651 /** 4652 * Displace filter column/row BG effect 4653 * 4654 * @since 10.5 4655 */ 4656 function nectarLiquidBGs() { 4657 $liquidBG_EL = []; 4658 4659 if (typeof NectarLiquid == 'undefined' || nectarDOMInfo.usingFrontEndEditor) { 4660 return; 4661 } 4662 4663 $('.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) { 4664 4665 var $that_el = $(this); 4666 var $type; 4667 var $el_type; 4668 4669 if ($(this).is('.row-bg')) { 4670 $type = $(this).parents('.row-bg-wrap').attr('data-bg-animation'); 4671 $el_type = 'row'; 4672 } 4673 else if ($(this).is('.column-image-bg')) { 4674 $type = $(this).parents('.column-image-bg-wrap').attr('data-bg-animation'); 4675 $el_type = 'col'; 4676 } 4677 4678 $liquidBG_EL[i] = new NectarLiquid($that_el, $type, $el_type); 4679 4680 }); 4681 } 4682 4683 4684 4685 /** 4686 * Morphing outline element creation. 4687 * 4688 * @since 5.0 4689 */ 4690 function morphingOutlines() { 4691 4692 if ($('.morphing-outline').length > 0) { 4693 4694 var $morphingOutlineCSS = '', 4695 $frontEndEditorMOSelector = ($('body.vc_editor').length > 0) ? '' : '>'; 4696 4697 $('.morphing-outline').each(function (i) { 4698 4699 $(this).removeClass(function (index, className) { 4700 return (className.match(/(^|\s)instance-\S+/g) || []).join(' '); 4701 }); 4702 4703 $(this).addClass('instance-' + i).css({ 4704 'visibility': 'visible' 4705 }); 4706 4707 var $width = $(this).find('.inner').width(), 4708 $height = $(this).find('.inner').height(), 4709 $border = parseInt($(this).attr("data-border-thickness")), 4710 $hover = ($('body[data-button-style*="rounded"]').length > 0) ? ':hover' : '', 4711 $hover2 = ($('body[data-button-style*="rounded"]').length > 0) ? '' : ':hover'; 4712 4713 $morphingOutlineCSS += 'body .morphing-outline.instance-' + i + ' .inner > * { color: ' + $(this).attr("data-starting-color") + '; } '; 4714 $morphingOutlineCSS += 'body .morphing-outline.instance-' + i + ' .inner:after { border-width:' + $(this).attr("data-border-thickness") + 'px ; border-color: ' + $(this).attr("data-starting-color") + '; } '; 4715 4716 $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") + '; } '; 4717 $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") + '; } '; 4718 4719 // Padding calcs 4720 $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}'; 4721 $morphingOutlineCSS += '.morphing-outline.instance-' + i + ' { padding: ' + (30 + ($width + 80 + $border * 2 - $height) / 2 - $border) + 'px 50px}'; 4722 $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 }'; 4723 4724 $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 }'; 4725 4726 // Hover 4727 $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}'; 4728 $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 }'; 4729 4730 });
4731 4732 // Style 4733 nectarCreateStyle($morphingOutlineCSS, 'morphing-outlines'); 4734 4735 } 4736 4737 } 4738 4739 4740 /** 4741 * Morphing outline element initialization. 4742 * 4743 * @since 5.0 4744 */ 4745 function morphingOutlinesInit() { 4746 4747 if($('.morphing-outline').length > 0) { 4748 4749 // Create style. 4750 setTimeout(morphingOutlines, 100); 4751 setTimeout(fullWidthContentColumns, 125); 4752 4753 // Handle resize. 4754 $window.on('smartresize', morphingOutlines); 4755 4756 } 4757 4758 } 4759 4760 4761 4762 4763 /** 4764 * SVG icon element animations 4765 * 4766 * @since 6.0 4767 * @see waypoints 4768 */ 4769 function svgAnimations() { 4770 4771 var $svgOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : 'bottom-in-view'; 4772 4773 if ($svgIcons.length == 0) { 4774 4775 $('.svg-icon-holder:not(.animated-in)').has('svg').each(function (i) { 4776 4777 var $that = $(this); 4778 4779 if (bypassAnimations) { 4780 $that.attr('data-animation', 'false'); 4781 } 4782 // Size 4783 $that.find('svg').css({ 4784 'height': parseInt($that.attr('data-size')) + 'px', 4785 'width': parseInt($that.attr('data-size')) + 'px' 4786 }); 4787 4788 // Animation 4789 $(this).find('svg').attr('id', 'nectar-svg-animation-instance-' + i); 4790 4791 var $animationSpeed = ($that.is('[data-animation-speed]') && $that.attr('data-animation-speed').length > 0) ? $that.attr('data-animation-speed') : 200; 4792 4793 if ($that.attr('data-animation') == 'false') { 4794 $animationSpeed = 1; 4795 $that.css('opacity', '1'); 4796 } 4797 4798 if (!$that.hasClass('bound')) { 4799 $svgIcons[i] = new Vivus($that.find('svg').attr('id'), { 4800 type: 'delayed', 4801 pathTimingFunction: Vivus.EASE_OUT, 4802 animTimingFunction: Vivus.LINEAR, 4803 duration: $animationSpeed, 4804 onReady: svgInit 4805 });
4806 } 4807 4808 if ($animationSpeed !== 1) { 4809 4810 var waypoint = new Waypoint({ 4811 element: $that, 4812 handler: function () { 4813 if ($that.hasClass('animated-in')) { 4814 waypoint.destroy(); 4815 return; 4816 } 4817 4818 checkIfReady(); 4819 $that.addClass('animated-in'); 4820 waypoint.destroy(); 4821 }, 4822 offset: $svgOffsetPos 4823 4824 }); 4825 4826 } else { 4827 checkIfReady(); 4828 } 4829 4830 function checkIfReady() { 4831 4832 var $animationDelay = 0; 4833 4834 if($that.is('[data-animation-delay]') && 4835 $that.attr('data-animation-delay').length > 0 && 4836 $that.attr('data-animation') != 'false') { 4837 $animationDelay = $that.attr('data-animation-delay'); 4838 } 4839 4840 var $iconID = $that.find('svg').attr('id').replace(/[^0-9]/g, ''); 4841 4842 if ($svgIcons[$iconID].isReady == true) { 4843 setTimeout(function () { 4844 $that.css('opacity', '1'); 4845 $svgIcons[$iconID].reset().play(); 4846 }, $animationDelay); 4847 } else { 4848 setTimeout(checkIfReady, 50); 4849 } 4850 } 4851 4852 function svgInit() { 4853 4854 //set size 4855 $that.css({ 4856 'height': parseInt($that.attr('data-size')) + 'px', 4857 'width': parseInt($that.attr('data-size')) + 'px' 4858 });
4859 4860 } 4861 4862 $that.addClass('bound'); 4863 4864 }); 4865 4866 4867 // SVG in equal height column resize 4868 if ($('.vc_row-o-equal-height .svg-icon-holder[data-animation="true"]').length > 0 && 4869 $('#nectar_fullscreen_rows').length == 0) { 4870 4871 $window.on('smartresize', function () { 4872 clearTimeout($svgResizeTimeout); 4873 $svgResizeTimeout = setTimeout(function () { 4874 4875 if ($svgIcons.length > 0) { 4876 $('.svg-icon-holder.animated-in').each(function () { 4877 4878 $(this).css('opacity', '1'); 4879 if ($(this).is('[id]')) { 4880 var $iconID = $(this).attr('id').replace(/[^0-9]/g, ''); 4881 $svgIcons[$iconID].finish(); 4882 } 4883 4884 }); 4885 } 4886 4887 }, 300); 4888 4889 }); 4890 4891 } 4892 4893 } 4894 4895 // After svg animated icons initalized 4896 else { 4897 $('.svg-icon-holder').addClass('animated-in').css('opacity', '1'); 4898 } 4899 4900 // Full vc row support 4901 $('#nectar_fullscreen_rows .svg-icon-holder.animated-in').has('svg').each(function (i) { 4902 4903 var $animationDelay = 0; 4904 4905 if($(this).is('[data-animation-delay]') && 4906 $(this).attr('data-animation-delay').length > 0 && 4907 $(this).attr('data-animation') != 'false') { 4908 $animationDelay = $(this).attr('data-animation-delay'); 4909 } 4910 4911 var $that = $(this); 4912 4913 var $iconID = $that.find('svg').attr('id').replace(/[^0-9]/g, ''); 4914 4915 clearTimeout($animatedSVGIconTimeout[i]); 4916 4917 if ($that.attr('data-animation') == 'false') { 4918 4919 $that.css('opacity', '1'); 4920 $svgIcons[$iconID].finish(); 4921 4922 } else { 4923 4924 if ($(this).parents('.active').length > 0 || 4925 $(this).parents('#footer-outer').length > 0 || 4926 $('body.mobile').length > 0) { 4927 4928 $svgIcons[$iconID].reset(); 4929 $animatedSVGIconTimeout[i] = setTimeout(function () { 4930 $svgIcons[$iconID].play(); 4931 }, $animationDelay); 4932 4933 } else { 4934 $svgIcons[$iconID].reset().stop(); 4935 } 4936 } 4937 }); 4938 4939 } 4940 4941 4942 4943 /** 4944 * Fancy unordered list element initialization. 4945 * 4946 * @since 4.0 4947 * @see waypoints 4948 */ 4949 function nectarFancyUlInit() { 4950 4951 $($fullscreenSelector + '.nectar-fancy-ul').each(function () { 4952 4953 var $animation = $(this).attr('data-animation'), 4954 $animationDelay = 0; 4955 4956 if($(this).is('[data-animation-delay]') && 4957 $(this).attr('data-animation-delay').length > 0 && 4958 $(this).attr('data-animation') != 'false') { 4959 $animationDelay = $(this).attr('data-animation-delay'); 4960 } 4961 4962 if ($animation == 'true') { 4963 4964 var $that = $(this), 4965 waypoint = new Waypoint({ 4966 element: $that, 4967 handler: function () { 4968 4969 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 4970 waypoint.destroy(); 4971 return; 4972 } 4973 4974 setTimeout(function () { 4975 $that.find('li').each(function (i) { 4976 var $that = $(this); 4977 $that.delay(i * 220).transition({ 4978 'opacity': '1', 4979 'left': '0' 4980 }, 220, 'easeOutCubic'); 4981 }); 4982 }, $animationDelay); 4983 4984 $that.addClass('animated-in'); 4985 waypoint.destroy(); 4986 }, 4987 offset: 'bottom-in-view' 4988 4989 }); 4990 4991 } 4992 4993 }); 4994 4995 } 4996 4997 4998 /** 4999 * Fancy unordered list element icons. 5000 * 5001 * @since 11.0 5002 */ 5003 function nectarFancyUlIcons() { 5004 5005 $('.nectar-fancy-ul:not([data-list-icon="dot"])').each(function () { 5006 5007 var $icon = $(this).attr('data-list-icon'), 5008 $color = $(this).attr('data-color'); 5009 5010 $(this).find('li').each(function () { 5011 $(this).find('> i').remove(); 5012 $(this).prepend('<i class="icon-default-style ' + $icon + ' ' + $color + '"></i> '); 5013 });
5014 5015 }); 5016 5017 } 5018 5019 5020 /** 5021 * Flipbox element height calculations. 5022 * 5023 * @since 7.0 5024 */ 5025 function flipBoxHeights() { 5026 5027 $('.nectar-flip-box').each(function () { 5028 5029 var $flipBoxMinHeight = parseInt($(this).attr('data-min-height')), 5030 $flipBoxHeight = $(this).find('.flip-box-front .inner').height(); 5031 5032 if ($(this).find('.flip-box-back .inner').height() > $(this).find('.flip-box-front .inner').height()) { 5033 $flipBoxHeight = $(this).find('.flip-box-back .inner').height(); 5034 } 5035 5036 if ($flipBoxHeight >= $flipBoxMinHeight - 80) { 5037 $(this).find('> div').css('height', $flipBoxHeight + 80); 5038 } else { 5039 $(this).find('> div').css('height', 'auto'); 5040 } 5041 5042 // Safari needs 3D translate. 5043 if ($(this).parent().hasClass('wpb_wrapper')) { 5044 $(this).parent().css('transform', 'translateZ(0)'); 5045 } 5046 5047 }); 5048 } 5049 5050 5051 5052 5053 /** 5054 * Flipbox element events. 5055 * 5056 * @since 7.0 5057 */ 5058 function flipBoxInit() { 5059 5060 if( $('.nectar-flip-box').length > 0 ) { 5061 5062 // Mobile gets click. 5063 if (nectarDOMInfo.usingMobileBrowser) { 5064 $body.on('click', '.nectar-flip-box', function () { 5065 $(this).toggleClass('flipped'); 5066 }); 5067 } 5068 5069 flipBoxHeights(); 5070 5071 // Handle resize. 5072 $window.on('smartresize', flipBoxHeights); 5073 } 5074 5075 } 5076 5077 5078 5079 5080 /** 5081 * Parallax Scrolling 5082 * 5083 * @since 3.0 5084 */ 5085 $.fn.parallaxScroll = function (xpos, speedFactor, outerHeight) { 5086 5087 var $windowDOMWidth = nectarDOMInfo.winW, 5088 $windowDOMHeight = nectarDOMInfo.winH, 5089 $orientationChange = 0, 5090 $this = $(this), 5091 firstTop = $this.offset().top; 5092 5093 // Get the starting position of each element to have parallax applied to it 5094 $this.each(function () { 5095 firstTop = $this.offset().top; 5096 }); 5097 5098 var getHeight = function (jqo) { 5099 return jqo.outerHeight(true); 5100 }; 5101 5102 // setup defaults if arguments aren't specified 5103 if (arguments.length < 1 || xpos === null) { 5104 xpos = "50%"; 5105 } 5106 if (arguments.length < 2 || speedFactor === null) { 5107 speedFactor = 0.25; 5108 } 5109 if (arguments.length < 3 || outerHeight === null) { 5110 outerHeight = true; 5111 } 5112 5113 var $onMobileBrowser = nectarDOMInfo.usingMobileBrowser, 5114 classic_mobile_menu_open = false, 5115 firstSection = false, 5116 $element = $this, 5117 height = getHeight($element); 5118 5119 5120 $this.find('.row-bg.using-image, .page-header-bg-image, .image-bg, .video-wrap').addClass('translate'); 5121 5122 setInterval(function () { 5123 5124 height = getHeight($element); 5125 classic_mobile_menu_open = ($('body.classic_mobile_menu_open.mobile').length > 0) ? true : false; 5126 5127 }, 600); 5128 5129 5130 if($element.parents('.top-level').length > 0 && $element.parents('.parallax_slider_outer').length > 0 || 5131 $element.parents('.top-level').length > 0 && $element.is('.nectar-recent-posts-single_featured') || 5132 $element.is('.wpb_row.top-level') || 5133 $('.wpb_row').length == 0) { 5134 firstSection = true; 5135 } 5136 5137 if ($('.wpb_row').length == 0 && $element.parents('.parallax_slider_outer').length > 0 && $element.is('[data-full-width="true"]') || 5138 ($('#portfolio-extra').length > 0 && $element.parents('.parallax_slider_outer').length > 0 && $element.parents('.wpb_row').length > 0 && $element.parents('.wpb_row').index() == '0')) { 5139 firstSection = true; 5140 } 5141 5142 if (nectarDOMInfo.usingFrontEndEditor) { 5143 firstSection = false; 5144 } 5145 5146 var nectarSliderElBool = $this.is('.nectar-slider-wrap'); 5147 var pageHeaderBool = ($this.find('.page-header-bg-image').length > 0) ? true : false; 5148 var $elToParallax = false; 5149 5150 if (nectarSliderElBool) { 5151 5152 if ($this.find('.video-wrap').length > 0 || $this.find('.image-bg').length > 0) { 5153 $elToParallax = $this.find('.video-wrap, .image-bg'); 5154 } 5155 5156 } else { 5157 5158 if ($this.find('.row-bg.using-image').length > 0) { 5159 $elToParallax = $this.find('.row-bg.using-image'); 5160 } else if ($this.find('.page-header-bg-image').length > 0) { 5161 $elToParallax = $this.find('.page-header-bg-image'); 5162 } 5163 5164 } 5165 5166
5167 function update() { 5168 5169 firstTop = $element.offset().top; 5170 5171 // Check if totally above or totally below viewport. 5172 if ($elToParallax == false || 5173 firstTop + height < nectarDOMInfo.scrollTop || 5174 firstTop > nectarDOMInfo.scrollTop + nectarDOMInfo.winH || 5175 $('body.material-ocm-open').length > 0) { 5176 // Skip processing. 5177 } else { 5178 5179 // Nectar slider 5180 if (nectarSliderElBool) { 5181 5182 if (firstSection) { 5183 // Top level row 5184 if (!classic_mobile_menu_open) { 5185 $this.find('.video-wrap, .image-bg').css({ 5186 'transform': 'translate3d(0, ' + parseFloat(nectarDOMInfo.scrollTop * speedFactor) + 'px, 0)' 5187 }); 5188 } 5189 } else { 5190 $this.find('.video-wrap, .image-bg').css({ 5191 'transform': 'translate3d(0, ' + parseFloat((($windowDOMHeight + nectarDOMInfo.scrollTop - firstTop) * speedFactor)) + 'px, 0)' 5192 }); 5193 } 5194 5195 } else { 5196 5197 // Rows 5198 if (firstSection) { 5199 // Top level row 5200 if (!classic_mobile_menu_open) { 5201 $elToParallax.css({ 5202 'transform': 'translate3d(0, ' + parseFloat(nectarDOMInfo.scrollTop * speedFactor) + 'px, 0)' 5203 }); 5204 } 5205 } else { 5206 // Regular rows further down page 5207 $elToParallax.css({ 5208 'transform': 'translate3d(0, ' + parseFloat((($windowDOMHeight + nectarDOMInfo.scrollTop - firstTop) * speedFactor)) + 'px, 0), scale(1.005)' 5209 }); 5210 } 5211 5212 // Page header 5213 if (pageHeaderBool && !classic_mobile_menu_open) { 5214 $elToParallax.css({ 5215 'transform': 'translate3d(0, ' + parseFloat(nectarDOMInfo.scrollTop * speedFactor) + 'px, 0)' 5216 }); 5217 } 5218 5219 } 5220 5221 } 5222 5223 5224 //if on mobile, auto RAF 5225 if ($onMobileBrowser) { 5226 requestAnimationFrame(update); 5227 } 5228 5229 } 5230 5231 if (window.addEventListener) { 5232 5233 if (nectarDOMInfo.usingFrontEndEditor || !nectarDOMInfo.usingMobileBrowser) { 5234 $window.on('resize', function () { 5235 $windowDOMWidth = nectarDOMInfo.winW; 5236 $windowDOMHeight = nectarDOMInfo.winH; 5237 });
5238 } 5239 5240 if (nectarDOMInfo.usingFrontEndEditor) { 5241 5242 $window.on('scroll.parallaxSections', update); 5243 5244 } else if (!nectarDOMInfo.usingMobileBrowser) { 5245 5246 window.addEventListener('scroll', function () { 5247 requestAnimationFrame(update); 5248 }, false); 5249 5250 } else { 5251 5252 //if on mobile, auto RAF 5253 requestAnimationFrame(update); 5254 5255 window.addEventListener("orientationchange", function () { 5256 $orientationChange = 1; 5257 }); 5258 5259 $window.on('resize', function () { 5260 if (($window.width() != $windowDOMWidth && $window.height != $windowDOMHeight) || $orientationChange == 1) { 5261 5262 //store the current window dimensions 5263 $windowDOMWidth = nectarDOMInfo.winW; 5264 $windowDOMHeight = nectarDOMInfo.winH; 5265 5266 $orientationChange = 0; 5267 } 5268 }); 5269 5270 } 5271 5272 } 5273 5274 $window.on('resize.parallaxSections', update); 5275 5276 update(); 5277 5278 }; 5279 5280 5281 5282 5283 /** 5284 * Runs before other full width section calculations. 5285 * 5286 * @since 4.0 5287 */ 5288 function fullWidthSectionsPreInit() { 5289 5290 // Nectar Slider force full width parent row when using full width element option. 5291 $('.wpb_row .vc_col-sm-12 .nectar-slider-wrap[data-full-width="true"]').each(function () { 5292 if ($(this).parents('.wpb_row.full-width-section').length == 0 && $(this).parents('.wpb_row.full-width-content').length == 0) { 5293 $(this).parents('.wpb_row').addClass('full-width-section'); 5294 } 5295 }); 5296 5297 // Handle percent row padding values when using the boxed theme option. 5298 if( !nectarDOMInfo.usingMobileBrowser && $('body[data-boxed-style="1"]').length > 0 && $('#boxed').length > 0 ) { 5299 fullWidthRowPaddingAdjustCalcBoxed(); 5300 } 5301 5302 } 5303 5304 5305 5306 /** 5307 * Full width section calculations. 5308 * 5309 * @since 4.0 5310 */ 5311 function fullWidthSections() { 5312 5313 var $windowInnerWidth = nectarDOMInfo.winW, 5314 $bodyBorderWidth = ($('.body-border-right').length > 0 && $windowInnerWidth > 1000) ? parseInt($('.body-border-right').width()) * 2 : 0, 5315 $container_width = ($('.container-wrap').length > 0) ? parseInt($('.container-wrap').outerWidth()) : $window.width(); 5316 5317 var $windowWidth, 5318 $justOutOfSight, 5319 $mainContentWidth; 5320 5321 if ($('#boxed').length == 1) { 5322 $justOutOfSight = ((parseInt($('.container-wrap').width()) - parseInt($('.main-content').width())) / 2) + 4; 5323 } else { 5324 5325 // Ext responsive mode is on - add the extra padding into the calcs 5326 var $extResponsivePadding = ($('body[data-ext-responsive="true"]').length > 0 && $windowInnerWidth >= 1000) ? 180 : 0; 5327 5328 if ($container_width - $bodyBorderWidth <= parseInt($('.main-content').css('max-width'))) { 5329 $windowWidth = parseInt($('.main-content').css('max-width')); 5330 } else { 5331 $windowWidth = $container_width - $bodyBorderWidth; 5332 } 5333 5334 5335 var $contentWidth = parseInt($('.main-content').css('max-width')); 5336 5337 // Single post fullwidth 5338 if ($('body.single-post[data-ext-responsive="true"]').length > 0 && $('.container-wrap.no-sidebar').length > 0) { 5339 $contentWidth = $('.post-area').width(); 5340 $extResponsivePadding = 0; 5341 } 5342 5343 $justOutOfSight = Math.ceil((($windowWidth + $extResponsivePadding - $contentWidth) / 2)); 5344 } 5345 5346 5347 // Full width content row type. 5348 $('.carousel-outer').has('.carousel-wrap[data-full-width="true"]').css('overflow', 'visible'); 5349 5350 $('.carousel-wrap[data-full-width="true"], .portfolio-items[data-col-num="elastic"]:not(.fullwidth-constrained), .full-width-content').each(function () { 5351 5352 var $leftHeaderSize = ($('#header-outer[data-format="left-header"]').length > 0 && $windowInnerWidth >= 1000) ? parseInt($('#header-outer[data-format="left-header"]').width()) : 0; 5353 var $bodyBorderWidth = ($('.body-border-right').length > 0 && $windowInnerWidth > 1000) ? (parseInt($('.body-border-right').width()) * 2) - 2 : 0; 5354 5355 // Single post fullwidth. 5356 if ($('#boxed').length == 1) { 5357 5358 $mainContentWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').width()) : parseInt($(this).parents('.container').width()); 5359 5360 if ($('body.single-post[data-ext-responsive="true"]').length > 0 && $('.container-wrap.no-sidebar').length > 0 && $(this).parents('.post-area').length > 0) { 5361 $contentWidth = $('.post-area').width(); 5362 $extResponsivePadding = 0; 5363 $windowWidth = $container_width - $bodyBorderWidth;
5364 $justOutOfSight = Math.ceil((($windowWidth + $extResponsivePadding - $contentWidth) / 2)); 5365 } else { 5366 if ($(this).parents('.page-submenu').length > 0) { 5367 $justOutOfSight = ((parseInt($('.container-wrap').width()) - $mainContentWidth) / 2); 5368 } 5369 else { 5370 $justOutOfSight = ((parseInt($('.container-wrap').width()) - $mainContentWidth) / 2) + 4; 5371 } 5372 } 5373 } else { 5374 5375 if ($('body.single-post[data-ext-responsive="true"]').length > 0 && $('.container-wrap.no-sidebar').length > 0 && $(this).parents('.post-area').length > 0) { 5376 5377 $contentWidth = $('.post-area').width(); 5378 $extResponsivePadding = 0; 5379 $windowWidth = $container_width - $bodyBorderWidth; 5380 5381 } else { 5382 5383 var $mainContentMaxWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').css('max-width')) : parseInt($(this).parents('.container').css('max-width')); 5384 5385 if ($container_width - $bodyBorderWidth <= $mainContentMaxWidth) { 5386 $windowWidth = $mainContentMaxWidth; 5387 } 5388 5389 $contentWidth = $mainContentMaxWidth; 5390 $extResponsivePadding = ($('body[data-ext-responsive="true"]').length > 0 && nectarDOMInfo.winW >= 1000) ? 180 : 0; 5391 5392 if ($leftHeaderSize > 0) { 5393 $extResponsivePadding = ($('body[data-ext-responsive="true"]').length > 0 && nectarDOMInfo.winW >= 1000) ? 120 : 0; 5394 } 5395 5396 } 5397 5398 $justOutOfSight = Math.ceil((($windowWidth + $extResponsivePadding - $contentWidth) / 2)); 5399 } 5400 5401 var $extraSpace = 0; 5402 if ($(this).hasClass('carousel-wrap')) { 5403 $extraSpace = 1; 5404 } 5405 if ($(this).hasClass('portfolio-items')) { 5406 $extraSpace = 5; 5407 } 5408 5409 var $carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight * 2) : $container_width - $bodyBorderWidth + $extraSpace; 5410 5411 // When using gutter on portfolio don't add extra space 5412 if ($('#boxed').length == 0 && $(this).hasClass('portfolio-items') && $(this).is('[data-gutter*="px"]') && $(this).attr('data-gutter').length > 0 && $(this).attr('data-gutter') != 'none') { 5413 if ($container_width > 1000) { 5414 $carouselWidth = $container_width - $bodyBorderWidth + 3; 5415 } 5416 else { 5417 $carouselWidth = $container_width - $bodyBorderWidth; 5418 } 5419 } 5420 5421 if ($(this).parent().hasClass('default-style')) { 5422 5423 $mainContentWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').width()) : parseInt($(this).parents('.container').width()); 5424 5425 if ($('#boxed').length != 0) { 5426 $carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight * 2) : $container_width + $extraSpace; 5427 } else { 5428 $carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight * 2) : ($container_width - $bodyBorderWidth) - (($container_width - $bodyBorderWidth) * 0.025) + $extraSpace; 5429 $windowWidth = ($container_width - $bodyBorderWidth <= $mainContentWidth) ? $mainContentWidth : ($container_width - $bodyBorderWidth) - (($container_width - $bodyBorderWidth) * 0.025); 5430 $justOutOfSight = Math.ceil((($windowWidth - $mainContentWidth) / 2)); 5431 } 5432 5433 } 5434 5435 else if ($(this).parent().hasClass('spaced')) { 5436 5437 $mainContentWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').width()) : parseInt($(this).parents('.container').width()); 5438 5439 if ($('#boxed').length != 0) { 5440 $carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight * 2) - ($container_width * 0.02) : $container_width + $extraSpace; 5441 } else { 5442 $carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight * 2) : ($container_width - $bodyBorderWidth) - Math.ceil(($container_width - $bodyBorderWidth) * 0.02) + $extraSpace; 5443 var $windowWidth2 = ($container_width - $bodyBorderWidth <= $mainContentWidth) ? $mainContentWidth : ($container_width - $bodyBorderWidth) - (($container_width - $bodyBorderWidth) * 0.02);
5444 $justOutOfSight = Math.ceil((($windowWidth2 - $mainContentWidth) / 2) + 2); 5445 } 5446 } 5447 5448 // Make sure the element/row is capable of going full width. 5449 if (!$(this).parents('.span_9').length > 0 && 5450 !$(this).parent().hasClass('span_3') && 5451 $(this).parent().attr('id') != 'sidebar-inner' && 5452 $(this).parent().attr('id') != 'portfolio-extra' && 5453 !$(this).find('.carousel-wrap[data-full-width="true"]').length > 0 && 5454 !$(this).find('.nectar-carousel-flickity-fixed-content').length > 0 && 5455 !$(this).find('.portfolio-items:not(".carousel")[data-col-num="elastic"]').length > 0) { 5456 5457 // Escape if inside woocoommerce page and not using applicable layout 5458 if ($('.single-product').length > 0 && 5459 $(this).parents('#tab-description').length > 0 && 5460 $(this).parents('.full-width-tabs').length == 0) { 5461 5462 $(this).css({ 5463 'visibility': 'visible' 5464 }); 5465 5466 } else { 5467 // Portfolio. 5468 if ($(this).hasClass('portfolio-items')) { 5469 $(this).css({ 5470 'margin-left': -$justOutOfSight, 5471 'left': 0, 5472 'width': $carouselWidth, 5473 'visibility': 'visible' 5474 }); 5475 5476 } else { 5477 5478 // Fullscreen page rows left. 5479 if ($('#nectar_fullscreen_rows').length > 0 && $(this).hasClass('wpb_row')) { 5480 5481 $(this).css({ 5482 'margin-left': -$justOutOfSight, 5483 'width': $carouselWidth, 5484 'visibility': 'visible' 5485 }); 5486 5487 } else { 5488 // Regular rows. 5489 $(this).css({ 5490 'left': 0, 5491 'margin-left': -$justOutOfSight, 5492 'width': $carouselWidth, 5493 'visibility': 'visible' 5494 }); 5495 } 5496 5497 } 5498 5499 } 5500 } 5501 5502 else if ($(this).parent().attr('id') == 'portfolio-extra' && $('#full_width_portfolio').length != 0) { 5503 5504 $(this).css({ 5505 'left': 0, 5506 'margin-left': -$justOutOfSight, 5507 'width': $carouselWidth, 5508 'visibility': 'visible' 5509 }); 5510 5511 } else { 5512 5513 $(this).css({ 5514 'margin-left': 0, 5515 'width': 'auto', 5516 'left': '0', 5517 'visibility': 'visible' 5518 }); 5519 } 5520 5521 }); 5522 5523 } 5524 5525 5526 5527 /** 5528 * Parallax scroll speed helper. 5529 * 5530 * @since 4.0 5531 */ 5532 function parallaxSrollSpeed(speedString) { 5533 5534 var speed; 5535 switch (speedString) { 5536 case 'slow': 5537 speed = 0.6; 5538 break; 5539 case 'medium': 5540 speed = 0.4; 5541 break; 5542 case 'fast': 5543 speed = 0.25; 5544 break; 5545 } 5546 5547 return speed; 5548 } 5549 5550 5551 /** 5552 * Parallax scroll initialization. 5553 * 5554 * @since 4.0 5555 */ 5556 function parallaxScrollInit() { 5557 5558 if (nectarDOMInfo.usingMobileBrowser && $('body[data-remove-m-parallax="1"]').length > 0) { 5559 return; 5560 } 5561 5562 parallaxRowsBGCals(); 5563 5564 $('.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 () { 5565 var $id = $(this).attr('id'); 5566 5567 if ( $(this).find('[data-parallax-speed="fixed"]').length == 0) { 5568 5569 if ($(this).find('.row-bg').length == 0) { 5570 //set default scroll speed if not defined 5571 $('#' + $id).parallaxScroll("50%", 0.25); 5572 } else { 5573 $('#' + $id + ".parallax_section").parallaxScroll("50%", parallaxSrollSpeed($(this).find('.row-bg').attr('data-parallax-speed'))); 5574 } 5575 5576 } 5577 5578 $(this).addClass('nectar-parallax-enabled'); 5579 5580 }); 5581 5582 } 5583 5584 5585 /** 5586 * First full width row on page 5587 * 5588 * @since 4.0 5589 */ 5590 function firstFWSection() { 5591 $('.full-width-section.wpb_row, .full-width-content.wpb_row').each(function () { 5592 5593 if (!$(this).parent().hasClass('span_9') && 5594 !$(this).parent().hasClass('span_3') && 5595 $(this).parent().attr('id') != 'sidebar-inner') { 5596 5597 if ($(this).parents('#portfolio-extra').length > 0 && $('#full_width_portfolio').length == 0) { 5598 return false; 5599 } 5600 5601 if ($(this).index() == '0' && 5602 $pageHeaderBG.length == 0 && 5603 $('.page-header-no-bg').length == 0 && 5604 $('.project-title').length == 0 && 5605 $('body.single').length == 0 && 5606 $('.project-title').length == 0) { 5607 5608 $(this).addClass('first-section'); 5609 var $that = $(this); 5610 setTimeout(function () { 5611 $that.addClass('loaded'); 5612 }, 50); 5613 5614 } 5615 5616 } 5617 5618 });
5619 } 5620 5621 5622 5623 5624 5625 /** 5626 * Parallax row background height calculations. 5627 * 5628 * @since 6.0 5629 */ 5630 function parallaxRowsBGCals() { 5631 5632 if (nectarDOMInfo.usingMobileBrowser && $('body[data-remove-m-parallax="1"]').length > 0) { 5633 return; 5634 } 5635 5636 $('.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 () { 5637 5638 var $non_page_builder_slider; 5639 5640 if ($(this).find('.row-bg').length == 0 && $(this).find('.page-header-bg-image').length > 0) { 5641 //skip processing. 5642 } else if ($(this).find('.row-bg').length == 0 && $(this).find('.image-bg').length > 0) { 5643 5644 $non_page_builder_slider = false; 5645 5646 // First nectar slider shortcode without page builder 5647 if ($('.wpb_row').length == 0 && 5648 $(this).parents('.nectar-slider-wrap[data-full-width="true"]').length > 0 && 5649 $(this).parents('.parallax_slider_outer').length > 0 && 5650 $(this).parents('.parallax_slider_outer').index() == '1') { 5651 $non_page_builder_slider = true; 5652 } 5653 5654 // Portfolio first 5655 if ($('#portfolio-extra').length > 0 && 5656 $(this).parents('.wpb_row').length > 0 && 5657 $(this).parents('.parallax_slider_outer').length > 0 && 5658 $(this).parents('.wpb_row').index() == '0') { 5659 $non_page_builder_slider = true; 5660 } 5661 5662 // Set heights. 5663 if ($(this).parents('.top-level').length > 0 && !nectarDOMInfo.usingFrontEndEditor || 5664 $non_page_builder_slider && !nectarDOMInfo.usingFrontEndEditor) { 5665 $(this).find('.image-bg').css({ 5666 'height': Math.ceil($(this).parent().offset().top * 0.25) + $(this).outerHeight(true) 5667 });
5668 } else { 5669 $(this).find('.image-bg').css({ 5670 'height': Math.ceil($window.height() * 0.25) + $(this).outerHeight(true) 5671 }); 5672 } 5673 5674 } 5675 5676 // Video backgrounds. 5677 else if ($(this).find('.row-bg').length == 0 && $(this).find('.video-wrap').length > 0) { 5678 5679 $non_page_builder_slider = false; 5680 // First nectar slider shortcode without page builder 5681 if ($('.wpb_row').length == 0 && 5682 $(this).parents('.nectar-slider-wrap[data-full-width="true"]').length > 0 && 5683 $(this).parents('.parallax_slider_outer').length > 0 && 5684 $(this).parents('.parallax_slider_outer').index() == '1') { 5685 $non_page_builder_slider = true; 5686 } 5687 // Portfolio first 5688 if ($('#portfolio-extra').length > 0 && 5689 $(this).parents('.wpb_row').length > 0 && 5690 $(this).parents('.parallax_slider_outer').length > 0 && 5691 $(this).parents('.wpb_row').index() == '0') { 5692 $non_page_builder_slider = true; 5693 } 5694 5695 // Set heights. 5696 if ($(this).parents('.top-level').length > 0 && !nectarDOMInfo.usingFrontEndEditor || 5697 $non_page_builder_slider && !nectarDOMInfo.usingFrontEndEditor) { 5698 5699 $(this).find('.video-wrap').css({ 5700 'height': Math.ceil($(this).parent().offset().top * 0.25) + $(this).outerHeight(true) 5701 });
5702 } 5703 5704 else { 5705 $(this).find('.video-wrap').css({ 5706 'height': Math.ceil($window.height() * 0.25) + $(this).outerHeight(true) 5707 }); 5708 } 5709 5710 var vid = $(this).find('.video-wrap video'), 5711 vid_w_orig = 1280, 5712 vid_h_orig = 720; 5713 5714 // Get the parent element size 5715 var container_w = vid.parent().width(), 5716 container_h = vid.parent().height(), 5717 scale_w = container_w / vid_w_orig, 5718 scale_h = container_h / vid_h_orig; 5719 5720 var scale = scale_w > scale_h ? scale_w : scale_h; 5721 5722 // Scale the video. 5723 vid.width(scale * vid_w_orig); 5724 vid.height(scale * vid_h_orig); 5725 5726 } else { 5727 5728 if ($(this).is('.nectar-recent-posts-single_featured') && $(this).parents('.top-level').length > 0 && !nectarDOMInfo.usingFrontEndEditor) { 5729 //skip processing. 5730 } else if (!$(this).hasClass('top-level') || nectarDOMInfo.usingFrontEndEditor) { 5731 5732 var $ifFast = ($(this).find('.row-bg[data-parallax-speed="fast"]').length > 0) ? 60 : 0; 5733 $(this).find('.row-bg').css({ 5734 'height': Math.ceil($window.height() * parallaxSrollSpeed($(this).find('.row-bg').attr('data-parallax-speed'))) + $(this).outerHeight(true) + $ifFast 5735 });
5736 5737 } 5738 5739 } 5740 5741 }); 5742 5743 } 5744 5745 5746 /** 5747 * Class names added for specific full width section rows at top 5748 * 5749 * @since 3.0 5750 */ 5751 function fwsClasses() { 5752 5753 $('.wpb_wrapper > .nectar-slider-wrap[data-full-width="true"]').each(function () { 5754 if (!$(this).parent().hasClass('span_9') && !$(this).parent().hasClass('span_3') && $(this).parent().attr('id') != 'sidebar-inner') { 5755 if ($(this).parents('.wpb_row').index() == '0') { 5756 $(this).addClass('first-nectar-slider'); 5757 } 5758 } 5759 }); 5760 5761 var $contentElementsNum = ($('#portfolio-extra').length == 0) ? $('.main-content > .row > *').length : $('.main-content > .row #portfolio-extra > *').length; 5762 5763 if ($('#portfolio-extra').length == 0) { 5764 $contentElementsNum = ($('.main-content > .row > .wpb_row').length > 0) ? $('.main-content > .row > .wpb_row').length : $('.main-content > .row > *').length; 5765 } else { 5766 $contentElementsNum = $('.main-content > .row #portfolio-extra > *').length; 5767 } 5768 5769 $('.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 () { 5770 5771 if (!$(this).parent().hasClass('span_9') && !$(this).parent().hasClass('span_3') && $(this).parent().attr('id') != 'sidebar-inner') { 5772 5773 if ($(this).parents('.wpb_row').length > 0) { 5774 5775 if ($(this).parents('#portfolio-extra').length > 0 && 5776 $('#full_width_portfolio').length == 0) { 5777 return false; 5778 } 5779 5780 ////first 5781 if ($(this).parents('.wpb_row').index() == '0' && $pageHeaderBG.length != 0) { 5782 //skip processing. 5783 } 5784 else if ($(this).parents('.wpb_row').index() == '0' && 5785 $pageHeaderBG.length == 0 && $('.page-header-no-bg').length == 0 && 5786 $('.project-title').length == 0 && $(this).parents('.wpb_row').index() == '0' && 5787 $('.project-title').length == 0 && $('body[data-bg-header="true"]').length == 0) { 5788 5789 if ($('.single').length == 0) { 5790 $('.container-wrap').css('padding-top', '0px'); 5791 } else { 5792 $(this).addClass('first-section'); 5793 } 5794 5795 } 5796 5797 // Check if it's also last (i.e. the only fws) 5798 if ($(this).parents('.wpb_row').index() == $contentElementsNum - 1 && $('#respond').length == 0) { 5799 if ($(this).attr('id') != 'portfolio-filters-inline') { 5800 $('.container-wrap').css('padding-bottom', '0px'); 5801 $('#call-to-action .triangle').remove(); 5802 } 5803 } 5804 5805 } else { 5806 5807 if ($(this).parents('#portfolio-extra').length > 0 && $('#full_width_portfolio').length == 0) { 5808 return false; 5809 } 5810 5811 if ($(this).find('.portfolio-filters-inline').length == 0 && $(this).attr('id') != 'post-area') { 5812 5813 ////first 5814 if ($(this).index() == '0' && $pageHeaderBG.length != 0) { 5815 //skip processing. 5816 } 5817 else if ($(this).index() == '0' && $pageHeaderBG.length == 0 && 5818 $(this).index() == '0' && $('.page-header-no-bg').length == 0 && 5819 $(this).index() == '0' && !$(this).hasClass('blog_next_prev_buttons') && 5820 !$(this).hasClass('nectar-shop-outer') && $(this).parents('.pum-container').length == 0) { 5821 5822 if ($('body[data-header-resize="0"]').length == 1 && $('.single').length == 0 || $('body.material').length > 0 && $('.single').length == 0) { 5823 5824 if (!$('body.blog .blog-fullwidth-wrap > .masonry:not(.meta-overlaid)').length > 0) { 5825 $('.container-wrap').css('padding-top', '0px'); 5826 } 5827 5828 } 5829 5830 else { 5831 $(this).addClass('first-section'); 5832 } 5833 5834 } 5835 5836 //check if it's also last (i.e. the only fws) 5837 if ($(this).index() == $contentElementsNum - 1 && $('#respond').length == 0 && $('body.woocommerce-checkout').length == 0) { 5838 $('.container-wrap').css('padding-bottom', '0px'); 5839 $('.bottom_controls').css('margin-top', '0px'); 5840 $('#call-to-action .triangle').remove(); 5841 } 5842 5843 } 5844 } 5845 } 5846 5847 });
5848 5849 5850 $('#portfolio-extra > .nectar-slider-wrap[data-full-width="true"], .portfolio-wrap').each(function () { 5851 //check if it's last 5852 if ($(this).index() == $contentElementsNum - 1 && $('#commentform').length == 0 && $('#pagination').length == 0) { 5853 if (parseInt($('.container-wrap').css('padding-bottom')) > 0) { 5854 $(this).css('margin-bottom', '-40px'); 5855 } 5856 $('#call-to-action .triangle').remove(); 5857 } 5858 }); 5859 5860 5861 $('.portfolio-filters').each(function () { 5862 ////first 5863 if ($(this).index() == '0' && $pageHeaderBG.length != 0 || $(this).index() == '0') { 5864 $(this).addClass('first-section nder-page-header'); 5865 } else if ($(this).index() == '0' && $pageHeaderBG.length == 0 || $(this).index() == '0') { 5866 $(this).css({ 5867 'margin-top': '0px' 5868 }).addClass('first-section'); 5869 } 5870 }); 5871 5872 5873 $('.portfolio-filters-inline').each(function () { 5874 ////first 5875 if ($(this).parents('.wpb_row').length > 0) { 5876 //skip processing. 5877 } else { 5878 if ($(this).index() == '0' && $pageHeaderBG.length != 0 || $(this).index() == '0') { 5879 $(this).addClass('first-section nder-page-header'); 5880 } else if ($(this).index() == '0' && $pageHeaderBG.length == 0 || $(this).index() == '0') { 5881 5882 $(this).css({ 5883 'margin-top': '-30px', 5884 'padding-top': '50px' 5885 }).addClass('first-section'); 5886 5887 } 5888 } 5889 5890 }); 5891 5892 5893 } 5894 5895 5896 5897 5898 5899 5900 /** 5901 * Full width row padding adjust calculations. 5902 * 5903 * @since 3.0 5904 */ 5905 function fullWidthRowPaddingAdjustCalc() { 5906 5907 if ($('#boxed').length == 0) { 5908 5909 $('.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 () { 5910 5911 var $windowHeight = $window.width(), 5912 $topPadding = ($(this).attr('data-top-percent')) ? $(this).attr('data-top-percent') : 'skip', 5913 $bottomPadding = ($(this).attr('data-bottom-percent')) ? $(this).attr('data-bottom-percent') : 'skip'; 5914 5915 //top 5916 if ($topPadding != 'skip') { 5917 $(this).css('padding-top', $windowHeight * (parseInt($topPadding) / 100)); 5918 } 5919 5920 //bottom 5921 if ($bottomPadding != 'skip') { 5922 $(this).css('padding-bottom', $windowHeight * (parseInt($bottomPadding) / 100)); 5923 } 5924 5925 }); 5926 } 5927 } 5928 5929 /** 5930 * Full width row padding adjust calculations for boxed theme option. 5931 * 5932 * @since 11.0.4 5933 */ 5934 function fullWidthRowPaddingAdjustCalcBoxed() { 5935 5936 if ($('#boxed').length > 0) { 5937 5938 $('.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 () { 5939 5940 var $topPadding = ($(this).attr('data-top-percent')) ? $(this).attr('data-top-percent') : 'skip', 5941 $bottomPadding = ($(this).attr('data-bottom-percent')) ? $(this).attr('data-bottom-percent') : 'skip'; 5942 5943 //top 5944 if ($topPadding != 'skip') { 5945 $(this).css('padding-top', $topPadding); 5946 } 5947 5948 //bottom 5949 if ($bottomPadding != 'skip') { 5950 $(this).css('padding-bottom', $bottomPadding); 5951 } 5952 5953 }); 5954 } 5955 5956 } 5957 5958 5959 /** 5960 * Full width row padding adjust initialization 5961 * 5962 * @since 10.5 5963 */ 5964 function fullWidthRowPaddingAdjust() { 5965 5966 if (nectarDOMInfo.usingMobileBrowser) { 5967 fullWidthRowPaddingAdjustCalc(); 5968 } 5969 5970 $window.on('resize', fullWidthRowPaddingAdjustCalc); 5971 5972 } 5973 5974 5975 5976 5977 5978 /** 5979 * Full width content row auto equal height cols. 5980 * 5981 * @since 4.0 5982 */ 5983 function fullWidthContentColumns() { 5984 5985 var $frontEndEditorElDiv = ($('body.vc_editor').length > 0) ? '.vc_element > ' : ''; 5986 5987 $('.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 () { 5988 5989 // Only set the height if more than one column 5990 if ($(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col').length > 1) { 5991 5992 var tallestColumn = 0;
5993 var $columnInnerHeight = 0; 5994 var $column_inner_selector; 5995 5996 $(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col').each(function () { 5997 5998 $column_inner_selector = ($(this).find('> .vc_column-inner > .wpb_wrapper').length > 0) ? '.vc_column-inner' : '.column-inner-wrap > .column-inner'; 5999 6000 var $padding = ( $body.is('[data-flex-cols="true"]') ) ? parseInt($(this).find('> .vc_column-inner').css('padding-top')) : parseInt($(this).css('padding-top')); 6001 var $frontEndEditorElPadding = ($frontEndEditorElDiv.length > 2 && $(this).find('> .vc_column-inner').length > 0) ? parseInt($(this).find('> .vc_column-inner').css('padding-top')) : 0; 6002 6003 if( $(this).find('> ' + $column_inner_selector + ' > .wpb_wrapper').height() + ($padding * 2) + $frontEndEditorElPadding > tallestColumn ) { 6004 tallestColumn = $(this).find('> ' + $column_inner_selector + ' > .wpb_wrapper').height() + ($padding * 2) + $frontEndEditorElPadding; 6005 } 6006 6007 }); 6008 6009 $(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col').each(function () { 6010 6011 $column_inner_selector = ($(this).find('> .vc_column-inner > .wpb_wrapper').length > 0) ? '.vc_column-inner' : '.column-inner-wrap > .column-inner'; 6012 6013 // Columns with content 6014 if ($(this).find('> ' + $column_inner_selector + ' > .wpb_wrapper > *').length > 0) { 6015 6016 // Added in 7.6 to fix equal height columns 6017 if ($frontEndEditorElDiv.length < 2 && !$(this).parent().parent().hasClass('vc_row-o-equal-height')) { 6018 $(this).css('height', tallestColumn); 6019 6020 if( $body.is('[data-flex-cols="true"]') ) { 6021 $(this).find('> .vc_column-inner').css('height', tallestColumn); 6022 } 6023 6024 } else if ($frontEndEditorElDiv.length > 2 && !$(this).parent().parent().parent().hasClass('vc_row-o-equal-height')) { 6025 $(this).css('height', tallestColumn); 6026 6027 if( $body.is('[data-flex-cols="true"]') ) { 6028 $(this).find('> .vc_column-inner').css('height', tallestColumn); 6029 } 6030 6031 } 6032 } 6033 6034 // Empty columns 6035 else { 6036 if ($(this).is('[data-using-bg="true"]')) { 6037 6038 $(this).css('min-height', tallestColumn); 6039 6040 if( $body.is('[data-flex-cols="true"]') ) { 6041 $(this).find('> .vc_column-inner').css('min-height', tallestColumn); 6042 } 6043 6044 if ($(this).is('[data-animation*="reveal"]')) { 6045 $(this).find('.column-inner') 6046 .css('min-height', tallestColumn); 6047 } 6048 6049 } 6050 } 6051 6052 }); 6053 6054 // Nested column height 6055 if (nectarDOMInfo.winW < 1000) { 6056 $(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col .wpb_row .col').css('min-height', '0px'); 6057 } 6058 6059 // Vertically center 6060 if ($(this).hasClass('vertically-align-columns') && 6061 nectarDOMInfo.winW > 1000 && 6062 !$(this).hasClass('vc_row-o-equal-height')) { 6063 6064 // Parent columns 6065 $(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col').each(function () { 6066 6067 $column_inner_selector = ($(this).find('> .vc_column-inner > .wpb_wrapper').length > 0) ? '.vc_column-inner' : '.column-inner-wrap > .column-inner'; 6068
6069 $columnInnerHeight = $(this).find('> ' + $column_inner_selector + ' > .wpb_wrapper').height(); 6070 6071 var $marginCalc = ($(this).height() / 2) - ($columnInnerHeight / 2); 6072 6073 if ($marginCalc <= 0) { 6074 $marginCalc = 0; 6075 } 6076 6077 $(this).find('> ' + $column_inner_selector + ' > .wpb_wrapper') 6078 .css('margin-top', $marginCalc) 6079 .css('margin-bottom', $marginCalc); 6080 6081 }); 6082 6083 6084 } 6085 6086 } 6087 6088 }); 6089 6090 6091 if( $('body[data-flex-cols="true"]').length == 0 ) { 6092 6093 // Equal height columns in container type with reveal columns 6094 $('.main-content > .row > .wpb_row:not(.full-width-content).vc_row-o-equal-height').each(function () { 6095 if ($(this).find('>.span_12 > ' + $frontEndEditorElDiv + ' .wpb_column[data-animation*="reveal"]').length > 0) { 6096 6097 var tallestColumn = 0; 6098 6099 $(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col').each(function () { 6100 6101 var $padding = parseInt($(this).find('> .column-inner-wrap > .column-inner').css('padding-top')); 6102 6103 if( $(this).find('> .column-inner-wrap > .column-inner').height() + ($padding * 2) > tallestColumn ) { 6104 tallestColumn = $(this).find('> .column-inner-wrap > .column-inner').height() + ($padding * 2); 6105 } 6106 6107 });
6108 6109 $(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col').each(function () { 6110 6111 // Columns with content 6112 if ($(this).find('> .column-inner-wrap > .column-inner .wpb_wrapper > *').length > 0) { 6113 $(this).find('> .column-inner-wrap').css('height', tallestColumn); 6114 } 6115 // Empty columns 6116 else { 6117 $(this).css('min-height', tallestColumn); 6118 if ($(this).is('[data-animation*="reveal"]')) { 6119 $(this).find('.column-inner').css('min-height', tallestColumn); 6120 } 6121 } 6122 }); 6123 6124 } 6125 }); 6126 6127 // Using equal height option, top/bottom padding % needs to be convered into px for cross browser (flex bug) 6128 $('.wpb_row.vc_row-o-equal-height>.span_12> ' + $frontEndEditorElDiv + '.wpb_column[class*="padding-"][data-padding-pos="all"]').each(function () { 6129 if ($(this).parents('.tabbed').length == 0) { 6130 $(this).css({ 6131 'padding-top': $(this).css('padding-left'), 6132 'padding-bottom': $(this).css('padding-left') 6133 });
6134 } 6135 }); 6136 6137 } // endif; Not using modern grid system. 6138 6139 } 6140 6141 6142 6143 6144 /** 6145 * Mouse parallax row option. 6146 * 6147 * @since 4.0 6148 */ 6149 function mouseParallaxInit() { 6150 6151 $('.wpb_row:has(.nectar-parallax-scene)').each(function (i) { 6152 6153 var $strength = parseInt($(this).find('.nectar-parallax-scene').attr('data-scene-strength')); 6154 6155 $mouseParallaxScenes[i] = $(this).find('.nectar-parallax-scene').parallax({ 6156 scalarX: $strength, 6157 scalarY: $strength 6158 }); 6159 6160 // Wait until the images in the scene have loaded. 6161 var images = $(this).find('.nectar-parallax-scene li'); 6162 6163 $.each(images, function () { 6164 if ($(this).find('div').length > 0) { 6165 var el = $(this).find('div'), 6166 image = el.css('background-image').replace(/"/g, '').replace(/url\(|\)$/ig, ''); 6167 if (image && image !== '' && image !== 'none') { 6168 images = images.add($('<img>').attr('src', image)); 6169 } 6170 } 6171 }); 6172 6173 }); 6174 6175 } 6176 6177 6178 6179 6180 6181 6182 /** 6183 * Add checkmark icons to unorder list with checkmark class. 6184 * 6185 * @since 2.0 6186 */ 6187 function ulCheckmarks() { 6188 $('ul.checks li').each(function () { 6189 if ($(this).find('i.fa-check-circle').length == 0) { 6190 $(this).prepend('<i class="fa fa-check-circle"></i>'); 6191 } 6192 }); 6193 } 6194 6195 6196 6197 6198 /** 6199 * Allow CTA element BG color to also act as a link. 6200 * 6201 * @since 11.0 6202 */ 6203 function ctaLinkBG() { 6204 6205 $body.on('click','.nectar-cta[data-using-bg="true"]:not([data-style="material"]) .link_wrap', function() { 6206 6207 $(this).find('a.link_text')[0].click(); 6208 6209 }); 6210 6211 } 6212 6213 6214 6215 /** 6216 * Add CSS default animation classes through JS to 6217 * avoid inital animation on page load. 6218 * 6219 * @since 11.0 6220 */ 6221 function nectarKeyframeAssist() { 6222 6223 $('.nectar-cta[data-style="arrow-animation"]').addClass('loaded'); 6224 6225 } 6226 6227 6228 6229 6230 /** 6231 * Page builder row background layer animations. 6232 * 6233 * @since 9.0 6234 * @see waypoints 6235 */ 6236 function rowBGAnimations() { 6237 6238 var $rowBGAnimationsOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : '93%'; 6239 var $rowBGAnimationsRevealOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : '75%'; 6240 var $rowBGOffset; 6241 6242 $($fullscreenSelector + '.row-bg-wrap[data-bg-animation]:not([data-bg-animation="none"]):not([data-bg-animation*="displace-filter"]) .row-bg').each(function () { 6243 6244 var $animation = $(this).parents('.row-bg-wrap').attr('data-bg-animation'); 6245 6246 if( $animation != 'zoom-out-reveal' && $animation.indexOf('reveal-from-') == -1 ) { 6247 $rowBGOffset = $rowBGAnimationsOffsetPos; 6248 } else { 6249 $rowBGOffset = $rowBGAnimationsRevealOffsetPos; 6250 } 6251 6252 if( !$(this).hasClass('using-image') && $(this).parents('.nectar-scrolling-text').length == 0 ) { 6253 6254 if( $animation != 'zoom-out-reveal' && $animation.indexOf('reveal-from-') == -1 ) { 6255 return; 6256 } 6257 6258 } 6259 6260 var $that = $(this); 6261 var waypoint = new Waypoint({ 6262 element: $that.parents('.row-bg-wrap'), 6263 handler: function () { 6264 6265 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 6266 waypoint.destroy(); 6267 return; 6268 } 6269 6270 $that.parents('.inner-wrap').addClass('animated-in'); 6271 6272 if( $animation == 'zoom-out-reveal' || $animation.indexOf('reveal-from-') > -1 || $that.parents('.nectar-scrolling-text').length > 0 ) { 6273 $that.parents('.row-bg-wrap').addClass('animated-in'); 6274 } 6275 6276 waypoint.destroy(); 6277 }, 6278 offset: $rowBGOffset 6279 }); 6280 6281 }); 6282 6283 } 6284 6285 6286 /** 6287 * Page builder column background layer animations. 6288 * 6289 * @since 9.0 6290 * @see waypoints 6291 */ 6292 function columnBGAnimations() { 6293 6294 var $colBGAnimationsOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : '93%'; 6295 var $colBGAnimationsRevealOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : '80%'; 6296 var $colBGOffset; 6297 6298 $($fullscreenSelector + '.column-image-bg-wrap[data-bg-animation]:not([data-bg-animation="none"]):not([data-bg-animation*="displace-filter"]) .column-image-bg').each(function () { 6299 6300 var $animation = $(this).parents('.column-image-bg-wrap').attr('data-bg-animation'); 6301 6302 if( $animation != 'zoom-out-reveal' && $animation.indexOf('reveal-from-') == -1 ) { 6303 $colBGOffset = $colBGAnimationsOffsetPos; 6304 } else { 6305 6306 if( $animation == 'ro-reveal-from-bottom' && $fullscreenMarkupBool == false ) { 6307 $colBGOffset = '95%'; 6308 } else if( $animation == 'ro-reveal-from-top' && $fullscreenMarkupBool == false ) { 6309 $colBGOffset = '65%'; 6310 } else { 6311 $colBGOffset = $colBGAnimationsRevealOffsetPos; 6312 } 6313 } 6314 6315 var $that = $(this); 6316 6317 var waypoint = new Waypoint({ 6318 element: $that.parents('.column-image-bg-wrap'), 6319 handler: function () { 6320 6321 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 6322 waypoint.destroy(); 6323 return; 6324 } 6325 6326 $that.parents('.inner-wrap').addClass('animated-in'); 6327 if( $animation == 'zoom-out-reveal' || $animation.indexOf('reveal-from-') > -1 ) { 6328 $that.parents('.column-image-bg-wrap').addClass('animated-in'); 6329 $that.parents('.column-image-bg-wrap').siblings('.column-bg-overlay-wrap').addClass('animated-in'); 6330 $that.parents('.vc_column-inner').addClass('revealed-bg'); 6331 } 6332 waypoint.destroy(); 6333 }, 6334 offset: $colBGOffset 6335 });
6336 6337 }); 6338 6339 // Zoom out reveal with BG color only 6340 $($fullscreenSelector + '.column-bg-overlay-wrap[data-bg-animation]').each(function () { 6341 6342 $colBGOffset = $colBGAnimationsRevealOffsetPos; 6343 6344 var $that = $(this); 6345 var $animation = $(this).attr('data-bg-animation'); 6346 6347 if( $animation == 'zoom-out-reveal' || $animation.indexOf('reveal-from-') > 0 ) { 6348 6349 if( $that.parent().find('.column-image-bg-wrap').length == 0 ) { 6350 6351 var waypoint = new Waypoint({ 6352 element: $that, 6353 handler: function () { 6354 6355 if ( $that.hasClass('animated-in') ) { 6356 waypoint.destroy(); 6357 return; 6358 } 6359 6360 $that.addClass('animated-in'); 6361 $that.parents('.vc_column-inner').addClass('revealed-bg'); 6362 waypoint.destroy(); 6363 6364 }, 6365 offset: $colBGOffset 6366 }); 6367 6368 } 6369 6370 } 6371 6372 }); 6373 6374 } 6375 6376 6377 6378 /** 6379 * Page builder column and image animations. 6380 * 6381 * @since 4.0 6382 * @see waypoints 6383 */ 6384 function colAndImgAnimations() { 6385 6386 var $colAndImgOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : '88%'; 6387 var $cascadingOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : '70%'; 6388 var $colAndImgRevealOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : '70%'; 6389 6390 $($fullscreenSelector + '.img-with-animation').each(function () { 6391 6392 var $that = $(this); 6393 6394 var $animationType = ($that.is('[data-animation]')) ? $that.attr('data-animation') : 'fade-in'; 6395 6396 // reveal images alters offset 6397 if( $animationType == 'ro-reveal-from-right' && $colAndImgOffsetPos == '88%' || 6398 $animationType == 'ro-reveal-from-left' && $colAndImgOffsetPos == '88%' ) { 6399 $colAndImgOffsetPos = '75%'; 6400 } 6401 6402 // initiate waypoint. 6403 var waypoint = new Waypoint({ 6404 element: $that, 6405 handler: function () { 6406 6407 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 6408 waypoint.destroy(); 6409 return; 6410 } 6411 6412 if (!bypassAnimations || $('body[data-responsive="0"]').length > 0) { 6413 6414 var $delay = ($that.is('[data-delay]')) ? $that.attr('data-delay') : 0; 6415 var $elToAnimate = ($that.parents('.hover-wrap').length > 0) ? $that.parents('.hover-wrap') : $that; 6416 6417 6418 if ($animationType == 'fade-in-from-left' || $animationType == 'fade-in-from-right') { 6419 6420 $elToAnimate.delay($delay).transition({ 6421 'opacity': 1, 6422 'x': '0px' 6423 }, $animationDuration, $animationEasing); 6424 6425 } else if ($animationType == 'fade-in-from-bottom') { 6426 6427 $elToAnimate.delay($delay).transition({ 6428 'opacity': 1, 6429 'y': '0px' 6430 }, $animationDuration, $animationEasing); 6431 6432 } else if ($animationType == 'fade-in') { 6433 6434 $elToAnimate.delay($delay).transition({ 6435 'opacity': 1 6436 }, $animationDuration, $animationEasing); 6437 6438 } else if ($animationType == 'grow-in') { 6439 6440 setTimeout(function () { 6441 $elToAnimate.transition({ 6442 scale: 1, 6443 'opacity': 1 6444 }, $animationDuration, $animationEasing); 6445 }, $delay); 6446 6447 } else if ($animationType == 'flip-in') { 6448 6449 setTimeout(function () { 6450 $elToAnimate.transition({ 6451 rotateY: 0, 6452 'opacity': 1 6453 }, $animationDuration, $animationEasing); 6454 }, $delay); 6455 6456 } else if ($animationType == 'flip-in-vertical') { 6457 6458 setTimeout(function () { 6459 $elToAnimate.transition({ 6460 rotateX: 0, 6461 'opacity': 1 6462 }, $animationDuration, $animationEasing); 6463 }, $delay); 6464 6465 } 6466 else if ($animationType == 'ro-reveal-from-left' || 6467 $animationType == 'ro-reveal-from-right' || 6468 $animationType == 'ro-reveal-from-bottom' || 6469 $animationType == 'ro-reveal-from-top') { 6470 $that.parents('.img-with-aniamtion-wrap').addClass('animated-in'); 6471 } 6472 6473 $that.addClass('animated-in'); 6474 6475 } 6476 6477 waypoint.destroy(); 6478 6479 }, 6480 offset: $colAndImgOffsetPos 6481 });
6482 6483 6484 6485 }); 6486 6487 6488 $($fullscreenSelector + '.nectar_cascading_images').each(function () { 6489 6490 var $that = $(this); 6491 var $animationDelay = ($(this).is('[data-animation-timing]')) ? $(this).attr('data-animation-timing') : 175; 6492 $animationDelay = parseInt($animationDelay); 6493 6494 var waypoint = new Waypoint({ 6495 element: $that, 6496 handler: function () { 6497 6498 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 6499 waypoint.destroy(); 6500 return; 6501 } 6502 6503 if (!bypassAnimations || $('body[data-responsive="0"]').length > 0) { 6504 6505 $that.find('.cascading-image').each(function (i) { 6506 6507 var $that2 = $(this); 6508 6509 if ($that2.attr('data-animation') == 'flip-in' || $that2.attr('data-animation') == 'flip-in-vertical') { 6510 setTimeout(function () { 6511 $that2.find('.inner-wrap').css({ 6512 'opacity': 1, 6513 'transform': 'rotate(0deg) translateZ(0px)' 6514 }); 6515 }, i * $animationDelay); 6516 } else if( $that2.attr('data-animation') == 'grow-in-reveal' ) { 6517 setTimeout(function () { 6518 $that2.find('.inner-wrap').css({ 6519 'opacity': 1, 6520 'transform': 'translateX(0px) translateY(0px) scale(1,1) translateZ(0px)' 6521 }); 6522 $that2.find('.inner-wrap img').css({ 6523 'transform': 'translateX(0px) translateY(0px) scale(1,1) translateZ(0px)' 6524 }); 6525 }, i * $animationDelay); 6526 } 6527 else { 6528 setTimeout(function () { 6529 $that2.find('.inner-wrap').css({ 6530 'opacity': 1, 6531 'transform': 'translateX(0px) translateY(0px) scale(1,1) translateZ(0px)' 6532 }); 6533 }, i * $animationDelay); 6534 } 6535 6536 6537 }); 6538 6539 $that.addClass('animated-in'); 6540 6541 } 6542 6543 waypoint.destroy(); 6544 6545 }, 6546 offset: $cascadingOffsetPos 6547 }); 6548 6549 }); 6550 6551 6552 $($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) { 6553 6554 var $that = $(this); 6555 6556 //set perspective for vertical flip 6557 if ($that.is('[data-animation="flip-in-vertical"]') || $that.is('[data-animation="slight-twist"]')) { 6558 if( $('.page-submenu[data-sticky="true"]').length == 0 && $that.parents('.nectar-scrolling-tabs').length == 0 ) { 6559 $that.parents('.col.span_12').addClass('flip-in-vertical-wrap'); 6560 } 6561 } 6562 6563 var waypoint = new Waypoint({ 6564 element: $that, 6565 handler: function () { 6566 6567 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 6568 waypoint.destroy(); 6569 return; 6570 } 6571 6572 if (!bypassAnimations || $('body[data-responsive="0"]').length > 0) { 6573 6574 var $delay = $that.attr('data-delay'); 6575 6576 if ($that.attr('data-animation') == 'fade-in-from-left' || $that.attr('data-animation') == 'fade-in-from-right') { 6577 6578 $standAnimatedColTimeout[i] = setTimeout(function () { 6579 $that.transition({ 6580 'opacity': 1, 6581 'x': '0px' 6582 }, $animationDuration, $animationEasing); 6583 }, $delay); 6584 6585 } else if ($that.attr('data-animation') == 'fade-in-from-bottom') { 6586 6587 $standAnimatedColTimeout[i] = setTimeout(function () { 6588 $that.transition({ 6589 'opacity': 1, 6590 'y': '0px' 6591 }, $animationDuration, $animationEasing); 6592 }, $delay); 6593 6594 } else if ($that.attr('data-animation') == 'fade-in') { 6595 6596 $standAnimatedColTimeout[i] = setTimeout(function () { 6597 $that.transition({ 6598 'opacity': 1 6599 }, $animationDuration, $animationEasing); 6600 }, $delay); 6601 6602 } else if ($that.attr('data-animation') == 'grow-in' || $that.attr('data-animation') == 'zoom-out') { 6603 6604 $standAnimatedColTimeout[i] = setTimeout(function () { 6605 $that.transition({ 6606 scale: 1, 6607 'opacity': 1 6608 }, $animationDuration, $animationEasing); 6609 }, $delay); 6610 6611 } else if ($that.attr('data-animation') == 'flip-in') { 6612 6613 $standAnimatedColTimeout[i] = setTimeout(function () { 6614 $that.transition({ 6615 rotateY: 0, 6616 'opacity': 1 6617 }, $animationDuration, $animationEasing); 6618 }, $delay); 6619 6620 } else if ($that.attr('data-animation') == 'flip-in-vertical') { 6621 6622 $standAnimatedColTimeout[i] = setTimeout(function () { 6623 $that.transition({ 6624 rotateX: 0, 6625 y: 0, 6626 'opacity': 1 6627 }, $animationDuration, $animationEasing); 6628 }, $delay); 6629 6630 } else if ($that.attr('data-animation') == 'slight-twist') { 6631 6632 $standAnimatedColTimeout[i] = setTimeout(function () { 6633 anime({ 6634 targets: $that[0], 6635 rotateY: [20, 0], 6636 rotateZ: [-4, 0], 6637 opacity: 1, 6638 easing: $animationEasing, 6639 duration: $animationDuration 6640 });
6641 }, $delay); 6642 6643 } 6644 6645 //boxed column hover fix 6646 if ($that.hasClass('boxed')) { 6647 $that.addClass('no-pointer-events'); 6648 setTimeout(function () { 6649 $that.removeClass('no-pointer-events'); 6650 }, parseInt($animationDuration) + parseInt($delay) + 30); 6651 } 6652 6653 if ($that.find('.nectar-post-grid-wrap[data-style="mouse_follow_image"]')) { 6654 setTimeout(function() { 6655 $that[0].style.transform = 'none'; 6656 }, parseInt($animationDuration) + parseInt($delay) + 30 ); 6657 } 6658 6659 $that.addClass('animated-in'); 6660 6661 } 6662 6663 waypoint.destroy(); 6664 }, 6665 offset: $colAndImgOffsetPos 6666 }); 6667 6668 }); 6669 6670 6671 $($fullscreenSelector + '.wpb_column.has-animation[data-animation*="reveal"]').each(function () { 6672 6673 var $that = $(this), 6674 waypoint = new Waypoint({ 6675 element: $that, 6676 handler: function () { 6677 6678 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 6679 waypoint.destroy(); 6680 return; 6681 } 6682 6683 var $delay = $that.attr('data-delay'); 6684 6685 if (!bypassAnimations || $('body[data-responsive="0"]').length > 0) { 6686 6687 var $columnInnerSelector = ( $that.find('> .vc_column-inner').length > 0 ) ? true : false; 6688 6689 if ($that.attr('data-animation') == 'reveal-from-bottom' || $that.attr('data-animation') == 'reveal-from-top') { 6690 6691 setTimeout(function () { 6692 6693 if ($that.hasClass('animated-in')) { 6694 6695 if( $columnInnerSelector == true ) { 6696 6697 // Modern. 6698 $that.find('> .vc_column-inner').transition({ 6699 'y': 0 6700 }, $animationDuration, $animationEasing ); 6701 6702 } else { 6703 6704 // Legacy. 6705 $that.find('.column-inner-wrap, .column-inner').transition({ 6706 'y': 0 6707 }, $animationDuration, $animationEasing, function () { 6708 $that.find('.column-inner-wrap, .column-inner').addClass('no-transform'); 6709 }); 6710 } 6711 6712 } 6713 6714 }, $delay); 6715 6716 } else if ($that.attr('data-animation') == 'reveal-from-right' || $that.attr('data-animation') == 'reveal-from-left') { 6717 setTimeout(function () { 6718 if ($that.hasClass('animated-in')) { 6719 6720 if( $columnInnerSelector == true ) { 6721 6722 // Modern. 6723 $that.find('> .vc_column-inner').transition({ 6724 'x': 0 6725 }, $animationDuration, $animationEasing); 6726 6727 6728 } else { 6729 // Legacy. 6730 $that.find('.column-inner-wrap, .column-inner').transition({ 6731 'x': 0 6732 }, $animationDuration, $animationEasing, function () { 6733 $that.find('.column-inner-wrap, .column-inner').addClass('no-transform'); 6734 }); 6735 6736 } 6737 6738 6739 } 6740 }, $delay); 6741 } 6742 6743 $that.addClass('animated-in'); 6744 6745 } 6746 6747 waypoint.destroy(); 6748 }, 6749 offset: $colAndImgRevealOffsetPos 6750 }); 6751 6752 }); 6753 6754 } 6755 6756 6757 6758 /** 6759 * Cascading images element sizing 6760 * 6761 * @since 6.0 6762 */ 6763 function cascadingImageBGSizing() { 6764 6765 $('.nectar_cascading_images').each(function () { 6766 6767 //handle max width for cascading images in equal height columns 6768 if ($(this).parents('.vc_row-o-equal-height').length > 0 && $(this).parents('.wpb_column').length > 0) { 6769 $(this).css('max-width', $(this).parents('.wpb_column').width()); 6770 } 6771 6772 //set size for layers with no images 6773 $(this).find('.bg-color').each(function () { 6774 6775 var $bgColorHeight = 0; 6776 var $bgColorWidth = 0; 6777 6778 if ($(this).parent().find('.img-wrap').length == 0) { 6779 6780 var $firstSibling = $(this).parents('.cascading-image').siblings('.cascading-image[data-has-img="true"]').first(); 6781 6782 $firstSibling.css({ 6783 'position': 'relative', 6784 'visiblity': 'hidden' 6785 });
6786 6787 $bgColorHeight = $firstSibling.find('.img-wrap').height(); 6788 $bgColorWidth = $firstSibling.find('.img-wrap').width(); 6789 6790 if ($firstSibling.index() == 0) { 6791 $firstSibling.css({ 6792 'visiblity': 'visible' 6793 }); 6794 } else { 6795 $firstSibling.css({ 6796 'position': 'absolute', 6797 'visiblity': 'visible' 6798 }); 6799 } 6800 } else { 6801 $bgColorHeight = $(this).parent().find('.img-wrap').height(); 6802 $bgColorWidth = $(this).parent().find('.img-wrap').width(); 6803 } 6804 6805 $(this).css({ 6806 'height': $bgColorHeight, 6807 'width': $bgColorWidth 6808 }); 6809 }); 6810 }); 6811 6812 } 6813 6814 6815 6816 6817 /** 6818 * Cascading images element initialization. 6819 * 6820 * @since 10.5 6821 */ 6822 function cascadingImageInit() { 6823 6824 if ($('.nectar_cascading_images').length > 0) { 6825 6826 var cascadingParallax = []; 6827 6828 $('.nectar_cascading_images').each(function(i){ 6829 6830 imagesLoaded($(this), function (instance) { 6831 6832 // Create sizes. 6833 cascadingImageBGSizing(); 6834 6835 // Parallax scrolling. 6836 if( $(instance.elements[0]).is('[data-parallax="yes"]') && !nectarDOMInfo.usingMobileBrowser && $('#nectar_fullscreen_rows').length == 0 ) { 6837 cascadingParallax[i] = new CascadingParallax($(instance.elements[0]), $(instance.elements[0]).attr('data-parallax-intensity')); 6838 } 6839 6840 }); 6841 6842 }); 6843 6844 // BG Sizing Resize. 6845 $window.on('resize', cascadingImageBGSizing); 6846 6847 } 6848 6849 } 6850 6851 6852 6853 6854 function CascadingParallax(el, intensity) { 6855 6856 this.$element = el; 6857 this.inView = false; 6858 this.topLevel = false; 6859 this.lastY = 0; 6860 6861 this.layer1Parallax = ( this.$element.is('[data-layer-1-parallax="yes"]') ) ? true : false; 6862 6863 switch(intensity) { 6864 case 'subtle': 6865 this.intensity = 0.09; 6866 break; 6867 case 'medium': 6868 this.intensity = 0.15; 6869 break; 6870 case 'high': 6871 this.intensity = 0.25; 6872 break; 6873 } 6874 this.calculatePos(); 6875 this.trackView(); 6876 this.animate(); 6877 6878 if( $('.portfolio-filters').length > 0 || 6879 $('.portfolio-filters-inline').length > 0 ) { 6880 setInterval(this.calculatePos.bind(this),700); 6881 } 6882 6883 $window.on('resize', this.calculatePos.bind(this)); 6884 } 6885 6886 CascadingParallax.prototype.calculatePos = function() { 6887 this.offsetTop = this.$element.offset().top; 6888 this.height = this.$element.outerHeight(); 6889 this.vertCenter = nectarDOMInfo.winH/2 - this.height/2; 6890 }; 6891 6892 CascadingParallax.prototype.trackView = function() { 6893 6894 var that = this; 6895 6896 if( this.$element.parents('.top-level').length > 0 ) { 6897 this.topLevel = true; 6898 } 6899 6900 if( 'IntersectionObserver' in window ) { 6901 6902 var options = { 6903 rootMargin: '250px', 6904 } 6905 var observer = new IntersectionObserver(function(entries) { 6906 6907 entries.forEach(function(entry){ 6908 var isIntersecting = entry.isIntersecting; 6909 6910 if (isIntersecting) { 6911 that.inView = true; 6912 } else { 6913 that.inView = false; 6914 } 6915 }); 6916 6917 }, options); 6918 6919 observer.observe(this.$element[0]); 6920 6921 } 6922 6923 }; 6924 6925 CascadingParallax.prototype.animate = function() { 6926 6927 if( this.inView ) { 6928 6929 var that = this; 6930 6931 this.lastY = linearInterpolate(this.lastY, nectarDOMInfo.scrollTop, 0.18); 6932 6933 this.$element.find('.bg-layer').each(function(i) { 6934 6935 var $scale = $(this).attr('data-scale'); 6936 6937 if( that.layer1Parallax ) { 6938 i = (i/1.5)+1; 6939 } 6940 6941 if( that.topLevel === true && nectarDOMInfo.winW > 1000) { 6942 $(this).css('transform','translateY(' + -(that.lastY * that.intensity * i) + 'px) translateZ(0) scale(' + $scale + ')'); 6943 } else { 6944 $(this).css('transform','translateY(' + -((that.lastY - that.offsetTop + that.vertCenter ) * that.intensity * i ) + 'px) translateZ(0) scale(' + $scale + ')'); 6945 } 6946 6947 });
6948 } 6949 6950 window.requestAnimationFrame(this.animate.bind(this)); 6951 }; 6952 6953 6954 6955 6956 /** 6957 * Split line heading element initialization. 6958 * 6959 * @since 10.5 6960 * @see waypoints 6961 */ 6962 function splitLineHeadings() { 6963 6964 // Create waypoint. 6965 var $splitLineOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : 'bottom-in-view'; 6966 $($fullscreenSelector + '.nectar-split-heading').each(function () { 6967 6968 var $that = $(this); 6969 var $delay = ( $that.is('[data-animation-delay]') ) ? parseInt($that.attr('data-animation-delay')) : 0; 6970 6971 var waypoint = new Waypoint({ 6972 element: $that, 6973 handler: function () { 6974 6975 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 6976 waypoint.destroy(); 6977 return; 6978 } 6979 6980 if (!bypassAnimations || $('body[data-responsive="0"]').length > 0) { 6981 6982 var $animationDurationCap; 6983 6984 setTimeout(function() { 6985 6986 if( $that.is('[data-animation-type="line-reveal-by-space"]') ) { 6987 6988 $animationDurationCap = (parseInt($animationDuration) < 900) ? $animationDuration : '900'; 6989 $that.find('> * > span').each(function (i) { 6990 6991 $(this).find('> .inner').transition({ 6992 'y': '0px' 6993 }, $animationDuration, $animationEasing); 6994 6995 }); 6996 6997 } else if( $that.is('[data-animation-type="letter-fade-reveal"]') ) { 6998 6999 $animationDurationCap = (parseInt($animationDuration) < 1000) ? $animationDuration : '1000'; 7000 $that.find('> * > span span').each(function (i) { 7001 7002 $(this).delay(i * 8).transition({ 7003 'y': '0px', 7004 'opacity': '1' 7005 }, $animationDurationCap, $animationEasing); 7006 7007 }); 7008 7009 } else { 7010 $that.find('.heading-line').each(function (i) { 7011 7012 $(this).find('> div').delay(i * 70).transition({ 7013 'y': '0px' 7014 }, $animationDuration, $animationEasing); 7015 7016 }); 7017 } 7018 7019 $that.addClass('animated-in'); 7020 7021 }, $delay); 7022 7023 } 7024 7025 waypoint.destroy(); 7026 }, 7027 offset: $splitLineOffsetPos 7028 }); 7029 7030 }); 7031 } 7032 7033 7034 7035 /** 7036 * Progress bar element initialization. 7037 * 7038 * @since 3.0 7039 * @see waypoints 7040 */ 7041 7042 function progressBars() { 7043 7044 var $progressBarsOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : 'bottom-in-view'; 7045 var $progressSelector = ($('#nectar_fullscreen_rows[data-mobile-disable="on"]').length > 0 && nectarDOMInfo.usingMobileBrowser) ? '.nectar-progress-bar' : $fullscreenSelector + '.nectar-progress-bar'; 7046 7047 if( nectarDOMInfo.usingMobileBrowser && $progressBarsOffsetPos == 'bottom-in-view') { 7048 $progressBarsOffsetPos = '70%'; 7049 } 7050 7051 $($progressSelector).parent().each(function () { 7052 7053 var $that = $(this), 7054 waypoint = new Waypoint({ 7055 element: $that, 7056 handler: function () { 7057 7058 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 7059 waypoint.destroy(); 7060 return; 7061 } 7062 7063 if ($progressBarsOffsetPos == '100%') { 7064 $that.find('.nectar-progress-bar .bar-wrap').css('opacity', '1'); 7065 } 7066 7067 $that.find('.nectar-progress-bar').each(function (i) { 7068 7069 var percent = $(this).find('span').attr('data-width'), 7070 $endNum = parseInt($(this).find('span strong i').text()), 7071 $that = $(this); 7072 7073 $that.find('span').delay(i * 90).transition({ 7074 'width': percent + '%' 7075 }, 1050, 'easeInOutQuint', function () {}); 7076 7077 setTimeout(function () { 7078 7079 var countOptions = {
7080 useEasing: false 7081 }; 7082 var $countEle = $that.find('span strong i')[0]; 7083 var numAnim = new CountUp($countEle, 0, $endNum, 0, 1, countOptions); 7084 numAnim.start(); 7085 7086 $that.find('span strong').transition({ 7087 'opacity': 1 7088 }, 550, 'easeInCirc'); 7089 }, (i * 90)); 7090 7091 ////100% progress bar 7092 if (percent == '100') { 7093 $that.find('span strong').addClass('full'); 7094 } 7095 }); 7096 7097 $that.addClass('completed'); 7098 7099 waypoint.destroy(); 7100 7101 }, 7102 offset: $progressBarsOffsetPos 7103 }); 7104 7105 }); 7106 } 7107 7108 7109 7110 /** 7111 * Page builder column border animations. 7112 * 7113 * @since 8.0 7114 * @see waypoints 7115 */ 7116 function animatedColBorders() { 7117 7118 var $progressBarsOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : '75%'; 7119 $($fullscreenSelector + '.wpb_column[data-border-animation="true"]').each(function () { 7120 7121 var $that = $(this), 7122 waypoint = new Waypoint({ 7123 element: $that, 7124 handler: function () { 7125 7126 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 7127 waypoint.destroy(); 7128 return; 7129 } 7130 7131 var $borderDelay = ($that.attr('data-border-animation-delay').length > 0) ? parseInt($that.attr('data-border-animation-delay')) : 0; 7132 setTimeout(function () { 7133 $that.find('.border-wrap').addClass('animation'); 7134 $that.find('.border-wrap').addClass('completed'); 7135 }, $borderDelay); 7136 7137 waypoint.destroy(); 7138 7139 }, 7140 offset: $progressBarsOffsetPos 7141 }); 7142 7143 }); 7144 } 7145 7146 7147 7148 /** 7149 * Food menu item element. 7150 * 7151 * @since 8.0 7152 * @see waypoints 7153 */ 7154 function foodMenuItems() { 7155 7156 var $foodItemOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : '80%'; 7157 $($fullscreenSelector + '.nectar_food_menu_item').parent().each(function () { 7158 7159 var $that = $(this), 7160 waypoint = new Waypoint({ 7161 element: $that, 7162 handler: function () { 7163 7164 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 7165 waypoint.destroy(); 7166 return; 7167 } 7168 7169 $that.find('.nectar_food_menu_item').each(function (i) { 7170 7171 var $that = $(this); 7172 7173 setTimeout(function () { 7174 $that.addClass('animated-in'); 7175 }, i * 150); 7176 7177 });
7178 7179 waypoint.destroy(); 7180 7181 }, 7182 offset: $foodItemOffsetPos 7183 }); 7184 7185 }); 7186 } 7187 7188 7189 7190 /** 7191 * Divider element 7192 * 7193 * @since 3.0 7194 * @see waypoints 7195 */ 7196 function dividers() { 7197 7198 var $dividerOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : 'bottom-in-view'; 7199 7200 $($fullscreenSelector + '.divider-small-border[data-animate="yes"], ' + $fullscreenSelector + '.divider-border[data-animate="yes"]').each(function () { 7201 7202 var $lineDur = ($(this).hasClass('divider-small-border')) ? 1300 : 1500, 7203 $that = $(this), 7204 waypoint = new Waypoint({ 7205 element: $that, 7206 handler: function () { 7207 7208 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 7209 waypoint.destroy(); 7210 return; 7211 } 7212 7213 $that.each(function () { 7214 7215 $(this).css({ 7216 'transform': 'scale(0,1)', 7217 'visibility': 'visible' 7218 }); 7219 var $that = $(this); 7220 7221 $that.delay($that.attr('data-animation-delay')).transition({ 7222 'transform': 'scale(1, 1)' 7223 }, $lineDur, 'cubic-bezier(.18,1,.22,1)'); 7224 7225 });
7226 7227 $that.addClass('completed'); 7228 7229 waypoint.destroy(); 7230 7231 }, 7232 offset: $dividerOffsetPos 7233 }); 7234 7235 }); 7236 } 7237 7238 7239 7240 /** 7241 * Image with hotspots element hover event 7242 * 7243 * @since 7.0 7244 */ 7245 function hotSpotHoverBind() { 7246 7247 //add pulse animation 7248 $('.nectar_image_with_hotspots[data-hotspot-icon="numerical"]').each(function () { 7249 $(this).find('.nectar_hotspot_wrap').each(function (i) { 7250 var $that = $(this); 7251 setTimeout(function () { 7252 $that.find('.nectar_hotspot').addClass('pulse'); 7253 }, i * 300); 7254 }); 7255 }); 7256 7257 7258 var hotSpotHoverTimeout = []; 7259 7260 $('.nectar_image_with_hotspots:not([data-tooltip-func="click"]) .nectar_hotspot').each(function (i) { 7261 7262 hotSpotHoverTimeout[i] = ''; 7263 7264 $(this).on('mouseover', function () { 7265 clearTimeout(hotSpotHoverTimeout[i]); 7266 $(this).parent().css({ 7267 'z-index': '400', 7268 'height': 'auto', 7269 'width': 'auto' 7270 }); 7271 }); 7272 7273 $(this).on('mouseleave', function () { 7274 7275 var $that = $(this); 7276 $that.parent().css({ 7277 'z-index': 'auto' 7278 }); 7279 7280 hotSpotHoverTimeout[i] = setTimeout(function () { 7281 $that.parent().css({ 7282 'height': '30px', 7283 'width': '30px' 7284 });
7285 }, 300); 7286 7287 }); 7288 7289 }); 7290 7291 } 7292 7293 7294 7295 /** 7296 * Image with hotspots element responsive behavior. 7297 * 7298 * @since 7.0 7299 */ 7300 function responsiveTooltips() { 7301 7302 $('.nectar_image_with_hotspots').each(function () { 7303 7304 $(this).find('.nectar_hotspot_wrap').each(function () { 7305 7306 if (nectarDOMInfo.winW > 690) { 7307 7308 // Remove click if applicable 7309 if ($(this).parents('.nectar_image_with_hotspots[data-tooltip-func="hover"]').length > 0) { 7310 $(this).find('.nectar_hotspot').removeClass('click'); 7311 $(this).find('.nttip').removeClass('open'); 7312 } 7313 7314 $(this).find('.nttip .inner a.tipclose').remove(); 7315 $('.nttip').css('height', 'auto'); 7316 7317 // Reset for positioning 7318 $(this).css({ 7319 'width': 'auto', 7320 'height': 'auto' 7321 }); 7322 7323 $(this).find('.nttip') 7324 .removeClass('force-right') 7325 .removeClass('force-left') 7326 .removeClass('force-top') 7327 .css('width', 'auto'); 7328 7329 var $tipOffset = $(this).find('.nttip').offset(); 7330 7331 // Against right side 7332 if ($tipOffset.left > $(this).parents('.nectar_image_with_hotspots').width() - 200) { 7333 $(this).find('.nttip').css('width', '250px'); 7334 } 7335 else { 7336 $(this).find('.nttip').css('width', 'auto'); 7337 } 7338 7339 // Responsive 7340 if ($tipOffset.left < 0) { 7341 $(this).find('.nttip').addClass('force-right'); 7342 } 7343 else if ($tipOffset.left + $(this).find('.nttip').outerWidth(true) > nectarDOMInfo.winW) { 7344 $(this).find('.nttip').addClass('force-left').css('width', '250px'); 7345 } 7346 else if ($tipOffset.top + $(this).find('.nttip').height() + 35 > $window.height() && $('#nectar_fullscreen_rows').length > 0) { 7347 $(this).find('.nttip').addClass('force-top'); 7348 } 7349 7350 if ($(this).find('> .open').length == 0) { 7351 7352 $(this).css({ 7353 'width': '30px', 7354 'height': '30px' 7355 }); 7356 } 7357 7358 } else { 7359 7360 //fixed position 7361 $(this).find('.nttip') 7362 .removeClass('force-left') 7363 .removeClass('force-right') 7364 .removeClass('force-top'); 7365 7366 $(this).find('.nectar_hotspot').addClass('click'); 7367 7368 if ($(this).find('.nttip a.tipclose').length == 0) { 7369 $(this).find('.nttip .inner').append('<a href="#" class="tipclose"><span></span></a>'); 7370 } 7371 7372 // Change height of fixed 7373 $('.nttip').css('height', $window.height()); 7374 } 7375 }); 7376 }); 7377 7378 } 7379 7380 7381 /** 7382 * Image with hotspots events 7383 * 7384 * @since 10.5 7385 */ 7386 function imageWithHotspotEvents() { 7387 7388 if( $('.nectar_image_with_hotspots').length == 0 ) { 7389 return; 7390 } 7391 7392 // Hover 7393 hotSpotHoverBind(); 7394 7395 // Click 7396 $body.on('click', '.nectar_hotspot.click', function () { 7397 $(this).parents('.nectar_image_with_hotspots').find('.nttip').removeClass('open'); 7398 $(this).parent().find('.nttip').addClass('open'); 7399 7400 $(this).parents('.nectar_image_with_hotspots').find('.nectar_hotspot').removeClass('open'); 7401 $(this).parent().find('.nectar_hotspot').addClass('open'); 7402 7403 if (nectarDOMInfo.winW > 690) { 7404 $(this).parent().css({ 7405 'z-index': '120', 7406 'height': 'auto', 7407 'width': 'auto' 7408 }); 7409 7410 var $that = $(this); 7411 7412 setTimeout(function () { 7413 $that.parents('.nectar_image_with_hotspots').find('.nectar_hotspot_wrap').each(function () { 7414 7415 if ($(this).find('> .open').length == 0) { 7416 $(this).css({ 7417 'height': '30px', 7418 'width': '30px', 7419 'z-index': 'auto' 7420 }); 7421 } 7422 });
7423 }, 300); 7424 } 7425 7426 if (nectarDOMInfo.winW <= 690) { 7427 $(this).parents('.wpb_row, [class*="vc_col-"]').css('z-index', '200'); 7428 } 7429 7430 return false; 7431 }); 7432 7433 $body.on('click', '.nectar_hotspot.open', function () { 7434 $(this).parent().find('.nttip').removeClass('open'); 7435 $(this).parent().find('.nectar_hotspot').removeClass('open'); 7436 7437 $(this).parents('.wpb_row').css('z-index', 'auto'); 7438 7439 return false; 7440 }); 7441 7442 $body.on('click', '.nttip.open', function () { 7443 if (nectarDOMInfo.winW < 690) { 7444 $(this).parents('.nectar_image_with_hotspots').find('.nttip').removeClass('open'); 7445 $(this).parents('.nectar_image_with_hotspots').find('.nectar_hotspot').removeClass('open'); 7446 $(this).parents('.wpb_row').css('z-index', 'auto'); 7447 return false; 7448 } 7449 }); 7450 7451 7452 // Calculate on init. 7453 responsiveTooltips(); 7454 7455 // Resize event. 7456 $window.on('resize',responsiveTooltips); 7457 7458 } 7459 7460 7461 7462 /** 7463 * Image with hotspots initialization. 7464 * 7465 * @since 7.0 7466 * @see waypoints 7467 */ 7468 function imageWithHotspots() { 7469 7470 var $imageWithHotspotsOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : '50%'; 7471 7472 $($fullscreenSelector + '.nectar_image_with_hotspots[data-animation="true"]').each(function () { 7473 7474 var $that = $(this); 7475 var waypoint = new Waypoint({ 7476 element: $that, 7477 handler: function () { 7478 7479 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 7480 waypoint.destroy(); 7481 return; 7482 } 7483 7484 $that.addClass('completed'); 7485 $that.find('.nectar_hotspot_wrap').each(function (i) { 7486 var $that2 = $(this); 7487 var $extrai = ($that2.parents('.col.has-animation').length > 0) ? 1 : 0; 7488 setTimeout(function () { 7489 $that2.addClass('animated-in'); 7490 }, 175 * (i + $extrai)); 7491 });
7492 7493 waypoint.destroy(); 7494 7495 }, 7496 offset: $imageWithHotspotsOffsetPos 7497 }); 7498 7499 }); 7500 7501 7502 } 7503 7504 7505 /** 7506 * Nectar Lazy Loading 7507 * 7508 * @since 11.0 7509 */ 7510 function nectarLazyImageLoading() { 7511 7512 var lazyItems = [].slice.call(document.querySelectorAll('[data-nectar-img-src]')); 7513 7514 if ('IntersectionObserver' in window) { 7515 7516 var options = { 7517 rootMargin: '500px', 7518 } 7519 7520 nectarLazyImageSizing(); 7521 $window.off('resize.nectarLazySizing', nectarLazyImageSizing); 7522 $window.on('resize.nectarLazySizing', nectarLazyImageSizing); 7523 7524 var lazyItemObserver = new IntersectionObserver(function(entries) { 7525 7526 entries.forEach(function(entry) { 7527 if (entry.isIntersecting) { 7528 var lazyItem = entry.target; 7529 7530 var imgSrc = lazyItem.getAttribute('data-nectar-img-src'); 7531 7532 // img tags. 7533 if( lazyItem.classList.contains('nectar-lazy') ) { 7534 lazyItem.addEventListener( 'load', function() { 7535 lazyItem.style.height = ""; 7536 lazyItem.style.width = ""; 7537 lazyItem.classList.add('loaded'); 7538 lazyItem.removeAttribute('data-nectar-img-src'); 7539 lazyItemObserver.unobserve(lazyItem); 7540 }); 7541 lazyItem.src = imgSrc; 7542 var srcset = lazyItem.getAttribute('data-nectar-img-srcset'); 7543 if( srcset ) { 7544 lazyItem.setAttribute( 'srcset', srcset ); 7545 lazyItem.removeAttribute('data-nectar-img-srcset'); 7546 } 7547 } 7548 // BGs. 7549 else { 7550 lazyItem.style.backgroundImage = "url('" + imgSrc + "')"; 7551 lazyItem.classList.add('loaded'); 7552 lazyItem.removeAttribute('data-nectar-img-src'); 7553 lazyItemObserver.unobserve(lazyItem); 7554 } 7555 7556 } 7557 7558 }); 7559 7560 }, options); 7561 7562 lazyItems.forEach(function(lazyItem) { 7563 lazyItemObserver.observe(lazyItem); 7564 }); 7565 7566 } 7567 else { 7568 // load all the images when intersection observer is not supported. 7569 lazyItems.forEach(function(lazyItem) { 7570 7571 // img tags. 7572 if( lazyItem.classList.contains('nectar-lazy') ) { 7573 lazyItem.style.height = ""; 7574 lazyItem.style.width = ""; 7575 lazyItem.src = lazyItem.getAttribute('data-nectar-img-src'); 7576 var srcset = lazyItem.getAttribute('data-nectar-img-srcset'); 7577 if( srcset ) { 7578 lazyItem.setAttribute( 'srcset', srcset ); 7579 lazyItem.removeAttribute('data-nectar-img-srcset'); 7580 } 7581 lazyItem.classList.add('loaded'); 7582 lazyItem.removeAttribute('data-nectar-img-src'); 7583 } 7584 // BGs. 7585 else { 7586 lazyItem.style.backgroundImage = "url('" + lazyItem.getAttribute('data-nectar-img-src') + "')"; 7587 lazyItem.classList.add('loaded'); 7588 lazyItem.removeAttribute('data-nectar-img-src'); 7589 } 7590 7591 }); 7592 } 7593 7594 7595 } 7596 7597 7598 /** 7599 * Nectar lazy img size helper. 7600 * 7601 * @since 11.0 7602 */ 7603 7604 function nectarLazyImageSizing() { 7605 7606 $('img.nectar-lazy:not(.loaded)').each(function() { 7607 7608 $(this).css({ 7609 'height': '', 7610 'width' : '' 7611 }); 7612 7613 var heightAttr = parseInt($(this).attr('height')); 7614 var widthAttr = parseInt($(this).attr('width')); 7615 7616 var width = ($(this).parents('.nectar_cascading_images').length > 0) ? $(this).parents('.bg-layer').width() : $(this).width(); 7617 7618 // Shadow img. 7619 if( $(this).parents('.img-with-aniamtion-wrap[data-shadow*="depth"]').length > 0 ) { 7620 width = $(this).parents('.img-with-aniamtion-wrap').width(); 7621 } 7622 7623 // Post grid. 7624 if( $(this).parents('.nectar-post-grid-item-bg-wrap-inner').length > 0 ) { 7625 width = $(this).parents('.nectar-post-grid-item-bg-wrap-inner').width(); 7626 } 7627 7628 var dimensions = calculateAspectRatio( widthAttr, heightAttr, width, 2000 ); 7629 7630 $(this).css({ 7631 'height': dimensions.height + 'px', 7632 'width' : dimensions.width + 'px' 7633 });
7634 7635 }); 7636 7637 } 7638 7639 7640 /** 7641 * Nectar Post Grid Mouse Follow Init 7642 * 7643 * @since 11.0 7644 */ 7645 function nectarPostGridMouse() { 7646 7647 viewIndicatorArr = []; 7648 postGridImgMouseFollowArr = []; 7649 7650 if( !nectarDOMInfo.usingMobileBrowser ) { 7651 7652 $('.nectar-post-grid[data-indicator="yes"]').each(function(i) { 7653 viewIndicatorArr[i] = new NectarIconMouseFollow($(this),'view-indicator'); 7654 }); 7655 7656 $('.nectar-post-grid-wrap[data-style="mouse_follow_image"] .nectar-post-grid').each(function(i) { 7657 postGridImgMouseFollowArr[i] = new NectarIconMouseFollow($(this), 'post-grid-images'); 7658 }); 7659 7660 } 7661 7662 } 7663 7664 7665 7666 7667 7668 /** 7669 * Nectar Post Grid 7670 * 7671 * @since 11.0 7672 */ 7673 function nectarPostGridInit() { 7674 7675 $nectarPostGridArr = []; 7676 7677 // Mouse follow. 7678 nectarPostGridMouse(); 7679 7680 // Create grid instances. 7681 $('.nectar-post-grid-wrap').each(function(i) { 7682 $nectarPostGridArr[i] = new NectarPostGrid($(this)); 7683 }); 7684 7685 7686 } 7687 7688 7689 7690 function NectarPostGrid(el) { 7691 7692 this.el = el; 7693 this.currentPage = 0; 7694 this.activeFilter = 1; 7695 this.activeCatTotal = 0; 7696 this.settingsData = JSON.parse(this.el.attr('data-el-settings')); 7697 this.queryData = JSON.parse(this.el.attr('data-query')); 7698 this.sortable = this.el.find('.nectar-post-grid-filters').attr('data-sortable'); 7699 7700 this.initialMarkup(); 7701 this.clickEvents(); 7702 } 7703 7704 NectarPostGrid.prototype.initialMarkup = function() { 7705 7706 // Start Filter Active. 7707 if( this.el.find('.nectar-post-grid-filters a.active').length == 0 ) { 7708 this.el.find('.nectar-post-grid-filters a:first-child').addClass('active'); 7709 } 7710 7711 // Load More Markup. 7712 if( this.settingsData.pagination === 'load-more' && this.el.find('.load-more-wrap').length == 0 ) { 7713 7714 this.activeCatTotal = parseInt(this.el.find('.nectar-post-grid-filters a:nth-child(' + this.activeFilter + ')').attr('data-total-count')); 7715 7716 // Start hidden? 7717 if( this.el.find('.nectar-post-grid-item').length >= this.activeCatTotal ) { 7718 this.el.append('<div class="load-more-wrap inactive"><a href="#" class="load-more">'+ this.el.attr('data-load-more-text') + '</a></div>'); 7719 } else { 7720 this.el.append('<div class="load-more-wrap"><a href="#" class="load-more">'+ this.el.attr('data-load-more-text') + '</a></div>'); 7721 } 7722 7723 } 7724 7725 }; 7726 7727 7728 7729 NectarPostGrid.prototype.clickEvents = function() { 7730 7731 // Sortable Mobile Toggle. 7732 this.el.find('.nectar-post-grid-filters h4').on('click', function(){ 7733 $(this).parent().find('div').toggleClass('visible'); 7734 $(this).toggleClass('visible'); 7735 }); 7736 7737 // Sortable/Pagination. 7738 var settingsData = this.settingsData; 7739 var queryData = this.queryData; 7740 var instance = this; 7741 7742 this.el.find('.nectar-post-grid-filters a, .load-more-wrap:not(.inactive) .load-more').on('click', function() { 7743 7744 var $that = $(this); 7745 7746 // Filter active. 7747 if($that.parents('.nectar-post-grid-wrap.loading').length > 0 || $(this).hasClass('active')) { 7748 return false; 7749 } 7750 7751 7752 if( $(this).parents('.nectar-post-grid-filters').length > 0 ) { 7753 // Filter specific. 7754 $that.parent().find('a').removeClass('active'); 7755 $that.addClass('active'); 7756 instance.currentPage = 0; 7757 instance.activeFilter = $that.index() + 1; 7758 } else { 7759 // Load More specific. 7760 instance.currentPage++; 7761 } 7762 7763 var $gridEl = $that.parents('.nectar-post-grid-wrap').find('.nectar-post-grid') 7764 var $pagination = settingsData.pagination; 7765 var $action = ($that.hasClass('load-more') && $pagination === 'load-more') ? 'load-more' : 'filter'; 7766 var $category = ''; 7767 7768 // Determine what category to load from. 7769 if( instance.sortable === 'yes' ) { 7770 $category = $that.parents('.nectar-post-grid-wrap').find('.nectar-post-grid-filters a.active').attr('data-filter'); 7771 } else { 7772 7773 var skipAll = ( $that.parents('.nectar-post-grid-wrap').find('.nectar-post-grid-filters a').length > 1 ) ? ':not(.all-filter)' : ''; 7774 7775 $that.parents('.nectar-post-grid-wrap').find('.nectar-post-grid-filters a' + skipAll).each(function(){ 7776 $category += $(this).attr('data-filter') + ', '; 7777 });
7778 7779 $category = $category.substring(0, $category.length - 2); 7780 7781 } 7782 7783 7784 var $dataToPass = { 7785 action: 'nectar_get_post_grid_segment', 7786 post_type: queryData.post_type, 7787 category: $category, 7788 posts_per_page: queryData.posts_per_page, 7789 current_page: instance.currentPage, 7790 offset: queryData.offset, 7791 order: queryData.order, 7792 orderby: queryData.orderby, 7793 load_action: $action, 7794 settings: { 7795 pagination: $pagination, 7796 post_type: settingsData.post_type, 7797 image_size: settingsData.image_size, 7798 aspect_ratio_image_size: settingsData.aspect_ratio_image_size, 7799 card_bg_color: settingsData.card_bg_color, 7800 display_categories: settingsData.display_categories, 7801 display_excerpt: settingsData.display_excerpt, 7802 display_date: settingsData.display_date, 7803 color_overlay: settingsData.color_overlay, 7804 color_overlay_opacity: settingsData.color_overlay_opacity, 7805 color_overlay_hover_opacity: settingsData.color_overlay_hover_opacity, 7806 grid_style: settingsData.grid_style, 7807 heading_tag: settingsData.heading_tag, 7808 post_title_overlay: settingsData.post_title_overlay 7809 } 7810 }; 7811 7812 $that.parents('.nectar-post-grid-wrap').addClass('loading'); 7813 7814 $.post(window.nectarLove.ajaxurl, $dataToPass, function (data) { 7815 7816 // Update markup. 7817 if( $action === 'load-more' ) { 7818 $gridEl.append(data); 7819 } else { 7820 $gridEl.html(data); 7821 } 7822 7823 // Load in animation. 7824 if( $gridEl.is('[data-animation="fade-in-from-bottom"]') ) { 7825 7826 $that.parents('.nectar-post-grid-wrap').removeClass('finished-animating'); 7827 7828 $gridEl.find('.nectar-post-grid-item:not(.animated-in)').each(function(i) { 7829 var $storedEl = $(this); 7830 setTimeout(function() { 7831 $storedEl.addClass('animated-in'); 7832 }, i * 90); 7833 7834 }); 7835 7836 setTimeout(function(){ 7837 $that.parents('.nectar-post-grid-wrap').addClass('finished-animating'); 7838 }, 950); 7839 } 7840 7841 if( $pagination === 'load-more' ) { 7842 7843 instance.activeCatTotal = parseInt(instance.el.find('.nectar-post-grid-filters a:nth-child(' + instance.activeFilter + ')').attr('data-total-count')); 7844 7845 if( $gridEl.find('.nectar-post-grid-item').length >= instance.activeCatTotal ) { 7846 instance.el.find('.load-more-wrap').addClass('inactive'); 7847 } else { 7848 instance.el.find('.load-more-wrap').removeClass('inactive'); 7849 } 7850 7851 } 7852 7853 $that.parents('.nectar-post-grid-wrap').removeClass('loading'); 7854 7855 // Resize. 7856 $window.trigger('resize'); 7857 7858 // Mouse follow. 7859 nectarPostGridMouse(); 7860 7861 }); // end POST 7862 7863 return false; 7864 7865 }); 7866 7867 // External project links 7868 if( this.el.hasClass('target-blank-external-urls') ) { 7869 this.el.find(".nectar-post-grid-item a[href*='http://']:not([href*='" + window.location.hostname + "'])").attr("target", "_blank"); 7870 } 7871 7872 7873 }; 7874 7875 7876 function NectarPostGridWaypoint() { 7877 7878 var postGridOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : '75%'; 7879 7880 $($fullscreenSelector + '.nectar-post-grid-wrap').each(function () { 7881 7882 var $that = $(this), 7883 waypoint = new Waypoint({ 7884 element: $that, 7885 handler: function () { 7886 7887 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 7888 waypoint.destroy(); 7889 return; 7890 } 7891 7892 $that.find('.nectar-post-grid-filters').addClass('animated-in'); 7893 $that.find('.nectar-post-grid-item').each(function(i) { 7894 7895 var $item = $(this); 7896 7897 setTimeout(function() { 7898 7899 $item.addClass('animated-in'); 7900 7901 }, i * 90); 7902 7903 });
7904 7905 setTimeout(function(){ 7906 $that.addClass('finished-animating'); 7907 }, 950); 7908 7909 7910 waypoint.destroy(); 7911 7912 }, 7913 offset: postGridOffsetPos 7914 }); 7915 7916 }); 7917 7918 } 7919 7920 7921 7922 /** 7923 * Animated title element initialization. 7924 * 7925 * @since 7.0 7926 * @see waypoints 7927 */ 7928 function animatedTitles() { 7929 7930 var $animatedTitlesOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : 'bottom-in-view'; 7931 7932 $($fullscreenSelector + '.nectar-animated-title').each(function () { 7933 7934 var $that = $(this), 7935 waypoint = new Waypoint({ 7936 element: $that, 7937 handler: function () { 7938 7939 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 7940 waypoint.destroy(); 7941 return; 7942 } 7943 7944 $that.addClass('completed'); 7945 7946 waypoint.destroy(); 7947 7948 }, 7949 offset: $animatedTitlesOffsetPos 7950 }); 7951 7952 }); 7953 } 7954 7955 7956 7957 7958 /** 7959 * Highlighted Text element initialization. 7960 * 7961 * @since 9.0 7962 * @see waypoints 7963 */ 7964 function highlightedText() { 7965 7966 var $highlightedTextOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : 'bottom-in-view'; 7967 var highlightedColorCss = ''; 7968 7969 if( nectarDOMInfo.usingMobileBrowser && $highlightedTextOffsetPos == 'bottom-in-view' ) { 7970 $highlightedTextOffsetPos = '85%'; 7971 } 7972 7973 $($fullscreenSelector + '.nectar-highlighted-text').each(function (i) { 7974 7975 var $animationDelay = 0; 7976 7977 if($(this).is('[data-animation-delay]') && 7978 $(this).attr('data-animation-delay').length > 0 && 7979 $(this).attr('data-animation') != 'false') { 7980 $animationDelay = $(this).attr('data-animation-delay'); 7981 } 7982 7983 // Custom color 7984 if ($(this).is('[data-using-custom-color="true"]')) { 7985 7986 var $custom_highlight_color = $(this).attr('data-color'); 7987 var $custom_highlight_color_2 = ( $(this).is('[data-color-gradient]') && $(this).attr('data-color-gradient').length > 0 ) ? $(this).attr('data-color-gradient') : false; 7988 7989 $(this).addClass('instance-' + i); 7990 7991 if( $custom_highlight_color_2 !== false && $custom_highlight_color_2.length > 0 ) { 7992 highlightedColorCss += '.nectar-highlighted-text.instance-' + i + ' em:before { background: linear-gradient(90deg, '+ $custom_highlight_color +', '+ $custom_highlight_color_2 +'); }'; 7993 7994 if( $(this).is('[data-style="regular_underline"]') ) { 7995 highlightedColorCss += '.nectar-highlighted-text[data-style="regular_underline"].instance-' + i + ' a em:after { background: linear-gradient(90deg, '+ $custom_highlight_color +', '+ $custom_highlight_color_2 +'); }'; 7996 highlightedColorCss += '.nectar-highlighted-text[data-style="regular_underline"].instance-' + i + ' em a:after { background: linear-gradient(90deg, '+ $custom_highlight_color +', '+ $custom_highlight_color_2 +'); }'; 7997 } 7998 7999 } else { 8000 highlightedColorCss += '.nectar-highlighted-text.instance-' + i + ' em:before { background-color: ' + $custom_highlight_color + '; }'; 8001 8002 if( $(this).is('[data-style="regular_underline"]') ) { 8003 highlightedColorCss += '.nectar-highlighted-text[data-style="regular_underline"].instance-' + i + ' a em:after { background-color: ' + $custom_highlight_color + '; }'; 8004 highlightedColorCss += '.nectar-highlighted-text[data-style="regular_underline"].instance-' + i + ' em a:after { background-color: ' + $custom_highlight_color + '; }'; 8005 } 8006 8007 } 8008 8009 8010 } 8011 8012 if (bypassAnimations) { 8013 $(this).find('em').addClass('animated'); 8014 } 8015 8016 // Waypoint 8017 var $that = $(this); 8018 var waypoint = new Waypoint({ 8019 element: $that, 8020 handler: function () { 8021 8022 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated')) { 8023 waypoint.destroy(); 8024 return; 8025 } 8026 8027 setTimeout(function() { 8028 8029 $that.find('em').each(function (i) { 8030 var $highlighted_em = $(this); 8031 setTimeout(function () { 8032 $highlighted_em.addClass('animated'); 8033 }, i * 300); 8034 8035 });
8036 8037 }, $animationDelay); 8038 8039 waypoint.destroy(); 8040 8041 }, 8042 offset: $highlightedTextOffsetPos 8043 }); 8044 8045 }); 8046 8047 // Style 8048 nectarCreateStyle(highlightedColorCss, 'highlighted-text'); 8049 8050 } 8051 8052 8053 8054 8055 /** 8056 * Pricing table element height calculations. 8057 * 8058 * @since 2.0 8059 */ 8060 function pricingTableHeight() { 8061 8062 var $tallestCol; 8063 8064 $('.pricing-table[data-style="default"]').each(function () { 8065 $tallestCol = 0; 8066 8067 $(this).find('> div ul').each(function () { 8068 8069 if( $(this).height() > $tallestCol ) { 8070 $tallestCol = $(this).height(); 8071 } 8072 8073 }); 8074 8075 //safety net incase pricing tables height couldn't be determined 8076 if ($tallestCol == 0) { 8077 $tallestCol = 'auto'; 8078 } 8079 8080 //set even height 8081 $(this).find('> div ul').css('height', $tallestCol); 8082 8083 }); 8084 } 8085 8086 8087 8088 8089 /** 8090 * Testimonial slider element initialization. 8091 * 8092 * @since 10.5 8093 */ 8094 function nectarTestimonialSliders() { 8095 8096 $testimonialSliders = []; 8097 8098 if (typeof NectarTestimonialSlider == 'undefined') { 8099 return; 8100 } 8101 8102 $('.testimonial_slider').each(function (i) { 8103 8104 var $that_el = $(this), 8105 $type = ($(this).is('[data-style]')) ? $(this).attr('data-style') : 'none'; 8106 8107 $testimonialSliders[i] = new NectarTestimonialSlider($that_el, $type, resizeVideoToCover, fullWidthContentColumns); 8108 8109 8110 if ($(this).is('.disable-height-animation:not([data-style*="multiple_visible"])')) { 8111 $testimonialSliders[i].testimonialSliderHeight(); 8112 setTimeout($testimonialSliders[i].testimonialSliderHeight.bind($testimonialSliders[i]), 500); 8113 } 8114 8115 if ($(this).is('.testimonial_slider[data-style="multiple_visible_minimal"]')) { 8116 $testimonialSliders[i].testimonialSliderHeightMinimalMult(); 8117 setTimeout($testimonialSliders[i].testimonialSliderHeightMinimalMult.bind($testimonialSliders[i]), 500); 8118 } 8119 8120 }); 8121 8122 8123 } 8124 8125 8126 /** 8127 * Testimonial slider element resize binding. 8128 * 8129 * @since 10.5 8130 */ 8131 function nectarTestimonialSlidersEvents() { 8132 8133 $window.off('smartresize.nectarTestimonials'); 8134 $window.off('resize.nectarTestimonialsMin'); 8135 8136 if($testimonialSliders.length > 0) { 8137 $window.on('smartresize.nectarTestimonials',nectarTestimonialMainResize); 8138 } 8139 8140 if( $('.testimonial_slider[data-style="multiple_visible_minimal"]').length > 0 ) { 8141 $window.on('resize.nectarTestimonialsMin',nectarTestimonialMiniamlResize); 8142 } 8143 8144 } 8145 8146 function nectarTestimonialMainResize() { 8147 for (var i = 0; i < $testimonialSliders.length; i++) { 8148 $testimonialSliders[i].testimonialSliderHeight(); 8149 $testimonialSliders[i].testimonialHeightResize(); 8150 } 8151 } 8152 function nectarTestimonialMiniamlResize() { 8153 for (var i = 0; i < $testimonialSliders.length; i++) { 8154 $testimonialSliders[i].testimonialSliderHeightMinimalMult(); 8155 } 8156 } 8157 8158 8159 8160 /** 8161 * Icon list element initialization. 8162 * 8163 * @since 6.0 8164 * @see waypoints 8165 */ 8166 function iconList() { 8167 8168 var $iconListOffsetPos = ($fullscreenMarkupBool == true) ? '250%' : '75%'; 8169 8170 $($fullscreenSelector + '.nectar-icon-list[data-animate="true"]').each(function () { 8171 8172 var $that = $(this), 8173 waypoint = new Waypoint({ 8174 element: $that, 8175 handler: function () { 8176 8177 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 8178 waypoint.destroy(); 8179 return; 8180 } 8181 8182 $that.each(function () { 8183 8184 var $listItemAnimationDelay = ($that.is('[data-direction="horizontal"]')) ? 100 : 300; 8185 8186 $(this).find('.nectar-icon-list-item').each(function (i) { 8187 var $thatt = $(this); 8188 setTimeout(function () { 8189 $thatt.addClass('animated'); 8190 }, i * $listItemAnimationDelay); 8191 });
8192 8193 }); 8194 8195 $that.addClass('completed'); 8196 8197 waypoint.destroy(); 8198 8199 }, 8200 offset: $iconListOffsetPos 8201 }); 8202 8203 }); 8204 } 8205 8206 8207 8208 /** 8209 * Get the BG color of parent column/row. 8210 * 8211 * @since 6.0 8212 */ 8213 function narrowParentBGC(element) { 8214 8215 var narrowedBGC; 8216 8217 if (element.parents('.wpb_column[data-bg-color*="#"]').length > 0 && element.parents('.wpb_column[data-bg-opacity="1"]').length > 0) { 8218 narrowedBGC = element.parents('.wpb_column').attr('data-bg-color'); 8219 } 8220 else if (element.parents('.wpb_row').length > 0 && element.parents('.wpb_row').find('.row-bg.using-bg-color').length > 0 || 8221 element.parents('.wpb_row').length > 0 && element.parents('.wpb_row').find('.row-bg.using-bg-color-excluded').length > 0) { 8222 narrowedBGC = element.parents('.wpb_row').find('.row-bg').css('background-color'); 8223 } 8224 else { 8225 if ($('#nectar_fullscreen_rows').length > 0) { 8226 narrowedBGC = $('#nectar_fullscreen_rows > .wpb_row .full-page-inner-wrap').css('background-color'); 8227 } 8228 else { 8229 narrowedBGC = $('.container-wrap').css('background-color'); 8230 } 8231 } 8232 8233 return narrowedBGC; 8234 8235 } 8236 8237 8238 /** 8239 * Icon BG matching row BG 8240 * 8241 * @since 6.0 8242 */ 8243 function nectarIconMatchColoring() { 8244 8245 var nectarMatchingBGCss = ''; 8246 8247 // Icon list 8248 $('.nectar-icon-list[data-icon-style="border"], .nectar_icon_wrap[data-style="border-animation"][data-color*="extra-color-gradient-"]').each(function (i) { 8249 8250 var $bgColorToSet = narrowParentBGC($(this)); 8251 8252 if( $(this).hasClass('nectar-icon-list') ) { 8253 $(this).find('.list-icon-holder').css('background-color', $bgColorToSet); 8254 } 8255 else { 8256 8257 $(this).removeClass(function (index, className) { 8258 return (className.match(/(^|\s)instance-\S+/g) || []).join(' '); 8259 }); 8260 8261 $(this).addClass('instance-' + i); 8262 nectarMatchingBGCss += '.nectar_icon_wrap.instance-' + i + ' .nectar_icon:before { background-color: ' + $bgColorToSet + '!important; }'; 8263 } 8264 8265 }); 8266 8267 // Material gradient btns 8268 $('body.material .nectar-button.see-through[class*="m-extra-color-gradient"]').each(function (i) { 8269 8270 var $bgColorToSet = narrowParentBGC($(this)); 8271 8272 $(this).removeClass(function (index, className) { 8273 return (className.match(/(^|\s)instance-\S+/g) || []).join(' '); 8274 }); 8275 8276 $(this).addClass('instance-' + i); 8277 nectarMatchingBGCss += '.nectar-button.see-through.instance-' + i + ':after { background-color: ' + $bgColorToSet + '!important; }'; 8278 8279 }); 8280 8281 // Style 8282 nectarCreateStyle(nectarMatchingBGCss, 'nectaricon-color-match'); 8283 8284 } 8285 8286 8287 8288 8289 8290 /** 8291 * One fourth column classes. 8292 * 8293 * @since 2.0 8294 */ 8295 function oneFourthClasses() { 8296 8297 $('.col.span_3, .vc_span3, .vc_col-sm-3').each(function () { 8298 if (!$(this).is('[data-t-w-inherits="small_desktop"]')) { 8299 8300 var $currentDiv = $(this); 8301 var $nextDiv = $(this).next('div'); 8302 8303 if ($nextDiv.hasClass('span_3') && !$currentDiv.hasClass('one-fourths') || 8304 $nextDiv.hasClass('vc_span3') && !$currentDiv.hasClass('one-fourths') || 8305 $nextDiv.hasClass('vc_col-sm-3') && !$currentDiv.hasClass('one-fourths')) { 8306 $currentDiv.addClass('one-fourths clear-both'); 8307 $nextDiv.addClass('one-fourths right-edge'); 8308 } 8309 } 8310 }); 8311 8312 // Make empty second 1/2 half columns display right on iPad 8313 $('.span_12 .col.span_6').each(function () { 8314 if ($(this).next('div').hasClass('span_6') && $.trim($(this).next('div').html()).length == 0) { 8315 $(this).addClass('empty-second'); 8316 } 8317 }); 8318 8319 } 8320 8321 8322 8323 8324 /** 8325 * Responsive video iframes initialization. 8326 * 8327 * @since 3.0 8328 */ 8329 function responsiveVideoIframesInit() { 8330 8331 $('iframe').each(function () { 8332 8333 // Make sure the iframe has a src 8334 if (typeof $(this).attr('src') != 'undefined' && 8335 !$(this).hasClass('skip-nectar-video-size') && 8336 !$(this).hasClass('iframe-embed') && 8337 $(this).parents('.ult_modal').length == 0 && 8338 $(this).parents('.ls-slide').length == 0 && 8339 $(this).parents('.esg-entry-media').length == 0 && 8340 $(this).parents('.wpb_video_widget.wpb_content_element').length == 0) { 8341 8342 var embedSrcLower = $(this).attr('src').toLowerCase(); 8343 8344 if (embedSrcLower.indexOf("youtube") >= 0 || 8345 embedSrcLower.indexOf("vimeo") >= 0 || 8346 embedSrcLower.indexOf("twitch.tv") >= 0 || 8347 embedSrcLower.indexOf("kickstarter") >= 0 || 8348 embedSrcLower.indexOf("embed-ssl.ted") >= 0 || 8349 embedSrcLower.indexOf("dailymotion") >= 0) { 8350 8351 $(this).addClass('iframe-embed'); 8352 8353 if ($(this).width() < $(this).parent().width()) { 8354 $(this) 8355 .attr('data-aspectRatio', $(this).height() / $(this).width()) 8356 .removeAttr('height') 8357 .removeAttr('width'); 8358 } else { 8359 $(this) 8360 .attr('data-aspectRatio', '0.56') 8361 .removeAttr('height') 8362 .removeAttr('width'); 8363 } 8364 8365 if ($(this).parents('.post-area.masonry.classic').length > 0) { 8366 $(this) 8367 .attr('data-aspectRatio', '0.56') 8368 .removeAttr('height') 8369 .removeAttr('width'); 8370 } 8371 8372 } 8373 8374 } 8375 8376 });
8377 8378 } 8379 8380 8381 /** 8382 * Responsive video iframes. 8383 * 8384 * @since 3.0 8385 */ 8386 function responsiveVideoIframes() { 8387 8388 $('iframe[data-aspectRatio]').each(function () { 8389 8390 var $el = $(this), 8391 newWidth = $el.parent().width(); 8392 8393 // In nectar slider 8394 if ($(this).parents('.swiper-slide').length > 0) { 8395 if ($(this).is(':visible')) { 8396 $el 8397 .width(newWidth) 8398 .height(newWidth * $el.attr('data-aspectRatio')); 8399 } 8400 } 8401 // All others 8402 else { 8403 $el 8404 .width(newWidth) 8405 .height(newWidth * $el.attr('data-aspectRatio')); 8406 } 8407 8408 }); 8409 8410 } 8411 8412 8413 /** 8414 * Reveal the audio/video elements after the size has been calculated. 8415 * 8416 * @since 10.5 8417 */ 8418 function audioVideoVis() { 8419 8420 //unwrap post and protfolio videos 8421 $('.video-wrap iframe').unwrap(); 8422 $('#sidebar iframe[src]').unwrap(); 8423 8424 $('audio') 8425 .attr('width', '100%') 8426 .attr('height', '100%') 8427 .css('visibility', 'visible'); 8428 8429 if ($body.hasClass('mobile')) { 8430 $('video').css('visibility', 'hidden'); 8431 } else { 8432 $('video').css('visibility', 'visible'); 8433 } 8434 8435 8436 $('.wp-video').each(function () { 8437 var video = $(this).find('video').get(0); 8438 video.addEventListener('loadeddata', function () { 8439 $window.trigger('resize'); 8440 }, false); 8441 }); 8442 8443 //webkit video back button fix 8444 $('.main-content iframe[src]').each(function () { 8445 $(this).css({ 8446 'opacity': '1', 8447 'visibility': 'visible' 8448 }); 8449 }); 8450 8451 } 8452 8453 8454 8455 8456 8457 /** 8458 * Nectar video background size calculations 8459 * 8460 * @since 5.0 8461 */ 8462 function resizeVideoToCover() { 8463 8464 var vid_w_orig = 1280, 8465 vid_h_orig = 720, 8466 min_w = 1200; 8467 8468 $('.nectar-video-wrap').each(function () { 8469 8470 var $containerHeight, $containerWidth; 8471 8472 if ($(this).find('video').length == 0) { 8473 return; 8474 } 8475 8476 if ($(this).parents('#page-header-bg').length > 0) { 8477 8478 if ($('.container-wrap.auto-height').length > 0) { 8479 return false; 8480 } 8481 8482 $containerHeight = $(this).parents('#page-header-bg').outerHeight(); 8483 $containerWidth = $(this).parents('#page-header-bg').outerWidth(); 8484 } else { 8485 8486 if ($(this).hasClass('column-video')) { 8487 if( $body.is('[data-flex-cols="true"]') ) { 8488 $containerHeight = $(this).parents('.vc_column-inner').outerHeight(); 8489 $containerWidth = $(this).parents('.vc_column-inner').outerWidth(); 8490 } else { 8491 $containerHeight = $(this).parents('.wpb_column').outerHeight(); 8492 $containerWidth = $(this).parents('.wpb_column').outerWidth(); 8493 } 8494 } else { 8495 $containerHeight = $(this).parents('.wpb_row').outerHeight(); 8496 $containerWidth = ($(this).parents('.full-width-section').length > 0) ? nectarDOMInfo.winW : $(this).parents('.wpb_row').outerWidth(); 8497 } 8498 } 8499 8500 // Set the video viewport to the window size 8501 $(this).width($containerWidth); 8502 if ($(this).parents('#page-header-bg').length > 0) { 8503 $(this).height($containerHeight); 8504 } 8505 8506 // Use largest scale factor of horizontal/vertical 8507 var scale_h = $containerWidth / vid_w_orig, 8508 scale_v = ($containerHeight - $containerHeight) / vid_h_orig, 8509 scale = scale_h > scale_v ? scale_h : scale_v; 8510 8511 // Update minium width to never allow excess space 8512 min_w = 1280 / 720 * ($containerHeight + 40); 8513 8514 // Don't allow scaled width < minimum video width 8515 if (scale * vid_w_orig < min_w) { 8516 scale = min_w / vid_w_orig; 8517 } 8518 8519 // Now scale the video 8520 $(this).find('video, .mejs-overlay, .mejs-poster').width(Math.ceil(scale * vid_w_orig + 0)); 8521 $(this).find('video, .mejs-overlay, .mejs-poster').height(Math.ceil(scale * vid_h_orig + 0)); 8522 8523 // And center it by scrolling the video viewport 8524 $(this).scrollLeft(($(this).find('video').width() - $containerWidth) / 2); 8525 $(this).scrollTop(($(this).find('video').height() - ($containerHeight)) / 2); 8526 $(this).find('.mejs-overlay, .mejs-poster').scrollTop(($(this).find('video').height() - ($containerHeight)) / 2); 8527 8528 8529 // Align bottom 8530 if ($(this).attr('data-bg-alignment') == 'center bottom' || $(this).attr('data-bg-alignment') == 'bottom') { 8531 $(this).scrollTop(($(this).find('video').height() - ($containerHeight + 6))); 8532 } 8533 // Align top 8534 else if ($(this).attr('data-bg-alignment') == 'center top' || $(this).attr('data-bg-alignment') == 'top') { 8535 $(this).scrollTop(0); 8536 } 8537 8538 // Add loaded class 8539 $(this).addClass('position-loaded'); 8540 });
8541 8542 } 8543 8544 8545 8546 /** 8547 * Nectar video background initialization. 8548 * 8549 * @since 5.0 8550 */ 8551 function videoBGInit() { 8552 8553 if ($('.nectar-video-wrap').length == 0 && $('.nectar-youtube-bg').length == 0) { 8554 return; 8555 } 8556 8557 setTimeout(function () { 8558 8559 resizeVideoToCover(); 8560 8561 // Resize 8562 $window.on('resize',resizeVideoToCover); 8563 8564 $('.video-color-overlay').each(function () { 8565 $(this).css('background-color', $(this).attr('data-color')); 8566 }); 8567 8568 $('.nectar-video-wrap').each(function () { 8569 8570 if ($(this).find('video').length == 0) { 8571 return; 8572 } 8573 8574 var $headerVideo = ($(this).parents('#page-header-bg').length > 0) ? true : false; 8575 var $that = $(this); 8576 var videoReady = setInterval(function () { 8577 8578 if ($that.find('video').get(0).readyState > 3) { 8579 8580 if (!nectarDOMInfo.usingMobileBrowser) { 8581 $that.transition({ 8582 'opacity': '1' 8583 }, 400); 8584 $that.find('video').transition({ 8585 'opacity': '1' 8586 }, 400); 8587 $that.parent().find('.video-color-overlay').transition({ 8588 'opacity': '0.7' 8589 }, 400); 8590 if ($headerVideo == true) { 8591 pageHeaderTextEffect(); 8592 } 8593 } 8594 8595 // Remove page loading screen 8596 $loadingScreenEl.addClass('loaded'); 8597 setTimeout(function () { 8598 $loadingScreenEl.addClass('hidden'); 8599 }, 1000); 8600 8601 8602 clearInterval(videoReady); 8603 } 8604 8605 }, 60); 8606 8607 if (nectarDOMInfo.usingMobileBrowser) { 8608 if ($that.parents('.full-width-section').length > 0 && $that.parents('#nectar_fullscreen_rows').length == 0) { 8609 $that.css('left', '50%'); 8610 } else { 8611 $that.css('left', '0px'); 8612 } 8613 8614 if ($headerVideo == true) { 8615 pageHeaderTextEffect(); 8616 } 8617 $that.find('video')[0].onplay = function () { 8618 $that.transition({ 8619 'opacity': '1' 8620 }, 400); 8621 $that.find('video').transition({ 8622 'opacity': '1' 8623 }, 400); 8624 $that.parent().find('.video-color-overlay').transition({ 8625 'opacity': '0.7' 8626 }, 400); 8627 }; 8628 } 8629 8630 }); 8631 }, 300); 8632 8633 8634 if (nectarDOMInfo.usingMobileBrowser) { 8635 8636 $('.nectar-video-wrap').each(function () { 8637 8638 if (!$(this).find('video').is('[muted]')) { 8639 8640 // Autoplay not supported unless muted 8641 $(this).parent().find('.mobile-video-image').show(); 8642 $(this).remove(); 8643 } 8644 8645 }); 8646 8647 } 8648 8649 8650 $('.wpb_row:has(".nectar-video-wrap"):not(.fp-section)').each(function (i) { 8651 $(this).css('z-index', 100 + i); 8652 }); 8653 8654 8655 $(".vc_row").each(function () { 8656 var youtubeUrl, youtubeId, $row = jQuery(this); 8657 $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(); 8658 8659 // Remove yt url 8660 $row.find('.nectar-youtube-bg span').remove(); 8661 8662 if (!nectarDOMInfo.usingMobileBrowser) { 8663 $row.find('.nectar-video-wrap, .nectar-youtube-bg').css({ 8664 'opacity': '1', 8665 'width': '100%', 8666 'height': '100%' 8667 }); 8668 } 8669 $row.find('.video-color-overlay').transition({ 8670 'opacity': '0.7' 8671 }, 400); 8672 }); 8673 8674 8675 function nectarInsertYoutubeVideoAsBackground($element, youtubeId, counter) { 8676 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 () {
8677 nectarInsertYoutubeVideoAsBackground($element, youtubeId, counter++) 8678 }, 100); 8679 var $container = $element.prepend('<div class="vc_video-bg"><div class="inner"></div></div>').find(".inner"); 8680 new YT.Player($container[0], { 8681 width: "100%", 8682 height: "100%", 8683 videoId: youtubeId, 8684 playerVars: { 8685 playlist: youtubeId, 8686 iv_load_policy: 3, 8687 enablejsapi: 1, 8688 disablekb: 1, 8689 autoplay: 1, 8690 controls: 0, 8691 showinfo: 0, 8692 rel: 0, 8693 loop: 1 8694 }, 8695 events: { 8696 onReady: function (event) { 8697 event.target.mute().setLoop(!0); 8698 nectarResizeVideoBackground($element); 8699 } 8700 } 8701 }), nectarResizeVideoBackground($element), jQuery(window).on("resize", function () { 8702 nectarResizeVideoBackground($element); 8703 }); 8704 8705 setTimeout(function () { 8706 nectarResizeVideoBackground($element); 8707 }, 100); 8708 } 8709 8710 function nectarResizeVideoBackground($element) { 8711 var iframeW, iframeH, marginLeft, marginTop, containerW = $element.innerWidth(), 8712 containerH = $element.innerHeight(), 8713 ratio1 = 16, 8714 ratio2 = 9; 8715 ratio1 / ratio2 > containerW / containerH ? (iframeW = containerH * (ratio1 / ratio2), 8716 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", 8717 marginLeft = -Math.round((iframeW - containerW) / 2) + "px", iframeW += "px", iframeH += "px"), 8718 $element.find(".vc_video-bg iframe").css({ 8719 maxWidth: "1000%", 8720 marginLeft: marginLeft, 8721 marginTop: marginTop, 8722 width: iframeW, 8723 height: iframeH 8724 }); 8725 } 8726 8727 function nectarExtractYoutubeId(url) { 8728 8729 if ("undefined" == typeof url) { 8730 return !1; 8731 } 8732 8733 var id = url.match(/(?:https?:\/{2})?(?:w{3}\.)?youtu(?:be)?\.(?:com|be)(?:\/watch\?v=|\/)([^\s&]+)/); 8734 return null !== id ? id[1] : !1 8735 } 8736 8737 8738 } 8739 8740 8741 8742 8743 /** 8744 * Single Blog Posts 8745 * 8746 * @since 11.0 8747 */ 8748 function blogSingle() { 8749 8750 // Remove first gallery on post when using the gallery slider option. 8751 if( $body.hasClass('single-post') && $('.content-inner[data-has-gallery]').length > 0 ) { 8752 8753 8754 if($('.wp-block-gallery').length > 0) { 8755 // Gutenberg. 8756 $('.content-inner').find('.wp-block-gallery').each(function(i) { 8757 if(i !== 0) { 8758 $(this).css('display','flex'); 8759 } 8760 }); 8761 8762 } else { 8763 // Classic Editor. 8764 $('.content-inner').find('.gallery').each(function(i) { 8765 if(i !== 0) { 8766 $(this).css('display','block'); 8767 } 8768 }); 8769 8770 } 8771 8772 } // If using gallery slider on single conditional end. 8773 8774 } 8775 8776 8777 8778 8779 8780 /*-------------------------------------------------------------------------*/ 8781 /* Header + Search 8782 /*-------------------------------------------------------------------------*/ 8783 8784 /** 8785 * Correct megamenus in mobile navigation. 8786 * 8787 * @since 8.0 8788 */ 8789 function mobileNavMegamenuCorrect() { 8790 8791 ////mobile megamenus without titles / nested groupings 8792 var $mobileNavSelector = ( $('#top #mobile-menu').length > 0 ) ? '#top #mobile-menu ' : '.off-canvas-menu-container.mobile-only '; 8793 8794 $($mobileNavSelector + '.megamenu > ul > li > a').each(function () { 8795 if ($(this).text() == '-' || $(this).text() == '–' || $(this).parent().hasClass('hide-title')) { 8796 var $navLIs = $(this).parent().find('> ul > li').clone(); 8797 $(this).parent().find('ul').remove(); 8798 $(this).parent().parent().append($navLIs); 8799 $(this).parent().remove(); 8800 } 8801 }); 8802 8803 } 8804 8805 8806 8807 8808 8809 8810 8811 8812 /** 8813 * Material theme skin off canvas menu initialization. 8814 * 8815 * @since 10.5 8816 */ 8817 function materialSkinOCM_Init() { 8818
8819 if ($('body.material[data-slide-out-widget-area-style="slide-out-from-right"]').length > 0) { 8820 OCM_materialWidth(); 8821 8822 if( $wpAdminBar.length > 0 ) { 8823 var $topToolBar = $wpAdminBar.detach(); 8824 $('.ocm-effect-wrap-inner').append($topToolBar); 8825 } 8826 8827 } 8828 8829 OCM_materialIconMarkup(); 8830 materialSkinTransition(); 8831 8832 $window.on('resize', OCM_materialSize); 8833 8834 } 8835 8836 8837 8838 8839 /** 8840 * Material theme skin transition helper 8841 * 8842 * @since 10.5 8843 */ 8844 function materialSkinTransition() { 8845 8846 if ($('body.material[data-header-search="true"]').length > 0 || 8847 $('body.material .ocm-effect-wrap').length > 0) { 8848 8849 var materialTransTO, 8850 allowMaterialResizeCalc = false, 8851 orientTrack = 0, 8852 $winDOMWidth = nectarDOMInfo.winW, 8853 $winDOMHeight = nectarDOMInfo.winH; 8854 8855 // For mobile make sure the orientation has changed. 8856 window.addEventListener("orientationchange", function () { 8857 orientTrack = 1; 8858 }); 8859 8860 // Resize. 8861 $window.on('resize', function () { 8862 8863 if( nectarDOMInfo.usingMobileBrowser ) { 8864 // Mobile. 8865 if (($window.width() != $winDOMWidth && $window.height != $winDOMHeight) || orientTrack === 1) { 8866 8867 // Store the current window dimensions. 8868 $winDOMWidth = nectarDOMInfo.winW; 8869 $winDOMHeight = nectarDOMInfo.winH; 8870 8871 // Reset orientation change tracker. 8872 orientTrack = 0; 8873 8874 // Set to allow. 8875 allowMaterialResizeCalc = true; 8876 8877 } 8878 } else { 8879 // Desktop always allows. 8880 allowMaterialResizeCalc = true; 8881 } 8882 8883 if(allowMaterialResizeCalc) { 8884 8885 clearTimeout(materialTransTO); 8886 8887 $('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') 8888 .addClass('no-material-transition'); 8889 8890 materialTransTO = setTimeout(function () { 8891 $('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') 8892 .removeClass('no-material-transition'); 8893 }, 250); 8894 8895 OCM_materialWidth(); 8896 8897 // Reset allow. 8898 allowMaterialResizeCalc = false; 8899 8900 } // endif for allow. 8901 8902 }); // end resize. 8903 8904 } 8905 8906 } 8907 8908 8909 8910 /** 8911 * Calculate off canvas menu slide out from right on hover 8912 * 8913 * @since 8.0 8914 */ 8915 function calculateHoverNavMinHeight() { 8916 8917 var $widgetHeights = 0; 8918 $('#slide-out-widget-area > .widget').each(function () { 8919 $widgetHeights += $(this).height(); 8920 }); 8921 8922 var $menuHeight; 8923 8924 if(($offCanvasEl.height() - 25 - $('.bottom-meta-wrap').outerHeight(true) - $widgetHeights) > $('#slide-out-widget-area .off-canvas-menu-container:last-child').height()) { 8925 $menuHeight = $offCanvasEl.height() - 25 - $('.bottom-meta-wrap').outerHeight(true) - $widgetHeights; 8926 } else { 8927 $menuHeight = $('#slide-out-widget-area .off-canvas-menu-container:last-child').height(); 8928 } 8929 8930 $('#slide-out-widget-area .inner').css({ 8931 'height': 'auto', 8932 'min-height': $menuHeight 8933 }); 8934 8935 $('#slide-out-widget-area > .inner .off-canvas-menu-container').transition({ 8936 y: '-' + ($('#slide-out-widget-area > .inner .off-canvas-menu-container:last-child').height() / 2) + 'px' 8937 }, 0); 8938 8939 } 8940 8941 8942 /** 8943 * Material theme skin off canvas menu width. 8944 * 8945 * @since 8.0 8946 */ 8947 function OCM_materialWidth() { 8948 8949 $('#slide-out-widget-area.slide-out-from-right').css({ 8950 'padding-top': $window.height() * 0.1, 8951 'padding-bottom': $window.height() * 0.1 8952 }); 8953 8954 OCM_overflowState(); 8955 } 8956 8957 8958 8959 /** 8960 * Material theme skin off canvas menu icon markup 8961 * 8962 * @since 8.0 8963 */ 8964 function OCM_materialIconMarkup() { 8965 8966 if ($('body.material').length >
8966 0 && $('body[data-slide-out-widget-area-style="slide-out-from-right-hover"]').length == 0 ) { 8967 8968 if ($('body[data-slide-out-widget-area-style*="fullscreen"]').length == 0 && $('#mobile-menu').length == 0) { 8969 var $menuIconClone = $('header#top nav ul .slide-out-widget-area-toggle a > span > i').clone(); 8970 $menuIconClone.addClass('hover-effect'); 8971 $('header#top nav ul .slide-out-widget-area-toggle a > span').append($menuIconClone); 8972 8973 var $menuIconClone2 = $('header#top .slide-out-widget-area-toggle.mobile-icon a > span > i').clone(); 8974 $menuIconClone2.addClass('hover-effect'); 8975 $('header#top .slide-out-widget-area-toggle.mobile-icon a > span').append($menuIconClone2); 8976 } 8977 8978 $('body:not([data-slide-out-widget-area-style="slide-out-from-right"]) header#top .slide-out-widget-area-toggle a > span') 8979 .append($('<span class="close-wrap"> <span class="close-line close-line1"></span> <span class="close-line close-line2"></span> </span>')); 8980 8981 setTimeout(function(){ 8982 $('header#top .slide-out-widget-area-toggle a > span .close-wrap').addClass('loaded'); 8983 },200); 8984 8985 } 8986 8987 if ($('body.material #boxed').length > 0 && $('body[data-slide-out-widget-area-style="slide-out-from-right-hover"]').length > 0) { 8988 $('#ajax-content-wrap > .slide-out-widget-area-toggle.slide-out-hover-icon-effect').insertAfter('.ocm-effect-wrap'); 8989 } 8990 8991 //move material skin default ocm 8992 if ($('body.material').length > 0 && $('body[data-slide-out-widget-area-style*="fullscreen"]').length == 0) { 8993 $('body.material #slide-out-widget-area.slide-out-from-right .slide_out_area_close').insertAfter('.ocm-effect-wrap'); 8994 $('#slide-out-widget-area-bg').insertAfter('.ocm-effect-wrap'); 8995 $offCanvasEl.insertAfter('.ocm-effect-wrap'); 8996 } 8997 8998 } 8999 9000 9001 9002 /** 9003 * Material theme skin off canvas menu height 9004 * 9005 * @since 8.0 9006 */ 9007 function OCM_materialSize() { 9008 if ($('.ocm-effect-wrap.material-ocm-open').length > 0) { 9009 9010 $('.ocm-effect-wrap').css({ 9011 'height': $window.height() 9012 }); 9013 9014 $('.ocm-effect-wrap-inner').css({ 9015 'padding-top': nectarDOMInfo.adminBarHeight 9016 }); 9017 9018 } 9019 } 9020 9021 9022 9023 /** 9024 * Off canvas menu dropdown markup 9025 * 9026 * @since 8.0 9027 */ 9028 function OCM_dropdownMarkup() { 9029 var $nectar_ocm_dropdown_func = ($('#slide-out-widget-area[data-dropdown-func]').length > 0) ? $offCanvasEl.attr('data-dropdown-func') : 'default'; 9030 if ($nectar_ocm_dropdown_func == 'separate-dropdown-parent-link') { 9031 $('#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>'); 9032 } 9033 } 9034 9035 9036 9037 /** 9038 * Off canvas menu dropdown icon position. 9039 * 9040 * @since 8.0 9041 */ 9042 function OCM_dropdownIconPos() { 9043 9044 $('#slide-out-widget-area[class*="slide-out-from-right"] .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 $('#slide-out-widget-area.fullscreen-split .off-canvas-menu-container li.menu-item-has-children').each(function () { 9050 $(this).find('.ocm-dropdown-arrow').css({ 9051 'top': $(this).find('a').height() / 2 9052 }); 9053 }); 9054 9055 } 9056 9057 9058 9059 9060 /** 9061 * Off canvas menu overflow scrolling. 9062 * 9063 * @since 8.0 9064 */ 9065 function OCM_overflowState() { 9066 9067 //switch position of social media/extra info based on screen size 9068 if (nectarDOMInfo.winW < 1000 || 9069 $('body > #boxed').length > 0 || 9070 $('.ocm-effect-wrap-inner > #boxed').length > 0) { 9071 9072 $('#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'); 9073 $('#slide-out-widget-area.fullscreen .bottom-text, #slide-out-widget-area.fullscreen-alt .bottom-text').appendTo('#slide-out-widget-area .inner'); 9074 9075 } else { 9076 $('#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'); 9077 $('#slide-out-widget-area.fullscreen .bottom-text, #slide-out-widget-area.fullscreen-alt .bottom-text').appendTo('#slide-out-widget-area .inner-wrap'); 9078 } 9079 9080 //add overflow 9081 if( !$offCanvasEl.hasClass('fullscreen-split') ) { 9082 9083 if ($('#slide-out-widget-area[class*="fullscreen"] .inner').height() >= $window.height() - 100) { 9084 $('#slide-out-widget-area[class*="fullscreen"] .inner, #slide-out-widget-area[class*="fullscreen"]').addClass('overflow-state'); 9085 } else { 9086 $('#slide-out-widget-area[class*="fullscreen"] .inner, #slide-out-widget-area[class*="fullscreen"]').removeClass('overflow-state'); 9087 } 9088 9089 $('#slide-out-widget-area[class*="fullscreen"] .inner').transition({ 9090 y: '-' + ($('#slide-out-widget-area[class*="fullscreen"] .inner').height() / 2) + 'px' 9091 }, 0); 9092 9093 } 9094 9095 //close mobile only slide out widget area if switching back to desktop 9096 if ($('.slide-out-from-right.open .off-canvas-menu-container.mobile-only').length > 0 && $('body.mobile').length == 0) { 9097 $('#slide-out-widget-area .slide_out_area_close').trigger('click'); 9098 } 9099 9100 //sizing for dropdown 9101 OCM_dropdownIconPos(); 9102 9103 } 9104 9105 9106 9107 /** 9108 * Off canvas menu: slide out from right hover open. 9109 * 9110 * @since 10.5 9111 */ 9112 function OCM_slideOutRightHoverOpen() { 9113 9114 calculateHoverNavMinHeight(); 9115 9116 if ( nectarDOMInfo.usingMobileBrowser && $('#slide-out-widget-area.open').length > 0 ) { 9117 OCM_mobileSlideOutRightHoverCloseCheck(); 9118 return false; 9119 } 9120 9121 if( nectarDOMInfo.usingMobileBrowser ) { 9122 $('.slide-out-widget-area-toggle a').attr('aria-expanded','true'); 9123 } 9124 9125 $offCanvasEl.css({
9126 'transform': 'translate3d(0,0,0)' 9127 }).addClass('open'); 9128 9129 // Icon effect 9130 // Set position 9131 if ($('header#top .container .span_9 > .slide-out-widget-area-toggle').length > 0) { 9132 9133 var $hIconEl = $('.slide-out-hover-icon-effect'), 9134 secondaryBarHeight = nectarDOMInfo.secondaryHeaderHeight; 9135 9136 var $nectarHamMenuPos; 9137 9138 if ($('body.mobile').length > 0) { 9139 9140 $hIconEl.css({ 9141 'top': $('header#top .span_9 > .slide-out-widget-area-toggle a').offset().top - nectarDOMInfo.scrollTop, 9142 'right': parseInt($('#header-outer header > .container').css('padding-right')) + 1 9143 }); 9144 9145 } else { 9146 9147 if ($bodyBorderHeaderColorMatch) { 9148 9149 var $extraCushion = ($('#header-outer[data-has-menu="false"]').length > 0) ? 2 : 1; 9150 $hIconEl.css({ 9151 'top': nectarDOMInfo.adminBarHeight + secondaryBarHeight + parseInt($('header#top nav >ul .slide-out-widget-area-toggle a').css('padding-top')), 9152 'right': 29 + $extraCushion 9153 });
9154 9155 } else { 9156 9157 if ($('#header-outer[data-format="centered-menu-bottom-bar"]').length > 0) { 9158 $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(); 9159 9160 $hIconEl.css({ 9161 'top': parseInt($nectarHamMenuPos.top) - nectarDOMInfo.scrollTop, 9162 'right': parseInt($('#header-outer header >.container').css('padding-right')) + 2 9163 }); 9164 } else { 9165 9166 if( $body.hasClass('ascend') ) { 9167 $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(); 9168 } else { 9169 $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(); 9170 } 9171 9172 9173 if ($('#header-secondary-outer.hide-up').length > 0) { 9174 secondaryBarHeight = 0; 9175 } 9176 9177 $hIconEl.css({ 9178 'top': nectarDOMInfo.adminBarHeight + secondaryBarHeight + parseInt($nectarHamMenuPos.top), 9179 'right': parseInt($('#header-outer header >.container').css('padding-right')) + 2 9180 }); 9181 } 9182 9183 } // No body border color match. 9184 9185 } //Not on mobile. 9186 9187 } 9188 9189 ////Open 9190 $('.slide-out-hover-icon-effect .lines-button') 9191 .removeClass('no-delay') 9192 .addClass('unhidden-line'); 9193 9194 if ($('#header-outer[data-permanent-transparent="1"]').length == 0 && 9195 $('#nectar_fullscreen_rows').length == 0 && 9196 !nectarDOMInfo.usingFrontEndEditor && 9197 nectarDOMInfo.winW > 1000) { 9198 9199 if (!(nectarDOMInfo.scrollTop == 0 && $('#header-outer.transparent').length > 0)) { 9200 9201 if ($('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) { 9202 9203 $headerOuterEl.attr('data-transparent', 'true').addClass('no-bg-color').addClass('slide-out-hover'); 9204 $('#header-outer header, #header-outer > .cart-outer').addClass('all-hidden'); 9205 } 9206 9207 } 9208 9209 if ($('#header-outer[data-remove-fixed="1"]').length == 0 && $('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) { 9210 9211 if (headerResize == true) { 9212 9213 $window.off('scroll', bigNav); 9214 $window.off('scroll', smallNav); 9215 9216 } else { 9217 $window.off('scroll', opaqueCheck); 9218 $window.off('scroll', transparentCheck); 9219 } 9220 } 9221 9222 } 9223 9224 if (!nectarDOMInfo.usingMobileBrowser) { 9225 $window.on('mousemove.rightOffsetCheck', OCM_slideOutRightHoverCloseCheck); 9226 } else { 9227 return false; 9228 } 9229 9230 } 9231 9232 9233 /** 9234 * Off canvas menu: slide out from right hover close 9235 * 9236 * @since 10.5 9237 */ 9238 function OCM_slideOutRightHoverCloseCheck(e) { 9239 9240 var $windowWidth = $window.width(); 9241 var $ocmHoverWidth = $offCanvasEl.outerWidth(); 9242 9243 if (e.clientX < $windowWidth - parseInt($ocmHoverWidth) - $bodyBorderWidth && $offCanvasEl.hasClass('mouse-accessed')) { 9244 9245 $offCanvasEl.removeClass('mouse-accessed'); 9246 $window.off('mousemove.rightOffsetCheck', OCM_slideOutRightHoverCloseCheck); 9247 9248 $offCanvasEl.css({ 9249 'transform': 'translate3d(101%,0,0)' 9250 }).removeClass('open'); 9251 9252 $headerOuterEl.removeClass('style-slide-out-from-right'); 9253 9254 $('.slide-out-hover-icon-effect .lines-button') 9255 .removeClass('unhidden-line') 9256 .addClass('no-delay'); 9257 9258 if ($('#header-outer[data-permanent-transparent="1"]').length == 0) { 9259 9260 if ($('#header-outer[data-remove-fixed="1"]').length == 0 && $('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) { 9261 9262 if ($('body.mobile').length == 0) { 9263 $headerOuterEl.removeClass('no-bg-color'); 9264 $('#header-outer header, #header-outer > .cart-outer').removeClass('all-hidden'); 9265 } 9266 } 9267 9268 if ($('#header-outer[data-remove-fixed="1"]').length == 0 && $('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) { 9269 9270 if (headerResize == true) { 9271 9272 $window.off('scroll.headerResizeEffect'); 9273 9274 if (nectarDOMInfo.scrollTop == 0) { 9275 9276 $window.on('scroll.headerResizeEffect', smallNav); 9277 9278 if ($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 && 9279 $bodyBorderTop.length > 0 && 9280 $bodyBorderHeaderColorMatch == true && 9281 $('#header-outer.pseudo-data-transparent').length > 0) { 9282 9283 $('#header-outer[data-full-width="true"] header > .container').stop(true, true).animate({ 9284 'padding': '0' 9285 }, { 9286 queue: false, 9287 duration: 250, 9288 easing: 'easeOutCubic' 9289 });
9290 9291 } 9292 } else { 9293 $window.on('scroll.headerResizeEffect', bigNav); 9294 } 9295 9296 } else { 9297 9298 $window.off('scroll.headerResizeEffectOpaque'); 9299 $window.on('scroll.headerResizeEffectOpaque', opaqueCheck); 9300 } 9301 } 9302 } 9303 } 9304 9305 } 9306 9307 9308 /** 9309 * Off canvas menu: mobile slide out from right hover close. 9310 * 9311 * @since 10.5 9312 */ 9313 function OCM_mobileSlideOutRightHoverCloseCheck() { 9314 9315 if(nectarDOMInfo.usingMobileBrowser) { 9316 $('.slide-out-widget-area-toggle a').attr('aria-expanded','false'); 9317 } 9318 9319 $offCanvasEl.css({ 9320 'transform': 'translate3d(101%,0,0)' 9321 }).removeClass('open'); 9322 9323 $headerOuterEl.removeClass('style-slide-out-from-right'); 9324 9325 $('.slide-out-hover-icon-effect .lines-button') 9326 .removeClass('unhidden-line') 9327 .addClass('no-delay'); 9328 9329 if ($('#header-outer[data-permanent-transparent="1"]').length == 0) { 9330 9331 $headerOuterEl.removeClass('no-bg-color'); 9332 $('#header-outer header').removeClass('all-hidden'); 9333 9334 } 9335 9336 9337 if ($('#header-outer[data-remove-fixed="1"]').length == 0 && $('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) { 9338 9339 if (headerResize == true) { 9340 9341 $window.off('scroll.headerResizeEffect'); 9342 9343 if (nectarDOMInfo.scrollTop == 0) { 9344 9345 $window.on('scroll.headerResizeEffect', smallNav); 9346 9347 if ($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 && 9348 $bodyBorderTop.length > 0 && 9349 $bodyBorderHeaderColorMatch == true && 9350 $('#header-outer.pseudo-data-transparent').length > 0) { 9351 9352 $('#header-outer[data-full-width="true"] header > .container').stop(true, true).animate({ 9353 'padding': '0' 9354 }, { 9355 queue: false, 9356 duration: 250, 9357 easing: 'easeOutCubic' 9358 }); 9359 9360 } 9361 } 9362 9363 else { 9364 $window.on('scroll.headerResizeEffect', bigNav); 9365 } 9366 9367 } else { 9368 9369 $window.off('scroll.headerResizeEffectOpaque'); 9370 $window.on('scroll.headerResizeEffectOpaque', opaqueCheck); 9371 9372 } 9373 9374 } 9375 9376 } 9377 9378 9379 9380 /** 9381 * Off canvas menu: slide out from right hover initialization. 9382 * 9383 * @since 10.5 9384 */ 9385 function OCM_slideOutRightHoverInit() { 9386 9387 if ($('#ajax-content-wrap > .slide-out-widget-area-toggle').length == 0) { 9388 9389 //icon effect html creation 9390 var $iconInsertLocation = ( $('.slide-out-widget-area-toggle[data-custom-color="true"]').length > 0 ) ? '#slide-out-widget-area > div' : '#slide-out-widget-area'; 9391 9392 $('<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); 9393 9394 if ($('#header-outer[data-has-menu="true"]').length > 0 || 9395 $('body[data-header-search="true"]').length > 0 || 9396 $('.slide-out-widget-area-toggle a.using-label').length > 0 || 9397 $('.slide-out-widget-area-toggle[data-custom-color="true"]').length > 0 ) { 9398 $('.slide-out-widget-area-toggle').addClass('small'); 9399 } 9400 } 9401 9402 9403 //hover triggered 9404 if (!nectarDOMInfo.usingMobileBrowser) { 9405 $body.on('mouseenter', '#header-outer .slide-out-widget-area-toggle:not(.std-menu) a', OCM_slideOutRightHoverOpen); 9406 $offCanvasEl.on('mouseenter', function () { 9407 $(this).addClass('mouse-accessed'); 9408 }); 9409 9410 } else { 9411 $body.on('click', '.slide-out-widget-area-toggle:not(.std-menu) a', OCM_slideOutRightHoverOpen); 9412 } 9413 9414 $window.on('smartresize', calculateHoverNavMinHeight); 9415 9416 9417 } 9418 9419 9420 /** 9421 * Off canvas menu: slide out from right open. 9422 * 9423 * @since 10.5 9424 */ 9425 function OCM_slideOutRightOpen() { 9426 9427 var $slideOutAmount = ($bodyBorderTop.length > 0 && $('body.mobile').length == 0) ? $bodyBorderTop.height() : 0; 9428 9429 if ($('body.material').length == 0) { 9430
9431 // Calc height if used bottom meta. 9432 $('#slide-out-widget-area .inner').css({ 9433 'height': 'auto', 9434 'min-height': $offCanvasEl.height() - 25 - $('.bottom-meta-wrap').height() 9435 }); 9436 9437 // First item dropdown? 9438 if($('#slide-out-widget-area[data-dropdown-func="separate-dropdown-parent-link"] .inner > div:first-of-type > .menu > li:first-child').length > 0 && 9439 $('#slide-out-widget-area .inner > div:first-of-type > .menu > li:first-child').hasClass('menu-item-has-children')) { 9440 $('#slide-out-widget-area .inner > div:first-of-type').css({'margin-top':'50px'}); 9441 } 9442 9443 if ($('#boxed').length == 0) { 9444 9445 $('.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({ 9446 x: '-300px' 9447 }, 700, 'easeInOutCubic'); 9448 9449 var $withinCustomBreakpoint = mobileBreakPointCheck(); 9450 9451 if ($('#header-outer[data-format="centered-logo-between-menu"]').length == 0 || $withinCustomBreakpoint) { 9452 9453 if ($('#header-outer[data-transparency-option="1"]').length == 0 || 9454 ($('#header-outer[data-transparency-option="1"]').length > 0 && $('#header-outer[data-full-width="true"]').length == 0) || 9455 $('body.mobile').length > 0) { 9456 9457 $headerOuterEl.stop(true).css('transform', 'translateY(0)').transition({ 9458 x: '-' + (300 + $slideOutAmount) + 'px' 9459 }, 700, 'easeInOutCubic'); 9460 9461 } else { 9462 9463 $headerOuterEl.stop(true).css('transform', 'translateY(0)').transition({ 9464 x: '-' + (300 + $slideOutAmount) + 'px', 9465 'background-color': 'transparent', 9466 'border-bottom': '1px solid rgba(255,255,255,0.22)' 9467 }, 700, 'easeInOutCubic'); 9468 9469 } 9470 } else { 9471 $('#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({ 9472 x: '-300px' 9473 }, 700, 'easeInOutCubic'); 9474 } 9475 9476 } 9477 9478 $offCanvasEl.stop(true).transition({ 9479 x: '-' + $slideOutAmount + 'px' 9480 }, 700, 'easeInOutCubic').addClass('open'); 9481 9482 9483 if ($('#boxed').length == 0) { 9484 9485 // Full width menu adjustments 9486 if ($('#header-outer[data-full-width="true"]').length > 0 && !$body.hasClass('mobile')) { 9487 $headerOuterEl.addClass('highzI'); 9488 $('#ascrail2000').addClass('z-index-adj'); 9489 9490 if ($('#header-outer[data-format="centered-logo-between-menu"]').length == 0) { 9491 9492 if ($bodyBorderWidth == 0) { 9493 $('header#top #logo').stop(true).transition({ 9494 x: (300 + $slideOutAmount) + 'px' 9495 }, 700, 'easeInOutCubic'); 9496 } 9497 9498 } 9499 9500 $('header#top .slide-out-widget-area-toggle .lines-button').addClass('close'); 9501 9502 $('body #header-outer nav > ul > li > a').css({ 9503 'margin-bottom': '0' 9504 }); 9505 9506 } 9507 9508 } 9509 9510 $headerOuterEl.addClass('style-slide-out-from-right'); 9511 9512 // Fade In BG Overlay 9513 $offCanvasBG.css({ 9514 'height': '100%', 9515 'width': '100%' 9516 }).stop(true).transition({ 9517 'opacity': 1 9518 }, 700, 'easeInOutCubic', function () { 9519 $('.slide-out-widget-area-toggle:not(.std-menu) > div > a').removeClass('animating'); 9520 }); 9521 9522 // Hide menu if no space 9523 if ($('#header-outer[data-format="centered-logo-between-menu"]').length == 0) { 9524 9525 var $logoWidth = ($('#logo img:visible').length > 0) ? $('#logo img:visible').width() : $('#logo').width(); 9526 9527 if ($('header#top nav > .sf-menu').offset().left - $logoWidth - 300 < 20) { 9528 $headerOuterEl.addClass('hidden-menu'); 9529 } 9530 9531 } else { 9532 $headerOuterEl.addClass('hidden-menu-items'); 9533 } 9534 9535 9536 if ($('#header-outer[data-remove-fixed="1"]').length == 0 && nectarDOMInfo.winW > 1000) { 9537 9538 if ($bodyBorderHeaderColorMatch == true && headerResize == true) { 9539 9540 $headerOuterEl.stop(true).transition({ 9541 y: '0' 9542 }, 0).addClass('transparent').css('transition', 'transform'); 9543 if ($headerOuterEl.attr('data-transparent-header') != 'true') { 9544 $headerOuterEl.attr('data-transparent-header', 'true').addClass('pseudo-data-transparent'); 9545 } 9546 9547 $window.off('scroll', bigNav); 9548 $window.off('scroll', smallNav); 9549 9550 } else if ($bodyBorderHeaderColorMatch == true) { 9551 9552 $headerOuterEl.addClass('transparent'); 9553 $window.off('scroll', opaqueCheck); 9554 $window.off('scroll', transparentCheck); 9555 9556 if ($headerOuterEl.attr('data-transparent-header') != 'true') { 9557 $headerOuterEl.attr('data-transparent-header', 'true').addClass('pseudo-data-transparent'); 9558 } 9559 } 9560 } 9561 9562 } else if ($('body.material').length > 0) { 9563 9564 // Material theme skin slide out from right 9565 9566 //move ajax loading outside 9567 if ($loadingScreenEl.length > 0 && $('.ocm-effect-wrap #ajax-loading-screen').length > 0) { 9568 $loadingScreenEl.insertBefore('.ocm-effect-wrap'); 9569 } 9570 9571 // Hide secondary header when not at top with hhun 9572 if (nectarDOMInfo.scrollTop > 40) { 9573 9574 $('body[data-hhun="1"] #header-secondary-outer').addClass('hidden'); 9575 } 9576 9577 9578 setTimeout(function () { 9579 $('.slide-out-widget-area-toggle:not(.std-menu) > div > a').removeClass('animating'); 9580 }, 300); 9581 $('#slide-out-widget-area, #slide-out-widget-area-bg, #header-outer .slide-out-widget-area-toggle').addClass('material-open'); 9582 9583 9584 // Handle bottom bar nav 9585 if ($('body:not(.mobile) #header-outer[data-format="centered-menu-bottom-bar"][data-condense="true"]').length > 0 && 9586 $('#header-outer[data-format="centered-menu-bottom-bar"] .span_9').css('display') != 'none') { 9587 9588 $('#header-outer:not(.fixed-menu)').css('top', nectarDOMInfo.adminBarHeight - nectarDOMInfo.scrollTop + 'px'); 9589 9590 if ($headerSecondaryEl.length > 0 && $('#header-outer.fixed-menu').length > 0) { 9591 $headerSecondaryEl.css('visibility', 'hidden'); 9592 } 9593 9594 } 9595 9596 $('#ajax-content-wrap').css({ 9597 'position': 'relative', 9598 'top': '-' + nectarDOMInfo.scrollTop + 'px' 9599 });
9600 9601 $('.ocm-effect-wrap-inner').css({ 9602 'padding-top': nectarDOMInfo.adminBarHeight 9603 }); 9604 9605 $('#fp-nav').addClass('material-ocm-open'); 9606 9607 $body.addClass('material-ocm-open'); 9608 $body.addClass('nectar-no-flex-height'); 9609 9610 $('.ocm-effect-wrap').css({ 9611 'height': nectarDOMInfo.winH 9612 }); 9613 9614 setTimeout(function () { 9615 $('.ocm-effect-wrap').addClass('material-ocm-open'); 9616 }, 40); 9617 9618 9619 $('body > .slide_out_area_close').addClass('follow-body'); 9620 9621 //icon effect 9622 $('#header-outer:not([data-format="left-header"]) header#top .slide-out-widget-area-toggle a').addClass('effect-shown'); 9623 9624 //handle hhun when at top 9625 $('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({ 9626 'transition': 'none', 9627 'transform': 'translateY(' + nectarDOMInfo.adminBarHeight + 'px)' 9628 }); 9629 9630 setTimeout(function () { 9631 $('body > .slide_out_area_close').addClass('material-ocm-open'); 9632 }, 350); 9633 9634 9635 } 9636 9637 } 9638 9639 9640 /** 9641 * Off canvas menu: slide out from right close. 9642 * 9643 * @since 10.5 9644 */ 9645 function OCM_slideOutRightClose() { 9646 9647 if ($('body.material').length == 0) { 9648 9649 $('.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({ 9650 x: '0px' 9651 }, 700, 'easeInOutCubic'); 9652 9653 if ($('#header-outer[data-transparency-option="1"]').length > 0 && $('#boxed').length == 0) { 9654 var $currentRowBG = ($('#header-outer[data-current-row-bg-color]').length > 0) ? $headerOuterEl.attr('data-current-row-bg-color') : $headerOuterEl.attr('data-user-set-bg'); 9655 $headerOuterEl.stop(true).transition({ 9656 x: '0px', 9657 'background-color': $currentRowBG 9658 }, 700, 'easeInOutCubic'); 9659 } else { 9660 $headerOuterEl.stop(true).transition({ 9661 x: '0px' 9662 }, 700, 'easeInOutCubic'); 9663 } 9664 9665 $offCanvasEl.stop(true).transition({ 9666 x: '301px' 9667 }, 700, 'easeInOutCubic').removeClass('open'); 9668 9669 9670 if ($('#boxed').length == 0) { 9671 if ($('#header-outer[data-full-width="true"]').length > 0) { 9672 $headerOuterEl.removeClass('highzI'); 9673 $('header#top #logo').stop(true).transition({ 9674 x: '0px' 9675 }, 700, 'easeInOutCubic'); 9676 $('.lines-button').removeClass('close'); 9677 9678 } 9679 } 9680 9681 if ($('#header-outer[data-format="centered-logo-between-menu"]').length > 0) { 9682 $('#header-outer header#top nav > ul.buttons, #header-outer .cart-outer .cart-menu-wrap').stop(true).transition({ 9683 x: '0px' 9684 }, 700, 'easeInOutCubic'); 9685 } 9686 9687 //fade out overlay 9688 $offCanvasBG.stop(true).transition({ 9689 'opacity': 0 9690 }, 700, 'easeInOutCubic', function () { 9691 9692 $('.slide-out-widget-area-toggle a').removeClass('animating'); 9693 9694 $(this).css({ 9695 'height': '1px', 9696 'width': '1px' 9697 }); 9698 9699 if ($('#header-outer[data-remove-fixed="1"]').length == 0) { 9700 9701 //hide menu if transparent, user has scrolled down and hhun is on 9702 if ($headerOuterEl.hasClass('parallax-contained') && 9703 nectarDOMInfo.scrollTop > 0 && 9704 $('#header-outer[data-permanent-transparent="1"]').length == 0) { 9705 $headerOuterEl.removeClass('parallax-contained').addClass('detached').removeClass('transparent'); 9706 } 9707 else if (nectarDOMInfo.scrollTop == 0 && $('body[data-hhun="1"]').length > 0 && $('#page-header-bg[data-parallax="1"]').length > 0 || 9708 nectarDOMInfo.scrollTop == 0 && $('body[data-hhun="1"]').length > 0 && $('.parallax_slider_outer').length > 0) { 9709 9710 if ($('#header-outer[data-transparency-option="1"]').length > 0) { 9711 $headerOuterEl.addClass('transparent'); 9712 } 9713 9714 $headerOuterEl 9715 .addClass('parallax-contained') 9716 .removeClass('detached'); 9717 9718 } 9719 9720 } 9721 9722 //fix for fixed subpage menu 9723 $('.container-wrap').css('transform', 'none'); 9724 9725 });
9726 9727 9728 $headerOuterEl.removeClass('style-slide-out-from-right'); 9729 9730 9731 if ($('#header-outer[data-remove-fixed="1"]').length == 0) { 9732 9733 if ($bodyBorderHeaderColorMatch == true && 9734 headerResize == true && 9735 nectarDOMInfo.winW > 1000) { 9736 9737 $window.off('scroll.headerResizeEffect'); 9738 if (nectarDOMInfo.scrollTop == 0) { 9739 9740 $window.on('scroll.headerResizeEffect', smallNav); 9741 9742 if ($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 && 9743 $bodyBorderTop.length > 0 && 9744 $bodyBorderHeaderColorMatch == true && 9745 $('#header-outer.pseudo-data-transparent').length > 0) { 9746 9747 $('#header-outer[data-full-width="true"] header > .container').stop(true, true).animate({ 9748 'padding': '0' 9749 }, { 9750 queue: false, 9751 duration: 250, 9752 easing: 'easeOutCubic' 9753 }); 9754 9755 } 9756 } else { 9757 $window.on('scroll.headerResizeEffect', bigNav); 9758 } 9759 9760 if ($headerOuterEl.hasClass('pseudo-data-transparent')) { 9761 9762 $headerOuterEl.attr('data-transparent-header', 'false') 9763 .removeClass('pseudo-data-transparent') 9764 .removeClass('transparent'); 9765 } 9766 9767 $headerOuterEl.css('transition', 'transform'); 9768 9769 } else if ($bodyBorderHeaderColorMatch == true && nectarDOMInfo.winW > 1000) { 9770 9771 $window.off('scroll.headerResizeEffectOpaque'); 9772 $window.on('scroll.headerResizeEffectOpaque', opaqueCheck); 9773 9774 $headerOuterEl.css('transition', 'transform'); 9775 9776 if ($headerOuterEl.hasClass('pseudo-data-transparent')) { 9777 $headerOuterEl.attr('data-transparent-header', 'false') 9778 .removeClass('pseudo-data-transparent') 9779 .removeClass('transparent'); 9780 } 9781 } 9782 } 9783 } 9784 9785 else if ($('body.material').length > 0) { 9786 9787 //material 9788 $offCanvasEl.removeClass('open'); 9789 9790 $('#slide-out-widget-area, #slide-out-widget-area-bg, #header-outer .slide-out-widget-area-toggle').removeClass('material-open'); 9791 $('.ocm-effect-wrap, .ocm-effect-wrap-shadow, body > .slide_out_area_close, #fp-nav').removeClass('material-ocm-open'); 9792 9793 $('body > .slide_out_area_close').removeClass('follow-body'); 9794 9795 setTimeout(function () { 9796 $('.slide-out-widget-area-toggle a').removeClass('animating'); 9797 9798 $body.removeClass('material-ocm-open'); 9799 $body.removeClass('nectar-no-flex-height'); 9800 9801 $('.ocm-effect-wrap').css({ 9802 'height': '100%' 9803 }); 9804 9805 $('.ocm-effect-wrap-inner').css({ 9806 'padding-top': '0' 9807 }); 9808 9809 $window.scrollTop(Math.abs(parseInt($('#ajax-content-wrap').css('top')))); 9810 9811 $('#ajax-content-wrap').css({ 9812 'position': '', 9813 'top': '' 9814 }); 9815 9816 9817 //handle bottom bar nav 9818 if ($('#header-outer[data-format="centered-menu-bottom-bar"]').length > 0 && 9819 $('#header-outer[data-format="centered-menu-bottom-bar"] .span_9').css('display') != 'none' && 9820 $('body.mobile').length == 0) { 9821 9822 $('#header-outer:not(.fixed-menu)').css('top', ''); 9823 $headerSecondaryEl.css('visibility', ''); 9824 9825 } 9826 9827 //handle hhun when at top 9828 $('body[data-hhun="1"]:not(.no-scroll) #header-outer[data-permanent-transparent="false"]:not(.detached):not(.parallax-contained):not(.at-top-before-box)').css({ 9829 'transform': '' 9830 }); 9831 setTimeout(function () { 9832 $('body[data-hhun="1"]:not(.no-scroll) #header-outer[data-permanent-transparent="false"]:not(.detached):not(.parallax-contained):not(.at-top-before-box)').css({ 9833 'transition': '' 9834 });
9835 }, 30); 9836 9837 9838 $('body[data-hhun="1"] #header-secondary-outer.hidden').removeClass('hidden'); 9839 9840 }, 900); 9841 9842 setTimeout(function () { 9843 9844 //icon effect 9845 $('#header-outer:not([data-format="left-header"]) header#top .slide-out-widget-area-toggle a') 9846 .addClass('no-trans') 9847 .removeClass('effect-shown'); 9848 9849 }, 200); 9850 9851 setTimeout(function () { 9852 //icon 9853 $('#header-outer:not([data-format="left-header"]) header#top .slide-out-widget-area-toggle a').removeClass('no-trans'); 9854 }, 500); 9855 9856 } 9857 9858 } 9859 9860 9861 9862 9863 /** 9864 * Off canvas menu: fullscreen open. 9865 * 9866 * @since 10.5 9867 */ 9868 function OCM_fullscreenOpen() { 9869 9870 if ($('body.material').length > 0) { 9871 $('header#top .slide-out-widget-area-toggle a').addClass('menu-push-out'); 9872 } 9873 9874 // Scroll away from fixed reveal footer if shown (firefox bug with bluring over it) 9875 var $scrollDelay = 0; 9876 var $scrollDelay2 = 0; 9877 9878 if (nectarDOMInfo.scrollTop + $window.height() > $('.blurred-wrap').height() && $('#nectar_fullscreen_rows').length == 0) { 9879 $('body,html').stop().animate({ 9880 scrollTop: $('.blurred-wrap').height() - $window.height() 9881 }, 600, 'easeInOutCubic'); 9882 $scrollDelay = 550; 9883 $scrollDelay2 = 200; 9884 } 9885 9886 $('header#top .slide-out-widget-area-toggle:not(.std-menu) .lines-button').addClass('close'); 9887 setTimeout(function () { 9888 $('.blurred-wrap').addClass('blurred'); 9889 }, $scrollDelay); 9890 $('#slide-out-widget-area.fullscreen').show().addClass('open'); 9891 9892 if ($('.nectar-social.fixed').length == 0) { 9893 hideToTop(); 9894 } 9895 9896 // Remove box shadow incase at the top of the page with nectar box roll above 9897 $('.container-wrap').addClass('no-shadow'); 9898 $headerOuterEl.stop(true).css('transform', 'translateY(0)'); 9899 9900 setTimeout(function () { 9901 9902 $('.off-canvas-menu-container .menu > li').each(function (i) { 9903 $(this).delay(i * 50).transition({ 9904 y: 0, 9905 'opacity': 1 9906 }, 800, 'easeOutExpo'); 9907 }); 9908 9909 $('#slide-out-widget-area.fullscreen .widget').each(function (i) { 9910 $(this).delay(i * 100).transition({ 9911 y: 0, 9912 'opacity': 1 9913 }, 800, 'easeOutExpo'); 9914 }); 9915 }, 370 + $scrollDelay2); 9916 9917 setTimeout(function () { 9918 $('#slide-out-widget-area .off-canvas-social-links').addClass('line-shown'); 9919 9920 $('#slide-out-widget-area .off-canvas-social-links li').each(function (i) { 9921 $(this).delay(i * 50).transition({ 9922 'scale': 1 9923 }, 400, 'easeOutCubic'); 9924 }); 9925 9926 $('#slide-out-widget-area .bottom-text').transition({ 9927 'opacity': 0.7 9928 }, 400, 'easeOutCubic'); 9929 }, 750 + $scrollDelay2); 9930 9931 // Fade In BG Overlay 9932 setTimeout(function () { 9933 var $easing = ($('body.mobile').length > 0) ? 'easeOutCubic' : 'easeInOutQuint'; 9934 $offCanvasBG.css({ 9935 'height': '100%', 9936 'width': '100%' 9937 }).show().stop(true).transition({ 9938 'y': '0%' 9939 }, 920, $easing, function () { 9940 $('.slide-out-widget-area-toggle > div > a').removeClass('animating'); 9941 }); 9942 }, 50 + $scrollDelay2); 9943 9944 // Overflow state 9945 OCM_overflowState(); 9946 9947 if ($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && $('.container-wrap').hasClass('no-scroll')) { 9948 $('#ajax-content-wrap').addClass('at-content'); 9949 } 9950 9951 if ($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 || $('.mobile').length == 0 && $('#header-outer.transparent').length == 0) { 9952 $('#slide-out-widget-area.fullscreen .inner-wrap').css('padding-top', $headerOuterEl.height()); 9953 } 9954 9955 } 9956 9957 9958 /** 9959 * Off canvas menu: fullscreen close. 9960 * 9961 * @since 10.5 9962 */ 9963 function OCM_fullscreenClose() { 9964 9965 if ($('body.material').length > 0) { 9966 setTimeout(function () { 9967 $('header#top .slide-out-widget-area-toggle a').removeClass('menu-push-out'); 9968 }, 350); 9969 } 9970 9971 $('.slide-out-widget-area-toggle:not(.std-menu) .lines-button').removeClass('close'); 9972 $('.blurred-wrap').removeClass('blurred'); 9973 $('#slide-out-widget-area.fullscreen').transition({ 9974 'opacity': 0 9975 }, 700, 'easeOutQuad', function () { 9976 $('#slide-out-widget-area.fullscreen').hide().css('opacity', '1'); 9977 }).removeClass('open'); 9978 $('#slide-out-widget-area.fullscreen .widget').transition({ 9979 'opacity': 0 9980 }, 700, 'easeOutQuad', function () { 9981 $(this).transition({ 9982 y: '110px' 9983 }, 0); 9984 });
9985 9986 setTimeout(function () { 9987 $('.off-canvas-menu-container .menu > li').transition({ 9988 y: '80px', 9989 'opacity': 0 9990 }, 0); 9991 $('#slide-out-widget-area .off-canvas-social-links li').transition({ 9992 'scale': 0 9993 }, 0); 9994 $('#slide-out-widget-area .off-canvas-social-links').removeClass('line-shown'); 9995 $('#slide-out-widget-area .bottom-text').transition({ 9996 'opacity': 0 9997 }, 0); 9998 9999 // Close submenu items 10000 $('#slide-out-widget-area .menuwrapper .menu').removeClass('subview'); 10001 $('#slide-out-widget-area .menuwrapper .menu li').removeClass('subview subviewopen'); 10002 $('#slide-out-widget-area.fullscreen .inner .off-canvas-menu-container').css('height', 'auto'); 10003 }, 800); 10004 10005 setTimeout(function () { 10006 if ($('.nectar-social.fixed').length == 0) { 10007 showToTop(); 10008 } 10009 $('.container-wrap').removeClass('no-shadow'); 10010 }, 500); 10011 10012 // Fade out overlay 10013 $offCanvasBG.stop(true).transition({ 10014 'opacity': 0 10015 }, 900, 'easeOutQuad', function () { 10016 10017 if ($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && $('.container-wrap').hasClass('no-scroll')) { 10018 $('#ajax-content-wrap').removeClass('at-content'); 10019 } 10020 if ($('.mobile #header-outer[data-permanent-transparent="false"]').length == 0) { 10021 $('#slide-out-widget-area.fullscreen .inner-wrap').css('padding-top', '0'); 10022 } 10023 10024 $('.slide-out-widget-area-toggle a').removeClass('animating'); 10025 10026 var $opacity = 0.4; 10027 10028 if ($offCanvasBG.hasClass('solid')) { 10029 $opacity = 1; 10030 } 10031 if ($offCanvasBG.hasClass('dark')) { 10032 $opacity = 0.93; 10033 } 10034 if ($offCanvasBG.hasClass('medium')) { 10035 $opacity = 0.6; 10036 } 10037 if ($offCanvasBG.hasClass('light')) { 10038 $opacity = 0.4; 10039 } 10040 $(this).css({ 10041 'height': '1px', 10042 'width': '1px', 10043 'opacity': $opacity 10044 }).transition({ 10045 y: '-100%' 10046 }, 0); 10047 }); 10048 10049 } 10050 10051 10052 /** 10053 * Off canvas menu: fullscreen alt open. 10054 * 10055 * @since 10.5 10056 */ 10057 function OCM_fullscreenAltOpen() { 10058 10059 var $ocm_fullscreen_class = ( $offCanvasEl.hasClass('fullscreen-alt') ) ? '.fullscreen-alt' : '.fullscreen-split'; 10060 10061 if ($('body.material').length > 0) { 10062 $('header#top .slide-out-widget-area-toggle a').addClass('menu-push-out'); 10063 } 10064 10065 $('header#top .slide-out-widget-area-toggle:not(.std-menu) .lines-button').addClass('close'); 10066 10067 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 10068 $('#slide-out-widget-area'+$ocm_fullscreen_class).show().addClass('open'); 10069 } else { 10070 $('#slide-out-widget-area'+$ocm_fullscreen_class).addClass('open').removeClass('hidden'); 10071 } 10072 10073 $offCanvasBG.addClass('open').removeClass('hidden'); 10074 10075 $('body > div[class*="body-border"]').css('z-index', '9995'); 10076 10077 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 10078 $('.off-canvas-menu-container .menu').transition({ 10079 y: '0px', 10080 'opacity': 1 10081 }, 0); 10082 } 10083 10084 if ($('.nectar-social.fixed').length == 0) { 10085 hideToTop(); 10086 } 10087 10088 if ($('#header-outer.transparent').length > 0) { 10089 10090 if ($bodyBorderTop.length > 0) { 10091 $('.admin-bar #slide-out-widget-area-bg'+$ocm_fullscreen_class).css({ 10092 'padding-top': ($bodyBorderTop.outerHeight(true) + 32) + 'px' 10093 }); 10094 $('body:not(.admin-bar) #slide-out-widget-area-bg'+$ocm_fullscreen_class).css({ 10095 'padding-top': ($bodyBorderTop.outerHeight(true)) + 'px' 10096 }); 10097 } 10098 } 10099 10100 // Set translateY to 0 in all cases 10101 $headerOuterEl.stop(true).css('transform', 'translateY(0)'); 10102 10103 if ($('#logo .starting-logo').length > 0 && 10104 $window.width() > 1000 && 10105 $('#header-outer[data-format="centered-menu-bottom-bar"].fixed-menu').length == 0 && 10106 $('body.material #header-outer[data-condense="true"]').length == 0 && 10107 !nectarDOMInfo.usingFrontEndEditor) { 10108 10109 $headerOuterEl.stop(true).css('transform', 'translateY(0)').addClass('transparent'); 10110 if ($headerOuterEl.attr('data-transparent-header') != 'true') { 10111 $headerOuterEl.attr('data-transparent-header', 'true').addClass('pseudo-data-transparent'); 10112 } 10113 10114 } 10115 10116 $('.off-canvas-menu-container .clip-wrap').css('transition-duration', '0s'); 10117 10118 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 10119 10120 setTimeout(function () { 10121 10122 $('.off-canvas-menu-container .menu > li').each(function (i) { 10123 $(this).delay(i * 50).transition({ 10124 y: 0, 10125 'opacity': 1 10126 }, 750, 'easeOutCubic').addClass('no-pointer-events'); 10127 });
10128 10129 setTimeout(function () { 10130 $('.off-canvas-menu-container .menu > li').removeClass('no-pointer-events'); 10131 $('.off-canvas-menu-container .clip-wrap').css('transition-duration', '.45s'); 10132 }, 500); 10133 10134 $('#slide-out-widget-area.fullscreen-alt .widget').each(function (i) { 10135 $(this).delay(i * 100).transition({ 10136 y: 0, 10137 'opacity': 1 10138 }, 650, 'easeOutCubic'); 10139 }); 10140 10141 }, 200); 10142 10143 setTimeout(function () { 10144 $('#slide-out-widget-area .off-canvas-social-links').addClass('line-shown'); 10145 10146 $('#slide-out-widget-area .off-canvas-social-links li').css('opacity', '1').each(function (i) { 10147 $(this).delay(i * 50).transition({ 10148 'scale': 1 10149 }, 400, 'easeOutCubic'); 10150 }); 10151 $('#slide-out-widget-area .bottom-text').transition({ 10152 'opacity': 1 10153 }, 600, 'easeOutCubic'); 10154 }, 200); 10155 10156 } 10157 10158 // Fade In BG Overlay 10159 var $opacity = 0.4; 10160 10161 if ($offCanvasBG.hasClass('solid')) { 10162 $opacity = 1; 10163 } 10164 if ($offCanvasBG.hasClass('dark')) { 10165 $opacity = 0.97; 10166 } 10167 if ($offCanvasBG.hasClass('medium')) { 10168 $opacity = 0.6; 10169 } 10170 if ($offCanvasBG.hasClass('light')) { 10171 $opacity = 0.4; 10172 } 10173 $offCanvasBG.removeClass('no-transition'); 10174 10175 10176 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 10177 10178 $offCanvasBG.addClass('padding-removed').css({ 10179 'height': '100%', 10180 'width': '100%', 10181 'left': '0', 10182 'opacity': $opacity 10183 }); 10184 10185 // Overflow state 10186 OCM_overflowState(); 10187 10188 } 10189 10190 setTimeout(function () { 10191 $('.slide-out-widget-area-toggle > div > a').removeClass('animating'); 10192 }, 600); 10193 10194 10195 if ($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && 10196 $('.container-wrap').hasClass('no-scroll')) { 10197 $('#ajax-content-wrap').addClass('at-content'); 10198 } 10199 10200 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 10201 if ($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 || 10202 $('.mobile').length == 0 && $('#header-outer.transparent').length == 0) { 10203 $('#slide-out-widget-area'+$ocm_fullscreen_class+' .inner-wrap').css('padding-top', $headerOuterEl.height()); 10204 } 10205 } else { 10206 $('#slide-out-widget-area'+$ocm_fullscreen_class+' .inner-wrap').css('padding-top', $headerOuterEl.outerHeight()); 10207 } 10208 10209 } 10210 10211 10212 /** 10213 * Off canvas menu: fullscreen alt close. 10214 * 10215 * @since 10.5 10216 */ 10217 function OCM_fullscreenAltClose() { 10218 10219 var $ocm_fullscreen_class = ( $offCanvasEl.hasClass('fullscreen-alt') ) ? '.fullscreen-alt' : '.fullscreen-split'; 10220 10221 if ($('body.material').length > 0) { 10222 setTimeout(function () { 10223 $('header#top .slide-out-widget-area-toggle a').removeClass('menu-push-out'); 10224 }, 350); 10225 } 10226 10227 $('.slide-out-widget-area-toggle:not(.std-menu) .lines-button').removeClass('close'); 10228 10229 10230 $offCanvasBG.removeClass('open'); 10231 10232 if( $ocm_fullscreen_class === '.fullscreen-split' ) { 10233 setTimeout(function () { 10234 $offCanvasBG.addClass('hidden'); 10235 $('#slide-out-widget-area'+$ocm_fullscreen_class).addClass('hidden'); 10236 },600); 10237 } 10238 10239 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 10240 10241 $('.blurred-wrap').removeClass('blurred'); 10242 10243 $('#slide-out-widget-area.fullscreen-alt .widget').transition({ 10244 'opacity': 0 10245 }, 500, 'easeOutQuad', function () { 10246 $(this).transition({ 10247 y: '40px' 10248 }, 0); 10249 }); 10250 $('#slide-out-widget-area .bottom-text, #slide-out-widget-area .off-canvas-social-links li').transition({ 10251 'opacity': 0 10252 }, 250, 'easeOutQuad'); 10253 $('#slide-out-widget-area .off-canvas-social-links').removeClass('line-shown'); 10254 10255 $('.off-canvas-menu-container .menu').transition({ 10256 y: '-13px', 10257 'opacity': 0 10258 }, 400); 10259 10260 } 10261 10262 10263 setTimeout(function () { 10264 10265 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 10266 10267 $('.off-canvas-menu-container .menu > li').stop(true, true).transition({ 10268 y: '40px', 10269 'opacity': 0 10270 }, 0); 10271 $('#slide-out-widget-area .off-canvas-social-links li').transition({ 10272 'scale': 0 10273 }, 0); 10274 $('#slide-out-widget-area .off-canvas-social-links').removeClass('line-shown'); 10275 10276 // Close submenu items 10277 $('#slide-out-widget-area .menuwrapper .menu').removeClass('subview'); 10278 $('#slide-out-widget-area .menuwrapper .menu li').removeClass('subview subviewopen'); 10279 $('#slide-out-widget-area.fullscreen-alt .inner .off-canvas-menu-container').css('height', 'auto'); 10280 10281 $offCanvasBG.css({ 10282 'height': '1px', 10283 'width': '1px', 10284 'left': '-100%' 10285 });
10286 10287 } 10288 10289 if ($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && $('.container-wrap').hasClass('no-scroll')) { 10290 $('#ajax-content-wrap').removeClass('at-content'); 10291 } 10292 10293 if ($('.mobile #header-outer[data-permanent-transparent="false"]').length == 0) { 10294 $('#slide-out-widget-area'+$ocm_fullscreen_class+' .inner-wrap').css('padding-top', '0'); 10295 } 10296 10297 $('.slide-out-widget-area-toggle a').removeClass('animating'); 10298 10299 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 10300 $('#slide-out-widget-area'+$ocm_fullscreen_class).hide().removeClass('open'); 10301 } 10302 10303 }, 550); 10304 10305 if( $ocm_fullscreen_class === '.fullscreen-split' ) { 10306 $('#slide-out-widget-area'+$ocm_fullscreen_class).removeClass('open'); 10307 } 10308 10309 setTimeout(function () { 10310 if ($('.nectar-social.fixed').length == 0) { 10311 showToTop(); 10312 } 10313 }, 600); 10314 10315 // Fade out overlay 10316 setTimeout(function () { 10317 $offCanvasBG.removeClass('padding-removed'); 10318 }, 50); 10319 10320 10321 var borderDelay = ($bodyBorderHeaderColorMatch == true) ? 150 : 50; 10322 10323 setTimeout(function () { 10324 10325 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 10326 $offCanvasBG.stop(true).css({ 10327 'opacity': 0 10328 }); 10329 } 10330 if ($('#header-outer[data-transparent-header="true"]').length > 0) { 10331 $('body > div[class*="body-border"]').css('z-index', '10000'); 10332 } 10333 }, borderDelay); 10334 10335 setTimeout(function () { 10336 $('#header-outer.transparent.small-nav, #header-outer.transparent.detached, #header-outer:not([data-permanent-transparent="1"]).transparent.scrolled-down').removeClass('transparent'); 10337 10338 if ($headerOuterEl.hasClass('pseudo-data-transparent')) { 10339 10340 $headerOuterEl.attr('data-transparent-header', 'false') 10341 .removeClass('pseudo-data-transparent') 10342 .removeClass('transparent'); 10343 } 10344 10345 }, 100); 10346 10347 } 10348 10349 10350 /** 10351 * Off canvas menu: simple dropdown open. 10352 * 10353 * @since 10.5 10354 */ 10355 function OCM_simpleDropdownOpen() { 10356 10357 $('#mobile-menu').show(); 10358 10359 $('header#top .slide-out-widget-area-toggle:not(.std-menu) .lines-button').addClass('close'); 10360 10361 if ($('body.material').length > 0) { 10362 $('header#top .slide-out-widget-area-toggle a').addClass('menu-push-out'); 10363 } 10364 10365 setTimeout(function () { 10366 $('.slide-out-widget-area-toggle > div > a').removeClass('animating'); 10367 }, 100); 10368 10369 } 10370 10371 /** 10372 * Off canvas menu: simple dropdown close.
10373 * 10374 * @since 10.5 10375 */ 10376 function OCM_simpleDropdownClose() { 10377 $('#mobile-menu').hide(); 10378 10379 $('.slide-out-widget-area-toggle:not(.std-menu) .lines-button').removeClass('close'); 10380 10381 setTimeout(function () { 10382 if ($('body.material').length > 0) { 10383 $('header#top .slide-out-widget-area-toggle a').removeClass('menu-push-out'); 10384 } 10385 $('.slide-out-widget-area-toggle a').removeClass('animating'); 10386 }, 350); 10387 } 10388 10389 10390 /** 10391 * Off canvas menu: simple dropdown click events. 10392 * 10393 * @since 10.5 10394 */ 10395 function OCM_simpleStyleInit() { 10396 10397 if( $('#header-outer #mobile-menu').length == 0 ) { 10398 return; 10399 } 10400 10401 $('#header-outer #mobile-menu li.megamenu').removeClass('megamenu'); 10402 10403 // Add icons/markup. 10404 $('#header-outer #mobile-menu ul li').each(function(){ 10405 $(this).find('a').wrapInner('<span></span>'); 10406 if($(this).find('> ul').length > 0) { 10407 $(this).find('> a').append('<span class="sf-sub-indicator"><i class="fa fa-angle-down"></i></span>'); 10408 } 10409 }); 10410 10411 // Click event. 10412 $('#header-outer #mobile-menu .sf-sub-indicator').on('click', function(){ 10413 10414 var $parentLI = $(this).parent().parent(); 10415 10416 $parentLI.toggleClass('current-open-item'); 10417 10418 // Open. 10419 if( $parentLI.hasClass('current-open-item') ) { 10420 $parentLI.find('> ul').show(); 10421 setTimeout(function(){ 10422 $parentLI.addClass('visible'); 10423 },30); 10424 } else { 10425 // Close. 10426 $parentLI.find('ul').hide(); 10427 // Ensure open children also close. 10428 $parentLI.find('li').removeClass('visible').removeClass('current-open-item'); 10429 $parentLI.removeClass('visible'); 10430 } 10431 10432 return false; 10433 10434 }); 10435 10436 // Resize event. 10437 $window.on('smartresize', function(){ 10438 10439 if( nectarDOMInfo.winW > 1000 && $('.slide-out-widget-area-toggle.mobile-icon a.open').length > 0 ) { 10440 10441 $('.slide-out-widget-area-toggle.mobile-icon a') 10442 .addClass('non-human-allowed') 10443 .trigger('click'); 10444 10445 setTimeout(function () { 10446 $('.slide-out-widget-area-toggle.mobile-icon a').removeClass('non-human-allowed'); 10447 }, 100); 10448 10449 } 10450 10451 }); 10452 10453 } 10454 10455 10456 /** 10457 * Off canvas menu click triggered styles initialization 10458 * 10459 * @since 10.5 10460 */ 10461 function OCM_clickTriggeredStylesInit() { 10462 10463 // Click triggered open bind. 10464 $body.on('click', '.slide-out-widget-area-toggle:not(.std-menu) a.closed:not(.animating), .nectar-ocm-trigger-open', function () { 10465 10466 if (nectarBoxRoll.animating == 'true' || $('.slide-out-from-right-hover').length > 0) { 10467 return false; 10468 } 10469 10470 $headerOuterEl.removeClass('no-transition'); 10471 10472 // Slide out from right. 10473 if ($offCanvasEl.hasClass('slide-out-from-right')) { 10474 OCM_slideOutRightOpen(); 10475 } 10476 // Fullscreen. 10477 else if ($offCanvasEl.hasClass('fullscreen')) { 10478 OCM_fullscreenOpen(); 10479 } 10480 // Fullscreen Alt. 10481 else if ($offCanvasEl.hasClass('fullscreen-alt') || $offCanvasEl.hasClass('fullscreen-split')) { 10482 OCM_fullscreenAltOpen(); 10483 } 10484 // Simple dropdown. 10485 else if( $('#header-outer #mobile-menu').length > 0 ) { 10486 OCM_simpleDropdownOpen(); 10487 } 10488 10489 10490 // Add open class 10491 if( $('#header-outer #mobile-menu').length == 0 ) { 10492 10493 $headerOuterEl 10494 .removeClass('side-widget-closed') 10495 .addClass('side-widget-open'); 10496 10497 10498 // Give header transparent state 10499 if ($('#header-outer[data-transparency-option="1"]').length > 0 && 10500 $('#boxed').length == 0 && 10501 $('#header-outer[data-full-width="true"]').length > 0 && 10502 !nectarDOMInfo.usingFrontEndEditor) { 10503 10504 if ($('body.material[data-slide-out-widget-area-style="slide-out-from-right"]').length == 0 && 10505 $('body.material #header-outer[data-condense="true"]').length == 0) { 10506 10507 $headerOuterEl.addClass('transparent'); 10508 10509 } 10510 10511 } 10512 10513 // Dark slide transparent nav 10514 if ($('#header-outer.dark-slide.transparent').length > 0 && 10515 $('#boxed').length == 0 && 10516 $('body.material-ocm-open').length == 0) { 10517 $headerOuterEl 10518 .removeClass('dark-slide') 10519 .addClass('temp-removed-dark-slide'); 10520 } 10521 10522 } // Not using simple OCM. 10523 10524 10525 $('.slide-out-widget-area-toggle > div > a') 10526 .removeClass('closed') 10527 .addClass('open') 10528 .attr('aria-expanded','true'); 10529 10530 $('.slide-out-widget-area-toggle > div > a').addClass('animating'); 10531 10532 return false; 10533 10534 });
10535 10536 10537 10538 // Close event bind. 10539 $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) { 10540 10541 if (e.originalEvent == undefined && 10542 $('.slide_out_area_close.non-human-allowed').length == 0 && 10543 $('.slide-out-widget-area-toggle.mobile-icon a.non-human-allowed').length == 0) { 10544 return; 10545 } 10546 10547 if ($('.slide-out-widget-area-toggle:not(.std-menu) a.animating').length > 0) { 10548 return; 10549 } 10550 10551 $headerOuterEl.removeClass('no-transition'); 10552 10553 $('.slide-out-widget-area-toggle:not(.std-menu) a') 10554 .removeClass('open') 10555 .addClass('closed') 10556 .attr('aria-expanded','false'); 10557 10558 $('.slide-out-widget-area-toggle:not(.std-menu) a') 10559 .addClass('animating'); 10560 10561 // Slide out from right. 10562 if ($offCanvasEl.hasClass('slide-out-from-right')) { 10563 OCM_slideOutRightClose(); 10564 } 10565 10566 // Fullscreen. 10567 else if ($offCanvasEl.hasClass('fullscreen')) { 10568 OCM_fullscreenClose(); 10569 } 10570 // Fullscreen alt. 10571 else if ($offCanvasEl.hasClass('fullscreen-alt') || $offCanvasEl.hasClass('fullscreen-split')) { 10572 OCM_fullscreenAltClose(); 10573 } 10574 // Simple dropdown. 10575 else if( $('#header-outer #mobile-menu').length > 0 ) { 10576 OCM_simpleDropdownClose(); 10577 } 10578 10579 if( $('#header-outer #mobile-menu').length == 0 ) { 10580 10581 // Dark slide transparent nav 10582 if ($('#header-outer.temp-removed-dark-slide.transparent').length > 0 && $('#boxed').length == 0) { 10583 $headerOuterEl 10584 .removeClass('temp-removed-dark-slide') 10585 .addClass('dark-slide'); 10586 } 10587 10588 // Remove header transparent state 10589 if ($('#header-outer[data-permanent-transparent="1"]').length == 0 && $('#slide-out-widget-area.fullscreen-alt').length == 0) { 10590 10591 if ($('.nectar-box-roll').length == 0) { 10592 if ($('#header-outer.small-nav').length > 0 || 10593 $('#header-outer.scrolled-down').length > 0) { 10594 $headerOuterEl.removeClass('transparent'); 10595 } 10596 } 10597 else { 10598 if ($('#header-outer.small-nav').length > 0 || 10599 $('#header-outer.scrolled-down').length > 0 || 10600 $('.container-wrap.auto-height').length > 0) { 10601 $headerOuterEl.removeClass('transparent'); 10602 } 10603 } 10604 10605 } 10606 10607 // Remove hidden menu 10608 $headerOuterEl.removeClass('hidden-menu'); 10609 10610 $headerOuterEl 10611 .removeClass('side-widget-open') 10612 .addClass('side-widget-closed'); 10613 10614 } // Not using simple OCM. 10615 10616 return false; 10617 10618 }); 10619 10620 } 10621 10622 10623 /** 10624 * Off canvas menu main initialization. 10625 * 10626 * @since 10.5 10627 */ 10628 function OCM_init() { 10629 10630 if ($('#slide-out-widget-area.slide-out-from-right-hover').length > 0) { 10631 OCM_slideOutRightHoverInit(); 10632 } else { 10633 OCM_clickTriggeredStylesInit(); 10634 OCM_simpleStyleInit(); 10635 } 10636 10637 10638 if ($('#slide-out-widget-area.fullscreen-split').length == 0 && 10639 $('body.material[data-slide-out-widget-area-style*="slide-out-from-right"]').length == 0 && 10640 $('#slide-out-widget-area[data-dropdown-func="separate-dropdown-parent-link"]').length == 0) { 10641 10642 fullscreenMenuInit(); 10643 10644 } else if ($('body.using-mobile-browser[data-slide-out-widget-area-style="slide-out-from-right-hover"]').length > 0) { 10645 10646 // Close OCM on mobile when clicking anchor on same page 10647 $('body #slide-out-widget-area .inner .off-canvas-menu-container li a[href]').on('click', function () { 10648 10649 if ($(this).attr('href') != '#') { 10650 OCM_close($(this).parent()); 10651 } 10652 10653 }); 10654 10655 } 10656 10657 // Page fullscreen row close OCM fullscreen 10658 if ($('#nectar_fullscreen_rows').length >
10658 0 && $('body[data-slide-out-widget-area-style*="fullscreen"]').length > 0) { 10659 10660 $('body #slide-out-widget-area .inner .off-canvas-menu-container li a[href]').on('click', function () { 10661 var $link_href = ($(this).is('[href*="#"]')) ? $(this).attr('href') : ''; 10662 if ($link_href != '#' && $('div[data-fullscreen-anchor-id="' + $link_href.substr($link_href.indexOf("#") + 1) + '"]').length > 0) { 10663 10664 setTimeout(function () { 10665 10666 $('#slide-out-widget-area .slide_out_area_close') 10667 .addClass('non-human-allowed') 10668 .trigger('click'); 10669 10670 }, 100); 10671 10672 setTimeout(function () { 10673 $('#slide-out-widget-area .slide_out_area_close').removeClass('non-human-allowed'); 10674 }, 150); 10675 10676 } 10677 10678 }); 10679 } 10680 10681 10682 // Submenu link hover fix 10683 $body.on('mouseover', '#slide-out-widget-area .off-canvas-menu-container .menuwrapper > .sub-menu li > a', function () { 10684 var $currentTxt = $(this).text(); 10685 $('.off-canvas-menu-container .menuwrapper .menu li > a').removeClass('hovered'); 10686 $('.off-canvas-menu-container .menuwrapper .menu li > a:contains(' + $currentTxt + ')').addClass('hovered'); 10687 }); 10688 10689 $body.on('mouseover', '.off-canvas-menu-container .menuwrapper .menu li > a', function () { 10690 $('.off-canvas-menu-container .menuwrapper .menu li > a').removeClass('hovered'); 10691 }); 10692 10693 10694 // Bind mousewheel. 10695 setTimeout(OCM_scrolling, 500); 10696 10697 // Handle mobile scrolling. 10698 if (nectarDOMInfo.usingMobileBrowser) { 10699 $offCanvasEl.addClass('mobile'); 10700 } 10701 10702 10703 } 10704 10705 10706 10707 10708 /** 10709 * Off canvas menu scrolling. 10710 * 10711 * @since 10.5 10712 */ 10713 function OCM_scrolling() { 10714 10715 $offCanvasEl.mousewheel(function (event, delta) { 10716 10717 this.scrollTop -= (delta * 30); 10718 10719 event.preventDefault(); 10720 }); 10721 10722 } 10723 10724 10725 10726 /** 10727 * Off canvas menu close. 10728 * 10729 * @since 10.5 10730 */ 10731 function OCM_close(item) { 10732 10733 if ($('#slide-out-widget-area.open').length > 0) { 10734 10735 var $windowCurrentLocation = window.location.href.split("#")[0]; 10736 var $windowClickedLocation = item.find('> a').attr('href').split("#")[0]; 10737 10738 if ($windowCurrentLocation == $windowClickedLocation || item.find('a[href^="#"]').length > 0) { 10739 if (item.parents('.slide-out-from-right-hover').length > 0) { 10740 $('.slide-out-widget-area-toggle.slide-out-hover-icon-effect a').trigger('click'); 10741 } else { 10742 $('.slide-out-widget-area-toggle a').trigger('click'); 10743 } 10744 10745 } 10746 } 10747 10748 } 10749 10750 10751 10752 10753 /** 10754 * Click based submenus. 10755 * 10756 * Used by left header layout and off canvas menu. 10757 * 10758 * @since 10.5 10759 */ 10760 function clickToggleSubmenus() { 10761 10762 if (!$('#header-outer[data-format="left-header"]').length > 0 && 10763 !$('body.material[data-slide-out-widget-area-style*="slide-out-from-right"]').length > 0 && 10764 !$('#slide-out-widget-area.fullscreen-split').length > 0 && 10765 !$('#slide-out-widget-area[data-dropdown-func="separate-dropdown-parent-link"]').length > 0) { 10766 return; 10767 } 10768 10769 // Remove megamenu class. 10770 $('#header-outer[data-format="left-header"] nav li.megamenu').removeClass('megamenu'); 10771 10772 var $ocm_link_selector; 10773 10774 if ($('#slide-out-widget-area[data-dropdown-func="separate-dropdown-parent-link"]').length > 0) { 10775 $ocm_link_selector = '#slide-out-widget-area .off-canvas-menu-container li.menu-item-has-children > .ocm-dropdown-arrow'; 10776 } else { 10777 $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'; 10778 } 10779 10780 // Click event. 10781 $('#header-outer[data-format="left-header"] nav li.menu-item-has-children > a, ' + $ocm_link_selector).on('click', function () { 10782 10783 if ($(this).parent().hasClass('open-submenu')) { 10784 $(this).parent().find('.sub-menu').css({ 10785 'max-height': '0' 10786 });
10787 $(this).parent().removeClass('open-submenu'); 10788 } else { 10789 10790 // Get max height. 10791 var $that = $(this); 10792 var $maxSubMenuHeight; 10793 10794 $that.parent() 10795 .find('> .sub-menu') 10796 .addClass('no-trans'); 10797 10798 setTimeout(function () { 10799 10800 $that.parent().find('> .sub-menu').css({ 10801 'max-height': 'none', 10802 'position': 'absolute', 10803 'visibility': 'hidden' 10804 }); 10805 10806 $maxSubMenuHeight = $that.parent().find('> .sub-menu').height(); 10807 10808 $that.parent() 10809 .find('> .sub-menu') 10810 .removeClass('no-trans'); 10811 10812 $that.parent().find('> .sub-menu').css({ 10813 'max-height': '0', 10814 'position': 'relative', 10815 'visibility': 'visible' 10816 }); 10817 10818 }, 25); 10819 10820 setTimeout(function () { 10821 10822 // Reset Max Height. 10823 $that.closest('ul') 10824 .find('li.menu-item-has-children') 10825 .removeClass('open-submenu'); 10826 10827 $that.closest('ul').find('li.menu-item-has-children > .sub-menu').css({ 10828 'max-height': '0' 10829 });
10830 10831 $that.parent().addClass('open-submenu'); 10832 10833 $that.parent() 10834 .find('> .sub-menu') 10835 .css('max-height', $maxSubMenuHeight); 10836 10837 // Add height to open parents. 10838 if ($that.parents('ul').length > 0) { 10839 10840 $that.parents('ul:not(.sf-menu)').each(function () { 10841 $(this).css('max-height'); 10842 $(this).css('max-height', parseInt($(this).height() + parseInt($(this).css('padding-top')) * 2 + $maxSubMenuHeight) + 'px'); 10843 }); 10844 } 10845 10846 10847 }, 50); 10848 } 10849 10850 return false; 10851 10852 }); 10853 10854 // Start open for current page items. 10855 if($('#header-outer[data-format="left-header"] nav .sf-menu > .current-menu-ancestor.menu-item-has-children > ul > li.current-menu-item').length > 0) { 10856 $('#header-outer[data-format="left-header"] nav .sf-menu > .current-menu-ancestor.menu-item-has-children > a').trigger('click'); 10857 } 10858 10859 10860 } 10861 10862 10863 10864 10865 10866 10867 10868 10869 /** 10870 * DLMenu - plugin used for submenus in off canvas menu. 10871 * 10872 * @since 6.0 10873 */ 10874 $.DLMenu = function (options, element) { 10875 this.$el = $(element); 10876 this._init(options); 10877 }; 10878 10879 // the options 10880 $.DLMenu.defaults = { 10881 // classes for the animation effects 10882 animationClasses: { 10883 classin: 'dl-animate-in-1', 10884 classout: 'dl-animate-out-1' 10885 }, 10886 onLevelClick: function () { 10887 return false; 10888 }, 10889 onLinkClick: function () { 10890 return false; 10891 } 10892 }; 10893 10894 $.DLMenu.prototype = { 10895 _init: function (options) { 10896 10897 // options 10898 this.options = $.extend(true, {}, $.DLMenu.defaults, options); 10899 this._config(); 10900 10901 var animEndEventNames = { 10902 'WebkitAnimation': 'webkitAnimationEnd', 10903 'OAnimation': 'oAnimationEnd', 10904 'msAnimation': 'MSAnimationEnd', 10905 'animation': 'animationend' 10906 }, 10907 transEndEventNames = { 10908 'WebkitTransition': 'webkitTransitionEnd', 10909 'MozTransition': 'transitionend', 10910 'OTransition': 'oTransitionEnd', 10911 'msTransition': 'MSTransitionEnd', 10912 'transition': 'transitionend' 10913 }; 10914 // animation end event name 10915 this.animEndEventName = animEndEventNames['animation'] + '.menu'; 10916 // transition end event name 10917 this.transEndEventName = transEndEventNames['transition'] + '.menu', 10918 // support for css animations and css transitions 10919 this.supportAnimations = true, 10920 this.supportTransitions = true; 10921 this._initEvents(); 10922 10923 }, 10924 _config: function () { 10925 this.open = false; 10926 this.$trigger = this.$el.children('.trigger'); 10927 this.$menu = this.$el.children('ul.menu'); 10928 this.$menuitems = this.$menu.find('li:not(.back) > a'); 10929 10930 this.$el.find('ul.sub-menu') 10931 .prepend('<li class="back"><a href="#"> ' + $offCanvasEl.attr('data-back-txt') + ' </a></li>'); 10932 10933 this.$back = this.$menu.find('li.back'); 10934 }, 10935 _initEvents: function () { 10936 10937 var self = this; 10938 10939 this.$trigger.on('click.menu', function () { 10940 10941 if (self.open) { 10942 self._closeMenu(); 10943 } else { 10944 self._openMenu(); 10945 } 10946 return false; 10947 10948 }); 10949 10950 this.$menuitems.on('click.menu', function (event) { 10951 10952 10953 var $item = $(this).parent('li'), 10954 $submenu = $item.children('ul.sub-menu'); 10955 10956 $('.fullscreen-alt .off-canvas-menu-container .clip-wrap, .fullscreen-alt .off-canvas-menu-container .clip-wrap span').css('transition-duration', '0s'); 10957 10958 if ($submenu.length > 0) { 10959 10960 var $flyin = $submenu.clone().css('opacity', 0).insertAfter(self.$menu), 10961 onAnimationEndFn = function () { 10962 self.$menu.off(self.animEndEventName).removeClass(self.options.animationClasses.classout).addClass('subview'); 10963 $item.addClass('subviewopen').parents('.subviewopen:first').removeClass('subviewopen').addClass('subview'); 10964 $flyin.remove(); 10965 setTimeout(function () { 10966 $('.off-canvas-menu-container .menu > li').removeClass('no-pointer-events'); 10967 $('.off-canvas-menu-container .clip-wrap, .off-canvas-menu-container .clip-wrap span').css('transition-duration', '.45s'); 10968 }, 300); 10969 10970 }; 10971 10972 setTimeout(function () { 10973 $flyin.addClass(self.options.animationClasses.classin); 10974 self.$menu.addClass(self.options.animationClasses.classout); 10975 if (self.supportAnimations) { 10976 self.$menu.on(self.animEndEventName, onAnimationEndFn); 10977 } else { 10978 onAnimationEndFn.call(); 10979 } 10980 10981 self.options.onLevelClick($item, $item.children('a:first').text()); 10982 });
10983 10984 10985 $item.parents('.off-canvas-menu-container').css('height', $item.parents('.off-canvas-menu-container').find('.menuwrapper .menu').height()).transition({ 10986 'height': $flyin.height() 10987 }, 500, 'easeInOutQuad'); 10988 10989 10990 return false; 10991 10992 } else { 10993 10994 self.options.onLinkClick($item.find('> a'), event); 10995 } 10996 10997 OCM_close($item); 10998 10999 }); 11000 11001 11002 11003 this.$back.on('click.menu', function () { 11004 11005 var $this = $(this), 11006 $submenu = $this.parents('ul.sub-menu:first'), 11007 $item = $submenu.parent(), 11008 $flyin = $submenu.clone().insertAfter(self.$menu); 11009 11010 var onAnimationEndFn = function () { 11011 self.$menu.off(self.animEndEventName).removeClass(self.options.animationClasses.classin); 11012 $flyin.remove(); 11013 }; 11014 11015 setTimeout(function () { 11016 $flyin.addClass(self.options.animationClasses.classout); 11017 self.$menu.addClass(self.options.animationClasses.classin); 11018 if (self.supportAnimations) { 11019 self.$menu.on(self.animEndEventName, onAnimationEndFn); 11020 } else { 11021 onAnimationEndFn.call(); 11022 } 11023 11024 $item.removeClass('subviewopen'); 11025 11026 var $subview = $this.parents('.subview:first'); 11027 if ($subview.is('li')) { 11028 $subview.addClass('subviewopen'); 11029 } 11030 $subview.removeClass('subview'); 11031 }); 11032 11033 11034 $item.parents('.off-canvas-menu-container').css('height', $item.parents('.off-canvas-menu-container').find('.menuwrapper .menu').height()); 11035 11036 setTimeout(function () { 11037 $item.parents('.off-canvas-menu-container').transition({ 11038 'height': $item.parent().height() 11039 }, 500, 'easeInOutQuad'); 11040 }, 50); 11041 11042 11043 return false; 11044 11045 }); 11046 11047 }, 11048 closeMenu: function () { 11049 if (this.open) { 11050 this._closeMenu(); 11051 } 11052 }, 11053 _closeMenu: function () { 11054 var self = this, 11055 onTransitionEndFn = function () { 11056 self.$menu.off(self.transEndEventName); 11057 self._resetMenu(); 11058 }; 11059 11060 this.$menu.removeClass('menuopen'); 11061 this.$menu.addClass('menu-toggle'); 11062 this.$trigger.removeClass('active'); 11063 11064 if (this.supportTransitions) { 11065 this.$menu.on(this.transEndEventName, onTransitionEndFn); 11066 } else { 11067 onTransitionEndFn.call(); 11068 } 11069 11070 this.open = false; 11071 }, 11072 openMenu: function () { 11073 if (!this.open) { 11074 this._openMenu(); 11075 } 11076 }, 11077 _openMenu: function () { 11078 var self = this; 11079 $body.off('click').on('click.menu', function () { 11080 self._closeMenu(); 11081 }); 11082 this.$menu.addClass('menuopen menu-toggle').on(this.transEndEventName, function () { 11083 $(this).removeClass('menu-toggle'); 11084 }); 11085 this.$trigger.addClass('active'); 11086 this.open = true; 11087 }, 11088 _resetMenu: function () { 11089 this.$menu.removeClass('subview'); 11090 this.$menuitems.removeClass('subview subviewopen'); 11091 } 11092 }; 11093 11094 var logError = function (message) { 11095 if (window.console) { 11096 window.console.error(message); 11097 } 11098 }; 11099 11100 $.fn.dlmenu = function (options) { 11101 if (typeof options === 'string') { 11102 var args = Array.prototype.slice.call(arguments, 1); 11103 this.each(function () { 11104 var instance = $.data(this, 'menu'); 11105 if (!instance) { 11106 logError("cannot call methods on menu prior to initialization; " + 11107 "attempted to call method '" + options + "'"); 11108 return; 11109 } 11110 if (!$.isFunction(instance[options]) || options.charAt(0) === "_") { 11111 logError("no such method '" + options + "' for menu instance"); 11112 return; 11113 } 11114 instance[options].apply(instance, args); 11115 }); 11116 } else { 11117 this.each(function () { 11118 var instance = $.data(this, 'menu'); 11119 if (instance) { 11120 instance._init(); 11121 } else { 11122 instance = $.data(this, 'menu', new $.DLMenu(options, this)); 11123 } 11124 });
11125 } 11126 return this; 11127 }; 11128 11129 11130 /** 11131 * Initialize DL menu. 11132 * 11133 * @since 6.0 11134 */ 11135 function fullscreenMenuInit() { 11136 11137 $('#slide-out-widget-area .off-canvas-menu-container .menu').wrap('<div class="menu-wrap menuwrapper" />'); 11138 $('#slide-out-widget-area .off-canvas-menu-container .menu').addClass('menuopen'); 11139 11140 var $ocmAnimationClassNum = ($('#slide-out-widget-area.fullscreen-alt').length > 0) ? '4' : '5'; 11141 $('#slide-out-widget-area .off-canvas-menu-container .menu-wrap').dlmenu({ 11142 animationClasses: { 11143 classin: 'dl-animate-in-' + $ocmAnimationClassNum, 11144 classout: 'dl-animate-out-' + $ocmAnimationClassNum 11145 } 11146 }); 11147 11148 } 11149 11150 11151 11152 11153 11154 11155 11156 11157 11158 /** 11159 * Set the page header height when using "slide down" theme option effect. 11160 * 11161 * @since 2.0 11162 */ 11163 function pageHeaderSlideInHeight() { 11164 11165 var pageHeaderHeight = parseInt($pageHeaderBG.height()); 11166 $('body[data-aie="slide-down"] #page-header-wrap:not(.fullscreen-header):not([data-responsive="true"])').css('height', pageHeaderHeight + 'px'); 11167 11168 } 11169 11170 11171 /** 11172 * Fired after page header image has loaded. 11173 * 11174 * @since 2.0 11175 */ 11176 function pageHeaderAfterLoad() { 11177 11178 11179 // Transparent 11180 if ($('#header-outer[data-transparent-header="true"]').length > 0) { 11181 $('#page-header-bg[data-parallax="1"]').css({ 11182 'top': nectarDOMInfo.adminBarHeight 11183 }); 11184 } else { 11185 11186 if ($('body[data-header-resize="0"]').length == 0 && $('body.material').length == 0) { 11187 $('#page-header-bg[data-parallax="1"]').css({ 11188 'top': ($('#page-header-wrap').offset().top) + 'px' 11189 }); 11190 } 11191 } 11192 11193 //fade in header 11194 if ($('#ajax-content-wrap').length == 0 || !$body.hasClass('ajax-loaded')) { 11195 $('#page-header-bg[data-parallax="1"]').animate({ 11196 'opacity': 1 11197 }, 350, 'easeInCubic'); 11198 } else if ($('#ajax-content-wrap').length == 1) { 11199 $('#page-header-bg[data-parallax="1"]').css({ 11200 'opacity': 1 11201 }); 11202 } 11203 11204 $('#page-header-bg[data-parallax="1"] .nectar-particles').append('<div class="fade-out" />'); 11205 11206 } 11207 11208 11209 11210 /** 11211 * Page header unload event. 11212 * 11213 * @since 2.0 11214 */ 11215 function pageHeaderUnload() { 11216 11217 if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1 || navigator.userAgent.match(/(iPod|iPhone|iPad)/)) { 11218 window.onunload = function () { 11219 11220 pageHeaderInit(); 11221 11222 $('#page-header-bg[data-parallax="1"] .span_6').css({ 11223 'opacity': 1 11224 }); 11225 11226 }; 11227 } 11228 11229 } 11230 11231 11232 /** 11233 * Page header initialization. 11234 * 11235 * @since 2.0 11236 */ 11237 function pageHeaderInit() { 11238 11239 var $headerRemoveStickyness = ($('body[data-hhun="1"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length > 0) ? 1 : 0; 11240 11241 if ($('#page-header-bg[data-parallax="1"]').length > 0) { 11242 11243 // Fade in 11244 var img = new Image(), 11245 pageHeaderHeight = parseInt($pageHeaderBG.height()), 11246 $initialImgCheck = extractUrl($('#page-header-bg[data-parallax="1"]').css('background-image')); 11247 11248 if ($initialImgCheck && $initialImgCheck.indexOf('.') !== -1) { 11249 img.onload = function () { 11250 pageHeaderAfterLoad(); 11251 }; 11252 11253 img.src = extractUrl($('#page-header-bg[data-parallax="1"]').css('background-image')); 11254 11255 } else { 11256 pageHeaderAfterLoad(); 11257 } 11258 11259 11260 if ($('body[data-hhun="1"]').length > 0 && !$('#header-outer[data-remove-fixed="1"]').length > 0) { 11261 $headerOuterEl.addClass('parallax-contained'); 11262 } 11263 11264 // Calculate on scroll. 11265 window.addEventListener('scroll', function () { 11266 if( nectarDOMInfo.winW > 1000 ) { 11267 window.requestAnimationFrame(parallaxPageHeaderCalc); 11268 } 11269 }, false); 11270 11271 } 11272 11273 var $pt_timeout = ($('body[data-ajax-transitions="true"]').length > 0 && $('#page-header-bg[data-animate-in-effect="slide-down"]').length > 0) ? 350 : 0; 11274 11275 if ($pageHeaderBG.length > 0) { 11276 11277 // Slide in height effect. 11278 setTimeout(function () { 11279 pageHeaderSlideInHeight(); 11280 }, $pt_timeout); 11281 11282 $('#page-header-bg[data-animate-in-effect="fade-in"]').addClass('loaded'); 11283 11284 // Using bg classname. 11285 var $initialImgCheckAscend = extractUrl($pageHeaderBG.css('background-image'));
11286 if ($initialImgCheckAscend && $initialImgCheckAscend.indexOf('.') !== -1) { 11287 $pageHeaderBG.addClass('has-bg'); 11288 } 11289 11290 // Resize slide in height. 11291 $window.on('smartresize',pageHeaderSlideInHeight); 11292 11293 } 11294 11295 function parallaxPageHeaderCalc() { 11296 11297 var $scrollTop = nectarDOMInfo.scrollTop, 11298 $multiplier1 = 0.4, 11299 $multiplier2 = 0.09; 11300 11301 if (!$body.hasClass('mobile') && 11302 navigator.userAgent.match(/iPad/i) == null && 11303 $('body.material-ocm-open').length == 0) { 11304 11305 if( headerLayoutFormat != 'left-header' ) { 11306 11307 if (nectarDOMInfo.winW > 1000) { 11308 $('#page-header-bg').css('top', $('#ajax-content-wrap').offset().top); 11309 } else { 11310 $('#page-header-bg').css('top', '0'); 11311 } 11312 } 11313 11314 // Calc bg pos. 11315 if ($('#page-header-bg.out-of-sight').length == 0) { 11316 11317 if ($headerRemoveStickyness) { 11318 $pageHeaderBG.css({ 11319 'transform': 'translateY(' + $scrollTop * -0.55 + 'px)' 11320 }); 11321 $('#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({ 11322 'transform': 'translateY(' + $scrollTop * -0.45 + 'px)' 11323 }); 11324 11325 } else { 11326 $pageHeaderBG.css({ 11327 'transform': 'translateY(' + $scrollTop * -$multiplier1 + 'px)' 11328 }); 11329 $('#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({ 11330 'transform': 'translateY(' + $scrollTop * -$multiplier2 + 'px)' 11331 }); 11332 $('#page-header-bg .span_6 .inner-wrap, #page-header-bg[data-post-hs="default_minimal"] .author-section').css({ 11333 'opacity': 1 - ($scrollTop / (pageHeaderHeight - 60)) 11334 }); 11335 } 11336 11337 11338 if ($('#page-header-bg .span_6 .inner-wrap').css('opacity') == 0) { 11339 $('#page-header-bg .span_6 .inner-wrap, #page-header-bg .portfolio-filters').hide(); 11340 } else { 11341 $('#page-header-bg .span_6 .inner-wrap, #page-header-bg .portfolio-filters').show(); 11342 } 11343 11344 11345 } 11346 11347 // Hide elements to allow other parallax sections to work in webkit browsers. 11348 if (($scrollTop / (pageHeaderHeight + $('#header-space').height() + nectarDOMInfo.adminBarHeight)) > 1) { 11349 $('#page-header-bg, .nectar-particles, #page-header-bg .fade-out').css('visibility', 'hidden').hide().addClass('out-of-sight'); 11350 } 11351 else { 11352 $('#page-header-bg, .nectar-particles, #page-header-bg .fade-out').css('visibility', 'visible').show().removeClass('out-of-sight'); 11353 11354 // Ensure header is centered. 11355 pageHeaderHeight = parseInt($pageHeaderBG.height()); 11356 $('#page-header-bg .container > .row').css('top', 0); 11357 11358 } 11359 11360 } 11361 11362 } 11363 11364 if ($pageHeaderBG.length > 0) { 11365 11366 // Bind unload event 11367 pageHeaderUnload(); 11368 11369 // Initialize text effects. 11370 if( $('.nectar-box-roll').length == 0 ) { 11371 pageHeaderTextEffectInit(); 11372 } 11373 11374 } 11375 11376 } 11377 11378 11379 11380 11381 11382 11383 11384 /** 11385 * Page header text effect markup creation. 11386 * 11387 * @since 6.0 11388 */ 11389 function pageHeaderTextEffectMarkup() { 11390 11391 $pageHeaderBG.each(function () { 11392 11393 if ($(this).attr('data-text-effect') == 'rotate_in') { 11394 11395 var $topHeading = 'none'; 11396 11397 if ($(this).find('.span_6 h1').length > 0) { 11398 $topHeading = 'h1'; 11399 } 11400 11401 if ($topHeading != 'none') { 11402 11403 var $selector = ($(this).find('.nectar-particles').length > 0) ? '.inner-wrap.shape-1' : '.span_6'; 11404 11405 $(this).find($selector).find($topHeading).addClass('top-heading').contents().filter(function () { 11406 return this.nodeType === 3 && typeof this.data != 'undefined' && this.data.replace(/\s+/, ""); 11407 }).wrap('<span class="wraped"></span>'); 11408 11409 $(this).find($selector).find('.wraped').each(function () { 11410 11411 var textNode = $(this), 11412 text = textNode.text().split(' '), 11413 replace = ''; 11414 11415 $.each(text, function (index, value) { 11416 if (value.replace(/\s+/, "")) { 11417 replace += '<span class="wraped"><span>' + value + '</span></span> '; 11418 } 11419 });
11420 11421 textNode.replaceWith($(replace)); 11422 11423 }); 11424 11425 } 11426 11427 } 11428 11429 }); 11430 11431 } 11432 11433 11434 /** 11435 * Page header text effect animation. 11436 * 11437 * @since 6.0 11438 */ 11439 function pageHeaderTextEffect() { 11440 11441 if ($('#page-header-bg .nectar-particles').length == 0 && $('#page-header-bg[data-text-effect="none"]').length == 0 || 11442 $('.nectar-box-roll').length > 0 && $('#page-header-bg .nectar-particles').length == 0) { 11443 11444 var $selector = ($('.nectar-box-roll').length == 0) ? '#page-header-bg .span_6' : '.nectar-box-roll .overlaid-content .span_6'; 11445 11446 $($selector).find('.wraped').each(function (i) { 11447 $(this).find('span').delay(i * 370).transition({ 11448 rotateX: '0', 11449 'opacity': 1, 11450 y: 0 11451 }, 400, 'easeOutQuad'); 11452 }); 11453 11454 setTimeout(function () { 11455 11456 $($selector).find('.inner-wrap > *:not(.top-heading)').each(function (i) { 11457 $(this).delay(i * 370).transition({ 11458 rotateX: '0', 11459 'opacity': 1, 11460 y: 0 11461 }, 650, 'easeOutQuad'); 11462 }); 11463 11464 $('.scroll-down-wrap, .scroll-down-wrap .section-down-arrow').removeClass('hidden'); 11465 11466 }, $($selector).find('.wraped').length * 370); 11467 } 11468 11469 } 11470 11471 11472 /** 11473 * Page header text effect initialization. 11474 * 11475 * @since 6.0 11476 */ 11477 function pageHeaderTextEffectInit() { 11478 11479 pageHeaderTextEffectMarkup(); 11480 11481 var $effectTimeout = ($loadingScreenEl.length > 0) ? 800 : 0; 11482 11483 if ($('#page-header-bg .nectar-video-wrap video').length == 0) { 11484 setTimeout(pageHeaderTextEffect, $effectTimeout); 11485 } 11486 11487 } 11488 11489 11490 11491 11492 11493 11494 11495 /** 11496 * Permanent transparent header effect. 11497 * 11498 * @since 6.0 11499 */ 11500 function midnightInit() { 11501 11502 if ($('#header-outer[data-permanent-transparent="1"]').length > 0 && 11503 $('body[data-bg-header="true"]').length > 0) { 11504 11505 11506 // Pages that set no midnight coloring. 11507 if ($('.container-wrap div[data-midnight]').length == 0) { 11508 $('.container-wrap').attr('data-midnight', 'dark'); 11509 } 11510 11511 //// Cache midnight compat divs. 11512 var $midnightCompatArr = []; 11513 $('div[data-midnight]').each(function () { 11514 11515 if ($(this).attr('data-midnight') == 'light' && $(this).parents('.pum-content').length == 0 || 11516 $(this).attr('data-midnight') == 'dark' && $(this).parents('.pum-content').length == 0) { 11517 11518 if( $(this).is('#page-header-bg') && $(this).parents('#page-header-wrap[data-midnight]').length > 0 ) { 11519 // skip. 11520 } else { 11521 $midnightCompatArr.push($(this)); 11522 } 11523 11524 } 11525 11526 }); 11527 11528 11529 if ($midnightCompatArr.length > 0) { 11530 11531 $.each($midnightCompatArr, function (k, v) { 11532 11533 if (v.attr('data-midnight') == 'light' || v.attr('data-midnight') == 'dark') { 11534 11535 var $that = v; 11536 var waypoint = new Waypoint({ 11537 element: $that, 11538 handler: function (direction) { 11539 11540 11541 if ($('body.material-ocm-open').length > 0 || $that.css('display') == 'none' ) { 11542 return; 11543 } 11544 11545 11546 var $textColor; 11547 11548 if (direction == 'down') { 11549 $textColor = ($that.attr('data-midnight') == 'light') ? '' : 'dark-slide'; 11550 $headerOuterEl.removeClass('dark-slide').addClass($textColor); 11551 11552 } else { 11553 11554 var $prevMidItem; 11555 11556 if (k - 1 >= 0) { 11557 $prevMidItem = k - 1; 11558 } else { 11559 $prevMidItem = k; 11560 } 11561 11562 $textColor = ($midnightCompatArr[$prevMidItem].attr('data-midnight') == 'light') ? '' : 'dark-slide'; 11563 $headerOuterEl.removeClass('dark-slide').addClass($textColor); 11564 11565 } 11566 11567 }, 11568 offset: $headerOuterEl.height() 11569 11570 });
11571 11572 } 11573 11574 }); 11575 11576 } 11577 11578 } 11579 11580 11581 } 11582 11583 11584 11585 11586 /** 11587 * Box roll header effect initialization. 11588 * 11589 * @since 6.0 11590 */ 11591 function nectarBoxRollInit() { 11592 if ($('.nectar-box-roll').length > 0 && typeof NectarBoxRoll !== 'undefined') { 11593 pageHeaderTextEffectInit(); 11594 nectarBoxRoll = new NectarBoxRoll(nectarDOMInfo, waypoints, midnightInit, pageLoadHash, resizeVideoToCover); 11595 } 11596 } 11597 11598 11599 11600 11601 /** 11602 * Create all waypoints. 11603 * 11604 * @since 6.0 11605 */ 11606 function waypoints() { 11607 rowBGAnimations(); 11608 columnBGAnimations(); 11609 colAndImgAnimations(); 11610 progressBars(); 11611 dividers(); 11612 iconList(); 11613 animatedTitles(); 11614 highlightedText(); 11615 imageWithHotspots(); 11616 clientsFadeIn(); 11617 splitLineHeadings(); 11618 svgAnimations(); 11619 milestoneInit(); 11620 nectarFancyUlInit(); 11621 owl_carousel_animate(); 11622 headerRowColorInheritInit(); 11623 morphingOutlines(); 11624 animatedColBorders(); 11625 foodMenuItems(); 11626 vcWaypoints(); 11627 NectarPostGridWaypoint(); 11628 } 11629 11630 11631 11632 /** 11633 * Salient page builder elements initialization. 11634 * 11635 * @since 10.5 11636 */ 11637 function salientPageBuilderElInit() { 11638 flexsliderInit(); 11639 flickityLazyInit(); 11640 setTimeout(flickityInit, 100); 11641 twentytwentyInit(); 11642 standardCarouselInit(); 11643 productCarouselInit(); 11644 clientsCarouselInit(); 11645 carouselfGrabbingClass(); 11646 setTimeout(tabbedInit, 60); 11647 accordionInit(); 11648 accordionClickEvents(); 11649 largeIconHover(); 11650 nectarIconMatchColoring(); 11651 coloredButtons(); 11652 ctaLinkBG(); 11653 teamMemberFullscreen(); 11654 flipBoxInit(); 11655 owlCarouselInit(); 11656 mouseParallaxInit(); 11657 ulCheckmarks(); 11658 nectarFancyUlIcons(); 11659 nectarFancyBoxHover(); 11660 nectarVideoLightbox(); 11661 nectarKeyframeAssist(); 11662 morphingOutlinesInit(); 11663 nectarPostGridInit(); 11664 cascadingImageInit(); 11665 imageWithHotspotEvents(); 11666 pricingTableHeight(); 11667 pageSubmenuInit(); 11668 nectarLiquidBGs(); 11669 nectarTestimonialSliders(); 11670 nectarTestimonialSlidersEvents(); 11671 recentPostsTitleOnlyEqualHeight(); 11672 recentPostsInit(); 11673 parallaxItemHoverEffect(); 11674 fsProjectSliderInit(); 11675 postMouseEvents(); 11676 masonryPortfolioInit(); 11677 masonryBlogInit(); 11678 portfolioCustomColoring(); 11679 searchResultMasonryInit(); 11680 stickySidebarInit(); 11681 portfolioSidebarFollow(); 11682 splitLineHeadingInit(); 11683 } 11684 11685 11686 11687 11688 /***************** WooCommerce *****************/ 11689 11690 11691 /** 11692 * Add quantity buttons to WooCommerce pages 11693 * 11694 * @since 10.5 11695 */ 11696 function wooQauntityBtns() { 11697 11698 jQuery(document.body).on('updated_cart_totals', function () { 11699 11700 if ($('.plus').length == 0) { 11701 $('div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)') 11702 .addClass('buttons_added') 11703 .append('<input type="button" value="+" class="plus" />') 11704 .prepend('<input type="button" value="-" class="minus" />'); 11705 } 11706 }); 11707 11708 11709 // Quantity buttons 11710 if ($('.plus').length == 0) { 11711 11712 $('div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)') 11713 .addClass('buttons_added') 11714 .append('<input type="button" value="+" class="plus" />') 11715 .prepend('<input type="button" value="-" class="minus" />'); 11716 11717 $(document).on('click', '.plus, .minus', function () { 11718 11719 // Get values 11720 var $qty = $(this).closest('.quantity').find('.qty'), 11721 currentVal = parseFloat($qty.val()), 11722 max = parseFloat($qty.attr('max')), 11723 min = parseFloat($qty.attr('min')), 11724 step = $qty.attr('step'); 11725 11726 // Format values 11727 if (!currentVal || currentVal === '' || currentVal === 'NaN') { 11728 currentVal = 0; 11729 } 11730 if (max === '' || max === 'NaN') { 11731 max = ''; 11732 } 11733 if (min === '' || min === 'NaN') { 11734 min = 0; 11735 } 11736 if (step === 'any' || step === '' || step === undefined || parseFloat(step) === 'NaN') { 11737 step = 1; 11738 } 11739 11740 // Change the value 11741 if ($(this).is('.plus')) { 11742 11743 if (max && (max == currentVal || currentVal > max)) { 11744 $qty.val(max); 11745 } else { 11746 $qty.val(currentVal + parseFloat(step)); 11747 } 11748 11749 } else { 11750 11751 if (min && (min == currentVal || currentVal < min)) { 11752 $qty.val(min); 11753 } else if (currentVal > 0) { 11754 $qty.val(currentVal - parseFloat(step)); 11755 } 11756 11757 } 11758 11759 // Trigger change event 11760 $qty.trigger('change'); 11761 11762 });
11763 } 11764 11765 } 11766 11767 11768 11769 /** 11770 * WooCommerce plugin events. 11771 * 11772 * @since 10.5 11773 */ 11774 function wooCommerceEvents() { 11775 11776 var wooCartTimeout; 11777 11778 // Notification. 11779 $body.on('click', '.product .add_to_cart_button', function () { 11780 11781 var $productHeading = ($(this).parents('li').find('h2').length > 0) ? 'h2' : 'h3', 11782 productToAdd = $(this).parents('li').find($productHeading).text(); 11783 11784 $('#header-outer .cart-notification span.item-name').html(productToAdd); 11785 11786 }); 11787 11788 // Notification hover. 11789 $body.on('mouseenter', '#header-outer .cart-notification', function () { 11790 11791 $(this).hide(); 11792 11793 $('#header-outer .widget_shopping_cart') 11794 .addClass('open') 11795 .stop(true, true) 11796 .show(); 11797 11798 $('#header-outer .cart_list') 11799 .stop(true, true) 11800 .show(); 11801 11802 clearTimeout(wooCartTimeout); 11803 11804 }); 11805 11806 11807 // Cart dropdown. 11808 var $headerCartSelector = '#header-outer .nectar-woo-cart'; 11809 11810 if ($($headerCartSelector).length > 0) { 11811 11812 $($headerCartSelector).hoverIntent(function () { 11813 11814 $('#header-outer .widget_shopping_cart') 11815 .addClass('open') 11816 .stop(true, true) 11817 .show(); 11818 11819 $('#header-outer .cart_list') 11820 .stop(true, true) 11821 .show(); 11822 11823 clearTimeout(wooCartTimeout); 11824 11825 $('#header-outer .cart-notification').hide(); 11826 11827 }); 11828 } 11829 11830 11831 $body.on('mouseleave', $headerCartSelector, function () { 11832 var $that = $(this); 11833 setTimeout(function () { 11834 if (!$that.is(':hover')) { 11835 $('#header-outer .widget_shopping_cart') 11836 .removeClass('open') 11837 .stop(true, true) 11838 .fadeOut(300); 11839 11840 $('#header-outer .cart_list') 11841 .stop(true, true) 11842 .fadeOut(300); 11843 } 11844 }, 200); 11845 }); 11846 11847 if ($('#header-outer[data-cart="false"]').length == 0) { 11848 11849 $body.on('added_to_cart', shopping_cart_dropdown_show); 11850 $body.on('added_to_cart', shopping_cart_dropdown); 11851 11852 // Update header cart markup after ajax remove. 11853 $body.on('removed_from_cart', wooCartImgPos); 11854 } 11855 11856 function shopping_cart_dropdown() { 11857 11858 if (!$('.widget_shopping_cart .widget_shopping_cart_content .cart_list .empty').length && 11859 $('.widget_shopping_cart .widget_shopping_cart_content .cart_list').length > 0) { 11860 11861 $('.cart-menu-wrap').addClass('has_products'); 11862 $('header#top nav > ul, #search-outer #search #close a, header#top .span_9 >.slide-out-widget-area-toggle').addClass('product_added'); 11863 11864 if (!$('.cart-menu-wrap').hasClass('static')) { 11865 $('.cart-menu-wrap, #mobile-cart-link').addClass('first-load'); 11866 } 11867 11868 // Change position of img in cart nav dropdown. 11869 wooCartImgPos(); 11870 11871 } 11872 11873 } 11874 11875 11876 function shopping_cart_dropdown_show(e) { 11877 11878 clearTimeout(wooCartTimeout); 11879 11880 if (!$('.widget_shopping_cart .widget_shopping_cart_content .cart_list .empty').length && 11881 $('.widget_shopping_cart .widget_shopping_cart_content .cart_list').length > 0 && 11882 typeof e.type != 'undefined') { 11883 11884 // Standalone woocommerce add to cart buttons. 11885 if ($('#header-outer .cart-notification .item-name').length > 0 && 11886 $('#header-outer .cart-notification .item-name').text().length == 0) { 11887 return; 11888 } 11889 11890 // Before cart has slide in. 11891 if (!$('#header-outer .cart-menu-wrap').hasClass('has_products')) { 11892 11893 setTimeout(function () { 11894 $('#header-outer .cart-notification').fadeIn(400); 11895 }, 400); 11896 11897 } else if (!$('#header-outer .cart-notification').is(':visible')) { 11898 $('#header-outer .cart-notification').fadeIn(400); 11899 } else { 11900 $('#header-outer .cart-notification').show(); 11901 } 11902 wooCartTimeout = setTimeout(hideCart, 2700); 11903 11904 } 11905 } 11906 11907 function hideCart() { 11908 $('#header-outer .cart-notification').stop(true, true).fadeOut(); 11909 } 11910 11911 function checkForWooItems() { 11912 11913 var checkForCartItems = setInterval(shopping_cart_dropdown, 250); 11914 setTimeout(function () { 11915 clearInterval(checkForCartItems); 11916 }, 4500); 11917 11918 } 11919 11920 function wooCartImgPos() { 11921 $('#header-outer .widget_shopping_cart .cart_list li, #slide-out-widget-area .widget_shopping_cart .cart_list li').each(function () { 11922 11923 if ($(this).find('> img').length == 0 && $(this).find('.product-meta').length == 0) { 11924 11925 var productCartImgLinkSrc = ($(this).find('> a[href]:not(.remove)').length > 0) ? $(this).find('> a[href]:not(.remove)').attr('href') : ''; 11926 var productCartImg = $(this).find('> a > img').clone(); 11927 11928 $(this).wrapInner('<div class="product-meta" />'); 11929 $(this).prepend(productCartImg); 11930 11931 if (productCartImgLinkSrc.length > 0) { 11932 productCartImg.wrap('<a href="' + productCartImgLinkSrc + '"></a>'); 11933 } 11934 11935 } 11936 11937 });
11938 } 11939 11940 if ($('#header-outer[data-cart="false"]').length == 0) { 11941 checkForWooItems(); 11942 } 11943 11944 function nectarAccountPageTabs() { 11945 11946 // Not on account page. 11947 if ($('body.woocommerce-account #customer_login').length == 0) { 11948 return; 11949 } 11950 11951 // Create HTML. 11952 $('.woocommerce-account .woocommerce > #customer_login').prepend('<div class="nectar-form-controls" />'); 11953 11954 $('.woocommerce-account .woocommerce > #customer_login > div:not(.nectar-form-controls)').each(function () { 11955 var $title = $(this).find('> h2').text(); 11956 $('#customer_login .nectar-form-controls').append('<div class="control">' + $title + '</div>'); 11957 }); 11958 11959 // Click event. 11960 $('.woocommerce-account .woocommerce > #customer_login .nectar-form-controls .control').on('click', function () { 11961 11962 $('.woocommerce-account .woocommerce > #customer_login .nectar-form-controls .control').removeClass('active'); 11963 $(this).addClass('active'); 11964 11965 var formIndex = $(this).index() + 1; 11966 $('#customer_login div[class*="u-column"]').hide(); 11967 $('#customer_login div[class*="u-column"].col-' + formIndex).show(); 11968 11969 setTimeout(function () { 11970 $('#customer_login div[class*="u-column"]').removeClass('visible'); 11971 $('#customer_login div[class*="u-column"].col-' + formIndex).addClass('visible'); 11972 }, 30); 11973 11974 }); 11975 11976 // Starting. 11977 $('.woocommerce-account .woocommerce > #customer_login .nectar-form-controls .control:nth-child(1)').trigger('click'); 11978 11979 } 11980 11981 nectarAccountPageTabs(); 11982 11983 // Text on hover effect. 11984 $body.on('mouseover', '.text_on_hover .product-wrap, .text_on_hover > a:first-child', function () { 11985 $(this).parent().addClass('hovered'); 11986 }); 11987 11988 $body.on('mouseout', '.text_on_hover .product-wrap, .text_on_hover > a:first-child', function () { 11989 $(this).parent().removeClass('hovered'); 11990 }); 11991 11992 11993 // Material/fancy parallax hover effect zindex. 11994 if ($('.material.product').length > 0 || 11995 $('.minimal.product').length > 0 || 11996 $('.nectar-fancy-box[data-style="parallax_hover"]').length > 0 || 11997 $('.nectar-category-grid[data-shadow-hover="yes"]').length > 0 || 11998 $('.nectar-post-grid[data-shadow-hover="yes"]').length > 0) { 11999 12000 var $productZindex = 101; 12001 12002 $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 () { 12003 $productZindex++; 12004 $(this).css('z-index', $productZindex + 1); 12005 }); 12006 12007 $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 () { 12008 12009 var $that = $(this); 12010 setTimeout(function () { 12011 if (!$that.is(':hover')) { 12012 $that.css('z-index', 100); 12013 } 12014 }, 350); 12015 }); 12016 12017 // Reset to stop zindex from getting too high. 12018 setInterval(function () { 12019 if ($('.nectar-fancy-box[data-style="parallax_hover"]:hover').length > 0 || 12020 $('.minimal.product:hover').length > 0) { 12021 return; 12022 } 12023 12024 $('.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); 12025 $productZindex = 101; 12026 }, 10000); 12027 12028 } 12029 12030 function minimalProductHover() { 12031 12032 // Add icons. 12033 $('.products .classic .product-wrap .add_to_cart_button').wrapInner('<span />'); 12034 $('.products .classic .product-wrap .add_to_cart_button').prepend('<i class="normal icon-salient-cart"></i>'); 12035 12036 // Bind hover. 12037 $body.on('mouseover', '.products .minimal.product', function () { 12038 minimalProductCalc($(this)); 12039 });
12040 12041 $body.on('mouseleave', '.products .minimal.product', function () { 12042 12043 $(this).find('.background-color-expand').css({ 12044 'transform': 'scale(1)' 12045 }); 12046 12047 }); 12048 12049 // Starting trigger mouse over. 12050 $('.products .minimal.product').each(function () { 12051 if ($(this).is(':hover')) { 12052 $(this).trigger('mouseover'); 12053 } 12054 }); 12055 } 12056 12057 function minimalProductCalc(el) { 12058 12059 var $item = el, 12060 $itemWidth = $item.width(), 12061 $itemHeight = $item.height(), 12062 $wChange = (parseInt($itemWidth) + 40) / parseInt($itemWidth), 12063 $hChange = (parseInt($itemHeight) + 40) / parseInt($itemHeight); 12064 12065 $item.addClass('hover-bound'); 12066 12067 $item.find('.background-color-expand').css({ 12068 'transform': 'scale(' + $wChange + ',' + $hChange + ') translateY(0px)' 12069 }); 12070 12071 } 12072 12073 minimalProductHover(); 12074 12075 12076 12077 // Mobile widget filters. 12078 $('.woocommerce #sidebar .widget.woocommerce').each(function () { 12079 12080 // Skip widgets without any titles. 12081 if ($(this).find('> h4').length == 0) { 12082 $(this).addClass('no-widget-title'); 12083 } 12084 }); 12085 12086 $body.on('click', '#sidebar .widget.woocommerce:not(.widget_price_filter) h4', function () { 12087 12088 if ($window.width() < 1000) { 12089 12090 if ($(this).parent().is('.widget_product_tag_cloud')) { 12091 $(this).parent().find('> div').slideToggle(); 12092 } 12093 if ($(this).parent().is('.woocommerce-widget-layered-nav') && $(this).parent().find('> .woocommerce-widget-layered-nav-dropdown').length > 0) { 12094 $(this).parent().find('> .woocommerce-widget-layered-nav-dropdown').slideToggle(); 12095 } 12096 12097 $(this).parent().find('> ul').slideToggle(); 12098 12099 $(this).parent().toggleClass('open-filter'); 12100 } 12101 12102 }); 12103 12104 // Slide in cart event. 12105 $body.on('mouseenter', '#header-outer [data-cart-style="slide_in"] .cart-menu-wrap', openRightCart); 12106 12107 function openRightCart() { 12108 12109 if ($('.nectar-slide-in-cart ul.cart_list li:not(.empty)').length > 0) { 12110 12111 $('.nectar-slide-in-cart').addClass('open'); 12112 $window.on('mousemove.rightCartOffsetCheck', closeCartCheck); 12113 12114 } 12115 } 12116 12117 function closeCartCheck(e) { 12118 12119 var $windowWidth = $window.width(); 12120 if (e.clientX < $windowWidth - 370 - $bodyBorderWidth) { 12121 12122 $window.off('mousemove.rightCartOffsetCheck', closeCartCheck); 12123 12124 $('.nectar-slide-in-cart').removeClass('open'); 12125 12126 } 12127 12128 } 12129 12130 // Add quantity buttons if needed. 12131 wooQauntityBtns(); 12132 12133 } 12134 12135 12136 12137 12138 12139 /** 12140 * Search in navigation functionality. 12141 * 12142 * @since 10.5 12143 */ 12144 12145 function navigationSearchInit() { 12146 12147 var $placeholder = ($('#search-outer #search input[type=text][data-placeholder]').length > 0) ? $('#search-outer #search input[type=text]').attr('data-placeholder') : ''; 12148 12149 // Material skin add search BG markup. 12150 if ($body.hasClass('material') && $('#header-outer .bg-color-stripe').length == 0) { 12151 $headerOuterEl.append('<div class="bg-color-stripe" />'); 12152 } 12153 12154 // Prevent jumping on click. 12155 $body.on('click', '#search-btn a', function () { 12156 return false; 12157 }); 12158 12159 // Open search on mouseup. 12160 $body.on('click', '#search-btn a:not(.inactive), #header-outer .mobile-search', function () { 12161 12162 if ($(this).hasClass('open-search')) { 12163 return false; 12164 } 12165 12166 // Close menu on original skin. 12167 if( $body.hasClass('original') && $('.slide-out-widget-area-toggle.mobile-icon a.open').length > 0 ) { 12168 $('.slide-out-widget-area-toggle.mobile-icon a') 12169 .addClass('non-human-allowed') 12170 .trigger('click'); 12171 12172 setTimeout(function () { 12173 $('.slide-out-widget-area-toggle.mobile-icon a').removeClass('non-human-allowed'); 12174 }, 100); 12175 } 12176 12177 if ($body.hasClass('ascend') || 12178 $('body[data-header-format="left-header"]').length > 0 && $('body.material').length == 0) { 12179 12180 // Ascend theme skin. 12181 $('#search-outer > #search form, #search-outer #search .span_12 span, #search-outer #search #close').css('opacity', 0); 12182 12183 $('#search-outer > #search form').css('transform', 'translateY(-30px)'); 12184 $('#search-outer #search .span_12 span').css('transform', 'translateY(20px)'); 12185 12186 $('#search-outer').show(); 12187 $('#search-outer').stop().transition({ 12188 scale: '1,0', 12189 'opacity': 1 12190 }, 0).transition({ 12191 scale: '1,1' 12192 }, 700, 'cubic-bezier(0.2, 1, 0.3, 1)'); 12193 12194 $('#search-outer > #search form').delay(350).transition({ 12195 'opacity': 1, 12196 'transform': 'translateY(0)' 12197 }, 700, 'cubic-bezier(0.2, 1, 0.3, 1)'); 12198 12199 $('#search-outer #search #close').delay(500).transition({ 12200 'opacity': 1 12201 }, 700, 'cubic-bezier(0.2, 1, 0.3, 1)'); 12202 12203 12204 $('#search-outer #search .span_12 span').delay(450).transition({ 12205 'opacity': 1, 12206 'transform': 'translateY(0)' 12207 }, 700, 'cubic-bezier(0.2, 1, 0.3, 1)'); 12208 12209 } 12210 12211 else if (!$body.hasClass('material')) { 12212 // Original theme skin. 12213 $('#search-outer').stop(true).fadeIn(600, 'easeOutExpo'); 12214 } 12215 else { 12216 12217 // Material theme skin. 12218 $('#header-outer[data-transparent-header="true"] .bg-color-stripe').css('transition', ''); 12219 $('#search-outer, #ajax-content-wrap').addClass('material-open'); 12220 $headerOuterEl.addClass('material-search-open'); 12221 $('#fp-nav').addClass('material-ocm-open'); 12222 12223 } 12224 12225 12226 setTimeout(function () { 12227 12228 $('#search input[type=text]').trigger('focus'); 12229 12230 if ($('#search input[type=text]').val() == $placeholder) { 12231 $('#search input[type=text]').setCursorPosition(0); 12232 } 12233 12234 }, 300); 12235 12236 12237 $(this).toggleClass('open-search'); 12238 12239 // Close slide out widget area. 12240 $('.slide-out-widget-area-toggle a:not(#toggle-nav).open:not(.animating)').trigger('click'); 12241 12242 return false; 12243 12244 });
12245 12246 // Handle the placeholder value. 12247 $('body:not(.material)').on('keydown', '#search input[type=text]', function () { 12248 if ($(this).val() == $placeholder) { 12249 $(this).val(''); 12250 } 12251 }); 12252 12253 $('body:not(.material)').on('keyup', '#search input[type=text]', function () { 12254 if ($(this).val().length == 0 ) { 12255 $(this).val($placeholder); 12256 $(this).setCursorPosition(0); 12257 } 12258 }); 12259 12260 12261 // Close search btn event. 12262 $body.on('click', '#close', function () { 12263 closeSearch(); 12264 $searchButtonEl.removeClass('open-search'); 12265 $('#header-outer .mobile-search').removeClass('open-search'); 12266 return false; 12267 }); 12268 12269 // Original and Ascend skin close search when clicking off. 12270 $('body:not(.material)').on('blur', '#search-box input[type=text]', function () { 12271 closeSearch(); 12272 $searchButtonEl.removeClass('open-search'); 12273 $('#header-outer .mobile-search').removeClass('open-search'); 12274 }); 12275 12276 12277 // Material skin close when clicking off the search. 12278 $('body.material').on('click', '#ajax-content-wrap', function (e) { 12279 if (e.originalEvent !== undefined) { 12280 closeSearch(); 12281 $searchButtonEl.removeClass('open-search'); 12282 $('#header-outer .mobile-search').removeClass('open-search'); 12283 } 12284 }); 12285 12286 // Material skin close on esc button event. 12287 if ($('body.material').length > 0) { 12288 $(document).on('keyup', function (e) { 12289 12290 if (e.keyCode == 27) { 12291 closeSearch(); 12292 $searchButtonEl.removeClass('open-search'); 12293 12294 // Close ocm material 12295 if ($('.ocm-effect-wrap.material-ocm-open').length > 0) { 12296 $('.slide-out-widget-area-toggle.material-open a').trigger('click'); 12297 } 12298 } 12299 12300 }); 12301 } 12302 12303 12304 12305 // Called to hide the search bar. 12306 function closeSearch() { 12307 12308 if ($body.hasClass('ascend') || $('body[data-header-format="left-header"]').length > 0 && $('body.material').length == 0) { 12309 $('#search-outer').stop().transition({ 12310 'opacity': 0 12311 }, 300, 'cubic-bezier(0.2, 1, 0.3, 1)'); 12312 $searchButtonEl.addClass('inactive'); 12313 setTimeout(function () { 12314 $('#search-outer').hide(); 12315 $searchButtonEl.removeClass('inactive'); 12316 }, 300); 12317 } else if ($('body.material').length == 0) { 12318 $('#search-outer').stop(true).fadeOut(450, 'easeOutExpo'); 12319 } 12320 12321 if ($body.hasClass('material')) { 12322 $('#ajax-content-wrap').removeClass('material-open'); 12323 $headerOuterEl.removeClass('material-search-open'); 12324 $('#search-outer').removeClass('material-open'); 12325 $('#fp-nav').removeClass('material-ocm-open'); 12326 } 12327 12328 } 12329 12330 } 12331 12332 12333 12334 12335 12336 12337 /** 12338 * Header layout "Centered header bottom bar" functionality. 12339 * 12340 * @since 9.0 12341 */ 12342 function centeredNavBottomBarReposition() { 12343 12344 var $headerOuter = $headerOuterEl, 12345 $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'), 12346 $headerSpan3 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_3'), 12347 $secondaryHeader = $headerSecondaryEl, 12348 $headerBtns = $headerSpan3.find('nav >ul.buttons'), 12349 $navLogoMargin = parseInt($('body.material #header-outer').attr('data-padding')), 12350 $navLogoHeight = parseInt($('body.material #header-outer').attr('data-logo-height')), 12351 $triggerCondition = ($navLogoMargin*2) + $navLogoHeight - parseInt(nectarDOMInfo.adminBarHeight) + parseInt(nectarDOMInfo.secondaryHeaderHeight); 12352 12353 if ($secondaryHeader.length > 0) { 12354 12355 if ($('#header-outer[data-remove-fixed="1"]').length == 0 && $('#header-outer[data-condense="true"]').length > 0) { 12356 12357 setTimeout(function () { 12358 if( $headerSecondaryEl.css('display') != 'none' ) { 12359 nectarDOMInfo.secondaryHeaderHeight = $headerSecondaryEl.outerHeight(); 12360 } 12361 12362 }, 50); 12363 } 12364 12365 } 12366 12367 // Helper to determine if custom mobile breakpoint is active. 12368 function condenseCustomBreakPointHelper() { 12369 var $withinCustomBreakpoint = mobileBreakPointCheck(); 12370 12371 // Adding class to prevent logo from hiding when opening OCM 12372 if ( $withinCustomBreakpoint ) { 12373 $headerOuterEl.addClass('within-custom-breakpoint'); 12374 } else { 12375 $headerOuterEl.removeClass('within-custom-breakpoint'); 12376 } 12377 } 12378 12379 12380 // Bind events if "Condense Header On Scroll" effect is enabled. 12381 if ($('#header-outer[data-condense="true"]').length > 0) { 12382 12383 $window.on('scroll.centeredNavCondense', centeredNavBottomFixed_Scroll); 12384 $window.trigger('scroll'); 12385 12386 $window.on('resize', function(){ 12387 if(nectarDOMInfo.winW < 1000 ) { 12388 $headerOuter.addClass('force-condense-remove'); 12389 $window.off('scroll.centeredNavCondense'); 12390 } 12391 });
12392 12393 $window.smartresize(function () { 12394 condenseCustomBreakPointHelper(); 12395 12396 if(nectarDOMInfo.winW >= 1000 ) { 12397 12398 // Coming from mobile. 12399 if($headerOuter.hasClass('force-condense-remove')) { 12400 12401 // Remove condense effect. 12402 centeredNavBottomFixed_Scroll(); 12403 $headerOuter.removeClass('force-condense-remove'); 12404 12405 // See if the condense effect needs to be reapplied. 12406 setTimeout(function() { 12407 12408 if(nectarDOMInfo.scrollTop >= $triggerCondition) { 12409 $headerOuter.addClass('force-condense'); 12410 centeredNavBottomFixed_Scroll(); 12411 $headerOuter.removeClass('force-condense'); 12412 } 12413 // Bind scroll event. 12414 $window.on('scroll.centeredNavCondense', centeredNavBottomFixed_Scroll); 12415 },200); 12416 12417 } 12418 } 12419 12420 }); 12421 12422 condenseCustomBreakPointHelper(); 12423 12424 } 12425 12426 12427 12428 function centeredNavBottomFixed_Scroll() { 12429 12430 // Bypass calculating. 12431 if (nectarDOMInfo.winW < 1000 || 12432 $('body.material-ocm-open').length > 0 || 12433 $('#header-outer[data-has-menu="true"][data-format="centered-menu-bottom-bar"] .span_9').css('display') == 'none') { 12434 return; 12435 } 12436 12437 $bodyBorderTop = ($bodyBorderTop.length > 0 && nectarDOMInfo.secondaryHeaderHeight > 0) ? $bodyBorderTop.height() : 0; 12438 12439 // Add condense effect. 12440 if ($headerOuter.hasClass('force-condense') || !$headerOuter.hasClass('fixed-menu') && nectarDOMInfo.scrollTop >= $triggerCondition) { 12441 12442 var amountToMove = (parseInt($headerSpan9.position().top) - $navLogoMargin - parseInt(nectarDOMInfo.adminBarHeight)) + parseInt(nectarDOMInfo.secondaryHeaderHeight) - $bodyBorderTop; 12443 12444 // Megamenu removes transparency option 12445 if ($('#header-outer[data-megamenu-rt="1"]').length > 0 && $('#header-outer .megamenu').length > 0 && $('#header-outer[data-transparent-header="true"]').length > 0) { 12446 $headerOuterEl.removeClass('no-transition'); 12447 } 12448 12449 $headerOuter.addClass('fixed-menu').removeClass('transparent').css({ 12450 'top': '-' + amountToMove + 'px', 12451 'position': 'fixed' 12452 }); 12453 12454 var $headerNavBarOffset = $('header#top .span_9 nav >ul').offset().top; 12455 var $headerButtonsOffset = $headerBtns.offset().top; 12456 12457 12458 var $headerButtonsHeight = ($headerSpan9.find('.sf-menu > li > a').length > 0) ? (20 - parseInt($headerSpan9.find('.sf-menu > li > a').height())) / 2 : 2; 12459 12460 $headerBtns.css('transform', 'translateY(' + (parseInt($headerNavBarOffset) - parseInt($headerButtonsOffset) - $headerButtonsHeight - 1) + 'px)'); 12461 $headerBtns.find('.nectar-woo-cart').css('height', $headerOuter.height() + parseInt($headerOuter.css('top')) - parseInt(nectarDOMInfo.adminBarHeight)); 12462 12463 } 12464 12465 // Remove condense effect. 12466 else if ($headerOuter.hasClass('force-condense-remove') || $headerOuter.hasClass('fixed-menu') && nectarDOMInfo.scrollTop < $triggerCondition ) { 12467 12468 $headerOuter.removeClass('fixed-menu').css({ 12469 'top': '0', 12470 'position': 'absolute' 12471 }); 12472 12473 $headerBtns.css('transform', 'translateY(0px)'); 12474 $headerBtns.find('.nectar-woo-cart').css('height', ''); 12475 12476 if ($('#header-outer.transparent').length == 0) { 12477 12478 if ($('#header-outer[data-megamenu-rt="1"]').length > 0 && 12479 $('#header-outer .megamenu').length > 0) { 12480 $headerOuterEl.removeClass('no-transition'); 12481 } 12482 12483 if ($('#header-outer[data-megamenu-rt="1"]').length > 0 && 12484 $('#header-outer[data-transparent-header="true"]').length > 0 && 12485 $('#header-outer .megamenu').length > 0) { 12486 12487 if ($headerOuterEl.attr('data-transparent-header') == 'true' && 12488 $('.nectar-box-roll').length == 0 && 12489 $('.megamenu.sfHover').length == 0) { 12490 12491 $headerOuterEl.addClass('transparent'); 12492 $headerOuterEl.removeClass('no-transition'); 12493 12494 } 12495 else if ($headerOuterEl.attr('data-transparent-header') == 'true' && 12496 $('.nectar-box-roll').length == 0 && 12497 $('.megamenu.sfHover').length > 0) { 12498 12499 $headerOuterEl.addClass('no-transition'); 12500 } 12501 12502 } 12503 12504 else { 12505 if ($headerOuterEl.attr('data-transparent-header') == 'true' && $('.nectar-box-roll').length == 0) { 12506 $headerOuterEl.addClass('transparent'); 12507 } 12508 } 12509 12510 } // endif transparent header conditional. 12511 12512 12513 }
12513 // End Remove condense effect. 12514 12515 } // End centeredNavBottomFixed_Scroll. 12516 12517 12518 12519 } 12520 12521 12522 12523 12524 /** 12525 * Header layout "Centered header bottom bar" initialization. 12526 * 12527 * @since 10.5 12528 */ 12529 function centeredNavBottomBarInit() { 12530 12531 if ($('#header-outer[data-format="centered-menu-bottom-bar"]').length > 0) { 12532 centeredNavBottomBarReposition(); 12533 } 12534 12535 } 12536 12537 12538 12539 12540 12541 /** 12542 * Header layout "Centered logo between menu". 12543 * 12544 * Splits the main navigation menu into two sections placed on each side of logo. 12545 * 12546 * @since 8.0 12547 */ 12548 function centeredLogoMargins() { 12549 12550 if (nectarDOMInfo.winW > 1000) { 12551 12552 var $navItemLength = $('#header-outer[data-format="centered-logo-between-menu"] #top nav > .sf-menu:not(.buttons) > li').length; 12553 12554 if ($('#header-outer #social-in-menu').length > 0) { 12555 $navItemLength--; 12556 } 12557 12558 var $centerLogoWidth, 12559 $extraMenuSpace; 12560 12561 if ($('#header-outer #top .row .col.span_3 #logo img:visible').length == 0) { 12562 $centerLogoWidth = parseInt($('#header-outer #top .row .col.span_3').width()); 12563 } else { 12564 $centerLogoWidth = parseInt($('#header-outer #top .row .col.span_3 img:visible').width()); 12565 } 12566 12567 if ($('#header-outer[data-lhe="animated_underline"]').length > 0) { 12568 $extraMenuSpace = parseInt($('header#top nav > ul > li:first-child > a').css('margin-right')); 12569 } else { 12570 $extraMenuSpace = parseInt($('header#top nav > ul > li:first-child > a').css('padding-right')); 12571 } 12572 12573 if ($extraMenuSpace > 30) { 12574 $extraMenuSpace += 45; 12575 } else if ($extraMenuSpace > 20) { 12576 $extraMenuSpace += 40; 12577 } else { 12578 $extraMenuSpace += 30; 12579 } 12580 12581 if (!$body.hasClass('rtl')) { 12582 $('#header-outer[data-format="centered-logo-between-menu"] #top nav > .sf-menu:not(.buttons) > li:nth-child(' + Math.floor($navItemLength / 2) + ')').css({ 12583 'margin-right': ($centerLogoWidth + $extraMenuSpace) + 'px' 12584 }).addClass('menu-item-with-margin'); 12585 } else { 12586 $('#header-outer[data-format="centered-logo-between-menu"] #top nav > .sf-menu:not(.buttons) > li:nth-child(' + Math.floor($navItemLength / 2) + ')').css({ 12587 'margin-left': ($centerLogoWidth + $extraMenuSpace) + 'px' 12588 }).addClass('menu-item-with-margin'); 12589 } 12590 12591 var $leftMenuWidth = 0; 12592 var $rightMenuWidth = 0; 12593 12594 $('#header-outer[data-format="centered-logo-between-menu"] #top nav > .sf-menu:not(.buttons) > li:not(#social-in-menu)').each(function (i) { 12595 if (i + 1 <= Math.floor($navItemLength / 2)) { 12596 $leftMenuWidth += $(this).width(); 12597 } else { 12598 $rightMenuWidth += $(this).width(); 12599 } 12600 12601 }); 12602 12603 var $menuDiff = Math.abs($rightMenuWidth - $leftMenuWidth); 12604 12605 if ($leftMenuWidth > $rightMenuWidth || ($body.hasClass('rtl') && $leftMenuWidth < $rightMenuWidth) ) { 12606 $('#header-outer #top .row > .col.span_9').css('padding-right', $menuDiff); 12607 } else { 12608 $('#header-outer #top .row > .col.span_9').css('padding-left', $menuDiff); 12609 } 12610 12611 $('#header-outer[data-format="centered-logo-between-menu"] nav').css('visibility', 'visible'); 12612 12613 } 12614 12615 else if ($('#header-outer[data-format="centered-logo-between-menu"]').length > 0 && nectarDOMInfo.winW < 1000) { 12616 $('#header-outer .row > .col.span_9').css({ 12617 'padding-right': '0', 12618 'padding-left': '0' 12619 }); 12620 } 12621 12622 } 12623 12624 12625 /** 12626 * Header layout "Centered logo between menu" initialization. 12627 * 12628 * @since 10.5 12629 */ 12630 function centeredLogoHeaderInit() { 12631 12632 if($('#header-outer[data-format="centered-logo-between-menu"]').length > 0) { 12633 12634 if(!usingLogoImage) { 12635 centeredLogoMargins(); 12636 } 12637 else if(usingLogoImage && $('#header-outer[data-format="centered-logo-between-menu"]').length > 0 && $('header#top #logo img:first[src]').length > 0) { 12638 12639 //fadein img on load 12640 var tempLogoImg = new Image(); 12641 tempLogoImg.src = $('header#top #logo img:first').attr('src'); 12642 12643 tempLogoImg.onload = function() { 12644 centeredLogoMargins(); 12645 }; 12646 12647 } 12648 12649 // Resize event. 12650 $window.on('smartresize', centeredLogoMargins); 12651 12652 } 12653 12654 } 12655 12656 12657 12658 12659 12660 12661 12662 12663 /** 12664 * Handle basic items before initializing effects. 12665 * 12666 * @since 10.5 12667 */ 12668 function headerNavPreInit() { 12669 12670 // Deactivate hide header until needed effect on mobile. 12671 if (nectarDOMInfo.usingMobileBrowser && $('#header-outer[data-remove-fixed="1"]').length == 0) { 12672 $body.attr('data-hhun', '0'); 12673 } 12674 12675 // Page fullscreen rows does not need permanent transparent. 12676 if ($('#nectar_fullscreen_rows').length > 0) { 12677 ($headerOuterEl.attr('data-permanent-transparent', 'false')); 12678 } 12679 12680 // Set mobile header height. 12681 if (nectarDOMInfo.usingMobileBrowser && $('#header-outer[data-mobile-fixed="1"]').length > 0 && 12682 $('#header-outer[data-transparent-header="true"]').length == 0) { 12683 $('#header-space').css('height', $headerOuterEl.outerHeight()); 12684 } 12685 12686 } 12687 12688 12689 12690 12691 12692 12693 /** 12694 * Hide header until needed. 12695 * 12696 * Used when "Header Hide Until Needed" is active. 12697 * 12698 * @since 10.5 12699 */ 12700 function hhunHeaderEffect() { 12701 12702 var previousScroll = 0, // previous scroll position
12703 menuOffset = 250, // height of menu (once scroll passed it, menu is hidden) 12704 hideShowOffset = 6; // scrolling value after which triggers hide/show menu 12705 12706 // Called in RAF loop to calculate the header visibility. 12707 function hhunCalcs() { 12708 12709 $headerOuterEl.addClass('detached'); 12710 12711 var currentScroll = nectarDOMInfo.scrollTop, // Gets current scroll position 12712 scrollDifference = Math.abs(currentScroll - previousScroll); // Calculates how fast user is scrolling 12713 12714 // Stop scrolling while animated anchors / box roll 12715 if ($('body.animated-scrolling').length > 0 && $('#header-outer.detached').length > 0 || $('body.no-scroll').length > 0) { 12716 12717 if (nectarDOMInfo.winW > 999) { 12718 12719 if (currentScroll > menuOffset) { 12720 12721 // Alter scroll tracking to continue hiding menu. 12722 previousScroll = nectarDOMInfo.scrollTop; 12723 currentScroll = nectarDOMInfo.scrollTop; 12724 12725 } 12726 12727 requestAnimationFrame(hhunCalcs); 12728 return; 12729 } 12730 } 12731 12732 // Stop when material ocm or material search is open 12733 if ($('body.material-ocm-open').length > 0 || $('#search-outer.material-open').length > 0) { 12734 if (nectarDOMInfo.winW > 999) { 12735 requestAnimationFrame(hhunCalcs); 12736 return; 12737 } 12738 } 12739 12740 // Stop on mobile if not using sticky option 12741 if ($('#header-outer[data-mobile-fixed="false"]').length > 0 && $('body.mobile').length > 0) { 12742 $headerOuterEl.removeClass('detached'); 12743 return; 12744 } 12745 12746 12747 12748 if (!$headerOuterEl.hasClass('side-widget-open') && !$('#header-outer .slide-out-widget-area-toggle a').hasClass('animating')) { 12749 12750 var heightToAdjust; 12751 12752 // Remove transparent and body border margin 12753 if (currentScroll > 1) { 12754 if ($('#header-outer[data-permanent-transparent="1"]').length == 0) { 12755 $headerOuterEl.removeClass('transparent'); 12756 $headerOuterEl.addClass('scrolling'); 12757 } 12758 12759 // Handle secondary header 12760 if ($headerSecondaryEl.length > 0) { 12761 if (currentScroll > menuOffset) { 12762 $headerSecondaryEl.addClass('hide-up'); 12763 $headerOuterEl.css('transform', 'translateY(-' + nectarDOMInfo.secondaryHeaderHeight + 'px)'); 12764 } else { 12765 $headerSecondaryEl.removeClass('hide-up'); 12766 $headerOuterEl.css('transform', '0px)'); 12767 } 12768 } 12769 12770 } 12771 12772 // Scrolled past menu 12773 if (currentScroll > menuOffset) { 12774 12775 // Scrolled past detach point add class to fix menu 12776 if (!$headerOuterEl.hasClass('detached')) { 12777 12778 $headerOuterEl 12779 .addClass('detached') 12780 .removeClass('parallax-contained'); 12781 } 12782 12783 $headerOuterEl.removeClass('no-transition'); 12784 12785 12786 // Scrolling faster than hideShowOffset hide/show menu 12787 if (scrollDifference >= hideShowOffset) { 12788 12789 if (currentScroll > previousScroll) { 12790 12791 // Hide menu 12792 if (!$headerOuterEl.hasClass('invisible')) { 12793 12794 $headerOuterEl 12795 .addClass('invisible') 12796 .removeClass('at-top'); 12797 12798 // Close submenus 12799 if ($(".sf-menu").length > 0 && $().superfish) { 12800 $(".sf-menu").superfish('hide'); 12801 $('header#top nav > ul.sf-menu > li.menu-item-over').removeClass('menu-item-over'); 12802 } 12803 12804 } 12805 12806 $('.page-submenu.stuck') 12807 .css('transform', 'translateY(0px)') 12808 .addClass('header-not-visible'); 12809 12810 } else { 12811 12812 // Show menu 12813 if ($headerOuterEl.hasClass('invisible')) { 12814 $headerOuterEl.removeClass('invisible'); 12815 } 12816 12817 // Page submenu adjust 12818 heightToAdjust = $headerOuterEl.outerHeight(); 12819 12820 if( $headerSecondaryEl.length > 0) { 12821 heightToAdjust -= nectarDOMInfo.secondaryHeaderHeight; 12822 } 12823 12824 if ($bodyBorderTop.length > 0 && $('body.mobile').length == 0) { 12825 12826 $bodyBorderSizeToRemove = ($bodyBorderHeaderColorMatch) ? $bodyBorderTop.height() : 0; 12827 12828 $('.page-submenu.stuck') 12829 .css('transform', 'translateY(' + (heightToAdjust - $bodyBorderSizeToRemove) + 'px)') 12830 .removeClass('header-not-visible'); 12831 12832 } else { 12833 $('.page-submenu.stuck') 12834 .css('transform', 'translateY(' + heightToAdjust + 'px)') 12835 .removeClass('header-not-visible'); 12836 } 12837 12838 } 12839 } 12840 12841 } else { 12842 12843 12844 var $topDetachNum = ($('#header-outer[data-using-secondary="1"]').length > 0) ? 32 : 0; 12845 if ($bodyBorderTop.length > 0) { 12846 $topDetachNum = ($('#header-outer[data-using-secondary="1"]').length > 0) ? 32 + $bodyBorderTop.height() : $bodyBorderTop.height(); 12847 } 12848 12849 if (currentScroll <= $topDetachNum) { 12850 12851 $headerOuterEl 12852 .addClass('at-top') 12853 .removeClass('invisible') 12854 .removeClass('scrolling'); 12855 12856 if ($('#header-outer[data-megamenu-rt="1"]').length > 0 && 12857 $('#header-outer[data-transparent-header="true"]').length > 0 && 12858 $('#header-outer .megamenu').length > 0) { 12859 12860 if ($('#header-outer[data-transparent-header="true"]').length > 0 && 12861 $('.nectar-box-roll').length == 0 && 12862 $('.megamenu.sfHover').length == 0) { 12863 12864 $headerOuterEl 12865 .addClass('transparent') 12866 .css('transform', 'translateY(0)') 12867 .removeClass('no-transition'); 12868 12869 } else if ($('.nectar-box-roll').length > 0) { 12870 12871 $headerOuterEl 12872 .css('transform', 'translateY(0)') 12873 .addClass('at-top-before-box'); 12874 } 12875 12876 } else { 12877 12878 if ($('#header-outer[data-transparent-header="true"]').length > 0 && 12879 $('.nectar-box-roll').length == 0) { 12880 12881 $headerOuterEl 12882 .addClass('transparent') 12883 .css('transform', 'translateY(0)'); 12884 12885 } else if ($('.nectar-box-roll').length > 0) { 12886 12887 $headerOuterEl 12888 .css('transform', 'translateY(0)') 12889 .addClass('at-top-before-box'); 12890 } 12891 } 12892
12893 if ($('#page-header-bg[data-parallax="1"]').length > 0) { 12894 12895 $headerOuterEl 12896 .addClass('parallax-contained') 12897 .css('transform', 'translateY(0)'); 12898 } 12899 12900 } 12901 12902 } 12903 12904 // At the bottom of document - show menu 12905 if ((nectarDOMInfo.winH + window.scrollY) >= document.body.offsetHeight) { 12906 12907 $headerOuterEl.removeClass('invisible'); 12908 12909 // Page submenu adjust 12910 heightToAdjust = $headerOuterEl.outerHeight(); 12911 if( $headerSecondaryEl.length > 0) { 12912 heightToAdjust -= nectarDOMInfo.secondaryHeaderHeight; 12913 } 12914 12915 if ($bodyBorderTop.length > 0 && $('body.mobile').length == 0) { 12916 12917 $bodyBorderSizeToRemove = ($bodyBorderHeaderColorMatch) ? $bodyBorderTop.height() : 0; 12918 $('.page-submenu.stuck') 12919 .css('transform', 'translateY(' + (heightToAdjust - $bodyBorderSizeToRemove) + 'px)') 12920 .removeClass('header-not-visible'); 12921 } else { 12922 12923 $('.page-submenu.stuck') 12924 .css('transform', 'translateY(' + heightToAdjust + 'px)') 12925 .removeClass('header-not-visible'); 12926 } 12927 12928 } 12929 12930 } 12931 12932 // Keep track of current scroll position 12933 previousScroll = currentScroll; 12934 12935 if (nectarDOMInfo.winW > 999) { 12936 requestAnimationFrame(hhunCalcs); 12937 } 12938 12939 } 12940 12941 // Start the animation loop. 12942 hhunCalcs(); 12943 12944 } 12945 12946 12947 12948 /** 12949 * Shrink the header navigation size. 12950 * 12951 * Used when "Header Resize On Scroll" is active. 12952 * 12953 * @since 1.0 12954 */ 12955 function smallNav() { 12956 12957 var $offset = nectarDOMInfo.scrollTop, 12958 $windowWidth = nectarDOMInfo.winW, 12959 $scrollTriggerOffset = ($body.hasClass('material')) ? 150 : 30; 12960 12961 if( headerTransparent == true ) { 12962 $scrollTriggerOffset = 0; 12963 } 12964 12965 if ($offset > $scrollTriggerOffset && $windowWidth >= 1000 && $('body.material-ocm-open').length == 0) { 12966 12967 12968 // Going to small when material search is closing, it must be closed immediately 12969 if ($body.is('.material')) { 12970 12971 if ($('#search-outer.material-open').length == 0) { 12972 $('#header-outer[data-transparent-header="true"] .bg-color-stripe').css('transition', 'none'); 12973 } 12974 12975 // Secondary header 12976 if ($headerSecondaryEl.length > 0) { 12977 $headerSecondaryEl.addClass('hide-up'); 12978 $headerOuterEl.css('transform', 'translateY(-' + nectarDOMInfo.secondaryHeaderHeight + 'px)'); 12979 } 12980 12981 } 12982 12983 if ($('#header-outer[data-megamenu-rt="1"]').length > 0 && 12984 $('#header-outer[data-transparent-header="true"]').length > 0 && 12985 $('#header-outer .megamenu').length > 0) { 12986 12987 if ($headerOuterEl.attr('data-transparent-header') == 'true' && 12988 $('#header-outer.side-widget-open').length == 0 && 12989 $('#header-outer[data-permanent-transparent="1"]').length == 0 && 12990 $('.megamenu.sfHover').length == 0) { 12991 $headerOuterEl.removeClass('transparent'); 12992 $headerOuterEl.removeClass('no-transition'); 12993 } 12994 12995 } else { 12996 12997 if ($headerOuterEl.attr('data-transparent-header') == 'true' && 12998 $('#header-outer.side-widget-open').length == 0 && 12999 $('#header-outer[data-permanent-transparent="1"]').length == 0) { 13000 $headerOuterEl.removeClass('transparent'); 13001 } 13002 13003 } 13004 13005 $('#header-outer, #search-outer').addClass('small-nav'); 13006 13007 // Body border full width side padding 13008 if ($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 && 13009 $bodyBorderTop.length > 0 && 13010 $bodyBorderHeaderColorMatch == true) { 13011 13012 $('#header-outer[data-full-width="true"] header > .container').stop(true, true).animate({ 13013 'padding': '0' 13014 }, { 13015 queue: false, 13016 duration: 250, 13017 easing: 'easeOutCubic' 13018 });
13019 13020 } 13021 13022 if ($('body.material').length > 0) { 13023 $('header#top nav > ul > li.menu-item-with-margin').stop(true, true).animate({ 13024 'margin-right': (parseInt($('header#top nav > ul > li.menu-item-with-margin').css('margin-right')) - parseInt(logoShrinkNum) * 3) + 'px' 13025 }, { 13026 queue: false, 13027 duration: 310, 13028 easing: 'easeOutQuad' 13029 }); 13030 } 13031 13032 // Box roll effect 13033 if ($('.nectar-box-roll').length > 0 && $('#header-outer[data-permanent-transparent="1"]').length == 0) { 13034 $('#ajax-content-wrap').animate({ 13035 'margin-top': (Math.floor(($logoHeight - logoShrinkNum) + (headerPadding * 2) / 1.8 + nectarDOMInfo.adminBarHeight + nectarDOMInfo.secondaryHeaderHeight)) 13036 }, { 13037 queue: false, 13038 duration: 250, 13039 easing: 'easeOutCubic' 13040 }); 13041 } 13042 13043 $window.off('scroll.headerResizeEffect', smallNav); 13044 $window.on('scroll.headerResizeEffect', bigNav); 13045 13046 // Dark slider coloring border 13047 $('#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'); 13048 $('#header-outer[data-transparent-header="true"] .cart-menu').css('transition', 'none'); 13049 setTimeout(function () { 13050 $('#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'); 13051 $('#header-outer[data-transparent-header="true"] .cart-menu').css('transition', 'border-color 0.30s ease'); 13052 }, 300); 13053 13054 } 13055 13056 } 13057 13058 13059 /** 13060 * Return header navigation size to full. 13061 * 13062 * Used when "Header Resize On Scroll" is active. 13063 * 13064 * @since 1.0 13065 */ 13066 function bigNav() { 13067 13068 var $offset = nectarDOMInfo.scrollTop, 13069 $windowWidth = nectarDOMInfo.winW, 13070 $scrollTriggerOffset = ($body.hasClass('material')) ? 150 : 30; 13071 13072 if ($body.is('.material-ocm-open')) { 13073 return false; 13074 } 13075 13076 if( headerTransparent == true ) { 13077 $scrollTriggerOffset = 0; 13078 } 13079 13080 if ($offset <= $scrollTriggerOffset && $windowWidth >= 1000 || $('.small-nav').length > 0 && $('#ajax-content-wrap.no-scroll').length > 0) { 13081 13082 $('#header-outer, #search-outer').removeClass('small-nav'); 13083 13084 if ($('#header-outer[data-megamenu-rt="1"]').length > 0 && 13085 $('#header-outer[data-transparent-header="true"]').length > 0 && 13086 $('#header-outer .megamenu').length > 0) { 13087 13088 if ($headerOuterEl.attr('data-transparent-header') == 'true' && 13089 $('.nectar-box-roll').length == 0 && 13090 $('.megamenu.sfHover').length == 0) { 13091 13092 $headerOuterEl.addClass('transparent'); 13093 $headerOuterEl.removeClass('no-transition'); 13094 } 13095 13096 } else { 13097 13098 if ($headerOuterEl.attr('data-transparent-header') == 'true' && $('.nectar-box-roll').length == 0) { 13099 $headerOuterEl.addClass('transparent'); 13100 } 13101 13102 } 13103 13104 // Body border full width side padding 13105 if ($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 && 13106 $bodyBorderTop.length > 0 && 13107 $bodyBorderHeaderColorMatch == true) { 13108 13109 $('#header-outer[data-full-width="true"] header > .container').stop(true, true).animate({ 13110 'padding': '0 28px' 13111 }, { 13112 queue: false, 13113 duration: 250, 13114 easing: 'easeOutCubic' 13115 }); 13116 13117 } 13118 13119 13120 if ($('body.material').length > 0) { 13121 13122 $('header#top nav > ul > li.menu-item-with-margin').stop(true, true).animate({ 13123 'margin-right': (parseInt($('header#top nav > ul > li.menu-item-with-margin').css('margin-right')) + parseInt(logoShrinkNum) * 3) + 'px' 13124 }, { 13125 queue: false, 13126 duration: 140, 13127 easing: 'easeOutQuad' 13128 });
13129 13130 } 13131 13132 13133 // Secondary header 13134 if ($headerSecondaryEl.length > 0) { 13135 13136 $headerSecondaryEl.removeClass('hide-up'); 13137 $headerOuterEl 13138 .removeClass('hide-up') 13139 .css('transform', 'translateY(0%)'); 13140 13141 } 13142 13143 // Box roll 13144 if ($('.nectar-box-roll').length > 0 && $('#header-outer[data-permanent-transparent="1"]').length == 0) { 13145 $('#ajax-content-wrap').animate({ 13146 'margin-top': (Math.floor(($logoHeight) + (headerPadding * 2) + nectarDOMInfo.adminBarHeight + nectarDOMInfo.secondaryHeaderHeight)) 13147 }, { 13148 queue: false, 13149 duration: 250, 13150 easing: 'easeOutCubic' 13151 }); 13152 } 13153 13154 $window.off('scroll.headerResizeEffect', bigNav); 13155 $window.on('scroll.headerResizeEffect', smallNav); 13156 13157 // Dark slider coloring border 13158 $('#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'); 13159 $('#header-outer[data-transparent-header="true"] .cart-menu').css('transition', 'none'); 13160 setTimeout(function () { 13161 $('#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'); 13162 $('#header-outer[data-transparent-header="true"] .cart-menu').css('transition', 'border-color 0.30s ease'); 13163 }, 300); 13164 } 13165 13166 } 13167 13168 13169 13170 /** 13171 * Default scroll event to handle transparency/secondary header when no header effects are enabled. 13172 * 13173 * @since 4.0 13174 */ 13175 function opaqueCheck() { 13176 13177 // The condense header effect will bypass this unless in the custom mobile breakpoint (which is defined in theme options). 13178 if ($('#header-outer[data-format="centered-menu-bottom-bar"][data-condense="true"]').length > 0 && !$headerOuterEl.hasClass('within-custom-breakpoint') ) { 13179 return; 13180 } 13181 13182 if (nectarDOMInfo.scrollTop > 0) { 13183 13184 if ($('body.material').length > 0) { 13185 $headerOuterEl.addClass('scrolled-down'); 13186 13187 // Secondary header 13188 if ($headerSecondaryEl.length > 0 && nectarDOMInfo.winW > 1000) { 13189 $headerSecondaryEl.addClass('hide-up'); 13190 $headerOuterEl.css('transform', 'translateY(-' + nectarDOMInfo.secondaryHeaderHeight + 'px)'); 13191 } 13192 } 13193 13194 if ($headerOuterEl.attr('data-transparent-header') == 'true' && $('#header-outer[data-permanent-transparent="1"]').length == 0) { 13195 $headerOuterEl.removeClass('transparent').addClass('scrolled-down'); 13196 } 13197 13198 // Switch event to watch. 13199 $window.off('scroll.headerResizeEffectOpaque', opaqueCheck); 13200 $window.on('scroll.headerResizeEffectOpaque', transparentCheck); 13201 } 13202 } 13203 13204 13205 /** 13206 * Default scroll event to handle transparency/secondary header when no header effects are enabled. 13207 * 13208 * @since 4.0 13209 */ 13210 function transparentCheck() { 13211 13212 // The condense header effect will bypass this unless in the custom mobile breakpoint (which is defined in theme options). 13213 if ($('#header-outer[data-format="centered-menu-bottom-bar"][data-condense="true"]').length > 0 && !$headerOuterEl.hasClass('within-custom-breakpoint') ) { 13214 return; 13215 } 13216 13217 if (nectarDOMInfo.scrollTop == 0 && $('body.material-ocm-open').length == 0) { 13218 13219 if ($('#header-outer[data-megamenu-rt="1"]').length > 0 && 13220 $('#header-outer[data-transparent-header="true"]').length > 0 && 13221 $('#header-outer .megamenu').length > 0) { 13222 13223 if ($headerOuterEl.attr('data-transparent-header') == 'true' && $('.megamenu.sfHover').length == 0) { 13224 13225 $headerOuterEl 13226 .addClass('transparent') 13227 .removeClass('scrolled-down'); 13228 13229 $headerOuterEl.removeClass('no-transition'); 13230 13231 } else if ($headerOuterEl.attr('data-transparent-header') == 'true') { 13232 13233 $headerOuterEl.removeClass('scrolled-down'); 13234 } 13235 13236 } else { 13237 13238 if ($headerOuterEl.attr('data-transparent-header') == 'true') { 13239 $headerOuterEl 13240 .addClass('transparent') 13241 .removeClass('scrolled-down'); 13242 } 13243 13244 } 13245 13246 if ($('body.material').length > 0) { 13247 $headerOuterEl.removeClass('scrolled-down'); 13248 13249 // Secondary header 13250 if ($headerSecondaryEl.length > 0 && nectarDOMInfo.winW > 1000) { 13251 13252 $headerSecondaryEl.removeClass('hide-up'); 13253 $headerOuterEl 13254 .removeClass('hide-up') 13255 .css('transform', 'translateY(0%)'); 13256 } 13257 } 13258 13259 // Switch event to watch. 13260 $window.off('scroll.headerResizeEffectOpaque', transparentCheck); 13261 $window.on('scroll.headerResizeEffectOpaque', opaqueCheck); 13262 } 13263 13264 } 13265 13266 13267 13268 13269 /** 13270 * Mobile header event for handling transparency/secondary header. 13271 * 13272 * @since 10.5 13273 * @see bindScrollEffectsMobile 13274 */ 13275 function mobileHeaderRAF() { 13276 13277 if ($('body.material-ocm-open').length > 0) { 13278 requestAnimationFrame(mobileHeaderRAF); 13279 return; 13280 } 13281 // Scrolled down. 13282 if (nectarDOMInfo.scrollTop > 5) { 13283 13284 if (!$headerOuterEl.is('[data-permanent-transparent="1"]')) { 13285 $headerOuterEl.removeClass('transparent'); 13286 } 13287 13288 if (nectarDOMInfo.secondaryHeaderHeight > 0) { 13289 $headerSecondaryEl.addClass('hide-up'); 13290 $headerOuterEl.css('transform', 'translateY(-' + nectarDOMInfo.secondaryHeaderHeight + 'px)').addClass('hidden-secondary'); 13291 } else { 13292 $headerOuterEl.removeClass('hidden-secondary'); 13293 } 13294 13295 } 13296 // At top. 13297 else { 13298 13299 if ($headerOuterEl.is('[data-transparent-header="true"]')) { 13300 $headerOuterEl.addClass('transparent'); 13301 } 13302 13303 if (nectarDOMInfo.secondaryHeaderHeight > 0) { 13304 $headerSecondaryEl.removeClass('hide-up'); 13305 $headerOuterEl.css('transform', 'translateY(0px)'); 13306 } 13307 $headerOuterEl.removeClass('hidden-secondary'); 13308 13309 } 13310 13311 if (nectarDOMInfo.winW < 1000) { 13312 requestAnimationFrame(mobileHeaderRAF); 13313 } 13314 } 13315 13316 13317 13318 /** 13319 * Bind mobile header scroll effects. 13320 * 13321 * @since 10.5 13322 * @see headerNavScrollInit 13323 */ 13324 function bindScrollEffectsMobile() { 13325 13326 if (nectarDOMInfo.winW > 999) { 13327 return; 13328 } 13329 13330 // Unbind desktop effects. 13331 $window.off('scroll.headerResizeEffect'); 13332 $window.off('scroll.headerResizeEffectOpaque'); 13333 13334 // Remove HHUN classes. 13335 $headerOuterEl 13336 .removeClass('scrolled-down') 13337 .removeClass('detached') 13338 .removeClass('invisible') 13339 .removeClass('at-top') 13340 .css('transform', 'none'); 13341 13342 // Handle mobile transparent class. 13343 if ($('#header-outer[data-mobile-fixed="1"]').length > 0) { 13344 requestAnimationFrame(mobileHeaderRAF); 13345 } else if ($headerOuterEl.attr('data-transparent-header') == 'true') { 13346 $headerOuterEl.addClass('transparent'); 13347 } 13348 13349 $window.off('smartresize.nectarNavScrollEffects'); 13350 $window.on('smartresize.nectarNavScrollEffects', bindScrollEffectsDesktop); 13351 13352 } 13353 13354 /** 13355 * Bind deaktop header scroll effects. 13356 * 13357 * @since 10.5 13358 * @see headerNavScrollInit 13359 */ 13360 function bindScrollEffectsDesktop() { 13361 13362 if (nectarDOMInfo.winW < 1000) { 13363 return; 13364 } 13365 13366 if (headerResize == true && headerHideUntilNeeded != '1') { 13367 13368 $window.off('scroll.headerResizeEffect'); 13369 13370 if ($('#nectar_fullscreen_rows').length == 0) { 13371 $window.on('scroll.headerResizeEffect', smallNav); 13372 } else if ($('#nectar_fullscreen_rows[data-mobile-disable="on"]').length > 0 && nectarDOMInfo.usingMobileBrowser) { 13373 $window.on('scroll.headerResizeEffect', smallNav); 13374 } 13375 13376 } else if (headerHideUntilNeeded != '1') { 13377 13378 $window.off('scroll.headerResizeEffectOpaque'); 13379 $window.on('scroll.headerResizeEffectOpaque', opaqueCheck); 13380 13381 }
13381 else if (headerHideUntilNeeded == '1') { 13382 13383 13384 if ($('.nectar-box-roll').length > 0) { 13385 $headerOuterEl.addClass('at-top-before-box'); 13386 } 13387 13388 // Don't trigger for header remove stickiness. 13389 if ($('#header-outer[data-remove-fixed="1"]').length == 0) { 13390 hhunHeaderEffect(); 13391 } 13392 13393 } //end if hhun 13394 13395 // Condense header effect coming from mobile. 13396 if ($('#header-outer[data-format="centered-menu-bottom-bar"][data-condense="true"]').length > 0 ) { 13397 13398 if( $headerSecondaryEl.length > 0 ) { 13399 // Remove transform. 13400 $headerOuterEl.css('transform',''); 13401 } 13402 13403 if ( nectarDOMInfo.scrollTop > 200 && !$headerOuterEl.hasClass('fixed-menu') ) { 13404 $headerOuterEl.addClass('fixed-menu'); 13405 } 13406 13407 } 13408 13409 // Only bind mobile if applicable. 13410 13411 $window.off('smartresize.nectarNavScrollEffects'); 13412 $window.on('smartresize.nectarNavScrollEffects', bindScrollEffectsMobile); 13413 13414 } 13415 13416 13417 13418 /** 13419 * Header Navigation scroll events initialization. 13420 * 13421 * @since 10.5 13422 */ 13423 function headerNavScrollInit() { 13424 13425 // Remove transparent class if page loaded further down. 13426 if ($('#header-outer[data-remove-fixed="1"]').length == 0 && nectarDOMInfo.winW > 1000) { 13427 if ( $(window).scrollTop() != 0 && $('#header-outer.transparent[data-permanent-transparent="false"]').length == 1) { 13428 $headerOuterEl.removeClass('transparent'); 13429 } 13430 } 13431 13432 // Permanent transparent header. 13433 if ($('#nectar_fullscreen_rows').length == 0 && $('.nectar-box-roll').length == 0) { 13434 midnightInit(); 13435 } 13436 13437 // Determine which events to bind at start. 13438 if (nectarDOMInfo.winW < 1000 && $('.nectar-box-roll').length == 0) { 13439 bindScrollEffectsMobile(); 13440 $window.on('smartresize.nectarNavScrollEffects', bindScrollEffectsMobile); 13441 } else { 13442 bindScrollEffectsDesktop(); 13443 $window.on('smartresize.nectarNavScrollEffects', bindScrollEffectsDesktop); 13444 } 13445 13446 } 13447 13448 13449 13450 13451 13452 13453 /** 13454 * Set the header space div height. 13455 * 13456 * @since 10.5 13457 */ 13458 function headerSpace() { 13459 13460 if ($('.mobile').length > 0) { 13461 13462 if (nectarDOMInfo.winH < nectarDOMInfo.winW && nectarDOMInfo.winW > 1000) { 13463 if ($('#header-outer.small-nav').length == 0) { 13464 $('#header-space').css('height', $headerOuterEl.outerHeight()); 13465 } 13466 } else { 13467 $('#header-space').css('height', $headerOuterEl.outerHeight()); 13468 } 13469 13470 } else { 13471 13472 if ($('.nectar-parallax-scene.first-section').length == 0) { 13473 13474 var headerPadding2 = headerPadding - headerPadding / 1.8; 13475 var $headerHeight = ($('#header-outer[data-header-resize="1"]').length > 0 && $('.small-nav').length > 0) ? $headerOuterEl.outerHeight() + (parseInt(logoShrinkNum) + headerPadding2 * 2) : $headerOuterEl.outerHeight(); 13476 13477 $('#header-space').css('height', $headerHeight); 13478 13479 } 13480 13481 } 13482 13483 } 13484 13485 13486 13487 /** 13488 * Handle header nav distance away from top to account for admin bar. 13489 * 13490 * @since 10.5 13491 */ 13492 13493 function headerNavOffsetInit() { 13494 13495 var lastPosition = -1; 13496 var $headerScrollTop = nectarDOMInfo.scrollTop; 13497 13498 // Verify scroll pos has changed before calculating. 13499 function headerOffsetAdjust() { 13500 13501 if ( $body.hasClass('compose-mode') ) { 13502 return; 13503 } 13504 13505 $headerScrollTop = nectarDOMInfo.scrollTop; 13506 13507 if (lastPosition == $headerScrollTop) { 13508 requestAnimationFrame(headerOffsetAdjust); 13509 return false; 13510 } else { 13511 lastPosition = $headerScrollTop; 13512 } 13513 13514 headerOffsetAdjustCalc(); 13515 requestAnimationFrame(headerOffsetAdjust); 13516 13517 } 13518 13519 // Called when scrolling occurs. 13520 function headerOffsetAdjustCalc() { 13521 13522 var $eleHeight = 0; 13523 13524 // Mobile. 13525 if ($('body.mobile').length > 0 || (condenseHeaderLayout == true && $('#header-outer .span_9').css('display') == 'none')) { 13526 13527 $eleHeight = 0; 13528 var $endOffset = ($wpAdminBar.css('position') == 'fixed') ? $wpAdminBar.height() : 0; 13529 13530 $eleHeight += nectarDOMInfo.adminBarHeight; 13531 13532 if ($eleHeight - $headerScrollTop > $endOffset) { 13533 $headerOuterEl.css('top', $eleHeight - $headerScrollTop + 'px'); 13534 } else { 13535 $headerOuterEl.css('top', $endOffset); 13536 } 13537 13538 } 13539 // Desktop 13540 else { 13541 if ( condenseHeaderLayout == false ) { 13542 13543 $eleHeight = 0; 13544 13545 if( !$headerOuterEl.is('[data-remove-fixed="1"]') ) { 13546 $eleHeight += nectarDOMInfo.adminBarHeight; 13547 } 13548 $headerOuterEl.css('top', $eleHeight + 'px'); 13549 } 13550 } 13551 13552 } 13553 13554 // Bind event and begin if needed. 13555 if ($('#header-outer[data-mobile-fixed="1"]').length > 0 && $wpAdminBar.length > 0) { 13556 13557 if ($('#nectar_fullscreen_rows').length == 0) { 13558 requestAnimationFrame(headerOffsetAdjust); 13559 } else if ($('#nectar_fullscreen_rows').length > 0 && nectarDOMInfo.usingMobileBrowser) { 13560 requestAnimationFrame(headerOffsetAdjust); 13561 } 13562 13563 $window.smartresize(headerOffsetAdjustCalc); 13564 13565 } 13566 13567 } 13568 13569 13570 13571 13572 13573 13574 13575 /** 13576 * Calculate the minimum body height when using the footer reveal effect or material OCM 13577 * 13578 * @since 7.0 13579 */ 13580 function footerRevealCalcs() { 13581 13582 var $headerNavSpace = ''; 13583 var pageHeaderHeight = 0; 13584 13585 if( $headerOuterEl.is('[data-logo-height]') && $headerOuterEl.is('[data-padding]') ) { 13586 13587 if( $headerOuterEl.find('#logo.no-image').length > 0 ) { 13588 $headerNavSpace = ( headerLayoutFormat == 'left-header' && nectarDOMInfo.winW > 1000) ? 0 : parseInt($headerOuterEl.find('#logo.no-image').height()) + (parseInt($headerOuterEl.attr('data-padding')*2)); 13589 } else { 13590 $headerNavSpace = ( headerLayoutFormat == 'left-header' && nectarDOMInfo.winW > 1000) ? 0 : parseInt($headerOuterEl.attr('data-logo-height')) + (parseInt($headerOuterEl.attr('data-padding')*2)); 13591 } 13592 13593 } else { 13594 $headerNavSpace = ( headerLayoutFormat == 'left-header' && nectarDOMInfo.winW > 1000) ? 0 : $headerOuterEl.outerHeight(); 13595 } 13596 13597 if( $pageHeaderBG.length > 0 ) { 13598 pageHeaderHeight += $pageHeaderBG.height(); 13599 } 13600 if( $('.page-header-no-bg').length > 0 ) { 13601 pageHeaderHeight += $('.page-header-no-bg').height(); 13602 } 13603 13604 if (nectarDOMInfo.winH - nectarDOMInfo.adminBarHeight - $headerNavSpace - nectarDOMInfo.footerOuterHeight - 1 - pageHeaderHeight > 0) { 13605 13606 var $resizeExtra = ($('body:not(.material) #header-outer[data-header-resize="1"]').length > 0) ? 55 : 0; 13607 13608 $('body[data-footer-reveal="1"] .container-wrap').css({ 13609 'margin-bottom': nectarDOMInfo.footerOuterHeight 13610 });
13611 13612 $('.container-wrap').css({ 13613 'min-height': nectarDOMInfo.winH - nectarDOMInfo.adminBarHeight - $headerNavSpace - nectarDOMInfo.footerOuterHeight - pageHeaderHeight + $resizeExtra 13614 }); 13615 13616 } else { 13617 $('body[data-footer-reveal="1"] .container-wrap').css({ 13618 'margin-bottom': nectarDOMInfo.footerOuterHeight 13619 }); 13620 } 13621 13622 if (nectarDOMInfo.winW < 1000) { 13623 $footerOuterEl.attr('data-midnight', 'light'); 13624 } 13625 else { 13626 $footerOuterEl.removeAttr('data-midnight'); 13627 } 13628 } 13629 13630 13631 /** 13632 * Initialize footer reveal and bind event 13633 * 13634 * @since 10.5 13635 */ 13636 function footerRevealInit() { 13637 13638 if ($('body[data-footer-reveal="1"]').length > 0 || $('body.material[data-slide-out-widget-area-style="slide-out-from-right"]').length > 0) { 13639 13640 // Don't add on mobile 13641 if( !$body.hasClass('mobile') ) { 13642 $body.addClass('nectar-no-flex-height'); 13643 } 13644 13645 setTimeout(footerRevealCalcs, 60); 13646 footerRevealCalcs(); 13647 13648 $window.on('resize', footerRevealCalcs); 13649 13650 if ($('body[data-footer-reveal="1"][data-footer-reveal-shadow="large_2"]').length > 0) { 13651 $('.container-wrap').css({ 13652 boxShadow: '0 70px 110px -30px ' + $footerOuterEl.css('backgroundColor') 13653 }); 13654 } 13655 13656 } 13657 13658 } 13659 13660 13661 13662 13663 13664 /** 13665 * Switch header navigation BG color to match row BG color that is passes. 13666 * 13667 * Only called when using "Header Inherit Row Color" option. 13668 * 13669 * @since 5.0 13670 */ 13671 function headerRowColorInheritInit() { 13672 13673 if ($('body[data-header-inherit-rc="true"]').length > 0 && $('.mobile').length == 0 && $('#header-outer[data-transparent-header="true"]').length > 0 ) { 13674 13675 var headerOffset = $logoHeight / 2 + headerPadding + nectarDOMInfo.adminBarHeight; 13676 13677 if( $('#header-outer[data-permanent-transparent="1"]').length == 0 ) { 13678 headerOffset = ($logoHeight - logoShrinkNum) + Math.ceil((headerPadding * 2) / 1.8) + nectarDOMInfo.adminBarHeight; 13679 } 13680 13681 $('.main-content > .row > .wpb_row').each(function () { 13682 13683 var $that = $(this); 13684 var $textColor; 13685 13686 var waypoint = new Waypoint({ 13687 element: $that, 13688 handler: function (direction) { 13689 13690 //User is scrolling down. 13691 if (direction == 'down') { 13692 13693 if ($that.find('.row-bg.using-bg-color').length > 0) { 13694 13695 $textColor = ($that.find('> .col.span_12.light').length > 0) ? 'light-text' : 'dark-text'; 13696 13697 $headerOuterEl 13698 .css('background-color', $that.find('.row-bg').css('background-color')) 13699 .removeClass('light-text') 13700 .removeClass('dark-text') 13701 .addClass($textColor); 13702 13703 $headerOuterEl.attr('data-current-row-bg-color', $that.find('.row-bg').css('background-color')); 13704 $('body.material #header-outer .bg-color-stripe').css('background-color', $that.find('.row-bg').css('background-color')); 13705 13706 } else { 13707 13708 $headerOuterEl 13709 .css('background-color', $headerOuterEl.attr('data-user-set-bg')) 13710 .removeClass('light-text') 13711 .removeClass('dark-text'); 13712 13713 $headerOuterEl.attr('data-current-row-bg-color', $headerOuterEl.attr('data-user-set-bg')); 13714 $('body.material #header-outer .bg-color-stripe').css('background-color', ''); 13715 13716 } 13717 13718 } 13719 13720 //User is scrolling up. 13721 else { 13722 13723 if ($that.prev('div.wpb_row').find('.row-bg.using-bg-color').length > 0) { 13724 13725 $textColor = ($that.prev('div.wpb_row').find('> .col.span_12.light').length > 0) ? 'light-text' : 'dark-text'; 13726 13727 $headerOuterEl 13728 .css('background-color', $that.prev('div.wpb_row').find('.row-bg').css('background-color')) 13729 .removeClass('light-text') 13730 .removeClass('dark-text') 13731 .addClass($textColor); 13732 13733 $headerOuterEl.attr('data-current-row-bg-color', $that.prev('div.wpb_row').find('.row-bg').css('background-color')); 13734 $('body.material #header-outer .bg-color-stripe').css('background-color', $that.prev('div.wpb_row').find('.row-bg').css('background-color')); 13735 13736 } else { 13737 13738 $headerOuterEl 13739 .css('background-color', $headerOuterEl.attr('data-user-set-bg')) 13740 .removeClass('light-text') 13741 .removeClass('dark-text'); 13742 13743 $headerOuterEl.attr('data-current-row-bg-color', $headerOuterEl.attr('data-user-set-bg')); 13744 $('body.material #header-outer .bg-color-stripe').css('background-color', ''); 13745 13746 } 13747 13748 } 13749 13750 }, 13751 offset: headerOffset 13752 13753 }); // End of waypoint bind. 13754 13755 }); // End of loop through rows. 13756 13757 } 13758 13759 } 13760 13761 13762 13763 /** 13764 * Page submenu sticky functionality 13765 * 13766 * @since 10.5.2 13767 */ 13768 13769 function stickyPageSubmenuInit() { 13770 13771 var $ = window.jQuery, 13772 Waypoint = window.Waypoint, 13773 $offsetHeight = calcHeaderNavHeight(), 13774 $headerHeight = calcHeaderNavHeight(); 13775 13776 $window.on('smartresize', function () { 13777 13778 $offsetHeight = calcHeaderNavHeight(); 13779 13780 if ($wpAdminBar.length > 0 && 13781 $wpAdminBar.css('position') == 'fixed') { 13782 $offsetHeight += $wpAdminBar.height(); 13783 } 13784 13785 if ($bodyBorderTop.length > 0 && 13786 $window.width() > 1000 && 13787 $('body[data-hhun="1"]').length > 0) { 13788 $offsetHeight += $bodyBorderTop.height(); 13789 } 13790 13791 // Recalc for resizing (same as stuck/unstuck logic below) 13792 if ($('.page-submenu.stuck').length > 0) { 13793 13794 $('.page-submenu.stuck') 13795 .addClass('no-trans') 13796 .css('top', $offsetHeight) 13797 .css('transform', 'translateY(0)').addClass('stuck'); 13798 13799 setTimeout(function () { 13800 $('.page-submenu.stuck').removeClass('no-trans'); 13801 }, 50); 13802 13803 $('.page-submenu.stuck') 13804 .parents('.wpb_row') 13805 .css('z-index', 10000); 13806 13807 // Boxed layout 13808 if ($('#boxed').length > 0) { 13809 13810 var $negMargin = ($window.width() > 1000) ? $('.container-wrap').width() * 0.04 : 39; 13811 13812 $('.page-submenu.stuck').css({ 13813 'margin-left': '-' + $negMargin + 'px', 13814 'width': $('.container-wrap').width() 13815 });
13816 13817 } 13818 13819 } else { 13820 13821 $('.page-submenu.stuck') 13822 .css('top', '0') 13823 .removeClass('stuck'); 13824 13825 $('.page-submenu.stuck') 13826 .parents('.wpb_row') 13827 .css('z-index', 'auto'); 13828 13829 if ($('#boxed').length > 0) { 13830 $('.page-submenu.stuck').css({ 13831 'margin-left': '0px', 13832 'width': '100%' 13833 }); 13834 } 13835 13836 } 13837 13838 }); 13839 13840 /* http://imakewebthings.com/waypoints/shortcuts/sticky-elements */ 13841 function Sticky(options) { 13842 this.options = $.extend({}, Waypoint.defaults, Sticky.defaults, options); 13843 this.element = this.options.element; 13844 this.$element = $(this.element); 13845 this.createWrapper(); 13846 this.createWaypoint(); 13847 } 13848 13849 /* Private */ 13850 Sticky.prototype.createWaypoint = function () { 13851 13852 var originalHandler = this.options.handler; 13853 13854 $offsetHeight = calcHeaderNavHeight(); 13855 13856 if ($wpAdminBar.length > 0 && $wpAdminBar.css('position') == 'fixed') { 13857 $offsetHeight += $wpAdminBar.height(); 13858 } 13859 13860 if ($bodyBorderTop.length > 0 && $window.width() > 1000 && $('body[data-hhun="1"]').length > 0) { 13861 $offsetHeight += $bodyBorderTop.height(); 13862 } 13863 13864 this.waypoint = new Waypoint($.extend({}, this.options, { 13865 element: this.wrapper, 13866 handler: $.proxy(function (direction) { 13867 var shouldBeStuck = this.options.direction.indexOf(direction) > -1; 13868 var wrapperHeight = shouldBeStuck ? this.$element.outerHeight(true) : ''; 13869 13870 this.$wrapper.height(wrapperHeight); 13871 if (shouldBeStuck) { 13872 13873 this.$element 13874 .addClass('no-trans') 13875 .css('top', $offsetHeight) 13876 .css('transform', 'translateY(0)') 13877 .addClass('stuck'); 13878 13879 var $that = this; 13880 13881 setTimeout(function () { 13882 $that.$element.removeClass('no-trans'); 13883 }, 50); 13884 13885 this.$element.parents('.wpb_row').css('z-index', 10000); 13886 13887 //boxed 13888 if ($('#boxed').length > 0) { 13889 var $negMargin = ($window.width() > 1000) ? $('.container-wrap').width() * 0.04 : 39; 13890 this.$element.css({ 13891 'margin-left': '-' + $negMargin + 'px', 13892 'width': $('.container-wrap').width() 13893 }); 13894 } 13895 13896 } else { 13897 this.$element.css('top', '0').removeClass('stuck'); 13898 13899 if ($('#boxed').length > 0) this.$element.css({ 13900 'margin-left': '0px', 13901 'width': '100%' 13902 }); 13903 } 13904 13905 if (originalHandler) { 13906 originalHandler.call(this, direction); 13907 } 13908 }, this), 13909 offset: $offsetHeight 13910 })); 13911 13912 var $that = this; 13913 13914 13915 setInterval(function () { 13916 13917 if ($('body[data-hhun="1"] #header-outer.detached:not(.invisible)').length > 0) { 13918 13919 var heightToAdjust = $headerOuterEl.outerHeight(); 13920 13921 if( $headerSecondaryEl.length > 0) { 13922 heightToAdjust -= nectarDOMInfo.secondaryHeaderHeight; 13923 } 13924 13925 $that.waypoint.options.offset = $offsetHeight + heightToAdjust; 13926 } 13927 else { 13928 $that.waypoint.options.offset = $offsetHeight; 13929 } 13930 13931 Waypoint.refreshAll(); 13932 13933 }, 100); 13934 13935 13936 }; 13937 13938 /* Private */ 13939 Sticky.prototype.createWrapper = function () { 13940 if (this.options.wrapper) { 13941 this.$element.wrap(this.options.wrapper); 13942 } 13943 this.$wrapper = this.$element.parent(); 13944 this.wrapper = this.$wrapper[0]; 13945 }; 13946 13947 /* Public */ 13948 Sticky.prototype.destroy = function () { 13949 13950 if (this.$element.parent()[0] === this.wrapper) { 13951 this.waypoint.destroy(); 13952 this.$element.removeClass(this.options.stuckClass); 13953 if (this.options.wrapper) { 13954 this.$element.unwrap(); 13955 } 13956 } 13957 13958 }; 13959 13960 Sticky.defaults = { 13961 wrapper: '<div class="sticky-wrapper" />', 13962 stuckClass: 'stuck', 13963 direction: 'down right' 13964 }; 13965
13966 Waypoint.Sticky = Sticky; 13967 13968 } 13969 13970 13971 13972 /** 13973 * Page submenu page builder element. 13974 * 13975 * @since 10.5 13976 */ 13977 13978 function pageSubmenuInit() { 13979 13980 if ($('.page-submenu[data-sticky="true"]').length > 0 && $('#nectar_fullscreen_rows').length == 0) { 13981 13982 stickyPageSubmenuInit(); 13983 13984 // Remove outside of column setups 13985 if ($('.page-submenu').parents('.span_12').find('> .wpb_column').length > 1) { 13986 13987 var pageMenu = $('.page-submenu').clone(), 13988 pageMenuParentRow = $('.page-submenu').parents('.wpb_row'); 13989 13990 $('.page-submenu').remove(); 13991 pageMenuParentRow.before(pageMenu); 13992 } 13993 13994 var sticky = new Waypoint.Sticky({ 13995 element: $('.page-submenu[data-sticky="true"]')[0] 13996 }); 13997 13998 } 13999 14000 // Adjust to be higher. 14001 if ($('#nectar_fullscreen_rows').length == 0) { 14002 14003 $('.page-submenu') 14004 .parents('.wpb_row') 14005 .css('z-index', 10000); 14006 } 14007 14008 // Bind events. 14009 $('.page-submenu .mobile-menu-link').on('click', function () { 14010 14011 $(this).parents('.page-submenu') 14012 .find('ul') 14013 .stop(true) 14014 .slideToggle(350); 14015 14016 return false; 14017 14018 }); 14019 14020 $('.page-submenu ul li a').on('click', function () { 14021 14022 if ($('body.mobile').length > 0) { 14023 $(this).parents('.page-submenu') 14024 .find('ul') 14025 .stop(true) 14026 .slideToggle(350); 14027 } 14028 14029 }); 14030 14031 } 14032 14033 14034 14035 14036 /** 14037 * Page builder full height row option. 14038 * 14039 * @since 8.0 14040 */ 14041 14042 function vcFullHeightRow() { 14043 14044 var $element = $(".vc_row-o-full-height:first"); 14045 if ($element.length) { 14046 14047 var windowHeight, offsetTop, fullHeight; 14048 windowHeight = $window.height(); 14049 14050 $(".vc_row-o-full-height").each(function () { 14051 14052 offsetTop = $(this).offset().top; 14053 14054 if (offsetTop < windowHeight && 14055 $(this).hasClass('top-level') && 14056 !nectarDOMInfo.usingFrontEndEditor) { 14057 14058 fullHeight = 100 - offsetTop / (windowHeight / 100); 14059 $(this).css("min-height", fullHeight + "vh"); 14060 $(this).find('> .col.span_12').css("min-height", fullHeight + "vh"); 14061 14062 } else { 14063 14064 $(this).css("min-height", windowHeight); 14065 $(this).find('> .col.span_12').css("min-height", windowHeight); 14066 14067 } 14068 14069 }); 14070 14071 } 14072 14073 } 14074 14075 14076 /** 14077 * Page builder full height row init. 14078 * 14079 * @since 10.5 14080 */ 14081 14082 function vcFullHeightRowInit() { 14083 14084 if( $('.vc_row-o-full-height').length > 0 ) { 14085 vcFullHeightRow(); 14086 $window.on('smartresize', vcFullHeightRow); 14087 } 14088 14089 } 14090 14091 14092 /** 14093 * Page builder equal height row IE helper. 14094 * 14095 * @since 8.0 14096 */ 14097 function fixIeFlexbox() { 14098 var ua = window.navigator.userAgent, 14099 msie = ua.indexOf("MSIE "); 14100 (msie > 0 || navigator.userAgent.match(/Trident.*rv\:11\./)) && $(".vc_row-o-full-height").each(function () { 14101 "flex" === $(this).find('> .span_12').css("display") && $(this).wrap('<div class="vc_ie-flexbox-fixer"></div>') 14102 }); 14103 14104 if( msie > 0 || navigator.userAgent.match(/Trident.*rv\:11\./)) { 14105 fixIE11Images(); 14106 $(window).on('resize',fixIE11Images); 14107 } 14108 14109 } 14110 14111 /** 14112 * Fix the IE11 bug with max-width 100% on imgs 14113 * 14114 * @since 11.0 14115 */ 14116 function fixIE11Images() { 14117 14118 $('.img-with-aniamtion-wrap img.img-with-animation').each(function() { 14119 14120 if( $(this).parents('.tabbed').length == 0 && $(this).parents('.toggle').length == 0 ) { 14121 14122 var $parentWrap = $(this).parents('.img-with-aniamtion-wrap'); 14123 $parentWrap.css({ 14124 'height' : '' 14125 }); 14126 var height = $(this).height(); 14127 14128 $parentWrap.css({ 14129 'height' : height 14130 }); 14131 14132 } 14133 14134 });
14135 14136 } 14137 14138 14139 14140 14141 14142 14143 14144 14145 14146 /** 14147 * Recent post height 14148 * 14149 * @since 10.5 14150 */ 14151 function recentPostsTitleOnlyEqualHeight() { 14152 14153 function recentPostHeight() { 14154 14155 $('.blog-recent[data-style="title_only"]').each(function () { 14156 14157 if ($(this).find('> .col').length > 1) { 14158 return false; 14159 } 14160 var $parentsSeletor = $(this).parent().parent().parent(); 14161 14162 if ($parentsSeletor.hasClass('vc_col-sm-3') || 14163 $parentsSeletor.hasClass('vc_col-sm-4') || 14164 $parentsSeletor.hasClass('vc_col-sm-6') || 14165 $parentsSeletor.hasClass('vc_col-sm-8') || 14166 $parentsSeletor.hasClass('vc_col-sm-9')) { 14167 14168 if ($('body.mobile').length == 0 && $(this).next('div').length == 0) { 14169 var tallestColumn = 0; 14170 14171 $(this).find('> .col').css('padding', '50px 20px'); 14172 14173 $(this).parents('.span_12').find(' > .wpb_column').each(function () { 14174 14175 if( Math.floor($(this).height()) > tallestColumn ) { 14176 tallestColumn = Math.floor($(this).height()); 14177 } 14178 14179 }); 14180 14181 if (Math.floor($(this).find('> .col').outerHeight(true)) < Math.floor($(this).parents('.wpb_row').height()) - 1) { 14182 $(this).find('> .col').css('padding-top', (tallestColumn - $(this).find('> .col').height()) / 2 + 'px'); 14183 $(this).find('> .col').css('padding-bottom', (tallestColumn - $(this).find('> .col').height()) / 2 + 'px'); 14184 } 14185 14186 } else { 14187 $(this).find('> .col').css('padding', '50px 20px'); 14188 } 14189 } 14190 }); 14191 14192 } 14193 14194 // Set heights. 14195 if( $('.blog-recent[data-style="title_only"]').length > 0 ) { 14196 recentPostHeight(); 14197 $window.on('smartresize',recentPostHeight); 14198 } 14199 14200 } 14201 14202 14203 14204 14205 14206 /** 14207 * Helper to calculate recent post slider height 14208 * 14209 * @since 7.0 14210 */ 14211 function recentPostSliderHeight() { 14212 14213 $('.nectar-recent-posts-slider').each(function () { 14214 14215 var $minHeight = 250, 14216 $definedHeight = parseInt($(this).attr('data-height')), 14217 dif = ($('body[data-ext-responsive="true"]').length > 0) ? $window.width() / 1400 : $window.width() / 1100, 14218 $sliderSelectors = $(this).find('.nectar-recent-post-slide, .flickity-viewport'); 14219 14220 if (nectarDOMInfo.winW > 1000 && $('#boxed').length == 0) { 14221 14222 if ($(this).parents('.full-width-content').length == 0) { 14223 14224 if ($('body[data-ext-responsive="true"]').length > 0 && nectarDOMInfo.winW >= 1400) { 14225 $sliderSelectors.css('height', Math.ceil($definedHeight)); 14226 } else if ($('body[data-ext-responsive="true"]').length == 0 && nectarDOMInfo.winW >= 1100) { 14227 $sliderSelectors.css('height', Math.ceil($definedHeight)); 14228 } else { 14229 $sliderSelectors.css('height', Math.ceil($definedHeight * dif)); 14230 } 14231 14232 } else { 14233 $sliderSelectors.css('height', Math.ceil($definedHeight * dif)); 14234 } 14235 14236 } else { 14237 14238 // Column sliders 14239 var $parentCol = ($(this).parents('.wpb_column').length > 0) ? $(this).parents('.wpb_column') : $(this).parents('.col'); 14240 14241 if ($parentCol.length == 0) { 14242 $parentCol = $('.main-content'); 14243 } 14244 14245 if (!$parentCol.hasClass('vc_span12') && 14246 !$parentCol.hasClass('main-content') && 14247 !$parentCol.hasClass('span_12') && 14248 !$parentCol.hasClass('vc_col-sm-12')) { 14249 14250 var $parentColWidth = sliderColumnDesktopWidth($parentCol), 14251 $aspectRatio = $definedHeight / $parentColWidth; 14252 14253 // Min height 14254 if ($aspectRatio * $parentCol.width() <= $minHeight) { 14255 $sliderSelectors.css('height', $minHeight); 14256 } else { 14257 $sliderSelectors.css('height', $aspectRatio * $parentCol.width()); 14258 } 14259 14260 } 14261 14262 // Regular 14263 else { 14264 14265 // Min height 14266 if ($definedHeight * dif <= $minHeight) { 14267 $sliderSelectors.css('height', $minHeight); 14268 } else { 14269 $sliderSelectors.css('height', Math.ceil($definedHeight * dif)); 14270 } 14271 14272 } 14273 14274 } 14275 14276 });
14277 14278 } 14279 14280 14281 function sliderColumnDesktopWidth(parentCol) { 14282 14283 var $parentColWidth = 1100, 14284 $columnNumberParsed = $(parentCol).attr('class').match(/\d+/); 14285 14286 if ($columnNumberParsed == '2') { 14287 $parentColWidth = 170 14288 } else if ($columnNumberParsed == '3') { 14289 $parentColWidth = 260 14290 } else if ($columnNumberParsed == '4') { 14291 $parentColWidth = 340 14292 } else if ($columnNumberParsed == '6') { 14293 $parentColWidth = 530 14294 } else if ($columnNumberParsed == '8') { 14295 $parentColWidth = 700 14296 } else if ($columnNumberParsed == '9') { 14297 $parentColWidth = 805 14298 } else if ($columnNumberParsed == '10') { 14299 $parentColWidth = 916.3 14300 } else if ($columnNumberParsed == '12') { 14301 $parentColWidth = 1100 14302 } 14303 14304 return $parentColWidth; 14305 } 14306 14307 14308 /** 14309 * Spit text into separate lines to animate in 14310 * 14311 * @since 7.0 14312 */ 14313 14314 function splitLineText() { 14315 $('.nectar-recent-posts-single_featured.multiple_featured').each(function () { 14316 14317 var $slideClass = ($(this).find('.project-slides').length > 0) ? '.project-slide' : '.nectar-recent-post-slide', 14318 $slideInfoClass = ($(this).find('.project-slides').length > 0) ? '.project-info h1' : '.inner-wrap h2 a'; 14319 14320 $(this).find($slideClass).each(function () { 14321 14322 $(this).find($slideInfoClass).each(function () { 14323 14324 var textArr = $(this).text(); 14325 textArr = textArr.trim(); 14326 textArr = textArr.split(' '); 14327 14328 $(this)[0].innerHTML = ''; 14329 14330 for (var i = 0; i < textArr.length; i++) { 14331 $(this)[0].innerHTML += '<span>' + textArr[i] + '</span> '; 14332 } 14333 14334 }); 14335 14336 $(this).find($slideInfoClass + ' > span').wrapInner('<span class="inner" />'); 14337 14338 }); 14339 14340 }); 14341 14342 } 14343 14344 14345 /** 14346 * Spit text into separate lines to animate in 14347 * 14348 * @since 7.0 14349 */ 14350 14351 function splitLineHeadingMarkup() { 14352 14353 $('.nectar-split-heading[data-animation-type="line-reveal-by-space"]').each(function () { 14354 14355 $(this).find('> *').each(function () { 14356 14357 var textArr = $(this).text(); 14358 textArr = textArr.trim(); 14359 textArr = textArr.split(' '); 14360 14361 $(this)[0].innerHTML = ''; 14362 14363 for (var i = 0; i < textArr.length; i++) { 14364 $(this)[0].innerHTML += '<span>' + textArr[i] + '</span> '; 14365 } 14366 14367 }); 14368 14369 if( !$(this).hasClass('animated-in') ) { 14370 $(this).find('> * > span').wrapInner('<span class="inner" />'); 14371 } else { 14372 $(this).find('> * > span').wrapInner('<span class="inner animated" />'); 14373 } 14374 14375 $(this).addClass('markup-generated'); 14376 14377 }); 14378 14379 $('.nectar-split-heading[data-animation-type="letter-fade-reveal"]').each(function () { 14380 14381 14382 $(this).find('> *').each(function () { 14383 14384 var textArr = $(this).text(); 14385 textArr = textArr.trim(); 14386 textArr = textArr.split(' '); 14387 14388 $(this)[0].innerHTML = ''; 14389 14390 for (var i = 0; i < textArr.length; i++) { 14391 $(this)[0].innerHTML += '<span>' + textArr[i] + '</span> '; 14392 } 14393 14394 }); 14395 14396 14397 $(this).find('span').each(function () { 14398 14399 var $this = $(this); 14400 var textArr = $(this).text().split(''); 14401 14402 $this.empty(); 14403 14404 $.each(textArr, function (i, el) { 14405 $this.append("<span>" + el + "</span"); 14406 }); 14407 14408 }); 14409 14410 $(this).addClass('markup-generated'); 14411 14412 }); 14413 14414 } 14415 14416 function splitLineHeadingInit() { 14417 14418 if( $('.nectar-split-heading[data-animation-type="line-reveal-by-space"]').length > 0 || $('.nectar-split-heading[data-animation-type="letter-fade-reveal"]').length > 0 ) { 14419 // Generate markup. 14420 splitLineHeadingMarkup(); 14421 } 14422 14423 } 14424 14425 14426 /** 14427 * Create recent post sliders 14428 * 14429 * @since 7.0 14430 */ 14431 function recentPostsFlickityInit() { 14432 14433 14434 if ($('.nectar-recent-posts-slider-inner').length > 0) { 14435 14436 var $rpFGroupCells = ($('.nectar-recent-posts-slider_multiple_visible').length > 0) ? '90%' : false; 14437 14438 var $rpF = $('.nectar-recent-posts-slider-inner').flickity({ 14439 contain: true, 14440 groupCells: $rpFGroupCells, 14441 draggable: true, 14442 lazyLoad: false, 14443 imagesLoaded: true, 14444 percentPosition: true,
14445 prevNextButtons: false, 14446 pageDots: true, 14447 resize: true, 14448 setGallerySize: true, 14449 wrapAround: true, 14450 accessibility: false 14451 }); 14452 14453 setTimeout(function () { 14454 $('.nectar-recent-posts-slider-inner').addClass('loaded'); 14455 }, 1150); 14456 var flkty = $rpF.data('flickity'); 14457 14458 $rpF.on('dragStart.flickity', function () { 14459 $('.flickity-viewport').addClass('is-moving'); 14460 }); 14461 14462 $rpF.on('dragEnd.flickity', function () { 14463 $('.flickity-viewport').removeClass('is-moving'); 14464 }); 14465 14466 var $dragTimeout; 14467 14468 $rpF.on('select.flickity', function () { 14469 14470 $('.flickity-viewport').addClass('no-hover'); 14471 clearTimeout($dragTimeout); 14472 $dragTimeout = setTimeout(function () { 14473 $('.flickity-viewport').removeClass('no-hover'); 14474 }, 400); 14475 14476 }); 14477 14478 recentPostSliderHeight(); 14479 $window.on('resize', recentPostSliderHeight); 14480 14481 if (!nectarDOMInfo.usingMobileBrowser && !nectarDOMInfo.usingFrontEndEditor) { 14482 $window.on('resize', recentPostSliderParallaxMargins); 14483 } 14484 14485 14486 } 14487 14488 14489 14490 // Multiple featured controls 14491 function multipleLargeFeaturedInit() { 14492 $('.nectar-recent-posts-single_featured.multiple_featured').each(function (sliderIndex) { 14493 14494 if ($(this).find('> .normal-container').length > 0) { 14495 $(this).find('> .normal-container').remove(); 14496 } 14497 14498 $(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>'); 14499 var $that = $(this); 14500 var tallestFeaturedSlide = 0; 14501 var $slideClickTimeout; 14502 14503 // Store instance 14504 $nectarCustomSliderRotate[sliderIndex] = { 14505 autorotate: '' 14506 }; 14507 14508 $(this).find('.nectar-recent-post-slide').each(function (i) { 14509 14510 if ($(this).find('.recent-post-container').height() > tallestFeaturedSlide) { 14511 $(this).siblings().removeClass('tallest'); 14512 $(this).addClass('tallest'); 14513 tallestFeaturedSlide = $(this).find('.recent-post-container').height(); 14514 } 14515 14516 var $activeClass = (i == 0 && $(this).parents('.nectar-recent-posts-single_featured.multiple_featured[data-autorotate="none"]').length > 0) ? 'class="active"' : ''; 14517 $that.find('.controls').append('<li ' + $activeClass + '><span class="title">' + $(this).find('h2').text() + '</span></li>'); 14518 }); 14519 14520 $(this).addClass('js-loaded'); 14521 14522 14523 // Click event 14524 $(this).find('.controls li').on('click', function (e) { 14525 14526 if ($(this).hasClass('active')) { 14527 return; 14528 } 14529 14530 if (e.originalEvent !== undefined) { 14531 $(this).parent().find('.active').addClass('trans-out'); 14532 } 14533 14534 var $index = $(this).index(), 14535 $oldIndex = $(this).parent().find('.active').index(), 14536 $that = $(this); 14537 14538 clearTimeout($slideClickTimeout); 14539 14540 $(this).siblings().removeClass('active'); 14541 $(this).addClass('active'); 14542 14543 $slideClickTimeout = setTimeout(function () { 14544 14545 $that.parents('.multiple_featured') 14546 .find('.nectar-recent-post-slide:not(:eq(' + $index + '))') 14547 .css('opacity', '0') 14548 .removeClass('active'); 14549 14550 $that.parent() 14551 .find('.trans-out') 14552 .removeClass('trans-out'); 14553 14554 }, 300); 14555 14556 $that.parents('.multiple_featured') 14557 .find('.nectar-recent-post-slide:not(:eq(' + $index + '))') 14558 .css('z-index', '10'); 14559 14560 $that.parents('.multiple_featured') 14561 .find('.nectar-recent-post-slide:eq(' + $oldIndex + ')') 14562 .css('z-index', '15'); 14563 14564 $(this).parents('.multiple_featured').find('.nectar-recent-post-slide').eq($index).css({ 14565 'opacity': '1', 14566 'z-index': '20' 14567 }).addClass('active'); 14568 14569 if ($(this).parents('.multiple_featured').attr('data-autorotate') != 'none') { 14570 nectarCustomSliderResetRotate($that.parents('.nectar-recent-posts-single_featured.multiple_featured'), sliderIndex); 14571 } 14572 });
14573 14574 14575 // Autorotate 14576 $that = $(this); 14577 14578 if ($(this).attr('data-autorotate').length > 0 && 14579 $(this).attr('data-autorotate') != 'none' && 14580 $('body.vc_editor').length == 0) { 14581 14582 setTimeout(function () { 14583 var slide_interval = (parseInt($that.attr('data-autorotate')) < 100) ? 4000 : parseInt($that.attr('data-autorotate')); 14584 14585 $nectarCustomSliderRotate[sliderIndex].autorotate = setInterval(function () { 14586 nectarCustomSliderRotate($that) 14587 }, slide_interval); 14588 14589 // Set first active class 14590 $that 14591 .find('.controls > li:first-child') 14592 .addClass('active'); 14593 14594 }, 30); 14595 14596 } 14597 14598 }); 14599 14600 splitLineText(); 14601 $window.on('resize', splitLineText); 14602 14603 } 14604 14605 multipleLargeFeaturedInit(); 14606 14607 } 14608 14609 14610 14611 /** 14612 * Default recent post slider parallax RAF loop. 14613 * 14614 * @since 7.0 14615 */ 14616 function recentPostSliderParallax() { 14617 14618 $('.nectar-recent-posts-slider').each(function () { 14619 14620 var $offset = parseInt($(this).find('.flickity-slider').position().left), 14621 $slides = $(this).find('.nectar-recent-post-slide'), 14622 $slideLength = $slides.length, 14623 $slideWidth = $slides.width(), 14624 $lastChildIndex = $(this).find('.nectar-recent-post-slide:last-child').index(), 14625 $slideFirstChildBG = $(this).find('.nectar-recent-post-slide:first-child .nectar-recent-post-bg'), 14626 $slideLastChildBG = $(this).find('.nectar-recent-post-slide:last-child .nectar-recent-post-bg'); 14627 14628 // First going to last 14629 if ($offset >= -3) { 14630 $slideLastChildBG.css('margin-left', parseInt(Math.ceil($slideWidth / 3.5)) + 'px'); 14631 } else { 14632 $slideLastChildBG.css('margin-left', '-' + parseInt(Math.ceil($slideWidth / 3.5 * $lastChildIndex)) + 'px'); 14633 } 14634 14635 // Last going to first 14636 if (Math.abs($offset) >= ($slideLength - 1) * $slideWidth) { 14637 $slideFirstChildBG.css('margin-left', '-' + parseInt(Math.ceil(($slideWidth / 3.5) * $slideLength)) + 'px'); 14638 } else { 14639 $slideFirstChildBG.css('margin-left', '0px'); 14640 } 14641 14642 $(this) 14643 .find('.nectar-recent-post-bg') 14644 .css('transform', 'translateX(' + Math.ceil($(this).find('.flickity-slider').position().left / -3.5) + 'px)'); 14645 14646 }); 14647 14648 requestAnimationFrame(recentPostSliderParallax); 14649 14650 } 14651 14652 /** 14653 * Default recent post slider margin calculations. 14654 * 14655 * @since 7.0 14656 */ 14657 function recentPostSliderParallaxMargins() { 14658 14659 $('.nectar-recent-posts-slider').each(function () { 14660 14661 var $slideWidth = $(this).find('.nectar-recent-post-slide').width(); 14662 14663 $(this).find('.nectar-recent-post-slide').each(function (i) { 14664 $(this).find('.nectar-recent-post-bg').css('margin-left', '-' + parseInt(Math.ceil($slideWidth / 3.5) * i) + 'px'); 14665 }); 14666 14667 }); 14668 14669 } 14670 14671 14672 14673 /** 14674 * Initialize all recent post elements. 14675 * 14676 * @since 7.0 14677 */ 14678 function recentPostsInit() { 14679 14680 // Start flickity based sliders. 14681 recentPostsFlickityInit(); 14682 14683 14684 // Classic enhanced specific 14685 $('.blog-recent[data-style="classic_enhanced_alt"] .inner-wrap').each(function () { 14686 $(this).find('.post-featured-img').each(function () { 14687 var $src = $(this).find('img').attr('src'); 14688 $(this).css('background-image', 'url(' + $src + ')'); 14689 }); 14690 }); 14691 14692 $('.blog-recent[data-style="classic_enhanced"]').each(function () { 14693 if ($(this).find('.inner-wrap.has-post-thumbnail').length == 0) { 14694 $(this).addClass('no-thumbs'); 14695 } 14696 }); 14697 14698 // Regular recent posts slider. 14699 if (!nectarDOMInfo.usingMobileBrowser) { 14700 if ($('.nectar-recent-posts-slider').length > 0 && !nectarDOMInfo.usingFrontEndEditor) { 14701 window.requestAnimationFrame(recentPostSliderParallax); 14702 } 14703 } 14704 14705 if (!nectarDOMInfo.usingMobileBrowser && !nectarDOMInfo.usingFrontEndEditor) { 14706 recentPostSliderParallaxMargins(); 14707 } 14708 14709 } 14710 14711 14712 14713 14714 /** 14715 * Parallax on mousemove effect 14716 * 14717 * @since 10.5 14718 */ 14719 function parallaxItemHoverEffect() { 14720 14721 //change sizer pos 14722 $('.style-5').each(function () { 14723 $(this) 14724 .find('.sizer') 14725 .insertBefore($(this).find('.parallaxImg')); 14726 });
14727 14728 // Set parent zindex 14729 $('.style-5') 14730 .parents('.wpb_row') 14731 .css('z-index', '100'); 14732 14733 var d = document, 14734 bd = d.getElementsByTagName('body')[0], 14735 win = window, 14736 imgs = d.querySelectorAll('.parallaxImg'), 14737 totalImgs = imgs.length, 14738 supportsTouch = 'ontouchstart' in win || navigator.msMaxTouchPoints; 14739 14740 if (totalImgs <= 0) { 14741 return; 14742 } 14743 14744 // Build HTML 14745 for (var l = 0; l < totalImgs; l++) { 14746 14747 var thisImg = imgs[l], 14748 layerElems = thisImg.querySelectorAll('.parallaxImg-layer'), 14749 totalLayerElems = layerElems.length; 14750 14751 if (totalLayerElems <= 0) { 14752 continue; 14753 } 14754 14755 while (thisImg.firstChild) { 14756 thisImg.removeChild(thisImg.firstChild); 14757 } 14758 14759 var lastMove = 0; 14760 14761 //throttle performance old browsers 14762 var eventThrottle = 80; 14763 if ( navigator.userAgent.indexOf("Chrome") > -1 && navigator.userAgent.indexOf("Edge/") < 1 ) { 14764 eventThrottle = 1; 14765 $('html').addClass('cssreflections'); 14766 } else { 14767 $body.addClass('cssreflections'); 14768 } 14769 14770 var containerHTML = d.createElement('div'), 14771 shineHTML = d.createElement('div'), 14772 shadowHTML = d.createElement('div'), 14773 layersHTML = d.createElement('div'), 14774 layers = []; 14775 14776 thisImg.id = 'parallaxImg__' + l; 14777 containerHTML.className = 'parallaxImg-container'; 14778 shadowHTML.className = 'parallaxImg-shadow'; 14779 layersHTML.className = 'parallaxImg-layers'; 14780 14781 for (var i = 0; i < totalLayerElems; i++) { 14782 14783 var layer = d.createElement('div'), 14784 layerInner = d.createElement('div'), 14785 imgSrc = layerElems[i].getAttribute('data-img'); 14786 14787 $(layer).html($(layerElems[i]).html()); 14788 layer.className = 'parallaxImg-rendered-layer'; 14789 layer.setAttribute('data-layer', i); 14790 14791 if (i == 0 && $(thisImg).parents('.wpb_gallery').length == 0) { 14792 layerInner.className = 'bg-img'; 14793 layerInner.style.backgroundImage = 'url(' + imgSrc + ')'; 14794 layer.appendChild(layerInner); 14795 } 14796 layersHTML.appendChild(layer); 14797 14798 layers.push(layer); 14799 } 14800 14801 containerHTML.appendChild(layersHTML); 14802 thisImg.appendChild(containerHTML); 14803 $(thisImg).wrap('<div class="parallaxImg-wrap" />'); 14804 if (!(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1)) { 14805 $(thisImg).parent().append(shadowHTML); 14806 } 14807 14808 if (supportsTouch && $('body.using-mobile-browser').length > 0) { 14809 // Stop processing. 14810 } else { 14811 (function (_thisImg, _layers, _totalLayers, _shine) { 14812 $(thisImg).parents('.style-5').on('mousemove', function (e) { 14813 14814 var parentEl = $(this); 14815 var parallaxContainer = parentEl.find('.parallaxImg-container'); 14816 var parallaxShad = parentEl.find('.parallaxImg-shadow'); 14817 14818 var now = Date.now(); 14819 14820 var usingGallery = ($(_thisImg).parents('.wpb_gallery').length > 0) ? true : false; 14821 14822 if (now > lastMove + eventThrottle) { 14823 lastMove = now; 14824 window.requestAnimationFrame(function () { 14825 processMovement(e, false, _thisImg, _layers, _totalLayers, _shine, parentEl, parallaxContainer, parallaxShad, usingGallery); 14826 }); 14827 } 14828 14829 14830 });
14831 $(thisImg).parents('.style-5').on('mouseenter', function (e) { 14832 processEnter(e, _thisImg, _layers, _totalLayers, _shine); 14833 }); 14834 $(thisImg).parents('.style-5').on('mouseleave', function (e) { 14835 processExit(e, _thisImg, _layers, _totalLayers, _shine); 14836 }); 14837 })(thisImg, layers, totalLayerElems, shineHTML); 14838 } 14839 14840 // Set the depths 14841 (function (_thisImg, _layers, _totalLayers, _shine) { 14842 depths(false, _thisImg, _layers, _totalLayers, _shine); 14843 window.addEventListener('resize', function () { 14844 depths(false, _thisImg, _layers, _totalLayers, _shine); 14845 }); 14846 })(thisImg, layers, totalLayerElems, shineHTML); 14847 } 14848 14849 function processMovement(e, touchEnabled, elem, layers, totalLayers, shine, parentEl, parallaxContainer, parallaxShad, usingGal) { 14850 14851 // Stop raf if exit already called 14852 if (!$(elem.firstChild).hasClass('over')) { 14853 processExit(e, elem, layers, totalLayers, shine); 14854 return false 14855 } 14856 14857 // Set up multipliers 14858 var yMult = 0.03; 14859 var xMult = 0.063; 14860 14861 var scaleAmount = '1.03'; 14862 var offsetAmount = '-10'; 14863 var usingMasonrySize = false; 14864 14865 if ($(elem).parents('.col.wide').length > 0) { 14866 yMult = 0.03; 14867 xMult = 0.063; 14868 usingMasonrySize = true; 14869 } else if ($(elem).parents('.col.regular').length > 0 || $(elem).parents('.wpb_gallery').length > 0) { 14870 yMult = 0.045; 14871 xMult = 0.045; 14872 } else if ($(elem).parents('.col.tall').length > 0) { 14873 yMult = 0.05; 14874 xMult = 0.015; 14875 usingMasonrySize = true; 14876 } else if ($(elem).parents('.col.wide_tall').length > 0) { 14877 yMult = 0.04; 14878 xMult = 0.04; 14879 usingMasonrySize = true; 14880 } else if (parentEl.hasClass('nectar-fancy-box')) { 14881 yMult = 0.045; 14882 xMult = 0.022; 14883 scaleAmount = '1.06'; 14884 offsetAmount = '-2'; 14885 } else { 14886 yMult = 0.045; 14887 xMult = 0.075; 14888 } 14889 14890 var bdst = nectarDOMInfo.scrollTop, 14891 bdsl = 0, 14892 pageX = (touchEnabled) ? e.touches[0].pageX : e.pageX, 14893 pageY = (touchEnabled) ? e.touches[0].pageY : e.pageY, 14894 offsets = elem.getBoundingClientRect(), 14895 w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth, 14896 h = elem.clientHeight || elem.offsetHeight || elem.scrollHeight, 14897 wMultiple = 320 / w, 14898 offsetX = 0.52 - (pageX - offsets.left - bdsl) / w, 14899 offsetY = 0.52 - (pageY - offsets.top - bdst) / h, 14900 dy = (pageY - offsets.top - bdst) - h / 2, 14901 dx = (pageX - offsets.left - bdsl) - w / 2, 14902 yRotate = (offsetX - dx) * (yMult * wMultiple), 14903 xRotate = (dy - offsetY) * (xMult * wMultiple); 14904 14905 var imgCSS; 14906 14907 if (usingGal == true) { 14908 imgCSS = ' perspective(' + w * 3 + 'px) rotateX(' + -xRotate * 1.9 + 'deg) rotateY(' + -yRotate * 1.3 + 'deg)'; 14909 } else { 14910 14911 if (usingMasonrySize == false) { 14912 imgCSS = ' perspective(' + w * 3 + 'px) rotateX(' + xRotate + 'deg) rotateY(' + yRotate + 'deg) translateY(' + offsetY * offsetAmount + 'px) translateX(' + offsetX * offsetAmount + 'px) scale(' + scaleAmount + ')'; 14913 } else { 14914 imgCSS = ' perspective(' + w * 3 + 'px) rotateX(' + xRotate + 'deg) rotateY(' + yRotate + 'deg) translateY(' + offsetY * -10 + 'px) translateX(' + offsetX * -10 + 'px) scale(1.013)'; 14915 } 14916 14917 } 14918 14919 14920 // Container transform 14921 parallaxContainer.css('transform', imgCSS); 14922 14923 if (!(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1)) { 14924 parallaxShad.css('transform', imgCSS); 14925 } 14926 14927 14928 } 14929 14930 14931 function processEnter(e, elem) { 14932 14933 elem.firstChild.className += ' over'; 14934 elem.className += ' over'; 14935 14936 $(elem).addClass('transition'); 14937 14938 if ($(elem).parents('.wpb_gallery').length > 0) { 14939 setTimeout(function () { 14940 $(elem).removeClass('transition'); 14941 }, 450); 14942 } else { 14943 setTimeout(function () { 14944 $(elem).removeClass('transition'); 14945 }, 200); 14946 } 14947 14948 } 14949 14950 14951 function processExit(e, elem) { 14952 14953 var w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth; 14954 var container = elem.firstChild; 14955 14956 container.className = container.className.replace(' over', ''); 14957 elem.className = elem.className.replace(' over', ''); 14958 $(container).css('transform', 'perspective(' + w * 3 + 'px) rotateX(0deg) rotateY(0deg) translateZ(0)'); 14959 $(elem).parents('.parallaxImg-wrap').find('.parallaxImg-shadow').css('transform', 'perspective(' + w * 3 + 'px) rotateX(0deg) rotateY(0deg) translateZ(0)'); 14960 14961 $(elem).addClass('transition'); 14962 setTimeout(function () { 14963 $(elem).removeClass('transition'); 14964 }, 200); 14965 14966 } 14967 14968 14969 function depths(touchEnabled, elem, layers, totalLayers) { 14970 14971 var w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth; 14972 var container = elem.firstChild; 14973 14974 // Set z 14975 for (var ly = 0; ly < totalLayers; ly++) { 14976 if (ly == 0) { 14977 $(layers[ly]).css('transform', 'translateZ(0px)'); 14978 } 14979 else { 14980 $(layers[ly]).css('transform', 'translateZ(' + (w * 3) / 27 * (ly * 1.1) + 'px) '); 14981 } 14982 14983 } 14984 14985 totalLayers = totalLayers + 3; 14986 14987 // Set perspective from beginning 14988 $(container).css('transform', 'perspective(' + w * 3 + 'px)'); 14989 14990 } 14991 14992 } 14993 14994 14995 /** 14996 * Fancy Box 14997 * 14998 * @since 11.0 14999 */ 15000 function nectarFancyBoxHover() { 15001 15002 if( $('.nectar-fancy-box[data-style="hover_desc"]').length == 0 ) { 15003 return false; 15004 } 15005 15006 var $hoverContentHeight = 0; 15007 15008 $('body').on('mouseenter touchstart','.nectar-fancy-box[data-style="hover_desc"]', function() { 15009 $hoverContentHeight = parseInt($(this).find('.hover-content').outerHeight(true)); 15010 $(this).addClass('hovered'); 15011 $(this).find('.heading-wrap').css('transform','translateY(-'+ $hoverContentHeight +'px)'); 15012 });
15013 15014 $('body').on('mouseleave touchend','.nectar-fancy-box[data-style="hover_desc"]', function() { 15015 $(this).removeClass('hovered'); 15016 $(this).find('.heading-wrap').css('transform','translateY(0)'); 15017 }); 15018 15019 } 15020 15021 15022 15023 /** 15024 * Mouse Follow Icon 15025 * 15026 * @since 11.0 15027 */ 15028 function NectarMouseFollowIcon(el,iconSelector) { 15029 15030 this.$el = el; 15031 this.$iconEl = this.$el.find(iconSelector); 15032 15033 this.elX = 0; 15034 this.elY = 0; 15035 15036 this.initialX = this.$el.width() / 2; 15037 this.initialY = this.$el.height() / 2; 15038 15039 this.elX = 0; 15040 this.elY = 0; 15041 15042 this.lastScroll = 0; 15043 this.scrollAdjust = 0; 15044 15045 this.lastX = this.initialX; 15046 this.lastY = this.initialY; 15047 this.activeFollow = false; 15048 15049 this.percentage = 0.13; 15050 this.percentageTimeout; 15051 15052 $window.on('resize', this.resizeEvent.bind(this)); 15053 this.mouseEvents(); 15054 this.rafLoop(); 15055 15056 } 15057 15058 NectarMouseFollowIcon.prototype.resizeEvent = function() { 15059 this.initialX = this.$el.width() / 2; 15060 this.initialY = this.$el.height() / 2; 15061 }; 15062 15063 NectarMouseFollowIcon.prototype.mouseEvents = function() { 15064 15065 var that = this; 15066 15067 that.$el.on('mouseenter', function(e) { 15068 15069 that.activeFollow = true; 15070 15071 that.elX = e.offsetX; 15072 that.elY = e.offsetY; 15073 15074 that.lastScroll = 0; 15075 15076 clearTimeout(that.percentageTimeout); 15077 that.percentageTimeout = setTimeout(function(){ 15078 that.percentage = 0.2; 15079 },700); 15080 }); 15081 15082 that.$el.on('mouseleave', function() { 15083 15084 that.activeFollow = false; 15085 that.lastScroll = 0; 15086 15087 clearTimeout(that.percentageTimeout); 15088 that.percentage = 0.13; 15089 }); 15090 15091 that.$el.on('mousemove', function(e){ 15092 that.elX = e.offsetX; 15093 that.elY = e.offsetY; 15094 that.lastScroll = 0; 15095 }); 15096 15097 $(window).on('scroll',function() { 15098 if( that.activeFollow == true && that.lastScroll == 0) { 15099 that.lastScroll = nectarDOMInfo.scrollTop; 15100 } 15101 }); 15102 15103 }; 15104 15105 15106 NectarMouseFollowIcon.prototype.rafLoop = function() { 15107 15108 if( this.activeFollow == true ) { 15109 15110 this.scrollAdjust = ( this.lastScroll > 0 ) ? nectarDOMInfo.scrollTop - this.lastScroll : 0; 15111 15112 this.lastY = linearInterpolate(this.lastY, this.elY + this.scrollAdjust, this.percentage); 15113 this.lastX = linearInterpolate(this.lastX, this.elX, this.percentage); 15114 } else { 15115 this.lastY = linearInterpolate(this.lastY, this.initialY, 0.13); 15116 this.lastX = linearInterpolate(this.lastX, this.initialX, 0.13); 15117 } 15118 15119 this.$iconEl.css({ 15120 'transform': 'translateX(' + this.lastX + 'px) translateY(' + this.lastY + 'px)' 15121 }); 15122 15123 requestAnimationFrame(this.rafLoop.bind(this)); 15124 15125 }; 15126 15127 15128 15129 15130 /** 15131 * Video Lightbox 15132 * 15133 * @since 11.0 15134 */ 15135 function nectarVideoLightbox() { 15136 15137 iconMouseFollowArr = []; 15138 15139 // Parent hover relationship. 15140 $body.on('mouseenter','.nectar_video_lightbox[data-parent-hover="1"]', function() { 15141 var $parentRow = $(this).parents('.wpb_row'); 15142 $parentRow.find('> .row-bg-wrap .row-bg, > .nectar-video-wrap .nectar-video-inner').addClass('transition'); 15143 $parentRow.find('> .row-bg-wrap .row-bg, > .nectar-video-wrap .nectar-video-inner').css({ 15144 'transform' : 'scale(1.08)' 15145 }); 15146 }); 15147 15148 $body.on('mouseleave','.nectar_video_lightbox[data-parent-hover="1"]', function() { 15149 var $parentRow = $(this).parents('.wpb_row'); 15150 $parentRow.find('> .row-bg-wrap .row-bg, > .nectar-video-wrap .nectar-video-inner').css({ 15151 'transform' : 'scale(1)' 15152 }); 15153 }); 15154 15155 // Mouse Indicator. 15156 $('.nectar-video-box').each(function(i){ 15157 15158 if( $(this).find('.play_button_mouse_follow') ) { 15159 15160 var $that = $(this); 15161 15162 $(this).imagesLoaded(function () { 15163 15164 // Follow mouse. 15165 if( !nectarDOMInfo.usingMobileBrowser ) { 15166 iconMouseFollowArr[i] = new NectarMouseFollowIcon($that, '.play_button_mouse_follow'); 15167 } 15168 15169 // Initial setup. 15170 var $playColor = ( $that.is('[data-mouse-icon-color]') && $that.attr('data-mouse-icon-color').length > 0 ) ? $that.attr('data-mouse-icon-color') : '#000'; 15171 15172 if( $that.is('[data-mouse-style="solid_color"]') ) { 15173 15174 $that.find('.play_button_mouse_follow').css({ 15175 'background-color': $playColor 15176 });
15177 } 15178 15179 $that.find('.play_button_mouse_follow').addClass('visible'); 15180 15181 }); 15182 15183 } 15184 15185 }); 15186 15187 } 15188 15189 15190 15191 /** 15192 * Salient slider rotation 15193 * 15194 * @since 10.5 15195 */ 15196 function nectarCustomSliderRotate(slider) { 15197 15198 if ($('body.vc_editor').length > 0) { 15199 return; 15200 } 15201 15202 var $controlSelector = (slider.find('.project-slides').length > 0) ? '.dot-nav > span' : '.controls > li', 15203 $controlSelectorInd = (slider.find('.project-slides').length > 0) ? 'span' : ' li', 15204 $slideLength = slider.find($controlSelector).length, 15205 $currentSlide = slider.find($controlSelector + '.active').index(); 15206 15207 if ($currentSlide + 1 == $slideLength) { 15208 slider.find($controlSelector + ':first-child').trigger('click'); 15209 } else { 15210 slider.find($controlSelector + '.active').next($controlSelectorInd).trigger('click'); 15211 } 15212 } 15213 15214 15215 /** 15216 * Salient slider rotation reset 15217 * 15218 * @since 10.5 15219 */ 15220 function nectarCustomSliderResetRotate(slider, index) { 15221 clearInterval($nectarCustomSliderRotate[index].autorotate); 15222 15223 // Reinit autorotate 15224 if (slider.attr('data-autorotate').length > 0) { 15225 var slide_interval = (parseInt(slider.attr('data-autorotate')) < 100) ? 4000 : parseInt(slider.attr('data-autorotate')); 15226 $nectarCustomSliderRotate[index].autorotate = setInterval(function () { 15227 nectarCustomSliderRotate(slider) 15228 }, slide_interval); 15229 } 15230 } 15231 15232 15233 15234 /** 15235 * Fullscreen recent project slider 15236 * 15237 * @since 10.5 15238 */ 15239 function fsProjectSliderInit() { 15240 15241 $fsProjectSliderArr = []; 15242 15243 if (typeof SalientRecentProjectsFullScreen === 'undefined') { 15244 return; 15245 } 15246 15247 $('.nectar_fullscreen_zoom_recent_projects').each(function (i) { 15248 $fsProjectSliderArr[i] = new SalientRecentProjectsFullScreen($(this)); 15249 }); 15250 15251 } 15252 15253 15254 15255 15256 15257 /** 15258 * Portfolio single template sticky sidebar 15259 * 15260 * @since 6.0 15261 */ 15262 function portfolioSidebarFollow() { 15263 15264 var sidebarFollow = $('.single-portfolio #sidebar').attr('data-follow-on-scroll'); 15265 15266 if ($('body.single-portfolio').length == 0 || $('#sidebar[data-follow-on-scroll]').length == 0) { 15267 return; 15268 } 15269 15270 sidebarFollow = $('.single-portfolio #sidebar').attr('data-follow-on-scroll'); 15271 15272 if (sidebarFollow == 1 && 15273 !$body.hasClass('mobile') && 15274 parseInt($('#sidebar').height()) + 50 <= parseInt($('.post-area').height())) { 15275 15276 //padding from top of screen 15277 var $ssExtraTopSpace = 50; 15278 15279 if ($('#header-outer[data-remove-fixed="0"]').length > 0 && 15280 $('body[data-hhun="1"]').length == 0) { 15281 15282 $ssExtraTopSpace += $headerOuterEl.outerHeight(); 15283 15284 // Resize effect 15285 if ($('#header-outer[data-shrink-num][data-header-resize="1"]').length > 0) { 15286 var headerPadding2 = parseInt($headerOuterEl.attr('data-padding')) - parseInt($headerOuterEl.attr('data-padding')) / 1.8; 15287 $ssExtraTopSpace -= logoShrinkNum; 15288 $ssExtraTopSpace -= headerPadding2; 15289 } 15290 15291 // Condense 15292 if ($('body.mobile').length == 0 && $('#header-outer[data-condense="true"]').length > 0) { 15293 15294 var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'); 15295 15296 $ssExtraTopSpace = 50; 15297 $ssExtraTopSpace += $headerOuterEl.height() - (parseInt($headerSpan9.position().top) - parseInt($('#header-outer #logo').css('margin-top'))) - parseInt(nectarDOMInfo.secondaryHeaderHeight); 15298 } 15299 15300 } 15301 15302 if ($wpAdminBar.length > 0) { 15303 $ssExtraTopSpace += $wpAdminBar.outerHeight(); 15304 } 15305 15306 15307 $('.single-portfolio #sidebar').theiaStickySidebar({ 15308 additionalMarginTop: $ssExtraTopSpace, 15309 updateSidebarHeight: false 15310 }); 15311 15312 15313 } 15314 15315 } 15316 15317 15318 15319 15320 15321 /** 15322 * Infinite scroll pagination 15323 * 15324 * @since 6.0 15325 */ 15326 function infiniteScrollInit() { 15327 15328 if ($('.infinite_scroll').length > 0) { 15329 15330 // Portfolio 15331 $('.portfolio-items.infinite_scroll').infinitescroll({ 15332 navSelector: "div#pagination", 15333 nextSelector: "div#pagination a:first", 15334 itemSelector: ".portfolio-items.infinite_scroll .element", 15335 finishedMsg: "<em>Congratulations, you've reached the end of the internet.</em>", 15336 msgText: " ", 15337 }, function (newElements) { 15338 15339 15340 var $container = $('.portfolio-items.infinite_scroll:not(.carousel)'), 15341 $newElems = $(newElements).css('opacity', 0); 15342 15343 // Ensure that images load before adding to masonry layout 15344 $newElems.imagesLoaded(function () { 15345 15346 $(newElements).css('opacity', 1); 15347 15348 $container.isotope('appended', $(newElements)); 15349 15350 $(newElements).find('.work-item').addClass('ajax-loaded'); 15351 $(newElements).addClass('ajax-loaded'); 15352
15353 // Show elems now they're ready 15354 $(newElements).find('.work-meta, .nectar-love-wrap').css({ 15355 'opacity': 1 15356 }); 15357 15358 // Keep current filtering 15359 if ($('.portfolio-filters-inline').length > 0 || $('.portfolio-filters').length > 0) { 15360 15361 var selector; 15362 15363 if ($('.portfolio-filters-inline').length > 0) { 15364 selector = $('.portfolio-filters-inline a.active').attr('data-filter'); 15365 } else { 15366 selector = $('.portfolio-filters a.active').attr('data-filter'); 15367 } 15368 15369 $('.portfolio-filters-inline a.active').attr('data-filter'); 15370 $container.isotope({ 15371 filter: selector 15372 }); 15373 } 15374 15375 // Set width 15376 for (var i = 0; i < $portfolio_containers.length; i++) { 15377 $portfolio_containers[i].reLayout(); 15378 } 15379 15380 if ($(newElements).find('.work-item.style-5').length > 0) { 15381 parallaxItemHoverEffect(); 15382 } 15383 15384 if ($(newElements).find('.inner-wrap').attr('data-animation') == 'none') { 15385 $('.portfolio-items .col .inner-wrap').removeClass('animated'); 15386 } else { 15387 15388 for (var i = 0; i < $portfolio_containers.length; i++) { 15389 $portfolio_containers[i].masonryZindex(); 15390 $portfolio_containers[i].portfolioAccentColor(); 15391 } 15392 15393 $(newElements).each(function () { 15394 15395 var $portfolioOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '90%'; 15396 15397 // Not already visible 15398 var $that = $(this); 15399 var waypoint = new Waypoint({ 15400 element: $that, 15401 handler: function () { 15402 15403 var $portfolioAnimationDelay = ($that.is('[data-masonry-type="photography"].masonry-items')) ? 85 : 115; 15404 15405 setTimeout(function () { 15406 $that.addClass("animated-in"); 15407 }, $portfolioAnimationDelay * $that.attr('data-delay-amount')); 15408 15409 15410 waypoint.destroy(); 15411 }, 15412 offset: $portfolioOffsetPos 15413 15414 }); 15415 15416 15417 }); 15418 } 15419 15420 15421 // Lightbox reinit. 15422 $('.portfolio-items').each(function () { 15423 var $unique_id = uniqueIdGenerate(); 15424 $(this).find('a[rel^="prettyPhoto"], a.pretty_photo').attr('rel', 'prettyPhoto[' + $unique_id + '_gal]').removeClass('pretty_photo'); 15425 });
15426 15427 15428 $('.portfolio-items').each(function () { 15429 var $unique_id = uniqueIdGenerate(); 15430 $(this).find('a[data-fancybox^="group_"]').attr('data-fancybox', 'group_' + $unique_id); 15431 }); 15432 15433 lightBoxInit(); 15434 15435 setTimeout(function () { 15436 15437 for (var i = 0; i < $portfolio_containers.length; i++) { 15438 $portfolio_containers[i].masonryZindex(); 15439 $portfolio_containers[i].reLayout(); 15440 $portfolio_containers[i].isotopeCatSelection(); 15441 } 15442 $(newElements).removeClass('ajax-loaded'); 15443 }, 700); 15444 15445 parallaxRowsBGCals(); 15446 15447 }); 15448 15449 15450 }); 15451 15452 // Blog 15453 $('.post-area.infinite_scroll .posts-container').infinitescroll({ 15454 navSelector: "div#pagination", 15455 nextSelector: "div#pagination a:first", 15456 itemSelector: ".post-area.infinite_scroll .posts-container .post", 15457 finishedMsg: "<em>Congratulations, you've reached the end of the internet.</em>", 15458 msgText: " " 15459 }, function (newElements) { 15460 15461 if($(newElements).find('[data-nectar-img-src]').length > 0) { 15462 nectarLazyImageLoading(); 15463 } 15464 15465 // Only trigger recalc of waypoints and elements if needed 15466 if ($('.masonry.classic').length > 0 || $('.post-area:not(.masonry):not(.featured_img_left)').length > 0 || $('.post-area.standard-minimal').length > 0) { 15467 15468 // Gallery 15469 flexsliderInit(); 15470 15471 15472 // Media players 15473 if ($().mediaelementplayer) { 15474 $(newElements).find('.wp-audio-shortcode, .wp-video-shortcode').mediaelementplayer(); 15475 } 15476 15477 15478 // Lightbox 15479 lightBoxInit(); 15480 15481 // Carousels 15482 if ($('.carousel').length > 0) { 15483 standardCarouselInit(); 15484 clientsCarouselInit(); 15485 } 15486 15487 // Waypoints 15488 waypoints(); 15489 15490 // Testimonial slider 15491 $('.testimonial_slider').animate({ 15492 'opacity': '1' 15493 }, 800); 15494 nectarTestimonialSliders(); 15495 nectarTestimonialSlidersEvents(); 15496 15497 setTimeout(function () { 15498 responsiveVideoIframesInit(); 15499 responsiveVideoIframes(); 15500 $window.trigger('resize'); 15501 }, 500); 15502 15503 15504 parallaxRowsBGCals(); 15505 15506 $window.trigger('resize'); 15507 15508 } // Non meta overlaid style 15509 else { 15510 parallaxRowsBGCals(); 15511 15512 $window.trigger('resize'); 15513 } 15514 15515 // Trigger Masonry as a callback 15516 var $container = $('.infinite_scroll .posts-container'); 15517 if ($container.parent().hasClass('masonry')) { 15518 15519 $(newElements).addClass('masonry-blog-item'); 15520 15521 15522 } //if masonry 15523 15524 15525 // Loading effect 15526 15527 //// hide new items while they are loading 15528 var $newElems = $(newElements); 15529 //// ensure that images load before adding to masonry layout 15530 15531 if ($newElems.find('img').length == 0) { 15532 $newElems = $('body'); 15533 } 15534 15535 $newElems.imagesLoaded(function () { 15536 15537 if ($container.parent().hasClass('masonry') && 15538 !$container.parent().hasClass('auto_meta_overlaid_spaced')) { 15539 $container.isotope('appended', $(newElements)); 15540 } 15541 15542 for (var i = 0; i < $nectarMasonryBlogs.length; i++) { 15543 $nectarMasonryBlogs[i].flickityBlogInit(); 15544 } 15545 15546 $(newElements).addClass('ajax-loaded');
15547 // Show elems now they're ready 15548 15549 15550 // Classic enhanced specific 15551 if ($container.parent().hasClass('classic_enhanced')) { 15552 $container.find('.large_featured.has-post-thumbnail.ajax-loaded .post-featured-img, .wide_tall.has-post-thumbnail.ajax-loaded .post-featured-img').each(function () { 15553 var $src = $(this).find('img').attr('src'); 15554 $(this).css('background-image', 'url(' + $src + ')'); 15555 }); 15556 15557 $container.find('.large_featured.ajax-loaded .nectar-flickity, .wide_tall.ajax-loaded .nectar-flickity').each(function () { 15558 15559 $(this).find('.cell').each(function () { 15560 var $src = $(this).find('img').attr('src'); 15561 $(this).css('background-image', 'url(' + $src + ')'); 15562 }); 15563 15564 }); 15565 } 15566 15567 15568 if ($(newElements).parents('.posts-container').attr('data-animation') == 'none') { 15569 $(newElements).find('.inner-wrap').removeClass('animated'); 15570 } else { 15571 15572 for (var i = 0; i < $nectarMasonryBlogs.length; i++) { 15573 $nectarMasonryBlogs[i].blogMasonryZindex(); 15574 } 15575 15576 $(newElements).each(function () { 15577 15578 var $that = $(this); 15579 var waypoint = new Waypoint({ 15580 15581 element: $that, 15582 handler: function () { 15583 15584 setTimeout(function () { 15585 $that.addClass("animated-in"); 15586 }, 80 * $that.attr('data-delay-amount')); 15587 15588 waypoint.destroy(); 15589 }, 15590 offset: '90%' 15591 15592 }); 15593 15594 15595 }); 15596 } 15597 15598 setTimeout(function () { 15599 $(newElements).removeClass('ajax-loaded'); 15600 }, 700); 15601 15602 15603 }); 15604 15605 15606 }); 15607 15608 } 15609 15610 } 15611 15612 15613 15614 15615 15616 15617 /** 15618 * Scroll to top scroll bind. 15619 * 15620 * @since 2.0 15621 */ 15622 function toTopBind() { 15623 15624 if ($('#to-top').length > 0 && $window.width() > 1020 || 15625 $('#to-top').length > 0 && $('#to-top.mobile-enabled').length > 0) { 15626 15627 if (nectarDOMInfo.scrollTop > 350) { 15628 $window.on('scroll', hideToTop); 15629 } else { 15630 $window.on('scroll', showToTop); 15631 } 15632 } 15633 15634 } 15635 15636 /** 15637 * Scroll to top show. 15638 * 15639 * @since 2.0 15640 */ 15641 function showToTop() { 15642 15643 if (nectarDOMInfo.scrollTop > 350 && !$offCanvasEl.is('.fullscreen.open') ) { 15644 15645 $('#to-top').stop().transition({ 15646 'bottom': '17px' 15647 }, 350, 'easeInOutCubic'); 15648 15649 $window.off('scroll', showToTop); 15650 $window.on('scroll', hideToTop); 15651 } 15652 15653 } 15654 15655 15656 /** 15657 * Scroll to top hide. 15658 * 15659 * @since 2.0 15660 */ 15661 function hideToTop() { 15662 15663 if (nectarDOMInfo.scrollTop < 350 || $offCanvasEl.is('.fullscreen.open') ) { 15664 15665 var $animationTiming = ($('#slide-out-widget-area.fullscreen.open').length > 0) ? 1150 : 350; 15666 15667 $('#to-top').stop().transition({ 15668 'bottom': '-30px' 15669 }, $animationTiming, 'easeInOutQuint'); 15670 15671 $window.off('scroll', hideToTop); 15672 $window.on('scroll', showToTop); 15673 15674 } 15675 } 15676 15677 15678 /** 15679 * Scroll to top initialization. 15680 * 15681 * @since 10.5 15682 */ 15683 function scrollToTopInit() { 15684 15685 // Show/hide based on scroll pos 15686 if ($('.nectar-social.fixed').length == 0) { 15687 toTopBind(); 15688 } 15689 15690 15691 // Rounded style 15692 if ($('body[data-button-style*="rounded"]').length > 0) { 15693 var $clone = $('#to-top .fa-angle-up').clone(); 15694 $clone.addClass('top-icon'); 15695 $('#to-top').prepend($clone); 15696 } 15697 15698 // Scroll up click event 15699 $body.on('click', '#to-top, a[href="#top"]', function () { 15700 $('body,html').stop().animate({ 15701 scrollTop: 0 15702 }, 800, 'easeOutQuad', function () { 15703 if ($('.nectar-box-roll').length > 0) { 15704 $body.trigger('mousewheel', [1, 0, 0]); 15705 } 15706 });
15707 return false; 15708 }); 15709 15710 } 15711 15712 15713 15714 15715 15716 15717 15718 15719 15720 /** 15721 * Scrollspy plugin initialization. 15722 * 15723 * @since 5.0 15724 */ 15725 function scrollSpyInit() { 15726 15727 var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $window.width() > 1000) ? 0 : $headerOuterEl.outerHeight(); 15728 15729 if ($('.page-template-template-no-header-footer').length > 0 || $('.page-template-template-no-header').length > 0) { 15730 $headerNavSpace = 0; 15731 } 15732 15733 //prevent jump to rop on empty items 15734 $('header#top .sf-menu li a[href="#"]').on('click', function (e) { 15735 e.preventDefault(); 15736 }); 15737 15738 if ($('#nectar_fullscreen_rows').length == 0 || $nectarFullPage.$usingFullScreenRows == false) { 15739 15740 $('a.nectar-next-section').each(function () { 15741 15742 if ($(this).parents('.wpb_row:not(.inner_row)').length > 0) { 15743 15744 var $parentRow = $(this).parents('.wpb_row:not(.inner_row)'), 15745 $parentRowIndex = $(this).parents('.wpb_row:not(.inner_row)').index(); 15746 15747 if ($parentRow.parent().find('> .wpb_row[id]:eq(' + ($parentRowIndex + 1) + ')').length > 0) { 15748 var $nextRowID = $parentRow.parent().find('> .wpb_row:eq(' + ($parentRowIndex + 1) + ')').attr('id'); 15749 $(this).attr('href', '#' + $nextRowID); 15750 } 15751 15752 } 15753 15754 }); 15755 } 15756 15757 else if ($().fullpage) { 15758 $('a.nectar-next-section').on('click', function () { 15759 $.fn.fullpage.moveSectionDown(); 15760 return false; 15761 }); 15762 } 15763 15764 15765 // Links in off canvas menu. 15766 if ($('#slide-out-widget-area .off-canvas-menu-container').length > 0) { 15767 $('#slide-out-widget-area .off-canvas-menu-container').find("a[href*='" + location.pathname + "']").each(function () { 15768 15769 var $href = $(this).attr('href'); 15770 15771 // Regular animated anchors. 15772 if ($href != '#' && 15773 $href.indexOf("#") != -1 && 15774 $href.substr($href.indexOf("#")) !== '#' && 15775 $('div' + $href.substr($href.indexOf("#"))).length > 0) { 15776 15777 $(this).attr('href', $href.substr($href.indexOf("#"))); 15778 15779 $(this).parent() 15780 .removeClass('current_page_item') 15781 .removeClass('current-menu-item'); 15782 } 15783 15784 // Fullpage is a little different. 15785 if ($('div[data-fullscreen-anchor-id="' + $href.substr($href.indexOf("#") + 1) + '"]').length > 0) { 15786 15787 $(this).parent() 15788 .removeClass('current_page_item') 15789 .removeClass('current-menu-item'); 15790 } 15791 15792 }); 15793 } 15794 15795 // Links in header navigation. 15796 $("#header-outer").find("a[href*='" + location.pathname + "']").each(function () { 15797 15798 var $href = $(this).attr('href'); 15799 15800 // Regular animated anchors 15801 if ($href.indexOf("#") != -1 && 15802 $href.substr($href.indexOf("#")) !== '#' && 15803 $('div' + $href.substr($href.indexOf("#"))).length > 0) { 15804 15805 $(this).attr('href', $href.substr($href.indexOf("#"))); 15806 $(this).parent() 15807 .removeClass('current_page_item') 15808 .removeClass('current-menu-item'); 15809 } 15810 15811 // Fullpage is a little different 15812 if ($('div[data-fullscreen-anchor-id="' + $href.substr($href.indexOf("#") + 1) + '"]').length > 0) { 15813 15814 $(this).parent() 15815 .removeClass('current_page_item') 15816 .removeClass('current-menu-item'); 15817 } 15818 15819 }); 15820 15821 // Start scrollspy. 15822 var $target = ($('.page-submenu[data-sticky="true"]').length == 0) ? '#header-outer nav' : '.page-submenu'; 15823 $body.scrollspy({ 15824 target: $target, 15825 offset: $headerNavSpace + nectarDOMInfo.adminBarHeight + 40 15826 }); 15827 15828 } 15829 15830 15831 15832 15833 /** 15834 * Called to scroll to hash link on page load 15835 * 15836 * @since 5.0 15837 */ 15838 function pageLoadHash() { 15839 15840 var $hash = window.location.hash; 15841 15842 if( $hash && $hash.length > 0 ) { 15843 $hash = $hash.replace(/<|>/g,''); 15844 } 15845 15846 var $hashSubstrng = ($hash && $hash.length > 0) ? $hash.substring(1, $hash.length) : 0, 15847 headerPadding2 = headerPadding - headerPadding / 1.8, 15848 $hasSlashLength = 0; 15849 15850 // If the hash has slashes 15851 if ($hashSubstrng) { 15852 $hasSlashLength = $hashSubstrng.split("/"); 15853 $hasSlashLength = $hasSlashLength.length; 15854 } 15855 15856 if ($hashSubstrng && $hasSlashLength > 1) { 15857 $hashSubstrng = $hashSubstrng.replace(/\//g, ""); 15858 $hash = $hash.replace(/\//g, ""); 15859 } 15860 15861 if ($hash && $('.main-content').find($hash).length > 0 || 15862 $hash && $('.main-content').find('[data-fullscreen-anchor-id="' + $hashSubstrng + '"]').length > 0) { 15863 15864 var $hashObj = ($('.main-content').find($hash).length > 0) ? $('.main-content').find($hash) : $('.main-content').find('[data-fullscreen-anchor-id="' + $hashSubstrng + '"]'), 15865 $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $window.width() > 1000) ? 0 : $('#header-space').outerHeight(); 15866 15867 if ($('.page-template-template-no-header-footer').length > 0 || $('.page-template-template-no-header').length > 0) { 15868 $headerNavSpace = 0; 15869 } 15870 15871 var $timeoutVar = 0; 15872 15873 if ($('.nectar-box-roll').length > 0 && $('.container-wrap.bottomBoxOut').length > 0) { 15874 nectarBoxRoll.boxRoll(null, -1); 15875 $timeoutVar = 2050; 15876 } 15877 15878 setTimeout(function () { 15879 15880 var $scrollTopDistance; 15881 15882 if ($('body[data-permanent-transparent="1"]').length == 0) { 15883 15884 if (!$body.hasClass('mobile')) { 15885 var $resize = ($('#header-outer[data-header-resize="0"]').length > 0) ? 0 : parseInt(logoShrinkNum) + headerPadding2 * 2; 15886 if ($('#header-outer[data-remove-fixed="1"]').length > 0) { 15887 $headerNavSpace = 0; 15888 } 15889 $scrollTopDistance = $hashObj.offset().top - parseInt($headerNavSpace) + $resize + 3 - nectarDOMInfo.adminBarHeight; 15890 15891 15892 // Condense 15893 if ($('body.mobile').length == 0 && $('#header-outer[data-condense="true"]').length > 0) { 15894 15895 var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'), 15896 $headerHeightStored = $headerOuterEl.height(),
15897 $headerHeightCondensed = $headerHeightStored - (parseInt($headerSpan9.height()) + parseInt($('#header-outer #logo').css('margin-top'))); 15898 15899 $scrollTopDistance = $hashObj.offset().top - parseInt($headerNavSpace) + $headerHeightCondensed - nectarDOMInfo.adminBarHeight; 15900 } 15901 15902 } else { 15903 $scrollTopDistance = ($('#header-outer[data-mobile-fixed="1"]').length > 0) ? $hashObj.offset().top + 2 - $headerNavSpace + nectarDOMInfo.adminBarHeight : $hashObj.offset().top - nectarDOMInfo.adminBarHeight + 1; 15904 } 15905 15906 } else { 15907 $scrollTopDistance = $hashObj.offset().top - nectarDOMInfo.adminBarHeight + 1; 15908 } 15909 15910 if ($('body[data-hhun="1"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length == 0) { 15911 15912 // Alter offset 15913 if ($('#header-outer.detached').length == 0) { 15914 $scrollTopDistance = $scrollTopDistance + $headerNavSpace; 15915 } 15916 } 15917 15918 var $pageSubMenu = ($('.page-submenu[data-sticky="true"]').length > 0) ? $('.page-submenu').height() : 0; 15919 var $headerSecondary; 15920 15921 if ($('body.material').length > 0 && 15922 $headerSecondaryEl.length > 0 && 15923 $('body[data-hhun="1"]').length == 0 && 15924 $('#header-outer[data-remove-fixed="1"]').length == 0 && 15925 !$body.hasClass('mobile')) { 15926 15927 $headerSecondary = $headerSecondaryEl.height(); 15928 15929 } else { 15930 $headerSecondary = 0; 15931 } 15932 15933 nectar_scrollToY($scrollTopDistance - $pageSubMenu + $headerSecondary, 700, 'easeInOutQuint'); 15934 15935 }, $timeoutVar); 15936 } 15937 } 15938 15939 15940 /** 15941 * Initialize page load hash functionality 15942 * 15943 * @since 10.5 15944 */ 15945 function pageLoadHashInit() { 15946 15947 if ($('body[data-animated-anchors="true"]').length > 0) { 15948 if ($('.nectar-box-roll').length == 0 && $('#nectar_fullscreen_rows').length == 0) { 15949 15950 // Inside tabs 15951 if (typeof nectarGetQueryParam['tab'] != 'undefined') { 15952 setTimeout(function () { 15953 pageLoadHash(); 15954 }, 800); 15955 } 15956 // Regular 15957 else { 15958 pageLoadHash(); 15959 } 15960 15961 } 15962 15963 if ($('#nectar_fullscreen_rows[data-mobile-disable="on"]').length > 0 && $('.nectar-box-roll').length == 0 && 15964 nectarDOMInfo.usingMobileBrowser) { 15965 pageLoadHash(); 15966 } 15967 15968 } 15969 15970 } 15971 15972 15973 /** 15974 * Animated anchor link theme option. 15975 * 15976 * @since 10.5 15977 */ 15978 function animatedAnchorLinks() { 15979 15980 if ($('body[data-animated-anchors="true"]').length > 0 || 15981 $('.single-product [data-gallery-style="left_thumb_sticky"]').length > 0) { 15982 15983 var headerPadding2 = headerPadding - headerPadding / 1.8; 15984 15985 setTimeout(scrollSpyInit, 200); 15986 15987 var $animatedScrollingTimeout; 15988 15989 $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) { 15990 15991 var $hash = $(this).prop("hash"); 15992 15993 if( !$(this).hasClass('nectar-next-section') && headerHideUntilNeeded == '1' ) { 15994 $body.addClass('animated-scrolling'); 15995 } 15996 15997 clearTimeout($animatedScrollingTimeout); 15998 15999 $animatedScrollingTimeout = setTimeout(function () { 16000 $body.removeClass('animated-scrolling'); 16001 }, 850); 16002 16003 var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $window.width() > 1000) ? 0 : $('#header-space').outerHeight(); 16004 16005 if ($('.page-template-template-no-header-footer').length > 0 || $('.page-template-template-no-header').length > 0) { 16006 $headerNavSpace = 0; 16007 } 16008 16009 if ($hash && $body.find($hash).length > 0 && $hash != '#top' && $hash != '' && $(this).attr('href').indexOf(window.location.href.split("#")[0]) !== -1 || 16010 $(this).is('[href^="#"]') && $hash != '' && $body.find($hash).length > 0 && $hash != '#top') { 16011 16012 //update hash 16013 if (!$(this).hasClass('skip-hash')) { 16014 if (history.pushState) { 16015 history.pushState(null, null, $hash); 16016 } else { 16017 location.hash = $hash; 16018 } 16019 } 16020 16021 if ($(this).parents('ul').length > 0) { 16022 16023 $(this) 16024 .parents('ul') 16025 .find('li') 16026 .removeClass('current-menu-item'); 16027 } 16028 16029 // Side widget area click 16030 if ($(this).parents('#slide-out-widget-area').length > 0) { 16031
16032 if ($('body.material[data-slide-out-widget-area-style="slide-out-from-right"].material-ocm-open').length > 0) { 16033 16034 $('body > .slide_out_area_close') 16035 .addClass('non-human-allowed') 16036 .trigger('click'); 16037 16038 // Sroll 16039 var $clickedLinkStore = $(this); 16040 16041 setTimeout(function () { 16042 $clickedLinkStore.trigger('click'); 16043 }, 1000); 16044 16045 } else { 16046 $('#slide-out-widget-area .slide_out_area_close') 16047 .addClass('non-human-allowed') 16048 .trigger('click'); 16049 } 16050 16051 setTimeout(function () { 16052 if ($('body.material[data-slide-out-widget-area-style="slide-out-from-right"]').length > 0) { 16053 $('body > .slide_out_area_close').removeClass('non-human-allowed'); 16054 16055 } else { 16056 $('#slide-out-widget-area .slide_out_area_close').removeClass('non-human-allowed'); 16057 } 16058 }, 100); 16059 } 16060 16061 // Mobile menu click 16062 if ( $(this).parents('#mobile-menu').length > 0 ) { 16063 $('.slide-out-widget-area-toggle.mobile-icon a') 16064 .addClass('non-human-allowed') 16065 .trigger('click'); 16066 16067 setTimeout(function () { 16068 $('.slide-out-widget-area-toggle.mobile-icon a').removeClass('non-human-allowed'); 16069 }, 100); 16070 } 16071 16072 var $mobileMenuHeight = ($(this).parents('#mobile-menu').length > 0) ? $(this).parents('#mobile-menu').height() : null; 16073 var $timeoutVar = 1; 16074 var $that = $(this); 16075 16076 if ($('.nectar-box-roll').length > 0 && $('.container-wrap.bottomBoxOut').length > 0) { 16077 nectarBoxRoll.boxRoll(null, -1); 16078 $timeoutVar = 2050; 16079 } 16080 16081 16082 setTimeout(function () { 16083 16084 var $scrollTopDistance; 16085 16086 // Scrolling 16087 if ($('body[data-permanent-transparent="1"]').length == 0) { 16088 16089 if (!$body.hasClass('mobile')) { 16090 var $resize = ($('#header-outer[data-header-resize="0"]').length > 0) ? 0 : parseInt(logoShrinkNum) + headerPadding2 * 2; 16091 if ($('#header-outer[data-remove-fixed="1"]').length > 0) { 16092 $headerNavSpace = 0; 16093 } 16094 16095 $scrollTopDistance = $($hash).offset().top - $mobileMenuHeight - parseInt($headerNavSpace) + $resize + 3 - nectarDOMInfo.adminBarHeight; 16096 16097 // Condense 16098 if ($('body.mobile').length == 0 && $('#header-outer[data-condense="true"]').length > 0) { 16099 16100 var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'), 16101 $headerHeightStored = $headerOuterEl.height(),
16102 $headerHeightCondensed = $headerHeightStored - (parseInt($headerSpan9.height()) + parseInt($('#header-outer #logo').css('margin-top'))); 16103 $scrollTopDistance = $($hash).offset().top - parseInt($headerNavSpace) + $headerHeightCondensed - nectarDOMInfo.adminBarHeight; 16104 16105 } 16106 16107 16108 } else { 16109 $scrollTopDistance = ($('#header-outer[data-mobile-fixed="1"]').length > 0) ? $($hash).offset().top + 2 - $headerNavSpace + nectarDOMInfo.adminBarHeight : $($hash).offset().top - $mobileMenuHeight - nectarDOMInfo.adminBarHeight + 1; 16110 } 16111 16112 } else { 16113 $scrollTopDistance = $($hash).offset().top - nectarDOMInfo.adminBarHeight + 1; 16114 } 16115 16116 if ($('body[data-hhun="1"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length == 0) { 16117 16118 // Alter offset 16119 if ($('#header-outer.detached').length == 0 || $that.parents('.page-submenu[data-sticky="true"]').length > 0) { 16120 $scrollTopDistance = $scrollTopDistance + $headerNavSpace; 16121 } 16122 16123 // Hide top header 16124 if ($that.parents('.page-submenu[data-sticky="true"]').length > 0) { 16125 16126 $('#header-outer.detached').addClass('invisible'); 16127 $('.page-submenu') 16128 .addClass('header-not-visible') 16129 .css('transform', 'translateY(0px)'); 16130 16131 } 16132 } 16133 16134 var $pageSubMenu = ($that.parents('.page-submenu[data-sticky="true"]').length > 0) ? $that.parents('.page-submenu').height() : 0; 16135 var $headerSecondary; 16136 16137 if ($('body.material').length > 0 && 16138 $headerSecondaryEl.length > 0 && 16139 $('body[data-hhun="1"]').length == 0 && 16140 $('#header-outer[data-remove-fixed="1"]').length == 0 && 16141 !$body.hasClass('mobile')) { 16142 16143 $headerSecondary = $headerSecondaryEl.height(); 16144 16145 } else { 16146 16147 if($('body[data-hhun="1"]').length > 0 && 16148 $headerSecondaryEl.length > 0 && 16149 !$body.hasClass('mobile') && 16150 $('#header-outer[data-remove-fixed="1"]').length == 0) { 16151 $headerSecondary = $headerSecondaryEl.height(); 16152 } else { 16153 $headerSecondary = 0; 16154 } 16155 16156 } 16157 16158 16159 nectar_scrollToY($scrollTopDistance - $pageSubMenu + $headerSecondary, 700, 'easeInOutQuint'); 16160 16161 }, $timeoutVar); 16162 16163 e.preventDefault(); 16164 16165 } 16166 16167 if ($hash == '#top') { 16168 // Side widget area click 16169 if ($(this).parents('#slide-out-widget-area').length > 0) { 16170 $('#slide-out-widget-area .slide_out_area_close').trigger('click'); 16171 } 16172 } 16173 16174 }); 16175 16176 16177 } 16178 16179 } 16180 16181 16182 16183 16184 16185 16186 /** 16187 * Search results masonry layout. 16188 * 16189 * @since 10.0 16190 */ 16191 function searchResultMasonry() { 16192 16193 var $searchContainer = $('#search-results'), 16194 $dividerNum = ($searchContainer.is('[data-layout="masonry-no-sidebar"]')) ? 4 : 3; 16195 16196 $searchContainer.imagesLoaded(function () { 16197 16198 $searchContainer.isotope({ 16199 itemSelector: '.result', 16200 layoutMode: 'packery', 16201 packery: { 16202 columnWidth: $('#search-results').width() / $dividerNum 16203 } 16204 }); 16205 16206 $searchContainer 16207 .find('article') 16208 .css('opacity', '1'); 16209 16210 }); 16211 16212 $window.on('resize', function () { 16213 $searchContainer.isotope({ 16214 layoutMode: 'packery', 16215 packery: { 16216 columnWidth: $('#search-results').width() / $dividerNum 16217 } 16218 }); 16219 }); 16220 16221 } 16222 16223 16224 /** 16225 * Search results masonry layout initialization. 16226 * 16227 * @since 10.5 16228 */ 16229 function searchResultMasonryInit() { 16230 if ($('body.search-results').length > 0 && 16231 $('#search-results article').length > 0 && 16232 $('#search-results[data-layout="list-no-sidebar"]').length == 0) { 16233 searchResultMasonry(); 16234 } 16235 } 16236 16237 16238 16239 16240 /** 16241 * Custom colors for portfolio grid elements. 16242 * 16243 * @since 10.5 16244 */ 16245 function portfolioCustomColoring() { 16246 16247 //portfolio colors 16248 if ($('.portfolio-items .col .style-3-alt').length > 0 || 16249 $('.portfolio-items .col .style-3').length > 0 || 16250 $('.portfolio-items .col .style-2').length > 0 || 16251 $('.portfolio-items .col .style-5').length > 0) { 16252 16253 var portfolioColorCss = ''; 16254 16255 $('.portfolio-items .col').each(function () { 16256 16257 var $titleColor = $(this).attr('data-title-color'), 16258 $subTitleColor = $(this).attr('data-subtitle-color'); 16259 16260 if ($titleColor.length > 0) { 16261 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; } '; 16262 portfolioColorCss += ' .portfolio-items[data-ps="8"] .col[data-title-color="' + $titleColor + '"] .line { background-color: ' + $titleColor + '; }'; 16263 portfolioColorCss += '.portfolio-items[data-ps="8"] .col[data-title-color="' + $titleColor + '"] .next-arrow line { stroke: ' + $titleColor + '; } '; 16264 } 16265 if ($subTitleColor.length > 0) { 16266 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; } '; 16267 } 16268 16269 });
16270 16271 //style 16272 nectarCreateStyle(portfolioColorCss, 'nectar-portfolio-colors'); 16273 16274 } 16275 16276 } 16277 16278 16279 16280 16281 /** 16282 * Single post pagination/recent post mouse events 16283 * 16284 * @since 10.5 16285 */ 16286 function postMouseEvents() { 16287 16288 16289 $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 () { 16290 $(this).parents('.grav-wrap') 16291 .find('img') 16292 .addClass('hovered'); 16293 }); 16294 16295 $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 () { 16296 $(this).parents('.grav-wrap') 16297 .find('img') 16298 .removeClass('hovered'); 16299 }); 16300 16301 $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 () { 16302 $(this).addClass('mouse-leaving'); 16303 }); 16304 16305 } 16306 16307 16308 16309 16310 /** 16311 * Masonry portfolio initialization. 16312 * 16313 * @since 10.5 16314 */ 16315 function masonryPortfolioInit() { 16316 16317 $portfolio_containers = []; 16318 16319 $('.portfolio-items:not(.carousel)').each(function (i) { 16320 16321 $(this).attr('instance', i); 16322 $(this).parent().parent().find('div[class^=portfolio-filters]').attr('instance', i); 16323 16324 if (typeof SalientPortfolio !== 'undefined') { 16325 $portfolio_containers[i] = new SalientPortfolio($(this), fullWidthContentColumns); 16326 } 16327 16328 }); 16329 16330 } 16331 16332 16333 16334 16335 /** 16336 * Perspective load in styling. 16337 * 16338 * @since 8.0 16339 */ 16340 function updatePerspectiveOrigin() { 16341 16342 if( nectarDOMInfo.winW > 690 ) { 16343 $('.posts-container[data-load-animation="perspective"]').css('perspective-origin', '50% ' + (nectarDOMInfo.scrollTop + nectarDOMInfo.winH) + 'px'); 16344 } 16345 requestAnimationFrame(updatePerspectiveOrigin); 16346 16347 } 16348 16349 16350 /** 16351 * Perspective load in styling. 16352 * 16353 * @since 8.0 16354 */ 16355 function updatePerspectiveOriginInit() { 16356 16357 if ($('.posts-container[data-load-animation="perspective"]').length > 0) { 16358 requestAnimationFrame(updatePerspectiveOrigin); 16359 } 16360 16361 } 16362 16363 16364 16365 /** 16366 * Blog load in animation. 16367 * 16368 * @since 3.0 16369 */ 16370 function blogLoadIn(post_container) { 16371 16372 if (post_container.attr('data-load-animation') == 'none') { 16373 16374 post_container 16375 .find('.inner-wrap') 16376 .removeClass('animated'); 16377 16378 } else { 16379 16380 post_container.find('article').each(function (i) { 16381 16382 // Loaded visible 16383 if ($(this).visible(true)) { 16384 16385 $(this).delay(110 * i).queue(function (next) { 16386 $(this).addClass("animated-in"); 16387 next(); 16388 });
16389 16390 16391 } else { 16392 16393 // Not already visible 16394 var $that = $(this); 16395 var waypoint = new Waypoint({ 16396 16397 element: $that, 16398 handler: function () { 16399 16400 setTimeout(function () { 16401 $that.addClass("animated-in"); 16402 }, 80 * $that.attr('data-delay-amount')); 16403 16404 waypoint.destroy(); 16405 }, 16406 offset: '90%' 16407 16408 }); 16409 } 16410 16411 }); 16412 16413 } 16414 16415 } 16416 16417 16418 /** 16419 * Masonry blog initialization. 16420 * 16421 * @since 10.5 16422 */ 16423 function masonryBlogInit() { 16424 16425 $nectarMasonryBlogs = []; 16426 16427 $('.posts-container').each(function (i) { 16428 16429 if ($(this).parent().hasClass('masonry') && !$(this).parent().hasClass('auto_meta_overlaid_spaced')) { 16430 16431 if (typeof NectarMasonryBlog == 'undefined') { 16432 return; 16433 } 16434 16435 $nectarMasonryBlogs[i] = new NectarMasonryBlog($(this), fullWidthSections, blogLoadIn); 16436 16437 } else { 16438 16439 blogLoadIn($(this)); 16440 16441 } 16442 16443 }); 16444 } 16445 16446 16447 16448 /** 16449 * Sticky Sidebar initialization. 16450 * 16451 * @since 10.5 16452 */ 16453 function stickySidebarInit() { 16454 16455 if (!$().theiaStickySidebar || nectarDOMInfo.usingMobileBrowser && nectarDOMInfo.winW < 1000 ) { 16456 return; 16457 } 16458 16459 $('#sidebar[data-nectar-ss="true"], #sidebar[data-nectar-ss="1"], .nectar-scrolling-tabs .scrolling-tab-nav').each(function () { 16460 16461 // Padding from top of screen 16462 var $ssExtraTopSpace = 50; 16463 16464 if ($('#header-outer[data-remove-fixed="0"]').length > 0 && 16465 $('body[data-hhun="1"]').length == 0 && 16466 $('#header-outer[data-format="left-header"]').length == 0) { 16467 16468 $ssExtraTopSpace += $headerOuterEl.outerHeight(); 16469 16470 // Resize effect 16471 if ($('#header-outer[data-shrink-num][data-header-resize="1"]').length > 0) { 16472 var headerPadding2 = parseInt($headerOuterEl.attr('data-padding')) - parseInt($headerOuterEl.attr('data-padding')) / 1.8; 16473 $ssExtraTopSpace -= logoShrinkNum; 16474 $ssExtraTopSpace -= headerPadding2; 16475 } 16476 16477 // Condense 16478 if ($('body.mobile').length == 0 && $('#header-outer[data-condense="true"]').length > 0) { 16479 16480 var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'); 16481 $ssExtraTopSpace = 50; 16482 $ssExtraTopSpace += $headerOuterEl.height() - (parseInt($headerSpan9.position().top) - parseInt($('#header-outer #logo').css('margin-top'))) - parseInt(nectarDOMInfo.secondaryHeaderHeight); 16483 } 16484 16485 } 16486 16487 if ($wpAdminBar.length > 0) { 16488 $ssExtraTopSpace += $wpAdminBar.outerHeight(); 16489 } 16490 16491 16492 if ($(this).parents('.wpb_widgetised_column').length > 0) { 16493 16494 if ($('body.vc_editor').length > 0) { 16495 // Skip processing. 16496 } else { 16497 $(this).parents('.wpb_column').theiaStickySidebar({ 16498 additionalMarginTop: $ssExtraTopSpace, 16499 updateSidebarHeight: false 16500 });
16501 } 16502 16503 } else { 16504 $(this).theiaStickySidebar({ 16505 additionalMarginTop: $ssExtraTopSpace, 16506 updateSidebarHeight: false 16507 }); 16508 } 16509 16510 }); 16511 } 16512 16513 16514 16515 16516 16517 /** 16518 * Section down arrow animated link 16519 * 16520 * @since 10.5 16521 */ 16522 function sectionDownArrowEvent() { 16523 16524 var headerPadding2 = headerPadding - headerPadding / 1.8; 16525 16526 $body.on('click', '.section-down-arrow, .scroll-down-wrap > .minimal-arrow', function () { 16527 16528 if ($(this).parents('.nectar-box-roll').length > 0) { 16529 return false; 16530 } 16531 16532 var $currentSection = $(this).parents('#page-header-bg'), 16533 $topDistance = $currentSection.height(), 16534 $offset = ($currentSection.parents('.first-section').length == 0 || $('body[data-transparent-header="false"]').length > 0) ? $currentSection.offset().top : 0, 16535 $bodyBorderSize = ($bodyBorderTop.length > 0 && $window.width() > 1000) ? $bodyBorderTop.height() : 0, 16536 $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0) ? 0 : $('#header-space').height(), 16537 $materialSecondary = 0; 16538 16539 if ($('body.material').length > 0 && $headerSecondaryEl.length > 0) { 16540 $materialSecondary = $headerSecondaryEl.height(); 16541 } 16542 16543 if ($('body[data-permanent-transparent="1"]').length == 0) { 16544 16545 // Regular 16546 if (!$body.hasClass('mobile')) { 16547 16548 if ($('body[data-hhun="1"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length == 0) { 16549 $('body,html').stop().animate({ 16550 scrollTop: parseInt($topDistance) + $offset + 2 - $bodyBorderSize * 2 16551 }, 1000, 'easeInOutCubic'); 16552 } else { 16553 16554 var $resize = ($('#header-outer[data-header-resize="0"]').length > 0) ? 0 : parseInt(logoShrinkNum) + headerPadding2 * 2; 16555 if ($('#header-outer[data-remove-fixed="1"]').length > 0) { 16556 $headerNavSpace = 0; 16557 $offset = 0; 16558 } 16559 16560 // Condense 16561 if ($('body.mobile').length == 0 && $('#header-outer[data-condense="true"]').length > 0) { 16562 var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'); 16563 $headerNavSpace = $headerOuterEl.height() - (parseInt($headerSpan9.position().top) - parseInt($('#header-outer #logo').css('margin-top'))) - parseInt(nectarDOMInfo.secondaryHeaderHeight); 16564 } 16565 16566 $('body,html').stop().animate({ 16567 scrollTop: parseInt($topDistance - $headerNavSpace) + $resize + 3 + $offset + $materialSecondary 16568 }, 1000, 'easeInOutCubic'); 16569 16570 } 16571 16572 } else { 16573 16574 var $scrollPos; 16575 16576 if($('#header-outer[data-mobile-fixed="1"]').length > 0) { 16577 $scrollPos = parseInt($topDistance) - $headerNavSpace + parseInt($currentSection.offset().top) + 2; 16578 } else { 16579 $scrollPos = parseInt($topDistance) + parseInt($currentSection.offset().top) + 2; 16580 } 16581 16582 $('body,html').stop().animate({ 16583 scrollTop: $scrollPos - $bodyBorderSize * 2 16584 }, 1000, 'easeInOutCubic'); 16585 } 16586 16587 } else { 16588 // Permanent transparent 16589 $('body,html').stop().animate({ 16590 scrollTop: parseInt($topDistance) + parseInt($currentSection.offset().top) + 2 - $bodyBorderSize * 2 16591 }, 1000, 'easeInOutCubic'); 16592 } 16593 return false; 16594 }); 16595 16596 } 16597 16598 16599 16600 16601 16602 /** 16603 * Displace filter column/row BG effect - fullpage 16604 * 16605 * @since 10.5 16606 */ 16607 function nectarLiquidBGFP() { 16608 16609 $('.nectar-liquid-bg').removeClass('animated-in'); 16610 16611 for (var k = 0; k < $liquidBG_EL.length; k++) { 16612 16613 if ($liquidBG_EL[k].animationType == 'displace-filter-fade' && $($liquidBG_EL[k].canvasContainer).parents('.fp-section.active').length > 0) { 16614 16615 //add bg to container 16616 if ($($liquidBG_EL[k].canvasContainer).find('.image-added-to-stage').length == 0) { 16617 $liquidBG_EL[k].imgContainer.addChild($liquidBG_EL[k].bg); 16618 } 16619 16620 $($liquidBG_EL[k].canvasContainer) 16621 .find('.nectar-liquid-bg') 16622 .addClass('image-added-to-stage'); 16623 16624 $liquidBG_EL[k].animateProps($liquidBG_EL[k]); 16625 16626 } 16627 } 16628 } 16629 16630 16631 /** 16632 * Page Full Screen Rows 16633 * 16634 * @since 10.5 16635 */ 16636 function nectarFullPageInit() { 16637 16638 if ($('#nectar_fullscreen_rows').length > 0 && $().fullpage) { 16639 16640 $fullscreenSelector = (window.vc_iframe) ? '.vc_element.vc_vc_row.active ' : '.wpb_row.active '; 16641 16642 var $disableFPonMobile = ($('#nectar_fullscreen_rows[data-mobile-disable]').length > 0) ? $('#nectar_fullscreen_rows').attr('data-mobile-disable') : 'off'; 16643 if( !nectarDOMInfo.usingMobileBrowser ) { 16644 $disableFPonMobile = 'off'; 16645 }
16646 // Support for mobile animation theme option. 16647 if( $disableFPonMobile != 'on' ) { 16648 $fullscreenMarkupBool = true; 16649 } else { 16650 $fullscreenSelector = ''; 16651 } 16652 16653 $nectarFullPage = new NectarFullScreenRows(waypoints, $mouseParallaxScenes, nectarLiquidBGFP, nectarDOMInfo, responsiveTooltips, $standAnimatedColTimeout, $svgIcons); 16654 16655 } 16656 16657 } 16658 16659 16660 16661 16662 /** 16663 * Cross browser adjustments. 16664 * 16665 * @since 1.0 16666 */ 16667 function crossBrowserAdjust() { 16668 16669 // Add specific class if on device for better tablet tracking. 16670 if (nectarDOMInfo.usingMobileBrowser) { 16671 $body.addClass('using-mobile-browser'); 16672 } 16673 16674 // Add class for old IE. 16675 var ua = window.navigator.userAgent; 16676 var msie = ua.indexOf("Edge/"); 16677 if (msie > 0) { 16678 $body.addClass('msie'); 16679 } 16680 16681 // For users updating to 8 with a custom, old header template file 16682 if ($('html.js').length == 0) { 16683 $('html').removeClass('no-js').addClass('js'); 16684 } 16685 16686 //remove br's from code tag 16687 $('code').find('br').remove(); 16688 16689 // Contact form 7. 16690 $('.wpcf7-form p:has(input[type=submit])').css('padding-bottom', '0px'); 16691 16692 $('.full-width-content .wpcf7-submit').on('click', function () { 16693 setTimeout(function () { 16694 fullWidthContentColumns(); 16695 }, 1000); 16696 setTimeout(function () { 16697 fullWidthContentColumns(); 16698 }, 2000); 16699 }); 16700 16701 // Gravity form inside fw content row 16702 $('.gform_body').on('click', function () { 16703 setTimeout(function () { 16704 fullWidthContentColumns(); 16705 }, 200); 16706 }); 16707 16708 // Popup Maker. 16709 $('.pum.pum-theme-salient-page-builder-optimized button.pum-close').wrapInner('<span />'); 16710 16711 // pum inside fspr 16712 if ($('#nectar_fullscreen_rows').length > 0 && 16713 $('.pum-container .pum-content > .wpb_row .full-page-inner > .container > .span_12').length > 0) { 16714 $('.pum-container .pum-content > .wpb_row .full-page-inner > .container > .span_12').unwrap(); 16715 } 16716 16717 // Blog bottom padding 16718 if ($('.single .blog_next_prev_buttons').length > 0) { 16719 $('.container-wrap').css('padding-bottom', 0); 16720 } 16721 16722 // Remove margin on last cols inside of full width sections 16723 $('.full-width-section').each(function () { 16724 $(this).find('> .span_12 > div.col_last').last().css('margin-bottom', '0'); 16725 }); 16726 16727 // Remove boxed style from full width content 16728 $('.full-width-content .col.boxed').removeClass('boxed'); 16729 16730 // Neg marg z-index adjust 16731 $('.wpb_column.neg-marg').parents('.wpb_row').css('z-index', '110'); 16732 16733 16734 } 16735 16736 16737 16738 16739 //vc col mobile fixes 16740 function vcMobileColumns() { 16741 16742 $('.wpb_row').each(function () { 16743 if (typeof $(this).find('.span_12').offset() != 'undefined') { 16744 16745 $(this).find('[class*="vc_col-"]').each(function () { 16746 16747 var $firstChildOffset = $(this).parents('.span_12').offset().left; 16748 16749 $(this).removeClass('no-left-margin'); 16750 16751 if ($(this).offset().left < $firstChildOffset + 27) { 16752 $(this).addClass('no-left-margin'); 16753 } else { 16754 $(this).removeClass('no-left-margin'); 16755 } 16756 });
16757 } 16758 }); 16759 } 16760 16761 function vcMobileColumnsInit() { 16762 16763 var $winDOMWidth = nectarDOMInfo.winW, 16764 $winDOMHeight = nectarDOMInfo.winH, 16765 $orientChangeTrack = 0; 16766 16767 // Only needed in legacy column setups. 16768 if( $body.is('[data-flex-cols="true"]') ) { 16769 return; 16770 } 16771 16772 if ($('[class*="vc_col-xs-"], [class*="vc_col-md-"], [class*="vc_col-lg-"]').length > 0) { 16773 16774 // Trigger immediately. 16775 vcMobileColumns(); 16776 16777 // Resize. 16778 if( !nectarDOMInfo.usingMobileBrowser ) { 16779 // Bind normally for desktop. 16780 $window.on('resize',vcMobileColumns); 16781 } 16782 else { 16783 16784 // For mobile make sure the orientation has changed. 16785 window.addEventListener("orientationchange", function () { 16786 $orientChangeTrack = 1; 16787 }); 16788 16789 $window.on('resize', function () { 16790 16791 if (($window.width() != $winDOMWidth && $window.height != $winDOMHeight) || $orientChangeTrack === 1) { 16792 16793 vcMobileColumns(); 16794 16795 // Store the current window dimensions. 16796 $winDOMWidth = nectarDOMInfo.winW; 16797 $winDOMHeight = nectarDOMInfo.winH; 16798 16799 // Reset orientation change tracker. 16800 $orientChangeTrack = 0; 16801 } 16802 16803 }); 16804 16805 16806 } // end mobile only. 16807 16808 } // endif vc offset cols found. 16809 16810 16811 } 16812 16813 16814 16815 16816 /** 16817 * Select2 plugin initialization. 16818 * 16819 * @since 5.0 16820 */ 16821 function select2Init() { 16822 16823 $('select:not(.state_select):not(.country_select):not(.comment-form-rating #rating):not(#tribe-bar-form select):not(.woocommerce-currency-switcher)').each(function () { 16824 16825 // Prevent search from triggering on small devices. 16826 var $minimumToSearch = ( nectarDOMInfo.winW > 690 ) ? 7 : 200; 16827 16828 // Skip search class 16829 if( $(this).hasClass('skip-select2-search') || $(this).parents('.skip-select2-search').length > 0 ) { 16830 $minimumToSearch = 1000; 16831 } 16832 16833 if ($(this).parents('#buddypress').length == 0) { 16834 16835 if ($(this).parents('.woocommerce-ordering').length == 0) { 16836 $(this).select2({ 16837 minimumResultsForSearch: $minimumToSearch, 16838 width: '100%' 16839 });
16840 } else { 16841 $(this).select2({ 16842 minimumResultsForSearch: $minimumToSearch, 16843 dropdownAutoWidth: true 16844 }); 16845 } 16846 } 16847 16848 }); 16849 } 16850 16851 16852 /** 16853 * Fancy select styling theme option. 16854 * 16855 * @since 10.5 16856 */ 16857 function fancySelectStyling() { 16858 16859 if ( $('body[data-fancy-form-rcs="1"]').length > 0 ) { 16860 16861 $('select:not(.comment-form-rating #rating)').each(function () { 16862 16863 var $selector; 16864 16865 //cf7 16866 if ($(this).parents('.wpcf7-form-control-wrap').length > 0) { 16867 16868 //select 2 already initialized 16869 if ($(this).parents('.wpcf7-form-control-wrap').find('.select2-container').length > 0) { 16870 $selector = $($(this).prev('.select2-container')); 16871 } else { 16872 $selector = $(this); 16873 } 16874 16875 //if label is found 16876 if ($selector.parents('.wpcf7-form-control-wrap').parent().find('label').length == 1) { 16877 $selector.parents('.wpcf7-form-control-wrap').parent().wrapInner('<div class="fancy-select-wrap" />'); 16878 } else { 16879 //default wrap 16880 $selector.wrap('<div class="fancy-select-wrap" />'); 16881 } 16882 } 16883 //default 16884 else { 16885 16886 //select 2 already initialized 16887 if ($(this).prev('.select2-container').length > 0) { 16888 $selector = $(this).prev('.select2-container'); 16889 } else { 16890 $selector = $(this); 16891 } 16892 16893 if ($(this).parents('#buddypress').length == 0 && $(this).parents('.widget_categories').length == 0) { 16894 //if label is found 16895 if ($selector.prev('label').length == 1) { 16896 $selector.prev('label').andSelf().wrapAll('<div class="fancy-select-wrap" />'); 16897 } else if ($selector.next('label').length == 1) { 16898 $selector.next('label').andSelf().wrapAll('<div class="fancy-select-wrap" />'); 16899 } else { 16900 //default wrap 16901 $selector.wrap('<div class="fancy-select-wrap" />'); 16902 } 16903 } 16904 16905 } 16906 }); 16907 16908 select2Init(); 16909 16910 } 16911 16912 } 16913 16914 16915 16916 16917 16918 /** 16919 * Back/Forward Safari cache assist. 16920 * 16921 * @since 10.5 16922 */ 16923 function bfCacheAssist() { 16924 16925 //Back/forward cache OCM close 16926 if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1 || 16927 navigator.userAgent.match(/(iPod|iPhone|iPad)/)) { 16928 16929 window.onpageshow = function (event) { 16930 16931 if (event.persisted) { 16932 16933 // Play video BGs 16934 $('.nectar-video-wrap, .nectar-slider-wrap .swiper-slide .video-wrap').each(function () { 16935 16936 if ($(this).find('video').length > 0) { 16937 $(this).find('video')[0].play(); 16938 } 16939 16940 });
16941 16942 16943 // Close mobile nav 16944 16945 //// Material Skin. 16946 if ($('body.material-ocm-open').length > 0) { 16947 $('body > .slide_out_area_close').addClass('non-human-allowed').trigger('click'); 16948 16949 setTimeout(function () { 16950 $('body > .slide_out_area_close').removeClass('non-human-allowed'); 16951 }, 100); 16952 16953 } else if ($('#slide-out-widget-area.slide-out-from-right-hover.open').length > 0 && navigator.userAgent.match(/(iPod|iPhone|iPad)/)) { 16954 OCM_mobileSlideOutRightHoverCloseCheck(); 16955 } 16956 // Others 16957 else if ($('#slide-out-widget-area.fullscreen.open').length > 0 || 16958 $('#slide-out-widget-area.fullscreen-alt.open').length > 0 || 16959 $('#slide-out-widget-area.slide-out-from-right.open').length > 0) { 16960 16961 $('#slide-out-widget-area .slide_out_area_close').addClass('non-human-allowed'); 16962 $('.slide-out-widget-area-toggle:not(.std-menu) a.open') 16963 .addClass('non-human-allowed') 16964 .trigger('click'); 16965 16966 setTimeout(function () { 16967 $('#slide-out-widget-area .slide_out_area_close').removeClass('non-human-allowed'); 16968 }, 100); 16969 16970 } 16971 16972 } // Loaded from bf cache 16973 16974 }; // onpage show 16975 16976 } 16977 16978 } 16979 16980 16981 16982 16983 16984 16985 /*-------------------------------------------------------------------------*/ 16986 /* WPBakery Frontend Editor 16987 /*-------------------------------------------------------------------------*/ 16988 16989 /** 16990 * Control adjustments 16991 * 16992 * @since 10.0 16993 */ 16994 function addRowCtrls() { 16995 16996 //remove padding for rows with only fullwidth ns 16997 $('.wpb_row').removeClass('only-ns'); 16998 16999 $('.nectar-slider-wrap[data-full-width="true"], .page-submenu, .portfolio-items[data-col-num="elastic"]:not(.fullwidth-constrained), .blog-fullwidth-wrap') 17000 .parents('.wpb_row') 17001 .addClass('only-ns'); 17002 17003 //padding when column contains item that could get lost under column controls 17004 $('body.vc_editor.compose-mode .wpb_row .vc_vc_column > .wpb_column > .vc_column-inner').each(function() { 17005 17006 if ($(this).find('> .vc_element-container > div').length > 0) { 17007 17008 if ($(this).find('> .vc_element-container > div:first-child').is('.vc_vc_row_inner')) { 17009 $(this).find('> .vc_element-container > div:first-child').addClass('first-inner-row-el'); 17010 } else { 17011 $(this).find('> .vc_element-container > div:first-child').removeClass('first-inner-row-el'); 17012 } 17013 17014 } 17015 17016 }); 17017 17018 } //addRowCtrl end 17019 17020 17021 /** 17022 * Convert front end padding 17023 * 17024 * Needed when the flexbox grid is not active due to 17025 * different markup in front end page builder view. 17026 * 17027 * @since 10.0 17028 */ 17029 function convertFrontEndPadding() { 17030 17031 $('.vc_element > .wpb_column[class*="padding-"][class*="-percent"]').each(function() { 17032 17033 var $elPaddingPercent = 4; 17034 17035 var elclassName = this.className.match(/padding-\d+/); 17036 if (elclassName) { 17037 $elPaddingPercent = elclassName[0].match(/\d+/); 17038 if ($elPaddingPercent) { 17039 $elPaddingPercent = $elPaddingPercent[0] / 100; 17040 } else { 17041 $elPaddingPercent = 0; 17042 } 17043 } 17044 17045 if ($elPaddingPercent) { 17046 var $parentRowWidth = $(this).parents('.span_12').width(); 17047 17048 if ($(this).is('[data-padding-pos="all"]')) { 17049 $(this).css('padding', $parentRowWidth * $elPaddingPercent); 17050 } else if ($(this).is('[data-padding-pos="top"]')) { 17051 $(this).css('padding-top', $parentRowWidth * $elPaddingPercent); 17052 } else if ($(this).is('[data-padding-pos="bottom"]')) { 17053 $(this).css('padding-bottom', $parentRowWidth * $elPaddingPercent); 17054 } else if ($(this).is('[data-padding-pos="left"]')) { 17055 $(this).css('padding-left', $parentRowWidth * $elPaddingPercent); 17056 } else if ($(this).is('[data-padding-pos="right"]')) { 17057 $(this).css('padding-right', $parentRowWidth * $elPaddingPercent); 17058 } else if ($(this).is('[data-padding-pos="top-bottom"]')) { 17059 $(this).css({ 17060 'padding-top': $parentRowWidth * $elPaddingPercent, 17061 'padding-bottom': $parentRowWidth * $elPaddingPercent, 17062 });
17063 } else if ($(this).is('[data-padding-pos="top-right"]')) { 17064 $(this).css({ 17065 'padding-top': $parentRowWidth * $elPaddingPercent, 17066 'padding-right': $parentRowWidth * $elPaddingPercent, 17067 }); 17068 } else if ($(this).is('[data-padding-pos="bottom-right"]')) { 17069 $(this).css({ 17070 'padding-right': $parentRowWidth * $elPaddingPercent, 17071 'padding-bottom': $parentRowWidth * $elPaddingPercent, 17072 }); 17073 } else if ($(this).is('[data-padding-pos="bottom-left"]')) { 17074 $(this).css({ 17075 'padding-left': $parentRowWidth * $elPaddingPercent, 17076 'padding-bottom': $parentRowWidth * $elPaddingPercent, 17077 }); 17078 } else if ($(this).is('[data-padding-pos="left-right"]')) { 17079 $(this).css({ 17080 'padding-left': $parentRowWidth * $elPaddingPercent, 17081 'padding-right': $parentRowWidth * $elPaddingPercent, 17082 }); 17083 } 17084 } 17085 17086 }); 17087 17088 $('.wpb_row[class*="vc_custom_"]').each(function() { 17089 17090 $(this).parent().addClass('no-bottom-margin'); 17091 17092 }); 17093 17094 } 17095 17096 17097 /** 17098 * WPBakery Front end editor integration 17099 * 17100 * @since 10.0 17101 */ 17102 function wpBakeryFrontendInit() { 17103 17104 // Set up controls/column padding. 17105 setTimeout(function() { 17106 17107 if ($('body.compose-mode').length > 0) { 17108 $('.container-wrap').addClass('visible-editor-controls'); 17109 } 17110 17111 if (nectarDOMInfo.usingFrontEndEditor) { 17112 addRowCtrls(); 17113 17114 if( !$body.is('[data-flex-cols="true"]') ) { 17115 convertFrontEndPadding(); 17116 $window.smartresize(convertFrontEndPadding); 17117 } 17118 17119 } 17120 17121 }, 200); 17122 17123 // Bind reload event 17124 $window.on('vc_reload', function() { 17125 17126 addRowCtrls(); 17127 columnBGColors(); 17128 coloredButtons(); 17129 twentytwentyInit(); 17130 parallaxRowsBGCals(); 17131 flexsliderInit(); 17132 accordionInit(); 17133 ulCheckmarks(); 17134 nectarFancyUlIcons(); 17135 nectarFancyBoxHover(); 17136 oneFourthClasses(); 17137 carouselfGrabbingClass(); 17138 nectarPostGridInit(); 17139 splitLineHeadingInit(); 17140 nectarVideoLightbox(); 17141 nectarKeyframeAssist(); 17142 nectarLazyImageLoading(); 17143 17144 if ($('.carousel').length > 0) { 17145 standardCarouselInit(); 17146 clientsCarouselInit(); 17147 carouselHeightCalcs(); 17148 } 17149 17150 if ($('.owl-carousel').length > 0) { 17151 $('.owl-carousel').each(function() { 17152 $(this).trigger('destroy.owl.carousel').removeClass('owl-loaded'); 17153 $(this).find('.owl-stage-outer .owl-stage > *').unwrap(); 17154 $(this).find('.owl-stage-outer > *').unwrap(); 17155 $(this).find('.owl-item > *').unwrap(); 17156 $(this).find('.owl-dots').remove(); 17157 $(this).find('.owl-nav').remove(); 17158 }); 17159 owlCarouselInit(); 17160 } 17161 17162 if ($('.nectar_cascading_images').length > 0) { 17163 imagesLoaded($('.nectar_cascading_images'), function() { 17164 cascadingImageBGSizing(); 17165 }); 17166 } 17167 17168 fullWidthSections(); 17169 fwsClasses(); 17170 recentPostsInit(); 17171 fullWidthRowPaddingAdjust(); 17172 17173 /*flickity carousels*/ 17174 if ($flickitySliders.length > 0) { 17175 for (var i = 0; i < $flickitySliders.length; i++) { 17176 17177 $flickitySliders[i].reloadCells(); 17178 $flickitySliders[i].off('scroll.flickity'); 17179 $flickitySliders[i].off('dragStart.flickity'); 17180 $flickitySliders[i].off('dragEnd.flickity'); 17181 17182 } 17183 } 17184 17185 flickityLazyInit(); 17186 17187 setTimeout(function() { 17188 17189 flickityInit(); 17190 if ($flickitySliders.length > 0) { 17191 for (var i = 0; i < $flickitySliders.length; i++) { 17192 $flickitySliders[i].reloadCells(); 17193 $flickitySliders[i].resize(); 17194 } 17195 } 17196 17197 }, 100); 17198 17199 /*flickity product carousels*/ 17200 if ($wooFlickityCarousels.length > 0) { 17201 for (var i = 0; i < $wooFlickityCarousels.length; i++) { 17202 17203 $wooFlickityCarousels[i].flickity('reloadCells'); 17204 $wooFlickityCarousels[i].off('scroll.flickity'); 17205 $wooFlickityCarousels[i].off('dragStart.flickity'); 17206 $wooFlickityCarousels[i].off('dragEnd.flickity'); 17207 17208 } 17209 } 17210 17211 setTimeout(function() { 17212 17213 if ($('.nectar-woo-flickity').length > 0) { 17214 productCarouselInit(); 17215 } 17216 if ($wooFlickityCarousels.length > 0) { 17217 for (var i = 0; i < $wooFlickityCarousels.length; i++) { 17218 $wooFlickityCarousels[i].flickity('reloadCells'); 17219 $wooFlickityCarousels[i].flickity('resize'); 17220 } 17221 } 17222 17223 }, 100); 17224 17225 nectarTestimonialSliders(); 17226 17227 for (var i = 0; i < $testimonialSliders.length; i++) { 17228 17229 if ($testimonialSliders[i].type == 'multiple_visible' || 17230 $testimonialSliders[i].type == 'multiple_visible_minimal') { 17231 17232 $testimonialSliders[i].flickityEl.flickity('reloadCells'); 17233 $testimonialSliders[i].flickityEl.off('select.flickity'); 17234 nectarTestimonialSliders(); 17235 $testimonialSliders[i].flickityEl.resize(); 17236 } 17237 17238 $testimonialSliders[i].testimonialSliderHeight(); 17239 } 17240 nectarTestimonialSlidersEvents(); 17241 17242 pricingTableHeight(); 17243 nectarIconMatchColoring(); 17244 lightBoxInit(); 17245 imageWithHotspotEvents(); 17246 largeIconHover(); 17247 nectarBoxRollInit(); 17248 midnightInit(); 17249 responsiveVideoIframesInit(); 17250 responsiveVideoIframes(); 17251 fullWidthContentColumns(); 17252 setTimeout(fullWidthContentColumns, 1000); 17253 videoBGInit(); 17254 vcFullHeightRowInit(); 17255 $window.off('scroll.parallaxSections').off('resize.parallaxSections'); 17256 parallaxScrollInit(); 17257 masonryBlogInit(); 17258 masonryPortfolioInit(); 17259 17260 if ($portfolio_containers.length > 0) { 17261 for (var i = 0; i < $portfolio_containers.length; i++) { 17262 $portfolio_containers[i].portfolioAccentColor(); 17263 } 17264 } 17265 17266 parallaxItemHoverEffect(); 17267 fsProjectSliderInit(); 17268 17269 setTimeout(function() { 17270 if ($('.nectar_fullscreen_zoom_recent_projects').length > 0) { 17271 17272 if ($fsProjectSliderArr.length > 0) { 17273 for (var i = 0; i < $fsProjectSliderArr.length; i++) { 17274 $fsProjectSliderArr[i].sliderCalcs(); 17275 } 17276 } 17277 17278 } 17279 }, 300); 17280 17281 $window.unbind('.infscr'); 17282 infiniteScrollInit();
17283 mouseParallaxInit(); 17284 17285 //play video BGs 17286 $('.nectar-video-wrap').each(function() { 17287 if ($(this).find('video').length > 0) { 17288 $(this).find('video').css('visibility', 'visible'); 17289 } 17290 }); 17291 17292 //tablet inherits small desktop 17293 $('.wpb_column[data-t-w-inherits]').each(function() { 17294 if ($(this).is('[data-t-w-inherits="small_desktop"]')) { 17295 $(this).parent().addClass('inherits-s-desktop-col'); 17296 } else { 17297 $(this).parent().removeClass('inherits-s-desktop-col'); 17298 } 17299 }); 17300 17301 //full screen page rows 17302 if ($('#nectar_fullscreen_rows').length > 0) { 17303 17304 if ($('#nectar_fullscreen_rows > .vc_element').length == 0) { 17305 $('#nectar_fullscreen_rows').prepend('<div class="vc_element empty_placeholder" />'); 17306 } 17307 17308 17309 if ($('#nectar_fullscreen_rows > .vc_element:not(.empty_placeholder)').length > 0) { 17310 $('#nectar_fullscreen_rows >.vc_element.empty_placeholder').remove(); 17311 } 17312 17313 17314 $.fn.fullpage.destroy('all'); 17315 nectarFullPageInit(); 17316 17317 //keep tooltip active status 17318 var nectarFPOffsets = [{ 17319 el: '', 17320 offset: 0 17321 }]; 17322 17323 ////create list of offsets 17324 $('#nectar_fullscreen_rows > div.vc_element').each(function(i) { 17325 nectarFPOffsets[i] = { 17326 el: $(this), 17327 offset: $(this).offset().top 17328 }; 17329 }); 17330 17331 17332 ////start active on that index 17333 17334 //move back to first section when all have been deleted but one 17335 if ($('#nectar_fullscreen_rows > div.vc_element').length === 1) { 17336 $('#nectar_fullscreen_rows').css({ 17337 'transform': 'translate3d(0,0,0)' 17338 });
17339 } 17340 17341 $body.scrollTo(0, 0); 17342 17343 17344 } else { 17345 17346 //remove container wrap padding/margin when needded 17347 if ($('body .main-content > .row > .vc_element:first > .wpb_row[class*="full-width-"]').length > 0 || 17348 $('body .main-content > .row > .vc_element:first .nectar-slider-wrap[data-full-width="true"]').length > 0) { 17349 $('.container-wrap').css({ 17350 'padding-top': '0', 17351 'margin-top': '0' 17352 }); 17353 } else { 17354 $('.container-wrap').css({ 17355 'padding-top': '40px' 17356 }); 17357 } 17358 17359 } 17360 17361 //reset svg icon arr 17362 $svgIcons = []; 17363 $('.svg-icon-holder') 17364 .removeClass('animated-in') 17365 .removeClass('bound'); 17366 17367 17368 //gmap 17369 if ($('.vc_nectar_gmap').length > 0) { 17370 17371 setTimeout(function() { 17372 17373 if (typeof google === 'object' && typeof google.maps === 'object') { 17374 window.mapAPI_Loaded(); 17375 } else { 17376 17377 if (window.nectarLove.mapApiKey.length > 0) { 17378 $.getScript('https://maps.google.com/maps/api/js?sensor=false&key=' + window.nectarLove.mapApiKey + '&callback=mapAPI_Loaded'); 17379 } 17380 } 17381 17382 }, 100); 17383 } 17384 17385 17386 stickySidebarInit(); 17387 17388 17389 if (typeof window.Waypoint != 'undefined') { 17390 Waypoint.destroyAll(); 17391 waypoints(); 17392 } 17393 17394 }); 17395 17396 } 17397 17398 17399 17400 17401 17402 17403 17404 17405 /** 17406 * Page transitions and waypoint triggering 17407 * 17408 * @since 10.5 17409 */ 17410 function pageTransitionInit() { 17411 17412 var mobileDisabledCondition = false; 17413 17414 if( $('body[data-ajax-transitions="true"]').length > 0 && 17415 $('#ajax-loading-screen[data-disable-mobile="1"]').length > 0 && 17416 nectarDOMInfo.winW < 1000 ) { 17417 17418 mobileDisabledCondition = true; 17419 17420 } 17421 17422 if ($('body[data-ajax-transitions="true"]').length > 0 && $('#ajax-loading-screen[data-method="standard"]').length > 0 && mobileDisabledCondition == false) { 17423 17424 $('html').addClass('page-trans-loaded'); 17425 17426 // Fade loading animation 17427 if ($('#ajax-loading-screen[data-effect="standard"]').length > 0) { 17428 17429 if ($('.nectar-particles').length == 0) { 17430 17431 $loadingScreenEl.transition({ 17432 'opacity': 0 17433 }, 500, function () { 17434 $(this).css({ 17435 'display': 'none' 17436 }); 17437 });
17438 $('#ajax-loading-screen .loading-icon').transition({ 17439 'opacity': 0 17440 }, 500); 17441 17442 } 17443 17444 // Bind waypoints after loading screen has left 17445 if ($('.nectar-box-roll').length == 0) { 17446 setTimeout(function () { 17447 waypoints(); 17448 }, 550); 17449 } 17450 17451 } 17452 17453 // Swipe loading animation 17454 else { 17455 17456 if ($('#ajax-loading-screen[data-effect*="horizontal_swipe"]').length > 0) { 17457 setTimeout(function () { 17458 $loadingScreenEl.addClass('loaded'); 17459 }, 60); 17460 } 17461 17462 if ($('#page-header-wrap #page-header-bg[data-animate-in-effect="zoom-out"] .nectar-video-wrap').length == 0) { 17463 setTimeout(function () { 17464 $('#ajax-loading-screen:not(.loaded)').addClass('loaded'); 17465 setTimeout(function () { 17466 $loadingScreenEl.addClass('hidden'); 17467 }, 1000); 17468 }, 150); 17469 } 17470 17471 17472 // Bind waypoints after loading screen has left 17473 if ($('.nectar-box-roll').length == 0 && $('#ajax-loading-screen[data-effect*="horizontal_swipe"]').length > 0) { 17474 setTimeout(function () { 17475 waypoints(); 17476 }, 750); 17477 } else if ($('.nectar-box-roll').length == 0) setTimeout(function () { 17478 waypoints(); 17479 }, 350); 17480 17481 } 17482 17483 17484 // Safari back/prev fix 17485 if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1 || 17486 navigator.userAgent.match(/(iPod|iPhone|iPad)/)) { 17487 17488 window.onunload = function () { 17489 $loadingScreenEl.stop().transition({ 17490 'opacity': 0 17491 }, 800, function () { 17492 $(this).css({ 17493 'display': 'none' 17494 }); 17495 });
17496 $('#ajax-loading-screen .loading-icon').transition({ 17497 'opacity': 0 17498 }, 600); 17499 }; 17500 window.onpageshow = function (event) { 17501 17502 if (event.persisted) { 17503 17504 $loadingScreenEl.stop().transition({ 17505 'opacity': 0 17506 }, 800, function () { 17507 $(this).css({ 17508 'display': 'none' 17509 }); 17510 }); 17511 $('#ajax-loading-screen .loading-icon').transition({ 17512 'opacity': 0 17513 }, 600); 17514 17515 } 17516 17517 }; 17518 17519 } 17520 17521 else if (navigator.userAgent.indexOf('Firefox') != -1) { 17522 window.onunload = function () {}; 17523 } 17524 17525 17526 // Remove excess loading images if using page transitions. 17527 $('.portfolio-loading, .nectar-slider-loading .loading-icon').remove(); 17528 17529 17530 if ($('#ajax-loading-screen[data-disable-fade-on-click="1"]').length == 0) { 17531 17532 if ($('body.using-mobile-browser #ajax-loading-screen[data-method="standard"][data-disable-mobile="1"]').length == 0) { 17533 17534 var ignore_onbeforeunload = false; 17535 $('a[href^="mailto"], a[href^="tel"], .woocommerce-order-downloads a[class*="downloads-file"]').on('click', function () { 17536 ignore_onbeforeunload = true; 17537 });
17538 window.addEventListener('beforeunload', function () { 17539 17540 if (!ignore_onbeforeunload) { 17541 $loadingScreenEl.addClass('set-to-fade'); 17542 transitionPage(); 17543 } 17544 ignore_onbeforeunload = false; 17545 }); 17546 } 17547 17548 } 17549 17550 } 17551 17552 // No page transitions 17553 else { 17554 17555 // Mobile disabled. 17556 if( mobileDisabledCondition == true ) { 17557 $loadingScreenEl.css({ 17558 'opacity': '0', 17559 'display': 'none' 17560 }).addClass('loaded').addClass('hidden'); 17561 } 17562 17563 if ($('.nectar-box-roll').length == 0 && !nectarDOMInfo.usingFrontEndEditor) { 17564 17565 // Waypoints. 17566 setTimeout(function () { 17567 waypoints(); 17568 }, 80); 17569 17570 } 17571 17572 } 17573 17574 17575 function transitionPage() { 17576 17577 if ($('#ajax-loading-screen[data-effect*="horizontal_swipe"]').length > 0) { 17578 $loadingScreenEl.removeClass('loaded'); 17579 $loadingScreenEl.addClass('in-from-right'); 17580 17581 setTimeout(function () { 17582 $loadingScreenEl.addClass('loaded'); 17583 }, 30); 17584 17585 } 17586 else { 17587 if ($('#ajax-loading-screen[data-effect="center_mask_reveal"]').length > 0) { 17588 $loadingScreenEl.css('opacity', '0').css('display', 'block').transition({ 17589 'opacity': '1' 17590 }, 450); 17591 } else { 17592 $loadingScreenEl.show().transition({ 17593 'opacity': '1' 17594 }, 450); 17595 } 17596 } 17597 17598 } 17599 17600 } 17601 17602 17603 17604 // Document ready event - starting everything up. 17605 jQuery(document).ready(function ($) { 17606 17607 // Initialize Nectar DOM helper. 17608 nectarDOMInfo.init(); 17609 17610 // Priority calls 17611 nectarBoxRollInit(); 17612 nectarFullPageInit(); 17613 nectarLazyImageLoading(); 17614 17615 // Header navigation. 17616 initSF(); 17617 navigationSearchInit(); 17618 centeredNavBottomBarInit(); 17619 centeredLogoHeaderInit(); 17620 headerNavPreInit(); 17621 headerNavScrollInit(); 17622 headerNavOffsetInit(); 17623 17624 // Page builder elements. 17625 salientPageBuilderElInit(); 17626 17627 // Column related. 17628 columnBGColors(); 17629 vcMobileColumnsInit(); 17630 17631 // Row related. 17632 fullWidthSections(); 17633 fwsClasses(); 17634 fwCarouselLinkFix(); 17635 fullWidthSectionsPreInit(); 17636 firstFWSection(); 17637 parallaxScrollInit(); 17638 parallaxRowsBGCals(); 17639 fullWidthRowPaddingAdjust(); 17640 fullWidthContentColumns(); 17641 oneFourthClasses(); 17642 fixIeFlexbox(); 17643 vcFullHeightRowInit(); 17644 17645 // Media. 17646 lightBoxInit(); 17647 audioVideoVis(); 17648 responsiveVideoIframesInit(); 17649 responsiveVideoIframes(); 17650 videoBGInit(); 17651 blogSingle(); 17652 17653 // Off canvas navigation. 17654 mobileNavMegamenuCorrect(); 17655 materialSkinOCM_Init(); 17656 OCM_dropdownMarkup(); 17657 OCM_dropdownIconPos(); 17658 clickToggleSubmenus(); 17659 OCM_init(); 17660 17661 // Page header 17662 pageHeaderInit(); 17663 17664 // Footer. 17665 footerRevealInit(); 17666 17667 // Third party. 17668 wooCommerceEvents(); 17669 fancySelectStyling(); 17670 17671 // Scrolling 17672 infiniteScrollInit(); 17673 scrollToTopInit(); 17674 animatedAnchorLinks(); 17675 updatePerspectiveOriginInit(); 17676 sectionDownArrowEvent(); 17677 17678 // Cross browser assist. 17679 crossBrowserAdjust(); 17680 bfCacheAssist(); 17681 17682 // Front end editing. 17683 wpBakeryFrontendInit(); 17684 17685 // Page transitions and waypoint activation. 17686 pageTransitionInit(); 17687 17688 17689 17690 // Main Debounced Resize Event. 17691 $window.off('smartresize.srInit'); 17692 $window.on('smartresize.srInit', smartResizeInit); 17693 17694 // Main Resize Event. 17695 $window.off('resize.srInit'); 17696 $window.on('resize.srInit', resizeInit); 17697 17698 // Window Load Event. 17699 $window.on('load', function () { 17700 17701 // Set header space. 17702 if ( $(window).scrollTop() == 0 ) { 17703 headerSpace(); 17704 } 17705 17706 $('video').css('visibility', 'visible'); 17707 17708 // Scroll to anchor 17709 pageLoadHashInit(); 17710 17711 // Row/Column related. 17712 fullWidthContentColumns();
17713 parallaxRowsBGCals(); 17714 17715 // Video BG 17716 resizeVideoToCover(); 17717 17718 }); 17719 17720 17721 }); 17722 17723 17724 17725}(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.