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 /** 1894 * Aspect Ratio Calculator 1895 * 1896 * @since 11.0 1897 */ 1898 function calculateAspectRatio(srcWidth, srcHeight, maxWidth, maxHeight) { 1899 var ratio = Math.min(maxWidth / srcWidth, maxHeight / srcHeight); 1900 return { width: srcWidth*ratio, height: srcHeight*ratio }; 1901 } 1902 1903 /** 1904 * Calculate header navigation height 1905 * 1906 * The header nav bar height can change on scrolling from theme option effects/using the secondary 1907 * header, so it is necessary to calculate the reduced height in advance for correct sticky waypoint 1908 * event binding & animated anchor links. 1909 * 1910 * @since 10.5 1911 * @return {number} Height of nav bar. 1912 */ 1913 function calcHeaderNavHeight() { 1914 1915 var navHeight; 1916 1917 // Left header format, no header template, hide header until needed. 1918 if( ($body.is('[data-header-format="left-header"]') && nectarDOMInfo.winW >= 1000) || 1919 $body.is('[data-hhun="1"]') && nectarDOMInfo.winW >= 1000 || 1920 $('.page-template-template-no-header-footer').length > 0 || 1921 $('.page-template-template-no-header').length > 0) { 1922 1923 navHeight = 0; 1924 1925 } 1926 1927 // Regular Header 1928 else { 1929 1930 var headerPadding2 = headerPadding - headerPadding / 1.8; 1931 var $headerNavSpace = $headerOuterEl.outerHeight(); 1932 1933 // Secondary header bar. 1934 if( $headerSecondaryEl.length > 0 && $body.is('.material') || 1935 $headerSecondaryEl.length > 0 && !$body.is('.material') && nectarDOMInfo.winW < 1000) { 1936 $headerNavSpace -= nectarDOMInfo.secondaryHeaderHeight; 1937 } 1938 1939 // Check for header resize effect. 1940 if( $headerOuterEl.is('[data-header-resize="1"]') && !$headerOuterEl.is('.small-nav') && nectarDOMInfo.winW >= 1000 ) { 1941 navHeight = $headerNavSpace - (parseInt(logoShrinkNum) + headerPadding2 * 2); 1942 } else { 1943 navHeight = $headerNavSpace; 1944 } 1945 1946 } 1947 1948 // Condense header effect. 1949 if ( nectarDOMInfo.winW >= 1000 && $('#header-outer[data-condense="true"]').length > 0 ) { 1950 1951 var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'); 1952 navHeight = $headerOuterEl.height() - (parseInt($headerSpan9.position().top) - parseInt($headerOuterEl.find('#logo').css('margin-top'))) - parseInt(nectarDOMInfo.secondaryHeaderHeight); 1953 1954 } 1955 1956 return navHeight; 1957 1958 } 1959 1960 1961 /** 1962 * Removes CSS outlines in an accessible manner. 1963 * 1964 * @since 10.5 1965 */ 1966 (function(d){ 1967 1968 var style_element = d.createElement('STYLE'), 1969 dom_events = 'addEventListener' in d, 1970 add_event_listener = function(type, callback){ 1971 if(dom_events){ 1972 d.addEventListener(type, callback); 1973 }else{ 1974 d.attachEvent('on' + type, callback); 1975 } 1976 }, 1977 set_css = function(css_text){ 1978 !!style_element.styleSheet ? style_element.styleSheet.cssText = css_text : style_element.innerHTML = css_text; 1979 }; 1980 1981 d.getElementsByTagName('HEAD')[0].appendChild(style_element); 1982 1983 add_event_listener('mousedown', function(){ 1984 set_css(':focus{outline:0}::-moz-focus-inner{border:0;}'); 1985 }); 1986 1987 add_event_listener('keydown', function(){ 1988 set_css(''); 1989 }); 1990 1991 })(document); 1992 1993 1994 1995 /** 1996 * Cursor position. 1997 * 1998 * @since 4.0 1999 */ 2000 jQuery.fn.setCursorPosition = function (position) { 2001 2002 if (this.length == 0) { 2003 return this; 2004 } 2005 return $(this).setSelection(position, position); 2006 }; 2007 2008 2009 /** 2010 * Set selection in input. 2011 * 2012 * @since 4.0 2013 */ 2014 jQuery.fn.setSelection = function (selectionStart, selectionEnd) { 2015 if (this.length == 0) { 2016 return this; 2017 } 2018 var input = this[0]; 2019 2020 if (input.createTextRange) { 2021 var range = input.createTextRange(); 2022 range.collapse(true); 2023 range.moveEnd('character', selectionEnd); 2024 range.moveStart('character', selectionStart); 2025 range.select(); 2026 } else if (input.setSelectionRange) { 2027 input.focus(); 2028 input.setSelectionRange(selectionStart, selectionEnd); 2029 } 2030 2031 return this; 2032 }; 2033 2034 $.extend($.expr[':'], { 2035 transparent: function (elem, i, attr) { 2036 return ($(elem).css("opacity") === "0"); 2037 } 2038 }); 2039 2040 2041 2042 /** 2043 * Converts to hex. 2044 * 2045 * @since 3.0 2046 */ 2047 function hex(x) { 2048 return ("0" + parseInt(x).toString(16)).slice(-2); 2049 } 2050 2051 /** 2052 * CSS color RGB helper. 2053 * 2054 * @since 3.0 2055 */ 2056 $.cssHooks.color = { 2057 get: function (elem) { 2058 2059 var color; 2060 2061 if (elem.currentStyle) { 2062 color = elem.currentStyle["color"]; 2063 } else if (window.getComputedStyle) { 2064 color = document.defaultView.getComputedStyle(elem, 2065 null).getPropertyValue("color"); 2066 } 2067 if (color.search("rgb") == -1) { 2068 return color; 2069 } else { 2070 color = color.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/); 2071 2072 if (color) { 2073 return "#" + hex(color[1]) + hex(color[2]) + hex(color[3]); 2074 } 2075 } 2076 } 2077 }; 2078 2079 /** 2080 * CSS background color RGB helper. 2081 * 2082 * @since 3.0 2083 */ 2084 $.cssHooks.backgroundColor = { 2085 get: function (elem) { 2086 2087 var bg; 2088 2089 if (elem.currentStyle) { 2090 bg = elem.currentStyle["backgroundColor"]; 2091 } else if (window.getComputedStyle) { 2092 bg = document.defaultView.getComputedStyle(elem, 2093 null).getPropertyValue("background-color"); 2094 } 2095 if (bg.search("rgb") == -1) { 2096 return bg; 2097 } else { 2098 bg = bg.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/); 2099 2100 if (bg) { 2101 return "#" + hex(bg[1]) + hex(bg[2]) + hex(bg[3]);
2102 } 2103 } 2104 } 2105 }; 2106 2107 2108 /** 2109 * Unique ID generator. 2110 * 2111 * @since 10.5 2112 */ 2113 function uniqueIdGenerate() { 2114 return Math.floor(Math.random() * 10000); 2115 } 2116 2117 2118 2119 2120 /** 2121 * Animated page scroll 2122 * 2123 * @since 9.0 2124 */ 2125 function nectar_scrollToY(scrollTargetY, speed, easing) { 2126 2127 var scrollY = window.scrollY || document.documentElement.scrollTop, 2128 scrollTargetY = scrollTargetY || 0, 2129 speed = speed || 2000, 2130 easing = easing || 'easeOutSine', 2131 currentTime = 0; 2132 2133 var time = Math.max(0.1, Math.min(Math.abs(scrollY - scrollTargetY) / speed, 0.8)); 2134 2135 var easingEquations = { 2136 easeInOutQuint: function (pos) { 2137 if ((pos /= 0.5) < 1) { 2138 return 0.5 * Math.pow(pos, 5); 2139 } 2140 return 0.5 * (Math.pow((pos - 2), 5) + 2); 2141 } 2142 }; 2143 2144 function tick() { 2145 currentTime += 1 / 60; 2146 2147 var p = currentTime / time; 2148 var t = easingEquations[easing](p); 2149 2150 if (p < 1) { 2151 requestAnimationFrame(tick); 2152 2153 window.scrollTo(0, scrollY + ((scrollTargetY - scrollY) * t)); 2154 } else { 2155 window.scrollTo(0, scrollTargetY); 2156 } 2157 } 2158 2159 tick(); 2160 } 2161 2162 2163 /* 2164 * Bootstrap ScrollSpy Component 2165 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) */ 2166 (function ($) { 2167 2168 function s(e, i) { 2169 var r = $.proxy(this.process, this); 2170 this.$body = $("body"), this.$scrollElement = $($(e).is("body") ? window : e), 2171 this.options = $.extend({}, s.DEFAULTS, i), 2172 this.selector = (this.options.target || "") + " ul li > a", 2173 this.offsets = [], 2174 this.targets = [], 2175 this.activeTarget = null, 2176 this.scrollHeight = 0, 2177 this.$scrollElement.on("scroll.bs.scrollspy", r), 2178 this.refresh(), 2179 this.process(); 2180 } 2181 2182 function e(e) { 2183 return this.each(function () { 2184 var i = $(this), 2185 r = i.data("bs.scrollspy"), 2186 o = "object" == typeof e && e; 2187 r || i.data("bs.scrollspy", r = new s(this, o)), "string" == typeof e && r[e]() 2188 }) 2189 } 2190 2191 s.VERSION = "3.2.0", 2192 s.DEFAULTS = { 2193 offset: 10 2194 }, 2195 s.prototype.getScrollHeight = function () { 2196 return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight) 2197 }, 2198 s.prototype.refresh = function () { 2199 var s = "offset", 2200 e = 0; 2201 $.isWindow(this.$scrollElement[0]) || (s = "position", e = this.$scrollElement.scrollTop()), this.offsets = [], this.targets = [], this.scrollHeight = this.getScrollHeight(); 2202 var i = this; 2203 this.$body.find(this.selector).map(function () { 2204 var i = $(this), 2205 r = i.data("target") || i.attr("href"), 2206 o = /^#./.test(r) && $(r); 2207 return o && o.length && o.is(":visible") && [ 2208 [o[s]().top + e, r] 2209 ] || null 2210 }).sort(function (t, s) { 2211 return t[0] - s[0] 2212 }).each(function () { 2213 i.offsets.push(this[0]), i.targets.push(this[1]) 2214 }) 2215 }, 2216 s.prototype.process = function () { 2217 2218 var $pageSubMenu = 0; 2219 2220 if( $('.page-submenu[data-sticky="true"]').length > 0 && $('body[data-hhun="1"]').length == 0 2221 || $('.page-submenu[data-sticky="true"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length > 0 ) { 2222 $pageSubMenu = $('.page-submenu').height(); 2223 } 2224 2225 var t, s = this.$scrollElement.scrollTop() + this.options.offset + $pageSubMenu, 2226 e = this.getScrollHeight(), 2227 i = this.options.offset + e - this.$scrollElement.height() - $pageSubMenu, 2228 r = this.offsets, 2229 o = this.targets, 2230 l = this.activeTarget; 2231 2232 // remove active when scrolling to first section that does not have an anchor 2233 if (this.activeTarget && s < this.offsets[0] && this.offsets[0] > 0) { 2234 this.activeTarget = null; 2235 $(this.selector).parentsUntil(this.options.target, ".current-menu-item").removeClass("current-menu-item").removeClass('sfHover'); 2236 return; 2237 } 2238 2239 if (this.scrollHeight != e && this.refresh(), s >= i) { 2240 return l != (t = o[o.length - 1]) && this.activate(t); 2241 } 2242 if (l && s <= r[0]) { 2243 return l != (t = o[0]) && this.activate(t); 2244 } 2245 2246 2247 for (t = r.length; t--;) l != o[t] && s >= r[t] && (!r[t + 1] || s <= r[t + 1]) && this.activate(o[t]) 2248 }, 2249 s.prototype.activate = function (s) { 2250 this.activeTarget = s, $(this.selector).parentsUntil(this.options.target, ".current-menu-item").removeClass("current-menu-item").removeClass('sfHover'); 2251 var e = this.selector + '[data-target="' + s + '"],' + this.selector + '[href="' + s + '"]', 2252 i = $(e).parents("li").addClass("current-menu-item"); 2253 i.parent(".dropdown-menu").length && (i = i.closest("li.dropdown").addClass("current-menu-item")), i.trigger("activate.bs.scrollspy") 2254 }; 2255 2256 var i = $.fn.scrollspy; 2257 2258 $.fn.scrollspy = e, 2259 $.fn.scrollspy.Constructor = s, 2260 $.fn.scrollspy.noConflict = function () { 2261 return $.fn.scrollspy = i, this 2262 } 2263 2264 }(jQuery)); 2265 2266 2267 /** 2268 * Mobile break point checker 2269 * 2270 * @since 9.0 2271 */ 2272 function mobileBreakPointCheck() { 2273 2274 var $mobileBreakpoint = ($('body[data-header-breakpoint]').length > 0 && $body.attr('data-header-breakpoint') != '1000') ? parseInt($body.attr('data-header-breakpoint')) : 1000; 2275 var $withinCustomBreakpoint = false; 2276 2277 if ($mobileBreakpoint != 1000) {
2278 if ($('body[data-user-set-ocm="1"][data-slide-out-widget-area-style="slide-out-from-right-hover"]').length == 0 && nectarDOMInfo.winW > 1000 && nectarDOMInfo.winW <= $mobileBreakpoint) { 2279 $withinCustomBreakpoint = true; 2280 } 2281 } 2282 2283 return $withinCustomBreakpoint; 2284 } 2285 2286 /** 2287 * Extract a URL 2288 * 2289 * @since 5.0 2290 */ 2291 function extractUrl(input) { 2292 return input.replace(/"/g, "").replace(/url\(|\)$/ig, ""); 2293 } 2294 2295 /** 2296 * Extract query params 2297 * 2298 * @since 10.5 2299 */ 2300 function getQueryParams(qs) { 2301 qs = qs.split("+").join(" "); 2302 var params = {}, 2303 tokens, 2304 re = /[?&]?([^=]+)=([^&]*)/g; 2305 2306 while (tokens = re.exec(qs)) { 2307 params[decodeURIComponent(tokens[1])] = decodeURIComponent(tokens[2]); 2308 } 2309 2310 return params; 2311 } 2312 2313 var nectarGetQueryParam = getQueryParams(document.location.search); 2314 2315 2316 /** 2317 * Check whether an el is visible. 2318 * 2319 * @since 6.0 2320 */ 2321 (function (t) { 2322 var i = t(window); 2323 t.fn.visible = function (t, e, o) { 2324 if (!(this.length < 1)) { 2325 var r = this.length > 1 ? this.eq(0) : this, 2326 n = r.get(0), 2327 f = i.width(), 2328 h = i.height(), 2329 o = o ? o : "both", 2330 l = e === !0 ? n.offsetWidth * n.offsetHeight : !0; 2331 if ("function" == typeof n.getBoundingClientRect) { 2332 var g = n.getBoundingClientRect(), 2333 u = g.top >= 0 && g.top < h, 2334 s = g.bottom > 0 && g.bottom <= h, 2335 c = g.left >= 0 && g.left < f, 2336 a = g.right > 0 && g.right <= f, 2337 v = t ? u || s : u && s, 2338 b = t ? c || a : c && a; 2339 if ("both" === o) { 2340 return l && v && b; 2341 } 2342 if ("vertical" === o) { 2343 return l && v; 2344 } 2345 if ("horizontal" === o) { 2346 return l && b 2347 } 2348 } else { 2349 var d = i.scrollTop(), 2350 p = d + h, 2351 w = i.scrollLeft(), 2352 m = w + f, 2353 y = r.offset(), 2354 z = y.top, 2355 B = z + r.height(), 2356 C = y.left, 2357 R = C + r.width(), 2358 j = t === !0 ? B : z, 2359 q = t === !0 ? z : B, 2360 H = t === !0 ? R : C, 2361 L = t === !0 ? C : R; 2362 if ("both" === o) { 2363 return !!l && p >= q && j >= d && m >= L && H >= w; 2364 } 2365 if ("vertical" === o) { 2366 return !!l && p >= q && j >= d; 2367 } 2368 if ("horizontal" === o) { 2369 return !!l && m >= L && H >= w; 2370 } 2371 } 2372 } 2373 }; 2374 2375 }(jQuery)); 2376 2377 2378 /** 2379 * Count to a specific number 2380 * 2381 * @since 8.0 2382 */ 2383 var CountUp = function (target, startVal, endVal, decimals, duration, options) { 2384 2385 var lastTime = 0; 2386 var vendors = ['webkit', 'moz', 'ms', 'o']; 2387 for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { 2388 window.requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame']; 2389 window.cancelAnimationFrame = 2390 window[vendors[x] + 'CancelAnimationFrame'] || window[vendors[x] + 'CancelRequestAnimationFrame']; 2391 } 2392 if (!window.requestAnimationFrame) { 2393 window.requestAnimationFrame = function (callback) { 2394 var currTime = new Date().getTime(); 2395 var timeToCall = Math.max(0, 16 - (currTime - lastTime)); 2396 var id = window.setTimeout(function () { 2397 callback(currTime + timeToCall); 2398 }, 2399 timeToCall); 2400 lastTime = currTime + timeToCall; 2401 return id; 2402 }; 2403 } 2404 if (!window.cancelAnimationFrame) { 2405 window.cancelAnimationFrame = function (id) { 2406 clearTimeout(id); 2407 }; 2408 } 2409 2410 var self = this; 2411 2412 self.options = { 2413 useEasing: true, 2414 useGrouping: true, 2415 separator: ',', 2416 decimal: '.', 2417 easingFn: null, 2418 formattingFn: null 2419 }; 2420 // Extend default options with passed options object 2421 for (var key in options) { 2422 if (options.hasOwnProperty(key)) { 2423 self.options[key] = options[key]; 2424 } 2425 } 2426 if (self.options.separator === '') { 2427 self.options.useGrouping = false; 2428 } 2429 if (!self.options.prefix) { 2430 self.options.prefix = ''; 2431 } 2432 if (!self.options.suffix) { 2433 self.options.suffix = ''; 2434 } 2435 2436 self.d = (typeof target === 'string') ? document.getElementById(target) : target; 2437 self.startVal = Number(startVal); 2438 self.endVal = Number(endVal); 2439 self.countDown = (self.startVal > self.endVal); 2440 self.frameVal = self.startVal; 2441 self.decimals = Math.max(0, decimals || 0); 2442 self.dec = Math.pow(10, self.decimals); 2443 self.duration = Number(duration) * 1000 || 2000; 2444 2445 self.formatNumber = function (nStr) { 2446 nStr = nStr.toFixed(self.decimals); 2447 nStr += ''; 2448 var x, x1, x2, rgx; 2449 x = nStr.split('.'); 2450 x1 = x[0]; 2451 x2 = x.length > 1 ? self.options.decimal + x[1] : ''; 2452 rgx = /(\d+)(\d{3})/; 2453 if (self.options.useGrouping) { 2454 while (rgx.test(x1)) { 2455 x1 = x1.replace(rgx, '$1' + self.options.separator + '$2'); 2456 } 2457 } 2458 return self.options.prefix + x1 + x2 + self.options.suffix; 2459 }; 2460 // Robert Penner's easeOutExpo 2461 self.easeOutExpo = function (t, b, c, d) { 2462 return c * (-Math.pow(2, -10 * t / d) + 1) * 1024 / 1023 + b; 2463 }; 2464 2465 self.easingFn = self.options.easingFn ? self.options.easingFn : self.easeOutExpo; 2466 self.formattingFn = self.options.formattingFn ? self.options.formattingFn : self.formatNumber; 2467 2468 self.version = function () { 2469 return '1.7.1'; 2470 }; 2471 2472 // Print value to target 2473 self.printValue = function (value) { 2474 var result = self.formattingFn(value); 2475 2476 if (self.d.tagName === 'INPUT') { 2477 this.d.value = result; 2478 } else if (self.d.tagName === 'text' || self.d.tagName === 'tspan') { 2479 this.d.textContent = result; 2480 } else { 2481 this.d.innerHTML = result; 2482 } 2483 }; 2484 2485 self.count = function (timestamp) { 2486 2487 if (!self.startTime) { 2488 self.startTime = timestamp; 2489 } 2490 2491 self.timestamp = timestamp; 2492 var progress = timestamp - self.startTime; 2493 self.remaining = self.duration - progress; 2494 2495 // To ease or not to ease 2496 if (self.options.useEasing) { 2497 if (self.countDown) { 2498 self.frameVal = self.startVal - self.easingFn(progress, 0, self.startVal - self.endVal, self.duration); 2499 } else { 2500 self.frameVal = self.easingFn(progress, self.startVal, self.endVal - self.startVal, self.duration); 2501 } 2502 } else { 2503 if (self.countDown) { 2504 self.frameVal = self.startVal - ((self.startVal - self.endVal) * (progress / self.duration)); 2505 } else { 2506 self.frameVal = self.startVal + (self.endVal - self.startVal) * (progress / self.duration); 2507 } 2508 } 2509 2510 // Don't go past endVal since progress can exceed duration in the last frame 2511 if (self.countDown) { 2512 self.frameVal = (self.frameVal < self.endVal) ? self.endVal : self.frameVal; 2513 } else { 2514 self.frameVal = (self.frameVal > self.endVal) ? self.endVal : self.frameVal; 2515 } 2516 2517 // Decimal 2518 self.frameVal = Math.round(self.frameVal * self.dec) / self.dec; 2519 2520 // Format and print value 2521 self.printValue(self.frameVal); 2522 2523 // Whether to continue 2524 if (progress < self.duration) { 2525 self.rAF = requestAnimationFrame(self.count); 2526 } else { 2527 if (self.callback) { 2528 self.callback(); 2529 } 2530 } 2531 }; 2532 // Start animation 2533 self.start = function (callback) { 2534 self.callback = callback; 2535 self.rAF = requestAnimationFrame(self.count); 2536 return false; 2537 }; 2538 // Toggles pause/resume animation 2539 self.pauseResume = function () { 2540 if (!self.paused) { 2541 self.paused = true; 2542 cancelAnimationFrame(self.rAF); 2543 } else { 2544 self.paused = false; 2545 delete self.startTime; 2546 self.duration = self.remaining; 2547 self.startVal = self.frameVal; 2548 requestAnimationFrame(self.count); 2549 } 2550 }; 2551 // Reset to startVal so animation can be run again 2552 self.reset = function () { 2553 self.paused = false; 2554 delete self.startTime; 2555 self.startVal = startVal; 2556 cancelAnimationFrame(self.rAF); 2557 self.printValue(self.startVal); 2558 }; 2559 // Pass a new endVal and start animation 2560 self.update = function (newEndVal) { 2561 cancelAnimationFrame(self.rAF); 2562 self.paused = false; 2563 delete self.startTime; 2564 self.startVal = self.frameVal; 2565 self.endVal = Number(newEndVal); 2566 self.countDown = (self.startVal > self.endVal); 2567 self.rAF = requestAnimationFrame(self.count); 2568 }; 2569 2570 // Format startVal on initialization 2571 self.printValue(self.startVal); 2572 }; 2573 2574 var easeOutCubic = function (t, b, c, d) { 2575 return c * ((t = t / d - 1) * t * t + 1) + b; 2576 }; 2577 2578 2579 /** 2580 * Create styles 2581 * 2582 * @since 10.5 2583 */ 2584 function nectarCreateStyle(styles, name) { 2585 2586 if(styles.length > 0) { 2587 2588 var head = document.head || document.getElementsByTagName('head')[0]; 2589 var style = document.createElement('style'); 2590 2591 style.type = 'text/css'; 2592 if (style.styleSheet) { 2593 style.styleSheet.cssText = styles; 2594 } else { 2595 style.appendChild(document.createTextNode(styles)); 2596 } 2597 2598 $(style).attr('id', name); 2599 $('head').find('#'+name).remove(); 2600 head.appendChild(style); 2601 2602 } 2603 2604 } 2605 2606 2607 2608 2609 /** 2610 * FancyBox lightbox. 2611 * 2612 * @since 8.0 2613 */ 2614 function fancyBoxInit() { 2615 2616 // Convert prettyPhoto links 2617 $('a.pp') 2618 .removeClass('pp') 2619 .attr('data-fancybox', ''); 2620 2621 $("a[rel^='prettyPhoto']:not([rel*='_gal']):not([rel*='product-gallery']):not([rel*='prettyPhoto['])") 2622 .removeAttr('rel') 2623 .attr('data-fancybox', ''); 2624 2625 var $unique_id = uniqueIdGenerate(); 2626 2627 // Image gallery nectar. 2628 $('.wpb_gallery .wpb_gallery_slidesnectarslider_style').each(function() { 2629 $unique_id = uniqueIdGenerate(); 2630 $(this).find('.swiper-slide a:not(.ext-url-link)').attr('data-fancybox', 'group_' + $unique_id); 2631 }); 2632 2633 // Flexslider. 2634 $('.wpb_gallery_slides.wpb_flexslider:not([data-onclick="custom_link"])').each(function() { 2635 $unique_id = uniqueIdGenerate(); 2636 $(this).find('.slides > li > a').attr('data-fancybox', 'group_' + $unique_id); 2637 }); 2638 2639 // Touch enabled gallery. 2640 $('.wpb_gallery_slidesflickity_style, .wpb_gallery_slidesflickity_static_height_style').each(function() { 2641 $unique_id = uniqueIdGenerate(); 2642 $(this).find('.cell > a:not(.ext-url-link)').attr('data-fancybox', 'group_' + $unique_id); 2643 }); 2644 2645 // Add galleries to portfolios. 2646 $('.portfolio-items, .wpb_gallery_slidesparallax_image_grid').each(function() { 2647 $unique_id = uniqueIdGenerate(); 2648 if ($(this).find('.pretty_photo').length > 0) { 2649 2650 $(this).find('.pretty_photo') 2651 .removeClass('pretty_photo') 2652 .attr('data-fancybox', 'group_' + $unique_id); 2653 2654 } else if ($(this).find('a[rel*="prettyPhoto["]').length > 0) { 2655 2656 $(this).find('a[rel*="prettyPhoto["]') 2657 .removeAttr('rel') 2658 .attr('data-fancybox', 'group_' + $unique_id); 2659 } 2660 2661 }); 2662 2663 // Nectar auto lightbox theme option. 2664 if ($body.hasClass('nectar-auto-lightbox')) { 2665 2666 $('.gallery').each(function() { 2667 if ($(this).find('.gallery-icon a[rel^="prettyPhoto"]').length == 0) { 2668 var $unique_id = uniqueIdGenerate(); 2669 $(this).find('.gallery-item .gallery-icon a[href*=".jpg"], .gallery-item .gallery-icon a[href*=".png"], .gallery-item .gallery-icon a[href*=".gif"], .gallery-item .gallery-icon a[href*=".jpeg"]') 2670 .attr('data-fancybox', 'group_' + $unique_id) 2671 .removeClass('pretty_photo'); 2672 } 2673 }); 2674 2675 $('.main-content img').each(function() { 2676 2677 if ($(this).parent().is("[href]") && 2678 !$(this).parent().is(".magnific-popup") && 2679 $(this).parents('.tiled-gallery').length == 0 && 2680 $(this).parents('.product-image').length == 0 && 2681 $(this).parents('.iosSlider.product-slider').length == 0) { 2682 2683 var match = $(this).parent().attr('href').match(/\.(jpg|png|gif)\b/); 2684 if (match) { 2685 $(this).parent().attr('data-fancybox', ''); 2686 } 2687 } 2688 }); 2689 } 2690 2691 // Regular. 2692 var fbMarginArr = ($('body.admin-bar').length > 0) ? [60, 100] : [60, 100]; 2693 if (nectarDOMInfo.winW < 1000) { 2694 fbMarginArr = [0, 0]; 2695 } 2696 $("[data-fancybox]").fancybox({ 2697 animationEffect: "zoom-in-out", 2698 animationDuration: 350, 2699 buttons: [ 2700 'fullScreen', 2701 'zoom', 2702 'close' 2703 ], 2704 margin: fbMarginArr, 2705 loop: true, 2706 caption: function() { 2707 return $(this).attr('title'); 2708 }, 2709 hash: false, 2710 beforeLoad: function(instance) { 2711 2712 if (typeof instance.current.src !== 'string') { 2713 $.fancybox.close(true); 2714 } 2715 2716 }, 2717 mobile: { 2718 margin: 0 2719 } 2720 }); 2721 } 2722 2723 /** 2724 * Magnific lightbox. 2725 * 2726 * @since 6.0 2727 */ 2728 function magnificInit() { 2729 2730 // Convert old pp links 2731 $('a.pp') 2732 .removeClass('pp') 2733 .addClass('magnific-popup'); 2734 2735 $("a[rel^='prettyPhoto']:not([rel*='_gal']):not([rel*='product-gallery']):not([rel*='prettyPhoto['])") 2736 .removeAttr('rel') 2737 .addClass('magnific-popup'); 2738 2739 // Image gallery nectar. 2740 $('.wpb_gallery .wpb_gallery_slidesnectarslider_style').each(function() { 2741 $(this).find('.swiper-slide a:not(.ext-url-link)').addClass('pretty_photo'); 2742 }); 2743 2744 // Flexslider. 2745 $('.wpb_gallery_slides.wpb_flexslider:not([data-onclick="custom_link"])').each(function() { 2746 $(this).find('.slides > li > a').addClass('pretty_photo'); 2747 }); 2748 2749 // Touch enabled gallery. 2750 $('.wpb_gallery_slidesflickity_style, .wpb_gallery_slidesflickity_static_height_style').each(function() { 2751 $(this).find('.cell > a:not(.ext-url-link)').addClass('pretty_photo'); 2752 }); 2753 2754 // Add galleries to portfolios. 2755 $('.portfolio-items, .wpb_gallery .swiper-slide, .wpb_gallery_slidesflickity_style .cell, .wpb_gallery_slidesflickity_static_height_style .cell, .wpb_gallery_slides.wpb_flexslider ul > li, .wpb_gallery .parallax-grid-item').each(function() { 2756 2757 if ($(this).find('.pretty_photo').length > 0) { 2758 2759 $(this) 2760 .find('.pretty_photo') 2761 .removeClass('pretty_photo') 2762 .addClass('gallery') 2763 .addClass('magnific'); 2764 2765 } else if ($(this).find('a[rel*="prettyPhoto["]').length > 0) { 2766 2767 $(this) 2768 .find('a[rel*="prettyPhoto["]') 2769 .removeAttr('rel') 2770 .addClass('gallery') 2771 .addClass('magnific'); 2772 } 2773 2774 }); 2775 2776 $("a[data-rel='prettyPhoto[product-gallery]']").each(function() { 2777 $(this) 2778 .removeAttr('data-rel') 2779 .addClass('magnific') 2780 .addClass('gallery'); 2781 }); 2782 2783 // Nectar auto lightbox theme option. 2784 if ($body.hasClass('nectar-auto-lightbox')) { 2785 $('.gallery').each(function() { 2786 if ($(this).find('.gallery-icon a[rel^="prettyPhoto"]').length == 0) { 2787 2788 $(this).find('.gallery-item .gallery-icon a[href*=".jpg"], .gallery-item .gallery-icon a[href*=".png"], .gallery-item .gallery-icon a[href*=".gif"], .gallery-item .gallery-icon a[href*=".jpeg"]') 2789 .addClass('magnific') 2790 .addClass('gallery') 2791 .removeClass('pretty_photo'); 2792 } 2793 }); 2794 2795 $('.main-content img').each(function() { 2796 2797 if ($(this).parent().is("[href]") && 2798 !$(this).parent().is(".magnific-popup") && 2799 $(this).parents('.tiled-gallery').length == 0 && 2800 $(this).parents('.product-image').length == 0 && 2801 $(this).parents('.iosSlider.product-slider').length == 0) { 2802 2803 var match = $(this).parent().attr('href').match(/\.(jpg|png|gif)\b/); 2804 if (match) { 2805 2806 $(this).parent() 2807 .addClass('magnific-popup') 2808 .addClass('image-link'); 2809 } 2810 } 2811 2812 }); 2813 2814 } 2815 2816 2817 // Regular. 2818 $('a.magnific-popup:not(.gallery):not(.nectar_video_lightbox)').magnificPopup({ 2819 type: 'image', 2820 callbacks: { 2821 imageLoadComplete: function() { 2822 var $that = this; 2823 setTimeout(function() { 2824 $that.wrap.addClass('mfp-image-loaded'); 2825 }, 10); 2826 }, 2827 beforeOpen: function() { 2828 this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim'); 2829 }, 2830 open: function() { 2831 2832 $.magnificPopup.instance.next = function() { 2833 var $that = this; 2834 2835
2835 this.wrap.removeClass('mfp-image-loaded'); 2836 setTimeout(function() { 2837 $.magnificPopup.proto.next.call($that); 2838 }, 100); 2839 }; 2840 2841 $.magnificPopup.instance.prev = function() { 2842 var $that = this; 2843 2844 this.wrap.removeClass('mfp-image-loaded'); 2845 setTimeout(function() { 2846 $.magnificPopup.proto.prev.call($that); 2847 }, 100); 2848 }; 2849 2850 } 2851 }, 2852 fixedContentPos: false, 2853 mainClass: 'mfp-zoom-in', 2854 removalDelay: 400 2855 }); 2856 2857 // Video. 2858 $('a.magnific-popup.nectar_video_lightbox, .magnific_nectar_video_lightbox a.link_text, .swiper-slide a[href*=youtube], .swiper-slide a[href*=vimeo], .nectar-video-box a.full-link.magnific-popup').magnificPopup({ 2859 type: 'iframe', 2860 fixedContentPos: false, 2861 mainClass: 'mfp-zoom-in', 2862 removalDelay: 400 2863 }); 2864 2865 2866 // Galleries. 2867 $('a.magnific.gallery').each(function() { 2868 2869 var $parentRow = ($(this).closest('.wpb_column').length > 0) ? $(this).closest('.wpb_column') : $(this).parents('.row'); 2870 2871 if ($parentRow.length > 0 && !$parentRow.hasClass('lightbox-col')) { 2872 2873 $parentRow.magnificPopup({ 2874 type: 'image', 2875 delegate: 'a.magnific', 2876 mainClass: 'mfp-zoom-in', 2877 fixedContentPos: false, 2878 callbacks: { 2879 2880 elementParse: function(item) { 2881 2882 if ($(item.el.context).is('[href]') && $(item.el.context).attr('href').indexOf('iframe=true') != -1 || 2883 $(item.el.context).is('[href]') && $(item.el.context).attr('href').indexOf('https://www.youtube.com/watch') != -1) { 2884 item.type = 'iframe'; 2885 } else if ($(item.el.context).is('[href]') && $(item.el.context).attr('href').indexOf('video-popup-') != -1) { 2886 item.type = 'inline'; 2887 } else { 2888 item.type = 'image'; 2889 } 2890 }, 2891 2892 imageLoadComplete: function() { 2893 var $that = this; 2894 setTimeout(function() { 2895 $that.wrap.addClass('mfp-image-loaded'); 2896 }, 10); 2897 }, 2898 2899 beforeOpen: function() { 2900 this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim'); 2901 }, 2902 2903 open: function() { 2904 2905 // Self hosted video. 2906 if ($(this.content).find('.mejs-video video').length > 0 && $().mediaelementplayer) { 2907 $(this.content).find('.mejs-video video')[0].player.remove(); 2908 2909 var $that = this; 2910 setTimeout(function() { 2911 $($that.content).find('video').mediaelementplayer(); 2912 $($that.content).find('.mejs-video video')[0].player.play(); 2913 }, 50); 2914 2915 } 2916 2917 $.magnificPopup.instance.next = function() { 2918 var $that = this; 2919 2920 this.wrap.removeClass('mfp-image-loaded'); 2921 setTimeout(function() { 2922 $.magnificPopup.proto.next.call($that); 2923 2924 // Self hosted video. 2925 if ($($that.content).find('.mejs-video video').length > 0) { 2926 $($that.content).find('.mejs-video video')[0].play(); 2927 } 2928 2929 }, 100); 2930 }; 2931 2932 $.magnificPopup.instance.prev = function() { 2933 var $that = this; 2934 2935 this.wrap.removeClass('mfp-image-loaded'); 2936 setTimeout(function() { 2937 $.magnificPopup.proto.prev.call($that); 2938 2939 // Self hosted video. 2940 if ($($that.content).find('.mejs-video video').length > 0) { 2941 $($that.content).find('.mejs-video video')[0].play(); 2942 } 2943 }, 100); 2944 }; 2945 2946 }, 2947 2948 close: function() { 2949 // Self hosted video. 2950 if ($(this.content).find('.mejs-video video').length > 0) { 2951 $(this.content).find('.mejs-video video')[0].load(); 2952 } 2953 } 2954 }, 2955 removalDelay: 400, 2956 gallery: { 2957 enabled: true 2958 } 2959 }); 2960 2961 $parentRow.addClass('lightbox-col'); 2962 } 2963 2964 }); 2965 2966 } 2967 2968 2969 /** 2970 * Lightbox initialization. 2971 * 2972 * Determines which lightbox to use based on theme option. 2973 * 2974 * @since 8.0 2975 */ 2976 function lightBoxInit() { 2977 2978 setTimeout(function(){ 2979 if ($('body[data-ls="magnific"]').length > 0 || $('body[data-ls="pretty_photo"]').length > 0) { 2980 magnificInit(); 2981 } else if ($('body[data-ls="fancybox"]').length > 0) { 2982 fancyBoxInit(); 2983 } 2984 },100); 2985 2986 } 2987 2988 2989 /** 2990 * WPBakery page builder standard animations. 2991 * 2992 * @since 7.0 2993 * @see waypoints 2994 */ 2995 function vcWaypoints() { 2996 2997 $($fullscreenSelector + ' .wpb_animate_when_almost_visible').each(function () { 2998 2999 var $that = $(this), 3000 $vcOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : '90%', 3001 waypoint = new Waypoint({ 3002 element: $that, 3003 handler: function () { 3004 3005 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated')) { 3006 waypoint.destroy(); 3007 return; 3008 } 3009 3010 $that.addClass("animated"); 3011 $that.addClass("wpb_start_animation"); 3012 waypoint.destroy(); 3013 3014 if ($that.is('.nectar-button') && $('body[data-button-style*="rounded_shadow"]').length > 0) { 3015 setTimeout(function () { 3016 $that.removeClass('wpb_start_animation'); 3017 }, 1100); 3018 } 3019 3020 }, 3021 offset: $vcOffsetPos 3022 3023 }); 3024 3025 }); 3026 } 3027 3028 3029 3030 /** 3031 * Milestone element initialization. 3032 * 3033 * @since 4.0 3034 * @see waypoints 3035 */ 3036 function milestoneInit() { 3037 3038 $('.nectar-milestone').each(function () { 3039 3040 // Symbol 3041 if ($(this).is('[data-symbol]')) { 3042 3043 if ($(this).find('.symbol-wrap').length == 0) { 3044 3045 if ($(this).attr('data-symbol-pos') == 'before') { 3046 $(this) 3047 .find('.number') 3048 .prepend('<div class="symbol-wrap"><span class="symbol">' + $(this).attr('data-symbol') + '</span></div>'); 3049 } else { 3050 $(this) 3051 .find('.number') 3052 .append('<div class="symbol-wrap"><span class="symbol">' + $(this).attr('data-symbol') + '</span></div>'); 3053 } 3054 } 3055 3056 var $symbol_size; 3057 3058 if ($(this).attr('data-symbol-size') == $(this).find('.number').attr('data-number-size') && $(this).attr('data-symbol-alignment') == 'superscript') { 3059 $symbol_size = 32; 3060 } else { 3061 $symbol_size = parseInt($(this).attr('data-symbol-size'));
3062 } 3063 3064 $(this).find('.symbol-wrap').css({ 3065 'font-size': $symbol_size + 'px', 3066 'line-height': $symbol_size + 'px' 3067 }); 3068 } 3069 3070 $(this).find('.number').css({ 3071 'font-size': $(this).find('.number').attr('data-number-size') + 'px', 3072 'line-height': $(this).find('.number').attr('data-number-size') + 'px' 3073 }); 3074 }); 3075 3076 if (!bypassAnimations && $('.nectar-milestone').length > 0 || $body.hasClass('rtl') && $('.nectar-milestone').length > 0) { 3077 3078 // Blur effect 3079 var $blurCssString = ''; 3080 $($fullscreenSelector + '.nectar-milestone.motion_blur').each(function (i) { 3081 3082 $(this).removeClass(function (index, className) { 3083 return (className.match(/(^|\s)instance-\S+/g) || []).join(' '); 3084 }); 3085 3086 $(this).addClass('instance-' + i); 3087 3088 var $currentColor = $(this).find('.number').css('color'), 3089 colorInt = parseInt($currentColor.substring(1), 16); 3090 3091 var R = (colorInt & 0xFF0000) >> 16, 3092 G = (colorInt & 0x00FF00) >> 8, 3093 B = (colorInt & 0x0000FF) >> 0; 3094 3095 var $rgbaColorStart = 'rgba(' + R + ',' + G + ',' + B + ',0.2)', 3096 $rgbaColorEnd = 'rgba(' + R + ',' + G + ',' + B + ',1)', 3097 $numberSize = parseInt($(this).find('.number').attr('data-number-size')); 3098 3099 $blurCssString += '@keyframes motion-blur-number-' + i + ' { ' + 3100 ' 0% { ' + 3101 'opacity: 0;' + 3102 'color: ' + $rgbaColorStart + '; ' + 3103 'text-shadow: 0 ' + $numberSize / 20 + 'px 0 ' + $rgbaColorStart + ', 0 ' + $numberSize / 10 + 'px 0 ' + $rgbaColorStart + ', 0 ' + $numberSize / 6 + 'px 0 ' + $rgbaColorStart + ', 0 ' + $numberSize / 5 + 'px 0 ' + $rgbaColorStart + ', 0 ' + $numberSize / 4 + 'px 0 ' + $rgbaColorStart + ', 0 -' + $numberSize / 20 + 'px 0 ' + $rgbaColorStart + ', 0 -' + $numberSize / 10 + 'px 0 ' + $rgbaColorStart + ', 0 -' + $numberSize / 6 + 'px 0 ' + $rgbaColorStart + ', 0 -' + $numberSize / 5 + 'px 0 ' + $rgbaColorStart + ', 0 -' + $numberSize / 4 + 'px 0 ' + $rgbaColorStart + '; ' + 3104 'transform: translateZ(0px) translateY(-100%); ' + 3105 '-webkit-transform: translateZ(0px) translateY(-100%); ' + 3106 '} ' + 3107 '33% { opacity: 1 }' + 3108 '100% { ' + 3109 'color: ' + $rgbaColorEnd + '; ' + 3110 'text-shadow: none; ' + 3111 'transform: translateZ(0px) translateY(0px); ' + 3112 '-webkit-transform: translateZ(0px) translateY(0px); ' + 3113 '} ' + 3114 '} ' + 3115 '@-webkit-keyframes motion-blur-number-' + i + ' { ' + 3116 ' 0% { ' + 3117 'opacity: 0;' + 3118 'color: ' + $rgbaColorStart + '; ' + 3119 'text-shadow: 0 ' + $numberSize / 20 + 'px 0 ' + $rgbaColorStart + ', 0 ' + $numberSize / 10 + 'px 0 ' + $rgbaColorStart + ', 0 ' + $numberSize / 6 + 'px 0 ' + $rgbaColorStart + ', 0 ' + $numberSize / 5 + 'px 0 ' + $rgbaColorStart + ', 0 ' + $numberSize / 4 + 'px 0 ' + $rgbaColorStart + ', 0 -' + $numberSize / 20 + 'px 0 ' + $rgbaColorStart + ', 0 -' + $numberSize / 10 + 'px 0 ' + $rgbaColorStart + ', 0 -' + $numberSize / 6 + 'px 0 ' + $rgbaColorStart + ', 0 -' + $numberSize / 5 + 'px 0 ' + $rgbaColorStart + ', 0 -' + $numberSize / 4 + 'px 0 ' + $rgbaColorStart + '; ' + 3120 'transform: translateZ(0px) translateY(-100%); ' + 3121 '-webkit-transform: translateZ(0px) translateY(-100%); ' + 3122 '} ' + 3123 '33% { opacity: 1 }' + 3124 '100% { ' + 3125 'color: ' + $rgbaColorEnd + '; ' + 3126 'text-shadow: none; ' + 3127 'transform: translateZ(0px) translateY(0px); ' + 3128 '-webkit-transform: translateZ(0px) translateY(0px); ' + 3129 '} ' + 3130 '} ' + 3131 '.nectar-milestone.motion_blur.instance-' + i + ' .number span.in-sight { animation: 0.65s cubic-bezier(0, 0, 0.17, 1) 0s normal backwards 1 motion-blur-number-' + i + '; -webkit-animation: 0.65s cubic-bezier(0, 0, 0.17, 1) 0s normal backwards 1 motion-blur-number-' + i + '; } '; 3132 3133 if( $nectarFullPage.$usingFullScreenRows != false || $(this).find('.number > span').length == 0 ) { 3134 3135 // Separate each character into spans 3136 var $symbol = $(this).find('.symbol-wrap').clone(); 3137 $(this).find('.symbol-wrap').remove(); 3138 3139 var characters = $(this).find('.number').text().split(""); 3140 var $this = $(this).find('.number'); 3141 3142 $this.empty(); 3143 $.each(characters, function (i, el) { 3144 $this.append("<span>" + el + "</span"); 3145 });
3146 3147 // Handle symbol 3148 if ($(this).has('[data-symbol]')) { 3149 if ($(this).attr('data-symbol-pos') == 'after') { 3150 $this.append($symbol); 3151 } else { 3152 $this.prepend($symbol); 3153 } 3154 } 3155 3156 } // already made markup 3157 3158 }); 3159 3160 // Style 3161 nectarCreateStyle($blurCssString, 'milestone-blur'); 3162 3163 // Activate 3164 milestoneWaypoint(); 3165 3166 } 3167 3168 } 3169 3170 3171 /** 3172 * Milestone animation 3173 * 3174 * @since 4.0 3175 */ 3176 function milestoneWaypoint() { 3177 3178 $($fullscreenSelector + '.nectar-milestone').each(function () { 3179 3180 // Animation 3181 var $offset = ($fullscreenMarkupBool == true) ? '250%' : '98%'; 3182 3183 if( nectarDOMInfo.usingMobileBrowser && $offset == '98%') { 3184 $offset = '110%'; 3185 } 3186 3187 var $that = $(this), 3188 waypoint = new Waypoint({ 3189 element: $that, 3190 handler: function () { 3191 3192 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 3193 waypoint.destroy(); 3194 return; 3195 } 3196 3197 var $endNum = parseInt($that.find('.number span:not(.symbol)').text().replace(/,/g, '')); 3198 3199 if (!$that.hasClass('motion_blur')) { 3200 3201 var countOptions = { 3202 easingFn: easeOutCubic 3203 }; 3204 var $countEle = $that.find('.number span:not(.symbol)')[0]; 3205 var numAnim = new CountUp($countEle, 0, $endNum, 0, 2.2, countOptions); 3206 numAnim.start(); 3207 3208 } else { 3209 $that.find('span').each(function (i) { 3210 var $that = $(this); 3211 setTimeout(function () { 3212 $that.addClass('in-sight'); 3213 }, 200 * i); 3214 }); 3215 } 3216 3217 3218 $that.addClass('animated-in'); 3219 waypoint.destroy(); 3220 }, 3221 offset: $offset 3222 3223 }); 3224 3225 }); 3226 } 3227 3228 3229 3230 /** 3231 * Tabbed element change section event. 3232 * 3233 * @since 10.5 3234 */ 3235 function tabbedChangeSection(clickedTab) { 3236 3237 var $id = clickedTab.parents('li').index() + 1; 3238 var $frontEndEditorTabDiv = ($('body.vc_editor').length > 0) ? '> .wpb_tab ' : ''; 3239 3240 if (!clickedTab.hasClass('active-tab') && !clickedTab.hasClass('loading')) { 3241 3242 clickedTab.parents('ul') 3243 .find('a') 3244 .removeClass('active-tab'); 3245 3246 clickedTab 3247 .addClass('active-tab'); 3248 3249 clickedTab.parents('.tabbed').find('> div:not(.clear)' + $frontEndEditorTabDiv).css({ 3250 'visibility': 'hidden', 3251 'position': 'absolute', 3252 'opacity': '0', 3253 'left': '-9999px', 3254 'display': 'none' 3255 }).removeClass('visible-tab'); 3256 3257 if ($('body.vc_editor').length > 0) { 3258 3259 var $data_m_id = (clickedTab.parent().is('[data-m-id]')) ? clickedTab.parent().attr('data-m-id') : ''; 3260 3261 clickedTab.parents('.tabbed').find('> div[data-model-id="' + $data_m_id + '"]' + $frontEndEditorTabDiv).css({ 3262 'visibility': 'visible', 3263 'position': 'relative', 3264 'left': '0', 3265 'display': 'block' 3266 }).stop().transition({ 3267 'opacity': 1 3268 }, 400).addClass('visible-tab'); 3269 3270 if( !$body.is('[data-flex-cols="true"]') ) { 3271 convertFrontEndPadding(); 3272 } 3273 3274 } else { 3275 clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ')' + $frontEndEditorTabDiv).css({ 3276 'visibility': 'visible', 3277 'position': 'relative', 3278 'left': '0', 3279 'display': 'block' 3280 }).stop().transition({ 3281 'opacity': 1 3282 }, 400).addClass('visible-tab'); 3283 } 3284 3285 if (clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ') .iframe-embed').length > 0 || 3286 clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ') .portfolio-items').length > 0) { 3287 setTimeout(function () { 3288 $window.trigger('resize'); 3289 }, 10); 3290 } 3291 } 3292 3293 // Waypoint checking 3294 if ($tabbedClickCount != 0) { 3295 3296 var $currentVisTab = clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ')' + $frontEndEditorTabDiv); 3297 3298 if ($currentVisTab.find('.nectar-progress-bar').length > 0) { 3299 progressBars();
3300 } 3301 if ($currentVisTab.find('.divider-small-border [data-animate="yes"]').length > 0 || 3302 $currentVisTab.find('.divider-border [data-animate="yes"]').length > 0) { 3303 dividers(); 3304 } 3305 if ($currentVisTab.find('img.img-with-animation').length > 0 || 3306 $currentVisTab.find('.col.has-animation').length > 0 || 3307 $currentVisTab.find('.nectar_cascading_images').length > 0 || 3308 $currentVisTab.find('.wpb_column.has-animation').length > 0) { 3309 colAndImgAnimations(); 3310 cascadingImageBGSizing(); 3311 } 3312 if ($currentVisTab.find('.column-image-bg-wrap[data-bg-animation="displace-filter-fade"]').length > 0) { 3313 3314 for (var k = 0; k < $liquidBG_EL.length; k++) { 3315 3316 if ($($liquidBG_EL[k].canvasContainer).parents('.wpb_tab').length > 0 && 3317 $($liquidBG_EL[k].canvasContainer).parents('.wpb_tab').css('visibility') != 'hidden') { 3318 3319 // Add bg to container 3320 if ($($liquidBG_EL[k].canvasContainer).find('.image-added-to-stage').length == 0) { 3321 $liquidBG_EL[k].imgContainer.addChild($liquidBG_EL[k].bg); 3322 } 3323 $($liquidBG_EL[k].canvasContainer).find('.nectar-liquid-bg').addClass('image-added-to-stage'); 3324
3325 // Resize calcs 3326 $liquidBG_EL[k].resize(); 3327 3328 // Animate 3329 if ($($liquidBG_EL[k].canvasContainer).find('.nectar-liquid-bg.animated-in').length == 0) { 3330 $liquidBG_EL[k].animateProps($liquidBG_EL[k]); 3331 } 3332 3333 } 3334 } 3335 } 3336 if ($currentVisTab.find('.nectar-milestone').length > 0) { 3337 milestoneWaypoint(); 3338 } 3339 if ($currentVisTab.find('.nectar_image_with_hotspots[data-animation="true"]').length > 0) { 3340 imageWithHotspots(); 3341 setTimeout(function(){ 3342 $window.trigger('resize'); 3343 },100); 3344 } 3345 if ($currentVisTab.find('.nectar-fancy-ul').length > 0) { 3346 nectarFancyUlInit(); 3347 } 3348 if ($currentVisTab.find('.nectar-split-heading').length > 0) { 3349 splitLineHeadings(); 3350 } 3351 if ($currentVisTab.find('.wpb_column[data-border-animation="true"]').length > 0) { 3352 animatedColBorders(); 3353 } 3354 if ($currentVisTab.find('.wpb_animate_when_almost_visible').length > 0) { 3355 vcWaypoints(); 3356 } 3357 if ($currentVisTab.find('.nectar-animated-title').length > 0) { 3358 animatedTitles(); 3359 } 3360 if ($currentVisTab.find('.nectar-highlighted-text').length > 0) { 3361 highlightedText(); 3362 } 3363 if ($currentVisTab.find('.nectar_food_menu_item').length > 0) { 3364 foodMenuItems(); 3365 } 3366 if ($currentVisTab.find('.nectar-post-grid:not([data-animation="none"])').length > 0) { 3367 NectarPostGridWaypoint(); 3368 } 3369 3370 if (clickedTab.parents('.wpb_row').length > 0) { 3371 3372 if ($currentVisTab.find('.vc_pie_chart').length > 0 || 3373 $currentVisTab.find('.wp-video-shortcode').length > 0 || 3374 $currentVisTab.find('.post-area.masonry .posts-container').length > 0 || 3375 $currentVisTab.find('.twentytwenty-container').length > 0 || 3376 clickedTab.parents('#nectar_fullscreen_rows[data-content-overflow="scrollbar"]').length > 0 || 3377 clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ')').find('.wpb_gallery').length > 0 || 3378 clickedTab.parents('.wpb_row').next().hasClass('parallax_section')) { 3379 $window.trigger('resize'); 3380 } 3381 3382 if ($currentVisTab.find('.nectar-flickity').length > 0 && typeof Flickity != 'undefined') { 3383 var tabbedFlkty = Flickity.data(clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ')').find('.nectar-flickity')[0]); 3384 tabbedFlkty.resize(); 3385 } 3386 3387 if ($currentVisTab.find('.nectar-woo-flickity').length > 0 && typeof Flickity != 'undefined') { 3388 var wootabbedFlkty = Flickity.data(clickedTab.parents('.tabbed').find('> div:nth-of-type(' + $id + ')').find('.nectar-woo-flickity > ul')[0]); 3389 wootabbedFlkty.resize(); 3390 } 3391 3392 } 3393 3394 //SVG icons 3395 $currentVisTab.find('.svg-icon-holder').each(function (i) { 3396 3397 var $that = $(this); 3398 3399 setTimeout(function () { 3400 3401 var $animationDelay = 0; 3402 3403 if($that.is('[data-animation-delay]') && 3404 $that.attr('data-animation-delay').length > 0 && 3405 $that.attr('data-animation') != 'false') { 3406 $animationDelay = $that.attr('data-animation-delay'); 3407 } 3408 3409 clearTimeout($animatedSVGIconTimeout[i]); 3410 3411 if ($that.attr('data-animation') == 'false') { 3412 $that.css('opacity', '1'); 3413 $svgIcons[$that.find('svg').attr('id').slice(-1)].finish(); 3414 } else { 3415 3416 $svgIcons[$that.find('svg').attr('id').slice(-1)].reset(); 3417 $animatedSVGIconTimeout[i] = setTimeout(function () { 3418 $svgIcons[$that.find('svg').attr('id').slice(-1)].play(); 3419 }, $animationDelay); 3420 3421 } 3422 }, 150); 3423 }); 3424 3425 } 3426 3427 // Fix columns inside tabs 3428 clickedTab.parents('.tabbed').find('.wpb_row').each(function () { 3429 if (typeof $(this).find('[class*="vc_col-"]').first().offset() != 'undefined') { 3430 3431 var $firstChildOffset = $(this).find('[class*="vc_col-"]').first().offset().left; 3432 3433 $(this).find('[class*="vc_col-"]').each(function () { 3434 $(this).removeClass('no-left-margin'); 3435 if ($(this).offset().left < $firstChildOffset + 15) { 3436 $(this).addClass('no-left-margin'); 3437 } else { 3438 $(this).removeClass('no-left-margin'); 3439 } 3440 });
3441 } 3442 3443 }); 3444 3445 $tabbedClickCount++; 3446 3447 // Magic line 3448 if (clickedTab.parent().parent().find('.magic-line').length > 0) { 3449 magicLineCalc(clickedTab); 3450 } 3451 3452 } 3453 3454 3455 /** 3456 * Tabbed element magic line - used for style "Minimal alt" 3457 * 3458 * @since 7.0 3459 */ 3460 function magicLineCalc($ele) { 3461 3462 var el, leftPos, ratio; 3463 3464 el = $ele.parent(); 3465 if (el.length) { 3466 leftPos = el.position().left; 3467 ratio = el.width(); 3468 } else { 3469 leftPos = ratio = 0; 3470 } 3471 3472 3473 $ele.parent().parent() 3474 .find('.magic-line') 3475 .css('transform', 'translateX(' + leftPos + 'px) scaleX(' + ratio + ')'); 3476 } 3477 3478 3479 /** 3480 * Tabbed element deep linking. 3481 * 3482 * @since 3.0 3483 */ 3484 function tabbbedDeepLinking() { 3485 3486 if (typeof nectarGetQueryParam['tab'] != 'undefined') { 3487 $('.wpb_tabs_nav').each(function () { 3488 3489 $(this).find('li').each(function () { 3490 3491 var $currentText = $(this).find('a').clone(), 3492 $getText = nectarGetQueryParam['tab'], 3493 $that = $(this); 3494 3495 $currentText.find('svg').remove(); 3496 $currentText = $currentText.text(); 3497 $currentText = $currentText.replace(/\s+/g, '-').toLowerCase(); 3498 3499 // SVG icons. 3500 if( $currentText.length > 0 && $currentText.substring(0,1) === '-' ) { 3501 $currentText = $currentText.substring(1); 3502 } 3503 3504 $getText = $getText.replace(/\s+/g, '-').replace(/</g, '<').replace(/"/g, '"').toLowerCase(); 3505 3506 if ($currentText == $getText) { 3507 3508 $(this).find('a').trigger('click'); 3509 3510 setTimeout(function () { 3511 $that.find('a').trigger('click'); 3512 }, 501); 3513 } 3514 3515 }); 3516 3517 }); 3518 3519 } 3520 3521 } 3522 3523 3524 3525 /** 3526 * Tabbed element initialization. 3527 * 3528 * @since 3.0 3529 */ 3530 function tabbedInit() { 3531 3532 // Click event 3533 $body.on('click', '.tabbed > ul li:not(.cta-button) a', function(){ 3534 tabbedChangeSection($(this)); 3535 return false; 3536 }); 3537 3538 $('.tabbed').each(function () { 3539 3540 var $that; 3541 3542 // Handle icons 3543 $(this).find('.wpb_tab').each(function (i) { 3544 3545 if ($(this).is('[data-tab-icon]') && $(this).attr('data-tab-icon').length > 0) { 3546 3547 $(this) 3548 .parents('.tabbed') 3549 .addClass('using-icons'); 3550 3551 $(this) 3552 .parents('.tabbed') 3553 .find('.wpb_tabs_nav li:nth-child(' + (i + 1) + ') > a') 3554 .prepend('<i class="' + $(this).attr("data-tab-icon") + '"></i>'); 3555 3556 } 3557 3558 // SVG icons 3559 if ($(this).find('.im-icon-wrap.tab-icon').length > 0) { 3560 3561 var $svg_icon_markup = $(this).find('.im-icon-wrap.tab-icon').detach(); 3562 $(this).parents('.tabbed') 3563 .find('.wpb_tabs_nav li:nth-child(' + (i + 1) + ') > a') 3564 .prepend($svg_icon_markup); 3565 } 3566 3567 }); 3568 3569 3570 if ($(this).find('.swiper-container').length == 0 && 3571 $(this).find('.testimonial_slider').length == 0 && 3572 $(this).find('.portfolio-items:not(".carousel")').length == 0 && 3573 $(this).find('.wpb_gallery .portfolio-items').length == 0 && 3574 $(this).find('iframe').length == 0) { 3575 $(this).find('> ul li:first-child a').trigger('click'); 3576 } 3577 3578 if ($(this).find('.testimonial_slider').length > 0 || 3579 $(this).find('.portfolio-items:not(".carousel")').length > 0 || 3580 $(this).find('.wpb_gallery .portfolio-items').length > 0 || 3581 $(this).find('iframe').length > 0) { 3582 3583 $that = $(this); 3584 $(this).find('.wpb_tab').show().css({ 3585 'opacity': 0, 3586 'height': '1px' 3587 }); 3588 3589 $(this).find('> ul li a').addClass('loading'); 3590 3591 setTimeout(function () { 3592 $that.find('.wpb_tab').hide().css({ 3593 'opacity': 1, 3594 'height': 'auto' 3595 }); 3596 3597 $that.find('> ul li a').removeClass('loading'); 3598 $that.find('> ul li:first-child a').trigger('click'); 3599 tabbbedDeepLinking(); 3600 3601 }, 900); 3602 } 3603 3604 $that = $(this); 3605 3606 // Minimal alt effect 3607 setTimeout(function () { 3608 if ($that.is('[data-style="minimal_alt"]')) { 3609 $that.find('> ul').append('<li class="magic-line" />'); 3610 magicLineCalc($that.find('> ul > li:first-child > a')); 3611 } 3612 }, 100); 3613 3614 3615 }); 3616 3617 // Minimal alt resize event. 3618 if ( $('.tabbed[data-style="minimal_alt"]').length > 0 ) { 3619 $window.on('smartresize',function(){ 3620 3621 $('.tabbed[data-style="minimal_alt"]').each(function(){ 3622 3623 if( $(this).find('a.active-tab').length > 0 ) { 3624 magicLineCalc( $(this).find('a.active-tab') ); 3625 } 3626 3627 });
3628 3629 3630 }); 3631 3632 } 3633 3634 3635 tabbbedDeepLinking(); 3636 3637 // Vertical scrolling 3638 $('.nectar-scrolling-tabs').each(function(i) { 3639 if(!nectarDOMInfo.usingFrontEndEditor) { 3640 $verticalScrollingTabs[i] = new VerticalScrollingTabs($(this)); 3641 } 3642 }); 3643 3644 3645 } 3646 3647 3648 /** 3649 * Vertical Scrolling Tabs 3650 * 3651 * @since 12.0 3652 */ 3653 3654 function VerticalScrollingTabs(el) { 3655 3656 this.$el = el; 3657 this.$tabContent = el.find('.scrolling-tab-content'); 3658 this.$lineEl = el.find('.scrolling-tab-nav .line'); 3659 this.observer = null; 3660 3661 this.domSetup(); 3662 this.highlightObserve(); 3663 // Sticky handled in stickySidebarInit(); 3664 3665 } 3666 3667 VerticalScrollingTabs.prototype.domSetup = function() { 3668 3669 var that = this; 3670 var href = ''; 3671 3672 3673 // Icons 3674 this.$el.find('.wpb_tab').each(function (i) { 3675 3676 if ($(this).is('[data-tab-icon]') && $(this).attr('data-tab-icon').length > 0) { 3677 that.$el.addClass('using-icons'); 3678 3679 href = that.$el.find('.wpb_tabs_nav li:nth-child(' + (i + 1) + ') a').attr('href'); 3680 3681 that.$el 3682 .find('.wpb_tabs_nav li:nth-child(' + (i + 1) + ')') 3683 .addClass('has-icon') 3684 .prepend('<a class="skip-hash" href="'+href+'"><i class="' + $(this).attr("data-tab-icon") + '"></i></a>'); 3685 } 3686 3687 // SVG icons 3688 if ($(this).find('.im-icon-wrap.tab-icon').length > 0) { 3689 3690 href = that.$el.find('.wpb_tabs_nav li:nth-child(' + (i + 1) + ') a').attr('href'); 3691 3692 var $svg_icon_markup = $(this).find('.im-icon-wrap.tab-icon').detach(); 3693 that.$el 3694 .find('.wpb_tabs_nav li:nth-child(' + (i + 1) + ')') 3695 .addClass('has-icon') 3696 .prepend('<a class="skip-hash svg-icon-link" href="'+href+'"></a>'); 3697 3698 that.$el.find('.wpb_tabs_nav li:nth-child(' + (i + 1) + ') .svg-icon-link').append($svg_icon_markup); 3699 3700 } 3701 3702 }); 3703 3704 3705 // First active 3706 this.$el.find('.scrolling-tab-nav .menu-item:first').addClass('active'); 3707 this.lineAnimation(); 3708 3709 // Only tab 3710 if( this.$el.find('.scrolling-tab-nav .menu-item').length == 1 ) { 3711 this.$el.find('.scrolling-tab-nav').addClass('single-tab'); 3712 } 3713 3714 var $tabContent = this.$el.find('.scrolling-tab-content'); 3715 3716 this.$el.find('.scrolling-tab-nav .menu-item').each(function(i) { 3717 3718 i = i+1; 3719 var $tab = $tabContent.find('> div:nth-child('+i+')'); 3720 3721 // Add titles to mobile 3722 var $title = $(this).html(); 3723 $tab.prepend('<div class="scrolling-tab-mobile-title"><div class="inner">' + $title + '</div></div>'); 3724 $tab.find('a').contents().unwrap(); 3725 3726 // Create normal anchor relation. 3727 if( $tab ) { 3728 var id = $(this).find('a').attr('href'); 3729 id = id.substr(1); 3730 $tab.find('> .scrolling-tab-mobile-title').attr('id',id); 3731 $tab.removeAttr('id'); 3732 } 3733 3734 }); 3735 3736 3737 3738 }; 3739 3740 VerticalScrollingTabs.prototype.highlightObserve = function() { 3741 3742 var that = this; 3743 3744 if( !(nectarDOMInfo.usingMobileBrowser && nectarDOMInfo.winW < 1000) ) { 3745 3746 if( 'IntersectionObserver' in window ) { 3747 3748 var options = { 3749 rootMargin: '0px', 3750 threshold: 1 3751 } 3752 3753 this.observer = new IntersectionObserver(function(entries) { 3754 3755 entries.forEach(function(entry) { 3756 3757 var href = '#' + $(entry.target).attr('id'); 3758 var $menuItem = that.$el.find('.scrolling-tab-nav a[href="'+href+'"]'); 3759 3760 if (entry.isIntersecting && entry.intersectionRatio >= 1) { 3761 3762 $menuItem.parents('.menu-item').addClass('visible'); 3763 3764 } else { 3765 $menuItem.parents('.menu-item').removeClass('visible'); 3766 } 3767 3768 // Highlight 3769 var $firstVisLink = that.$el.find('.scrolling-tab-nav .menu-item.visible:first'); 3770 3771 // a link is visible 3772 if( $firstVisLink.length > 0 ) { 3773 that.$el.find('.scrolling-tab-nav .menu-item').removeClass('active'); 3774 $firstVisLink.addClass('active'); 3775 that.lineAnimation(); 3776 } 3777 3778 3779 });
3780 3781 }, options); 3782 3783 // Observe each section. 3784 this.$tabContent.find('> div > .scrolling-tab-mobile-title[id]').each(function() { 3785 that.observer.observe($(this)[0]); 3786 }); 3787 3788 } // if intersection observer. 3789 3790 } // don't trigger on mobile. 3791 3792 }; 3793 3794 VerticalScrollingTabs.prototype.lineAnimation = function() { 3795 3796 var activeItem = this.$el.find('.scrolling-tab-nav .active'); 3797 3798 if( activeItem.length == 0 ) { 3799 return; 3800 } 3801 3802 var itemOffset = parseInt(activeItem.position().top); 3803 var itemHeight = parseInt(activeItem.height()); 3804 3805 this.$lineEl.css({ 3806 'max-height': itemHeight + 'px', 3807 'transform' : 'translate3d(0px, '+itemOffset+'px, 0px)' 3808 }); 3809 3810 }; 3811 3812 3813 3814 3815 3816 3817 3818 3819 /** 3820 * Toggle Panels element deep linking. 3821 * 3822 * @since 3.0 3823 */ 3824 function accordionDeepLinking() { 3825 3826 if (typeof nectarGetQueryParam['toggle'] != 'undefined') { 3827 $('.toggles').each(function () { 3828 3829 $(this).find('.toggle').each(function () { 3830 var $currentText = $(this).find('h3 a').clone(); 3831 var $getText = nectarGetQueryParam['toggle']; 3832 3833 $($currentText).find('i').remove(); 3834 $currentText = $currentText.text(); 3835 $currentText = $currentText.replace(/\s+/g, '-').toLowerCase(); 3836 $getText = $getText.replace(/\s+/g, '-').replace(/</g, '<').replace(/"/g, '"').toLowerCase(); 3837 3838 if ($currentText == $getText) { 3839 $(this).find('h3 a').trigger('click'); 3840 } 3841 }); 3842 }); 3843 } 3844 3845 } 3846 3847 3848 3849 3850 function accordionSizing() { 3851 3852 $('.toggles').each(function(){ 3853 3854 var openToggle = $(this).find('.toggle.open'); 3855 if( openToggle.length > 0 ) { 3856 var openToggleInner = openToggle.find('> div')[0]; 3857 3858 openToggleInner.style.maxHeight = openToggleInner.scrollHeight + "px"; 3859 } 3860 3861 3862 }); 3863 3864 } 3865 3866 /** 3867 * Toggle Panels element initialization. 3868 * 3869 * @since 3.0 3870 */ 3871 function accordionInit() { 3872 3873 setTimeout(function() { 3874 3875 $('.accordion').each(function () { 3876 3877 // Legacy. 3878 if( $(this).find('.toggle[data-inner-wrap="true"]').length == 0 ) { 3879 $(this).find('> .toggle').first().addClass('open').find('> div').show(); 3880 } else if(!nectarDOMInfo.usingFrontEndEditor) { 3881 var $firstToggle = $(this).find('> .toggle').first(); 3882 $firstToggle.addClass('open'); 3883 $firstToggle.find('> div')[0].style.maxHeight = $firstToggle.find('> div')[0].scrollHeight + "px"; 3884 } 3885 3886 $(this).find('> .toggle').first().find('a:not(.nectar-button) i').attr('class', 'icon-minus-sign'); 3887 3888 }); 3889 3890 accordionDeepLinking(); 3891 3892 }, 60); 3893 3894 if( $('.toggle[data-inner-wrap="true"]').length > 0 ) { 3895 $window.on('smartresize', accordionSizing); 3896 } 3897 3898 } 3899 3900 function accordionClickEvents() { 3901 3902 // Regular toggle click event 3903 $body.on('click', '.toggle h3 a', function () { 3904 3905 if (!$(this).parents('.toggles').hasClass('accordion')) { 3906 3907 // Legacy. 3908 if( $(this).parents('.toggle[data-inner-wrap="true"]').length == 0 ) { 3909 3910 $(this).parents('.toggle') 3911 .find('> div') 3912 .slideToggle(300); 3913 3914 } else { 3915 3916 var parentEl = $(this).parents('.toggle').find('> div')[0]; 3917 3918 if (parentEl.style.maxHeight) { 3919 parentEl.style.maxHeight = null; 3920 } else { 3921 parentEl.style.maxHeight = parentEl.scrollHeight + "px"; 3922 } 3923 3924 } 3925 3926 3927 $(this).parents('.toggle') 3928 .toggleClass('open'); 3929 3930 // Switch icon 3931 if ($(this).parents('.toggle').hasClass('open')) { 3932 $(this) 3933 .find('i') 3934 .attr('class', 'icon-minus-sign'); 3935 } else { 3936 $(this) 3937 .find('i') 3938 .attr('class', 'icon-plus-sign'); 3939 } 3940 3941 if ($(this).parents('.toggle').find('> div .iframe-embed').length > 0 && 3942 $(this).parents('.toggle').find('> div iframe.iframe-embed').height() == '0') { 3943 responsiveVideoIframes(); 3944 } 3945 3946 if ($(this).parents('.full-width-content').length > 0) { 3947 setTimeout(function () { 3948 fullWidthContentColumns(); 3949 }, 300); 3950 } 3951 3952 if ($('#nectar_fullscreen_rows').length > 0) { 3953 setTimeout(function () { 3954 $window.trigger('smartresize'); 3955 }, 300); 3956 } 3957 return false; 3958 } 3959 }); 3960 3961 // Accordion click event 3962 $body.on('click', '.accordion .toggle h3 a', function () { 3963 3964 if ($(this).parents('.toggle').hasClass('open')) { 3965 return false; 3966 } 3967 3968 var $t; 3969 var $parentToggles = $(this).parents('.toggles'); 3970 var $parentToggle = $(this).parents('.toggle'); 3971 3972 3973 // Legacy. 3974 if( $(this).parents('.toggle[data-inner-wrap="true"]').length == 0 ) { 3975 3976 $parentToggles.find('.toggle > div').slideUp(300); 3977 $parentToggles.find('.toggle h3 a i').attr('class', 'icon-plus-sign'); 3978 $parentToggles.find('.toggle').removeClass('open'); 3979 $parentToggle.find('> div').slideDown(300); 3980 $parentToggle.addClass('open'); 3981 3982 } else { 3983 3984 var parentEl = $parentToggle.find('> div')[0]; 3985 3986 $parentToggles.find('.toggle > div').each(function(){ 3987 $(this)[0].style.maxHeight = null; 3988 });
3989 3990 $parentToggles.find('.toggle h3 a i').attr('class', 'icon-plus-sign'); 3991 $parentToggles.find('.toggle').removeClass('open'); 3992 3993 parentEl.style.maxHeight = parentEl.scrollHeight + "px"; 3994 3995 $parentToggle.addClass('open'); 3996 3997 } 3998 3999 // Switch icon 4000 if ($parentToggle.hasClass('open')) { 4001 $(this).find('i').attr('class', 'icon-minus-sign'); 4002 } else { 4003 $(this).find('i').attr('class', 'icon-plus-sign'); 4004 } 4005 4006 if ($(this).parents('.full-width-content').length > 0) { 4007 clearTimeout($t); 4008 $t = setTimeout(function () { 4009 fullWidthContentColumns(); 4010 }, 400); 4011 } 4012 if ($('#nectar_fullscreen_rows').length > 0) { 4013 clearTimeout($t); 4014 $t = setTimeout(function () { 4015 $window.trigger('smartresize'); 4016 }, 400); 4017 } 4018 4019 return false; 4020 4021 }); 4022 4023 } 4024 4025 4026 4027 4028 4029 /** 4030 * Color hex to rgb 4031 * 4032 * @since 3.0 4033 */ 4034 function shadeColor(hex, lum) { 4035 4036 // Validate hex string 4037 hex = String(hex).replace(/[^0-9a-f]/gi, ''); 4038 if (hex.length < 6) { 4039 hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2]; 4040 } 4041 lum = lum || 0; 4042 4043 // Convert to decimal and change luminosity 4044 var rgb = "#", 4045 c, i; 4046 for (i = 0; i < 3; i++) { 4047 c = parseInt(hex.substr(i * 2, 2), 16); 4048 c = Math.round(Math.min(Math.max(0, c + (c * lum)), 255)).toString(16); 4049 rgb += ("00" + c).substr(c.length); 4050 } 4051 4052 return rgb; 4053 } 4054 4055 /** 4056 * Jumbo size 3D nectar button. 4057 * 4058 * @since 3.0 4059 */ 4060 function createExtraJumboSize() { 4061 4062 $('.nectar-3d-transparent-button').each(function () { 4063 4064 if ($(this).css('visibility') != 'visible') { 4065 return; 4066 } 4067 4068 var $that = $(this), 4069 $size = $that.attr('data-size'), 4070 $padding = 0; 4071 4072 var $vert_height_divider = 1.7; 4073 4074 if ($size == 'extra_jumbo') { 4075 4076 var $font_size; 4077 4078 if (nectarDOMInfo.winW < 1000 && nectarDOMInfo.winW > 690) { 4079 $padding = 64; 4080 $font_size = 34; 4081 $that.find('.back-3d rect').attr('stroke-width', '12'); 4082 $vert_height_divider = 1.7; 4083 } else if (nectarDOMInfo.winW <= 690) { 4084 $padding = 46; 4085 $font_size = 16; 4086 $that.find('.back-3d rect').attr('stroke-width', '10'); 4087 $vert_height_divider = 1.7; 4088 } else { 4089 $padding = 100; 4090 $font_size = 64; 4091 $that.find('.back-3d rect').attr('stroke-width', '20'); 4092 $vert_height_divider = 1.6; 4093 } 4094 4095 4096 $that.find('svg text').attr('font-size', $font_size); 4097 4098 var $boundingRect = $(this).find('.back-3d .button-text')[0].getBoundingClientRect(), 4099 $text_width = $boundingRect.width, 4100 $text_height = $font_size * 1.5; 4101 4102 $that.css({ 4103 'width': ($text_width + $padding * 1.5) + 'px', 4104 'height': ($text_height + $padding) + 'px' 4105 }); 4106 4107 $that.find('> a').css({ 4108 'height': ($text_height + $padding) + 'px' 4109 }); 4110 4111 $that.find('.back-3d svg, .front-3d svg').css({ 4112 'width': ($text_width + $padding * 1.5) + 'px', 4113 'height': ($text_height + $padding) + 'px' 4114 }).attr('viewBox', '0 0 ' + ($text_width + $padding) + ' ' + ($text_height + $padding)); 4115 4116 $that.find('svg text').attr('transform', 'matrix(1 0 0 1 ' + ($text_width + $padding * 1.6) / 2 + ' ' + (($text_height + $padding) / $vert_height_divider) + ')'); 4117 $that.find('.front-3d ').css('transform-origin', '50% 50% -' + ($text_height + $padding) / 2 + 'px'); 4118 $that.find('.back-3d').css('transform-origin', '50% 50% -' + ($text_height + $padding) / 2 + 'px'); 4119 4120 } 4121 4122 }); 4123 4124 } 4125 4126 4127 /** 4128 * Nectar Button custom coloring 4129 * 4130 * @since 3.0 4131 */ 4132 function coloredButtons() { 4133 4134 $('.nectar-button.see-through[data-color-override], .nectar-button.see-through-2[data-color-override], .nectar-button.see-through-3[data-color-override]').each(function () { 4135 4136 var $usingMaterialSkin = ($('body.material[data-button-style^="rounded"]').length > 0) ? true : false; 4137 $(this).css('visibility', 'visible'); 4138 4139 if ($(this).hasClass('see-through-3') && $(this).attr('data-color-override') == 'false') { 4140 return true; 4141 } 4142 4143 var $color; 4144 var $that; 4145 4146 if ($(this).attr('data-color-override') != 'false') { 4147 $color = $(this).attr('data-color-override'); 4148 } else { 4149
4150 if ($(this).parents('.dark').length > 0) { 4151 $color = '#000000'; 4152 } else { 4153 $color = '#ffffff'; 4154 } 4155 4156 } 4157 4158 if (!$(this).hasClass('see-through-3')) { 4159 $(this).css('color', $color); 4160 } 4161 4162 $(this).find('i').css('color', $color); 4163 4164 var colorInt = parseInt($color.substring(1), 16); 4165 var $hoverColor = ($(this).has('[data-hover-color-override]')) ? $(this).attr('data-hover-color-override') : 'no-override'; 4166 var $hoverTextColor = ($(this).has('[data-hover-text-color-override]')) ? $(this).attr('data-hover-text-color-override') : '#fff'; 4167 4168 var R = (colorInt & 0xFF0000) >> 16; 4169 var G = (colorInt & 0x00FF00) >> 8; 4170 var B = (colorInt & 0x0000FF) >> 0; 4171 4172 var $opacityStr = ($(this).hasClass('see-through-3')) ? '1' : '0.75'; 4173 4174 $(this).css('border-color', 'rgba(' + R + ',' + G + ',' + B + ',' + $opacityStr + ')'); 4175 4176 // Material theme skin buttons w/ icons starting 4177 if ($usingMaterialSkin) { 4178 $(this).find('i').css({ 4179 'background-color': 'rgba(' + R + ',' + G + ',' + B + ',1)', 4180 'box-shadow': '0px 8px 15px rgba(' + R + ',' + G + ',' + B + ',0.24)' 4181 }); 4182 } 4183 4184 if ($(this).hasClass('see-through')) { 4185 4186 $that = $(this); 4187 4188 $(this).on('mouseenter touchstart', function () { 4189 $that.css('border-color', 'rgba(' + R + ',' + G + ',' + B + ',1)'); 4190 }); 4191 4192 $(this).on('mouseleave touchtouchend', function () { 4193 $that.css('border-color', 'rgba(' + R + ',' + G + ',' + B + ',1)'); 4194 $opacityStr = ($(this).hasClass('see-through-3')) ? '1' : '0.75'; 4195 $that.css('border-color', 'rgba(' + R + ',' + G + ',' + B + ',' + $opacityStr + ')'); 4196 }); 4197 4198 } else { 4199 4200 $(this).find('i').css('color', $hoverTextColor); 4201 4202 if ($hoverColor != 'no-override') { 4203 4204 $that = $(this); 4205 4206 $(this).on('mouseenter touchstart', function () { 4207 4208 $that.css({ 4209 'border-color': $hoverColor, 4210 'background-color': $hoverColor, 4211 'color': $hoverTextColor 4212 });
4213 4214 // Material buttons w/ icons over 4215 if ($usingMaterialSkin) { 4216 $that.find('i').css({ 4217 'background-color': '', 4218 'box-shadow': '' 4219 }); 4220 } 4221 }); 4222 4223 $(this).on('mouseleave touchtouchend', function () { 4224 4225 $opacityStr = ($(this).hasClass('see-through-3')) ? '1' : '0.75'; 4226 4227 if ($usingMaterialSkin) { 4228 $that.find('i').css({ 4229 'background-color': 'rgba(' + R + ',' + G + ',' + B + ',1)', 4230 'box-shadow': '0px 8px 15px rgba(' + R + ',' + G + ',' + B + ',0.24)' 4231 }); 4232 } 4233 4234 if (!$that.hasClass('see-through-3')) { 4235 $that.css({ 4236 'border-color': 'rgba(' + R + ',' + G + ',' + B + ',' + $opacityStr + ')', 4237 'background-color': 'transparent', 4238 'color': $color 4239 }); 4240 } else { 4241 $that.css({ 4242 'border-color': 'rgba(' + R + ',' + G + ',' + B + ',' + $opacityStr + ')', 4243 'background-color': 'transparent' 4244 }); 4245 } 4246 4247 }); 4248 4249 } else { 4250 4251 $that = $(this); 4252 4253 $(this).on('mouseenter touchstart', function () { 4254 4255 $that.css({ 4256 'border-color': $hoverColor, 4257 'color': $hoverTextColor 4258 });
4259 4260 }); 4261 4262 $(this).on('mouseleave touchtouchend', function () { 4263 4264 $opacityStr = ($that.hasClass('see-through-3')) ? '1' : '0.75'; 4265 $that.css({ 4266 'border-color': 'rgba(' + R + ',' + G + ',' + B + ',' + $opacityStr + ')', 4267 'color': $hoverTextColor 4268 }); 4269 4270 }); 4271 4272 } 4273 } 4274 }); 4275 4276 $('.nectar-button:not(.see-through):not(.see-through-2):not(.see-through-3)[data-color-override]').each(function () { 4277 4278 $(this).css('visibility', 'visible'); 4279 4280 if ($(this).attr('data-color-override') != 'false') { 4281 4282 var $color = $(this).attr('data-color-override'); 4283 4284 $(this) 4285 .removeClass('accent-color') 4286 .removeClass('extra-color-1') 4287 .removeClass('extra-color-2') 4288 .removeClass('extra-color-3') 4289 .css('background-color', $color); 4290 } 4291 4292 }); 4293 4294 4295 // Solid color tilt 4296 if ($('.swiper-slide .solid_color_2').length > 0 || $('.tilt-button-inner').length > 0) { 4297 4298 var $tiltButtonCssString = ''; 4299 var $color; 4300 4301 $('.swiper-slide .solid_color_2 a').each(function (i) { 4302 4303 $(this).addClass('instance-' + i); 4304 4305 if ($(this).attr('data-color-override') != 'false') { 4306 $color = $(this).attr('data-color-override'); 4307 } else { 4308 if ($(this).parents('.dark').length > 0) { 4309 $color = '#000000'; 4310 } 4311 else { 4312 $color = '#ffffff'; 4313 } 4314 } 4315 4316 $(this).css('color', $color); 4317 $(this).find('i').css('color', $color); 4318 4319 var $currentColor = $(this).css('background-color'), 4320 $topColor = shadeColor($currentColor, 0.13), 4321 $bottomColor = shadeColor($currentColor, -0.15); 4322 4323 $tiltButtonCssString += '.swiper-slide .solid_color_2 a.instance-' + i + ':after { background-color: ' + $topColor + '; }' + ' .swiper-slide .solid_color_2 a.instance-' + i + ':before { background-color: ' + $bottomColor + '; } '; 4324 4325 }); 4326 4327 4328 $('.tilt-button-wrap a').each(function (i) { 4329 4330 $(this).addClass('instance-' + i); 4331 4332 var $currentColor = $(this).css('background-color'); 4333 var $color; 4334 4335 if ($(this).attr('data-color-override') != 'false') { 4336 $color = $(this).attr('data-color-override'); 4337 $(this).css('background-color', $color); 4338 $currentColor = $color; 4339 } 4340 4341 var $topColor = shadeColor($currentColor, 0.13), 4342 $bottomColor = shadeColor($currentColor, -0.15); 4343 4344 $tiltButtonCssString += '.tilt-button-wrap a.instance-' + i + ':after { background-color: ' + $topColor + '; }' + ' .tilt-button-wrap a.instance-' + i + ':before { background-color: ' + $bottomColor + '; } '; 4345 4346 }); 4347 4348 // Style 4349 nectarCreateStyle($tiltButtonCssString, 'tilt-button'); 4350 4351 } 4352 4353 4354 // Transparent 3D 4355 if ($('.nectar-3d-transparent-button').length > 0) { 4356 4357 var $3dTransButtonCssString = ''; 4358 $('.nectar-3d-transparent-button').each(function (i) { 4359 4360 var $that = $(this), 4361 $size = $that.attr('data-size'), 4362 $padding = 0, 4363 v1 = 1.5, 4364 v2 = 1.65, 4365 $font_size; 4366 4367 // Size 4368 if ($size == 'large') { 4369 $padding = 46; 4370 $font_size = 16; 4371 v1 = 1.5; 4372 v2 = 1.7; 4373 } else if ($size == 'medium') { 4374 $padding = 30; 4375 $font_size = 16; 4376 } else if ($size == 'small') { 4377 $padding = 20; 4378 $font_size = 12; 4379 } else if ($size == 'jumbo') { 4380 $padding = 54; 4381 $font_size = 24; 4382 v1 = 1.5; 4383 v2 = 1.68; 4384 } else if ($size == 'extra_jumbo') { 4385 $padding = 100; 4386 $font_size = 64; 4387 v1 = 1.6; 4388 v2 = 1.6; 4389 } 4390 4391 $that.find('svg text').attr('font-size', $font_size); 4392 4393 var $boundingRect = $(this).find('.back-3d .button-text')[0].getBoundingClientRect(), 4394 $text_width = $boundingRect.width, 4395 $text_height = $font_size * 1.5; 4396 4397 $that.css({ 4398 'width': ($text_width + $padding * 1.5) + 'px', 4399 'height': ($text_height + $padding) + 'px' 4400 });
4401 4402 $that.find('> a').css({ 4403 'height': ($text_height + $padding) + 'px' 4404 }); 4405 4406 $that.find('.back-3d svg, .front-3d svg').css({ 4407 'width': ($text_width + $padding * 1.5) + 'px', 4408 'height': ($text_height + $padding) + 'px' 4409 }).attr('viewBox', '0 0 ' + ($text_width + $padding) + ' ' + ($text_height + $padding)); 4410 4411 $that.find('svg text').attr('transform', 'matrix(1 0 0 1 ' + ($text_width + $padding * v1) / 2 + ' ' + (($text_height + $padding) / v2) + ')'); 4412 $that.find('.front-3d, .back-3d').css('transform-origin', '50% 50% -' + ($text_height + $padding) / 2 + 'px'); 4413 4414 // Mask 4415 $(this).find('.front-3d svg > rect').attr('id', 'masked-rect-id-' + i); 4416 $(this).find('.front-3d defs mask').attr('id', 'button-text-mask-' + i); 4417 4418 $that.css('visibility', 'visible'); 4419 $3dTransButtonCssString += '#masked-rect-id-' + i + ' { mask: url(#button-text-mask-' + i + '); -webkit-mask: url(#button-text-mask-' + i + ')} '; 4420 4421 }); 4422 4423 // Extra jumbo resize 4424 createExtraJumboSize(); 4425 $window.on('smartresize', createExtraJumboSize); 4426 4427 // Style 4428 nectarCreateStyle($3dTransButtonCssString, 'nectar-td-button'); 4429 4430 } 4431 4432 // Gradient btn init 4433 setTimeout(function () { 4434 $('.nectar-button[class*="color-gradient"] .start').removeClass('loading'); 4435 }, 150); 4436 // No grad for ff 4437 if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1 || 4438 navigator.userAgent.indexOf("MSIE ") > -1 || 4439 navigator.userAgent.match(/Trident\/7\./)) { 4440 $('.nectar-button[class*="color-gradient"] .start').addClass('no-text-grad'); 4441 } 4442 } 4443 4444 4445 4446 4447 /** 4448 * Shortcode icon large style 4449 * 4450 * @since 1.0 4451 */ 4452 function largeIconHover() { 4453 $('.icon-3x').each(function () { 4454 $(this).closest('.col').on('mouseenter', function () { 4455 $(this).find('.icon-3x').addClass('hovered'); 4456 }); 4457 4458 $(this).closest('.col').on('mouseleave', function () { 4459 $(this).find('.icon-3x').removeClass('hovered'); 4460 }); 4461 }); 4462 4463 if (navigator.userAgent.indexOf("MSIE ") > -1 || navigator.userAgent.match(/Trident\/7\./)) { 4464 $('[class^="icon-"][class*="color-gradient"], .nectar_icon_wrap[data-color*="extra-color-gradient"] .nectar_icon, .nectar-gradient-text').addClass('no-grad'); 4465 } 4466 } 4467 4468 4469 4470 /** 4471 * Team member element - fullscreen style. 4472 * 4473 * @since 7.0 4474 */ 4475 function teamMemberFullscreen() { 4476 4477 if ( $('.team-member').length === 0 ) { 4478 return; 4479 } 4480 4481 // Open click event 4482 $body.on('click', '.team-member[data-style="bio_fullscreen"], .team-member[data-style="bio_fullscreen_alt"]', function () { 4483 4484 if ($('.nectar_team_member_overlay').length > 0) { 4485 return; 4486 } 4487 4488 var $usingBoxedClass = ($('body > #boxed').length > 0) ? 'in-boxed' : '', 4489 $teamMemberMeta = $(this).find('.nectar_team_bio').html(), 4490 $teamMemberTitle = ($(this).is('[data-style="bio_fullscreen_alt"]')) ? $(this).find('.team-meta h5').html() : $(this).find('.team-meta p').html(), 4491 $teamMemberImg = ($(this).find('.nectar_team_bio_img[data-img-src]').length > 0) ? $(this).find('.nectar_team_bio_img').attr('data-img-src') : '', 4492 $teamMemberStyle = ($(this).is('[data-style="bio_fullscreen_alt"]')) ? 'bio-fullscreen-alt' : 'bio-fullscreen', 4493 $teamName = ''; 4494 4495 if($(this).is('[data-style="bio_fullscreen_alt"]')) { 4496 $teamName = '<div class="title">' + $teamMemberTitle + '</div><h2>' + $(this).find('.team-meta h3').html() + '</h2>'; 4497 } else { 4498 $teamName = '<h2>' + $(this).find('.team-meta h3').html() + '</h2><div class="title">' + $teamMemberTitle + '</div>'; 4499 } 4500 4501 $body.append('<div class="nectar_team_member_overlay ' + $usingBoxedClass + '" data-style="' + $teamMemberStyle + '"><div class="inner-wrap"><div class="team_member_details"><div class="bio-inner"><span class="mobile-close"></span>'+ $teamName +'<div class="team-desc">' + $teamMemberMeta + '</div></div></div><div class="team_member_picture"><div class="team_member_image_bg_cover"></div><div class="team_member_picture_wrap"><div class="team_member_image"></div></div></div></div></div>'); 4502 4503 if ($teamMemberImg.length > 0) { 4504
4505 // Fade in img on load 4506 var teamTmpImg = new Image(); 4507 teamTmpImg.src = $teamMemberImg; 4508 teamTmpImg.onload = function () { 4509 $('.nectar_team_member_overlay .team_member_image').css('opacity', '1'); 4510 }; 4511 $('.nectar_team_member_overlay .team_member_image').css({ 4512 'background-image': 'url("' + $teamMemberImg + '")' 4513 }); 4514 } 4515 4516 var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $window.width() > 1000) ? 0 : $headerOuterEl.height(); 4517 $('.nectar_team_member_overlay .inner-wrap').css({ 4518 'padding-top': $headerNavSpace 4519 }); 4520 4521 // No-scroll class - ios ready 4522 if ($('.using-mobile-browser').length > 0) { 4523 $('body,html').addClass('nectar-no-scrolling'); 4524 } 4525 4526 teamFullscreenResize(); 4527 4528 // Transition in 4529 $('.nectar_team_member_overlay') 4530 .addClass('open') 4531 .addClass('animating'); 4532 4533 setTimeout(function () { 4534 $('.nectar_team_member_close').addClass('visible'); 4535 $('.nectar_team_member_overlay').removeClass('animating'); 4536 }, 500); 4537 4538 // Bind overflow 4539 if ($('.using-mobile-browser').length == 0) { 4540 fullscreenBioScrolling(); 4541 } 4542 4543 if ($('.team-member[data-style="bio_fullscreen"]').length > 0 && nectarDOMInfo.usingMobileBrowser) { 4544 $('.nectar_team_member_overlay').addClass('on-mobile'); 4545 } 4546 4547 }); 4548 4549 // Close click event 4550 $body.on('click', '.nectar_team_member_overlay', function () { 4551 4552 if (!$(this).hasClass('animating')) { 4553 4554 $('.nectar_team_member_overlay').removeClass('open'); 4555 $('.nectar_team_member_close').removeClass('visible'); 4556 4557 if ($('.using-mobile-browser').length > 0) { 4558 $('body,html').removeClass('nectar-no-scrolling'); 4559 } 4560 4561 setTimeout(function () { 4562 4563 $('.nectar_team_member_overlay, .nectar_team_member_close').remove(); 4564 4565 }, 820); 4566 } 4567 }); 4568 4569 if ($('.team-member[data-style="bio_fullscreen"]').length > 0 || $('.team-member[data-style="bio_fullscreen_alt"]').length > 0) { 4570 $window.on('resize', teamFullscreenResize); 4571 if( !nectarDOMInfo.usingMobileBrowser ) { 4572 var closeIndicator = new NectarIconMouseFollow('','close-indicator'); 4573 } 4574 4575 } 4576 4577 } 4578 4579 4580 /** 4581 * Team member element fullscreen resize event. 4582 * 4583 * @since 7.0 4584 */ 4585 function teamFullscreenResize() { 4586 var $leftHeaderSize = ($('body[data-header-format="left-header"]').length > 0 && $window.width() > 1000) ? 275 : 0; 4587 $('.nectar_team_member_overlay').css({ 4588 'width': $window.width() - $leftHeaderSize, 4589 'left': $leftHeaderSize 4590 }); 4591 } 4592 4593 /** 4594 * Team member element fullscreen overflow scrolling event. 4595 * 4596 * @since 7.0 4597 */ 4598 function fullscreenBioScrolling() { 4599 $('.nectar_team_member_overlay .inner-wrap').mousewheel(function (event, delta) { 4600 this.scrollTop -= (delta * 30); 4601 event.preventDefault(); 4602 }); 4603 4604 } 4605 4606 4607 4608 /** 4609 * WPBakery column element BG hover 4610 * 4611 * @since 5.0 4612 */ 4613 function columnBGColors() { 4614 4615 var $columnColorCSS = ''; 4616 4617 $('.wpb_column').each(function (i) { 4618 4619 $(this).removeClass(function (index, className) { 4620 return (className.match(/(^|\s)instance-\S+/g) || []).join(' '); 4621 }); 4622 4623 $(this).addClass('instance-' + i); 4624 4625 var $innerSelector = ( $(this).find('> .vc_column-inner > .column-bg-overlay-wrap').length > 0 || $(this).find('> .vc_column-inner > .column-bg-overlay').length > 0 ) ? ' > .vc_column-inner ' : ''; 4626 var $innerWrapSelector = ( $(this).find($innerSelector + ' > .column-bg-overlay-wrap').length > 0 ) ? '> .column-bg-overlay-wrap ' : ''; 4627 4628 // BG color 4629 if ($(this).attr('data-has-bg-color') == 'true') { 4630 $columnColorCSS += '.wpb_column.instance-' + i + $innerSelector + $innerWrapSelector + ' > .column-bg-overlay { background-color:' + $(this).attr('data-bg-color') + '; opacity: ' + $(this).attr('data-bg-opacity') + '; }'; 4631 } 4632 4633 // Hover bg color 4634 if ($(this).is('[data-hover-bg^="#"]')) { 4635 $columnColorCSS += '.wpb_column.instance-' + i + ':hover ' + $innerSelector + $innerWrapSelector + ' > .column-bg-overlay { background-color: ' + $(this).attr('data-hover-bg') + '!important; opacity: ' + $(this).attr('data-hover-bg-opacity') + '!important; }'; 4636 } 4637 });
4638 4639 // Style 4640 nectarCreateStyle($columnColorCSS, 'column-bg-colors'); 4641 4642 } 4643 4644 4645 4646 /** 4647 * Displace filter column/row BG effect 4648 * 4649 * @since 10.5 4650 */ 4651 function nectarLiquidBGs() { 4652 $liquidBG_EL = []; 4653 4654 if (typeof NectarLiquid == 'undefined' || nectarDOMInfo.usingFrontEndEditor) { 4655 return; 4656 } 4657 4658 $('.row-bg-wrap[data-bg-animation*="displace-filter"] .row-bg.using-image, .column-image-bg-wrap[data-bg-animation*="displace-filter"] .column-image-bg').each(function (i) { 4659 4660 var $that_el = $(this); 4661 var $type; 4662 var $el_type; 4663 4664 if ($(this).is('.row-bg')) { 4665 $type = $(this).parents('.row-bg-wrap').attr('data-bg-animation'); 4666 $el_type = 'row'; 4667 } 4668 else if ($(this).is('.column-image-bg')) { 4669 $type = $(this).parents('.column-image-bg-wrap').attr('data-bg-animation'); 4670 $el_type = 'col'; 4671 } 4672 4673 $liquidBG_EL[i] = new NectarLiquid($that_el, $type, $el_type); 4674 4675 }); 4676 } 4677 4678 4679 4680 /** 4681 * Morphing outline element creation. 4682 * 4683 * @since 5.0 4684 */ 4685 function morphingOutlines() { 4686 4687 if ($('.morphing-outline').length > 0) { 4688 4689 var $morphingOutlineCSS = '', 4690 $frontEndEditorMOSelector = ($('body.vc_editor').length > 0) ? '' : '>'; 4691 4692 $('.morphing-outline').each(function (i) { 4693 4694 $(this).removeClass(function (index, className) { 4695 return (className.match(/(^|\s)instance-\S+/g) || []).join(' '); 4696 }); 4697 4698 $(this).addClass('instance-' + i).css({ 4699 'visibility': 'visible' 4700 }); 4701 4702 var $width = $(this).find('.inner').width(), 4703 $height = $(this).find('.inner').height(), 4704 $border = parseInt($(this).attr("data-border-thickness")), 4705 $hover = ($('body[data-button-style*="rounded"]').length > 0) ? ':hover' : '', 4706 $hover2 = ($('body[data-button-style*="rounded"]').length > 0) ? '' : ':hover'; 4707 4708 $morphingOutlineCSS += 'body .morphing-outline.instance-' + i + ' .inner > * { color: ' + $(this).attr("data-starting-color") + '; } '; 4709 $morphingOutlineCSS += 'body .morphing-outline.instance-' + i + ' .inner:after { border-width:' + $(this).attr("data-border-thickness") + 'px ; border-color: ' + $(this).attr("data-starting-color") + '; } '; 4710 4711 $morphingOutlineCSS += 'body .wpb_column:hover > .wpb_wrapper ' + $frontEndEditorMOSelector + ' .morphing-outline.instance-' + i + ' .inner > *, body .wpb_column:hover > .vc_column-inner > .wpb_wrapper ' + $frontEndEditorMOSelector + ' .morphing-outline.instance-' + i + ' .inner > * { color: ' + $(this).attr("data-hover-color") + '; } '; 4712 $morphingOutlineCSS += 'body .wpb_column:hover > .wpb_wrapper ' + $frontEndEditorMOSelector + ' .morphing-outline.instance-' + i + ' .inner:after, body .wpb_column:hover > .vc_column-inner > .wpb_wrapper ' + $frontEndEditorMOSelector + ' .morphing-outline.instance-' + i + ' .inner:after { border-color: ' + $(this).attr("data-hover-color") + '; } '; 4713 4714 // Padding calcs 4715 $morphingOutlineCSS += 'body .wpb_column' + $hover2 + ' > .wpb_wrapper ' + $frontEndEditorMOSelector + ' .morphing-outline.instance-' + i + ' .inner:after, body .wpb_column' + $hover2 + ' > .vc_column-inner > .wpb_wrapper ' + $frontEndEditorMOSelector + ' .morphing-outline.instance-' + i + ' .inner:after { padding: ' + (($width + 100 + $border * 2 - $height) / 2 - $border) + 'px 50px}'; 4716 $morphingOutlineCSS += '.morphing-outline.instance-' + i + ' { padding: ' + (30 + ($width + 80 + $border * 2 - $height) / 2 - $border) + 'px 50px}'; 4717 $morphingOutlineCSS += 'body .wpb_column' + $hover2 + ' > .wpb_wrapper ' + $frontEndEditorMOSelector + ' .morphing-outline.instance-' + i + ' .inner:after, body .wpb_column' + $hover2 + ' > .vc_column-inner > .wpb_wrapper ' + $frontEndEditorMOSelector + ' .morphing-outline.instance-' + i + ' .inner:after { top: -' + parseInt((($width + 100 + $border * 2 - $height) / 2 - $border) + $border) + 'px }'; 4718 4719 $morphingOutlineCSS += 'body .wpb_column > .wpb_wrapper ' + $frontEndEditorMOSelector + ' .morphing-outline.instance-' + i + ' .inner:after, body .wpb_column > .vc_column-inner > .wpb_wrapper ' + $frontEndEditorMOSelector + ' .morphing-outline.instance-' + i + ' .inner:after { left: -' + parseInt(50 + $border) + 'px }'; 4720 4721 // Hover 4722 $morphingOutlineCSS += 'body .wpb_column' + $hover + ' > .wpb_wrapper ' + $frontEndEditorMOSelector + ' .morphing-outline.instance-' + i + ' .inner:after, body .wpb_column' + $hover + ' > .vc_column-inner > .wpb_wrapper ' + $frontEndEditorMOSelector + ' .morphing-outline.instance-' + i + ' .inner:after { padding: 50px 50px}'; 4723 $morphingOutlineCSS += 'body .wpb_column' + $hover + ' > .wpb_wrapper ' + $frontEndEditorMOSelector + ' .morphing-outline.instance-' + i + ' .inner:after, body .wpb_column' + $hover + ' > .vc_column-inner > .wpb_wrapper ' + $frontEndEditorMOSelector + ' .morphing-outline.instance-' + i + ' .inner:after { top: -' + parseInt(50 + $border) + 'px }'; 4724 4725 });
4726 4727 // Style 4728 nectarCreateStyle($morphingOutlineCSS, 'morphing-outlines'); 4729 4730 } 4731 4732 } 4733 4734 4735 /** 4736 * Morphing outline element initialization. 4737 * 4738 * @since 5.0 4739 */ 4740 function morphingOutlinesInit() { 4741 4742 if($('.morphing-outline').length > 0) { 4743 4744 // Create style. 4745 setTimeout(morphingOutlines, 100); 4746 setTimeout(fullWidthContentColumns, 125); 4747 4748 // Handle resize. 4749 $window.on('smartresize', morphingOutlines); 4750 4751 } 4752 4753 } 4754 4755 4756 4757 4758 /** 4759 * SVG icon element animations 4760 * 4761 * @since 6.0 4762 * @see waypoints 4763 */ 4764 function svgAnimations() { 4765 4766 var $svgOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : 'bottom-in-view'; 4767 4768 if ($svgIcons.length == 0) { 4769 4770 $('.svg-icon-holder:not(.animated-in)').has('svg').each(function (i) { 4771 4772 var $that = $(this); 4773 4774 if (bypassAnimations) { 4775 $that.attr('data-animation', 'false'); 4776 } 4777 // Size 4778 $that.find('svg').css({ 4779 'height': parseInt($that.attr('data-size')) + 'px', 4780 'width': parseInt($that.attr('data-size')) + 'px' 4781 }); 4782 4783 // Animation 4784 $(this).find('svg').attr('id', 'nectar-svg-animation-instance-' + i); 4785 4786 var $animationSpeed = ($that.is('[data-animation-speed]') && $that.attr('data-animation-speed').length > 0) ? $that.attr('data-animation-speed') : 200; 4787 4788 if ($that.attr('data-animation') == 'false') { 4789 $animationSpeed = 1; 4790 $that.css('opacity', '1'); 4791 } 4792 4793 if (!$that.hasClass('bound')) { 4794 $svgIcons[i] = new Vivus($that.find('svg').attr('id'), { 4795 type: 'delayed', 4796 pathTimingFunction: Vivus.EASE_OUT, 4797 animTimingFunction: Vivus.LINEAR, 4798 duration: $animationSpeed, 4799 onReady: svgInit 4800 });
4801 } 4802 4803 if ($animationSpeed !== 1) { 4804 4805 var waypoint = new Waypoint({ 4806 element: $that, 4807 handler: function () { 4808 if ($that.hasClass('animated-in')) { 4809 waypoint.destroy(); 4810 return; 4811 } 4812 4813 checkIfReady(); 4814 $that.addClass('animated-in'); 4815 waypoint.destroy(); 4816 }, 4817 offset: $svgOffsetPos 4818 4819 }); 4820 4821 } else { 4822 checkIfReady(); 4823 } 4824 4825 function checkIfReady() { 4826 4827 var $animationDelay = 0; 4828 4829 if($that.is('[data-animation-delay]') && 4830 $that.attr('data-animation-delay').length > 0 && 4831 $that.attr('data-animation') != 'false') { 4832 $animationDelay = $that.attr('data-animation-delay'); 4833 } 4834 4835 var $iconID = $that.find('svg').attr('id').replace(/[^0-9]/g, ''); 4836 4837 if ($svgIcons[$iconID].isReady == true) { 4838 setTimeout(function () { 4839 $that.css('opacity', '1'); 4840 $svgIcons[$iconID].reset().play(); 4841 }, $animationDelay); 4842 } else { 4843 setTimeout(checkIfReady, 50); 4844 } 4845 } 4846 4847 function svgInit() { 4848 4849 //set size 4850 $that.css({ 4851 'height': parseInt($that.attr('data-size')) + 'px', 4852 'width': parseInt($that.attr('data-size')) + 'px' 4853 });
4854 4855 } 4856 4857 $that.addClass('bound'); 4858 4859 }); 4860 4861 4862 // SVG in equal height column resize 4863 if ($('.vc_row-o-equal-height .svg-icon-holder[data-animation="true"]').length > 0 && 4864 $('#nectar_fullscreen_rows').length == 0) { 4865 4866 $window.on('smartresize', function () { 4867 clearTimeout($svgResizeTimeout); 4868 $svgResizeTimeout = setTimeout(function () { 4869 4870 if ($svgIcons.length > 0) { 4871 $('.svg-icon-holder.animated-in').each(function () { 4872 4873 $(this).css('opacity', '1'); 4874 if ($(this).is('[id]')) { 4875 var $iconID = $(this).attr('id').replace(/[^0-9]/g, ''); 4876 $svgIcons[$iconID].finish(); 4877 } 4878 4879 }); 4880 } 4881 4882 }, 300); 4883 4884 }); 4885 4886 } 4887 4888 } 4889 4890 // After svg animated icons initalized 4891 else { 4892 $('.svg-icon-holder').addClass('animated-in').css('opacity', '1'); 4893 } 4894 4895 // Full vc row support 4896 $('#nectar_fullscreen_rows .svg-icon-holder.animated-in').has('svg').each(function (i) { 4897 4898 var $animationDelay = 0; 4899 4900 if($(this).is('[data-animation-delay]') && 4901 $(this).attr('data-animation-delay').length > 0 && 4902 $(this).attr('data-animation') != 'false') { 4903 $animationDelay = $(this).attr('data-animation-delay'); 4904 } 4905 4906 var $that = $(this); 4907 4908 var $iconID = $that.find('svg').attr('id').replace(/[^0-9]/g, ''); 4909 4910 clearTimeout($animatedSVGIconTimeout[i]); 4911 4912 if ($that.attr('data-animation') == 'false') { 4913 4914 $that.css('opacity', '1'); 4915 $svgIcons[$iconID].finish(); 4916 4917 } else { 4918 4919 if ($(this).parents('.active').length > 0 || 4920 $(this).parents('#footer-outer').length > 0 || 4921 $('body.mobile').length > 0) { 4922 4923 $svgIcons[$iconID].reset(); 4924 $animatedSVGIconTimeout[i] = setTimeout(function () { 4925 $svgIcons[$iconID].play(); 4926 }, $animationDelay); 4927 4928 } else { 4929 $svgIcons[$iconID].reset().stop(); 4930 } 4931 } 4932 }); 4933 4934 } 4935 4936 4937 4938 /** 4939 * Fancy unordered list element initialization. 4940 * 4941 * @since 4.0 4942 * @see waypoints 4943 */ 4944 function nectarFancyUlInit() { 4945 4946 $($fullscreenSelector + '.nectar-fancy-ul').each(function () { 4947 4948 var $animation = $(this).attr('data-animation'), 4949 $animationDelay = 0; 4950 4951 if($(this).is('[data-animation-delay]') && 4952 $(this).attr('data-animation-delay').length > 0 && 4953 $(this).attr('data-animation') != 'false') { 4954 $animationDelay = $(this).attr('data-animation-delay'); 4955 } 4956 4957 if ($animation == 'true') { 4958 4959 var $that = $(this), 4960 waypoint = new Waypoint({ 4961 element: $that, 4962 handler: function () { 4963 4964 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 4965 waypoint.destroy(); 4966 return; 4967 } 4968 4969 setTimeout(function () { 4970 $that.find('li').each(function (i) { 4971 var $that = $(this); 4972 $that.delay(i * 220).transition({ 4973 'opacity': '1', 4974 'left': '0' 4975 }, 220, 'easeOutCubic'); 4976 }); 4977 }, $animationDelay); 4978 4979 $that.addClass('animated-in'); 4980 waypoint.destroy(); 4981 }, 4982 offset: 'bottom-in-view' 4983 4984 }); 4985 4986 } 4987 4988 }); 4989 4990 } 4991 4992 4993 /** 4994 * Fancy unordered list element icons. 4995 * 4996 * @since 11.0 4997 */ 4998 function nectarFancyUlIcons() { 4999 5000 $('.nectar-fancy-ul:not([data-list-icon="dot"])').each(function () { 5001 5002 var $icon = $(this).attr('data-list-icon'), 5003 $color = $(this).attr('data-color'); 5004 5005 $(this).find('li').each(function () { 5006 $(this).find('> i').remove(); 5007 $(this).prepend('<i class="icon-default-style ' + $icon + ' ' + $color + '"></i> '); 5008 });
5009 5010 }); 5011 5012 } 5013 5014 5015 /** 5016 * Flipbox element height calculations. 5017 * 5018 * @since 7.0 5019 */ 5020 function flipBoxHeights() { 5021 5022 $('.nectar-flip-box').each(function () { 5023 5024 var $flipBoxMinHeight = parseInt($(this).attr('data-min-height')), 5025 $flipBoxHeight = $(this).find('.flip-box-front .inner').height(); 5026 5027 if ($(this).find('.flip-box-back .inner').height() > $(this).find('.flip-box-front .inner').height()) { 5028 $flipBoxHeight = $(this).find('.flip-box-back .inner').height(); 5029 } 5030 5031 if ($flipBoxHeight >= $flipBoxMinHeight - 80) { 5032 $(this).find('> div').css('height', $flipBoxHeight + 80); 5033 } else { 5034 $(this).find('> div').css('height', 'auto'); 5035 } 5036 5037 // Safari needs 3D translate. 5038 if ($(this).parent().hasClass('wpb_wrapper')) { 5039 $(this).parent().css('transform', 'translateZ(0)'); 5040 } 5041 5042 }); 5043 } 5044 5045 5046 5047 5048 /** 5049 * Flipbox element events. 5050 * 5051 * @since 7.0 5052 */ 5053 function flipBoxInit() { 5054 5055 if( $('.nectar-flip-box').length > 0 ) { 5056 5057 // Mobile gets click. 5058 if (nectarDOMInfo.usingMobileBrowser) { 5059 $body.on('click', '.nectar-flip-box', function () { 5060 $(this).toggleClass('flipped'); 5061 }); 5062 } 5063 5064 flipBoxHeights(); 5065 5066 // Handle resize. 5067 $window.on('smartresize', flipBoxHeights); 5068 } 5069 5070 } 5071 5072 5073 5074 5075 /** 5076 * Parallax Scrolling 5077 * 5078 * @since 3.0 5079 */ 5080 $.fn.parallaxScroll = function (xpos, speedFactor, outerHeight) { 5081 5082 var $windowDOMWidth = nectarDOMInfo.winW, 5083 $windowDOMHeight = nectarDOMInfo.winH, 5084 $orientationChange = 0, 5085 $this = $(this), 5086 firstTop = $this.offset().top; 5087 5088 // Get the starting position of each element to have parallax applied to it 5089 $this.each(function () { 5090 firstTop = $this.offset().top; 5091 }); 5092 5093 var getHeight = function (jqo) { 5094 return jqo.outerHeight(true); 5095 }; 5096 5097 // setup defaults if arguments aren't specified 5098 if (arguments.length < 1 || xpos === null) { 5099 xpos = "50%"; 5100 } 5101 if (arguments.length < 2 || speedFactor === null) { 5102 speedFactor = 0.25; 5103 } 5104 if (arguments.length < 3 || outerHeight === null) { 5105 outerHeight = true; 5106 } 5107 5108 var $onMobileBrowser = nectarDOMInfo.usingMobileBrowser, 5109 classic_mobile_menu_open = false, 5110 firstSection = false, 5111 $element = $this, 5112 height = getHeight($element); 5113 5114 5115 $this.find('.row-bg.using-image, .page-header-bg-image, .image-bg, .video-wrap').addClass('translate'); 5116 5117 setInterval(function () { 5118 5119 height = getHeight($element); 5120 classic_mobile_menu_open = ($('body.classic_mobile_menu_open.mobile').length > 0) ? true : false; 5121 5122 }, 600); 5123 5124 5125 if($element.parents('.top-level').length > 0 && $element.parents('.parallax_slider_outer').length > 0 || 5126 $element.parents('.top-level').length > 0 && $element.is('.nectar-recent-posts-single_featured') || 5127 $element.is('.wpb_row.top-level') || 5128 $('.wpb_row').length == 0) { 5129 firstSection = true; 5130 } 5131 5132 if ($('.wpb_row').length == 0 && $element.parents('.parallax_slider_outer').length > 0 && $element.is('[data-full-width="true"]') || 5133 ($('#portfolio-extra').length > 0 && $element.parents('.parallax_slider_outer').length > 0 && $element.parents('.wpb_row').length > 0 && $element.parents('.wpb_row').index() == '0')) { 5134 firstSection = true; 5135 } 5136 5137 if (nectarDOMInfo.usingFrontEndEditor) { 5138 firstSection = false; 5139 } 5140 5141 var nectarSliderElBool = $this.is('.nectar-slider-wrap'); 5142 var pageHeaderBool = ($this.find('.page-header-bg-image').length > 0) ? true : false; 5143 var $elToParallax = false; 5144 5145 if (nectarSliderElBool) { 5146 5147 if ($this.find('.video-wrap').length > 0 || $this.find('.image-bg').length > 0) { 5148 $elToParallax = $this.find('.video-wrap, .image-bg'); 5149 } 5150 5151 } else { 5152 5153 if ($this.find('.row-bg.using-image').length > 0) { 5154 $elToParallax = $this.find('.row-bg.using-image'); 5155 } else if ($this.find('.page-header-bg-image').length > 0) { 5156 $elToParallax = $this.find('.page-header-bg-image'); 5157 } 5158 5159 } 5160 5161
5162 function update() { 5163 5164 firstTop = $element.offset().top; 5165 5166 // Check if totally above or totally below viewport. 5167 if ($elToParallax == false || 5168 firstTop + height < nectarDOMInfo.scrollTop || 5169 firstTop > nectarDOMInfo.scrollTop + nectarDOMInfo.winH || 5170 $('body.material-ocm-open').length > 0) { 5171 // Skip processing. 5172 } else { 5173 5174 // Nectar slider 5175 if (nectarSliderElBool) { 5176 5177 if (firstSection) { 5178 // Top level row 5179 if (!classic_mobile_menu_open) { 5180 $this.find('.video-wrap, .image-bg').css({ 5181 'transform': 'translate3d(0, ' + parseFloat(nectarDOMInfo.scrollTop * speedFactor) + 'px, 0)' 5182 }); 5183 } 5184 } else { 5185 $this.find('.video-wrap, .image-bg').css({ 5186 'transform': 'translate3d(0, ' + parseFloat((($windowDOMHeight + nectarDOMInfo.scrollTop - firstTop) * speedFactor)) + 'px, 0)' 5187 }); 5188 } 5189 5190 } else { 5191 5192 // Rows 5193 if (firstSection) { 5194 // Top level row 5195 if (!classic_mobile_menu_open) { 5196 $elToParallax.css({ 5197 'transform': 'translate3d(0, ' + parseFloat(nectarDOMInfo.scrollTop * speedFactor) + 'px, 0)' 5198 }); 5199 } 5200 } else { 5201 // Regular rows further down page 5202 $elToParallax.css({ 5203 'transform': 'translate3d(0, ' + parseFloat((($windowDOMHeight + nectarDOMInfo.scrollTop - firstTop) * speedFactor)) + 'px, 0), scale(1.005)' 5204 }); 5205 } 5206 5207 // Page header 5208 if (pageHeaderBool && !classic_mobile_menu_open) { 5209 $elToParallax.css({ 5210 'transform': 'translate3d(0, ' + parseFloat(nectarDOMInfo.scrollTop * speedFactor) + 'px, 0)' 5211 }); 5212 } 5213 5214 } 5215 5216 } 5217 5218 5219 //if on mobile, auto RAF 5220 if ($onMobileBrowser) { 5221 requestAnimationFrame(update); 5222 } 5223 5224 } 5225 5226 if (window.addEventListener) { 5227 5228 if (nectarDOMInfo.usingFrontEndEditor || !nectarDOMInfo.usingMobileBrowser) { 5229 $window.on('resize', function () { 5230 $windowDOMWidth = nectarDOMInfo.winW; 5231 $windowDOMHeight = nectarDOMInfo.winH; 5232 });
5233 } 5234 5235 if (nectarDOMInfo.usingFrontEndEditor) { 5236 5237 $window.on('scroll.parallaxSections', update); 5238 5239 } else if (!nectarDOMInfo.usingMobileBrowser) { 5240 5241 window.addEventListener('scroll', function () { 5242 requestAnimationFrame(update); 5243 }, false); 5244 5245 } else { 5246 5247 //if on mobile, auto RAF 5248 requestAnimationFrame(update); 5249 5250 window.addEventListener("orientationchange", function () { 5251 $orientationChange = 1; 5252 }); 5253 5254 $window.on('resize', function () { 5255 if (($window.width() != $windowDOMWidth && $window.height != $windowDOMHeight) || $orientationChange == 1) { 5256 5257 //store the current window dimensions 5258 $windowDOMWidth = nectarDOMInfo.winW; 5259 $windowDOMHeight = nectarDOMInfo.winH; 5260 5261 $orientationChange = 0; 5262 } 5263 }); 5264 5265 } 5266 5267 } 5268 5269 $window.on('resize.parallaxSections', update); 5270 5271 update(); 5272 5273 }; 5274 5275 5276 5277 5278 /** 5279 * Runs before other full width section calculations. 5280 * 5281 * @since 4.0 5282 */ 5283 function fullWidthSectionsPreInit() { 5284 5285 // Nectar Slider force full width parent row when using full width element option. 5286 $('.wpb_row .vc_col-sm-12 .nectar-slider-wrap[data-full-width="true"]').each(function () { 5287 if ($(this).parents('.wpb_row.full-width-section').length == 0 && $(this).parents('.wpb_row.full-width-content').length == 0) { 5288 $(this).parents('.wpb_row').addClass('full-width-section'); 5289 } 5290 }); 5291 5292 // Handle percent row padding values when using the boxed theme option. 5293 if( !nectarDOMInfo.usingMobileBrowser && $('body[data-boxed-style="1"]').length > 0 && $('#boxed').length > 0 ) { 5294 fullWidthRowPaddingAdjustCalcBoxed(); 5295 } 5296 5297 } 5298 5299 5300 5301 /** 5302 * Full width section calculations. 5303 * 5304 * @since 4.0 5305 */ 5306 function fullWidthSections() { 5307 5308 var $windowInnerWidth = nectarDOMInfo.winW, 5309 $bodyBorderWidth = ($('.body-border-right').length > 0 && $windowInnerWidth > 1000) ? parseInt($('.body-border-right').width()) * 2 : 0, 5310 $container_width = ($('.container-wrap').length > 0) ? parseInt($('.container-wrap').outerWidth()) : $window.width(); 5311 5312 var $windowWidth, 5313 $justOutOfSight, 5314 $mainContentWidth; 5315 5316 if ($('#boxed').length == 1) { 5317 $justOutOfSight = ((parseInt($('.container-wrap').width()) - parseInt($('.main-content').width())) / 2) + 4; 5318 } else { 5319 5320 // Ext responsive mode is on - add the extra padding into the calcs 5321 var $extResponsivePadding = ($('body[data-ext-responsive="true"]').length > 0 && $windowInnerWidth >= 1000) ? 180 : 0; 5322 5323 if ($container_width - $bodyBorderWidth <= parseInt($('.main-content').css('max-width'))) { 5324 $windowWidth = parseInt($('.main-content').css('max-width')); 5325 } else { 5326 $windowWidth = $container_width - $bodyBorderWidth; 5327 } 5328 5329 5330 var $contentWidth = parseInt($('.main-content').css('max-width')); 5331 5332 // Single post fullwidth 5333 if ($('body.single-post[data-ext-responsive="true"]').length > 0 && $('.container-wrap.no-sidebar').length > 0) { 5334 $contentWidth = $('.post-area').width(); 5335 $extResponsivePadding = 0; 5336 } 5337 5338 $justOutOfSight = Math.ceil((($windowWidth + $extResponsivePadding - $contentWidth) / 2)); 5339 } 5340 5341 5342 // Full width content row type. 5343 $('.carousel-outer').has('.carousel-wrap[data-full-width="true"]').css('overflow', 'visible'); 5344 5345 $('.carousel-wrap[data-full-width="true"], .portfolio-items[data-col-num="elastic"]:not(.fullwidth-constrained), .full-width-content').each(function () { 5346 5347 var $leftHeaderSize = ($('#header-outer[data-format="left-header"]').length > 0 && $windowInnerWidth >= 1000) ? parseInt($('#header-outer[data-format="left-header"]').width()) : 0; 5348 var $bodyBorderWidth = ($('.body-border-right').length > 0 && $windowInnerWidth > 1000) ? (parseInt($('.body-border-right').width()) * 2) - 2 : 0; 5349 5350 // Single post fullwidth. 5351 if ($('#boxed').length == 1) { 5352 5353 $mainContentWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').width()) : parseInt($(this).parents('.container').width()); 5354 5355 if ($('body.single-post[data-ext-responsive="true"]').length > 0 && $('.container-wrap.no-sidebar').length > 0 && $(this).parents('.post-area').length > 0) { 5356 $contentWidth = $('.post-area').width(); 5357 $extResponsivePadding = 0; 5358 $windowWidth = $container_width - $bodyBorderWidth;
5359 $justOutOfSight = Math.ceil((($windowWidth + $extResponsivePadding - $contentWidth) / 2)); 5360 } else { 5361 if ($(this).parents('.page-submenu').length > 0) { 5362 $justOutOfSight = ((parseInt($('.container-wrap').width()) - $mainContentWidth) / 2); 5363 } 5364 else { 5365 $justOutOfSight = ((parseInt($('.container-wrap').width()) - $mainContentWidth) / 2) + 4; 5366 } 5367 } 5368 } else { 5369 5370 if ($('body.single-post[data-ext-responsive="true"]').length > 0 && $('.container-wrap.no-sidebar').length > 0 && $(this).parents('.post-area').length > 0) { 5371 5372 $contentWidth = $('.post-area').width(); 5373 $extResponsivePadding = 0; 5374 $windowWidth = $container_width - $bodyBorderWidth; 5375 5376 } else { 5377 5378 var $mainContentMaxWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').css('max-width')) : parseInt($(this).parents('.container').css('max-width')); 5379 5380 if ($container_width - $bodyBorderWidth <= $mainContentMaxWidth) { 5381 $windowWidth = $mainContentMaxWidth; 5382 } 5383 5384 $contentWidth = $mainContentMaxWidth; 5385 $extResponsivePadding = ($('body[data-ext-responsive="true"]').length > 0 && nectarDOMInfo.winW >= 1000) ? 180 : 0; 5386 5387 if ($leftHeaderSize > 0) { 5388 $extResponsivePadding = ($('body[data-ext-responsive="true"]').length > 0 && nectarDOMInfo.winW >= 1000) ? 120 : 0; 5389 } 5390 5391 } 5392 5393 $justOutOfSight = Math.ceil((($windowWidth + $extResponsivePadding - $contentWidth) / 2)); 5394 } 5395 5396 var $extraSpace = 0; 5397 if ($(this).hasClass('carousel-wrap')) { 5398 $extraSpace = 1; 5399 } 5400 if ($(this).hasClass('portfolio-items')) { 5401 $extraSpace = 5; 5402 } 5403 5404 var $carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight * 2) : $container_width - $bodyBorderWidth + $extraSpace; 5405 5406 // When using gutter on portfolio don't add extra space 5407 if ($('#boxed').length == 0 && $(this).hasClass('portfolio-items') && $(this).is('[data-gutter*="px"]') && $(this).attr('data-gutter').length > 0 && $(this).attr('data-gutter') != 'none') { 5408 if ($container_width > 1000) { 5409 $carouselWidth = $container_width - $bodyBorderWidth + 3; 5410 } 5411 else { 5412 $carouselWidth = $container_width - $bodyBorderWidth; 5413 } 5414 } 5415 5416 if ($(this).parent().hasClass('default-style')) { 5417 5418 $mainContentWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').width()) : parseInt($(this).parents('.container').width()); 5419 5420 if ($('#boxed').length != 0) { 5421 $carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight * 2) : $container_width + $extraSpace; 5422 } else { 5423 $carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight * 2) : ($container_width - $bodyBorderWidth) - (($container_width - $bodyBorderWidth) * 0.025) + $extraSpace; 5424 $windowWidth = ($container_width - $bodyBorderWidth <= $mainContentWidth) ? $mainContentWidth : ($container_width - $bodyBorderWidth) - (($container_width - $bodyBorderWidth) * 0.025); 5425 $justOutOfSight = Math.ceil((($windowWidth - $mainContentWidth) / 2)); 5426 } 5427 5428 } 5429 5430 else if ($(this).parent().hasClass('spaced')) { 5431 5432 $mainContentWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').width()) : parseInt($(this).parents('.container').width()); 5433 5434 if ($('#boxed').length != 0) { 5435 $carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight * 2) - ($container_width * 0.02) : $container_width + $extraSpace; 5436 } else { 5437 $carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight * 2) : ($container_width - $bodyBorderWidth) - Math.ceil(($container_width - $bodyBorderWidth) * 0.02) + $extraSpace; 5438 var $windowWidth2 = ($container_width - $bodyBorderWidth <= $mainContentWidth) ? $mainContentWidth : ($container_width - $bodyBorderWidth) - (($container_width - $bodyBorderWidth) * 0.02);
5439 $justOutOfSight = Math.ceil((($windowWidth2 - $mainContentWidth) / 2) + 2); 5440 } 5441 } 5442 5443 // Make sure the element/row is capable of going full width. 5444 if (!$(this).parents('.span_9').length > 0 && 5445 !$(this).parent().hasClass('span_3') && 5446 $(this).parent().attr('id') != 'sidebar-inner' && 5447 $(this).parent().attr('id') != 'portfolio-extra' && 5448 !$(this).find('.carousel-wrap[data-full-width="true"]').length > 0 && 5449 !$(this).find('.nectar-carousel-flickity-fixed-content').length > 0 && 5450 !$(this).find('.portfolio-items:not(".carousel")[data-col-num="elastic"]').length > 0) { 5451 5452 // Escape if inside woocoommerce page and not using applicable layout 5453 if ($('.single-product').length > 0 && 5454 $(this).parents('#tab-description').length > 0 && 5455 $(this).parents('.full-width-tabs').length == 0) { 5456 5457 $(this).css({ 5458 'visibility': 'visible' 5459 }); 5460 5461 } else { 5462 // Portfolio. 5463 if ($(this).hasClass('portfolio-items')) { 5464 $(this).css({ 5465 'margin-left': -$justOutOfSight, 5466 'left': 0, 5467 'width': $carouselWidth, 5468 'visibility': 'visible' 5469 }); 5470 5471 } else { 5472 5473 // Fullscreen page rows left. 5474 if ($('#nectar_fullscreen_rows').length > 0 && $(this).hasClass('wpb_row')) { 5475 5476 $(this).css({ 5477 'margin-left': -$justOutOfSight, 5478 'width': $carouselWidth, 5479 'visibility': 'visible' 5480 }); 5481 5482 } else { 5483 // Regular rows. 5484 $(this).css({ 5485 'left': 0, 5486 'margin-left': -$justOutOfSight, 5487 'width': $carouselWidth, 5488 'visibility': 'visible' 5489 }); 5490 } 5491 5492 } 5493 5494 } 5495 } 5496 5497 else if ($(this).parent().attr('id') == 'portfolio-extra' && $('#full_width_portfolio').length != 0) { 5498 5499 $(this).css({ 5500 'left': 0, 5501 'margin-left': -$justOutOfSight, 5502 'width': $carouselWidth, 5503 'visibility': 'visible' 5504 }); 5505 5506 } else { 5507 5508 $(this).css({ 5509 'margin-left': 0, 5510 'width': 'auto', 5511 'left': '0', 5512 'visibility': 'visible' 5513 }); 5514 } 5515 5516 }); 5517 5518 } 5519 5520 5521 5522 /** 5523 * Parallax scroll speed helper. 5524 * 5525 * @since 4.0 5526 */ 5527 function parallaxSrollSpeed(speedString) { 5528 5529 var speed; 5530 switch (speedString) { 5531 case 'slow': 5532 speed = 0.6; 5533 break; 5534 case 'medium': 5535 speed = 0.4; 5536 break; 5537 case 'fast': 5538 speed = 0.25; 5539 break; 5540 } 5541 5542 return speed; 5543 } 5544 5545 5546 /** 5547 * Parallax scroll initialization. 5548 * 5549 * @since 4.0 5550 */ 5551 function parallaxScrollInit() { 5552 5553 if (nectarDOMInfo.usingMobileBrowser && $('body[data-remove-m-parallax="1"]').length > 0) { 5554 return; 5555 } 5556 5557 parallaxRowsBGCals(); 5558 5559 $('.nectar-recent-posts-single_featured, .wpb_row.parallax_section, #page-header-bg[data-parallax="1"] .page-header-bg-image-wrap, .parallax_slider_outer .nectar-slider-wrap').each(function () { 5560 var $id = $(this).attr('id'); 5561 5562 if ( $(this).find('[data-parallax-speed="fixed"]').length == 0) { 5563 5564 if ($(this).find('.row-bg').length == 0) { 5565 //set default scroll speed if not defined 5566 $('#' + $id).parallaxScroll("50%", 0.25); 5567 } else { 5568 $('#' + $id + ".parallax_section").parallaxScroll("50%", parallaxSrollSpeed($(this).find('.row-bg').attr('data-parallax-speed'))); 5569 } 5570 5571 } 5572 5573 $(this).addClass('nectar-parallax-enabled'); 5574 5575 }); 5576 5577 } 5578 5579 5580 /** 5581 * First full width row on page 5582 * 5583 * @since 4.0 5584 */ 5585 function firstFWSection() { 5586 $('.full-width-section.wpb_row, .full-width-content.wpb_row').each(function () { 5587 5588 if (!$(this).parent().hasClass('span_9') && 5589 !$(this).parent().hasClass('span_3') && 5590 $(this).parent().attr('id') != 'sidebar-inner') { 5591 5592 if ($(this).parents('#portfolio-extra').length > 0 && $('#full_width_portfolio').length == 0) { 5593 return false; 5594 } 5595 5596 if ($(this).index() == '0' && 5597 $pageHeaderBG.length == 0 && 5598 $('.page-header-no-bg').length == 0 && 5599 $('.project-title').length == 0 && 5600 $('body.single').length == 0 && 5601 $('.project-title').length == 0) { 5602 5603 $(this).addClass('first-section'); 5604 var $that = $(this); 5605 setTimeout(function () { 5606 $that.addClass('loaded'); 5607 }, 50); 5608 5609 } 5610 5611 } 5612 5613 });
5614 } 5615 5616 5617 5618 5619 5620 /** 5621 * Parallax row background height calculations. 5622 * 5623 * @since 6.0 5624 */ 5625 function parallaxRowsBGCals() { 5626 5627 if (nectarDOMInfo.usingMobileBrowser && $('body[data-remove-m-parallax="1"]').length > 0) { 5628 return; 5629 } 5630 5631 $('.nectar-recent-posts-single_featured, .wpb_row.parallax_section, #page-header-bg[data-parallax="1"] .page-header-bg-image-wrap, .parallax_slider_outer .nectar-slider-wrap .slide-bg-wrap').each(function () { 5632 5633 var $non_page_builder_slider; 5634 5635 if ($(this).find('.row-bg').length == 0 && $(this).find('.page-header-bg-image').length > 0) { 5636 //skip processing. 5637 } else if ($(this).find('.row-bg').length == 0 && $(this).find('.image-bg').length > 0) { 5638 5639 $non_page_builder_slider = false; 5640 5641 // First nectar slider shortcode without page builder 5642 if ($('.wpb_row').length == 0 && 5643 $(this).parents('.nectar-slider-wrap[data-full-width="true"]').length > 0 && 5644 $(this).parents('.parallax_slider_outer').length > 0 && 5645 $(this).parents('.parallax_slider_outer').index() == '1') { 5646 $non_page_builder_slider = true; 5647 } 5648 5649 // Portfolio first 5650 if ($('#portfolio-extra').length > 0 && 5651 $(this).parents('.wpb_row').length > 0 && 5652 $(this).parents('.parallax_slider_outer').length > 0 && 5653 $(this).parents('.wpb_row').index() == '0') { 5654 $non_page_builder_slider = true; 5655 } 5656 5657 // Set heights. 5658 if ($(this).parents('.top-level').length > 0 && !nectarDOMInfo.usingFrontEndEditor || 5659 $non_page_builder_slider && !nectarDOMInfo.usingFrontEndEditor) { 5660 $(this).find('.image-bg').css({ 5661 'height': Math.ceil($(this).parent().offset().top * 0.25) + $(this).outerHeight(true) 5662 });
5663 } else { 5664 $(this).find('.image-bg').css({ 5665 'height': Math.ceil($window.height() * 0.25) + $(this).outerHeight(true) 5666 }); 5667 } 5668 5669 } 5670 5671 // Video backgrounds. 5672 else if ($(this).find('.row-bg').length == 0 && $(this).find('.video-wrap').length > 0) { 5673 5674 $non_page_builder_slider = false; 5675 // First nectar slider shortcode without page builder 5676 if ($('.wpb_row').length == 0 && 5677 $(this).parents('.nectar-slider-wrap[data-full-width="true"]').length > 0 && 5678 $(this).parents('.parallax_slider_outer').length > 0 && 5679 $(this).parents('.parallax_slider_outer').index() == '1') { 5680 $non_page_builder_slider = true; 5681 } 5682 // Portfolio first 5683 if ($('#portfolio-extra').length > 0 && 5684 $(this).parents('.wpb_row').length > 0 && 5685 $(this).parents('.parallax_slider_outer').length > 0 && 5686 $(this).parents('.wpb_row').index() == '0') { 5687 $non_page_builder_slider = true; 5688 } 5689 5690 // Set heights. 5691 if ($(this).parents('.top-level').length > 0 && !nectarDOMInfo.usingFrontEndEditor || 5692 $non_page_builder_slider && !nectarDOMInfo.usingFrontEndEditor) { 5693 5694 $(this).find('.video-wrap').css({ 5695 'height': Math.ceil($(this).parent().offset().top * 0.25) + $(this).outerHeight(true) 5696 });
5697 } 5698 5699 else { 5700 $(this).find('.video-wrap').css({ 5701 'height': Math.ceil($window.height() * 0.25) + $(this).outerHeight(true) 5702 }); 5703 } 5704 5705 var vid = $(this).find('.video-wrap video'), 5706 vid_w_orig = 1280, 5707 vid_h_orig = 720; 5708 5709 // Get the parent element size 5710 var container_w = vid.parent().width(), 5711 container_h = vid.parent().height(), 5712 scale_w = container_w / vid_w_orig, 5713 scale_h = container_h / vid_h_orig; 5714 5715 var scale = scale_w > scale_h ? scale_w : scale_h; 5716 5717 // Scale the video. 5718 vid.width(scale * vid_w_orig); 5719 vid.height(scale * vid_h_orig); 5720 5721 } else { 5722 5723 if ($(this).is('.nectar-recent-posts-single_featured') && $(this).parents('.top-level').length > 0 && !nectarDOMInfo.usingFrontEndEditor) { 5724 //skip processing. 5725 } else if (!$(this).hasClass('top-level') || nectarDOMInfo.usingFrontEndEditor) { 5726 5727 var $ifFast = ($(this).find('.row-bg[data-parallax-speed="fast"]').length > 0) ? 60 : 0; 5728 $(this).find('.row-bg').css({ 5729 'height': Math.ceil($window.height() * parallaxSrollSpeed($(this).find('.row-bg').attr('data-parallax-speed'))) + $(this).outerHeight(true) + $ifFast 5730 });
5731 5732 } 5733 5734 } 5735 5736 }); 5737 5738 } 5739 5740 5741 /** 5742 * Class names added for specific full width section rows at top 5743 * 5744 * @since 3.0 5745 */ 5746 function fwsClasses() { 5747 5748 $('.wpb_wrapper > .nectar-slider-wrap[data-full-width="true"]').each(function () { 5749 if (!$(this).parent().hasClass('span_9') && !$(this).parent().hasClass('span_3') && $(this).parent().attr('id') != 'sidebar-inner') { 5750 if ($(this).parents('.wpb_row').index() == '0') { 5751 $(this).addClass('first-nectar-slider'); 5752 } 5753 } 5754 }); 5755 5756 var $contentElementsNum = ($('#portfolio-extra').length == 0) ? $('.main-content > .row > *').length : $('.main-content > .row #portfolio-extra > *').length; 5757 5758 if ($('#portfolio-extra').length == 0) { 5759 $contentElementsNum = ($('.main-content > .row > .wpb_row').length > 0) ? $('.main-content > .row > .wpb_row').length : $('.main-content > .row > *').length; 5760 } else { 5761 $contentElementsNum = $('.main-content > .row #portfolio-extra > *').length; 5762 } 5763 5764 $('.full-width-section, .full-width-content:not(.page-submenu .full-width-content):not(.blog-fullwidth-wrap), .row > .nectar-slider-wrap[data-full-width="true"], .wpb_wrapper > .nectar-slider-wrap[data-full-width="true"], .portfolio-items[data-col-num="elastic"]').each(function () { 5765 5766 if (!$(this).parent().hasClass('span_9') && !$(this).parent().hasClass('span_3') && $(this).parent().attr('id') != 'sidebar-inner') { 5767 5768 if ($(this).parents('.wpb_row').length > 0) { 5769 5770 if ($(this).parents('#portfolio-extra').length > 0 && 5771 $('#full_width_portfolio').length == 0) { 5772 return false; 5773 } 5774 5775 ////first 5776 if ($(this).parents('.wpb_row').index() == '0' && $pageHeaderBG.length != 0) { 5777 //skip processing. 5778 } 5779 else if ($(this).parents('.wpb_row').index() == '0' && 5780 $pageHeaderBG.length == 0 && $('.page-header-no-bg').length == 0 && 5781 $('.project-title').length == 0 && $(this).parents('.wpb_row').index() == '0' && 5782 $('.project-title').length == 0 && $('body[data-bg-header="true"]').length == 0) { 5783 5784 if ($('.single').length == 0) { 5785 $('.container-wrap').css('padding-top', '0px'); 5786 } else { 5787 $(this).addClass('first-section'); 5788 } 5789 5790 } 5791 5792 // Check if it's also last (i.e. the only fws) 5793 if ($(this).parents('.wpb_row').index() == $contentElementsNum - 1 && $('#respond').length == 0) { 5794 if ($(this).attr('id') != 'portfolio-filters-inline') { 5795 $('.container-wrap').css('padding-bottom', '0px'); 5796 $('#call-to-action .triangle').remove(); 5797 } 5798 } 5799 5800 } else { 5801 5802 if ($(this).parents('#portfolio-extra').length > 0 && $('#full_width_portfolio').length == 0) { 5803 return false; 5804 } 5805 5806 if ($(this).find('.portfolio-filters-inline').length == 0 && $(this).attr('id') != 'post-area') { 5807 5808 ////first 5809 if ($(this).index() == '0' && $pageHeaderBG.length != 0) { 5810 //skip processing. 5811 } 5812 else if ($(this).index() == '0' && $pageHeaderBG.length == 0 && 5813 $(this).index() == '0' && $('.page-header-no-bg').length == 0 && 5814 $(this).index() == '0' && !$(this).hasClass('blog_next_prev_buttons') && 5815 !$(this).hasClass('nectar-shop-outer') && $(this).parents('.pum-container').length == 0) { 5816 5817 if ($('body[data-header-resize="0"]').length == 1 && $('.single').length == 0 || $('body.material').length > 0 && $('.single').length == 0) { 5818 5819 if (!$('body.blog .blog-fullwidth-wrap > .masonry:not(.meta-overlaid)').length > 0) { 5820 $('.container-wrap').css('padding-top', '0px'); 5821 } 5822 5823 } 5824 5825 else { 5826 $(this).addClass('first-section'); 5827 } 5828 5829 } 5830 5831 //check if it's also last (i.e. the only fws) 5832 if ($(this).index() == $contentElementsNum - 1 && $('#respond').length == 0 && $('body.woocommerce-checkout').length == 0) { 5833 $('.container-wrap').css('padding-bottom', '0px'); 5834 $('.bottom_controls').css('margin-top', '0px'); 5835 $('#call-to-action .triangle').remove(); 5836 } 5837 5838 } 5839 } 5840 } 5841 5842 });
5843 5844 5845 $('#portfolio-extra > .nectar-slider-wrap[data-full-width="true"], .portfolio-wrap').each(function () { 5846 //check if it's last 5847 if ($(this).index() == $contentElementsNum - 1 && $('#commentform').length == 0 && $('#pagination').length == 0) { 5848 if (parseInt($('.container-wrap').css('padding-bottom')) > 0) { 5849 $(this).css('margin-bottom', '-40px'); 5850 } 5851 $('#call-to-action .triangle').remove(); 5852 } 5853 }); 5854 5855 5856 $('.portfolio-filters').each(function () { 5857 ////first 5858 if ($(this).index() == '0' && $pageHeaderBG.length != 0 || $(this).index() == '0') { 5859 $(this).addClass('first-section nder-page-header'); 5860 } else if ($(this).index() == '0' && $pageHeaderBG.length == 0 || $(this).index() == '0') { 5861 $(this).css({ 5862 'margin-top': '0px' 5863 }).addClass('first-section'); 5864 } 5865 }); 5866 5867 5868 $('.portfolio-filters-inline').each(function () { 5869 ////first 5870 if ($(this).parents('.wpb_row').length > 0) { 5871 //skip processing. 5872 } else { 5873 if ($(this).index() == '0' && $pageHeaderBG.length != 0 || $(this).index() == '0') { 5874 $(this).addClass('first-section nder-page-header'); 5875 } else if ($(this).index() == '0' && $pageHeaderBG.length == 0 || $(this).index() == '0') { 5876 5877 $(this).css({ 5878 'margin-top': '-30px', 5879 'padding-top': '50px' 5880 }).addClass('first-section'); 5881 5882 } 5883 } 5884 5885 }); 5886 5887 5888 } 5889 5890 5891 5892 5893 5894 5895 /** 5896 * Full width row padding adjust calculations. 5897 * 5898 * @since 3.0 5899 */ 5900 function fullWidthRowPaddingAdjustCalc() { 5901 5902 if ($('#boxed').length == 0) { 5903 5904 $('.full-width-section[data-top-percent], .full-width-section[data-bottom-percent], .full-width-content[data-top-percent], .full-width-content[data-bottom-percent]').each(function () { 5905 5906 var $windowHeight = $window.width(), 5907 $topPadding = ($(this).attr('data-top-percent')) ? $(this).attr('data-top-percent') : 'skip', 5908 $bottomPadding = ($(this).attr('data-bottom-percent')) ? $(this).attr('data-bottom-percent') : 'skip'; 5909 5910 //top 5911 if ($topPadding != 'skip') { 5912 $(this).css('padding-top', $windowHeight * (parseInt($topPadding) / 100)); 5913 } 5914 5915 //bottom 5916 if ($bottomPadding != 'skip') { 5917 $(this).css('padding-bottom', $windowHeight * (parseInt($bottomPadding) / 100)); 5918 } 5919 5920 }); 5921 } 5922 } 5923 5924 /** 5925 * Full width row padding adjust calculations for boxed theme option. 5926 * 5927 * @since 11.0.4 5928 */ 5929 function fullWidthRowPaddingAdjustCalcBoxed() { 5930 5931 if ($('#boxed').length > 0) { 5932 5933 $('.full-width-section[data-top-percent], .full-width-section[data-bottom-percent], .full-width-content[data-top-percent], .full-width-content[data-bottom-percent]').each(function () { 5934 5935 var $topPadding = ($(this).attr('data-top-percent')) ? $(this).attr('data-top-percent') : 'skip', 5936 $bottomPadding = ($(this).attr('data-bottom-percent')) ? $(this).attr('data-bottom-percent') : 'skip'; 5937 5938 //top 5939 if ($topPadding != 'skip') { 5940 $(this).css('padding-top', $topPadding); 5941 } 5942 5943 //bottom 5944 if ($bottomPadding != 'skip') { 5945 $(this).css('padding-bottom', $bottomPadding); 5946 } 5947 5948 }); 5949 } 5950 5951 } 5952 5953 5954 /** 5955 * Full width row padding adjust initialization 5956 * 5957 * @since 10.5 5958 */ 5959 function fullWidthRowPaddingAdjust() { 5960 5961 if (nectarDOMInfo.usingMobileBrowser) { 5962 fullWidthRowPaddingAdjustCalc(); 5963 } 5964 5965 $window.on('resize', fullWidthRowPaddingAdjustCalc); 5966 5967 } 5968 5969 5970 5971 5972 5973 /** 5974 * Full width content row auto equal height cols. 5975 * 5976 * @since 4.0 5977 */ 5978 function fullWidthContentColumns() { 5979 5980 var $frontEndEditorElDiv = ($('body.vc_editor').length > 0) ? '.vc_element > ' : ''; 5981 5982 $('.main-content > .row > ' + $frontEndEditorElDiv + ' .full-width-content, #portfolio-extra > ' + $frontEndEditorElDiv + ' .full-width-content, .woocommerce-tabs #tab-description > .full-width-content, .post-area.span_12 article .content-inner > .full-width-content').each(function () { 5983 5984 // Only set the height if more than one column 5985 if ($(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col').length > 1) { 5986 5987 var tallestColumn = 0;
5988 var $columnInnerHeight = 0; 5989 var $column_inner_selector; 5990 5991 $(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col').each(function () { 5992 5993 $column_inner_selector = ($(this).find('> .vc_column-inner > .wpb_wrapper').length > 0) ? '.vc_column-inner' : '.column-inner-wrap > .column-inner'; 5994 5995 var $padding = ( $body.is('[data-flex-cols="true"]') ) ? parseInt($(this).find('> .vc_column-inner').css('padding-top')) : parseInt($(this).css('padding-top')); 5996 var $frontEndEditorElPadding = ($frontEndEditorElDiv.length > 2 && $(this).find('> .vc_column-inner').length > 0) ? parseInt($(this).find('> .vc_column-inner').css('padding-top')) : 0; 5997 5998 if( $(this).find('> ' + $column_inner_selector + ' > .wpb_wrapper').height() + ($padding * 2) + $frontEndEditorElPadding > tallestColumn ) { 5999 tallestColumn = $(this).find('> ' + $column_inner_selector + ' > .wpb_wrapper').height() + ($padding * 2) + $frontEndEditorElPadding; 6000 } 6001 6002 }); 6003 6004 $(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col').each(function () { 6005 6006 $column_inner_selector = ($(this).find('> .vc_column-inner > .wpb_wrapper').length > 0) ? '.vc_column-inner' : '.column-inner-wrap > .column-inner'; 6007 6008 // Columns with content 6009 if ($(this).find('> ' + $column_inner_selector + ' > .wpb_wrapper > *').length > 0) { 6010 6011 // Added in 7.6 to fix equal height columns 6012 if ($frontEndEditorElDiv.length < 2 && !$(this).parent().parent().hasClass('vc_row-o-equal-height')) { 6013 $(this).css('height', tallestColumn); 6014 6015 if( $body.is('[data-flex-cols="true"]') ) { 6016 $(this).find('> .vc_column-inner').css('height', tallestColumn); 6017 } 6018 6019 } else if ($frontEndEditorElDiv.length > 2 && !$(this).parent().parent().parent().hasClass('vc_row-o-equal-height')) { 6020 $(this).css('height', tallestColumn); 6021 6022 if( $body.is('[data-flex-cols="true"]') ) { 6023 $(this).find('> .vc_column-inner').css('height', tallestColumn); 6024 } 6025 6026 } 6027 } 6028 6029 // Empty columns 6030 else { 6031 if ($(this).is('[data-using-bg="true"]')) { 6032 6033 $(this).css('min-height', tallestColumn); 6034 6035 if( $body.is('[data-flex-cols="true"]') ) { 6036 $(this).find('> .vc_column-inner').css('min-height', tallestColumn); 6037 } 6038 6039 if ($(this).is('[data-animation*="reveal"]')) { 6040 $(this).find('.column-inner') 6041 .css('min-height', tallestColumn); 6042 } 6043 6044 } 6045 } 6046 6047 }); 6048 6049 // Nested column height 6050 if (nectarDOMInfo.winW < 1000) { 6051 $(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col .wpb_row .col').css('min-height', '0px'); 6052 } 6053 6054 // Vertically center 6055 if ($(this).hasClass('vertically-align-columns') && 6056 nectarDOMInfo.winW > 1000 && 6057 !$(this).hasClass('vc_row-o-equal-height')) { 6058 6059 // Parent columns 6060 $(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col').each(function () { 6061 6062 $column_inner_selector = ($(this).find('> .vc_column-inner > .wpb_wrapper').length > 0) ? '.vc_column-inner' : '.column-inner-wrap > .column-inner'; 6063
6064 $columnInnerHeight = $(this).find('> ' + $column_inner_selector + ' > .wpb_wrapper').height(); 6065 6066 var $marginCalc = ($(this).height() / 2) - ($columnInnerHeight / 2); 6067 6068 if ($marginCalc <= 0) { 6069 $marginCalc = 0; 6070 } 6071 6072 $(this).find('> ' + $column_inner_selector + ' > .wpb_wrapper') 6073 .css('margin-top', $marginCalc) 6074 .css('margin-bottom', $marginCalc); 6075 6076 }); 6077 6078 6079 } 6080 6081 } 6082 6083 }); 6084 6085 6086 if( $('body[data-flex-cols="true"]').length == 0 ) { 6087 6088 // Equal height columns in container type with reveal columns 6089 $('.main-content > .row > .wpb_row:not(.full-width-content).vc_row-o-equal-height').each(function () { 6090 if ($(this).find('>.span_12 > ' + $frontEndEditorElDiv + ' .wpb_column[data-animation*="reveal"]').length > 0) { 6091 6092 var tallestColumn = 0; 6093 6094 $(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col').each(function () { 6095 6096 var $padding = parseInt($(this).find('> .column-inner-wrap > .column-inner').css('padding-top')); 6097 6098 if( $(this).find('> .column-inner-wrap > .column-inner').height() + ($padding * 2) > tallestColumn ) { 6099 tallestColumn = $(this).find('> .column-inner-wrap > .column-inner').height() + ($padding * 2); 6100 } 6101 6102 });
6103 6104 $(this).find('> .span_12 > ' + $frontEndEditorElDiv + ' .col').each(function () { 6105 6106 // Columns with content 6107 if ($(this).find('> .column-inner-wrap > .column-inner .wpb_wrapper > *').length > 0) { 6108 $(this).find('> .column-inner-wrap').css('height', tallestColumn); 6109 } 6110 // Empty columns 6111 else { 6112 $(this).css('min-height', tallestColumn); 6113 if ($(this).is('[data-animation*="reveal"]')) { 6114 $(this).find('.column-inner').css('min-height', tallestColumn); 6115 } 6116 } 6117 }); 6118 6119 } 6120 }); 6121 6122 // Using equal height option, top/bottom padding % needs to be convered into px for cross browser (flex bug) 6123 $('.wpb_row.vc_row-o-equal-height>.span_12> ' + $frontEndEditorElDiv + '.wpb_column[class*="padding-"][data-padding-pos="all"]').each(function () { 6124 if ($(this).parents('.tabbed').length == 0) { 6125 $(this).css({ 6126 'padding-top': $(this).css('padding-left'), 6127 'padding-bottom': $(this).css('padding-left') 6128 });
6129 } 6130 }); 6131 6132 } // endif; Not using modern grid system. 6133 6134 } 6135 6136 6137 6138 6139 /** 6140 * Mouse parallax row option. 6141 * 6142 * @since 4.0 6143 */ 6144 function mouseParallaxInit() { 6145 6146 $('.wpb_row:has(.nectar-parallax-scene)').each(function (i) { 6147 6148 var $strength = parseInt($(this).find('.nectar-parallax-scene').attr('data-scene-strength')); 6149 6150 $mouseParallaxScenes[i] = $(this).find('.nectar-parallax-scene').parallax({ 6151 scalarX: $strength, 6152 scalarY: $strength 6153 }); 6154 6155 // Wait until the images in the scene have loaded. 6156 var images = $(this).find('.nectar-parallax-scene li'); 6157 6158 $.each(images, function () { 6159 if ($(this).find('div').length > 0) { 6160 var el = $(this).find('div'), 6161 image = el.css('background-image').replace(/"/g, '').replace(/url\(|\)$/ig, ''); 6162 if (image && image !== '' && image !== 'none') { 6163 images = images.add($('<img>').attr('src', image)); 6164 } 6165 } 6166 }); 6167 6168 }); 6169 6170 } 6171 6172 6173 6174 6175 6176 6177 /** 6178 * Add checkmark icons to unorder list with checkmark class. 6179 * 6180 * @since 2.0 6181 */ 6182 function ulCheckmarks() { 6183 $('ul.checks li').each(function () { 6184 if ($(this).find('i.fa-check-circle').length == 0) { 6185 $(this).prepend('<i class="fa fa-check-circle"></i>'); 6186 } 6187 }); 6188 } 6189 6190 6191 6192 6193 /** 6194 * Allow CTA element BG color to also act as a link. 6195 * 6196 * @since 11.0 6197 */ 6198 function ctaLinkBG() { 6199 6200 $body.on('click','.nectar-cta[data-using-bg="true"]:not([data-style="material"]) .link_wrap', function() { 6201 6202 $(this).find('a.link_text')[0].click(); 6203 6204 }); 6205 6206 } 6207 6208 6209 6210 /** 6211 * Add CSS default animation classes through JS to 6212 * avoid inital animation on page load. 6213 * 6214 * @since 11.0 6215 */ 6216 function nectarKeyframeAssist() { 6217 6218 $('.nectar-cta[data-style="arrow-animation"]').addClass('loaded'); 6219 6220 } 6221 6222 6223 6224 6225 /** 6226 * Page builder row background layer animations. 6227 * 6228 * @since 9.0 6229 * @see waypoints 6230 */ 6231 function rowBGAnimations() { 6232 6233 var $rowBGAnimationsOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : '93%'; 6234 var $rowBGAnimationsRevealOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : '75%'; 6235 var $rowBGOffset; 6236 6237 $($fullscreenSelector + '.row-bg-wrap[data-bg-animation]:not([data-bg-animation="none"]):not([data-bg-animation*="displace-filter"]) .row-bg').each(function () { 6238 6239 var $animation = $(this).parents('.row-bg-wrap').attr('data-bg-animation'); 6240 6241 if( $animation != 'zoom-out-reveal' && $animation.indexOf('reveal-from-') == -1 ) { 6242 $rowBGOffset = $rowBGAnimationsOffsetPos; 6243 } else { 6244 $rowBGOffset = $rowBGAnimationsRevealOffsetPos; 6245 } 6246 6247 if( !$(this).hasClass('using-image') && $(this).parents('.nectar-scrolling-text').length == 0 ) { 6248 6249 if( $animation != 'zoom-out-reveal' && $animation.indexOf('reveal-from-') == -1 ) { 6250 return; 6251 } 6252 6253 } 6254 6255 var $that = $(this); 6256 var waypoint = new Waypoint({ 6257 element: $that.parents('.row-bg-wrap'), 6258 handler: function () { 6259 6260 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 6261 waypoint.destroy(); 6262 return; 6263 } 6264 6265 $that.parents('.inner-wrap').addClass('animated-in'); 6266 6267 if( $animation == 'zoom-out-reveal' || $animation.indexOf('reveal-from-') > -1 || $that.parents('.nectar-scrolling-text').length > 0 ) { 6268 $that.parents('.row-bg-wrap').addClass('animated-in'); 6269 } 6270 6271 waypoint.destroy(); 6272 }, 6273 offset: $rowBGOffset 6274 }); 6275 6276 }); 6277 6278 } 6279 6280 6281 /** 6282 * Page builder column background layer animations. 6283 * 6284 * @since 9.0 6285 * @see waypoints 6286 */ 6287 function columnBGAnimations() { 6288 6289 var $colBGAnimationsOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : '93%'; 6290 var $colBGAnimationsRevealOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : '80%'; 6291 var $colBGOffset; 6292 6293 $($fullscreenSelector + '.column-image-bg-wrap[data-bg-animation]:not([data-bg-animation="none"]):not([data-bg-animation*="displace-filter"]) .column-image-bg').each(function () { 6294 6295 var $animation = $(this).parents('.column-image-bg-wrap').attr('data-bg-animation'); 6296 6297 if( $animation != 'zoom-out-reveal' && $animation.indexOf('reveal-from-') == -1 ) { 6298 $colBGOffset = $colBGAnimationsOffsetPos; 6299 } else { 6300 6301 if( $animation == 'ro-reveal-from-bottom' && $fullscreenMarkupBool == false ) { 6302 $colBGOffset = '95%'; 6303 } else if( $animation == 'ro-reveal-from-top' && $fullscreenMarkupBool == false ) { 6304 $colBGOffset = '65%'; 6305 } else { 6306 $colBGOffset = $colBGAnimationsRevealOffsetPos; 6307 } 6308 } 6309 6310 var $that = $(this); 6311 6312 var waypoint = new Waypoint({ 6313 element: $that.parents('.column-image-bg-wrap'), 6314 handler: function () { 6315 6316 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 6317 waypoint.destroy(); 6318 return; 6319 } 6320 6321 $that.parents('.inner-wrap').addClass('animated-in'); 6322 if( $animation == 'zoom-out-reveal' || $animation.indexOf('reveal-from-') > -1 ) { 6323 $that.parents('.column-image-bg-wrap').addClass('animated-in'); 6324 $that.parents('.column-image-bg-wrap').siblings('.column-bg-overlay-wrap').addClass('animated-in'); 6325 $that.parents('.vc_column-inner').addClass('revealed-bg'); 6326 } 6327 waypoint.destroy(); 6328 }, 6329 offset: $colBGOffset 6330 });
6331 6332 }); 6333 6334 // Zoom out reveal with BG color only 6335 $($fullscreenSelector + '.column-bg-overlay-wrap[data-bg-animation]').each(function () { 6336 6337 $colBGOffset = $colBGAnimationsRevealOffsetPos; 6338 6339 var $that = $(this); 6340 var $animation = $(this).attr('data-bg-animation'); 6341 6342 if( $animation == 'zoom-out-reveal' || $animation.indexOf('reveal-from-') > 0 ) { 6343 6344 if( $that.parent().find('.column-image-bg-wrap').length == 0 ) { 6345 6346 var waypoint = new Waypoint({ 6347 element: $that, 6348 handler: function () { 6349 6350 if ( $that.hasClass('animated-in') ) { 6351 waypoint.destroy(); 6352 return; 6353 } 6354 6355 $that.addClass('animated-in'); 6356 $that.parents('.vc_column-inner').addClass('revealed-bg'); 6357 waypoint.destroy(); 6358 6359 }, 6360 offset: $colBGOffset 6361 }); 6362 6363 } 6364 6365 } 6366 6367 }); 6368 6369 } 6370 6371 6372 6373 /** 6374 * Page builder column and image animations. 6375 * 6376 * @since 4.0 6377 * @see waypoints 6378 */ 6379 function colAndImgAnimations() { 6380 6381 var $colAndImgOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : '88%'; 6382 var $cascadingOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : '70%'; 6383 var $colAndImgRevealOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : '70%'; 6384 6385 $($fullscreenSelector + '.img-with-animation').each(function () { 6386 6387 var $that = $(this); 6388 6389 var $animationType = ($that.is('[data-animation]')) ? $that.attr('data-animation') : 'fade-in'; 6390 6391 // reveal images alters offset 6392 if( $animationType == 'ro-reveal-from-right' && $colAndImgOffsetPos == '88%' || 6393 $animationType == 'ro-reveal-from-left' && $colAndImgOffsetPos == '88%' ) { 6394 $colAndImgOffsetPos = '75%'; 6395 } 6396 6397 // initiate waypoint. 6398 var waypoint = new Waypoint({ 6399 element: $that, 6400 handler: function () { 6401 6402 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 6403 waypoint.destroy(); 6404 return; 6405 } 6406 6407 if (!bypassAnimations || $('body[data-responsive="0"]').length > 0) { 6408 6409 var $delay = ($that.is('[data-delay]')) ? $that.attr('data-delay') : 0; 6410 var $elToAnimate = ($that.parents('.hover-wrap').length > 0) ? $that.parents('.hover-wrap') : $that; 6411 6412 6413 if ($animationType == 'fade-in-from-left' || $animationType == 'fade-in-from-right') { 6414 6415 $elToAnimate.delay($delay).transition({ 6416 'opacity': 1, 6417 'x': '0px' 6418 }, $animationDuration, $animationEasing); 6419 6420 } else if ($animationType == 'fade-in-from-bottom') { 6421 6422 $elToAnimate.delay($delay).transition({ 6423 'opacity': 1, 6424 'y': '0px' 6425 }, $animationDuration, $animationEasing); 6426 6427 } else if ($animationType == 'fade-in') { 6428 6429 $elToAnimate.delay($delay).transition({ 6430 'opacity': 1 6431 }, $animationDuration, $animationEasing); 6432 6433 } else if ($animationType == 'grow-in') { 6434 6435 setTimeout(function () { 6436 $elToAnimate.transition({ 6437 scale: 1, 6438 'opacity': 1 6439 }, $animationDuration, $animationEasing); 6440 }, $delay); 6441 6442 } else if ($animationType == 'flip-in') { 6443 6444 setTimeout(function () { 6445 $elToAnimate.transition({ 6446 rotateY: 0, 6447 'opacity': 1 6448 }, $animationDuration, $animationEasing); 6449 }, $delay); 6450 6451 } else if ($animationType == 'flip-in-vertical') { 6452 6453 setTimeout(function () { 6454 $elToAnimate.transition({ 6455 rotateX: 0, 6456 'opacity': 1 6457 }, $animationDuration, $animationEasing); 6458 }, $delay); 6459 6460 } 6461 else if ($animationType == 'ro-reveal-from-left' || 6462 $animationType == 'ro-reveal-from-right' || 6463 $animationType == 'ro-reveal-from-bottom' || 6464 $animationType == 'ro-reveal-from-top') { 6465 $that.parents('.img-with-aniamtion-wrap').addClass('animated-in'); 6466 } 6467 6468 $that.addClass('animated-in'); 6469 6470 } 6471 6472 waypoint.destroy(); 6473 6474 }, 6475 offset: $colAndImgOffsetPos 6476 });
6477 6478 6479 6480 }); 6481 6482 6483 $($fullscreenSelector + '.nectar_cascading_images').each(function () { 6484 6485 var $that = $(this); 6486 var $animationDelay = ($(this).is('[data-animation-timing]')) ? $(this).attr('data-animation-timing') : 175; 6487 $animationDelay = parseInt($animationDelay); 6488 6489 var waypoint = new Waypoint({ 6490 element: $that, 6491 handler: function () { 6492 6493 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 6494 waypoint.destroy(); 6495 return; 6496 } 6497 6498 if (!bypassAnimations || $('body[data-responsive="0"]').length > 0) { 6499 6500 $that.find('.cascading-image').each(function (i) { 6501 6502 var $that2 = $(this); 6503 6504 if ($that2.attr('data-animation') == 'flip-in' || $that2.attr('data-animation') == 'flip-in-vertical') { 6505 setTimeout(function () { 6506 $that2.find('.inner-wrap').css({ 6507 'opacity': 1, 6508 'transform': 'rotate(0deg) translateZ(0px)' 6509 }); 6510 }, i * $animationDelay); 6511 } else if( $that2.attr('data-animation') == 'grow-in-reveal' ) { 6512 setTimeout(function () { 6513 $that2.find('.inner-wrap').css({ 6514 'opacity': 1, 6515 'transform': 'translateX(0px) translateY(0px) scale(1,1) translateZ(0px)' 6516 }); 6517 $that2.find('.inner-wrap img').css({ 6518 'transform': 'translateX(0px) translateY(0px) scale(1,1) translateZ(0px)' 6519 }); 6520 }, i * $animationDelay); 6521 } 6522 else { 6523 setTimeout(function () { 6524 $that2.find('.inner-wrap').css({ 6525 'opacity': 1, 6526 'transform': 'translateX(0px) translateY(0px) scale(1,1) translateZ(0px)' 6527 }); 6528 }, i * $animationDelay); 6529 } 6530 6531 6532 }); 6533 6534 $that.addClass('animated-in'); 6535 6536 } 6537 6538 waypoint.destroy(); 6539 6540 }, 6541 offset: $cascadingOffsetPos 6542 }); 6543 6544 }); 6545 6546 6547 $($fullscreenSelector + '.col.has-animation:not([data-animation*="reveal"]), ' + $fullscreenSelector + '.wpb_column.has-animation:not([data-animation*="reveal"]), ' + $fullscreenSelector + '.nectar-fancy-box.has-animation').each(function (i) { 6548 6549 var $that = $(this); 6550 6551 //set perspective for vertical flip 6552 if ($that.is('[data-animation="flip-in-vertical"]') || $that.is('[data-animation="slight-twist"]')) { 6553 if( $('.page-submenu[data-sticky="true"]').length == 0 ) { 6554 $that.parents('.col.span_12').addClass('flip-in-vertical-wrap'); 6555 } 6556 } 6557 6558 var waypoint = new Waypoint({ 6559 element: $that, 6560 handler: function () { 6561 6562 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 6563 waypoint.destroy(); 6564 return; 6565 } 6566 6567 if (!bypassAnimations || $('body[data-responsive="0"]').length > 0) { 6568 6569 var $delay = $that.attr('data-delay'); 6570 6571 if ($that.attr('data-animation') == 'fade-in-from-left' || $that.attr('data-animation') == 'fade-in-from-right') { 6572 6573 $standAnimatedColTimeout[i] = setTimeout(function () { 6574 $that.transition({ 6575 'opacity': 1, 6576 'x': '0px' 6577 }, $animationDuration, $animationEasing); 6578 }, $delay); 6579 6580 } else if ($that.attr('data-animation') == 'fade-in-from-bottom') { 6581 6582 $standAnimatedColTimeout[i] = setTimeout(function () { 6583 $that.transition({ 6584 'opacity': 1, 6585 'y': '0px' 6586 }, $animationDuration, $animationEasing); 6587 }, $delay); 6588 6589 } else if ($that.attr('data-animation') == 'fade-in') { 6590 6591 $standAnimatedColTimeout[i] = setTimeout(function () { 6592 $that.transition({ 6593 'opacity': 1 6594 }, $animationDuration, $animationEasing); 6595 }, $delay); 6596 6597 } else if ($that.attr('data-animation') == 'grow-in' || $that.attr('data-animation') == 'zoom-out') { 6598 6599 $standAnimatedColTimeout[i] = setTimeout(function () { 6600 $that.transition({ 6601 scale: 1, 6602 'opacity': 1 6603 }, $animationDuration, $animationEasing); 6604 }, $delay); 6605 6606 } else if ($that.attr('data-animation') == 'flip-in') { 6607 6608 $standAnimatedColTimeout[i] = setTimeout(function () { 6609 $that.transition({ 6610 rotateY: 0, 6611 'opacity': 1 6612 }, $animationDuration, $animationEasing); 6613 }, $delay); 6614 6615 } else if ($that.attr('data-animation') == 'flip-in-vertical') { 6616 6617 $standAnimatedColTimeout[i] = setTimeout(function () { 6618 $that.transition({ 6619 rotateX: 0, 6620 y: 0, 6621 'opacity': 1 6622 }, $animationDuration, $animationEasing); 6623 }, $delay); 6624 6625 } else if ($that.attr('data-animation') == 'slight-twist') { 6626 6627 $standAnimatedColTimeout[i] = setTimeout(function () { 6628 anime({ 6629 targets: $that[0], 6630 rotateY: [20, 0], 6631 rotateZ: [-4, 0], 6632 opacity: 1, 6633 easing: $animationEasing, 6634 duration: $animationDuration 6635 });
6636 }, $delay); 6637 6638 } 6639 6640 //boxed column hover fix 6641 if ($that.hasClass('boxed')) { 6642 $that.addClass('no-pointer-events'); 6643 setTimeout(function () { 6644 $that.removeClass('no-pointer-events'); 6645 }, parseInt($animationDuration) + parseInt($delay) + 30); 6646 } 6647 6648 if ($that.find('.nectar-post-grid-wrap[data-style="mouse_follow_image"]')) { 6649 setTimeout(function() { 6650 $that[0].style.transform = 'none'; 6651 }, parseInt($animationDuration) + parseInt($delay) + 30 ); 6652 } 6653 6654 $that.addClass('animated-in'); 6655 6656 } 6657 6658 waypoint.destroy(); 6659 }, 6660 offset: $colAndImgOffsetPos 6661 }); 6662 6663 }); 6664 6665 6666 $($fullscreenSelector + '.wpb_column.has-animation[data-animation*="reveal"]').each(function () { 6667 6668 var $that = $(this), 6669 waypoint = new Waypoint({ 6670 element: $that, 6671 handler: function () { 6672 6673 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 6674 waypoint.destroy(); 6675 return; 6676 } 6677 6678 var $delay = $that.attr('data-delay'); 6679 6680 if (!bypassAnimations || $('body[data-responsive="0"]').length > 0) { 6681 6682 var $columnInnerSelector = ( $that.find('> .vc_column-inner').length > 0 ) ? true : false; 6683 6684 if ($that.attr('data-animation') == 'reveal-from-bottom' || $that.attr('data-animation') == 'reveal-from-top') { 6685 6686 setTimeout(function () { 6687 6688 if ($that.hasClass('animated-in')) { 6689 6690 if( $columnInnerSelector == true ) { 6691 6692 // Modern. 6693 $that.find('> .vc_column-inner').transition({ 6694 'y': 0 6695 }, $animationDuration, $animationEasing ); 6696 6697 } else { 6698 6699 // Legacy. 6700 $that.find('.column-inner-wrap, .column-inner').transition({ 6701 'y': 0 6702 }, $animationDuration, $animationEasing, function () { 6703 $that.find('.column-inner-wrap, .column-inner').addClass('no-transform'); 6704 }); 6705 } 6706 6707 } 6708 6709 }, $delay); 6710 6711 } else if ($that.attr('data-animation') == 'reveal-from-right' || $that.attr('data-animation') == 'reveal-from-left') { 6712 setTimeout(function () { 6713 if ($that.hasClass('animated-in')) { 6714 6715 if( $columnInnerSelector == true ) { 6716 6717 // Modern. 6718 $that.find('> .vc_column-inner').transition({ 6719 'x': 0 6720 }, $animationDuration, $animationEasing); 6721 6722 6723 } else { 6724 // Legacy. 6725 $that.find('.column-inner-wrap, .column-inner').transition({ 6726 'x': 0 6727 }, $animationDuration, $animationEasing, function () { 6728 $that.find('.column-inner-wrap, .column-inner').addClass('no-transform'); 6729 }); 6730 6731 } 6732 6733 6734 } 6735 }, $delay); 6736 } 6737 6738 $that.addClass('animated-in'); 6739 6740 } 6741 6742 waypoint.destroy(); 6743 }, 6744 offset: $colAndImgRevealOffsetPos 6745 }); 6746 6747 }); 6748 6749 } 6750 6751 6752 6753 /** 6754 * Cascading images element sizing 6755 * 6756 * @since 6.0 6757 */ 6758 function cascadingImageBGSizing() { 6759 6760 $('.nectar_cascading_images').each(function () { 6761 6762 //handle max width for cascading images in equal height columns 6763 if ($(this).parents('.vc_row-o-equal-height').length > 0 && $(this).parents('.wpb_column').length > 0) { 6764 $(this).css('max-width', $(this).parents('.wpb_column').width()); 6765 } 6766 6767 //set size for layers with no images 6768 $(this).find('.bg-color').each(function () { 6769 6770 var $bgColorHeight = 0; 6771 var $bgColorWidth = 0; 6772 6773 if ($(this).parent().find('.img-wrap').length == 0) { 6774 6775 var $firstSibling = $(this).parents('.cascading-image').siblings('.cascading-image[data-has-img="true"]').first(); 6776 6777 $firstSibling.css({ 6778 'position': 'relative', 6779 'visiblity': 'hidden' 6780 });
6781 6782 $bgColorHeight = $firstSibling.find('.img-wrap').height(); 6783 $bgColorWidth = $firstSibling.find('.img-wrap').width(); 6784 6785 if ($firstSibling.index() == 0) { 6786 $firstSibling.css({ 6787 'visiblity': 'visible' 6788 }); 6789 } else { 6790 $firstSibling.css({ 6791 'position': 'absolute', 6792 'visiblity': 'visible' 6793 }); 6794 } 6795 } else { 6796 $bgColorHeight = $(this).parent().find('.img-wrap').height(); 6797 $bgColorWidth = $(this).parent().find('.img-wrap').width(); 6798 } 6799 6800 $(this).css({ 6801 'height': $bgColorHeight, 6802 'width': $bgColorWidth 6803 }); 6804 }); 6805 }); 6806 6807 } 6808 6809 6810 6811 6812 /** 6813 * Cascading images element initialization. 6814 * 6815 * @since 10.5 6816 */ 6817 function cascadingImageInit() { 6818 6819 if ($('.nectar_cascading_images').length > 0) { 6820 6821 var cascadingParallax = []; 6822 6823 $('.nectar_cascading_images').each(function(i){ 6824 6825 imagesLoaded($(this), function (instance) { 6826 6827 // Create sizes. 6828 cascadingImageBGSizing(); 6829 6830 // Parallax scrolling. 6831 if( $(instance.elements[0]).is('[data-parallax="yes"]') && !nectarDOMInfo.usingMobileBrowser && $('#nectar_fullscreen_rows').length == 0 ) { 6832 cascadingParallax[i] = new CascadingParallax($(instance.elements[0]), $(instance.elements[0]).attr('data-parallax-intensity')); 6833 } 6834 6835 }); 6836 6837 }); 6838 6839 // BG Sizing Resize. 6840 $window.on('resize', cascadingImageBGSizing); 6841 6842 } 6843 6844 } 6845 6846 6847 6848 6849 function CascadingParallax(el, intensity) { 6850 6851 this.$element = el; 6852 this.inView = false; 6853 this.topLevel = false; 6854 this.lastY = 0; 6855 6856 this.layer1Parallax = ( this.$element.is('[data-layer-1-parallax="yes"]') ) ? true : false; 6857 6858 switch(intensity) { 6859 case 'subtle': 6860 this.intensity = 0.09; 6861 break; 6862 case 'medium': 6863 this.intensity = 0.15; 6864 break; 6865 case 'high': 6866 this.intensity = 0.25; 6867 break; 6868 } 6869 this.calculatePos(); 6870 this.trackView(); 6871 this.animate(); 6872 6873 if( $('.portfolio-filters').length > 0 || 6874 $('.portfolio-filters-inline').length > 0 ) { 6875 setInterval(this.calculatePos.bind(this),700); 6876 } 6877 6878 $window.on('resize', this.calculatePos.bind(this)); 6879 } 6880 6881 CascadingParallax.prototype.calculatePos = function() { 6882 this.offsetTop = this.$element.offset().top; 6883 this.height = this.$element.outerHeight(); 6884 this.vertCenter = nectarDOMInfo.winH/2 - this.height/2; 6885 }; 6886 6887 CascadingParallax.prototype.trackView = function() { 6888 6889 var that = this; 6890 6891 if( this.$element.parents('.top-level').length > 0 ) { 6892 this.topLevel = true; 6893 } 6894 6895 if( 'IntersectionObserver' in window ) { 6896 6897 var options = { 6898 rootMargin: '250px', 6899 } 6900 var observer = new IntersectionObserver(function(entries) { 6901 6902 entries.forEach(function(entry){ 6903 var isIntersecting = entry.isIntersecting; 6904 6905 if (isIntersecting) { 6906 that.inView = true; 6907 } else { 6908 that.inView = false; 6909 } 6910 }); 6911 6912 }, options); 6913 6914 observer.observe(this.$element[0]); 6915 6916 } 6917 6918 }; 6919 6920 CascadingParallax.prototype.animate = function() { 6921 6922 if( this.inView ) { 6923 6924 var that = this; 6925 6926 this.lastY = linearInterpolate(this.lastY, nectarDOMInfo.scrollTop, 0.18); 6927 6928 this.$element.find('.bg-layer').each(function(i) { 6929 6930 var $scale = $(this).attr('data-scale'); 6931 6932 if( that.layer1Parallax ) { 6933 i = (i/1.5)+1; 6934 } 6935 6936 if( that.topLevel === true && nectarDOMInfo.winW > 1000) { 6937 $(this).css('transform','translateY(' + -(that.lastY * that.intensity * i) + 'px) translateZ(0) scale(' + $scale + ')'); 6938 } else { 6939 $(this).css('transform','translateY(' + -((that.lastY - that.offsetTop + that.vertCenter ) * that.intensity * i ) + 'px) translateZ(0) scale(' + $scale + ')'); 6940 } 6941 6942 });
6943 } 6944 6945 window.requestAnimationFrame(this.animate.bind(this)); 6946 }; 6947 6948 6949 6950 6951 /** 6952 * Split line heading element initialization. 6953 * 6954 * @since 10.5 6955 * @see waypoints 6956 */ 6957 function splitLineHeadings() { 6958 6959 // Create waypoint. 6960 var $splitLineOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : 'bottom-in-view'; 6961 $($fullscreenSelector + '.nectar-split-heading').each(function () { 6962 6963 var $that = $(this); 6964 var $delay = ( $that.is('[data-animation-delay]') ) ? parseInt($that.attr('data-animation-delay')) : 0; 6965 6966 var waypoint = new Waypoint({ 6967 element: $that, 6968 handler: function () { 6969 6970 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 6971 waypoint.destroy(); 6972 return; 6973 } 6974 6975 if (!bypassAnimations || $('body[data-responsive="0"]').length > 0) { 6976 6977 var $animationDurationCap; 6978 6979 setTimeout(function() { 6980 6981 if( $that.is('[data-animation-type="line-reveal-by-space"]') ) { 6982 6983 $animationDurationCap = (parseInt($animationDuration) < 900) ? $animationDuration : '900'; 6984 $that.find('> * > span').each(function (i) { 6985 6986 $(this).find('> .inner').transition({ 6987 'y': '0px' 6988 }, $animationDuration, $animationEasing); 6989 6990 }); 6991 6992 } else if( $that.is('[data-animation-type="letter-fade-reveal"]') ) { 6993 6994 $animationDurationCap = (parseInt($animationDuration) < 1000) ? $animationDuration : '1000'; 6995 $that.find('> * > span span').each(function (i) { 6996 6997 $(this).delay(i * 8).transition({ 6998 'y': '0px', 6999 'opacity': '1' 7000 }, $animationDurationCap, $animationEasing); 7001 7002 }); 7003 7004 } else { 7005 $that.find('.heading-line').each(function (i) { 7006 7007 $(this).find('> div').delay(i * 70).transition({ 7008 'y': '0px' 7009 }, $animationDuration, $animationEasing); 7010 7011 }); 7012 } 7013 7014 $that.addClass('animated-in'); 7015 7016 }, $delay); 7017 7018 } 7019 7020 waypoint.destroy(); 7021 }, 7022 offset: $splitLineOffsetPos 7023 }); 7024 7025 }); 7026 } 7027 7028 7029 7030 /** 7031 * Progress bar element initialization. 7032 * 7033 * @since 3.0 7034 * @see waypoints 7035 */ 7036 7037 function progressBars() { 7038 7039 var $progressBarsOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : 'bottom-in-view'; 7040 var $progressSelector = ($('#nectar_fullscreen_rows[data-mobile-disable="on"]').length > 0 && nectarDOMInfo.usingMobileBrowser) ? '.nectar-progress-bar' : $fullscreenSelector + '.nectar-progress-bar'; 7041 7042 if( nectarDOMInfo.usingMobileBrowser && $progressBarsOffsetPos == 'bottom-in-view') { 7043 $progressBarsOffsetPos = '70%'; 7044 } 7045 7046 $($progressSelector).parent().each(function () { 7047 7048 var $that = $(this), 7049 waypoint = new Waypoint({ 7050 element: $that, 7051 handler: function () { 7052 7053 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 7054 waypoint.destroy(); 7055 return; 7056 } 7057 7058 if ($progressBarsOffsetPos == '100%') { 7059 $that.find('.nectar-progress-bar .bar-wrap').css('opacity', '1'); 7060 } 7061 7062 $that.find('.nectar-progress-bar').each(function (i) { 7063 7064 var percent = $(this).find('span').attr('data-width'), 7065 $endNum = parseInt($(this).find('span strong i').text()), 7066 $that = $(this); 7067 7068 $that.find('span').delay(i * 90).transition({ 7069 'width': percent + '%' 7070 }, 1050, 'easeInOutQuint', function () {}); 7071 7072 setTimeout(function () { 7073 7074 var countOptions = {
7075 useEasing: false 7076 }; 7077 var $countEle = $that.find('span strong i')[0]; 7078 var numAnim = new CountUp($countEle, 0, $endNum, 0, 1, countOptions); 7079 numAnim.start(); 7080 7081 $that.find('span strong').transition({ 7082 'opacity': 1 7083 }, 550, 'easeInCirc'); 7084 }, (i * 90)); 7085 7086 ////100% progress bar 7087 if (percent == '100') { 7088 $that.find('span strong').addClass('full'); 7089 } 7090 }); 7091 7092 $that.addClass('completed'); 7093 7094 waypoint.destroy(); 7095 7096 }, 7097 offset: $progressBarsOffsetPos 7098 }); 7099 7100 }); 7101 } 7102 7103 7104 7105 /** 7106 * Page builder column border animations. 7107 * 7108 * @since 8.0 7109 * @see waypoints 7110 */ 7111 function animatedColBorders() { 7112 7113 var $progressBarsOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : '75%'; 7114 $($fullscreenSelector + '.wpb_column[data-border-animation="true"]').each(function () { 7115 7116 var $that = $(this), 7117 waypoint = new Waypoint({ 7118 element: $that, 7119 handler: function () { 7120 7121 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 7122 waypoint.destroy(); 7123 return; 7124 } 7125 7126 var $borderDelay = ($that.attr('data-border-animation-delay').length > 0) ? parseInt($that.attr('data-border-animation-delay')) : 0; 7127 setTimeout(function () { 7128 $that.find('.border-wrap').addClass('animation'); 7129 $that.find('.border-wrap').addClass('completed'); 7130 }, $borderDelay); 7131 7132 waypoint.destroy(); 7133 7134 }, 7135 offset: $progressBarsOffsetPos 7136 }); 7137 7138 }); 7139 } 7140 7141 7142 7143 /** 7144 * Food menu item element. 7145 * 7146 * @since 8.0 7147 * @see waypoints 7148 */ 7149 function foodMenuItems() { 7150 7151 var $foodItemOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : '80%'; 7152 $($fullscreenSelector + '.nectar_food_menu_item').parent().each(function () { 7153 7154 var $that = $(this), 7155 waypoint = new Waypoint({ 7156 element: $that, 7157 handler: function () { 7158 7159 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 7160 waypoint.destroy(); 7161 return; 7162 } 7163 7164 $that.find('.nectar_food_menu_item').each(function (i) { 7165 7166 var $that = $(this); 7167 7168 setTimeout(function () { 7169 $that.addClass('animated-in'); 7170 }, i * 150); 7171 7172 });
7173 7174 waypoint.destroy(); 7175 7176 }, 7177 offset: $foodItemOffsetPos 7178 }); 7179 7180 }); 7181 } 7182 7183 7184 7185 /** 7186 * Divider element 7187 * 7188 * @since 3.0 7189 * @see waypoints 7190 */ 7191 function dividers() { 7192 7193 var $dividerOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : 'bottom-in-view'; 7194 7195 $($fullscreenSelector + '.divider-small-border[data-animate="yes"], ' + $fullscreenSelector + '.divider-border[data-animate="yes"]').each(function () { 7196 7197 var $lineDur = ($(this).hasClass('divider-small-border')) ? 1300 : 1500, 7198 $that = $(this), 7199 waypoint = new Waypoint({ 7200 element: $that, 7201 handler: function () { 7202 7203 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 7204 waypoint.destroy(); 7205 return; 7206 } 7207 7208 $that.each(function () { 7209 7210 $(this).css({ 7211 'transform': 'scale(0,1)', 7212 'visibility': 'visible' 7213 }); 7214 var $that = $(this); 7215 7216 $that.delay($that.attr('data-animation-delay')).transition({ 7217 'transform': 'scale(1, 1)' 7218 }, $lineDur, 'cubic-bezier(.18,1,.22,1)'); 7219 7220 });
7221 7222 $that.addClass('completed'); 7223 7224 waypoint.destroy(); 7225 7226 }, 7227 offset: $dividerOffsetPos 7228 }); 7229 7230 }); 7231 } 7232 7233 7234 7235 /** 7236 * Image with hotspots element hover event 7237 * 7238 * @since 7.0 7239 */ 7240 function hotSpotHoverBind() { 7241 7242 //add pulse animation 7243 $('.nectar_image_with_hotspots[data-hotspot-icon="numerical"]').each(function () { 7244 $(this).find('.nectar_hotspot_wrap').each(function (i) { 7245 var $that = $(this); 7246 setTimeout(function () { 7247 $that.find('.nectar_hotspot').addClass('pulse'); 7248 }, i * 300); 7249 }); 7250 }); 7251 7252 7253 var hotSpotHoverTimeout = []; 7254 7255 $('.nectar_image_with_hotspots:not([data-tooltip-func="click"]) .nectar_hotspot').each(function (i) { 7256 7257 hotSpotHoverTimeout[i] = ''; 7258 7259 $(this).on('mouseover', function () { 7260 clearTimeout(hotSpotHoverTimeout[i]); 7261 $(this).parent().css({ 7262 'z-index': '400', 7263 'height': 'auto', 7264 'width': 'auto' 7265 }); 7266 }); 7267 7268 $(this).on('mouseleave', function () { 7269 7270 var $that = $(this); 7271 $that.parent().css({ 7272 'z-index': 'auto' 7273 }); 7274 7275 hotSpotHoverTimeout[i] = setTimeout(function () { 7276 $that.parent().css({ 7277 'height': '30px', 7278 'width': '30px' 7279 });
7280 }, 300); 7281 7282 }); 7283 7284 }); 7285 7286 } 7287 7288 7289 7290 /** 7291 * Image with hotspots element responsive behavior. 7292 * 7293 * @since 7.0 7294 */ 7295 function responsiveTooltips() { 7296 7297 $('.nectar_image_with_hotspots').each(function () { 7298 7299 $(this).find('.nectar_hotspot_wrap').each(function () { 7300 7301 if (nectarDOMInfo.winW > 690) { 7302 7303 // Remove click if applicable 7304 if ($(this).parents('.nectar_image_with_hotspots[data-tooltip-func="hover"]').length > 0) { 7305 $(this).find('.nectar_hotspot').removeClass('click'); 7306 $(this).find('.nttip').removeClass('open'); 7307 } 7308 7309 $(this).find('.nttip .inner a.tipclose').remove(); 7310 $('.nttip').css('height', 'auto'); 7311 7312 // Reset for positioning 7313 $(this).css({ 7314 'width': 'auto', 7315 'height': 'auto' 7316 }); 7317 7318 $(this).find('.nttip') 7319 .removeClass('force-right') 7320 .removeClass('force-left') 7321 .removeClass('force-top') 7322 .css('width', 'auto'); 7323 7324 var $tipOffset = $(this).find('.nttip').offset(); 7325 7326 // Against right side 7327 if ($tipOffset.left > $(this).parents('.nectar_image_with_hotspots').width() - 200) { 7328 $(this).find('.nttip').css('width', '250px'); 7329 } 7330 else { 7331 $(this).find('.nttip').css('width', 'auto'); 7332 } 7333 7334 // Responsive 7335 if ($tipOffset.left < 0) { 7336 $(this).find('.nttip').addClass('force-right'); 7337 } 7338 else if ($tipOffset.left + $(this).find('.nttip').outerWidth(true) > nectarDOMInfo.winW) { 7339 $(this).find('.nttip').addClass('force-left').css('width', '250px'); 7340 } 7341 else if ($tipOffset.top + $(this).find('.nttip').height() + 35 > $window.height() && $('#nectar_fullscreen_rows').length > 0) { 7342 $(this).find('.nttip').addClass('force-top'); 7343 } 7344 7345 if ($(this).find('> .open').length == 0) { 7346 7347 $(this).css({ 7348 'width': '30px', 7349 'height': '30px' 7350 }); 7351 } 7352 7353 } else { 7354 7355 //fixed position 7356 $(this).find('.nttip') 7357 .removeClass('force-left') 7358 .removeClass('force-right') 7359 .removeClass('force-top'); 7360 7361 $(this).find('.nectar_hotspot').addClass('click'); 7362 7363 if ($(this).find('.nttip a.tipclose').length == 0) { 7364 $(this).find('.nttip .inner').append('<a href="#" class="tipclose"><span></span></a>'); 7365 } 7366 7367 // Change height of fixed 7368 $('.nttip').css('height', $window.height()); 7369 } 7370 }); 7371 }); 7372 7373 } 7374 7375 7376 /** 7377 * Image with hotspots events 7378 * 7379 * @since 10.5 7380 */ 7381 function imageWithHotspotEvents() { 7382 7383 if( $('.nectar_image_with_hotspots').length == 0 ) { 7384 return; 7385 } 7386 7387 // Hover 7388 hotSpotHoverBind(); 7389 7390 // Click 7391 $body.on('click', '.nectar_hotspot.click', function () { 7392 $(this).parents('.nectar_image_with_hotspots').find('.nttip').removeClass('open'); 7393 $(this).parent().find('.nttip').addClass('open'); 7394 7395 $(this).parents('.nectar_image_with_hotspots').find('.nectar_hotspot').removeClass('open'); 7396 $(this).parent().find('.nectar_hotspot').addClass('open'); 7397 7398 if (nectarDOMInfo.winW > 690) { 7399 $(this).parent().css({ 7400 'z-index': '120', 7401 'height': 'auto', 7402 'width': 'auto' 7403 }); 7404 7405 var $that = $(this); 7406 7407 setTimeout(function () { 7408 $that.parents('.nectar_image_with_hotspots').find('.nectar_hotspot_wrap').each(function () { 7409 7410 if ($(this).find('> .open').length == 0) { 7411 $(this).css({ 7412 'height': '30px', 7413 'width': '30px', 7414 'z-index': 'auto' 7415 }); 7416 } 7417 });
7418 }, 300); 7419 } 7420 7421 if (nectarDOMInfo.winW <= 690) { 7422 $(this).parents('.wpb_row, [class*="vc_col-"]').css('z-index', '200'); 7423 } 7424 7425 return false; 7426 }); 7427 7428 $body.on('click', '.nectar_hotspot.open', function () { 7429 $(this).parent().find('.nttip').removeClass('open'); 7430 $(this).parent().find('.nectar_hotspot').removeClass('open'); 7431 7432 $(this).parents('.wpb_row').css('z-index', 'auto'); 7433 7434 return false; 7435 }); 7436 7437 $body.on('click', '.nttip.open', function () { 7438 if (nectarDOMInfo.winW < 690) { 7439 $(this).parents('.nectar_image_with_hotspots').find('.nttip').removeClass('open'); 7440 $(this).parents('.nectar_image_with_hotspots').find('.nectar_hotspot').removeClass('open'); 7441 $(this).parents('.wpb_row').css('z-index', 'auto'); 7442 return false; 7443 } 7444 }); 7445 7446 7447 // Calculate on init. 7448 responsiveTooltips(); 7449 7450 // Resize event. 7451 $window.on('resize',responsiveTooltips); 7452 7453 } 7454 7455 7456 7457 /** 7458 * Image with hotspots initialization. 7459 * 7460 * @since 7.0 7461 * @see waypoints 7462 */ 7463 function imageWithHotspots() { 7464 7465 var $imageWithHotspotsOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : '50%'; 7466 7467 $($fullscreenSelector + '.nectar_image_with_hotspots[data-animation="true"]').each(function () { 7468 7469 var $that = $(this); 7470 var waypoint = new Waypoint({ 7471 element: $that, 7472 handler: function () { 7473 7474 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 7475 waypoint.destroy(); 7476 return; 7477 } 7478 7479 $that.addClass('completed'); 7480 $that.find('.nectar_hotspot_wrap').each(function (i) { 7481 var $that2 = $(this); 7482 var $extrai = ($that2.parents('.col.has-animation').length > 0) ? 1 : 0; 7483 setTimeout(function () { 7484 $that2.addClass('animated-in'); 7485 }, 175 * (i + $extrai)); 7486 });
7487 7488 waypoint.destroy(); 7489 7490 }, 7491 offset: $imageWithHotspotsOffsetPos 7492 }); 7493 7494 }); 7495 7496 7497 } 7498 7499 7500 /** 7501 * Nectar Lazy Loading 7502 * 7503 * @since 11.0 7504 */ 7505 function nectarLazyImageLoading() { 7506 7507 var lazyItems = [].slice.call(document.querySelectorAll('[data-nectar-img-src]')); 7508 7509 if ('IntersectionObserver' in window) { 7510 7511 var options = { 7512 rootMargin: '500px', 7513 } 7514 7515 nectarLazyImageSizing(); 7516 $window.off('resize.nectarLazySizing', nectarLazyImageSizing); 7517 $window.on('resize.nectarLazySizing', nectarLazyImageSizing); 7518 7519 var lazyItemObserver = new IntersectionObserver(function(entries) { 7520 7521 entries.forEach(function(entry) { 7522 if (entry.isIntersecting) { 7523 var lazyItem = entry.target; 7524 7525 var imgSrc = lazyItem.getAttribute('data-nectar-img-src'); 7526 7527 // img tags. 7528 if( lazyItem.classList.contains('nectar-lazy') ) { 7529 lazyItem.addEventListener( 'load', function() { 7530 lazyItem.style.height = ""; 7531 lazyItem.style.width = ""; 7532 lazyItem.classList.add('loaded'); 7533 lazyItem.removeAttribute('data-nectar-img-src'); 7534 lazyItemObserver.unobserve(lazyItem); 7535 }); 7536 lazyItem.src = imgSrc; 7537 var srcset = lazyItem.getAttribute('data-nectar-img-srcset'); 7538 if( srcset ) { 7539 lazyItem.setAttribute( 'srcset', srcset ); 7540 lazyItem.removeAttribute('data-nectar-img-srcset'); 7541 } 7542 } 7543 // BGs. 7544 else { 7545 lazyItem.style.backgroundImage = "url('" + imgSrc + "')"; 7546 lazyItem.classList.add('loaded'); 7547 lazyItem.removeAttribute('data-nectar-img-src'); 7548 lazyItemObserver.unobserve(lazyItem); 7549 } 7550 7551 } 7552 7553 }); 7554 7555 }, options); 7556 7557 lazyItems.forEach(function(lazyItem) { 7558 lazyItemObserver.observe(lazyItem); 7559 }); 7560 7561 } 7562 else { 7563 // load all the images when intersection observer is not supported. 7564 lazyItems.forEach(function(lazyItem) { 7565 7566 // img tags. 7567 if( lazyItem.classList.contains('nectar-lazy') ) { 7568 lazyItem.style.height = ""; 7569 lazyItem.style.width = ""; 7570 lazyItem.src = lazyItem.getAttribute('data-nectar-img-src'); 7571 var srcset = lazyItem.getAttribute('data-nectar-img-srcset'); 7572 if( srcset ) { 7573 lazyItem.setAttribute( 'srcset', srcset ); 7574 lazyItem.removeAttribute('data-nectar-img-srcset'); 7575 } 7576 lazyItem.classList.add('loaded'); 7577 lazyItem.removeAttribute('data-nectar-img-src'); 7578 } 7579 // BGs. 7580 else { 7581 lazyItem.style.backgroundImage = "url('" + lazyItem.getAttribute('data-nectar-img-src') + "')"; 7582 lazyItem.classList.add('loaded'); 7583 lazyItem.removeAttribute('data-nectar-img-src'); 7584 } 7585 7586 }); 7587 } 7588 7589 7590 } 7591 7592 7593 /** 7594 * Nectar lazy img size helper. 7595 * 7596 * @since 11.0 7597 */ 7598 7599 function nectarLazyImageSizing() { 7600 7601 $('img.nectar-lazy:not(.loaded)').each(function() { 7602 7603 $(this).css({ 7604 'height': '', 7605 'width' : '' 7606 }); 7607 7608 var heightAttr = parseInt($(this).attr('height')); 7609 var widthAttr = parseInt($(this).attr('width')); 7610 7611 var width = ($(this).parents('.nectar_cascading_images').length > 0) ? $(this).parents('.bg-layer').width() : $(this).width(); 7612 7613 // Post grid. 7614 if( $(this).parents('.nectar-post-grid-item-bg-wrap-inner').length > 0 ) { 7615 width = $(this).parents('.nectar-post-grid-item-bg-wrap-inner').width(); 7616 } 7617 7618 var dimensions = calculateAspectRatio( widthAttr, heightAttr, width, 2000 ); 7619 7620 $(this).css({ 7621 'height': dimensions.height + 'px', 7622 'width' : dimensions.width + 'px' 7623 }); 7624 7625 }); 7626 7627 } 7628 7629 7630 /** 7631 * Nectar Post Grid Mouse Follow Init 7632 * 7633 * @since 11.0 7634 */ 7635 function nectarPostGridMouse() { 7636 7637 viewIndicatorArr = []; 7638 postGridImgMouseFollowArr = []; 7639 7640 if( !nectarDOMInfo.usingMobileBrowser ) { 7641 7642 $('.nectar-post-grid[data-indicator="yes"]').each(function(i) { 7643 viewIndicatorArr[i] = new NectarIconMouseFollow($(this),'view-indicator'); 7644 });
7645 7646 $('.nectar-post-grid-wrap[data-style="mouse_follow_image"] .nectar-post-grid').each(function(i) { 7647 postGridImgMouseFollowArr[i] = new NectarIconMouseFollow($(this), 'post-grid-images'); 7648 }); 7649 7650 } 7651 7652 } 7653 7654 7655 7656 7657 7658 /** 7659 * Nectar Post Grid 7660 * 7661 * @since 11.0 7662 */ 7663 function nectarPostGridInit() { 7664 7665 $nectarPostGridArr = []; 7666 7667 // Mouse follow. 7668 nectarPostGridMouse(); 7669 7670 // Create grid instances. 7671 $('.nectar-post-grid-wrap').each(function(i) { 7672 $nectarPostGridArr[i] = new NectarPostGrid($(this)); 7673 }); 7674 7675 7676 } 7677 7678 7679 7680 function NectarPostGrid(el) { 7681 7682 this.el = el; 7683 this.currentPage = 0; 7684 this.activeFilter = 1; 7685 this.activeCatTotal = 0; 7686 this.settingsData = JSON.parse(this.el.attr('data-el-settings')); 7687 this.queryData = JSON.parse(this.el.attr('data-query')); 7688 this.sortable = this.el.find('.nectar-post-grid-filters').attr('data-sortable'); 7689 7690 this.initialMarkup(); 7691 this.clickEvents(); 7692 } 7693 7694 NectarPostGrid.prototype.initialMarkup = function() { 7695 7696 // Start Filter Active. 7697 if( this.el.find('.nectar-post-grid-filters a.active').length == 0 ) { 7698 this.el.find('.nectar-post-grid-filters a:first-child').addClass('active'); 7699 } 7700 7701 // Load More Markup. 7702 if( this.settingsData.pagination === 'load-more' && this.el.find('.load-more-wrap').length == 0 ) { 7703 7704 this.activeCatTotal = parseInt(this.el.find('.nectar-post-grid-filters a:nth-child(' + this.activeFilter + ')').attr('data-total-count')); 7705 7706 // Start hidden? 7707 if( this.el.find('.nectar-post-grid-item').length >= this.activeCatTotal ) { 7708 this.el.append('<div class="load-more-wrap inactive"><a href="#" class="load-more">'+ this.el.attr('data-load-more-text') + '</a></div>'); 7709 } else { 7710 this.el.append('<div class="load-more-wrap"><a href="#" class="load-more">'+ this.el.attr('data-load-more-text') + '</a></div>'); 7711 } 7712 7713 } 7714 7715 }; 7716 7717 7718 7719 NectarPostGrid.prototype.clickEvents = function() { 7720 7721 // Sortable Mobile Toggle. 7722 this.el.find('.nectar-post-grid-filters h4').on('click', function(){ 7723 $(this).parent().find('div').toggleClass('visible'); 7724 $(this).toggleClass('visible'); 7725 }); 7726 7727 // Sortable/Pagination. 7728 var settingsData = this.settingsData; 7729 var queryData = this.queryData; 7730 var instance = this; 7731 7732 this.el.find('.nectar-post-grid-filters a, .load-more-wrap:not(.inactive) .load-more').on('click', function(){ 7733 7734 var $that = $(this); 7735 7736 // Filter active. 7737 if($that.parents('.nectar-post-grid-wrap.loading').length > 0 || $(this).hasClass('active')) { 7738 return false; 7739 } 7740 7741 7742 if( $(this).parents('.nectar-post-grid-filters').length > 0 ) { 7743 // Filter specific. 7744 $that.parent().find('a').removeClass('active'); 7745 $that.addClass('active'); 7746 instance.currentPage = 0; 7747 instance.activeFilter = $that.index() + 1; 7748 } else { 7749 // Load More specific. 7750 instance.currentPage++; 7751 } 7752 7753 var $gridEl = $that.parents('.nectar-post-grid-wrap').find('.nectar-post-grid') 7754 var $pagination = settingsData.pagination; 7755 var $action = ($that.hasClass('load-more') && $pagination === 'load-more') ? 'load-more' : 'filter'; 7756 var $category = ''; 7757 7758 // Determine what category to load from. 7759 if( instance.sortable === 'yes' ) { 7760 $category = $that.parents('.nectar-post-grid-wrap').find('.nectar-post-grid-filters a.active').attr('data-filter'); 7761 } else { 7762 7763 var skipAll = ( $that.parents('.nectar-post-grid-wrap').find('.nectar-post-grid-filters a').length > 1 ) ? ':not(.all-filter)' : ''; 7764 7765 $that.parents('.nectar-post-grid-wrap').find('.nectar-post-grid-filters a' + skipAll).each(function(){ 7766 $category += $(this).attr('data-filter') + ', '; 7767 });
7768 7769 $category = $category.substring(0, $category.length - 2); 7770 7771 } 7772 7773 7774 var $dataToPass = { 7775 action: 'nectar_get_post_grid_segment', 7776 post_type: queryData.post_type, 7777 category: $category, 7778 posts_per_page: queryData.posts_per_page, 7779 current_page: instance.currentPage, 7780 offset: queryData.offset, 7781 order: queryData.order, 7782 orderby: queryData.orderby, 7783 load_action: $action, 7784 settings: { 7785 pagination: $pagination, 7786 post_type: settingsData.post_type, 7787 image_size: settingsData.image_size, 7788 aspect_ratio_image_size: settingsData.aspect_ratio_image_size, 7789 card_bg_color: settingsData.card_bg_color, 7790 display_categories: settingsData.display_categories, 7791 display_excerpt: settingsData.display_excerpt, 7792 display_date: settingsData.display_date, 7793 color_overlay: settingsData.color_overlay, 7794 color_overlay_opacity: settingsData.color_overlay_opacity, 7795 color_overlay_hover_opacity: settingsData.color_overlay_hover_opacity, 7796 grid_style: settingsData.grid_style, 7797 heading_tag: settingsData.heading_tag, 7798 post_title_overlay: settingsData.post_title_overlay 7799 } 7800 }; 7801 7802 $that.parents('.nectar-post-grid-wrap').addClass('loading'); 7803 7804 $.post(window.nectarLove.ajaxurl, $dataToPass, function (data) { 7805 7806 // Update markup. 7807 if( $action === 'load-more' ) { 7808 $gridEl.append(data); 7809 } else { 7810 $gridEl.html(data); 7811 } 7812 7813 // Load in animation. 7814 if( $gridEl.is('[data-animation="fade-in-from-bottom"]') ) { 7815 7816 $that.parents('.nectar-post-grid-wrap').removeClass('finished-animating'); 7817 7818 $gridEl.find('.nectar-post-grid-item:not(.animated-in)').each(function(i) { 7819 var $storedEl = $(this); 7820 setTimeout(function() { 7821 $storedEl.addClass('animated-in'); 7822 }, i * 90); 7823 7824 }); 7825 7826 setTimeout(function(){ 7827 $that.parents('.nectar-post-grid-wrap').addClass('finished-animating'); 7828 }, 950); 7829 } 7830 7831 if( $pagination === 'load-more' ) { 7832 7833 instance.activeCatTotal = parseInt(instance.el.find('.nectar-post-grid-filters a:nth-child(' + instance.activeFilter + ')').attr('data-total-count')); 7834 7835 if( $gridEl.find('.nectar-post-grid-item').length >= instance.activeCatTotal ) { 7836 instance.el.find('.load-more-wrap').addClass('inactive'); 7837 } else { 7838 instance.el.find('.load-more-wrap').removeClass('inactive'); 7839 } 7840 7841 } 7842 7843 $that.parents('.nectar-post-grid-wrap').removeClass('loading'); 7844 7845 // Resize. 7846 $window.trigger('resize'); 7847 7848 // Mouse follow. 7849 nectarPostGridMouse(); 7850 7851 }); 7852 7853 return false; 7854 7855 }); 7856 7857 }; 7858 7859 7860 function NectarPostGridWaypoint() { 7861 7862 var postGridOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : '75%'; 7863 7864 $($fullscreenSelector + '.nectar-post-grid-wrap').each(function () { 7865 7866 var $that = $(this), 7867 waypoint = new Waypoint({ 7868 element: $that, 7869 handler: function () { 7870 7871 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 7872 waypoint.destroy(); 7873 return; 7874 } 7875 7876 $that.find('.nectar-post-grid-filters').addClass('animated-in'); 7877 $that.find('.nectar-post-grid-item').each(function(i) { 7878 7879 var $item = $(this); 7880 7881 setTimeout(function() { 7882 7883 $item.addClass('animated-in'); 7884 7885 }, i * 90); 7886 7887 });
7888 7889 setTimeout(function(){ 7890 $that.addClass('finished-animating'); 7891 }, 950); 7892 7893 7894 waypoint.destroy(); 7895 7896 }, 7897 offset: postGridOffsetPos 7898 }); 7899 7900 }); 7901 7902 } 7903 7904 7905 7906 /** 7907 * Animated title element initialization. 7908 * 7909 * @since 7.0 7910 * @see waypoints 7911 */ 7912 function animatedTitles() { 7913 7914 var $animatedTitlesOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : 'bottom-in-view'; 7915 7916 $($fullscreenSelector + '.nectar-animated-title').each(function () { 7917 7918 var $that = $(this), 7919 waypoint = new Waypoint({ 7920 element: $that, 7921 handler: function () { 7922 7923 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 7924 waypoint.destroy(); 7925 return; 7926 } 7927 7928 $that.addClass('completed'); 7929 7930 waypoint.destroy(); 7931 7932 }, 7933 offset: $animatedTitlesOffsetPos 7934 }); 7935 7936 }); 7937 } 7938 7939 7940 7941 7942 /** 7943 * Highlighted Text element initialization. 7944 * 7945 * @since 9.0 7946 * @see waypoints 7947 */ 7948 function highlightedText() { 7949 7950 var $highlightedTextOffsetPos = ($fullscreenMarkupBool == true) ? '200%' : 'bottom-in-view'; 7951 var highlightedColorCss = ''; 7952 7953 if( nectarDOMInfo.usingMobileBrowser && $highlightedTextOffsetPos == 'bottom-in-view' ) { 7954 $highlightedTextOffsetPos = '85%'; 7955 } 7956 7957 $($fullscreenSelector + '.nectar-highlighted-text').each(function (i) { 7958 7959 var $animationDelay = 0; 7960 7961 if($(this).is('[data-animation-delay]') && 7962 $(this).attr('data-animation-delay').length > 0 && 7963 $(this).attr('data-animation') != 'false') { 7964 $animationDelay = $(this).attr('data-animation-delay'); 7965 } 7966 7967 // Custom color 7968 if ($(this).is('[data-using-custom-color="true"]')) { 7969 7970 var $custom_highlight_color = $(this).attr('data-color'); 7971 var $custom_highlight_color_2 = ( $(this).is('[data-color-gradient]') && $(this).attr('data-color-gradient').length > 0 ) ? $(this).attr('data-color-gradient') : false; 7972 7973 $(this).addClass('instance-' + i); 7974 7975 if( $custom_highlight_color_2 !== false && $custom_highlight_color_2.length > 0 ) { 7976 highlightedColorCss += '.nectar-highlighted-text.instance-' + i + ' em:before { background: linear-gradient(90deg, '+ $custom_highlight_color +', '+ $custom_highlight_color_2 +'); }'; 7977 7978 if( $(this).is('[data-style="regular_underline"]') ) { 7979 highlightedColorCss += '.nectar-highlighted-text[data-style="regular_underline"].instance-' + i + ' a em:after { background: linear-gradient(90deg, '+ $custom_highlight_color +', '+ $custom_highlight_color_2 +'); }'; 7980 highlightedColorCss += '.nectar-highlighted-text[data-style="regular_underline"].instance-' + i + ' em a:after { background: linear-gradient(90deg, '+ $custom_highlight_color +', '+ $custom_highlight_color_2 +'); }'; 7981 } 7982 7983 } else { 7984 highlightedColorCss += '.nectar-highlighted-text.instance-' + i + ' em:before { background-color: ' + $custom_highlight_color + '; }'; 7985 7986 if( $(this).is('[data-style="regular_underline"]') ) { 7987 highlightedColorCss += '.nectar-highlighted-text[data-style="regular_underline"].instance-' + i + ' a em:after { background-color: ' + $custom_highlight_color + '; }'; 7988 highlightedColorCss += '.nectar-highlighted-text[data-style="regular_underline"].instance-' + i + ' em a:after { background-color: ' + $custom_highlight_color + '; }'; 7989 } 7990 7991 } 7992 7993 7994 } 7995 7996 if (bypassAnimations) { 7997 $(this).find('em').addClass('animated'); 7998 } 7999 8000 // Waypoint 8001 var $that = $(this); 8002 var waypoint = new Waypoint({ 8003 element: $that, 8004 handler: function () { 8005 8006 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated')) { 8007 waypoint.destroy(); 8008 return; 8009 } 8010 8011 setTimeout(function() { 8012 8013 $that.find('em').each(function (i) { 8014 var $highlighted_em = $(this); 8015 setTimeout(function () { 8016 $highlighted_em.addClass('animated'); 8017 }, i * 300); 8018 8019 });
8020 8021 }, $animationDelay); 8022 8023 waypoint.destroy(); 8024 8025 }, 8026 offset: $highlightedTextOffsetPos 8027 }); 8028 8029 }); 8030 8031 // Style 8032 nectarCreateStyle(highlightedColorCss, 'highlighted-text'); 8033 8034 } 8035 8036 8037 8038 8039 /** 8040 * Pricing table element height calculations. 8041 * 8042 * @since 2.0 8043 */ 8044 function pricingTableHeight() { 8045 8046 var $tallestCol; 8047 8048 $('.pricing-table[data-style="default"]').each(function () { 8049 $tallestCol = 0; 8050 8051 $(this).find('> div ul').each(function () { 8052 8053 if( $(this).height() > $tallestCol ) { 8054 $tallestCol = $(this).height(); 8055 } 8056 8057 }); 8058 8059 //safety net incase pricing tables height couldn't be determined 8060 if ($tallestCol == 0) { 8061 $tallestCol = 'auto'; 8062 } 8063 8064 //set even height 8065 $(this).find('> div ul').css('height', $tallestCol); 8066 8067 }); 8068 } 8069 8070 8071 8072 8073 /** 8074 * Testimonial slider element initialization. 8075 * 8076 * @since 10.5 8077 */ 8078 function nectarTestimonialSliders() { 8079 8080 $testimonialSliders = []; 8081 8082 if (typeof NectarTestimonialSlider == 'undefined') { 8083 return; 8084 } 8085 8086 $('.testimonial_slider').each(function (i) { 8087 8088 var $that_el = $(this), 8089 $type = ($(this).is('[data-style]')) ? $(this).attr('data-style') : 'none'; 8090 8091 $testimonialSliders[i] = new NectarTestimonialSlider($that_el, $type, resizeVideoToCover, fullWidthContentColumns); 8092 8093 8094 if ($(this).is('.disable-height-animation:not([data-style*="multiple_visible"])')) { 8095 $testimonialSliders[i].testimonialSliderHeight(); 8096 setTimeout($testimonialSliders[i].testimonialSliderHeight.bind($testimonialSliders[i]), 500); 8097 } 8098 8099 if ($(this).is('.testimonial_slider[data-style="multiple_visible_minimal"]')) { 8100 $testimonialSliders[i].testimonialSliderHeightMinimalMult(); 8101 setTimeout($testimonialSliders[i].testimonialSliderHeightMinimalMult.bind($testimonialSliders[i]), 500); 8102 } 8103 8104 }); 8105 8106 8107 } 8108 8109 8110 /** 8111 * Testimonial slider element resize binding. 8112 * 8113 * @since 10.5 8114 */ 8115 function nectarTestimonialSlidersEvents() { 8116 8117 $window.off('smartresize.nectarTestimonials'); 8118 $window.off('resize.nectarTestimonialsMin'); 8119 8120 if($testimonialSliders.length > 0) { 8121 $window.on('smartresize.nectarTestimonials',nectarTestimonialMainResize); 8122 } 8123 8124 if( $('.testimonial_slider[data-style="multiple_visible_minimal"]').length > 0 ) { 8125 $window.on('resize.nectarTestimonialsMin',nectarTestimonialMiniamlResize); 8126 } 8127 8128 } 8129 8130 function nectarTestimonialMainResize() { 8131 for (var i = 0; i < $testimonialSliders.length; i++) { 8132 $testimonialSliders[i].testimonialSliderHeight(); 8133 $testimonialSliders[i].testimonialHeightResize(); 8134 } 8135 } 8136 function nectarTestimonialMiniamlResize() { 8137 for (var i = 0; i < $testimonialSliders.length; i++) { 8138 $testimonialSliders[i].testimonialSliderHeightMinimalMult(); 8139 } 8140 } 8141 8142 8143 8144 /** 8145 * Icon list element initialization. 8146 * 8147 * @since 6.0 8148 * @see waypoints 8149 */ 8150 function iconList() { 8151 8152 var $iconListOffsetPos = ($fullscreenMarkupBool == true) ? '250%' : '75%'; 8153 8154 $($fullscreenSelector + '.nectar-icon-list[data-animate="true"]').each(function () { 8155 8156 var $that = $(this), 8157 waypoint = new Waypoint({ 8158 element: $that, 8159 handler: function () { 8160 8161 if ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 8162 waypoint.destroy(); 8163 return; 8164 } 8165 8166 $that.each(function () { 8167 8168 var $listItemAnimationDelay = ($that.is('[data-direction="horizontal"]')) ? 100 : 300; 8169 8170 $(this).find('.nectar-icon-list-item').each(function (i) { 8171 var $thatt = $(this); 8172 setTimeout(function () { 8173 $thatt.addClass('animated'); 8174 }, i * $listItemAnimationDelay); 8175 });
8176 8177 }); 8178 8179 $that.addClass('completed'); 8180 8181 waypoint.destroy(); 8182 8183 }, 8184 offset: $iconListOffsetPos 8185 }); 8186 8187 }); 8188 } 8189 8190 8191 8192 /** 8193 * Get the BG color of parent column/row. 8194 * 8195 * @since 6.0 8196 */ 8197 function narrowParentBGC(element) { 8198 8199 var narrowedBGC; 8200 8201 if (element.parents('.wpb_column[data-bg-color*="#"]').length > 0 && element.parents('.wpb_column[data-bg-opacity="1"]').length > 0) { 8202 narrowedBGC = element.parents('.wpb_column').attr('data-bg-color'); 8203 } 8204 else if (element.parents('.wpb_row').length > 0 && element.parents('.wpb_row').find('.row-bg.using-bg-color').length > 0 || 8205 element.parents('.wpb_row').length > 0 && element.parents('.wpb_row').find('.row-bg.using-bg-color-excluded').length > 0) { 8206 narrowedBGC = element.parents('.wpb_row').find('.row-bg').css('background-color'); 8207 } 8208 else { 8209 if ($('#nectar_fullscreen_rows').length > 0) { 8210 narrowedBGC = $('#nectar_fullscreen_rows > .wpb_row .full-page-inner-wrap').css('background-color'); 8211 } 8212 else { 8213 narrowedBGC = $('.container-wrap').css('background-color'); 8214 } 8215 } 8216 8217 return narrowedBGC; 8218 8219 } 8220 8221 8222 /** 8223 * Icon BG matching row BG 8224 * 8225 * @since 6.0 8226 */ 8227 function nectarIconMatchColoring() { 8228 8229 var nectarMatchingBGCss = ''; 8230 8231 // Icon list 8232 $('.nectar-icon-list[data-icon-style="border"], .nectar_icon_wrap[data-style="border-animation"][data-color*="extra-color-gradient-"]').each(function (i) { 8233 8234 var $bgColorToSet = narrowParentBGC($(this)); 8235 8236 if( $(this).hasClass('nectar-icon-list') ) { 8237 $(this).find('.list-icon-holder').css('background-color', $bgColorToSet); 8238 } 8239 else { 8240 8241 $(this).removeClass(function (index, className) { 8242 return (className.match(/(^|\s)instance-\S+/g) || []).join(' '); 8243 }); 8244 8245 $(this).addClass('instance-' + i); 8246 nectarMatchingBGCss += '.nectar_icon_wrap.instance-' + i + ' .nectar_icon:before { background-color: ' + $bgColorToSet + '!important; }'; 8247 } 8248 8249 }); 8250 8251 // Material gradient btns 8252 $('body.material .nectar-button.see-through[class*="m-extra-color-gradient"]').each(function (i) { 8253 8254 var $bgColorToSet = narrowParentBGC($(this)); 8255 8256 $(this).removeClass(function (index, className) { 8257 return (className.match(/(^|\s)instance-\S+/g) || []).join(' '); 8258 }); 8259 8260 $(this).addClass('instance-' + i); 8261 nectarMatchingBGCss += '.nectar-button.see-through.instance-' + i + ':after { background-color: ' + $bgColorToSet + '!important; }'; 8262 8263 }); 8264 8265 // Style 8266 nectarCreateStyle(nectarMatchingBGCss, 'nectaricon-color-match'); 8267 8268 } 8269 8270 8271 8272 8273 8274 /** 8275 * One fourth column classes. 8276 * 8277 * @since 2.0 8278 */ 8279 function oneFourthClasses() { 8280 8281 $('.col.span_3, .vc_span3, .vc_col-sm-3').each(function () { 8282 if (!$(this).is('[data-t-w-inherits="small_desktop"]')) { 8283 8284 var $currentDiv = $(this); 8285 var $nextDiv = $(this).next('div'); 8286 8287 if ($nextDiv.hasClass('span_3') && !$currentDiv.hasClass('one-fourths') || 8288 $nextDiv.hasClass('vc_span3') && !$currentDiv.hasClass('one-fourths') || 8289 $nextDiv.hasClass('vc_col-sm-3') && !$currentDiv.hasClass('one-fourths')) { 8290 $currentDiv.addClass('one-fourths clear-both'); 8291 $nextDiv.addClass('one-fourths right-edge'); 8292 } 8293 } 8294 }); 8295 8296 // Make empty second 1/2 half columns display right on iPad 8297 $('.span_12 .col.span_6').each(function () { 8298 if ($(this).next('div').hasClass('span_6') && $.trim($(this).next('div').html()).length == 0) { 8299 $(this).addClass('empty-second'); 8300 } 8301 }); 8302 8303 } 8304 8305 8306 8307 8308 /** 8309 * Responsive video iframes initialization. 8310 * 8311 * @since 3.0 8312 */ 8313 function responsiveVideoIframesInit() { 8314 8315 $('iframe').each(function () { 8316 8317 // Make sure the iframe has a src 8318 if (typeof $(this).attr('src') != 'undefined' && 8319 !$(this).hasClass('skip-nectar-video-size') && 8320 !$(this).hasClass('iframe-embed') && 8321 $(this).parents('.ult_modal').length == 0 && 8322 $(this).parents('.ls-slide').length == 0 && 8323 $(this).parents('.esg-entry-media').length == 0 && 8324 $(this).parents('.wpb_video_widget.wpb_content_element').length == 0) { 8325 8326 var embedSrcLower = $(this).attr('src').toLowerCase(); 8327 8328 if (embedSrcLower.indexOf("youtube") >= 0 || 8329 embedSrcLower.indexOf("vimeo") >= 0 || 8330 embedSrcLower.indexOf("twitch.tv") >= 0 || 8331 embedSrcLower.indexOf("kickstarter") >= 0 || 8332 embedSrcLower.indexOf("embed-ssl.ted") >= 0 || 8333 embedSrcLower.indexOf("dailymotion") >= 0) { 8334 8335 $(this).addClass('iframe-embed'); 8336 8337 if ($(this).width() < $(this).parent().width()) { 8338 $(this) 8339 .attr('data-aspectRatio', $(this).height() / $(this).width()) 8340 .removeAttr('height') 8341 .removeAttr('width'); 8342 } else { 8343 $(this) 8344 .attr('data-aspectRatio', '0.56') 8345 .removeAttr('height') 8346 .removeAttr('width'); 8347 } 8348 8349 if ($(this).parents('.post-area.masonry.classic').length > 0) { 8350 $(this) 8351 .attr('data-aspectRatio', '0.56') 8352 .removeAttr('height') 8353 .removeAttr('width'); 8354 } 8355 8356 } 8357 8358 } 8359 8360 });
8361 8362 } 8363 8364 8365 /** 8366 * Responsive video iframes. 8367 * 8368 * @since 3.0 8369 */ 8370 function responsiveVideoIframes() { 8371 8372 $('iframe[data-aspectRatio]').each(function () { 8373 8374 var $el = $(this), 8375 newWidth = $el.parent().width(); 8376 8377 // In nectar slider 8378 if ($(this).parents('.swiper-slide').length > 0) { 8379 if ($(this).is(':visible')) { 8380 $el 8381 .width(newWidth) 8382 .height(newWidth * $el.attr('data-aspectRatio')); 8383 } 8384 } 8385 // All others 8386 else { 8387 $el 8388 .width(newWidth) 8389 .height(newWidth * $el.attr('data-aspectRatio')); 8390 } 8391 8392 }); 8393 8394 } 8395 8396 8397 /** 8398 * Reveal the audio/video elements after the size has been calculated. 8399 * 8400 * @since 10.5 8401 */ 8402 function audioVideoVis() { 8403 8404 //unwrap post and protfolio videos 8405 $('.video-wrap iframe').unwrap(); 8406 $('#sidebar iframe[src]').unwrap(); 8407 8408 $('audio') 8409 .attr('width', '100%') 8410 .attr('height', '100%') 8411 .css('visibility', 'visible'); 8412 8413 if ($body.hasClass('mobile')) { 8414 $('video').css('visibility', 'hidden'); 8415 } else { 8416 $('video').css('visibility', 'visible'); 8417 } 8418 8419 8420 $('.wp-video').each(function () { 8421 var video = $(this).find('video').get(0); 8422 video.addEventListener('loadeddata', function () { 8423 $window.trigger('resize'); 8424 }, false); 8425 }); 8426 8427 //webkit video back button fix 8428 $('.main-content iframe[src]').each(function () { 8429 $(this).css({ 8430 'opacity': '1', 8431 'visibility': 'visible' 8432 }); 8433 }); 8434 8435 } 8436 8437 8438 8439 8440 8441 /** 8442 * Nectar video background size calculations 8443 * 8444 * @since 5.0 8445 */ 8446 function resizeVideoToCover() { 8447 8448 var vid_w_orig = 1280, 8449 vid_h_orig = 720, 8450 min_w = 1200; 8451 8452 $('.nectar-video-wrap').each(function () { 8453 8454 var $containerHeight, $containerWidth; 8455 8456 if ($(this).find('video').length == 0) { 8457 return; 8458 } 8459 8460 if ($(this).parents('#page-header-bg').length > 0) { 8461 8462 if ($('.container-wrap.auto-height').length > 0) { 8463 return false; 8464 } 8465 8466 $containerHeight = $(this).parents('#page-header-bg').outerHeight(); 8467 $containerWidth = $(this).parents('#page-header-bg').outerWidth(); 8468 } else { 8469 8470 if ($(this).hasClass('column-video')) { 8471 if( $body.is('[data-flex-cols="true"]') ) { 8472 $containerHeight = $(this).parents('.vc_column-inner').outerHeight(); 8473 $containerWidth = $(this).parents('.vc_column-inner').outerWidth(); 8474 } else { 8475 $containerHeight = $(this).parents('.wpb_column').outerHeight(); 8476 $containerWidth = $(this).parents('.wpb_column').outerWidth(); 8477 } 8478 } else { 8479 $containerHeight = $(this).parents('.wpb_row').outerHeight(); 8480 $containerWidth = ($(this).parents('.full-width-section').length > 0) ? nectarDOMInfo.winW : $(this).parents('.wpb_row').outerWidth(); 8481 } 8482 } 8483 8484 // Set the video viewport to the window size 8485 $(this).width($containerWidth); 8486 if ($(this).parents('#page-header-bg').length > 0) { 8487 $(this).height($containerHeight); 8488 } 8489 8490 // Use largest scale factor of horizontal/vertical 8491 var scale_h = $containerWidth / vid_w_orig, 8492 scale_v = ($containerHeight - $containerHeight) / vid_h_orig, 8493 scale = scale_h > scale_v ? scale_h : scale_v; 8494 8495 // Update minium width to never allow excess space 8496 min_w = 1280 / 720 * ($containerHeight + 40); 8497 8498 // Don't allow scaled width < minimum video width 8499 if (scale * vid_w_orig < min_w) { 8500 scale = min_w / vid_w_orig; 8501 } 8502 8503 // Now scale the video 8504 $(this).find('video, .mejs-overlay, .mejs-poster').width(Math.ceil(scale * vid_w_orig + 0)); 8505 $(this).find('video, .mejs-overlay, .mejs-poster').height(Math.ceil(scale * vid_h_orig + 0)); 8506 8507 // And center it by scrolling the video viewport 8508 $(this).scrollLeft(($(this).find('video').width() - $containerWidth) / 2); 8509 $(this).scrollTop(($(this).find('video').height() - ($containerHeight)) / 2); 8510 $(this).find('.mejs-overlay, .mejs-poster').scrollTop(($(this).find('video').height() - ($containerHeight)) / 2); 8511 8512 8513 // Align bottom 8514 if ($(this).attr('data-bg-alignment') == 'center bottom' || $(this).attr('data-bg-alignment') == 'bottom') { 8515 $(this).scrollTop(($(this).find('video').height() - ($containerHeight + 6))); 8516 } 8517 // Align top 8518 else if ($(this).attr('data-bg-alignment') == 'center top' || $(this).attr('data-bg-alignment') == 'top') { 8519 $(this).scrollTop(0); 8520 } 8521 8522 // Add loaded class 8523 $(this).addClass('position-loaded'); 8524 });
8525 8526 } 8527 8528 8529 8530 /** 8531 * Nectar video background initialization. 8532 * 8533 * @since 5.0 8534 */ 8535 function videoBGInit() { 8536 8537 if ($('.nectar-video-wrap').length == 0 && $('.nectar-youtube-bg').length == 0) { 8538 return; 8539 } 8540 8541 setTimeout(function () { 8542 8543 resizeVideoToCover(); 8544 8545 // Resize 8546 $window.on('resize',resizeVideoToCover); 8547 8548 $('.video-color-overlay').each(function () { 8549 $(this).css('background-color', $(this).attr('data-color')); 8550 }); 8551 8552 $('.nectar-video-wrap').each(function () { 8553 8554 if ($(this).find('video').length == 0) { 8555 return; 8556 } 8557 8558 var $headerVideo = ($(this).parents('#page-header-bg').length > 0) ? true : false; 8559 var $that = $(this); 8560 var videoReady = setInterval(function () { 8561 8562 if ($that.find('video').get(0).readyState > 3) { 8563 8564 if (!nectarDOMInfo.usingMobileBrowser) { 8565 $that.transition({ 8566 'opacity': '1' 8567 }, 400); 8568 $that.find('video').transition({ 8569 'opacity': '1' 8570 }, 400); 8571 $that.parent().find('.video-color-overlay').transition({ 8572 'opacity': '0.7' 8573 }, 400); 8574 if ($headerVideo == true) { 8575 pageHeaderTextEffect(); 8576 } 8577 } 8578 8579 // Remove page loading screen 8580 $loadingScreenEl.addClass('loaded'); 8581 setTimeout(function () { 8582 $loadingScreenEl.addClass('hidden'); 8583 }, 1000); 8584 8585 8586 clearInterval(videoReady); 8587 } 8588 8589 }, 60); 8590 8591 if (nectarDOMInfo.usingMobileBrowser) { 8592 if ($that.parents('.full-width-section').length > 0 && $that.parents('#nectar_fullscreen_rows').length == 0) { 8593 $that.css('left', '50%'); 8594 } else { 8595 $that.css('left', '0px'); 8596 } 8597 8598 if ($headerVideo == true) { 8599 pageHeaderTextEffect(); 8600 } 8601 $that.find('video')[0].onplay = function () { 8602 $that.transition({ 8603 'opacity': '1' 8604 }, 400); 8605 $that.find('video').transition({ 8606 'opacity': '1' 8607 }, 400); 8608 $that.parent().find('.video-color-overlay').transition({ 8609 'opacity': '0.7' 8610 }, 400); 8611 }; 8612 } 8613 8614 }); 8615 }, 300); 8616 8617 8618 if (nectarDOMInfo.usingMobileBrowser) { 8619 8620 $('.nectar-video-wrap').each(function () { 8621 8622 if (!$(this).find('video').is('[muted]')) { 8623 8624 // Autoplay not supported unless muted 8625 $(this).parent().find('.mobile-video-image').show(); 8626 $(this).remove(); 8627 } 8628 8629 }); 8630 8631 } 8632 8633 8634 $('.wpb_row:has(".nectar-video-wrap"):not(.fp-section)').each(function (i) { 8635 $(this).css('z-index', 100 + i); 8636 }); 8637 8638 8639 $(".vc_row").each(function () { 8640 var youtubeUrl, youtubeId, $row = jQuery(this); 8641 $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(); 8642 8643 // Remove yt url 8644 $row.find('.nectar-youtube-bg span').remove(); 8645 8646 if (!nectarDOMInfo.usingMobileBrowser) { 8647 $row.find('.nectar-video-wrap, .nectar-youtube-bg').css({ 8648 'opacity': '1', 8649 'width': '100%', 8650 'height': '100%' 8651 }); 8652 } 8653 $row.find('.video-color-overlay').transition({ 8654 'opacity': '0.7' 8655 }, 400); 8656 }); 8657 8658 8659 function nectarInsertYoutubeVideoAsBackground($element, youtubeId, counter) { 8660 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 () {
8661 nectarInsertYoutubeVideoAsBackground($element, youtubeId, counter++) 8662 }, 100); 8663 var $container = $element.prepend('<div class="vc_video-bg"><div class="inner"></div></div>').find(".inner"); 8664 new YT.Player($container[0], { 8665 width: "100%", 8666 height: "100%", 8667 videoId: youtubeId, 8668 playerVars: { 8669 playlist: youtubeId, 8670 iv_load_policy: 3, 8671 enablejsapi: 1, 8672 disablekb: 1, 8673 autoplay: 1, 8674 controls: 0, 8675 showinfo: 0, 8676 rel: 0, 8677 loop: 1 8678 }, 8679 events: { 8680 onReady: function (event) { 8681 event.target.mute().setLoop(!0); 8682 nectarResizeVideoBackground($element); 8683 } 8684 } 8685 }), nectarResizeVideoBackground($element), jQuery(window).on("resize", function () { 8686 nectarResizeVideoBackground($element); 8687 }); 8688 8689 setTimeout(function () { 8690 nectarResizeVideoBackground($element); 8691 }, 100); 8692 } 8693 8694 function nectarResizeVideoBackground($element) { 8695 var iframeW, iframeH, marginLeft, marginTop, containerW = $element.innerWidth(), 8696 containerH = $element.innerHeight(), 8697 ratio1 = 16, 8698 ratio2 = 9; 8699 ratio1 / ratio2 > containerW / containerH ? (iframeW = containerH * (ratio1 / ratio2), 8700 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", 8701 marginLeft = -Math.round((iframeW - containerW) / 2) + "px", iframeW += "px", iframeH += "px"), 8702 $element.find(".vc_video-bg iframe").css({ 8703 maxWidth: "1000%", 8704 marginLeft: marginLeft, 8705 marginTop: marginTop, 8706 width: iframeW, 8707 height: iframeH 8708 }); 8709 } 8710 8711 function nectarExtractYoutubeId(url) { 8712 8713 if ("undefined" == typeof url) { 8714 return !1; 8715 } 8716 8717 var id = url.match(/(?:https?:\/{2})?(?:w{3}\.)?youtu(?:be)?\.(?:com|be)(?:\/watch\?v=|\/)([^\s&]+)/); 8718 return null !== id ? id[1] : !1 8719 } 8720 8721 8722 } 8723 8724 8725 8726 8727 /** 8728 * Single Blog Posts 8729 * 8730 * @since 11.0 8731 */ 8732 function blogSingle() { 8733 8734 // Remove first gallery on post when using the gallery slider option. 8735 if( $body.hasClass('single-post') && $('.content-inner[data-has-gallery]').length > 0 ) { 8736 8737 8738 if($('.wp-block-gallery').length > 0) { 8739 // Gutenberg. 8740 $('.content-inner').find('.wp-block-gallery').each(function(i) { 8741 if(i !== 0) { 8742 $(this).css('display','flex'); 8743 } 8744 }); 8745 8746 } else { 8747 // Classic Editor. 8748 $('.content-inner').find('.gallery').each(function(i) { 8749 if(i !== 0) { 8750 $(this).css('display','block'); 8751 } 8752 }); 8753 8754 } 8755 8756 } // If using gallery slider on single conditional end. 8757 8758 } 8759 8760 8761 8762 8763 8764 /*-------------------------------------------------------------------------*/ 8765 /* Header + Search 8766 /*-------------------------------------------------------------------------*/ 8767 8768 /** 8769 * Correct megamenus in mobile navigation. 8770 * 8771 * @since 8.0 8772 */ 8773 function mobileNavMegamenuCorrect() { 8774 8775 ////mobile megamenus without titles / nested groupings 8776 var $mobileNavSelector = ( $('#top #mobile-menu').length > 0 ) ? '#top #mobile-menu ' : '.off-canvas-menu-container.mobile-only '; 8777 8778 $($mobileNavSelector + '.megamenu > ul > li > a').each(function () { 8779 if ($(this).text() == '-' || $(this).text() == '–' || $(this).parent().hasClass('hide-title')) { 8780 var $navLIs = $(this).parent().find('> ul > li').clone(); 8781 $(this).parent().find('ul').remove(); 8782 $(this).parent().parent().append($navLIs); 8783 $(this).parent().remove(); 8784 } 8785 }); 8786 8787 } 8788 8789 8790 8791 8792 8793 8794 8795 8796 /** 8797 * Material theme skin off canvas menu initialization. 8798 * 8799 * @since 10.5 8800 */ 8801 function materialSkinOCM_Init() { 8802
8803 if ($('body.material[data-slide-out-widget-area-style="slide-out-from-right"]').length > 0) { 8804 OCM_materialWidth(); 8805 8806 if( $wpAdminBar.length > 0 ) { 8807 var $topToolBar = $wpAdminBar.detach(); 8808 $('.ocm-effect-wrap-inner').append($topToolBar); 8809 } 8810 8811 } 8812 8813 OCM_materialIconMarkup(); 8814 materialSkinTransition(); 8815 8816 $window.on('resize', OCM_materialSize); 8817 8818 } 8819 8820 8821 8822 8823 /** 8824 * Material theme skin transition helper 8825 * 8826 * @since 10.5 8827 */ 8828 function materialSkinTransition() { 8829 8830 if ($('body.material[data-header-search="true"]').length > 0 || 8831 $('body.material .ocm-effect-wrap').length > 0) { 8832 8833 var materialTransTO, 8834 allowMaterialResizeCalc = false, 8835 orientTrack = 0, 8836 $winDOMWidth = nectarDOMInfo.winW, 8837 $winDOMHeight = nectarDOMInfo.winH; 8838 8839 // For mobile make sure the orientation has changed. 8840 window.addEventListener("orientationchange", function () { 8841 orientTrack = 1; 8842 }); 8843 8844 // Resize. 8845 $window.on('resize', function () { 8846 8847 if( nectarDOMInfo.usingMobileBrowser ) { 8848 // Mobile. 8849 if (($window.width() != $winDOMWidth && $window.height != $winDOMHeight) || orientTrack === 1) { 8850 8851 // Store the current window dimensions. 8852 $winDOMWidth = nectarDOMInfo.winW; 8853 $winDOMHeight = nectarDOMInfo.winH; 8854 8855 // Reset orientation change tracker. 8856 orientTrack = 0; 8857 8858 // Set to allow. 8859 allowMaterialResizeCalc = true; 8860 8861 } 8862 } else { 8863 // Desktop always allows. 8864 allowMaterialResizeCalc = true; 8865 } 8866 8867 if(allowMaterialResizeCalc) { 8868 8869 clearTimeout(materialTransTO); 8870 8871 $('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') 8872 .addClass('no-material-transition'); 8873 8874 materialTransTO = setTimeout(function () { 8875 $('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') 8876 .removeClass('no-material-transition'); 8877 }, 250); 8878 8879 OCM_materialWidth(); 8880 8881 // Reset allow. 8882 allowMaterialResizeCalc = false; 8883 8884 } // endif for allow. 8885 8886 }); // end resize. 8887 8888 } 8889 8890 } 8891 8892 8893 8894 /** 8895 * Calculate off canvas menu slide out from right on hover 8896 * 8897 * @since 8.0 8898 */ 8899 function calculateHoverNavMinHeight() { 8900 8901 var $widgetHeights = 0; 8902 $('#slide-out-widget-area > .widget').each(function () { 8903 $widgetHeights += $(this).height(); 8904 }); 8905 8906 var $menuHeight; 8907 8908 if(($offCanvasEl.height() - 25 - $('.bottom-meta-wrap').outerHeight(true) - $widgetHeights) > $('#slide-out-widget-area .off-canvas-menu-container:last-child').height()) { 8909 $menuHeight = $offCanvasEl.height() - 25 - $('.bottom-meta-wrap').outerHeight(true) - $widgetHeights; 8910 } else { 8911 $menuHeight = $('#slide-out-widget-area .off-canvas-menu-container:last-child').height(); 8912 } 8913 8914 $('#slide-out-widget-area .inner').css({ 8915 'height': 'auto', 8916 'min-height': $menuHeight 8917 }); 8918 8919 $('#slide-out-widget-area > .inner .off-canvas-menu-container').transition({ 8920 y: '-' + ($('#slide-out-widget-area > .inner .off-canvas-menu-container:last-child').height() / 2) + 'px' 8921 }, 0); 8922 8923 } 8924 8925 8926 /** 8927 * Material theme skin off canvas menu width. 8928 * 8929 * @since 8.0 8930 */ 8931 function OCM_materialWidth() { 8932 8933 $('#slide-out-widget-area.slide-out-from-right').css({ 8934 'padding-top': $window.height() * 0.1, 8935 'padding-bottom': $window.height() * 0.1 8936 }); 8937 8938 OCM_overflowState(); 8939 } 8940 8941 8942 8943 /** 8944 * Material theme skin off canvas menu icon markup 8945 * 8946 * @since 8.0 8947 */ 8948 function OCM_materialIconMarkup() { 8949 8950 if ($('body.material').length >
8950 0 && $('body[data-slide-out-widget-area-style="slide-out-from-right-hover"]').length == 0 ) { 8951 8952 if ($('body[data-slide-out-widget-area-style*="fullscreen"]').length == 0 && $('#mobile-menu').length == 0) { 8953 var $menuIconClone = $('header#top nav ul .slide-out-widget-area-toggle a > span > i').clone(); 8954 $menuIconClone.addClass('hover-effect'); 8955 $('header#top nav ul .slide-out-widget-area-toggle a > span').append($menuIconClone); 8956 8957 var $menuIconClone2 = $('header#top .slide-out-widget-area-toggle.mobile-icon a > span > i').clone(); 8958 $menuIconClone2.addClass('hover-effect'); 8959 $('header#top .slide-out-widget-area-toggle.mobile-icon a > span').append($menuIconClone2); 8960 } 8961 8962 $('body:not([data-slide-out-widget-area-style="slide-out-from-right"]) header#top .slide-out-widget-area-toggle a > span') 8963 .append($('<span class="close-wrap"> <span class="close-line close-line1"></span> <span class="close-line close-line2"></span> </span>')); 8964 8965 setTimeout(function(){ 8966 $('header#top .slide-out-widget-area-toggle a > span .close-wrap').addClass('loaded'); 8967 },200); 8968 8969 } 8970 8971 if ($('body.material #boxed').length > 0 && $('body[data-slide-out-widget-area-style="slide-out-from-right-hover"]').length > 0) { 8972 $('#ajax-content-wrap > .slide-out-widget-area-toggle.slide-out-hover-icon-effect').insertAfter('.ocm-effect-wrap'); 8973 } 8974 8975 //move material skin default ocm 8976 if ($('body.material').length > 0 && $('body[data-slide-out-widget-area-style*="fullscreen"]').length == 0) { 8977 $('body.material #slide-out-widget-area.slide-out-from-right .slide_out_area_close').insertAfter('.ocm-effect-wrap'); 8978 $('#slide-out-widget-area-bg').insertAfter('.ocm-effect-wrap'); 8979 $offCanvasEl.insertAfter('.ocm-effect-wrap'); 8980 } 8981 8982 } 8983 8984 8985 8986 /** 8987 * Material theme skin off canvas menu height 8988 * 8989 * @since 8.0 8990 */ 8991 function OCM_materialSize() { 8992 if ($('.ocm-effect-wrap.material-ocm-open').length > 0) { 8993 8994 $('.ocm-effect-wrap').css({ 8995 'height': $window.height() 8996 }); 8997 8998 $('.ocm-effect-wrap-inner').css({ 8999 'padding-top': nectarDOMInfo.adminBarHeight 9000 }); 9001 9002 } 9003 } 9004 9005 9006 9007 /** 9008 * Off canvas menu dropdown markup 9009 * 9010 * @since 8.0 9011 */ 9012 function OCM_dropdownMarkup() { 9013 var $nectar_ocm_dropdown_func = ($('#slide-out-widget-area[data-dropdown-func]').length > 0) ? $offCanvasEl.attr('data-dropdown-func') : 'default'; 9014 if ($nectar_ocm_dropdown_func == 'separate-dropdown-parent-link') { 9015 $('#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>'); 9016 } 9017 } 9018 9019 9020 9021 /** 9022 * Off canvas menu dropdown icon position. 9023 * 9024 * @since 8.0 9025 */ 9026 function OCM_dropdownIconPos() { 9027 9028 $('#slide-out-widget-area[class*="slide-out-from-right"] .off-canvas-menu-container li.menu-item-has-children').each(function () { 9029 $(this).find('.ocm-dropdown-arrow').css({ 9030 'top': $(this).find('a').height() / 2 9031 }); 9032 }); 9033 $('#slide-out-widget-area.fullscreen-split .off-canvas-menu-container li.menu-item-has-children').each(function () { 9034 $(this).find('.ocm-dropdown-arrow').css({ 9035 'top': $(this).find('a').height() / 2 9036 }); 9037 }); 9038 9039 } 9040 9041 9042 9043 9044 /** 9045 * Off canvas menu overflow scrolling. 9046 * 9047 * @since 8.0 9048 */ 9049 function OCM_overflowState() { 9050 9051 //switch position of social media/extra info based on screen size 9052 if (nectarDOMInfo.winW < 1000 || 9053 $('body > #boxed').length > 0 || 9054 $('.ocm-effect-wrap-inner > #boxed').length > 0) { 9055 9056 $('#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'); 9057 $('#slide-out-widget-area.fullscreen .bottom-text, #slide-out-widget-area.fullscreen-alt .bottom-text').appendTo('#slide-out-widget-area .inner'); 9058 9059 } else { 9060 $('#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'); 9061 $('#slide-out-widget-area.fullscreen .bottom-text, #slide-out-widget-area.fullscreen-alt .bottom-text').appendTo('#slide-out-widget-area .inner-wrap'); 9062 } 9063 9064 //add overflow 9065 if( !$offCanvasEl.hasClass('fullscreen-split') ) { 9066 9067 if ($('#slide-out-widget-area[class*="fullscreen"] .inner').height() >= $window.height() - 100) { 9068 $('#slide-out-widget-area[class*="fullscreen"] .inner, #slide-out-widget-area[class*="fullscreen"]').addClass('overflow-state'); 9069 } else { 9070 $('#slide-out-widget-area[class*="fullscreen"] .inner, #slide-out-widget-area[class*="fullscreen"]').removeClass('overflow-state'); 9071 } 9072 9073 $('#slide-out-widget-area[class*="fullscreen"] .inner').transition({ 9074 y: '-' + ($('#slide-out-widget-area[class*="fullscreen"] .inner').height() / 2) + 'px' 9075 }, 0); 9076 9077 } 9078 9079 //close mobile only slide out widget area if switching back to desktop 9080 if ($('.slide-out-from-right.open .off-canvas-menu-container.mobile-only').length > 0 && $('body.mobile').length == 0) { 9081 $('#slide-out-widget-area .slide_out_area_close').trigger('click'); 9082 } 9083 9084 //sizing for dropdown 9085 OCM_dropdownIconPos(); 9086 9087 } 9088 9089 9090 9091 /** 9092 * Off canvas menu: slide out from right hover open. 9093 * 9094 * @since 10.5 9095 */ 9096 function OCM_slideOutRightHoverOpen() { 9097 9098 calculateHoverNavMinHeight(); 9099 9100 if ( nectarDOMInfo.usingMobileBrowser && $('#slide-out-widget-area.open').length > 0 ) { 9101 OCM_mobileSlideOutRightHoverCloseCheck(); 9102 return; 9103 } 9104 9105 if( nectarDOMInfo.usingMobileBrowser ) { 9106 $('.slide-out-widget-area-toggle a').attr('aria-expanded','true'); 9107 } 9108 9109 $offCanvasEl.css({
9110 'transform': 'translate3d(0,0,0)' 9111 }).addClass('open'); 9112 9113 // Icon effect 9114 // Set position 9115 if ($('header#top .container .span_9 > .slide-out-widget-area-toggle').length > 0) { 9116 9117 var $hIconEl = $('.slide-out-hover-icon-effect'), 9118 secondaryBarHeight = nectarDOMInfo.secondaryHeaderHeight; 9119 9120 var $nectarHamMenuPos; 9121 9122 if ($('body.mobile').length > 0) { 9123 9124 $hIconEl.css({ 9125 'top': $('header#top .span_9 > .slide-out-widget-area-toggle a').offset().top - nectarDOMInfo.scrollTop, 9126 'right': parseInt($('#header-outer header > .container').css('padding-right')) + 1 9127 }); 9128 9129 } else { 9130 9131 if ($bodyBorderHeaderColorMatch) { 9132 9133 var $extraCushion = ($('#header-outer[data-has-menu="false"]').length > 0) ? 2 : 1; 9134 $hIconEl.css({ 9135 'top': nectarDOMInfo.adminBarHeight + secondaryBarHeight + parseInt($('header#top nav >ul .slide-out-widget-area-toggle a').css('padding-top')), 9136 'right': 29 + $extraCushion 9137 });
9138 9139 } else { 9140 9141 if ($('#header-outer[data-format="centered-menu-bottom-bar"]').length > 0) { 9142 $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(); 9143 9144 $hIconEl.css({ 9145 'top': parseInt($nectarHamMenuPos.top) - nectarDOMInfo.scrollTop, 9146 'right': parseInt($('#header-outer header >.container').css('padding-right')) + 2 9147 }); 9148 } else { 9149 9150 if( $body.hasClass('ascend') ) { 9151 $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(); 9152 } else { 9153 $nectarHamMenuPos = ($('header#top .span_9 > .slide-out-widget-area-toggle').css('display') == 'block') ? $('header#top .span_9 > .slide-out-widget-area-toggle.mobile-icon').position() : $('header#top nav .buttons .slide-out-widget-area-toggle > div').position(); 9154 } 9155 9156 9157 if ($('#header-secondary-outer.hide-up').length > 0) { 9158 secondaryBarHeight = 0; 9159 } 9160 9161 $hIconEl.css({ 9162 'top': nectarDOMInfo.adminBarHeight + secondaryBarHeight + parseInt($nectarHamMenuPos.top), 9163 'right': parseInt($('#header-outer header >.container').css('padding-right')) + 2 9164 }); 9165 } 9166 9167 } // No body border color match. 9168 9169 } //Not on mobile. 9170 9171 } 9172 9173 ////Open 9174 $('.slide-out-hover-icon-effect .lines-button') 9175 .removeClass('no-delay') 9176 .addClass('unhidden-line'); 9177 9178 if ($('#header-outer[data-permanent-transparent="1"]').length == 0 && 9179 $('#nectar_fullscreen_rows').length == 0 && 9180 !nectarDOMInfo.usingFrontEndEditor && 9181 nectarDOMInfo.winW > 1000) { 9182 9183 if (!(nectarDOMInfo.scrollTop == 0 && $('#header-outer.transparent').length > 0)) { 9184 9185 if ($('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) { 9186 9187 $headerOuterEl.attr('data-transparent', 'true').addClass('no-bg-color').addClass('slide-out-hover'); 9188 $('#header-outer header, #header-outer > .cart-outer').addClass('all-hidden'); 9189 } 9190 9191 } 9192 9193 if ($('#header-outer[data-remove-fixed="1"]').length == 0 && $('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) { 9194 9195 if (headerResize == true) { 9196 9197 $window.off('scroll', bigNav); 9198 $window.off('scroll', smallNav); 9199 9200 } else { 9201 $window.off('scroll', opaqueCheck); 9202 $window.off('scroll', transparentCheck); 9203 } 9204 } 9205 9206 } 9207 9208 if (!nectarDOMInfo.usingMobileBrowser) { 9209 $window.on('mousemove.rightOffsetCheck', OCM_slideOutRightHoverCloseCheck); 9210 } 9211 9212 } 9213 9214 9215 /** 9216 * Off canvas menu: slide out from right hover close 9217 * 9218 * @since 10.5 9219 */ 9220 function OCM_slideOutRightHoverCloseCheck(e) { 9221 9222 var $windowWidth = $window.width(); 9223 var $ocmHoverWidth = $offCanvasEl.outerWidth(); 9224 9225 if (e.clientX < $windowWidth - parseInt($ocmHoverWidth) - $bodyBorderWidth && $offCanvasEl.hasClass('mouse-accessed')) { 9226 9227 $offCanvasEl.removeClass('mouse-accessed'); 9228 $window.off('mousemove.rightOffsetCheck', OCM_slideOutRightHoverCloseCheck); 9229 9230 $offCanvasEl.css({ 9231 'transform': 'translate3d(101%,0,0)' 9232 }).removeClass('open'); 9233 9234 $headerOuterEl.removeClass('style-slide-out-from-right'); 9235 9236 $('.slide-out-hover-icon-effect .lines-button') 9237 .removeClass('unhidden-line') 9238 .addClass('no-delay'); 9239 9240 if ($('#header-outer[data-permanent-transparent="1"]').length == 0) { 9241 9242 if ($('#header-outer[data-remove-fixed="1"]').length == 0 && $('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) { 9243 9244 if ($('body.mobile').length == 0) { 9245 $headerOuterEl.removeClass('no-bg-color'); 9246 $('#header-outer header, #header-outer > .cart-outer').removeClass('all-hidden'); 9247 } 9248 } 9249 9250 if ($('#header-outer[data-remove-fixed="1"]').length == 0 && $('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) { 9251 9252 if (headerResize == true) { 9253 9254 $window.off('scroll.headerResizeEffect'); 9255 9256 if (nectarDOMInfo.scrollTop == 0) { 9257 9258 $window.on('scroll.headerResizeEffect', smallNav); 9259 9260 if ($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 && 9261 $bodyBorderTop.length > 0 && 9262 $bodyBorderHeaderColorMatch == true && 9263 $('#header-outer.pseudo-data-transparent').length > 0) { 9264 9265 $('#header-outer[data-full-width="true"] header > .container').stop(true, true).animate({ 9266 'padding': '0' 9267 }, { 9268 queue: false, 9269 duration: 250, 9270 easing: 'easeOutCubic' 9271 });
9272 9273 } 9274 } else { 9275 $window.on('scroll.headerResizeEffect', bigNav); 9276 } 9277 9278 } else { 9279 9280 $window.off('scroll.headerResizeEffectOpaque'); 9281 $window.on('scroll.headerResizeEffectOpaque', opaqueCheck); 9282 } 9283 } 9284 } 9285 } 9286 9287 } 9288 9289 9290 /** 9291 * Off canvas menu: mobile slide out from right hover close. 9292 * 9293 * @since 10.5 9294 */ 9295 function OCM_mobileSlideOutRightHoverCloseCheck() { 9296 9297 if(nectarDOMInfo.usingMobileBrowser) { 9298 $('.slide-out-widget-area-toggle a').attr('aria-expanded','false'); 9299 } 9300 9301 $offCanvasEl.css({ 9302 'transform': 'translate3d(101%,0,0)' 9303 }).removeClass('open'); 9304 9305 $headerOuterEl.removeClass('style-slide-out-from-right'); 9306 9307 $('.slide-out-hover-icon-effect .lines-button') 9308 .removeClass('unhidden-line') 9309 .addClass('no-delay'); 9310 9311 if ($('#header-outer[data-permanent-transparent="1"]').length == 0) { 9312 9313 $headerOuterEl.removeClass('no-bg-color'); 9314 $('#header-outer header').removeClass('all-hidden'); 9315 9316 } 9317 9318 9319 if ($('#header-outer[data-remove-fixed="1"]').length == 0 && $('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) { 9320 9321 if (headerResize == true) { 9322 9323 $window.off('scroll.headerResizeEffect'); 9324 9325 if (nectarDOMInfo.scrollTop == 0) { 9326 9327 $window.on('scroll.headerResizeEffect', smallNav); 9328 9329 if ($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 && 9330 $bodyBorderTop.length > 0 && 9331 $bodyBorderHeaderColorMatch == true && 9332 $('#header-outer.pseudo-data-transparent').length > 0) { 9333 9334 $('#header-outer[data-full-width="true"] header > .container').stop(true, true).animate({ 9335 'padding': '0' 9336 }, { 9337 queue: false, 9338 duration: 250, 9339 easing: 'easeOutCubic' 9340 }); 9341 9342 } 9343 } 9344 9345 else { 9346 $window.on('scroll.headerResizeEffect', bigNav); 9347 } 9348 9349 } else { 9350 9351 $window.off('scroll.headerResizeEffectOpaque'); 9352 $window.on('scroll.headerResizeEffectOpaque', opaqueCheck); 9353 9354 } 9355 9356 } 9357 9358 } 9359 9360 9361 9362 /** 9363 * Off canvas menu: slide out from right hover initialization. 9364 * 9365 * @since 10.5 9366 */ 9367 function OCM_slideOutRightHoverInit() { 9368 9369 if ($('#ajax-content-wrap > .slide-out-widget-area-toggle').length == 0) { 9370 9371 //icon effect html creation 9372 var $iconInsertLocation = ( $('.slide-out-widget-area-toggle[data-custom-color="true"]').length > 0 ) ? '#slide-out-widget-area > div' : '#slide-out-widget-area'; 9373 9374 $('<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); 9375 9376 if ($('#header-outer[data-has-menu="true"]').length > 0 || 9377 $('body[data-header-search="true"]').length > 0 || 9378 $('.slide-out-widget-area-toggle a.using-label').length > 0 || 9379 $('.slide-out-widget-area-toggle[data-custom-color="true"]').length > 0 ) { 9380 $('.slide-out-widget-area-toggle').addClass('small'); 9381 } 9382 } 9383 9384 9385 //hover triggered 9386 if (!nectarDOMInfo.usingMobileBrowser) { 9387 $body.on('mouseenter', '#header-outer .slide-out-widget-area-toggle:not(.std-menu) a', OCM_slideOutRightHoverOpen); 9388 $offCanvasEl.on('mouseenter', function () { 9389 $(this).addClass('mouse-accessed'); 9390 }); 9391 9392 } else { 9393 $body.on('click', '.slide-out-widget-area-toggle:not(.std-menu) a', OCM_slideOutRightHoverOpen); 9394 } 9395 9396 $window.on('smartresize', calculateHoverNavMinHeight); 9397 9398 9399 } 9400 9401 9402 /** 9403 * Off canvas menu: slide out from right open. 9404 * 9405 * @since 10.5 9406 */ 9407 function OCM_slideOutRightOpen() { 9408 9409 var $slideOutAmount = ($bodyBorderTop.length > 0 && $('body.mobile').length == 0) ? $bodyBorderTop.height() : 0; 9410 9411 if ($('body.material').length == 0) { 9412
9413 // Calc height if used bottom meta. 9414 $('#slide-out-widget-area .inner').css({ 9415 'height': 'auto', 9416 'min-height': $offCanvasEl.height() - 25 - $('.bottom-meta-wrap').height() 9417 }); 9418 9419 // First item dropdown? 9420 if($('#slide-out-widget-area[data-dropdown-func="separate-dropdown-parent-link"] .inner > div:first-of-type > .menu > li:first-child').length > 0 && 9421 $('#slide-out-widget-area .inner > div:first-of-type > .menu > li:first-child').hasClass('menu-item-has-children')) { 9422 $('#slide-out-widget-area .inner > div:first-of-type').css({'margin-top':'50px'}); 9423 } 9424 9425 if ($('#boxed').length == 0) { 9426 9427 $('.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({ 9428 x: '-300px' 9429 }, 700, 'easeInOutCubic'); 9430 9431 var $withinCustomBreakpoint = mobileBreakPointCheck(); 9432 9433 if ($('#header-outer[data-format="centered-logo-between-menu"]').length == 0 || $withinCustomBreakpoint) { 9434 9435 if ($('#header-outer[data-transparency-option="1"]').length == 0 || 9436 ($('#header-outer[data-transparency-option="1"]').length > 0 && $('#header-outer[data-full-width="true"]').length == 0) || 9437 $('body.mobile').length > 0) { 9438 9439 $headerOuterEl.stop(true).css('transform', 'translateY(0)').transition({ 9440 x: '-' + (300 + $slideOutAmount) + 'px' 9441 }, 700, 'easeInOutCubic'); 9442 9443 } else { 9444 9445 $headerOuterEl.stop(true).css('transform', 'translateY(0)').transition({ 9446 x: '-' + (300 + $slideOutAmount) + 'px', 9447 'background-color': 'transparent', 9448 'border-bottom': '1px solid rgba(255,255,255,0.22)' 9449 }, 700, 'easeInOutCubic'); 9450 9451 } 9452 } else { 9453 $('#header-outer header#top nav > ul.buttons, body:not(.material) #header-outer .cart-outer .cart-menu-wrap').transition({ 9454 x: '-300px' 9455 }, 700, 'easeInOutCubic'); 9456 } 9457 9458 } 9459 9460 $offCanvasEl.stop(true).transition({ 9461 x: '-' + $slideOutAmount + 'px' 9462 }, 700, 'easeInOutCubic').addClass('open'); 9463 9464 9465 if ($('#boxed').length == 0) { 9466 9467 // Full width menu adjustments 9468 if ($('#header-outer[data-full-width="true"]').length > 0 && !$body.hasClass('mobile')) { 9469 $headerOuterEl.addClass('highzI'); 9470 $('#ascrail2000').addClass('z-index-adj'); 9471 9472 if ($('#header-outer[data-format="centered-logo-between-menu"]').length == 0) { 9473 9474 if ($bodyBorderWidth == 0) { 9475 $('header#top #logo').stop(true).transition({ 9476 x: (300 + $slideOutAmount) + 'px' 9477 }, 700, 'easeInOutCubic'); 9478 } 9479 9480 } 9481 9482 $('header#top .slide-out-widget-area-toggle .lines-button').addClass('close'); 9483 9484 $('body #header-outer nav > ul > li > a').css({ 9485 'margin-bottom': '0' 9486 }); 9487 9488 } 9489 9490 } 9491 9492 $headerOuterEl.addClass('style-slide-out-from-right'); 9493 9494 // Fade In BG Overlay 9495 $offCanvasBG.css({ 9496 'height': '100%', 9497 'width': '100%' 9498 }).stop(true).transition({ 9499 'opacity': 1 9500 }, 700, 'easeInOutCubic', function () { 9501 $('.slide-out-widget-area-toggle:not(.std-menu) > div > a').removeClass('animating'); 9502 }); 9503 9504 // Hide menu if no space 9505 if ($('#header-outer[data-format="centered-logo-between-menu"]').length == 0) { 9506 9507 var $logoWidth = ($('#logo img:visible').length > 0) ? $('#logo img:visible').width() : $('#logo').width(); 9508 9509 if ($('header#top nav > .sf-menu').offset().left - $logoWidth - 300 < 20) { 9510 $headerOuterEl.addClass('hidden-menu'); 9511 } 9512 9513 } else { 9514 $headerOuterEl.addClass('hidden-menu-items'); 9515 } 9516 9517 9518 if ($('#header-outer[data-remove-fixed="1"]').length == 0 && nectarDOMInfo.winW > 1000) { 9519 9520 if ($bodyBorderHeaderColorMatch == true && headerResize == true) { 9521 9522 $headerOuterEl.stop(true).transition({ 9523 y: '0' 9524 }, 0).addClass('transparent').css('transition', 'transform'); 9525 if ($headerOuterEl.attr('data-transparent-header') != 'true') { 9526 $headerOuterEl.attr('data-transparent-header', 'true').addClass('pseudo-data-transparent'); 9527 } 9528 9529 $window.off('scroll', bigNav); 9530 $window.off('scroll', smallNav); 9531 9532 } else if ($bodyBorderHeaderColorMatch == true) { 9533 9534 $headerOuterEl.addClass('transparent'); 9535 $window.off('scroll', opaqueCheck); 9536 $window.off('scroll', transparentCheck); 9537 9538 if ($headerOuterEl.attr('data-transparent-header') != 'true') { 9539 $headerOuterEl.attr('data-transparent-header', 'true').addClass('pseudo-data-transparent'); 9540 } 9541 } 9542 } 9543 9544 } else if ($('body.material').length > 0) { 9545 9546 // Material theme skin slide out from right 9547 9548 //move ajax loading outside 9549 if ($loadingScreenEl.length > 0 && $('.ocm-effect-wrap #ajax-loading-screen').length > 0) { 9550 $loadingScreenEl.insertBefore('.ocm-effect-wrap'); 9551 } 9552 9553 // Hide secondary header when not at top with hhun 9554 if (nectarDOMInfo.scrollTop > 40) { 9555 9556 $('body[data-hhun="1"] #header-secondary-outer').addClass('hidden'); 9557 } 9558 9559 9560 setTimeout(function () { 9561 $('.slide-out-widget-area-toggle:not(.std-menu) > div > a').removeClass('animating'); 9562 }, 300); 9563 $('#slide-out-widget-area, #slide-out-widget-area-bg, #header-outer .slide-out-widget-area-toggle').addClass('material-open'); 9564 9565 9566 // Handle bottom bar nav 9567 if ($('body:not(.mobile) #header-outer[data-format="centered-menu-bottom-bar"][data-condense="true"]').length > 0 && 9568 $('#header-outer[data-format="centered-menu-bottom-bar"] .span_9').css('display') != 'none') { 9569 9570 $('#header-outer:not(.fixed-menu)').css('top', nectarDOMInfo.adminBarHeight - nectarDOMInfo.scrollTop + 'px'); 9571 9572 if ($headerSecondaryEl.length > 0 && $('#header-outer.fixed-menu').length > 0) { 9573 $headerSecondaryEl.css('visibility', 'hidden'); 9574 } 9575 9576 } 9577 9578 $('#ajax-content-wrap').css({ 9579 'position': 'relative', 9580 'top': '-' + nectarDOMInfo.scrollTop + 'px' 9581 });
9582 9583 $('.ocm-effect-wrap-inner').css({ 9584 'padding-top': nectarDOMInfo.adminBarHeight 9585 }); 9586 9587 $('#fp-nav').addClass('material-ocm-open'); 9588 9589 $body.addClass('material-ocm-open'); 9590 $body.addClass('nectar-no-flex-height'); 9591 9592 $('.ocm-effect-wrap').css({ 9593 'height': nectarDOMInfo.winH 9594 }); 9595 9596 setTimeout(function () { 9597 $('.ocm-effect-wrap').addClass('material-ocm-open'); 9598 }, 40); 9599 9600 9601 $('body > .slide_out_area_close').addClass('follow-body'); 9602 9603 //icon effect 9604 $('#header-outer:not([data-format="left-header"]) header#top .slide-out-widget-area-toggle a').addClass('effect-shown'); 9605 9606 //handle hhun when at top 9607 $('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({ 9608 'transition': 'none', 9609 'transform': 'translateY(' + nectarDOMInfo.adminBarHeight + 'px)' 9610 }); 9611 9612 setTimeout(function () { 9613 $('body > .slide_out_area_close').addClass('material-ocm-open'); 9614 }, 350); 9615 9616 9617 } 9618 9619 } 9620 9621 9622 /** 9623 * Off canvas menu: slide out from right close. 9624 * 9625 * @since 10.5 9626 */ 9627 function OCM_slideOutRightClose() { 9628 9629 if ($('body.material').length == 0) { 9630 9631 $('.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({ 9632 x: '0px' 9633 }, 700, 'easeInOutCubic'); 9634 9635 if ($('#header-outer[data-transparency-option="1"]').length > 0 && $('#boxed').length == 0) { 9636 var $currentRowBG = ($('#header-outer[data-current-row-bg-color]').length > 0) ? $headerOuterEl.attr('data-current-row-bg-color') : $headerOuterEl.attr('data-user-set-bg'); 9637 $headerOuterEl.stop(true).transition({ 9638 x: '0px', 9639 'background-color': $currentRowBG 9640 }, 700, 'easeInOutCubic'); 9641 } else { 9642 $headerOuterEl.stop(true).transition({ 9643 x: '0px' 9644 }, 700, 'easeInOutCubic'); 9645 } 9646 9647 $offCanvasEl.stop(true).transition({ 9648 x: '301px' 9649 }, 700, 'easeInOutCubic').removeClass('open'); 9650 9651 9652 if ($('#boxed').length == 0) { 9653 if ($('#header-outer[data-full-width="true"]').length > 0) { 9654 $headerOuterEl.removeClass('highzI'); 9655 $('header#top #logo').stop(true).transition({ 9656 x: '0px' 9657 }, 700, 'easeInOutCubic'); 9658 $('.lines-button').removeClass('close'); 9659 9660 } 9661 } 9662 9663 if ($('#header-outer[data-format="centered-logo-between-menu"]').length > 0) { 9664 $('#header-outer header#top nav > ul.buttons, #header-outer .cart-outer .cart-menu-wrap').stop(true).transition({ 9665 x: '0px' 9666 }, 700, 'easeInOutCubic'); 9667 } 9668 9669 //fade out overlay 9670 $offCanvasBG.stop(true).transition({ 9671 'opacity': 0 9672 }, 700, 'easeInOutCubic', function () { 9673 9674 $('.slide-out-widget-area-toggle a').removeClass('animating'); 9675 9676 $(this).css({ 9677 'height': '1px', 9678 'width': '1px' 9679 }); 9680 9681 if ($('#header-outer[data-remove-fixed="1"]').length == 0) { 9682 9683 //hide menu if transparent, user has scrolled down and hhun is on 9684 if ($headerOuterEl.hasClass('parallax-contained') && 9685 nectarDOMInfo.scrollTop > 0 && 9686 $('#header-outer[data-permanent-transparent="1"]').length == 0) { 9687 $headerOuterEl.removeClass('parallax-contained').addClass('detached').removeClass('transparent'); 9688 } 9689 else if (nectarDOMInfo.scrollTop == 0 && $('body[data-hhun="1"]').length > 0 && $('#page-header-bg[data-parallax="1"]').length > 0 || 9690 nectarDOMInfo.scrollTop == 0 && $('body[data-hhun="1"]').length > 0 && $('.parallax_slider_outer').length > 0) { 9691 9692 if ($('#header-outer[data-transparency-option="1"]').length > 0) { 9693 $headerOuterEl.addClass('transparent'); 9694 } 9695 9696 $headerOuterEl 9697 .addClass('parallax-contained') 9698 .removeClass('detached'); 9699 9700 } 9701 9702 } 9703 9704 //fix for fixed subpage menu 9705 $('.container-wrap').css('transform', 'none'); 9706 9707 });
9708 9709 9710 $headerOuterEl.removeClass('style-slide-out-from-right'); 9711 9712 9713 if ($('#header-outer[data-remove-fixed="1"]').length == 0) { 9714 9715 if ($bodyBorderHeaderColorMatch == true && 9716 headerResize == true && 9717 nectarDOMInfo.winW > 1000) { 9718 9719 $window.off('scroll.headerResizeEffect'); 9720 if (nectarDOMInfo.scrollTop == 0) { 9721 9722 $window.on('scroll.headerResizeEffect', smallNav); 9723 9724 if ($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 && 9725 $bodyBorderTop.length > 0 && 9726 $bodyBorderHeaderColorMatch == true && 9727 $('#header-outer.pseudo-data-transparent').length > 0) { 9728 9729 $('#header-outer[data-full-width="true"] header > .container').stop(true, true).animate({ 9730 'padding': '0' 9731 }, { 9732 queue: false, 9733 duration: 250, 9734 easing: 'easeOutCubic' 9735 }); 9736 9737 } 9738 } else { 9739 $window.on('scroll.headerResizeEffect', bigNav); 9740 } 9741 9742 if ($headerOuterEl.hasClass('pseudo-data-transparent')) { 9743 9744 $headerOuterEl.attr('data-transparent-header', 'false') 9745 .removeClass('pseudo-data-transparent') 9746 .removeClass('transparent'); 9747 } 9748 9749 $headerOuterEl.css('transition', 'transform'); 9750 9751 } else if ($bodyBorderHeaderColorMatch == true && nectarDOMInfo.winW > 1000) { 9752 9753 $window.off('scroll.headerResizeEffectOpaque'); 9754 $window.on('scroll.headerResizeEffectOpaque', opaqueCheck); 9755 9756 $headerOuterEl.css('transition', 'transform'); 9757 9758 if ($headerOuterEl.hasClass('pseudo-data-transparent')) { 9759 $headerOuterEl.attr('data-transparent-header', 'false') 9760 .removeClass('pseudo-data-transparent') 9761 .removeClass('transparent'); 9762 } 9763 } 9764 } 9765 } 9766 9767 else if ($('body.material').length > 0) { 9768 9769 //material 9770 $offCanvasEl.removeClass('open'); 9771 9772 $('#slide-out-widget-area, #slide-out-widget-area-bg, #header-outer .slide-out-widget-area-toggle').removeClass('material-open'); 9773 $('.ocm-effect-wrap, .ocm-effect-wrap-shadow, body > .slide_out_area_close, #fp-nav').removeClass('material-ocm-open'); 9774 9775 $('body > .slide_out_area_close').removeClass('follow-body'); 9776 9777 setTimeout(function () { 9778 $('.slide-out-widget-area-toggle a').removeClass('animating'); 9779 9780 $body.removeClass('material-ocm-open'); 9781 $body.removeClass('nectar-no-flex-height'); 9782 9783 $('.ocm-effect-wrap').css({ 9784 'height': '100%' 9785 }); 9786 9787 $('.ocm-effect-wrap-inner').css({ 9788 'padding-top': '0' 9789 }); 9790 9791 $window.scrollTop(Math.abs(parseInt($('#ajax-content-wrap').css('top')))); 9792 9793 $('#ajax-content-wrap').css({ 9794 'position': '', 9795 'top': '' 9796 }); 9797 9798 9799 //handle bottom bar nav 9800 if ($('#header-outer[data-format="centered-menu-bottom-bar"]').length > 0 && 9801 $('#header-outer[data-format="centered-menu-bottom-bar"] .span_9').css('display') != 'none' && 9802 $('body.mobile').length == 0) { 9803 9804 $('#header-outer:not(.fixed-menu)').css('top', ''); 9805 $headerSecondaryEl.css('visibility', ''); 9806 9807 } 9808 9809 //handle hhun when at top 9810 $('body[data-hhun="1"]:not(.no-scroll) #header-outer[data-permanent-transparent="false"]:not(.detached):not(.parallax-contained):not(.at-top-before-box)').css({ 9811 'transform': '' 9812 }); 9813 setTimeout(function () { 9814 $('body[data-hhun="1"]:not(.no-scroll) #header-outer[data-permanent-transparent="false"]:not(.detached):not(.parallax-contained):not(.at-top-before-box)').css({ 9815 'transition': '' 9816 });
9817 }, 30); 9818 9819 9820 $('body[data-hhun="1"] #header-secondary-outer.hidden').removeClass('hidden'); 9821 9822 }, 900); 9823 9824 setTimeout(function () { 9825 9826 //icon effect 9827 $('#header-outer:not([data-format="left-header"]) header#top .slide-out-widget-area-toggle a') 9828 .addClass('no-trans') 9829 .removeClass('effect-shown'); 9830 9831 }, 200); 9832 9833 setTimeout(function () { 9834 //icon 9835 $('#header-outer:not([data-format="left-header"]) header#top .slide-out-widget-area-toggle a').removeClass('no-trans'); 9836 }, 500); 9837 9838 } 9839 9840 } 9841 9842 9843 9844 9845 /** 9846 * Off canvas menu: fullscreen open. 9847 * 9848 * @since 10.5 9849 */ 9850 function OCM_fullscreenOpen() { 9851 9852 if ($('body.material').length > 0) { 9853 $('header#top .slide-out-widget-area-toggle a').addClass('menu-push-out'); 9854 } 9855 9856 // Scroll away from fixed reveal footer if shown (firefox bug with bluring over it) 9857 var $scrollDelay = 0; 9858 var $scrollDelay2 = 0; 9859 9860 if (nectarDOMInfo.scrollTop + $window.height() > $('.blurred-wrap').height() && $('#nectar_fullscreen_rows').length == 0) { 9861 $('body,html').stop().animate({ 9862 scrollTop: $('.blurred-wrap').height() - $window.height() 9863 }, 600, 'easeInOutCubic'); 9864 $scrollDelay = 550; 9865 $scrollDelay2 = 200; 9866 } 9867 9868 $('header#top .slide-out-widget-area-toggle:not(.std-menu) .lines-button').addClass('close'); 9869 setTimeout(function () { 9870 $('.blurred-wrap').addClass('blurred'); 9871 }, $scrollDelay); 9872 $('#slide-out-widget-area.fullscreen').show().addClass('open'); 9873 9874 if ($('.nectar-social.fixed').length == 0) { 9875 hideToTop(); 9876 } 9877 9878 // Remove box shadow incase at the top of the page with nectar box roll above 9879 $('.container-wrap').addClass('no-shadow'); 9880 $headerOuterEl.stop(true).css('transform', 'translateY(0)'); 9881 9882 setTimeout(function () { 9883 9884 $('.off-canvas-menu-container .menu > li').each(function (i) { 9885 $(this).delay(i * 50).transition({ 9886 y: 0, 9887 'opacity': 1 9888 }, 800, 'easeOutExpo'); 9889 }); 9890 9891 $('#slide-out-widget-area.fullscreen .widget').each(function (i) { 9892 $(this).delay(i * 100).transition({ 9893 y: 0, 9894 'opacity': 1 9895 }, 800, 'easeOutExpo'); 9896 }); 9897 }, 370 + $scrollDelay2); 9898 9899 setTimeout(function () { 9900 $('#slide-out-widget-area .off-canvas-social-links').addClass('line-shown'); 9901 9902 $('#slide-out-widget-area .off-canvas-social-links li').each(function (i) { 9903 $(this).delay(i * 50).transition({ 9904 'scale': 1 9905 }, 400, 'easeOutCubic'); 9906 }); 9907 9908 $('#slide-out-widget-area .bottom-text').transition({ 9909 'opacity': 0.7 9910 }, 400, 'easeOutCubic'); 9911 }, 750 + $scrollDelay2); 9912 9913 // Fade In BG Overlay 9914 setTimeout(function () { 9915 var $easing = ($('body.mobile').length > 0) ? 'easeOutCubic' : 'easeInOutQuint'; 9916 $offCanvasBG.css({ 9917 'height': '100%', 9918 'width': '100%' 9919 }).show().stop(true).transition({ 9920 'y': '0%' 9921 }, 920, $easing, function () { 9922 $('.slide-out-widget-area-toggle > div > a').removeClass('animating'); 9923 }); 9924 }, 50 + $scrollDelay2); 9925 9926 // Overflow state 9927 OCM_overflowState(); 9928 9929 if ($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && $('.container-wrap').hasClass('no-scroll')) { 9930 $('#ajax-content-wrap').addClass('at-content'); 9931 } 9932 9933 if ($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 || $('.mobile').length == 0 && $('#header-outer.transparent').length == 0) { 9934 $('#slide-out-widget-area.fullscreen .inner-wrap').css('padding-top', $headerOuterEl.height()); 9935 } 9936 9937 } 9938 9939 9940 /** 9941 * Off canvas menu: fullscreen close. 9942 * 9943 * @since 10.5 9944 */ 9945 function OCM_fullscreenClose() { 9946 9947 if ($('body.material').length > 0) { 9948 setTimeout(function () { 9949 $('header#top .slide-out-widget-area-toggle a').removeClass('menu-push-out'); 9950 }, 350); 9951 } 9952 9953 $('.slide-out-widget-area-toggle:not(.std-menu) .lines-button').removeClass('close'); 9954 $('.blurred-wrap').removeClass('blurred'); 9955 $('#slide-out-widget-area.fullscreen').transition({ 9956 'opacity': 0 9957 }, 700, 'easeOutQuad', function () { 9958 $('#slide-out-widget-area.fullscreen').hide().css('opacity', '1'); 9959 }).removeClass('open'); 9960 $('#slide-out-widget-area.fullscreen .widget').transition({ 9961 'opacity': 0 9962 }, 700, 'easeOutQuad', function () { 9963 $(this).transition({ 9964 y: '110px' 9965 }, 0); 9966 });
9967 9968 setTimeout(function () { 9969 $('.off-canvas-menu-container .menu > li').transition({ 9970 y: '80px', 9971 'opacity': 0 9972 }, 0); 9973 $('#slide-out-widget-area .off-canvas-social-links li').transition({ 9974 'scale': 0 9975 }, 0); 9976 $('#slide-out-widget-area .off-canvas-social-links').removeClass('line-shown'); 9977 $('#slide-out-widget-area .bottom-text').transition({ 9978 'opacity': 0 9979 }, 0); 9980 9981 // Close submenu items 9982 $('#slide-out-widget-area .menuwrapper .menu').removeClass('subview'); 9983 $('#slide-out-widget-area .menuwrapper .menu li').removeClass('subview subviewopen'); 9984 $('#slide-out-widget-area.fullscreen .inner .off-canvas-menu-container').css('height', 'auto'); 9985 }, 800); 9986 9987 setTimeout(function () { 9988 if ($('.nectar-social.fixed').length == 0) { 9989 showToTop(); 9990 } 9991 $('.container-wrap').removeClass('no-shadow'); 9992 }, 500); 9993 9994 // Fade out overlay 9995 $offCanvasBG.stop(true).transition({ 9996 'opacity': 0 9997 }, 900, 'easeOutQuad', function () { 9998 9999 if ($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && $('.container-wrap').hasClass('no-scroll')) { 10000 $('#ajax-content-wrap').removeClass('at-content'); 10001 } 10002 if ($('.mobile #header-outer[data-permanent-transparent="false"]').length == 0) { 10003 $('#slide-out-widget-area.fullscreen .inner-wrap').css('padding-top', '0'); 10004 } 10005 10006 $('.slide-out-widget-area-toggle a').removeClass('animating'); 10007 10008 var $opacity = 0.4; 10009 10010 if ($offCanvasBG.hasClass('solid')) { 10011 $opacity = 1; 10012 } 10013 if ($offCanvasBG.hasClass('dark')) { 10014 $opacity = 0.93; 10015 } 10016 if ($offCanvasBG.hasClass('medium')) { 10017 $opacity = 0.6; 10018 } 10019 if ($offCanvasBG.hasClass('light')) { 10020 $opacity = 0.4; 10021 } 10022 $(this).css({ 10023 'height': '1px', 10024 'width': '1px', 10025 'opacity': $opacity 10026 }).transition({ 10027 y: '-100%' 10028 }, 0); 10029 }); 10030 10031 } 10032 10033 10034 /** 10035 * Off canvas menu: fullscreen alt open. 10036 * 10037 * @since 10.5 10038 */ 10039 function OCM_fullscreenAltOpen() { 10040 10041 var $ocm_fullscreen_class = ( $offCanvasEl.hasClass('fullscreen-alt') ) ? '.fullscreen-alt' : '.fullscreen-split'; 10042 10043 if ($('body.material').length > 0) { 10044 $('header#top .slide-out-widget-area-toggle a').addClass('menu-push-out'); 10045 } 10046 10047 $('header#top .slide-out-widget-area-toggle:not(.std-menu) .lines-button').addClass('close'); 10048 10049 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 10050 $('#slide-out-widget-area'+$ocm_fullscreen_class).show().addClass('open'); 10051 } else { 10052 $('#slide-out-widget-area'+$ocm_fullscreen_class).addClass('open').removeClass('hidden'); 10053 } 10054 10055 $offCanvasBG.addClass('open').removeClass('hidden'); 10056 10057 $('body > div[class*="body-border"]').css('z-index', '9995'); 10058 10059 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 10060 $('.off-canvas-menu-container .menu').transition({ 10061 y: '0px', 10062 'opacity': 1 10063 }, 0); 10064 } 10065 10066 if ($('.nectar-social.fixed').length == 0) { 10067 hideToTop(); 10068 } 10069 10070 if ($('#header-outer.transparent').length > 0) { 10071 10072 if ($bodyBorderTop.length > 0) { 10073 $('.admin-bar #slide-out-widget-area-bg'+$ocm_fullscreen_class).css({ 10074 'padding-top': ($bodyBorderTop.outerHeight(true) + 32) + 'px' 10075 }); 10076 $('body:not(.admin-bar) #slide-out-widget-area-bg'+$ocm_fullscreen_class).css({ 10077 'padding-top': ($bodyBorderTop.outerHeight(true)) + 'px' 10078 }); 10079 } 10080 } 10081 10082 // Set translateY to 0 in all cases 10083 $headerOuterEl.stop(true).css('transform', 'translateY(0)'); 10084 10085 if ($('#logo .starting-logo').length > 0 && 10086 $window.width() > 1000 && 10087 $('#header-outer[data-format="centered-menu-bottom-bar"].fixed-menu').length == 0 && 10088 $('body.material #header-outer[data-condense="true"]').length == 0 && 10089 !nectarDOMInfo.usingFrontEndEditor) { 10090 10091 $headerOuterEl.stop(true).css('transform', 'translateY(0)').addClass('transparent'); 10092 if ($headerOuterEl.attr('data-transparent-header') != 'true') { 10093 $headerOuterEl.attr('data-transparent-header', 'true').addClass('pseudo-data-transparent'); 10094 } 10095 10096 } 10097 10098 $('.off-canvas-menu-container .clip-wrap').css('transition-duration', '0s'); 10099 10100 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 10101 10102 setTimeout(function () { 10103 10104 $('.off-canvas-menu-container .menu > li').each(function (i) { 10105 $(this).delay(i * 50).transition({ 10106 y: 0, 10107 'opacity': 1 10108 }, 750, 'easeOutCubic').addClass('no-pointer-events'); 10109 });
10110 10111 setTimeout(function () { 10112 $('.off-canvas-menu-container .menu > li').removeClass('no-pointer-events'); 10113 $('.off-canvas-menu-container .clip-wrap').css('transition-duration', '.45s'); 10114 }, 500); 10115 10116 $('#slide-out-widget-area.fullscreen-alt .widget').each(function (i) { 10117 $(this).delay(i * 100).transition({ 10118 y: 0, 10119 'opacity': 1 10120 }, 650, 'easeOutCubic'); 10121 }); 10122 10123 }, 200); 10124 10125 setTimeout(function () { 10126 $('#slide-out-widget-area .off-canvas-social-links').addClass('line-shown'); 10127 10128 $('#slide-out-widget-area .off-canvas-social-links li').css('opacity', '1').each(function (i) { 10129 $(this).delay(i * 50).transition({ 10130 'scale': 1 10131 }, 400, 'easeOutCubic'); 10132 }); 10133 $('#slide-out-widget-area .bottom-text').transition({ 10134 'opacity': 1 10135 }, 600, 'easeOutCubic'); 10136 }, 200); 10137 10138 } 10139 10140 // Fade In BG Overlay 10141 var $opacity = 0.4; 10142 10143 if ($offCanvasBG.hasClass('solid')) { 10144 $opacity = 1; 10145 } 10146 if ($offCanvasBG.hasClass('dark')) { 10147 $opacity = 0.97; 10148 } 10149 if ($offCanvasBG.hasClass('medium')) { 10150 $opacity = 0.6; 10151 } 10152 if ($offCanvasBG.hasClass('light')) { 10153 $opacity = 0.4; 10154 } 10155 $offCanvasBG.removeClass('no-transition'); 10156 10157 10158 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 10159 10160 $offCanvasBG.addClass('padding-removed').css({ 10161 'height': '100%', 10162 'width': '100%', 10163 'left': '0', 10164 'opacity': $opacity 10165 }); 10166 10167 // Overflow state 10168 OCM_overflowState(); 10169 10170 } 10171 10172 setTimeout(function () { 10173 $('.slide-out-widget-area-toggle > div > a').removeClass('animating'); 10174 }, 600); 10175 10176 10177 if ($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && 10178 $('.container-wrap').hasClass('no-scroll')) { 10179 $('#ajax-content-wrap').addClass('at-content'); 10180 } 10181 10182 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 10183 if ($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 || 10184 $('.mobile').length == 0 && $('#header-outer.transparent').length == 0) { 10185 $('#slide-out-widget-area'+$ocm_fullscreen_class+' .inner-wrap').css('padding-top', $headerOuterEl.height()); 10186 } 10187 } else { 10188 $('#slide-out-widget-area'+$ocm_fullscreen_class+' .inner-wrap').css('padding-top', $headerOuterEl.outerHeight()); 10189 } 10190 10191 } 10192 10193 10194 /** 10195 * Off canvas menu: fullscreen alt close. 10196 * 10197 * @since 10.5 10198 */ 10199 function OCM_fullscreenAltClose() { 10200 10201 var $ocm_fullscreen_class = ( $offCanvasEl.hasClass('fullscreen-alt') ) ? '.fullscreen-alt' : '.fullscreen-split'; 10202 10203 if ($('body.material').length > 0) { 10204 setTimeout(function () { 10205 $('header#top .slide-out-widget-area-toggle a').removeClass('menu-push-out'); 10206 }, 350); 10207 } 10208 10209 $('.slide-out-widget-area-toggle:not(.std-menu) .lines-button').removeClass('close'); 10210 10211 10212 $offCanvasBG.removeClass('open'); 10213 10214 if( $ocm_fullscreen_class === '.fullscreen-split' ) { 10215 setTimeout(function () { 10216 $offCanvasBG.addClass('hidden'); 10217 $('#slide-out-widget-area'+$ocm_fullscreen_class).addClass('hidden'); 10218 },600); 10219 } 10220 10221 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 10222 10223 $('.blurred-wrap').removeClass('blurred'); 10224 10225 $('#slide-out-widget-area.fullscreen-alt .widget').transition({ 10226 'opacity': 0 10227 }, 500, 'easeOutQuad', function () { 10228 $(this).transition({ 10229 y: '40px' 10230 }, 0); 10231 }); 10232 $('#slide-out-widget-area .bottom-text, #slide-out-widget-area .off-canvas-social-links li').transition({ 10233 'opacity': 0 10234 }, 250, 'easeOutQuad'); 10235 $('#slide-out-widget-area .off-canvas-social-links').removeClass('line-shown'); 10236 10237 $('.off-canvas-menu-container .menu').transition({ 10238 y: '-13px', 10239 'opacity': 0 10240 }, 400); 10241 10242 } 10243 10244 10245 setTimeout(function () { 10246 10247 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 10248 10249 $('.off-canvas-menu-container .menu > li').stop(true, true).transition({ 10250 y: '40px', 10251 'opacity': 0 10252 }, 0); 10253 $('#slide-out-widget-area .off-canvas-social-links li').transition({ 10254 'scale': 0 10255 }, 0); 10256 $('#slide-out-widget-area .off-canvas-social-links').removeClass('line-shown'); 10257 10258 // Close submenu items 10259 $('#slide-out-widget-area .menuwrapper .menu').removeClass('subview'); 10260 $('#slide-out-widget-area .menuwrapper .menu li').removeClass('subview subviewopen'); 10261 $('#slide-out-widget-area.fullscreen-alt .inner .off-canvas-menu-container').css('height', 'auto'); 10262 10263 $offCanvasBG.css({ 10264 'height': '1px', 10265 'width': '1px', 10266 'left': '-100%' 10267 });
10268 10269 } 10270 10271 if ($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && $('.container-wrap').hasClass('no-scroll')) { 10272 $('#ajax-content-wrap').removeClass('at-content'); 10273 } 10274 10275 if ($('.mobile #header-outer[data-permanent-transparent="false"]').length == 0) { 10276 $('#slide-out-widget-area'+$ocm_fullscreen_class+' .inner-wrap').css('padding-top', '0'); 10277 } 10278 10279 $('.slide-out-widget-area-toggle a').removeClass('animating'); 10280 10281 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 10282 $('#slide-out-widget-area'+$ocm_fullscreen_class).hide().removeClass('open'); 10283 } 10284 10285 }, 550); 10286 10287 if( $ocm_fullscreen_class === '.fullscreen-split' ) { 10288 $('#slide-out-widget-area'+$ocm_fullscreen_class).removeClass('open'); 10289 } 10290 10291 setTimeout(function () { 10292 if ($('.nectar-social.fixed').length == 0) { 10293 showToTop(); 10294 } 10295 }, 600); 10296 10297 // Fade out overlay 10298 setTimeout(function () { 10299 $offCanvasBG.removeClass('padding-removed'); 10300 }, 50); 10301 10302 10303 var borderDelay = ($bodyBorderHeaderColorMatch == true) ? 150 : 50; 10304 10305 setTimeout(function () { 10306 10307 if( $ocm_fullscreen_class === '.fullscreen-alt' ) { 10308 $offCanvasBG.stop(true).css({ 10309 'opacity': 0 10310 }); 10311 } 10312 if ($('#header-outer[data-transparent-header="true"]').length > 0) { 10313 $('body > div[class*="body-border"]').css('z-index', '10000'); 10314 } 10315 }, borderDelay); 10316 10317 setTimeout(function () { 10318 $('#header-outer.transparent.small-nav, #header-outer.transparent.detached, #header-outer:not([data-permanent-transparent="1"]).transparent.scrolled-down').removeClass('transparent'); 10319 10320 if ($headerOuterEl.hasClass('pseudo-data-transparent')) { 10321 10322 $headerOuterEl.attr('data-transparent-header', 'false') 10323 .removeClass('pseudo-data-transparent') 10324 .removeClass('transparent'); 10325 } 10326 10327 }, 100); 10328 10329 } 10330 10331 10332 /** 10333 * Off canvas menu: simple dropdown open. 10334 * 10335 * @since 10.5 10336 */ 10337 function OCM_simpleDropdownOpen() { 10338 10339 $('#mobile-menu').show(); 10340 10341 $('header#top .slide-out-widget-area-toggle:not(.std-menu) .lines-button').addClass('close'); 10342 10343 if ($('body.material').length > 0) { 10344 $('header#top .slide-out-widget-area-toggle a').addClass('menu-push-out'); 10345 } 10346 10347 setTimeout(function () { 10348 $('.slide-out-widget-area-toggle > div > a').removeClass('animating'); 10349 }, 100); 10350 10351 } 10352 10353 /** 10354 * Off canvas menu: simple dropdown close.
10355 * 10356 * @since 10.5 10357 */ 10358 function OCM_simpleDropdownClose() { 10359 $('#mobile-menu').hide(); 10360 10361 $('.slide-out-widget-area-toggle:not(.std-menu) .lines-button').removeClass('close'); 10362 10363 setTimeout(function () { 10364 if ($('body.material').length > 0) { 10365 $('header#top .slide-out-widget-area-toggle a').removeClass('menu-push-out'); 10366 } 10367 $('.slide-out-widget-area-toggle a').removeClass('animating'); 10368 }, 350); 10369 } 10370 10371 10372 /** 10373 * Off canvas menu: simple dropdown click events. 10374 * 10375 * @since 10.5 10376 */ 10377 function OCM_simpleStyleInit() { 10378 10379 if( $('#header-outer #mobile-menu').length == 0 ) { 10380 return; 10381 } 10382 10383 $('#header-outer #mobile-menu li.megamenu').removeClass('megamenu'); 10384 10385 // Add icons/markup. 10386 $('#header-outer #mobile-menu ul li').each(function(){ 10387 $(this).find('a').wrapInner('<span></span>'); 10388 if($(this).find('> ul').length > 0) { 10389 $(this).find('> a').append('<span class="sf-sub-indicator"><i class="fa fa-angle-down"></i></span>'); 10390 } 10391 }); 10392 10393 // Click event. 10394 $('#header-outer #mobile-menu .sf-sub-indicator').on('click', function(){ 10395 10396 var $parentLI = $(this).parent().parent(); 10397 10398 $parentLI.toggleClass('current-open-item'); 10399 10400 // Open. 10401 if( $parentLI.hasClass('current-open-item') ) { 10402 $parentLI.find('> ul').show(); 10403 setTimeout(function(){ 10404 $parentLI.addClass('visible'); 10405 },30); 10406 } else { 10407 // Close. 10408 $parentLI.find('ul').hide(); 10409 // Ensure open children also close. 10410 $parentLI.find('li').removeClass('visible').removeClass('current-open-item'); 10411 $parentLI.removeClass('visible'); 10412 } 10413 10414 return false; 10415 10416 }); 10417 10418 // Resize event. 10419 $window.on('smartresize', function(){ 10420 10421 if( nectarDOMInfo.winW > 1000 && $('.slide-out-widget-area-toggle.mobile-icon a.open').length > 0 ) { 10422 10423 $('.slide-out-widget-area-toggle.mobile-icon a') 10424 .addClass('non-human-allowed') 10425 .trigger('click'); 10426 10427 setTimeout(function () { 10428 $('.slide-out-widget-area-toggle.mobile-icon a').removeClass('non-human-allowed'); 10429 }, 100); 10430 10431 } 10432 10433 }); 10434 10435 } 10436 10437 10438 /** 10439 * Off canvas menu click triggered styles initialization 10440 * 10441 * @since 10.5 10442 */ 10443 function OCM_clickTriggeredStylesInit() { 10444 10445 // Click triggered open bind. 10446 $body.on('click', '.slide-out-widget-area-toggle:not(.std-menu) a.closed:not(.animating), .nectar-ocm-trigger-open', function () { 10447 10448 if (nectarBoxRoll.animating == 'true' || $('.slide-out-from-right-hover').length > 0) { 10449 return false; 10450 } 10451 10452 $headerOuterEl.removeClass('no-transition'); 10453 10454 // Slide out from right. 10455 if ($offCanvasEl.hasClass('slide-out-from-right')) { 10456 OCM_slideOutRightOpen(); 10457 } 10458 // Fullscreen. 10459 else if ($offCanvasEl.hasClass('fullscreen')) { 10460 OCM_fullscreenOpen(); 10461 } 10462 // Fullscreen Alt. 10463 else if ($offCanvasEl.hasClass('fullscreen-alt') || $offCanvasEl.hasClass('fullscreen-split')) { 10464 OCM_fullscreenAltOpen(); 10465 } 10466 // Simple dropdown. 10467 else if( $('#header-outer #mobile-menu').length > 0 ) { 10468 OCM_simpleDropdownOpen(); 10469 } 10470 10471 10472 // Add open class 10473 if( $('#header-outer #mobile-menu').length == 0 ) { 10474 10475 $headerOuterEl 10476 .removeClass('side-widget-closed') 10477 .addClass('side-widget-open'); 10478 10479 10480 // Give header transparent state 10481 if ($('#header-outer[data-transparency-option="1"]').length > 0 && 10482 $('#boxed').length == 0 && 10483 $('#header-outer[data-full-width="true"]').length > 0 && 10484 !nectarDOMInfo.usingFrontEndEditor) { 10485 10486 if ($('body.material[data-slide-out-widget-area-style="slide-out-from-right"]').length == 0 && 10487 $('body.material #header-outer[data-condense="true"]').length == 0) { 10488 10489 $headerOuterEl.addClass('transparent'); 10490 10491 } 10492 10493 } 10494 10495 // Dark slide transparent nav 10496 if ($('#header-outer.dark-slide.transparent').length > 0 && 10497 $('#boxed').length == 0 && 10498 $('body.material-ocm-open').length == 0) { 10499 $headerOuterEl 10500 .removeClass('dark-slide') 10501 .addClass('temp-removed-dark-slide'); 10502 } 10503 10504 } // Not using simple OCM. 10505 10506 10507 $('.slide-out-widget-area-toggle > div > a') 10508 .removeClass('closed') 10509 .addClass('open') 10510 .attr('aria-expanded','true'); 10511 10512 $('.slide-out-widget-area-toggle > div > a').addClass('animating'); 10513 10514 return false; 10515 10516 });
10517 10518 10519 10520 // Close event bind. 10521 $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) { 10522 10523 if (e.originalEvent == undefined && 10524 $('.slide_out_area_close.non-human-allowed').length == 0 && 10525 $('.slide-out-widget-area-toggle.mobile-icon a.non-human-allowed').length == 0) { 10526 return; 10527 } 10528 10529 if ($('.slide-out-widget-area-toggle:not(.std-menu) a.animating').length > 0) { 10530 return; 10531 } 10532 10533 $headerOuterEl.removeClass('no-transition'); 10534 10535 $('.slide-out-widget-area-toggle:not(.std-menu) a') 10536 .removeClass('open') 10537 .addClass('closed') 10538 .attr('aria-expanded','false'); 10539 10540 $('.slide-out-widget-area-toggle:not(.std-menu) a') 10541 .addClass('animating'); 10542 10543 // Slide out from right. 10544 if ($offCanvasEl.hasClass('slide-out-from-right')) { 10545 OCM_slideOutRightClose(); 10546 } 10547 10548 // Fullscreen. 10549 else if ($offCanvasEl.hasClass('fullscreen')) { 10550 OCM_fullscreenClose(); 10551 } 10552 // Fullscreen alt. 10553 else if ($offCanvasEl.hasClass('fullscreen-alt') || $offCanvasEl.hasClass('fullscreen-split')) { 10554 OCM_fullscreenAltClose(); 10555 } 10556 // Simple dropdown. 10557 else if( $('#header-outer #mobile-menu').length > 0 ) { 10558 OCM_simpleDropdownClose(); 10559 } 10560 10561 if( $('#header-outer #mobile-menu').length == 0 ) { 10562 10563 // Dark slide transparent nav 10564 if ($('#header-outer.temp-removed-dark-slide.transparent').length > 0 && $('#boxed').length == 0) { 10565 $headerOuterEl 10566 .removeClass('temp-removed-dark-slide') 10567 .addClass('dark-slide'); 10568 } 10569 10570 // Remove header transparent state 10571 if ($('#header-outer[data-permanent-transparent="1"]').length == 0 && $('#slide-out-widget-area.fullscreen-alt').length == 0) { 10572 10573 if ($('.nectar-box-roll').length == 0) { 10574 if ($('#header-outer.small-nav').length > 0 || 10575 $('#header-outer.scrolled-down').length > 0) { 10576 $headerOuterEl.removeClass('transparent'); 10577 } 10578 } 10579 else { 10580 if ($('#header-outer.small-nav').length > 0 || 10581 $('#header-outer.scrolled-down').length > 0 || 10582 $('.container-wrap.auto-height').length > 0) { 10583 $headerOuterEl.removeClass('transparent'); 10584 } 10585 } 10586 10587 } 10588 10589 // Remove hidden menu 10590 $headerOuterEl.removeClass('hidden-menu'); 10591 10592 $headerOuterEl 10593 .removeClass('side-widget-open') 10594 .addClass('side-widget-closed'); 10595 10596 } // Not using simple OCM. 10597 10598 return false; 10599 10600 }); 10601 10602 } 10603 10604 10605 /** 10606 * Off canvas menu main initialization. 10607 * 10608 * @since 10.5 10609 */ 10610 function OCM_init() { 10611 10612 if ($('#slide-out-widget-area.slide-out-from-right-hover').length > 0) { 10613 OCM_slideOutRightHoverInit(); 10614 } else { 10615 OCM_clickTriggeredStylesInit(); 10616 OCM_simpleStyleInit(); 10617 } 10618 10619 10620 if ($('#slide-out-widget-area.fullscreen-split').length == 0 && 10621 $('body.material[data-slide-out-widget-area-style*="slide-out-from-right"]').length == 0 && 10622 $('#slide-out-widget-area[data-dropdown-func="separate-dropdown-parent-link"]').length == 0) { 10623 10624 fullscreenMenuInit(); 10625 10626 } else if ($('body.using-mobile-browser[data-slide-out-widget-area-style="slide-out-from-right-hover"]').length > 0) { 10627 10628 // Close OCM on mobile when clicking anchor on same page 10629 $('body #slide-out-widget-area .inner .off-canvas-menu-container li a[href]').on('click', function () { 10630 10631 if ($(this).attr('href') != '#') { 10632 OCM_close($(this).parent()); 10633 } 10634 10635 }); 10636 10637 } 10638 10639 // Page fullscreen row close OCM fullscreen 10640 if ($('#nectar_fullscreen_rows').length >
10640 0 && $('body[data-slide-out-widget-area-style*="fullscreen"]').length > 0) { 10641 10642 $('body #slide-out-widget-area .inner .off-canvas-menu-container li a[href]').on('click', function () { 10643 var $link_href = ($(this).is('[href*="#"]')) ? $(this).attr('href') : ''; 10644 if ($link_href != '#' && $('div[data-fullscreen-anchor-id="' + $link_href.substr($link_href.indexOf("#") + 1) + '"]').length > 0) { 10645 10646 setTimeout(function () { 10647 10648 $('#slide-out-widget-area .slide_out_area_close') 10649 .addClass('non-human-allowed') 10650 .trigger('click'); 10651 10652 }, 100); 10653 10654 setTimeout(function () { 10655 $('#slide-out-widget-area .slide_out_area_close').removeClass('non-human-allowed'); 10656 }, 150); 10657 10658 } 10659 10660 }); 10661 } 10662 10663 10664 // Submenu link hover fix 10665 $body.on('mouseover', '#slide-out-widget-area .off-canvas-menu-container .menuwrapper > .sub-menu li > a', function () { 10666 var $currentTxt = $(this).text(); 10667 $('.off-canvas-menu-container .menuwrapper .menu li > a').removeClass('hovered'); 10668 $('.off-canvas-menu-container .menuwrapper .menu li > a:contains(' + $currentTxt + ')').addClass('hovered'); 10669 }); 10670 10671 $body.on('mouseover', '.off-canvas-menu-container .menuwrapper .menu li > a', function () { 10672 $('.off-canvas-menu-container .menuwrapper .menu li > a').removeClass('hovered'); 10673 }); 10674 10675 10676 // Bind mousewheel. 10677 setTimeout(OCM_scrolling, 500); 10678 10679 // Handle mobile scrolling. 10680 if (nectarDOMInfo.usingMobileBrowser) { 10681 $offCanvasEl.addClass('mobile'); 10682 } 10683 10684 10685 } 10686 10687 10688 10689 10690 /** 10691 * Off canvas menu scrolling. 10692 * 10693 * @since 10.5 10694 */ 10695 function OCM_scrolling() { 10696 10697 $offCanvasEl.mousewheel(function (event, delta) { 10698 10699 this.scrollTop -= (delta * 30); 10700 10701 event.preventDefault(); 10702 }); 10703 10704 } 10705 10706 10707 10708 /** 10709 * Off canvas menu close. 10710 * 10711 * @since 10.5 10712 */ 10713 function OCM_close(item) { 10714 10715 if ($('#slide-out-widget-area.open').length > 0) { 10716 10717 var $windowCurrentLocation = window.location.href.split("#")[0]; 10718 var $windowClickedLocation = item.find('> a').attr('href').split("#")[0]; 10719 10720 if ($windowCurrentLocation == $windowClickedLocation || item.find('a[href^="#"]').length > 0) { 10721 if (item.parents('.slide-out-from-right-hover').length > 0) { 10722 $('.slide-out-widget-area-toggle.slide-out-hover-icon-effect a').trigger('click'); 10723 } else { 10724 $('.slide-out-widget-area-toggle a').trigger('click'); 10725 } 10726 10727 } 10728 } 10729 10730 } 10731 10732 10733 10734 10735 /** 10736 * Click based submenus. 10737 * 10738 * Used by left header layout and off canvas menu. 10739 * 10740 * @since 10.5 10741 */ 10742 function clickToggleSubmenus() { 10743 10744 if (!$('#header-outer[data-format="left-header"]').length > 0 && 10745 !$('body.material[data-slide-out-widget-area-style*="slide-out-from-right"]').length > 0 && 10746 !$('#slide-out-widget-area.fullscreen-split').length > 0 && 10747 !$('#slide-out-widget-area[data-dropdown-func="separate-dropdown-parent-link"]').length > 0) { 10748 return; 10749 } 10750 10751 // Remove megamenu class. 10752 $('#header-outer[data-format="left-header"] nav li.megamenu').removeClass('megamenu'); 10753 10754 var $ocm_link_selector; 10755 10756 if ($('#slide-out-widget-area[data-dropdown-func="separate-dropdown-parent-link"]').length > 0) { 10757 $ocm_link_selector = '#slide-out-widget-area .off-canvas-menu-container li.menu-item-has-children > .ocm-dropdown-arrow'; 10758 } else { 10759 $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'; 10760 } 10761 10762 // Click event. 10763 $('#header-outer[data-format="left-header"] nav li.menu-item-has-children > a, ' + $ocm_link_selector).on('click', function () { 10764 10765 if ($(this).parent().hasClass('open-submenu')) { 10766 $(this).parent().find('.sub-menu').css({ 10767 'max-height': '0' 10768 });
10769 $(this).parent().removeClass('open-submenu'); 10770 } else { 10771 10772 // Get max height. 10773 var $that = $(this); 10774 var $maxSubMenuHeight; 10775 10776 $that.parent() 10777 .find('> .sub-menu') 10778 .addClass('no-trans'); 10779 10780 setTimeout(function () { 10781 10782 $that.parent().find('> .sub-menu').css({ 10783 'max-height': 'none', 10784 'position': 'absolute', 10785 'visibility': 'hidden' 10786 }); 10787 10788 $maxSubMenuHeight = $that.parent().find('> .sub-menu').height(); 10789 10790 $that.parent() 10791 .find('> .sub-menu') 10792 .removeClass('no-trans'); 10793 10794 $that.parent().find('> .sub-menu').css({ 10795 'max-height': '0', 10796 'position': 'relative', 10797 'visibility': 'visible' 10798 }); 10799 10800 }, 25); 10801 10802 setTimeout(function () { 10803 10804 // Reset Max Height. 10805 $that.closest('ul') 10806 .find('li.menu-item-has-children') 10807 .removeClass('open-submenu'); 10808 10809 $that.closest('ul').find('li.menu-item-has-children > .sub-menu').css({ 10810 'max-height': '0' 10811 });
10812 10813 $that.parent().addClass('open-submenu'); 10814 10815 $that.parent() 10816 .find('> .sub-menu') 10817 .css('max-height', $maxSubMenuHeight); 10818 10819 // Add height to open parents. 10820 if ($that.parents('ul').length > 0) { 10821 10822 $that.parents('ul:not(.sf-menu)').each(function () { 10823 $(this).css('max-height'); 10824 $(this).css('max-height', parseInt($(this).height() + parseInt($(this).css('padding-top')) * 2 + $maxSubMenuHeight) + 'px'); 10825 }); 10826 } 10827 10828 10829 }, 50); 10830 } 10831 10832 return false; 10833 10834 }); 10835 10836 // Start open for current page items. 10837 if($('#header-outer[data-format="left-header"] nav .sf-menu > .current-menu-ancestor.menu-item-has-children > ul > li.current-menu-item').length > 0) { 10838 $('#header-outer[data-format="left-header"] nav .sf-menu > .current-menu-ancestor.menu-item-has-children > a').trigger('click'); 10839 } 10840 10841 10842 } 10843 10844 10845 10846 10847 10848 10849 10850 10851 /** 10852 * DLMenu - plugin used for submenus in off canvas menu. 10853 * 10854 * @since 6.0 10855 */ 10856 $.DLMenu = function (options, element) { 10857 this.$el = $(element); 10858 this._init(options); 10859 }; 10860 10861 // the options 10862 $.DLMenu.defaults = { 10863 // classes for the animation effects 10864 animationClasses: { 10865 classin: 'dl-animate-in-1', 10866 classout: 'dl-animate-out-1' 10867 }, 10868 onLevelClick: function () { 10869 return false; 10870 }, 10871 onLinkClick: function () { 10872 return false; 10873 } 10874 }; 10875 10876 $.DLMenu.prototype = { 10877 _init: function (options) { 10878 10879 // options 10880 this.options = $.extend(true, {}, $.DLMenu.defaults, options); 10881 this._config(); 10882 10883 var animEndEventNames = { 10884 'WebkitAnimation': 'webkitAnimationEnd', 10885 'OAnimation': 'oAnimationEnd', 10886 'msAnimation': 'MSAnimationEnd', 10887 'animation': 'animationend' 10888 }, 10889 transEndEventNames = { 10890 'WebkitTransition': 'webkitTransitionEnd', 10891 'MozTransition': 'transitionend', 10892 'OTransition': 'oTransitionEnd', 10893 'msTransition': 'MSTransitionEnd', 10894 'transition': 'transitionend' 10895 }; 10896 // animation end event name 10897 this.animEndEventName = animEndEventNames['animation'] + '.menu'; 10898 // transition end event name 10899 this.transEndEventName = transEndEventNames['transition'] + '.menu', 10900 // support for css animations and css transitions 10901 this.supportAnimations = true, 10902 this.supportTransitions = true; 10903 this._initEvents(); 10904 10905 }, 10906 _config: function () { 10907 this.open = false; 10908 this.$trigger = this.$el.children('.trigger'); 10909 this.$menu = this.$el.children('ul.menu'); 10910 this.$menuitems = this.$menu.find('li:not(.back) > a'); 10911 10912 this.$el.find('ul.sub-menu') 10913 .prepend('<li class="back"><a href="#"> ' + $offCanvasEl.attr('data-back-txt') + ' </a></li>'); 10914 10915 this.$back = this.$menu.find('li.back'); 10916 }, 10917 _initEvents: function () { 10918 10919 var self = this; 10920 10921 this.$trigger.on('click.menu', function () { 10922 10923 if (self.open) { 10924 self._closeMenu(); 10925 } else { 10926 self._openMenu(); 10927 } 10928 return false; 10929 10930 }); 10931 10932 this.$menuitems.on('click.menu', function (event) { 10933 10934 10935 var $item = $(this).parent('li'), 10936 $submenu = $item.children('ul.sub-menu'); 10937 10938 $('.fullscreen-alt .off-canvas-menu-container .clip-wrap, .fullscreen-alt .off-canvas-menu-container .clip-wrap span').css('transition-duration', '0s'); 10939 10940 if ($submenu.length > 0) { 10941 10942 var $flyin = $submenu.clone().css('opacity', 0).insertAfter(self.$menu), 10943 onAnimationEndFn = function () { 10944 self.$menu.off(self.animEndEventName).removeClass(self.options.animationClasses.classout).addClass('subview'); 10945 $item.addClass('subviewopen').parents('.subviewopen:first').removeClass('subviewopen').addClass('subview'); 10946 $flyin.remove(); 10947 setTimeout(function () { 10948 $('.off-canvas-menu-container .menu > li').removeClass('no-pointer-events'); 10949 $('.off-canvas-menu-container .clip-wrap, .off-canvas-menu-container .clip-wrap span').css('transition-duration', '.45s'); 10950 }, 300); 10951 10952 }; 10953 10954 setTimeout(function () { 10955 $flyin.addClass(self.options.animationClasses.classin); 10956 self.$menu.addClass(self.options.animationClasses.classout); 10957 if (self.supportAnimations) { 10958 self.$menu.on(self.animEndEventName, onAnimationEndFn); 10959 } else { 10960 onAnimationEndFn.call(); 10961 } 10962 10963 self.options.onLevelClick($item, $item.children('a:first').text()); 10964 });
10965 10966 10967 $item.parents('.off-canvas-menu-container').css('height', $item.parents('.off-canvas-menu-container').find('.menuwrapper .menu').height()).transition({ 10968 'height': $flyin.height() 10969 }, 500, 'easeInOutQuad'); 10970 10971 10972 return false; 10973 10974 } else { 10975 10976 self.options.onLinkClick($item.find('> a'), event); 10977 } 10978 10979 OCM_close($item); 10980 10981 }); 10982 10983 10984 10985 this.$back.on('click.menu', function () { 10986 10987 var $this = $(this), 10988 $submenu = $this.parents('ul.sub-menu:first'), 10989 $item = $submenu.parent(), 10990 $flyin = $submenu.clone().insertAfter(self.$menu); 10991 10992 var onAnimationEndFn = function () { 10993 self.$menu.off(self.animEndEventName).removeClass(self.options.animationClasses.classin); 10994 $flyin.remove(); 10995 }; 10996 10997 setTimeout(function () { 10998 $flyin.addClass(self.options.animationClasses.classout); 10999 self.$menu.addClass(self.options.animationClasses.classin); 11000 if (self.supportAnimations) { 11001 self.$menu.on(self.animEndEventName, onAnimationEndFn); 11002 } else { 11003 onAnimationEndFn.call(); 11004 } 11005 11006 $item.removeClass('subviewopen'); 11007 11008 var $subview = $this.parents('.subview:first'); 11009 if ($subview.is('li')) { 11010 $subview.addClass('subviewopen'); 11011 } 11012 $subview.removeClass('subview'); 11013 }); 11014 11015 11016 $item.parents('.off-canvas-menu-container').css('height', $item.parents('.off-canvas-menu-container').find('.menuwrapper .menu').height()); 11017 11018 setTimeout(function () { 11019 $item.parents('.off-canvas-menu-container').transition({ 11020 'height': $item.parent().height() 11021 }, 500, 'easeInOutQuad'); 11022 }, 50); 11023 11024 11025 return false; 11026 11027 }); 11028 11029 }, 11030 closeMenu: function () { 11031 if (this.open) { 11032 this._closeMenu(); 11033 } 11034 }, 11035 _closeMenu: function () { 11036 var self = this, 11037 onTransitionEndFn = function () { 11038 self.$menu.off(self.transEndEventName); 11039 self._resetMenu(); 11040 }; 11041 11042 this.$menu.removeClass('menuopen'); 11043 this.$menu.addClass('menu-toggle'); 11044 this.$trigger.removeClass('active'); 11045 11046 if (this.supportTransitions) { 11047 this.$menu.on(this.transEndEventName, onTransitionEndFn); 11048 } else { 11049 onTransitionEndFn.call(); 11050 } 11051 11052 this.open = false; 11053 }, 11054 openMenu: function () { 11055 if (!this.open) { 11056 this._openMenu(); 11057 } 11058 }, 11059 _openMenu: function () { 11060 var self = this; 11061 $body.off('click').on('click.menu', function () { 11062 self._closeMenu(); 11063 }); 11064 this.$menu.addClass('menuopen menu-toggle').on(this.transEndEventName, function () { 11065 $(this).removeClass('menu-toggle'); 11066 }); 11067 this.$trigger.addClass('active'); 11068 this.open = true; 11069 }, 11070 _resetMenu: function () { 11071 this.$menu.removeClass('subview'); 11072 this.$menuitems.removeClass('subview subviewopen'); 11073 } 11074 }; 11075 11076 var logError = function (message) { 11077 if (window.console) { 11078 window.console.error(message); 11079 } 11080 }; 11081 11082 $.fn.dlmenu = function (options) { 11083 if (typeof options === 'string') { 11084 var args = Array.prototype.slice.call(arguments, 1); 11085 this.each(function () { 11086 var instance = $.data(this, 'menu'); 11087 if (!instance) { 11088 logError("cannot call methods on menu prior to initialization; " + 11089 "attempted to call method '" + options + "'"); 11090 return; 11091 } 11092 if (!$.isFunction(instance[options]) || options.charAt(0) === "_") { 11093 logError("no such method '" + options + "' for menu instance"); 11094 return; 11095 } 11096 instance[options].apply(instance, args); 11097 }); 11098 } else { 11099 this.each(function () { 11100 var instance = $.data(this, 'menu'); 11101 if (instance) { 11102 instance._init(); 11103 } else { 11104 instance = $.data(this, 'menu', new $.DLMenu(options, this)); 11105 } 11106 });
11107 } 11108 return this; 11109 }; 11110 11111 11112 /** 11113 * Initialize DL menu. 11114 * 11115 * @since 6.0 11116 */ 11117 function fullscreenMenuInit() { 11118 11119 $('#slide-out-widget-area .off-canvas-menu-container .menu').wrap('<div class="menu-wrap menuwrapper" />'); 11120 $('#slide-out-widget-area .off-canvas-menu-container .menu').addClass('menuopen'); 11121 11122 var $ocmAnimationClassNum = ($('#slide-out-widget-area.fullscreen-alt').length > 0) ? '4' : '5'; 11123 $('#slide-out-widget-area .off-canvas-menu-container .menu-wrap').dlmenu({ 11124 animationClasses: { 11125 classin: 'dl-animate-in-' + $ocmAnimationClassNum, 11126 classout: 'dl-animate-out-' + $ocmAnimationClassNum 11127 } 11128 }); 11129 11130 } 11131 11132 11133 11134 11135 11136 11137 11138 11139 11140 /** 11141 * Set the page header height when using "slide down" theme option effect. 11142 * 11143 * @since 2.0 11144 */ 11145 function pageHeaderSlideInHeight() { 11146 11147 var pageHeaderHeight = parseInt($pageHeaderBG.height()); 11148 $('body[data-aie="slide-down"] #page-header-wrap:not(.fullscreen-header):not([data-responsive="true"])').css('height', pageHeaderHeight + 'px'); 11149 11150 } 11151 11152 11153 /** 11154 * Fired after page header image has loaded. 11155 * 11156 * @since 2.0 11157 */ 11158 function pageHeaderAfterLoad() { 11159 11160 11161 // Transparent 11162 if ($('#header-outer[data-transparent-header="true"]').length > 0) { 11163 $('#page-header-bg[data-parallax="1"]').css({ 11164 'top': nectarDOMInfo.adminBarHeight 11165 }); 11166 } else { 11167 11168 if ($('body[data-header-resize="0"]').length == 0 && $('body.material').length == 0) { 11169 $('#page-header-bg[data-parallax="1"]').css({ 11170 'top': ($('#page-header-wrap').offset().top) + 'px' 11171 }); 11172 } 11173 } 11174 11175 //fade in header 11176 if ($('#ajax-content-wrap').length == 0 || !$body.hasClass('ajax-loaded')) { 11177 $('#page-header-bg[data-parallax="1"]').animate({ 11178 'opacity': 1 11179 }, 350, 'easeInCubic'); 11180 } else if ($('#ajax-content-wrap').length == 1) { 11181 $('#page-header-bg[data-parallax="1"]').css({ 11182 'opacity': 1 11183 }); 11184 } 11185 11186 $('#page-header-bg[data-parallax="1"] .nectar-particles').append('<div class="fade-out" />'); 11187 11188 } 11189 11190 11191 11192 /** 11193 * Page header unload event. 11194 * 11195 * @since 2.0 11196 */ 11197 function pageHeaderUnload() { 11198 11199 if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1 || navigator.userAgent.match(/(iPod|iPhone|iPad)/)) { 11200 window.onunload = function () { 11201 11202 pageHeaderInit(); 11203 11204 $('#page-header-bg[data-parallax="1"] .span_6').css({ 11205 'opacity': 1 11206 }); 11207 11208 }; 11209 } 11210 11211 } 11212 11213 11214 /** 11215 * Page header initialization. 11216 * 11217 * @since 2.0 11218 */ 11219 function pageHeaderInit() { 11220 11221 var $headerRemoveStickyness = ($('body[data-hhun="1"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length > 0) ? 1 : 0; 11222 11223 if ($('#page-header-bg[data-parallax="1"]').length > 0) { 11224 11225 // Fade in 11226 var img = new Image(), 11227 pageHeaderHeight = parseInt($pageHeaderBG.height()), 11228 $initialImgCheck = extractUrl($('#page-header-bg[data-parallax="1"]').css('background-image')); 11229 11230 if ($initialImgCheck && $initialImgCheck.indexOf('.') !== -1) { 11231 img.onload = function () { 11232 pageHeaderAfterLoad(); 11233 }; 11234 11235 img.src = extractUrl($('#page-header-bg[data-parallax="1"]').css('background-image')); 11236 11237 } else { 11238 pageHeaderAfterLoad(); 11239 } 11240 11241 11242 if ($('body[data-hhun="1"]').length > 0 && !$('#header-outer[data-remove-fixed="1"]').length > 0) { 11243 $headerOuterEl.addClass('parallax-contained'); 11244 } 11245 11246 // Calculate on scroll. 11247 window.addEventListener('scroll', function () { 11248 if( nectarDOMInfo.winW > 1000 ) { 11249 window.requestAnimationFrame(parallaxPageHeaderCalc); 11250 } 11251 }, false); 11252 11253 } 11254 11255 var $pt_timeout = ($('body[data-ajax-transitions="true"]').length > 0 && $('#page-header-bg[data-animate-in-effect="slide-down"]').length > 0) ? 350 : 0; 11256 11257 if ($pageHeaderBG.length > 0) { 11258 11259 // Slide in height effect. 11260 setTimeout(function () { 11261 pageHeaderSlideInHeight(); 11262 }, $pt_timeout); 11263 11264 $('#page-header-bg[data-animate-in-effect="fade-in"]').addClass('loaded'); 11265 11266 // Using bg classname. 11267 var $initialImgCheckAscend = extractUrl($pageHeaderBG.css('background-image'));
11268 if ($initialImgCheckAscend && $initialImgCheckAscend.indexOf('.') !== -1) { 11269 $pageHeaderBG.addClass('has-bg'); 11270 } 11271 11272 // Resize slide in height. 11273 $window.on('smartresize',pageHeaderSlideInHeight); 11274 11275 } 11276 11277 function parallaxPageHeaderCalc() { 11278 11279 var $scrollTop = nectarDOMInfo.scrollTop, 11280 $multiplier1 = 0.4, 11281 $multiplier2 = 0.09; 11282 11283 if (!$body.hasClass('mobile') && 11284 navigator.userAgent.match(/iPad/i) == null && 11285 $('body.material-ocm-open').length == 0) { 11286 11287 if( headerLayoutFormat != 'left-header' ) { 11288 11289 if (nectarDOMInfo.winW > 1000) { 11290 $('#page-header-bg').css('top', $('#ajax-content-wrap').offset().top); 11291 } else { 11292 $('#page-header-bg').css('top', '0'); 11293 } 11294 } 11295 11296 // Calc bg pos. 11297 if ($('#page-header-bg.out-of-sight').length == 0) { 11298 11299 if ($headerRemoveStickyness) { 11300 $pageHeaderBG.css({ 11301 'transform': 'translateY(' + $scrollTop * -0.55 + 'px)' 11302 }); 11303 $('#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({ 11304 'transform': 'translateY(' + $scrollTop * -0.45 + 'px)' 11305 }); 11306 11307 } else { 11308 $pageHeaderBG.css({ 11309 'transform': 'translateY(' + $scrollTop * -$multiplier1 + 'px)' 11310 }); 11311 $('#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({ 11312 'transform': 'translateY(' + $scrollTop * -$multiplier2 + 'px)' 11313 }); 11314 $('#page-header-bg .span_6 .inner-wrap, #page-header-bg[data-post-hs="default_minimal"] .author-section').css({ 11315 'opacity': 1 - ($scrollTop / (pageHeaderHeight - 60)) 11316 }); 11317 } 11318 11319 11320 if ($('#page-header-bg .span_6 .inner-wrap').css('opacity') == 0) { 11321 $('#page-header-bg .span_6 .inner-wrap, #page-header-bg .portfolio-filters').hide(); 11322 } else { 11323 $('#page-header-bg .span_6 .inner-wrap, #page-header-bg .portfolio-filters').show(); 11324 } 11325 11326 11327 } 11328 11329 // Hide elements to allow other parallax sections to work in webkit browsers. 11330 if (($scrollTop / (pageHeaderHeight + $('#header-space').height() + nectarDOMInfo.adminBarHeight)) > 1) { 11331 $('#page-header-bg, .nectar-particles, #page-header-bg .fade-out').css('visibility', 'hidden').hide().addClass('out-of-sight'); 11332 } 11333 else { 11334 $('#page-header-bg, .nectar-particles, #page-header-bg .fade-out').css('visibility', 'visible').show().removeClass('out-of-sight'); 11335 11336 // Ensure header is centered. 11337 pageHeaderHeight = parseInt($pageHeaderBG.height()); 11338 $('#page-header-bg .container > .row').css('top', 0); 11339 11340 } 11341 11342 } 11343 11344 } 11345 11346 if ($pageHeaderBG.length > 0) { 11347 11348 // Bind unload event 11349 pageHeaderUnload(); 11350 11351 // Initialize text effects. 11352 if( $('.nectar-box-roll').length == 0 ) { 11353 pageHeaderTextEffectInit(); 11354 } 11355 11356 } 11357 11358 } 11359 11360 11361 11362 11363 11364 11365 11366 /** 11367 * Page header text effect markup creation. 11368 * 11369 * @since 6.0 11370 */ 11371 function pageHeaderTextEffectMarkup() { 11372 11373 $pageHeaderBG.each(function () { 11374 11375 if ($(this).attr('data-text-effect') == 'rotate_in') { 11376 11377 var $topHeading = 'none'; 11378 11379 if ($(this).find('.span_6 h1').length > 0) { 11380 $topHeading = 'h1'; 11381 } 11382 11383 if ($topHeading != 'none') { 11384 11385 var $selector = ($(this).find('.nectar-particles').length > 0) ? '.inner-wrap.shape-1' : '.span_6'; 11386 11387 $(this).find($selector).find($topHeading).addClass('top-heading').contents().filter(function () { 11388 return this.nodeType === 3 && typeof this.data != 'undefined' && this.data.replace(/\s+/, ""); 11389 }).wrap('<span class="wraped"></span>'); 11390 11391 $(this).find($selector).find('.wraped').each(function () { 11392 11393 var textNode = $(this), 11394 text = textNode.text().split(' '), 11395 replace = ''; 11396 11397 $.each(text, function (index, value) { 11398 if (value.replace(/\s+/, "")) { 11399 replace += '<span class="wraped"><span>' + value + '</span></span> '; 11400 } 11401 });
11402 11403 textNode.replaceWith($(replace)); 11404 11405 }); 11406 11407 } 11408 11409 } 11410 11411 }); 11412 11413 } 11414 11415 11416 /** 11417 * Page header text effect animation. 11418 * 11419 * @since 6.0 11420 */ 11421 function pageHeaderTextEffect() { 11422 11423 if ($('#page-header-bg .nectar-particles').length == 0 && $('#page-header-bg[data-text-effect="none"]').length == 0 || 11424 $('.nectar-box-roll').length > 0 && $('#page-header-bg .nectar-particles').length == 0) { 11425 11426 var $selector = ($('.nectar-box-roll').length == 0) ? '#page-header-bg .span_6' : '.nectar-box-roll .overlaid-content .span_6'; 11427 11428 $($selector).find('.wraped').each(function (i) { 11429 $(this).find('span').delay(i * 370).transition({ 11430 rotateX: '0', 11431 'opacity': 1, 11432 y: 0 11433 }, 400, 'easeOutQuad'); 11434 }); 11435 11436 setTimeout(function () { 11437 11438 $($selector).find('.inner-wrap > *:not(.top-heading)').each(function (i) { 11439 $(this).delay(i * 370).transition({ 11440 rotateX: '0', 11441 'opacity': 1, 11442 y: 0 11443 }, 650, 'easeOutQuad'); 11444 }); 11445 11446 $('.scroll-down-wrap, .scroll-down-wrap .section-down-arrow').removeClass('hidden'); 11447 11448 }, $($selector).find('.wraped').length * 370); 11449 } 11450 11451 } 11452 11453 11454 /** 11455 * Page header text effect initialization. 11456 * 11457 * @since 6.0 11458 */ 11459 function pageHeaderTextEffectInit() { 11460 11461 pageHeaderTextEffectMarkup(); 11462 11463 var $effectTimeout = ($loadingScreenEl.length > 0) ? 800 : 0; 11464 11465 if ($('#page-header-bg .nectar-video-wrap video').length == 0) { 11466 setTimeout(pageHeaderTextEffect, $effectTimeout); 11467 } 11468 11469 } 11470 11471 11472 11473 11474 11475 11476 11477 /** 11478 * Permanent transparent header effect. 11479 * 11480 * @since 6.0 11481 */ 11482 function midnightInit() { 11483 11484 if ($('#header-outer[data-permanent-transparent="1"]').length > 0 && 11485 $('body[data-bg-header="true"]').length > 0) { 11486 11487 11488 // Pages that set no midnight coloring. 11489 if ($('.container-wrap div[data-midnight]').length == 0) { 11490 $('.container-wrap').attr('data-midnight', 'dark'); 11491 } 11492 11493 //// Cache midnight compat divs. 11494 var $midnightCompatArr = []; 11495 $('div[data-midnight]').each(function () { 11496 11497 if ($(this).attr('data-midnight') == 'light' && $(this).parents('.pum-content').length == 0 || 11498 $(this).attr('data-midnight') == 'dark' && $(this).parents('.pum-content').length == 0) { 11499 11500 if( $(this).is('#page-header-bg') && $(this).parents('#page-header-wrap[data-midnight]').length > 0 ) { 11501 // skip. 11502 } else { 11503 $midnightCompatArr.push($(this)); 11504 } 11505 11506 } 11507 11508 }); 11509 11510 11511 if ($midnightCompatArr.length > 0) { 11512 11513 $.each($midnightCompatArr, function (k, v) { 11514 11515 if (v.attr('data-midnight') == 'light' || v.attr('data-midnight') == 'dark') { 11516 11517 var $that = v; 11518 var waypoint = new Waypoint({ 11519 element: $that, 11520 handler: function (direction) { 11521 11522 11523 if ($('body.material-ocm-open').length > 0 || $that.css('display') == 'none' ) { 11524 return; 11525 } 11526 11527 11528 var $textColor; 11529 11530 if (direction == 'down') { 11531 $textColor = ($that.attr('data-midnight') == 'light') ? '' : 'dark-slide'; 11532 $headerOuterEl.removeClass('dark-slide').addClass($textColor); 11533 11534 } else { 11535 11536 var $prevMidItem; 11537 11538 if (k - 1 >= 0) { 11539 $prevMidItem = k - 1; 11540 } else { 11541 $prevMidItem = k; 11542 } 11543 11544 $textColor = ($midnightCompatArr[$prevMidItem].attr('data-midnight') == 'light') ? '' : 'dark-slide'; 11545 $headerOuterEl.removeClass('dark-slide').addClass($textColor); 11546 11547 } 11548 11549 }, 11550 offset: $headerOuterEl.height() 11551 11552 });
11553 11554 } 11555 11556 }); 11557 11558 } 11559 11560 } 11561 11562 11563 } 11564 11565 11566 11567 11568 /** 11569 * Box roll header effect initialization. 11570 * 11571 * @since 6.0 11572 */ 11573 function nectarBoxRollInit() { 11574 if ($('.nectar-box-roll').length > 0 && typeof NectarBoxRoll !== 'undefined') { 11575 pageHeaderTextEffectInit(); 11576 nectarBoxRoll = new NectarBoxRoll(nectarDOMInfo, waypoints, midnightInit, pageLoadHash, resizeVideoToCover); 11577 } 11578 } 11579 11580 11581 11582 11583 /** 11584 * Create all waypoints. 11585 * 11586 * @since 6.0 11587 */ 11588 function waypoints() { 11589 rowBGAnimations(); 11590 columnBGAnimations(); 11591 colAndImgAnimations(); 11592 progressBars(); 11593 dividers(); 11594 iconList(); 11595 animatedTitles(); 11596 highlightedText(); 11597 imageWithHotspots(); 11598 clientsFadeIn(); 11599 splitLineHeadings(); 11600 svgAnimations(); 11601 milestoneInit(); 11602 nectarFancyUlInit(); 11603 owl_carousel_animate(); 11604 headerRowColorInheritInit(); 11605 morphingOutlines(); 11606 animatedColBorders(); 11607 foodMenuItems(); 11608 vcWaypoints(); 11609 NectarPostGridWaypoint(); 11610 } 11611 11612 11613 11614 /** 11615 * Salient page builder elements initialization. 11616 * 11617 * @since 10.5 11618 */ 11619 function salientPageBuilderElInit() { 11620 flexsliderInit(); 11621 flickityLazyInit(); 11622 setTimeout(flickityInit, 100); 11623 twentytwentyInit(); 11624 standardCarouselInit(); 11625 productCarouselInit(); 11626 clientsCarouselInit(); 11627 carouselfGrabbingClass(); 11628 setTimeout(tabbedInit, 60); 11629 accordionInit(); 11630 accordionClickEvents(); 11631 largeIconHover(); 11632 nectarIconMatchColoring(); 11633 coloredButtons(); 11634 ctaLinkBG(); 11635 teamMemberFullscreen(); 11636 flipBoxInit(); 11637 owlCarouselInit(); 11638 mouseParallaxInit(); 11639 ulCheckmarks(); 11640 nectarFancyUlIcons(); 11641 nectarFancyBoxHover(); 11642 nectarVideoLightbox(); 11643 nectarKeyframeAssist(); 11644 morphingOutlinesInit(); 11645 nectarPostGridInit(); 11646 cascadingImageInit(); 11647 imageWithHotspotEvents(); 11648 pricingTableHeight(); 11649 pageSubmenuInit(); 11650 nectarLiquidBGs(); 11651 nectarTestimonialSliders(); 11652 nectarTestimonialSlidersEvents(); 11653 recentPostsTitleOnlyEqualHeight(); 11654 recentPostsInit(); 11655 parallaxItemHoverEffect(); 11656 fsProjectSliderInit(); 11657 postMouseEvents(); 11658 masonryPortfolioInit(); 11659 masonryBlogInit(); 11660 portfolioCustomColoring(); 11661 searchResultMasonryInit(); 11662 stickySidebarInit(); 11663 portfolioSidebarFollow(); 11664 splitLineHeadingInit(); 11665 } 11666 11667 11668 11669 11670 /***************** WooCommerce *****************/ 11671 11672 11673 /** 11674 * Add quantity buttons to WooCommerce pages 11675 * 11676 * @since 10.5 11677 */ 11678 function wooQauntityBtns() { 11679 11680 jQuery(document.body).on('updated_cart_totals', function () { 11681 11682 if ($('.plus').length == 0) { 11683 $('div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)') 11684 .addClass('buttons_added') 11685 .append('<input type="button" value="+" class="plus" />') 11686 .prepend('<input type="button" value="-" class="minus" />'); 11687 } 11688 }); 11689 11690 11691 // Quantity buttons 11692 if ($('.plus').length == 0) { 11693 11694 $('div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)') 11695 .addClass('buttons_added') 11696 .append('<input type="button" value="+" class="plus" />') 11697 .prepend('<input type="button" value="-" class="minus" />'); 11698 11699 $(document).on('click', '.plus, .minus', function () { 11700 11701 // Get values 11702 var $qty = $(this).closest('.quantity').find('.qty'), 11703 currentVal = parseFloat($qty.val()), 11704 max = parseFloat($qty.attr('max')), 11705 min = parseFloat($qty.attr('min')), 11706 step = $qty.attr('step'); 11707 11708 // Format values 11709 if (!currentVal || currentVal === '' || currentVal === 'NaN') { 11710 currentVal = 0; 11711 } 11712 if (max === '' || max === 'NaN') { 11713 max = ''; 11714 } 11715 if (min === '' || min === 'NaN') { 11716 min = 0; 11717 } 11718 if (step === 'any' || step === '' || step === undefined || parseFloat(step) === 'NaN') { 11719 step = 1; 11720 } 11721 11722 // Change the value 11723 if ($(this).is('.plus')) { 11724 11725 if (max && (max == currentVal || currentVal > max)) { 11726 $qty.val(max); 11727 } else { 11728 $qty.val(currentVal + parseFloat(step)); 11729 } 11730 11731 } else { 11732 11733 if (min && (min == currentVal || currentVal < min)) { 11734 $qty.val(min); 11735 } else if (currentVal > 0) { 11736 $qty.val(currentVal - parseFloat(step)); 11737 } 11738 11739 } 11740 11741 // Trigger change event 11742 $qty.trigger('change'); 11743 11744 });
11745 } 11746 11747 } 11748 11749 11750 11751 /** 11752 * WooCommerce plugin events. 11753 * 11754 * @since 10.5 11755 */ 11756 function wooCommerceEvents() { 11757 11758 var wooCartTimeout; 11759 11760 // Notification. 11761 $body.on('click', '.product .add_to_cart_button', function () { 11762 11763 var $productHeading = ($(this).parents('li').find('h2').length > 0) ? 'h2' : 'h3', 11764 productToAdd = $(this).parents('li').find($productHeading).text(); 11765 11766 $('#header-outer .cart-notification span.item-name').html(productToAdd); 11767 11768 }); 11769 11770 // Notification hover. 11771 $body.on('mouseenter', '#header-outer .cart-notification', function () { 11772 11773 $(this).hide(); 11774 11775 $('#header-outer .widget_shopping_cart') 11776 .addClass('open') 11777 .stop(true, true) 11778 .show(); 11779 11780 $('#header-outer .cart_list') 11781 .stop(true, true) 11782 .show(); 11783 11784 clearTimeout(wooCartTimeout); 11785 11786 }); 11787 11788 11789 // Cart dropdown. 11790 var $headerCartSelector = '#header-outer .nectar-woo-cart'; 11791 11792 if ($($headerCartSelector).length > 0) { 11793 11794 $($headerCartSelector).hoverIntent(function () { 11795 11796 $('#header-outer .widget_shopping_cart') 11797 .addClass('open') 11798 .stop(true, true) 11799 .show(); 11800 11801 $('#header-outer .cart_list') 11802 .stop(true, true) 11803 .show(); 11804 11805 clearTimeout(wooCartTimeout); 11806 11807 $('#header-outer .cart-notification').hide(); 11808 11809 }); 11810 } 11811 11812 11813 $body.on('mouseleave', $headerCartSelector, function () { 11814 var $that = $(this); 11815 setTimeout(function () { 11816 if (!$that.is(':hover')) { 11817 $('#header-outer .widget_shopping_cart') 11818 .removeClass('open') 11819 .stop(true, true) 11820 .fadeOut(300); 11821 11822 $('#header-outer .cart_list') 11823 .stop(true, true) 11824 .fadeOut(300); 11825 } 11826 }, 200); 11827 }); 11828 11829 if ($('#header-outer[data-cart="false"]').length == 0) { 11830 11831 $body.on('added_to_cart', shopping_cart_dropdown_show); 11832 $body.on('added_to_cart', shopping_cart_dropdown); 11833 11834 // Update header cart markup after ajax remove. 11835 $body.on('removed_from_cart', wooCartImgPos); 11836 } 11837 11838 function shopping_cart_dropdown() { 11839 11840 if (!$('.widget_shopping_cart .widget_shopping_cart_content .cart_list .empty').length && 11841 $('.widget_shopping_cart .widget_shopping_cart_content .cart_list').length > 0) { 11842 11843 $('.cart-menu-wrap').addClass('has_products'); 11844 $('header#top nav > ul, #search-outer #search #close a, header#top .span_9 >.slide-out-widget-area-toggle').addClass('product_added'); 11845 11846 if (!$('.cart-menu-wrap').hasClass('static')) { 11847 $('.cart-menu-wrap, #mobile-cart-link').addClass('first-load'); 11848 } 11849 11850 // Change position of img in cart nav dropdown. 11851 wooCartImgPos(); 11852 11853 } 11854 11855 } 11856 11857 11858 function shopping_cart_dropdown_show(e) { 11859 11860 clearTimeout(wooCartTimeout); 11861 11862 if (!$('.widget_shopping_cart .widget_shopping_cart_content .cart_list .empty').length && 11863 $('.widget_shopping_cart .widget_shopping_cart_content .cart_list').length > 0 && 11864 typeof e.type != 'undefined') { 11865 11866 // Standalone woocommerce add to cart buttons. 11867 if ($('#header-outer .cart-notification .item-name').length > 0 && 11868 $('#header-outer .cart-notification .item-name').text().length == 0) { 11869 return; 11870 } 11871 11872 // Before cart has slide in. 11873 if (!$('#header-outer .cart-menu-wrap').hasClass('has_products')) { 11874 11875 setTimeout(function () { 11876 $('#header-outer .cart-notification').fadeIn(400); 11877 }, 400); 11878 11879 } else if (!$('#header-outer .cart-notification').is(':visible')) { 11880 $('#header-outer .cart-notification').fadeIn(400); 11881 } else { 11882 $('#header-outer .cart-notification').show(); 11883 } 11884 wooCartTimeout = setTimeout(hideCart, 2700); 11885 11886 } 11887 } 11888 11889 function hideCart() { 11890 $('#header-outer .cart-notification').stop(true, true).fadeOut(); 11891 } 11892 11893 function checkForWooItems() { 11894 11895 var checkForCartItems = setInterval(shopping_cart_dropdown, 250); 11896 setTimeout(function () { 11897 clearInterval(checkForCartItems); 11898 }, 4500); 11899 11900 } 11901 11902 function wooCartImgPos() { 11903 $('#header-outer .widget_shopping_cart .cart_list li, #slide-out-widget-area .widget_shopping_cart .cart_list li').each(function () { 11904 11905 if ($(this).find('> img').length == 0 && $(this).find('.product-meta').length == 0) { 11906 11907 var productCartImgLinkSrc = ($(this).find('> a[href]:not(.remove)').length > 0) ? $(this).find('> a[href]:not(.remove)').attr('href') : ''; 11908 var productCartImg = $(this).find('> a > img').clone(); 11909 11910 $(this).wrapInner('<div class="product-meta" />'); 11911 $(this).prepend(productCartImg); 11912 11913 if (productCartImgLinkSrc.length > 0) { 11914 productCartImg.wrap('<a href="' + productCartImgLinkSrc + '"></a>'); 11915 } 11916 11917 } 11918 11919 });
11920 } 11921 11922 if ($('#header-outer[data-cart="false"]').length == 0) { 11923 checkForWooItems(); 11924 } 11925 11926 function nectarAccountPageTabs() { 11927 11928 // Not on account page. 11929 if ($('body.woocommerce-account #customer_login').length == 0) { 11930 return; 11931 } 11932 11933 // Create HTML. 11934 $('.woocommerce-account .woocommerce > #customer_login').prepend('<div class="nectar-form-controls" />'); 11935 11936 $('.woocommerce-account .woocommerce > #customer_login > div:not(.nectar-form-controls)').each(function () { 11937 var $title = $(this).find('> h2').text(); 11938 $('#customer_login .nectar-form-controls').append('<div class="control">' + $title + '</div>'); 11939 }); 11940 11941 // Click event. 11942 $('.woocommerce-account .woocommerce > #customer_login .nectar-form-controls .control').on('click', function () { 11943 11944 $('.woocommerce-account .woocommerce > #customer_login .nectar-form-controls .control').removeClass('active'); 11945 $(this).addClass('active'); 11946 11947 var formIndex = $(this).index() + 1; 11948 $('#customer_login div[class*="u-column"]').hide(); 11949 $('#customer_login div[class*="u-column"].col-' + formIndex).show(); 11950 11951 setTimeout(function () { 11952 $('#customer_login div[class*="u-column"]').removeClass('visible'); 11953 $('#customer_login div[class*="u-column"].col-' + formIndex).addClass('visible'); 11954 }, 30); 11955 11956 }); 11957 11958 // Starting. 11959 $('.woocommerce-account .woocommerce > #customer_login .nectar-form-controls .control:nth-child(1)').trigger('click'); 11960 11961 } 11962 11963 nectarAccountPageTabs(); 11964 11965 // Text on hover effect. 11966 $body.on('mouseover', '.text_on_hover .product-wrap, .text_on_hover > a:first-child', function () { 11967 $(this).parent().addClass('hovered'); 11968 }); 11969 11970 $body.on('mouseout', '.text_on_hover .product-wrap, .text_on_hover > a:first-child', function () { 11971 $(this).parent().removeClass('hovered'); 11972 }); 11973 11974 11975 // Material/fancy parallax hover effect zindex. 11976 if ($('.material.product').length > 0 || 11977 $('.minimal.product').length > 0 || 11978 $('.nectar-fancy-box[data-style="parallax_hover"]').length > 0 || 11979 $('.nectar-category-grid[data-shadow-hover="yes"]').length > 0 || 11980 $('.nectar-post-grid[data-shadow-hover="yes"]').length > 0) { 11981 11982 var $productZindex = 101; 11983 11984 $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 () { 11985 $productZindex++; 11986 $(this).css('z-index', $productZindex + 1); 11987 }); 11988 11989 $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 () { 11990 11991 var $that = $(this); 11992 setTimeout(function () { 11993 if (!$that.is(':hover')) { 11994 $that.css('z-index', 100); 11995 } 11996 }, 350); 11997 }); 11998 11999 // Reset to stop zindex from getting too high. 12000 setInterval(function () { 12001 if ($('.nectar-fancy-box[data-style="parallax_hover"]:hover').length > 0 || 12002 $('.minimal.product:hover').length > 0) { 12003 return; 12004 } 12005 12006 $('.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); 12007 $productZindex = 101; 12008 }, 10000); 12009 12010 } 12011 12012 function minimalProductHover() { 12013 12014 // Add icons. 12015 $('.products .classic .product-wrap .add_to_cart_button').wrapInner('<span />'); 12016 $('.products .classic .product-wrap .add_to_cart_button').prepend('<i class="normal icon-salient-cart"></i>'); 12017 12018 // Bind hover. 12019 $body.on('mouseover', '.products .minimal.product', function () { 12020 minimalProductCalc($(this)); 12021 });
12022 12023 $body.on('mouseleave', '.products .minimal.product', function () { 12024 12025 $(this).find('.background-color-expand').css({ 12026 'transform': 'scale(1)' 12027 }); 12028 12029 }); 12030 12031 // Starting trigger mouse over. 12032 $('.products .minimal.product').each(function () { 12033 if ($(this).is(':hover')) { 12034 $(this).trigger('mouseover'); 12035 } 12036 }); 12037 } 12038 12039 function minimalProductCalc(el) { 12040 12041 var $item = el, 12042 $itemWidth = $item.width(), 12043 $itemHeight = $item.height(), 12044 $wChange = (parseInt($itemWidth) + 40) / parseInt($itemWidth), 12045 $hChange = (parseInt($itemHeight) + 40) / parseInt($itemHeight); 12046 12047 $item.addClass('hover-bound'); 12048 12049 $item.find('.background-color-expand').css({ 12050 'transform': 'scale(' + $wChange + ',' + $hChange + ') translateY(0px)' 12051 }); 12052 12053 } 12054 12055 minimalProductHover(); 12056 12057 12058 12059 // Mobile widget filters. 12060 $('.woocommerce #sidebar .widget.woocommerce').each(function () { 12061 12062 // Skip widgets without any titles. 12063 if ($(this).find('> h4').length == 0) { 12064 $(this).addClass('no-widget-title'); 12065 } 12066 }); 12067 12068 $body.on('click', '#sidebar .widget.woocommerce:not(.widget_price_filter) h4', function () { 12069 12070 if ($window.width() < 1000) { 12071 12072 if ($(this).parent().is('.widget_product_tag_cloud')) { 12073 $(this).parent().find('> div').slideToggle(); 12074 } 12075 if ($(this).parent().is('.woocommerce-widget-layered-nav') && $(this).parent().find('> .woocommerce-widget-layered-nav-dropdown').length > 0) { 12076 $(this).parent().find('> .woocommerce-widget-layered-nav-dropdown').slideToggle(); 12077 } 12078 12079 $(this).parent().find('> ul').slideToggle(); 12080 12081 $(this).parent().toggleClass('open-filter'); 12082 } 12083 12084 }); 12085 12086 // Slide in cart event. 12087 $body.on('mouseenter', '#header-outer [data-cart-style="slide_in"] .cart-menu-wrap', openRightCart); 12088 12089 function openRightCart() { 12090 12091 if ($('.nectar-slide-in-cart ul.cart_list li:not(.empty)').length > 0) { 12092 12093 $('.nectar-slide-in-cart').addClass('open'); 12094 $window.on('mousemove.rightCartOffsetCheck', closeCartCheck); 12095 12096 } 12097 } 12098 12099 function closeCartCheck(e) { 12100 12101 var $windowWidth = $window.width(); 12102 if (e.clientX < $windowWidth - 370 - $bodyBorderWidth) { 12103 12104 $window.off('mousemove.rightCartOffsetCheck', closeCartCheck); 12105 12106 $('.nectar-slide-in-cart').removeClass('open'); 12107 12108 } 12109 12110 } 12111 12112 // Add quantity buttons if needed. 12113 wooQauntityBtns(); 12114 12115 } 12116 12117 12118 12119 12120 12121 /** 12122 * Search in navigation functionality. 12123 * 12124 * @since 10.5 12125 */ 12126 12127 function navigationSearchInit() { 12128 12129 var $placeholder = ($('#search-outer #search input[type=text][data-placeholder]').length > 0) ? $('#search-outer #search input[type=text]').attr('data-placeholder') : ''; 12130 12131 // Material skin add search BG markup. 12132 if ($body.hasClass('material') && $('#header-outer .bg-color-stripe').length == 0) { 12133 $headerOuterEl.append('<div class="bg-color-stripe" />'); 12134 } 12135 12136 // Prevent jumping on click. 12137 $body.on('click', '#search-btn a', function () { 12138 return false; 12139 }); 12140 12141 // Open search on mouseup. 12142 $body.on('click', '#search-btn a:not(.inactive), #header-outer .mobile-search', function () { 12143 12144 if ($(this).hasClass('open-search')) { 12145 return false; 12146 } 12147 12148 // Close menu on original skin. 12149 if( $body.hasClass('original') && $('.slide-out-widget-area-toggle.mobile-icon a.open').length > 0 ) { 12150 $('.slide-out-widget-area-toggle.mobile-icon a') 12151 .addClass('non-human-allowed') 12152 .trigger('click'); 12153 12154 setTimeout(function () { 12155 $('.slide-out-widget-area-toggle.mobile-icon a').removeClass('non-human-allowed'); 12156 }, 100); 12157 } 12158 12159 if ($body.hasClass('ascend') || 12160 $('body[data-header-format="left-header"]').length > 0 && $('body.material').length == 0) { 12161 12162 // Ascend theme skin. 12163 $('#search-outer > #search form, #search-outer #search .span_12 span, #search-outer #search #close').css('opacity', 0); 12164 12165 $('#search-outer > #search form').css('transform', 'translateY(-30px)'); 12166 $('#search-outer #search .span_12 span').css('transform', 'translateY(20px)'); 12167 12168 $('#search-outer').show(); 12169 $('#search-outer').stop().transition({ 12170 scale: '1,0', 12171 'opacity': 1 12172 }, 0).transition({ 12173 scale: '1,1' 12174 }, 700, 'cubic-bezier(0.2, 1, 0.3, 1)'); 12175 12176 $('#search-outer > #search form').delay(350).transition({ 12177 'opacity': 1, 12178 'transform': 'translateY(0)' 12179 }, 700, 'cubic-bezier(0.2, 1, 0.3, 1)'); 12180 12181 $('#search-outer #search #close').delay(500).transition({ 12182 'opacity': 1 12183 }, 700, 'cubic-bezier(0.2, 1, 0.3, 1)'); 12184 12185 12186 $('#search-outer #search .span_12 span').delay(450).transition({ 12187 'opacity': 1, 12188 'transform': 'translateY(0)' 12189 }, 700, 'cubic-bezier(0.2, 1, 0.3, 1)'); 12190 12191 } 12192 12193 else if (!$body.hasClass('material')) { 12194 // Original theme skin. 12195 $('#search-outer').stop(true).fadeIn(600, 'easeOutExpo'); 12196 } 12197 else { 12198 12199 // Material theme skin. 12200 $('#header-outer[data-transparent-header="true"] .bg-color-stripe').css('transition', ''); 12201 $('#search-outer, #ajax-content-wrap').addClass('material-open'); 12202 $headerOuterEl.addClass('material-search-open'); 12203 $('#fp-nav').addClass('material-ocm-open'); 12204 12205 } 12206 12207 12208 setTimeout(function () { 12209 12210 $('#search input[type=text]').trigger('focus'); 12211 12212 if ($('#search input[type=text]').attr('value') == $placeholder) { 12213 $('#search input[type=text]').setCursorPosition(0); 12214 } 12215 12216 }, 300); 12217 12218 12219 $(this).toggleClass('open-search'); 12220 12221 // Close slide out widget area. 12222 $('.slide-out-widget-area-toggle a:not(#toggle-nav).open:not(.animating)').trigger('click'); 12223 12224 return false; 12225 12226 });
12227 12228 // Handle the placeholder value. 12229 $('body:not(.material)').on('keydown', '#search input[type=text]', function () { 12230 if ($(this).attr('value') == $placeholder) { 12231 $(this).attr('value', ''); 12232 } 12233 }); 12234 12235 $('body:not(.material)').on('keyup', '#search input[type=text]', function () { 12236 if ($(this).attr('value') == '') { 12237 $(this).attr('value', $placeholder); 12238 $(this).setCursorPosition(0); 12239 } 12240 }); 12241 12242 12243 // Close search btn event. 12244 $body.on('click', '#close', function () { 12245 closeSearch(); 12246 $searchButtonEl.removeClass('open-search'); 12247 $('#header-outer .mobile-search').removeClass('open-search'); 12248 return false; 12249 }); 12250 12251 // Original and Ascend skin close search when clicking off. 12252 $('body:not(.material)').on('blur', '#search-box input[type=text]', function () { 12253 closeSearch(); 12254 $searchButtonEl.removeClass('open-search'); 12255 $('#header-outer .mobile-search').removeClass('open-search'); 12256 }); 12257 12258 12259 // Material skin close when clicking off the search. 12260 $('body.material').on('click', '#ajax-content-wrap', function (e) { 12261 if (e.originalEvent !== undefined) { 12262 closeSearch(); 12263 $searchButtonEl.removeClass('open-search'); 12264 $('#header-outer .mobile-search').removeClass('open-search'); 12265 } 12266 }); 12267 12268 // Material skin close on esc button event. 12269 if ($('body.material').length > 0) { 12270 $(document).on('keyup', function (e) { 12271 12272 if (e.keyCode == 27) { 12273 closeSearch(); 12274 $searchButtonEl.removeClass('open-search'); 12275 12276 // Close ocm material 12277 if ($('.ocm-effect-wrap.material-ocm-open').length > 0) { 12278 $('.slide-out-widget-area-toggle.material-open a').trigger('click'); 12279 } 12280 } 12281 12282 }); 12283 } 12284 12285 12286 12287 // Called to hide the search bar. 12288 function closeSearch() { 12289 12290 if ($body.hasClass('ascend') || $('body[data-header-format="left-header"]').length > 0 && $('body.material').length == 0) { 12291 $('#search-outer').stop().transition({ 12292 'opacity': 0 12293 }, 300, 'cubic-bezier(0.2, 1, 0.3, 1)'); 12294 $searchButtonEl.addClass('inactive'); 12295 setTimeout(function () { 12296 $('#search-outer').hide(); 12297 $searchButtonEl.removeClass('inactive'); 12298 }, 300); 12299 } else if ($('body.material').length == 0) { 12300 $('#search-outer').stop(true).fadeOut(450, 'easeOutExpo'); 12301 } 12302 12303 if ($body.hasClass('material')) { 12304 $('#ajax-content-wrap').removeClass('material-open'); 12305 $headerOuterEl.removeClass('material-search-open'); 12306 $('#search-outer').removeClass('material-open'); 12307 $('#fp-nav').removeClass('material-ocm-open'); 12308 } 12309 12310 } 12311 12312 } 12313 12314 12315 12316 12317 12318 12319 /** 12320 * Header layout "Centered header bottom bar" functionality. 12321 * 12322 * @since 9.0 12323 */ 12324 function centeredNavBottomBarReposition() { 12325 12326 var $headerOuter = $headerOuterEl, 12327 $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'), 12328 $headerSpan3 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_3'), 12329 $secondaryHeader = $headerSecondaryEl, 12330 $headerBtns = $headerSpan3.find('nav >ul.buttons'), 12331 $navLogoMargin = parseInt($('body.material #header-outer').attr('data-padding')), 12332 $navLogoHeight = parseInt($('body.material #header-outer').attr('data-logo-height')), 12333 $triggerCondition = ($navLogoMargin*2) + $navLogoHeight - parseInt(nectarDOMInfo.adminBarHeight) + parseInt(nectarDOMInfo.secondaryHeaderHeight); 12334 12335 if ($secondaryHeader.length > 0) { 12336 12337 if ($('#header-outer[data-remove-fixed="1"]').length == 0 && $('#header-outer[data-condense="true"]').length > 0) { 12338 12339 setTimeout(function () { 12340 if( $headerSecondaryEl.css('display') != 'none' ) { 12341 nectarDOMInfo.secondaryHeaderHeight = $headerSecondaryEl.outerHeight(); 12342 } 12343 12344 }, 50); 12345 } 12346 12347 } 12348 12349 // Helper to determine if custom mobile breakpoint is active. 12350 function condenseCustomBreakPointHelper() { 12351 var $withinCustomBreakpoint = mobileBreakPointCheck(); 12352 12353 // Adding class to prevent logo from hiding when opening OCM 12354 if ( $withinCustomBreakpoint ) { 12355 $headerOuterEl.addClass('within-custom-breakpoint'); 12356 } else { 12357 $headerOuterEl.removeClass('within-custom-breakpoint'); 12358 } 12359 } 12360 12361 12362 // Bind events if "Condense Header On Scroll" effect is enabled. 12363 if ($('#header-outer[data-condense="true"]').length > 0) { 12364 12365 $window.on('scroll.centeredNavCondense', centeredNavBottomFixed_Scroll); 12366 $window.trigger('scroll'); 12367 12368 $window.on('resize', function(){ 12369 if(nectarDOMInfo.winW < 1000 ) { 12370 $headerOuter.addClass('force-condense-remove'); 12371 $window.off('scroll.centeredNavCondense'); 12372 } 12373 });
12374 12375 $window.smartresize(function () { 12376 condenseCustomBreakPointHelper(); 12377 12378 if(nectarDOMInfo.winW >= 1000 ) { 12379 12380 // Coming from mobile. 12381 if($headerOuter.hasClass('force-condense-remove')) { 12382 12383 // Remove condense effect. 12384 centeredNavBottomFixed_Scroll(); 12385 $headerOuter.removeClass('force-condense-remove'); 12386 12387 // See if the condense effect needs to be reapplied. 12388 setTimeout(function() { 12389 12390 if(nectarDOMInfo.scrollTop >= $triggerCondition) { 12391 $headerOuter.addClass('force-condense'); 12392 centeredNavBottomFixed_Scroll(); 12393 $headerOuter.removeClass('force-condense'); 12394 } 12395 // Bind scroll event. 12396 $window.on('scroll.centeredNavCondense', centeredNavBottomFixed_Scroll); 12397 },200); 12398 12399 } 12400 } 12401 12402 }); 12403 12404 condenseCustomBreakPointHelper(); 12405 12406 } 12407 12408 12409 12410 function centeredNavBottomFixed_Scroll() { 12411 12412 // Bypass calculating. 12413 if (nectarDOMInfo.winW < 1000 || 12414 $('body.material-ocm-open').length > 0 || 12415 $('#header-outer[data-has-menu="true"][data-format="centered-menu-bottom-bar"] .span_9').css('display') == 'none') { 12416 return; 12417 } 12418 12419 $bodyBorderTop = ($bodyBorderTop.length > 0 && nectarDOMInfo.secondaryHeaderHeight > 0) ? $bodyBorderTop.height() : 0; 12420 12421 // Add condense effect. 12422 if ($headerOuter.hasClass('force-condense') || !$headerOuter.hasClass('fixed-menu') && nectarDOMInfo.scrollTop >= $triggerCondition) { 12423 12424 var amountToMove = (parseInt($headerSpan9.position().top) - $navLogoMargin - parseInt(nectarDOMInfo.adminBarHeight)) + parseInt(nectarDOMInfo.secondaryHeaderHeight) - $bodyBorderTop; 12425 12426 // Megamenu removes transparency option 12427 if ($('#header-outer[data-megamenu-rt="1"]').length > 0 && $('#header-outer .megamenu').length > 0 && $('#header-outer[data-transparent-header="true"]').length > 0) { 12428 $headerOuterEl.removeClass('no-transition'); 12429 } 12430 12431 $headerOuter.addClass('fixed-menu').removeClass('transparent').css({ 12432 'top': '-' + amountToMove + 'px', 12433 'position': 'fixed' 12434 }); 12435 12436 var $headerNavBarOffset = $('header#top .span_9 nav >ul').offset().top; 12437 var $headerButtonsOffset = $headerBtns.offset().top; 12438 12439 12440 var $headerButtonsHeight = ($headerSpan9.find('.sf-menu > li > a').length > 0) ? (20 - parseInt($headerSpan9.find('.sf-menu > li > a').height())) / 2 : 2; 12441 12442 $headerBtns.css('transform', 'translateY(' + (parseInt($headerNavBarOffset) - parseInt($headerButtonsOffset) - $headerButtonsHeight - 1) + 'px)'); 12443 $headerBtns.find('.nectar-woo-cart').css('height', $headerOuter.height() + parseInt($headerOuter.css('top')) - parseInt(nectarDOMInfo.adminBarHeight)); 12444 12445 } 12446 12447 // Remove condense effect. 12448 else if ($headerOuter.hasClass('force-condense-remove') || $headerOuter.hasClass('fixed-menu') && nectarDOMInfo.scrollTop < $triggerCondition ) { 12449 12450 $headerOuter.removeClass('fixed-menu').css({ 12451 'top': '0', 12452 'position': 'absolute' 12453 }); 12454 12455 $headerBtns.css('transform', 'translateY(0px)'); 12456 $headerBtns.find('.nectar-woo-cart').css('height', ''); 12457 12458 if ($('#header-outer.transparent').length == 0) { 12459 12460 if ($('#header-outer[data-megamenu-rt="1"]').length > 0 && 12461 $('#header-outer .megamenu').length > 0) { 12462 $headerOuterEl.removeClass('no-transition'); 12463 } 12464 12465 if ($('#header-outer[data-megamenu-rt="1"]').length > 0 && 12466 $('#header-outer[data-transparent-header="true"]').length > 0 && 12467 $('#header-outer .megamenu').length > 0) { 12468 12469 if ($headerOuterEl.attr('data-transparent-header') == 'true' && 12470 $('.nectar-box-roll').length == 0 && 12471 $('.megamenu.sfHover').length == 0) { 12472 12473 $headerOuterEl.addClass('transparent'); 12474 $headerOuterEl.removeClass('no-transition'); 12475 12476 } 12477 else if ($headerOuterEl.attr('data-transparent-header') == 'true' && 12478 $('.nectar-box-roll').length == 0 && 12479 $('.megamenu.sfHover').length > 0) { 12480 12481 $headerOuterEl.addClass('no-transition'); 12482 } 12483 12484 } 12485 12486 else { 12487 if ($headerOuterEl.attr('data-transparent-header') == 'true' && $('.nectar-box-roll').length == 0) { 12488 $headerOuterEl.addClass('transparent'); 12489 } 12490 } 12491 12492 } // endif transparent header conditional. 12493 12494 12495 }
12495 // End Remove condense effect. 12496 12497 } // End centeredNavBottomFixed_Scroll. 12498 12499 12500 12501 } 12502 12503 12504 12505 12506 /** 12507 * Header layout "Centered header bottom bar" initialization. 12508 * 12509 * @since 10.5 12510 */ 12511 function centeredNavBottomBarInit() { 12512 12513 if ($('#header-outer[data-format="centered-menu-bottom-bar"]').length > 0) { 12514 centeredNavBottomBarReposition(); 12515 } 12516 12517 } 12518 12519 12520 12521 12522 12523 /** 12524 * Header layout "Centered logo between menu". 12525 * 12526 * Splits the main navigation menu into two sections placed on each side of logo. 12527 * 12528 * @since 8.0 12529 */ 12530 function centeredLogoMargins() { 12531 12532 if (nectarDOMInfo.winW > 1000) { 12533 12534 var $navItemLength = $('#header-outer[data-format="centered-logo-between-menu"] #top nav > .sf-menu:not(.buttons) > li').length; 12535 12536 if ($('#header-outer #social-in-menu').length > 0) { 12537 $navItemLength--; 12538 } 12539 12540 var $centerLogoWidth, 12541 $extraMenuSpace; 12542 12543 if ($('#header-outer #top .row .col.span_3 #logo img:visible').length == 0) { 12544 $centerLogoWidth = parseInt($('#header-outer #top .row .col.span_3').width()); 12545 } else { 12546 $centerLogoWidth = parseInt($('#header-outer #top .row .col.span_3 img:visible').width()); 12547 } 12548 12549 if ($('#header-outer[data-lhe="animated_underline"]').length > 0) { 12550 $extraMenuSpace = parseInt($('header#top nav > ul > li:first-child > a').css('margin-right')); 12551 } else { 12552 $extraMenuSpace = parseInt($('header#top nav > ul > li:first-child > a').css('padding-right')); 12553 } 12554 12555 if ($extraMenuSpace > 30) { 12556 $extraMenuSpace += 45; 12557 } else if ($extraMenuSpace > 20) { 12558 $extraMenuSpace += 40; 12559 } else { 12560 $extraMenuSpace += 30; 12561 } 12562 12563 if (!$body.hasClass('rtl')) { 12564 $('#header-outer[data-format="centered-logo-between-menu"] #top nav > .sf-menu:not(.buttons) > li:nth-child(' + Math.floor($navItemLength / 2) + ')').css({ 12565 'margin-right': ($centerLogoWidth + $extraMenuSpace) + 'px' 12566 }).addClass('menu-item-with-margin'); 12567 } else { 12568 $('#header-outer[data-format="centered-logo-between-menu"] #top nav > .sf-menu:not(.buttons) > li:nth-child(' + Math.floor($navItemLength / 2) + ')').css({ 12569 'margin-left': ($centerLogoWidth + $extraMenuSpace) + 'px' 12570 }).addClass('menu-item-with-margin'); 12571 } 12572 12573 var $leftMenuWidth = 0; 12574 var $rightMenuWidth = 0; 12575 12576 $('#header-outer[data-format="centered-logo-between-menu"] #top nav > .sf-menu:not(.buttons) > li:not(#social-in-menu)').each(function (i) { 12577 if (i + 1 <= Math.floor($navItemLength / 2)) { 12578 $leftMenuWidth += $(this).width(); 12579 } else { 12580 $rightMenuWidth += $(this).width(); 12581 } 12582 12583 }); 12584 12585 var $menuDiff = Math.abs($rightMenuWidth - $leftMenuWidth); 12586 12587 if ($leftMenuWidth > $rightMenuWidth || ($body.hasClass('rtl') && $leftMenuWidth < $rightMenuWidth) ) { 12588 $('#header-outer #top .row > .col.span_9').css('padding-right', $menuDiff); 12589 } else { 12590 $('#header-outer #top .row > .col.span_9').css('padding-left', $menuDiff); 12591 } 12592 12593 $('#header-outer[data-format="centered-logo-between-menu"] nav').css('visibility', 'visible'); 12594 12595 } 12596 12597 else if ($('#header-outer[data-format="centered-logo-between-menu"]').length > 0 && nectarDOMInfo.winW < 1000) { 12598 $('#header-outer .row > .col.span_9').css({ 12599 'padding-right': '0', 12600 'padding-left': '0' 12601 }); 12602 } 12603 12604 } 12605 12606 12607 /** 12608 * Header layout "Centered logo between menu" initialization. 12609 * 12610 * @since 10.5 12611 */ 12612 function centeredLogoHeaderInit() { 12613 12614 if($('#header-outer[data-format="centered-logo-between-menu"]').length > 0) { 12615 12616 if(!usingLogoImage) { 12617 centeredLogoMargins(); 12618 } 12619 else if(usingLogoImage && $('#header-outer[data-format="centered-logo-between-menu"]').length > 0 && $('header#top #logo img:first[src]').length > 0) { 12620 12621 //fadein img on load 12622 var tempLogoImg = new Image(); 12623 tempLogoImg.src = $('header#top #logo img:first').attr('src'); 12624 12625 tempLogoImg.onload = function() { 12626 centeredLogoMargins(); 12627 }; 12628 12629 } 12630 12631 // Resize event. 12632 $window.on('smartresize', centeredLogoMargins); 12633 12634 } 12635 12636 } 12637 12638 12639 12640 12641 12642 12643 12644 12645 /** 12646 * Handle basic items before initializing effects. 12647 * 12648 * @since 10.5 12649 */ 12650 function headerNavPreInit() { 12651 12652 // Deactivate hide header until needed effect on mobile. 12653 if (nectarDOMInfo.usingMobileBrowser && $('#header-outer[data-remove-fixed="1"]').length == 0) { 12654 $body.attr('data-hhun', '0'); 12655 } 12656 12657 // Page fullscreen rows does not need permanent transparent. 12658 if ($('#nectar_fullscreen_rows').length > 0) { 12659 ($headerOuterEl.attr('data-permanent-transparent', 'false')); 12660 } 12661 12662 // Set mobile header height. 12663 if (nectarDOMInfo.usingMobileBrowser && $('#header-outer[data-mobile-fixed="1"]').length > 0 && 12664 $('#header-outer[data-transparent-header="true"]').length == 0) { 12665 $('#header-space').css('height', $headerOuterEl.outerHeight()); 12666 } 12667 12668 } 12669 12670 12671 12672 12673 12674 12675 /** 12676 * Hide header until needed. 12677 * 12678 * Used when "Header Hide Until Needed" is active. 12679 * 12680 * @since 10.5 12681 */ 12682 function hhunHeaderEffect() { 12683 12684 var previousScroll = 0, // previous scroll position
12685 menuOffset = 250, // height of menu (once scroll passed it, menu is hidden) 12686 hideShowOffset = 6; // scrolling value after which triggers hide/show menu 12687 12688 // Called in RAF loop to calculate the header visibility. 12689 function hhunCalcs() { 12690 12691 $headerOuterEl.addClass('detached'); 12692 12693 var currentScroll = nectarDOMInfo.scrollTop, // Gets current scroll position 12694 scrollDifference = Math.abs(currentScroll - previousScroll); // Calculates how fast user is scrolling 12695 12696 // Stop scrolling while animated anchors / box roll 12697 if ($('body.animated-scrolling').length > 0 && $('#header-outer.detached').length > 0 || $('body.no-scroll').length > 0) { 12698 12699 if (nectarDOMInfo.winW > 999) { 12700 12701 if (currentScroll > menuOffset) { 12702 12703 // Alter scroll tracking to continue hiding menu. 12704 previousScroll = nectarDOMInfo.scrollTop; 12705 currentScroll = nectarDOMInfo.scrollTop; 12706 12707 } 12708 12709 requestAnimationFrame(hhunCalcs); 12710 return; 12711 } 12712 } 12713 12714 // Stop when material ocm or material search is open 12715 if ($('body.material-ocm-open').length > 0 || $('#search-outer.material-open').length > 0) { 12716 if (nectarDOMInfo.winW > 999) { 12717 requestAnimationFrame(hhunCalcs); 12718 return; 12719 } 12720 } 12721 12722 // Stop on mobile if not using sticky option 12723 if ($('#header-outer[data-mobile-fixed="false"]').length > 0 && $('body.mobile').length > 0) { 12724 $headerOuterEl.removeClass('detached'); 12725 return; 12726 } 12727 12728 12729 12730 if (!$headerOuterEl.hasClass('side-widget-open') && !$('#header-outer .slide-out-widget-area-toggle a').hasClass('animating')) { 12731 12732 var heightToAdjust; 12733 12734 // Remove transparent and body border margin 12735 if (currentScroll > 1) { 12736 if ($('#header-outer[data-permanent-transparent="1"]').length == 0) { 12737 $headerOuterEl.removeClass('transparent'); 12738 $headerOuterEl.addClass('scrolling'); 12739 } 12740 12741 // Handle secondary header 12742 if ($headerSecondaryEl.length > 0) { 12743 if (currentScroll > menuOffset) { 12744 $headerSecondaryEl.addClass('hide-up'); 12745 $headerOuterEl.css('transform', 'translateY(-' + nectarDOMInfo.secondaryHeaderHeight + 'px)'); 12746 } else { 12747 $headerSecondaryEl.removeClass('hide-up'); 12748 $headerOuterEl.css('transform', '0px)'); 12749 } 12750 } 12751 12752 } 12753 12754 // Scrolled past menu 12755 if (currentScroll > menuOffset) { 12756 12757 // Scrolled past detach point add class to fix menu 12758 if (!$headerOuterEl.hasClass('detached')) { 12759 12760 $headerOuterEl 12761 .addClass('detached') 12762 .removeClass('parallax-contained'); 12763 } 12764 12765 $headerOuterEl.removeClass('no-transition'); 12766 12767 12768 // Scrolling faster than hideShowOffset hide/show menu 12769 if (scrollDifference >= hideShowOffset) { 12770 12771 if (currentScroll > previousScroll) { 12772 12773 // Hide menu 12774 if (!$headerOuterEl.hasClass('invisible')) { 12775 12776 $headerOuterEl 12777 .addClass('invisible') 12778 .removeClass('at-top'); 12779 12780 // Close submenus 12781 if ($(".sf-menu").length > 0 && $().superfish) { 12782 $(".sf-menu").superfish('hide'); 12783 $('header#top nav > ul.sf-menu > li.menu-item-over').removeClass('menu-item-over'); 12784 } 12785 12786 } 12787 12788 $('.page-submenu.stuck') 12789 .css('transform', 'translateY(0px)') 12790 .addClass('header-not-visible'); 12791 12792 } else { 12793 12794 // Show menu 12795 if ($headerOuterEl.hasClass('invisible')) { 12796 $headerOuterEl.removeClass('invisible'); 12797 } 12798 12799 // Page submenu adjust 12800 heightToAdjust = $headerOuterEl.outerHeight(); 12801 12802 if( $headerSecondaryEl.length > 0) { 12803 heightToAdjust -= nectarDOMInfo.secondaryHeaderHeight; 12804 } 12805 12806 if ($bodyBorderTop.length > 0 && $('body.mobile').length == 0) { 12807 12808 $bodyBorderSizeToRemove = ($bodyBorderHeaderColorMatch) ? $bodyBorderTop.height() : 0; 12809 12810 $('.page-submenu.stuck') 12811 .css('transform', 'translateY(' + (heightToAdjust - $bodyBorderSizeToRemove) + 'px)') 12812 .removeClass('header-not-visible'); 12813 12814 } else { 12815 $('.page-submenu.stuck') 12816 .css('transform', 'translateY(' + heightToAdjust + 'px)') 12817 .removeClass('header-not-visible'); 12818 } 12819 12820 } 12821 } 12822 12823 } else { 12824 12825 12826 var $topDetachNum = ($('#header-outer[data-using-secondary="1"]').length > 0) ? 32 : 0; 12827 if ($bodyBorderTop.length > 0) { 12828 $topDetachNum = ($('#header-outer[data-using-secondary="1"]').length > 0) ? 32 + $bodyBorderTop.height() : $bodyBorderTop.height(); 12829 } 12830 12831 if (currentScroll <= $topDetachNum) { 12832 12833 $headerOuterEl 12834 .addClass('at-top') 12835 .removeClass('invisible') 12836 .removeClass('scrolling'); 12837 12838 if ($('#header-outer[data-megamenu-rt="1"]').length > 0 && 12839 $('#header-outer[data-transparent-header="true"]').length > 0 && 12840 $('#header-outer .megamenu').length > 0) { 12841 12842 if ($('#header-outer[data-transparent-header="true"]').length > 0 && 12843 $('.nectar-box-roll').length == 0 && 12844 $('.megamenu.sfHover').length == 0) { 12845 12846 $headerOuterEl 12847 .addClass('transparent') 12848 .css('transform', 'translateY(0)') 12849 .removeClass('no-transition'); 12850 12851 } else if ($('.nectar-box-roll').length > 0) { 12852 12853 $headerOuterEl 12854 .css('transform', 'translateY(0)') 12855 .addClass('at-top-before-box'); 12856 } 12857 12858 } else { 12859 12860 if ($('#header-outer[data-transparent-header="true"]').length > 0 && 12861 $('.nectar-box-roll').length == 0) { 12862 12863 $headerOuterEl 12864 .addClass('transparent') 12865 .css('transform', 'translateY(0)'); 12866 12867 } else if ($('.nectar-box-roll').length > 0) { 12868 12869 $headerOuterEl 12870 .css('transform', 'translateY(0)') 12871 .addClass('at-top-before-box'); 12872 } 12873 } 12874
12875 if ($('#page-header-bg[data-parallax="1"]').length > 0) { 12876 12877 $headerOuterEl 12878 .addClass('parallax-contained') 12879 .css('transform', 'translateY(0)'); 12880 } 12881 12882 } 12883 12884 } 12885 12886 // At the bottom of document - show menu 12887 if ((nectarDOMInfo.winH + window.scrollY) >= document.body.offsetHeight) { 12888 12889 $headerOuterEl.removeClass('invisible'); 12890 12891 // Page submenu adjust 12892 heightToAdjust = $headerOuterEl.outerHeight(); 12893 if( $headerSecondaryEl.length > 0) { 12894 heightToAdjust -= nectarDOMInfo.secondaryHeaderHeight; 12895 } 12896 12897 if ($bodyBorderTop.length > 0 && $('body.mobile').length == 0) { 12898 12899 $bodyBorderSizeToRemove = ($bodyBorderHeaderColorMatch) ? $bodyBorderTop.height() : 0; 12900 $('.page-submenu.stuck') 12901 .css('transform', 'translateY(' + (heightToAdjust - $bodyBorderSizeToRemove) + 'px)') 12902 .removeClass('header-not-visible'); 12903 } else { 12904 12905 $('.page-submenu.stuck') 12906 .css('transform', 'translateY(' + heightToAdjust + 'px)') 12907 .removeClass('header-not-visible'); 12908 } 12909 12910 } 12911 12912 } 12913 12914 // Keep track of current scroll position 12915 previousScroll = currentScroll; 12916 12917 if (nectarDOMInfo.winW > 999) { 12918 requestAnimationFrame(hhunCalcs); 12919 } 12920 12921 } 12922 12923 // Start the animation loop. 12924 hhunCalcs(); 12925 12926 } 12927 12928 12929 12930 /** 12931 * Shrink the header navigation size. 12932 * 12933 * Used when "Header Resize On Scroll" is active. 12934 * 12935 * @since 1.0 12936 */ 12937 function smallNav() { 12938 12939 var $offset = nectarDOMInfo.scrollTop, 12940 $windowWidth = nectarDOMInfo.winW, 12941 $scrollTriggerOffset = ($body.hasClass('material')) ? 150 : 30; 12942 12943 if( headerTransparent == true ) { 12944 $scrollTriggerOffset = 0; 12945 } 12946 12947 if ($offset > $scrollTriggerOffset && $windowWidth >= 1000 && $('body.material-ocm-open').length == 0) { 12948 12949 12950 // Going to small when material search is closing, it must be closed immediately 12951 if ($body.is('.material')) { 12952 12953 if ($('#search-outer.material-open').length == 0) { 12954 $('#header-outer[data-transparent-header="true"] .bg-color-stripe').css('transition', 'none'); 12955 } 12956 12957 // Secondary header 12958 if ($headerSecondaryEl.length > 0) { 12959 $headerSecondaryEl.addClass('hide-up'); 12960 $headerOuterEl.css('transform', 'translateY(-' + nectarDOMInfo.secondaryHeaderHeight + 'px)'); 12961 } 12962 12963 } 12964 12965 if ($('#header-outer[data-megamenu-rt="1"]').length > 0 && 12966 $('#header-outer[data-transparent-header="true"]').length > 0 && 12967 $('#header-outer .megamenu').length > 0) { 12968 12969 if ($headerOuterEl.attr('data-transparent-header') == 'true' && 12970 $('#header-outer.side-widget-open').length == 0 && 12971 $('#header-outer[data-permanent-transparent="1"]').length == 0 && 12972 $('.megamenu.sfHover').length == 0) { 12973 $headerOuterEl.removeClass('transparent'); 12974 $headerOuterEl.removeClass('no-transition'); 12975 } 12976 12977 } else { 12978 12979 if ($headerOuterEl.attr('data-transparent-header') == 'true' && 12980 $('#header-outer.side-widget-open').length == 0 && 12981 $('#header-outer[data-permanent-transparent="1"]').length == 0) { 12982 $headerOuterEl.removeClass('transparent'); 12983 } 12984 12985 } 12986 12987 $('#header-outer, #search-outer').addClass('small-nav'); 12988 12989 // Body border full width side padding 12990 if ($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 && 12991 $bodyBorderTop.length > 0 && 12992 $bodyBorderHeaderColorMatch == true) { 12993 12994 $('#header-outer[data-full-width="true"] header > .container').stop(true, true).animate({ 12995 'padding': '0' 12996 }, { 12997 queue: false, 12998 duration: 250, 12999 easing: 'easeOutCubic' 13000 });
13001 13002 } 13003 13004 if ($('body.material').length > 0) { 13005 $('header#top nav > ul > li.menu-item-with-margin').stop(true, true).animate({ 13006 'margin-right': (parseInt($('header#top nav > ul > li.menu-item-with-margin').css('margin-right')) - parseInt(logoShrinkNum) * 3) + 'px' 13007 }, { 13008 queue: false, 13009 duration: 310, 13010 easing: 'easeOutQuad' 13011 }); 13012 } 13013 13014 // Box roll effect 13015 if ($('.nectar-box-roll').length > 0 && $('#header-outer[data-permanent-transparent="1"]').length == 0) { 13016 $('#ajax-content-wrap').animate({ 13017 'margin-top': (Math.floor(($logoHeight - logoShrinkNum) + (headerPadding * 2) / 1.8 + nectarDOMInfo.adminBarHeight + nectarDOMInfo.secondaryHeaderHeight)) 13018 }, { 13019 queue: false, 13020 duration: 250, 13021 easing: 'easeOutCubic' 13022 }); 13023 } 13024 13025 $window.off('scroll.headerResizeEffect', smallNav); 13026 $window.on('scroll.headerResizeEffect', bigNav); 13027 13028 // Dark slider coloring border 13029 $('#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'); 13030 $('#header-outer[data-transparent-header="true"] .cart-menu').css('transition', 'none'); 13031 setTimeout(function () { 13032 $('#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'); 13033 $('#header-outer[data-transparent-header="true"] .cart-menu').css('transition', 'border-color 0.30s ease'); 13034 }, 300); 13035 13036 } 13037 13038 } 13039 13040 13041 /** 13042 * Return header navigation size to full. 13043 * 13044 * Used when "Header Resize On Scroll" is active. 13045 * 13046 * @since 1.0 13047 */ 13048 function bigNav() { 13049 13050 var $offset = nectarDOMInfo.scrollTop, 13051 $windowWidth = nectarDOMInfo.winW, 13052 $scrollTriggerOffset = ($body.hasClass('material')) ? 150 : 30; 13053 13054 if ($body.is('.material-ocm-open')) { 13055 return false; 13056 } 13057 13058 if( headerTransparent == true ) { 13059 $scrollTriggerOffset = 0; 13060 } 13061 13062 if ($offset <= $scrollTriggerOffset && $windowWidth >= 1000 || $('.small-nav').length > 0 && $('#ajax-content-wrap.no-scroll').length > 0) { 13063 13064 $('#header-outer, #search-outer').removeClass('small-nav'); 13065 13066 if ($('#header-outer[data-megamenu-rt="1"]').length > 0 && 13067 $('#header-outer[data-transparent-header="true"]').length > 0 && 13068 $('#header-outer .megamenu').length > 0) { 13069 13070 if ($headerOuterEl.attr('data-transparent-header') == 'true' && 13071 $('.nectar-box-roll').length == 0 && 13072 $('.megamenu.sfHover').length == 0) { 13073 13074 $headerOuterEl.addClass('transparent'); 13075 $headerOuterEl.removeClass('no-transition'); 13076 } 13077 13078 } else { 13079 13080 if ($headerOuterEl.attr('data-transparent-header') == 'true' && $('.nectar-box-roll').length == 0) { 13081 $headerOuterEl.addClass('transparent'); 13082 } 13083 13084 } 13085 13086 // Body border full width side padding 13087 if ($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 && 13088 $bodyBorderTop.length > 0 && 13089 $bodyBorderHeaderColorMatch == true) { 13090 13091 $('#header-outer[data-full-width="true"] header > .container').stop(true, true).animate({ 13092 'padding': '0 28px' 13093 }, { 13094 queue: false, 13095 duration: 250, 13096 easing: 'easeOutCubic' 13097 }); 13098 13099 } 13100 13101 13102 if ($('body.material').length > 0) { 13103 13104 $('header#top nav > ul > li.menu-item-with-margin').stop(true, true).animate({ 13105 'margin-right': (parseInt($('header#top nav > ul > li.menu-item-with-margin').css('margin-right')) + parseInt(logoShrinkNum) * 3) + 'px' 13106 }, { 13107 queue: false, 13108 duration: 140, 13109 easing: 'easeOutQuad' 13110 });
13111 13112 } 13113 13114 13115 // Secondary header 13116 if ($headerSecondaryEl.length > 0) { 13117 13118 $headerSecondaryEl.removeClass('hide-up'); 13119 $headerOuterEl 13120 .removeClass('hide-up') 13121 .css('transform', 'translateY(0%)'); 13122 13123 } 13124 13125 // Box roll 13126 if ($('.nectar-box-roll').length > 0 && $('#header-outer[data-permanent-transparent="1"]').length == 0) { 13127 $('#ajax-content-wrap').animate({ 13128 'margin-top': (Math.floor(($logoHeight) + (headerPadding * 2) + nectarDOMInfo.adminBarHeight + nectarDOMInfo.secondaryHeaderHeight)) 13129 }, { 13130 queue: false, 13131 duration: 250, 13132 easing: 'easeOutCubic' 13133 }); 13134 } 13135 13136 $window.off('scroll.headerResizeEffect', bigNav); 13137 $window.on('scroll.headerResizeEffect', smallNav); 13138 13139 // Dark slider coloring border 13140 $('#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'); 13141 $('#header-outer[data-transparent-header="true"] .cart-menu').css('transition', 'none'); 13142 setTimeout(function () { 13143 $('#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'); 13144 $('#header-outer[data-transparent-header="true"] .cart-menu').css('transition', 'border-color 0.30s ease'); 13145 }, 300); 13146 } 13147 13148 } 13149 13150 13151 13152 /** 13153 * Default scroll event to handle transparency/secondary header when no header effects are enabled. 13154 * 13155 * @since 4.0 13156 */ 13157 function opaqueCheck() { 13158 13159 // The condense header effect will bypass this unless in the custom mobile breakpoint (which is defined in theme options). 13160 if ($('#header-outer[data-format="centered-menu-bottom-bar"][data-condense="true"]').length > 0 && !$headerOuterEl.hasClass('within-custom-breakpoint') ) { 13161 return; 13162 } 13163 13164 if (nectarDOMInfo.scrollTop > 0) { 13165 13166 if ($('body.material').length > 0) { 13167 $headerOuterEl.addClass('scrolled-down'); 13168 13169 // Secondary header 13170 if ($headerSecondaryEl.length > 0 && nectarDOMInfo.winW > 1000) { 13171 $headerSecondaryEl.addClass('hide-up'); 13172 $headerOuterEl.css('transform', 'translateY(-' + nectarDOMInfo.secondaryHeaderHeight + 'px)'); 13173 } 13174 } 13175 13176 if ($headerOuterEl.attr('data-transparent-header') == 'true' && $('#header-outer[data-permanent-transparent="1"]').length == 0) { 13177 $headerOuterEl.removeClass('transparent').addClass('scrolled-down'); 13178 } 13179 13180 // Switch event to watch. 13181 $window.off('scroll.headerResizeEffectOpaque', opaqueCheck); 13182 $window.on('scroll.headerResizeEffectOpaque', transparentCheck); 13183 } 13184 } 13185 13186 13187 /** 13188 * Default scroll event to handle transparency/secondary header when no header effects are enabled. 13189 * 13190 * @since 4.0 13191 */ 13192 function transparentCheck() { 13193 13194 // The condense header effect will bypass this unless in the custom mobile breakpoint (which is defined in theme options). 13195 if ($('#header-outer[data-format="centered-menu-bottom-bar"][data-condense="true"]').length > 0 && !$headerOuterEl.hasClass('within-custom-breakpoint') ) { 13196 return; 13197 } 13198 13199 if (nectarDOMInfo.scrollTop == 0 && $('body.material-ocm-open').length == 0) { 13200 13201 if ($('#header-outer[data-megamenu-rt="1"]').length > 0 && 13202 $('#header-outer[data-transparent-header="true"]').length > 0 && 13203 $('#header-outer .megamenu').length > 0) { 13204 13205 if ($headerOuterEl.attr('data-transparent-header') == 'true' && $('.megamenu.sfHover').length == 0) { 13206 13207 $headerOuterEl 13208 .addClass('transparent') 13209 .removeClass('scrolled-down'); 13210 13211 $headerOuterEl.removeClass('no-transition'); 13212 13213 } else if ($headerOuterEl.attr('data-transparent-header') == 'true') { 13214 13215 $headerOuterEl.removeClass('scrolled-down'); 13216 } 13217 13218 } else { 13219 13220 if ($headerOuterEl.attr('data-transparent-header') == 'true') { 13221 $headerOuterEl 13222 .addClass('transparent') 13223 .removeClass('scrolled-down'); 13224 } 13225 13226 } 13227 13228 if ($('body.material').length > 0) { 13229 $headerOuterEl.removeClass('scrolled-down'); 13230 13231 // Secondary header 13232 if ($headerSecondaryEl.length > 0 && nectarDOMInfo.winW > 1000) { 13233 13234 $headerSecondaryEl.removeClass('hide-up'); 13235 $headerOuterEl 13236 .removeClass('hide-up') 13237 .css('transform', 'translateY(0%)'); 13238 } 13239 } 13240 13241 // Switch event to watch. 13242 $window.off('scroll.headerResizeEffectOpaque', transparentCheck); 13243 $window.on('scroll.headerResizeEffectOpaque', opaqueCheck); 13244 } 13245 13246 } 13247 13248 13249 13250 13251 /** 13252 * Mobile header event for handling transparency/secondary header. 13253 * 13254 * @since 10.5 13255 * @see bindScrollEffectsMobile 13256 */ 13257 function mobileHeaderRAF() { 13258 13259 if ($('body.material-ocm-open').length > 0) { 13260 requestAnimationFrame(mobileHeaderRAF); 13261 return; 13262 } 13263 // Scrolled down. 13264 if (nectarDOMInfo.scrollTop > 5) { 13265 13266 if (!$headerOuterEl.is('[data-permanent-transparent="1"]')) { 13267 $headerOuterEl.removeClass('transparent'); 13268 } 13269 13270 if (nectarDOMInfo.secondaryHeaderHeight > 0) { 13271 $headerSecondaryEl.addClass('hide-up'); 13272 $headerOuterEl.css('transform', 'translateY(-' + nectarDOMInfo.secondaryHeaderHeight + 'px)').addClass('hidden-secondary'); 13273 } else { 13274 $headerOuterEl.removeClass('hidden-secondary'); 13275 } 13276 13277 } 13278 // At top. 13279 else { 13280 13281 if ($headerOuterEl.is('[data-transparent-header="true"]')) { 13282 $headerOuterEl.addClass('transparent'); 13283 } 13284 13285 if (nectarDOMInfo.secondaryHeaderHeight > 0) { 13286 $headerSecondaryEl.removeClass('hide-up'); 13287 $headerOuterEl.css('transform', 'translateY(0px)'); 13288 } 13289 $headerOuterEl.removeClass('hidden-secondary'); 13290 13291 } 13292 13293 if (nectarDOMInfo.winW < 1000) { 13294 requestAnimationFrame(mobileHeaderRAF); 13295 } 13296 } 13297 13298 13299 13300 /** 13301 * Bind mobile header scroll effects. 13302 * 13303 * @since 10.5 13304 * @see headerNavScrollInit 13305 */ 13306 function bindScrollEffectsMobile() { 13307 13308 if (nectarDOMInfo.winW > 999) { 13309 return; 13310 } 13311 13312 // Unbind desktop effects. 13313 $window.off('scroll.headerResizeEffect'); 13314 $window.off('scroll.headerResizeEffectOpaque'); 13315 13316 // Remove HHUN classes. 13317 $headerOuterEl 13318 .removeClass('scrolled-down') 13319 .removeClass('detached') 13320 .removeClass('invisible') 13321 .removeClass('at-top') 13322 .css('transform', 'none'); 13323 13324 // Handle mobile transparent class. 13325 if ($('#header-outer[data-mobile-fixed="1"]').length > 0) { 13326 requestAnimationFrame(mobileHeaderRAF); 13327 } else if ($headerOuterEl.attr('data-transparent-header') == 'true') { 13328 $headerOuterEl.addClass('transparent'); 13329 } 13330 13331 $window.off('smartresize.nectarNavScrollEffects'); 13332 $window.on('smartresize.nectarNavScrollEffects', bindScrollEffectsDesktop); 13333 13334 } 13335 13336 /** 13337 * Bind deaktop header scroll effects. 13338 * 13339 * @since 10.5 13340 * @see headerNavScrollInit 13341 */ 13342 function bindScrollEffectsDesktop() { 13343 13344 if (nectarDOMInfo.winW < 1000) { 13345 return; 13346 } 13347 13348 if (headerResize == true && headerHideUntilNeeded != '1') { 13349 13350 $window.off('scroll.headerResizeEffect'); 13351 13352 if ($('#nectar_fullscreen_rows').length == 0) { 13353 $window.on('scroll.headerResizeEffect', smallNav); 13354 } else if ($('#nectar_fullscreen_rows[data-mobile-disable="on"]').length > 0 && nectarDOMInfo.usingMobileBrowser) { 13355 $window.on('scroll.headerResizeEffect', smallNav); 13356 } 13357 13358 } else if (headerHideUntilNeeded != '1') { 13359 13360 $window.off('scroll.headerResizeEffectOpaque'); 13361 $window.on('scroll.headerResizeEffectOpaque', opaqueCheck); 13362 13363 }
13363 else if (headerHideUntilNeeded == '1') { 13364 13365 13366 if ($('.nectar-box-roll').length > 0) { 13367 $headerOuterEl.addClass('at-top-before-box'); 13368 } 13369 13370 // Don't trigger for header remove stickiness. 13371 if ($('#header-outer[data-remove-fixed="1"]').length == 0) { 13372 hhunHeaderEffect(); 13373 } 13374 13375 } //end if hhun 13376 13377 // Condense header effect coming from mobile. 13378 if ($('#header-outer[data-format="centered-menu-bottom-bar"][data-condense="true"]').length > 0 ) { 13379 13380 if( $headerSecondaryEl.length > 0 ) { 13381 // Remove transform. 13382 $headerOuterEl.css('transform',''); 13383 } 13384 13385 if ( nectarDOMInfo.scrollTop > 200 && !$headerOuterEl.hasClass('fixed-menu') ) { 13386 $headerOuterEl.addClass('fixed-menu'); 13387 } 13388 13389 } 13390 13391 // Only bind mobile if applicable. 13392 13393 $window.off('smartresize.nectarNavScrollEffects'); 13394 $window.on('smartresize.nectarNavScrollEffects', bindScrollEffectsMobile); 13395 13396 } 13397 13398 13399 13400 /** 13401 * Header Navigation scroll events initialization. 13402 * 13403 * @since 10.5 13404 */ 13405 function headerNavScrollInit() { 13406 13407 // Remove transparent class if page loaded further down. 13408 if ($('#header-outer[data-remove-fixed="1"]').length == 0 && nectarDOMInfo.winW > 1000) { 13409 if ( $(window).scrollTop() != 0 && $('#header-outer.transparent[data-permanent-transparent="false"]').length == 1) { 13410 $headerOuterEl.removeClass('transparent'); 13411 } 13412 } 13413 13414 // Permanent transparent header. 13415 if ($('#nectar_fullscreen_rows').length == 0 && $('.nectar-box-roll').length == 0) { 13416 midnightInit(); 13417 } 13418 13419 // Determine which events to bind at start. 13420 if (nectarDOMInfo.winW < 1000 && $('.nectar-box-roll').length == 0) { 13421 bindScrollEffectsMobile(); 13422 $window.on('smartresize.nectarNavScrollEffects', bindScrollEffectsMobile); 13423 } else { 13424 bindScrollEffectsDesktop(); 13425 $window.on('smartresize.nectarNavScrollEffects', bindScrollEffectsDesktop); 13426 } 13427 13428 } 13429 13430 13431 13432 13433 13434 13435 /** 13436 * Set the header space div height. 13437 * 13438 * @since 10.5 13439 */ 13440 function headerSpace() { 13441 13442 if ($('.mobile').length > 0) { 13443 13444 if (nectarDOMInfo.winH < nectarDOMInfo.winW && nectarDOMInfo.winW > 1000) { 13445 if ($('#header-outer.small-nav').length == 0) { 13446 $('#header-space').css('height', $headerOuterEl.outerHeight()); 13447 } 13448 } else { 13449 $('#header-space').css('height', $headerOuterEl.outerHeight()); 13450 } 13451 13452 } else { 13453 13454 if ($('.nectar-parallax-scene.first-section').length == 0) { 13455 13456 var headerPadding2 = headerPadding - headerPadding / 1.8; 13457 var $headerHeight = ($('#header-outer[data-header-resize="1"]').length > 0 && $('.small-nav').length > 0) ? $headerOuterEl.outerHeight() + (parseInt(logoShrinkNum) + headerPadding2 * 2) : $headerOuterEl.outerHeight(); 13458 13459 $('#header-space').css('height', $headerHeight); 13460 13461 } 13462 13463 } 13464 13465 } 13466 13467 13468 13469 /** 13470 * Handle header nav distance away from top to account for admin bar. 13471 * 13472 * @since 10.5 13473 */ 13474 13475 function headerNavOffsetInit() { 13476 13477 var lastPosition = -1; 13478 var $headerScrollTop = nectarDOMInfo.scrollTop; 13479 13480 // Verify scroll pos has changed before calculating. 13481 function headerOffsetAdjust() { 13482 13483 if ( $body.hasClass('compose-mode') ) { 13484 return; 13485 } 13486 13487 $headerScrollTop = nectarDOMInfo.scrollTop; 13488 13489 if (lastPosition == $headerScrollTop) { 13490 requestAnimationFrame(headerOffsetAdjust); 13491 return false; 13492 } else { 13493 lastPosition = $headerScrollTop; 13494 } 13495 13496 headerOffsetAdjustCalc(); 13497 requestAnimationFrame(headerOffsetAdjust); 13498 13499 } 13500 13501 // Called when scrolling occurs. 13502 function headerOffsetAdjustCalc() { 13503 13504 var $eleHeight = 0; 13505 13506 // Mobile. 13507 if ($('body.mobile').length > 0 || (condenseHeaderLayout == true && $('#header-outer .span_9').css('display') == 'none')) { 13508 13509 $eleHeight = 0; 13510 var $endOffset = ($wpAdminBar.css('position') == 'fixed') ? $wpAdminBar.height() : 0; 13511 13512 $eleHeight += nectarDOMInfo.adminBarHeight; 13513 13514 if ($eleHeight - $headerScrollTop > $endOffset) { 13515 $headerOuterEl.css('top', $eleHeight - $headerScrollTop + 'px'); 13516 } else { 13517 $headerOuterEl.css('top', $endOffset); 13518 } 13519 13520 } 13521 // Desktop 13522 else { 13523 if ( condenseHeaderLayout == false ) { 13524 13525 $eleHeight = 0; 13526 13527 if( !$headerOuterEl.is('[data-remove-fixed="1"]') ) { 13528 $eleHeight += nectarDOMInfo.adminBarHeight; 13529 } 13530 $headerOuterEl.css('top', $eleHeight + 'px'); 13531 } 13532 } 13533 13534 } 13535 13536 // Bind event and begin if needed. 13537 if ($('#header-outer[data-mobile-fixed="1"]').length > 0 && $wpAdminBar.length > 0) { 13538 13539 if ($('#nectar_fullscreen_rows').length == 0) { 13540 requestAnimationFrame(headerOffsetAdjust); 13541 } else if ($('#nectar_fullscreen_rows').length > 0 && nectarDOMInfo.usingMobileBrowser) { 13542 requestAnimationFrame(headerOffsetAdjust); 13543 } 13544 13545 $window.smartresize(headerOffsetAdjustCalc); 13546 13547 } 13548 13549 } 13550 13551 13552 13553 13554 13555 13556 13557 /** 13558 * Calculate the minimum body height when using the footer reveal effect or material OCM 13559 * 13560 * @since 7.0 13561 */ 13562 function footerRevealCalcs() { 13563 13564 var $headerNavSpace = ''; 13565 13566 if( $headerOuterEl.is('[data-logo-height]') && $headerOuterEl.is('[data-padding]') ) { 13567 13568 if( $headerOuterEl.find('#logo.no-image').length > 0 ) { 13569 $headerNavSpace = ( headerLayoutFormat == 'left-header' && nectarDOMInfo.winW > 1000) ? 0 : parseInt($headerOuterEl.find('#logo.no-image').height()) + (parseInt($headerOuterEl.attr('data-padding')*2)); 13570 } else { 13571 $headerNavSpace = ( headerLayoutFormat == 'left-header' && nectarDOMInfo.winW > 1000) ? 0 : parseInt($headerOuterEl.attr('data-logo-height')) + (parseInt($headerOuterEl.attr('data-padding')*2)); 13572 } 13573 13574 } else { 13575 $headerNavSpace = ( headerLayoutFormat == 'left-header' && nectarDOMInfo.winW > 1000) ? 0 : $headerOuterEl.outerHeight(); 13576 } 13577 13578 13579 if (nectarDOMInfo.winH - nectarDOMInfo.adminBarHeight - $headerNavSpace - nectarDOMInfo.footerOuterHeight - 1 - $pageHeaderBG.height() - $('.page-header-no-bg').height() > 0) { 13580 13581 var $resizeExtra = ($('body:not(.material) #header-outer[data-header-resize="1"]').length > 0) ? 55 : 0; 13582 13583 $('body[data-footer-reveal="1"] .container-wrap').css({ 13584 'margin-bottom': nectarDOMInfo.footerOuterHeight 13585 });
13586 13587 $('.container-wrap').css({ 13588 'min-height': nectarDOMInfo.winH - nectarDOMInfo.adminBarHeight - $headerNavSpace - nectarDOMInfo.footerOuterHeight - $('.page-header-no-bg').height() - $pageHeaderBG.height() + $resizeExtra 13589 }); 13590 13591 } else { 13592 $('body[data-footer-reveal="1"] .container-wrap').css({ 13593 'margin-bottom': nectarDOMInfo.footerOuterHeight 13594 }); 13595 } 13596 13597 if (nectarDOMInfo.winW < 1000) { 13598 $footerOuterEl.attr('data-midnight', 'light'); 13599 } 13600 else { 13601 $footerOuterEl.removeAttr('data-midnight'); 13602 } 13603 } 13604 13605 13606 /** 13607 * Initialize footer reveal and bind event 13608 * 13609 * @since 10.5 13610 */ 13611 function footerRevealInit() { 13612 13613 if ($('body[data-footer-reveal="1"]').length > 0 || $('body.material[data-slide-out-widget-area-style="slide-out-from-right"]').length > 0) { 13614 13615 // Don't add on mobile 13616 if( !$body.hasClass('mobile') ) { 13617 $body.addClass('nectar-no-flex-height'); 13618 } 13619 13620 setTimeout(footerRevealCalcs, 60); 13621 footerRevealCalcs(); 13622 13623 $window.on('resize', footerRevealCalcs); 13624 13625 if ($('body[data-footer-reveal="1"][data-footer-reveal-shadow="large_2"]').length > 0) { 13626 $('.container-wrap').css({ 13627 boxShadow: '0 70px 110px -30px ' + $footerOuterEl.css('backgroundColor') 13628 }); 13629 } 13630 13631 } 13632 13633 } 13634 13635 13636 13637 13638 13639 /** 13640 * Switch header navigation BG color to match row BG color that is passes. 13641 * 13642 * Only called when using "Header Inherit Row Color" option. 13643 * 13644 * @since 5.0 13645 */ 13646 function headerRowColorInheritInit() { 13647 13648 if ($('body[data-header-inherit-rc="true"]').length > 0 && $('.mobile').length == 0 && $('#header-outer[data-transparent-header="true"]').length > 0 ) { 13649 13650 var headerOffset = $logoHeight / 2 + headerPadding + nectarDOMInfo.adminBarHeight; 13651 13652 if( $('#header-outer[data-permanent-transparent="1"]').length == 0 ) { 13653 headerOffset = ($logoHeight - logoShrinkNum) + Math.ceil((headerPadding * 2) / 1.8) + nectarDOMInfo.adminBarHeight; 13654 } 13655 13656 $('.main-content > .row > .wpb_row').each(function () { 13657 13658 var $that = $(this); 13659 var $textColor; 13660 13661 var waypoint = new Waypoint({ 13662 element: $that, 13663 handler: function (direction) { 13664 13665 //User is scrolling down. 13666 if (direction == 'down') { 13667 13668 if ($that.find('.row-bg.using-bg-color').length > 0) { 13669 13670 $textColor = ($that.find('> .col.span_12.light').length > 0) ? 'light-text' : 'dark-text'; 13671 13672 $headerOuterEl 13673 .css('background-color', $that.find('.row-bg').css('background-color')) 13674 .removeClass('light-text') 13675 .removeClass('dark-text') 13676 .addClass($textColor); 13677 13678 $headerOuterEl.attr('data-current-row-bg-color', $that.find('.row-bg').css('background-color')); 13679 $('body.material #header-outer .bg-color-stripe').css('background-color', $that.find('.row-bg').css('background-color')); 13680 13681 } else { 13682 13683 $headerOuterEl 13684 .css('background-color', $headerOuterEl.attr('data-user-set-bg')) 13685 .removeClass('light-text') 13686 .removeClass('dark-text'); 13687 13688 $headerOuterEl.attr('data-current-row-bg-color', $headerOuterEl.attr('data-user-set-bg')); 13689 $('body.material #header-outer .bg-color-stripe').css('background-color', ''); 13690 13691 } 13692 13693 } 13694 13695 //User is scrolling up. 13696 else { 13697 13698 if ($that.prev('div.wpb_row').find('.row-bg.using-bg-color').length > 0) { 13699 13700 $textColor = ($that.prev('div.wpb_row').find('> .col.span_12.light').length > 0) ? 'light-text' : 'dark-text'; 13701 13702 $headerOuterEl 13703 .css('background-color', $that.prev('div.wpb_row').find('.row-bg').css('background-color')) 13704 .removeClass('light-text') 13705 .removeClass('dark-text') 13706 .addClass($textColor); 13707 13708 $headerOuterEl.attr('data-current-row-bg-color', $that.prev('div.wpb_row').find('.row-bg').css('background-color')); 13709 $('body.material #header-outer .bg-color-stripe').css('background-color', $that.prev('div.wpb_row').find('.row-bg').css('background-color')); 13710 13711 } else { 13712 13713 $headerOuterEl 13714 .css('background-color', $headerOuterEl.attr('data-user-set-bg')) 13715 .removeClass('light-text') 13716 .removeClass('dark-text'); 13717 13718 $headerOuterEl.attr('data-current-row-bg-color', $headerOuterEl.attr('data-user-set-bg')); 13719 $('body.material #header-outer .bg-color-stripe').css('background-color', ''); 13720 13721 } 13722 13723 } 13724 13725 }, 13726 offset: headerOffset 13727 13728 }); // End of waypoint bind. 13729 13730 }); // End of loop through rows. 13731 13732 } 13733 13734 } 13735 13736 13737 13738 /** 13739 * Page submenu sticky functionality 13740 * 13741 * @since 10.5.2 13742 */ 13743 13744 function stickyPageSubmenuInit() { 13745 13746 var $ = window.jQuery, 13747 Waypoint = window.Waypoint, 13748 $offsetHeight = calcHeaderNavHeight(), 13749 $headerHeight = calcHeaderNavHeight(); 13750 13751 $window.on('smartresize', function () { 13752 13753 $offsetHeight = calcHeaderNavHeight(); 13754 13755 if ($wpAdminBar.length > 0 && 13756 $wpAdminBar.css('position') == 'fixed') { 13757 $offsetHeight += $wpAdminBar.height(); 13758 } 13759 13760 if ($bodyBorderTop.length > 0 && 13761 $window.width() > 1000 && 13762 $('body[data-hhun="1"]').length > 0) { 13763 $offsetHeight += $bodyBorderTop.height(); 13764 } 13765 13766 // Recalc for resizing (same as stuck/unstuck logic below) 13767 if ($('.page-submenu.stuck').length > 0) { 13768 13769 $('.page-submenu.stuck') 13770 .addClass('no-trans') 13771 .css('top', $offsetHeight) 13772 .css('transform', 'translateY(0)').addClass('stuck'); 13773 13774 setTimeout(function () { 13775 $('.page-submenu.stuck').removeClass('no-trans'); 13776 }, 50); 13777 13778 $('.page-submenu.stuck') 13779 .parents('.wpb_row') 13780 .css('z-index', 10000); 13781 13782 // Boxed layout 13783 if ($('#boxed').length > 0) { 13784 13785 var $negMargin = ($window.width() > 1000) ? $('.container-wrap').width() * 0.04 : 39; 13786 13787 $('.page-submenu.stuck').css({ 13788 'margin-left': '-' + $negMargin + 'px', 13789 'width': $('.container-wrap').width() 13790 });
13791 13792 } 13793 13794 } else { 13795 13796 $('.page-submenu.stuck') 13797 .css('top', '0') 13798 .removeClass('stuck'); 13799 13800 $('.page-submenu.stuck') 13801 .parents('.wpb_row') 13802 .css('z-index', 'auto'); 13803 13804 if ($('#boxed').length > 0) { 13805 $('.page-submenu.stuck').css({ 13806 'margin-left': '0px', 13807 'width': '100%' 13808 }); 13809 } 13810 13811 } 13812 13813 }); 13814 13815 /* http://imakewebthings.com/waypoints/shortcuts/sticky-elements */ 13816 function Sticky(options) { 13817 this.options = $.extend({}, Waypoint.defaults, Sticky.defaults, options); 13818 this.element = this.options.element; 13819 this.$element = $(this.element); 13820 this.createWrapper(); 13821 this.createWaypoint(); 13822 } 13823 13824 /* Private */ 13825 Sticky.prototype.createWaypoint = function () { 13826 13827 var originalHandler = this.options.handler; 13828 13829 $offsetHeight = calcHeaderNavHeight(); 13830 13831 if ($wpAdminBar.length > 0 && $wpAdminBar.css('position') == 'fixed') { 13832 $offsetHeight += $wpAdminBar.height(); 13833 } 13834 13835 if ($bodyBorderTop.length > 0 && $window.width() > 1000 && $('body[data-hhun="1"]').length > 0) { 13836 $offsetHeight += $bodyBorderTop.height(); 13837 } 13838 13839 this.waypoint = new Waypoint($.extend({}, this.options, { 13840 element: this.wrapper, 13841 handler: $.proxy(function (direction) { 13842 var shouldBeStuck = this.options.direction.indexOf(direction) > -1; 13843 var wrapperHeight = shouldBeStuck ? this.$element.outerHeight(true) : ''; 13844 13845 this.$wrapper.height(wrapperHeight); 13846 if (shouldBeStuck) { 13847 13848 this.$element 13849 .addClass('no-trans') 13850 .css('top', $offsetHeight) 13851 .css('transform', 'translateY(0)') 13852 .addClass('stuck'); 13853 13854 var $that = this; 13855 13856 setTimeout(function () { 13857 $that.$element.removeClass('no-trans'); 13858 }, 50); 13859 13860 this.$element.parents('.wpb_row').css('z-index', 10000); 13861 13862 //boxed 13863 if ($('#boxed').length > 0) { 13864 var $negMargin = ($window.width() > 1000) ? $('.container-wrap').width() * 0.04 : 39; 13865 this.$element.css({ 13866 'margin-left': '-' + $negMargin + 'px', 13867 'width': $('.container-wrap').width() 13868 }); 13869 } 13870 13871 } else { 13872 this.$element.css('top', '0').removeClass('stuck'); 13873 13874 if ($('#boxed').length > 0) this.$element.css({ 13875 'margin-left': '0px', 13876 'width': '100%' 13877 }); 13878 } 13879 13880 if (originalHandler) { 13881 originalHandler.call(this, direction); 13882 } 13883 }, this), 13884 offset: $offsetHeight 13885 })); 13886 13887 var $that = this; 13888 13889 13890 setInterval(function () { 13891 13892 if ($('body[data-hhun="1"] #header-outer.detached:not(.invisible)').length > 0) { 13893 13894 var heightToAdjust = $headerOuterEl.outerHeight(); 13895 13896 if( $headerSecondaryEl.length > 0) { 13897 heightToAdjust -= nectarDOMInfo.secondaryHeaderHeight; 13898 } 13899 13900 $that.waypoint.options.offset = $offsetHeight + heightToAdjust; 13901 } 13902 else { 13903 $that.waypoint.options.offset = $offsetHeight; 13904 } 13905 13906 Waypoint.refreshAll(); 13907 13908 }, 100); 13909 13910 13911 }; 13912 13913 /* Private */ 13914 Sticky.prototype.createWrapper = function () { 13915 if (this.options.wrapper) { 13916 this.$element.wrap(this.options.wrapper); 13917 } 13918 this.$wrapper = this.$element.parent(); 13919 this.wrapper = this.$wrapper[0]; 13920 }; 13921 13922 /* Public */ 13923 Sticky.prototype.destroy = function () { 13924 13925 if (this.$element.parent()[0] === this.wrapper) { 13926 this.waypoint.destroy(); 13927 this.$element.removeClass(this.options.stuckClass); 13928 if (this.options.wrapper) { 13929 this.$element.unwrap(); 13930 } 13931 } 13932 13933 }; 13934 13935 Sticky.defaults = { 13936 wrapper: '<div class="sticky-wrapper" />', 13937 stuckClass: 'stuck', 13938 direction: 'down right' 13939 }; 13940
13941 Waypoint.Sticky = Sticky; 13942 13943 } 13944 13945 13946 13947 /** 13948 * Page submenu page builder element. 13949 * 13950 * @since 10.5 13951 */ 13952 13953 function pageSubmenuInit() { 13954 13955 if ($('.page-submenu[data-sticky="true"]').length > 0 && $('#nectar_fullscreen_rows').length == 0) { 13956 13957 stickyPageSubmenuInit(); 13958 13959 // Remove outside of column setups 13960 if ($('.page-submenu').parents('.span_12').find('> .wpb_column').length > 1) { 13961 13962 var pageMenu = $('.page-submenu').clone(), 13963 pageMenuParentRow = $('.page-submenu').parents('.wpb_row'); 13964 13965 $('.page-submenu').remove(); 13966 pageMenuParentRow.before(pageMenu); 13967 } 13968 13969 var sticky = new Waypoint.Sticky({ 13970 element: $('.page-submenu[data-sticky="true"]')[0] 13971 }); 13972 13973 } 13974 13975 // Adjust to be higher. 13976 if ($('#nectar_fullscreen_rows').length == 0) { 13977 13978 $('.page-submenu') 13979 .parents('.wpb_row') 13980 .css('z-index', 10000); 13981 } 13982 13983 // Bind events. 13984 $('.page-submenu .mobile-menu-link').on('click', function () { 13985 13986 $(this).parents('.page-submenu') 13987 .find('ul') 13988 .stop(true) 13989 .slideToggle(350); 13990 13991 return false; 13992 13993 }); 13994 13995 $('.page-submenu ul li a').on('click', function () { 13996 13997 if ($('body.mobile').length > 0) { 13998 $(this).parents('.page-submenu') 13999 .find('ul') 14000 .stop(true) 14001 .slideToggle(350); 14002 } 14003 14004 }); 14005 14006 } 14007 14008 14009 14010 14011 /** 14012 * Page builder full height row option. 14013 * 14014 * @since 8.0 14015 */ 14016 14017 function vcFullHeightRow() { 14018 14019 var $element = $(".vc_row-o-full-height:first"); 14020 if ($element.length) { 14021 14022 var windowHeight, offsetTop, fullHeight; 14023 windowHeight = $window.height(); 14024 14025 $(".vc_row-o-full-height").each(function () { 14026 14027 offsetTop = $(this).offset().top; 14028 14029 if (offsetTop < windowHeight && 14030 $(this).hasClass('top-level') && 14031 !nectarDOMInfo.usingFrontEndEditor) { 14032 14033 fullHeight = 100 - offsetTop / (windowHeight / 100); 14034 $(this).css("min-height", fullHeight + "vh"); 14035 $(this).find('> .col.span_12').css("min-height", fullHeight + "vh"); 14036 14037 } else { 14038 14039 $(this).css("min-height", windowHeight); 14040 $(this).find('> .col.span_12').css("min-height", windowHeight); 14041 14042 } 14043 14044 }); 14045 14046 } 14047 14048 } 14049 14050 14051 /** 14052 * Page builder full height row init. 14053 * 14054 * @since 10.5 14055 */ 14056 14057 function vcFullHeightRowInit() { 14058 14059 if( $('.vc_row-o-full-height').length > 0 ) { 14060 vcFullHeightRow(); 14061 $window.on('smartresize', vcFullHeightRow); 14062 } 14063 14064 } 14065 14066 14067 /** 14068 * Page builder equal height row IE helper. 14069 * 14070 * @since 8.0 14071 */ 14072 function fixIeFlexbox() { 14073 var ua = window.navigator.userAgent, 14074 msie = ua.indexOf("MSIE "); 14075 (msie > 0 || navigator.userAgent.match(/Trident.*rv\:11\./)) && $(".vc_row-o-full-height").each(function () { 14076 "flex" === $(this).find('> .span_12').css("display") && $(this).wrap('<div class="vc_ie-flexbox-fixer"></div>') 14077 }); 14078 14079 if( msie > 0 || navigator.userAgent.match(/Trident.*rv\:11\./)) { 14080 fixIE11Images(); 14081 $(window).on('resize',fixIE11Images); 14082 } 14083 14084 } 14085 14086 /** 14087 * Fix the IE11 bug with max-width 100% on imgs 14088 * 14089 * @since 11.0 14090 */ 14091 function fixIE11Images() { 14092 14093 $('.img-with-aniamtion-wrap img.img-with-animation').each(function() { 14094 14095 if( $(this).parents('.tabbed').length == 0 && $(this).parents('.toggle').length == 0 ) { 14096 14097 var $parentWrap = $(this).parents('.img-with-aniamtion-wrap'); 14098 $parentWrap.css({ 14099 'height' : '' 14100 }); 14101 var height = $(this).height(); 14102 14103 $parentWrap.css({ 14104 'height' : height 14105 }); 14106 14107 } 14108 14109 });
14110 14111 } 14112 14113 14114 14115 14116 14117 14118 14119 14120 14121 /** 14122 * Recent post height 14123 * 14124 * @since 10.5 14125 */ 14126 function recentPostsTitleOnlyEqualHeight() { 14127 14128 function recentPostHeight() { 14129 14130 $('.blog-recent[data-style="title_only"]').each(function () { 14131 14132 if ($(this).find('> .col').length > 1) { 14133 return false; 14134 } 14135 var $parentsSeletor = $(this).parent().parent().parent(); 14136 14137 if ($parentsSeletor.hasClass('vc_col-sm-3') || 14138 $parentsSeletor.hasClass('vc_col-sm-4') || 14139 $parentsSeletor.hasClass('vc_col-sm-6') || 14140 $parentsSeletor.hasClass('vc_col-sm-8') || 14141 $parentsSeletor.hasClass('vc_col-sm-9')) { 14142 14143 if ($('body.mobile').length == 0 && $(this).next('div').length == 0) { 14144 var tallestColumn = 0; 14145 14146 $(this).find('> .col').css('padding', '50px 20px'); 14147 14148 $(this).parents('.span_12').find(' > .wpb_column').each(function () { 14149 14150 if( Math.floor($(this).height()) > tallestColumn ) { 14151 tallestColumn = Math.floor($(this).height()); 14152 } 14153 14154 }); 14155 14156 if (Math.floor($(this).find('> .col').outerHeight(true)) < Math.floor($(this).parents('.wpb_row').height()) - 1) { 14157 $(this).find('> .col').css('padding-top', (tallestColumn - $(this).find('> .col').height()) / 2 + 'px'); 14158 $(this).find('> .col').css('padding-bottom', (tallestColumn - $(this).find('> .col').height()) / 2 + 'px'); 14159 } 14160 14161 } else { 14162 $(this).find('> .col').css('padding', '50px 20px'); 14163 } 14164 } 14165 }); 14166 14167 } 14168 14169 // Set heights. 14170 if( $('.blog-recent[data-style="title_only"]').length > 0 ) { 14171 recentPostHeight(); 14172 $window.on('smartresize',recentPostHeight); 14173 } 14174 14175 } 14176 14177 14178 14179 14180 14181 /** 14182 * Helper to calculate recent post slider height 14183 * 14184 * @since 7.0 14185 */ 14186 function recentPostSliderHeight() { 14187 14188 $('.nectar-recent-posts-slider').each(function () { 14189 14190 var $minHeight = 250, 14191 $definedHeight = parseInt($(this).attr('data-height')), 14192 dif = ($('body[data-ext-responsive="true"]').length > 0) ? $window.width() / 1400 : $window.width() / 1100, 14193 $sliderSelectors = $(this).find('.nectar-recent-post-slide, .flickity-viewport'); 14194 14195 if (nectarDOMInfo.winW > 1000 && $('#boxed').length == 0) { 14196 14197 if ($(this).parents('.full-width-content').length == 0) { 14198 14199 if ($('body[data-ext-responsive="true"]').length > 0 && nectarDOMInfo.winW >= 1400) { 14200 $sliderSelectors.css('height', Math.ceil($definedHeight)); 14201 } else if ($('body[data-ext-responsive="true"]').length == 0 && nectarDOMInfo.winW >= 1100) { 14202 $sliderSelectors.css('height', Math.ceil($definedHeight)); 14203 } else { 14204 $sliderSelectors.css('height', Math.ceil($definedHeight * dif)); 14205 } 14206 14207 } else { 14208 $sliderSelectors.css('height', Math.ceil($definedHeight * dif)); 14209 } 14210 14211 } else { 14212 14213 // Column sliders 14214 var $parentCol = ($(this).parents('.wpb_column').length > 0) ? $(this).parents('.wpb_column') : $(this).parents('.col'); 14215 14216 if ($parentCol.length == 0) { 14217 $parentCol = $('.main-content'); 14218 } 14219 14220 if (!$parentCol.hasClass('vc_span12') && 14221 !$parentCol.hasClass('main-content') && 14222 !$parentCol.hasClass('span_12') && 14223 !$parentCol.hasClass('vc_col-sm-12')) { 14224 14225 var $parentColWidth = sliderColumnDesktopWidth($parentCol), 14226 $aspectRatio = $definedHeight / $parentColWidth; 14227 14228 // Min height 14229 if ($aspectRatio * $parentCol.width() <= $minHeight) { 14230 $sliderSelectors.css('height', $minHeight); 14231 } else { 14232 $sliderSelectors.css('height', $aspectRatio * $parentCol.width()); 14233 } 14234 14235 } 14236 14237 // Regular 14238 else { 14239 14240 // Min height 14241 if ($definedHeight * dif <= $minHeight) { 14242 $sliderSelectors.css('height', $minHeight); 14243 } else { 14244 $sliderSelectors.css('height', Math.ceil($definedHeight * dif)); 14245 } 14246 14247 } 14248 14249 } 14250 14251 });
14252 14253 } 14254 14255 14256 function sliderColumnDesktopWidth(parentCol) { 14257 14258 var $parentColWidth = 1100, 14259 $columnNumberParsed = $(parentCol).attr('class').match(/\d+/); 14260 14261 if ($columnNumberParsed == '2') { 14262 $parentColWidth = 170 14263 } else if ($columnNumberParsed == '3') { 14264 $parentColWidth = 260 14265 } else if ($columnNumberParsed == '4') { 14266 $parentColWidth = 340 14267 } else if ($columnNumberParsed == '6') { 14268 $parentColWidth = 530 14269 } else if ($columnNumberParsed == '8') { 14270 $parentColWidth = 700 14271 } else if ($columnNumberParsed == '9') { 14272 $parentColWidth = 805 14273 } else if ($columnNumberParsed == '10') { 14274 $parentColWidth = 916.3 14275 } else if ($columnNumberParsed == '12') { 14276 $parentColWidth = 1100 14277 } 14278 14279 return $parentColWidth; 14280 } 14281 14282 14283 /** 14284 * Spit text into separate lines to animate in 14285 * 14286 * @since 7.0 14287 */ 14288 14289 function splitLineText() { 14290 $('.nectar-recent-posts-single_featured.multiple_featured').each(function () { 14291 14292 var $slideClass = ($(this).find('.project-slides').length > 0) ? '.project-slide' : '.nectar-recent-post-slide', 14293 $slideInfoClass = ($(this).find('.project-slides').length > 0) ? '.project-info h1' : '.inner-wrap h2 a'; 14294 14295 $(this).find($slideClass).each(function () { 14296 14297 $(this).find($slideInfoClass).each(function () { 14298 14299 var textArr = $(this).text(); 14300 textArr = textArr.trim(); 14301 textArr = textArr.split(' '); 14302 14303 $(this)[0].innerHTML = ''; 14304 14305 for (var i = 0; i < textArr.length; i++) { 14306 $(this)[0].innerHTML += '<span>' + textArr[i] + '</span> '; 14307 } 14308 14309 }); 14310 14311 $(this).find($slideInfoClass + ' > span').wrapInner('<span class="inner" />'); 14312 14313 }); 14314 14315 }); 14316 14317 } 14318 14319 14320 /** 14321 * Spit text into separate lines to animate in 14322 * 14323 * @since 7.0 14324 */ 14325 14326 function splitLineHeadingMarkup() { 14327 14328 $('.nectar-split-heading[data-animation-type="line-reveal-by-space"]').each(function () { 14329 14330 $(this).find('> *').each(function () { 14331 14332 var textArr = $(this).text(); 14333 textArr = textArr.trim(); 14334 textArr = textArr.split(' '); 14335 14336 $(this)[0].innerHTML = ''; 14337 14338 for (var i = 0; i < textArr.length; i++) { 14339 $(this)[0].innerHTML += '<span>' + textArr[i] + '</span> '; 14340 } 14341 14342 }); 14343 14344 if( !$(this).hasClass('animated-in') ) { 14345 $(this).find('> * > span').wrapInner('<span class="inner" />'); 14346 } else { 14347 $(this).find('> * > span').wrapInner('<span class="inner animated" />'); 14348 } 14349 14350 $(this).addClass('markup-generated'); 14351 14352 }); 14353 14354 $('.nectar-split-heading[data-animation-type="letter-fade-reveal"]').each(function () { 14355 14356 14357 $(this).find('> *').each(function () { 14358 14359 var textArr = $(this).text(); 14360 textArr = textArr.trim(); 14361 textArr = textArr.split(' '); 14362 14363 $(this)[0].innerHTML = ''; 14364 14365 for (var i = 0; i < textArr.length; i++) { 14366 $(this)[0].innerHTML += '<span>' + textArr[i] + '</span> '; 14367 } 14368 14369 }); 14370 14371 14372 $(this).find('span').each(function () { 14373 14374 var $this = $(this); 14375 var textArr = $(this).text().split(''); 14376 14377 $this.empty(); 14378 14379 $.each(textArr, function (i, el) { 14380 $this.append("<span>" + el + "</span"); 14381 }); 14382 14383 }); 14384 14385 $(this).addClass('markup-generated'); 14386 14387 }); 14388 14389 } 14390 14391 function splitLineHeadingInit() { 14392 14393 if( $('.nectar-split-heading[data-animation-type="line-reveal-by-space"]').length > 0 || $('.nectar-split-heading[data-animation-type="letter-fade-reveal"]').length > 0 ) { 14394 // Generate markup. 14395 splitLineHeadingMarkup(); 14396 } 14397 14398 } 14399 14400 14401 /** 14402 * Create recent post sliders 14403 * 14404 * @since 7.0 14405 */ 14406 function recentPostsFlickityInit() { 14407 14408 14409 if ($('.nectar-recent-posts-slider-inner').length > 0) { 14410 14411 var $rpFGroupCells = ($('.nectar-recent-posts-slider_multiple_visible').length > 0) ? '90%' : false; 14412 14413 var $rpF = $('.nectar-recent-posts-slider-inner').flickity({ 14414 contain: true, 14415 groupCells: $rpFGroupCells, 14416 draggable: true, 14417 lazyLoad: false, 14418 imagesLoaded: true, 14419 percentPosition: true,
14420 prevNextButtons: false, 14421 pageDots: true, 14422 resize: true, 14423 setGallerySize: true, 14424 wrapAround: true, 14425 accessibility: false 14426 }); 14427 14428 setTimeout(function () { 14429 $('.nectar-recent-posts-slider-inner').addClass('loaded'); 14430 }, 1150); 14431 var flkty = $rpF.data('flickity'); 14432 14433 $rpF.on('dragStart.flickity', function () { 14434 $('.flickity-viewport').addClass('is-moving'); 14435 }); 14436 14437 $rpF.on('dragEnd.flickity', function () { 14438 $('.flickity-viewport').removeClass('is-moving'); 14439 }); 14440 14441 var $dragTimeout; 14442 14443 $rpF.on('select.flickity', function () { 14444 14445 $('.flickity-viewport').addClass('no-hover'); 14446 clearTimeout($dragTimeout); 14447 $dragTimeout = setTimeout(function () { 14448 $('.flickity-viewport').removeClass('no-hover'); 14449 }, 400); 14450 14451 }); 14452 14453 recentPostSliderHeight(); 14454 $window.on('resize', recentPostSliderHeight); 14455 14456 if (!nectarDOMInfo.usingMobileBrowser && !nectarDOMInfo.usingFrontEndEditor) { 14457 $window.on('resize', recentPostSliderParallaxMargins); 14458 } 14459 14460 14461 } 14462 14463 14464 14465 // Multiple featured controls 14466 function multipleLargeFeaturedInit() { 14467 $('.nectar-recent-posts-single_featured.multiple_featured').each(function (sliderIndex) { 14468 14469 if ($(this).find('> .normal-container').length > 0) { 14470 $(this).find('> .normal-container').remove(); 14471 } 14472 14473 $(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>'); 14474 var $that = $(this); 14475 var tallestFeaturedSlide = 0; 14476 var $slideClickTimeout; 14477 14478 // Store instance 14479 $nectarCustomSliderRotate[sliderIndex] = { 14480 autorotate: '' 14481 }; 14482 14483 $(this).find('.nectar-recent-post-slide').each(function (i) { 14484 14485 if ($(this).find('.recent-post-container').height() > tallestFeaturedSlide) { 14486 $(this).siblings().removeClass('tallest'); 14487 $(this).addClass('tallest'); 14488 tallestFeaturedSlide = $(this).find('.recent-post-container').height(); 14489 } 14490 14491 var $activeClass = (i == 0 && $(this).parents('.nectar-recent-posts-single_featured.multiple_featured[data-autorotate="none"]').length > 0) ? 'class="active"' : ''; 14492 $that.find('.controls').append('<li ' + $activeClass + '><span class="title">' + $(this).find('h2').text() + '</span></li>'); 14493 }); 14494 14495 $(this).addClass('js-loaded'); 14496 14497 14498 // Click event 14499 $(this).find('.controls li').on('click', function (e) { 14500 14501 if ($(this).hasClass('active')) { 14502 return; 14503 } 14504 14505 if (e.originalEvent !== undefined) { 14506 $(this).parent().find('.active').addClass('trans-out'); 14507 } 14508 14509 var $index = $(this).index(), 14510 $oldIndex = $(this).parent().find('.active').index(), 14511 $that = $(this); 14512 14513 clearTimeout($slideClickTimeout); 14514 14515 $(this).siblings().removeClass('active'); 14516 $(this).addClass('active'); 14517 14518 $slideClickTimeout = setTimeout(function () { 14519 14520 $that.parents('.multiple_featured') 14521 .find('.nectar-recent-post-slide:not(:eq(' + $index + '))') 14522 .css('opacity', '0') 14523 .removeClass('active'); 14524 14525 $that.parent() 14526 .find('.trans-out') 14527 .removeClass('trans-out'); 14528 14529 }, 300); 14530 14531 $that.parents('.multiple_featured') 14532 .find('.nectar-recent-post-slide:not(:eq(' + $index + '))') 14533 .css('z-index', '10'); 14534 14535 $that.parents('.multiple_featured') 14536 .find('.nectar-recent-post-slide:eq(' + $oldIndex + ')') 14537 .css('z-index', '15'); 14538 14539 $(this).parents('.multiple_featured').find('.nectar-recent-post-slide').eq($index).css({ 14540 'opacity': '1', 14541 'z-index': '20' 14542 }).addClass('active'); 14543 14544 if ($(this).parents('.multiple_featured').attr('data-autorotate') != 'none') { 14545 nectarCustomSliderResetRotate($that.parents('.nectar-recent-posts-single_featured.multiple_featured'), sliderIndex); 14546 } 14547 });
14548 14549 14550 // Autorotate 14551 $that = $(this); 14552 14553 if ($(this).attr('data-autorotate').length > 0 && 14554 $(this).attr('data-autorotate') != 'none' && 14555 $('body.vc_editor').length == 0) { 14556 14557 setTimeout(function () { 14558 var slide_interval = (parseInt($that.attr('data-autorotate')) < 100) ? 4000 : parseInt($that.attr('data-autorotate')); 14559 14560 $nectarCustomSliderRotate[sliderIndex].autorotate = setInterval(function () { 14561 nectarCustomSliderRotate($that) 14562 }, slide_interval); 14563 14564 // Set first active class 14565 $that 14566 .find('.controls > li:first-child') 14567 .addClass('active'); 14568 14569 }, 30); 14570 14571 } 14572 14573 }); 14574 14575 splitLineText(); 14576 $window.on('resize', splitLineText); 14577 14578 } 14579 14580 multipleLargeFeaturedInit(); 14581 14582 } 14583 14584 14585 14586 /** 14587 * Default recent post slider parallax RAF loop. 14588 * 14589 * @since 7.0 14590 */ 14591 function recentPostSliderParallax() { 14592 14593 $('.nectar-recent-posts-slider').each(function () { 14594 14595 var $offset = parseInt($(this).find('.flickity-slider').position().left), 14596 $slides = $(this).find('.nectar-recent-post-slide'), 14597 $slideLength = $slides.length, 14598 $slideWidth = $slides.width(), 14599 $lastChildIndex = $(this).find('.nectar-recent-post-slide:last-child').index(), 14600 $slideFirstChildBG = $(this).find('.nectar-recent-post-slide:first-child .nectar-recent-post-bg'), 14601 $slideLastChildBG = $(this).find('.nectar-recent-post-slide:last-child .nectar-recent-post-bg'); 14602 14603 // First going to last 14604 if ($offset >= -3) { 14605 $slideLastChildBG.css('margin-left', parseInt(Math.ceil($slideWidth / 3.5)) + 'px'); 14606 } else { 14607 $slideLastChildBG.css('margin-left', '-' + parseInt(Math.ceil($slideWidth / 3.5 * $lastChildIndex)) + 'px'); 14608 } 14609 14610 // Last going to first 14611 if (Math.abs($offset) >= ($slideLength - 1) * $slideWidth) { 14612 $slideFirstChildBG.css('margin-left', '-' + parseInt(Math.ceil(($slideWidth / 3.5) * $slideLength)) + 'px'); 14613 } else { 14614 $slideFirstChildBG.css('margin-left', '0px'); 14615 } 14616 14617 $(this) 14618 .find('.nectar-recent-post-bg') 14619 .css('transform', 'translateX(' + Math.ceil($(this).find('.flickity-slider').position().left / -3.5) + 'px)'); 14620 14621 }); 14622 14623 requestAnimationFrame(recentPostSliderParallax); 14624 14625 } 14626 14627 /** 14628 * Default recent post slider margin calculations. 14629 * 14630 * @since 7.0 14631 */ 14632 function recentPostSliderParallaxMargins() { 14633 14634 $('.nectar-recent-posts-slider').each(function () { 14635 14636 var $slideWidth = $(this).find('.nectar-recent-post-slide').width(); 14637 14638 $(this).find('.nectar-recent-post-slide').each(function (i) { 14639 $(this).find('.nectar-recent-post-bg').css('margin-left', '-' + parseInt(Math.ceil($slideWidth / 3.5) * i) + 'px'); 14640 }); 14641 14642 }); 14643 14644 } 14645 14646 14647 14648 /** 14649 * Initialize all recent post elements. 14650 * 14651 * @since 7.0 14652 */ 14653 function recentPostsInit() { 14654 14655 // Start flickity based sliders. 14656 recentPostsFlickityInit(); 14657 14658 14659 // Classic enhanced specific 14660 $('.blog-recent[data-style="classic_enhanced_alt"] .inner-wrap').each(function () { 14661 $(this).find('.post-featured-img').each(function () { 14662 var $src = $(this).find('img').attr('src'); 14663 $(this).css('background-image', 'url(' + $src + ')'); 14664 }); 14665 }); 14666 14667 $('.blog-recent[data-style="classic_enhanced"]').each(function () { 14668 if ($(this).find('.inner-wrap.has-post-thumbnail').length == 0) { 14669 $(this).addClass('no-thumbs'); 14670 } 14671 }); 14672 14673 // Regular recent posts slider. 14674 if (!nectarDOMInfo.usingMobileBrowser) { 14675 if ($('.nectar-recent-posts-slider').length > 0 && !nectarDOMInfo.usingFrontEndEditor) { 14676 window.requestAnimationFrame(recentPostSliderParallax); 14677 } 14678 } 14679 14680 if (!nectarDOMInfo.usingMobileBrowser && !nectarDOMInfo.usingFrontEndEditor) { 14681 recentPostSliderParallaxMargins(); 14682 } 14683 14684 } 14685 14686 14687 14688 14689 /** 14690 * Parallax on mousemove effect 14691 * 14692 * @since 10.5 14693 */ 14694 function parallaxItemHoverEffect() { 14695 14696 //change sizer pos 14697 $('.style-5').each(function () { 14698 $(this) 14699 .find('.sizer') 14700 .insertBefore($(this).find('.parallaxImg')); 14701 });
14702 14703 // Set parent zindex 14704 $('.style-5') 14705 .parents('.wpb_row') 14706 .css('z-index', '100'); 14707 14708 var d = document, 14709 bd = d.getElementsByTagName('body')[0], 14710 win = window, 14711 imgs = d.querySelectorAll('.parallaxImg'), 14712 totalImgs = imgs.length, 14713 supportsTouch = 'ontouchstart' in win || navigator.msMaxTouchPoints; 14714 14715 if (totalImgs <= 0) { 14716 return; 14717 } 14718 14719 // Build HTML 14720 for (var l = 0; l < totalImgs; l++) { 14721 14722 var thisImg = imgs[l], 14723 layerElems = thisImg.querySelectorAll('.parallaxImg-layer'), 14724 totalLayerElems = layerElems.length; 14725 14726 if (totalLayerElems <= 0) { 14727 continue; 14728 } 14729 14730 while (thisImg.firstChild) { 14731 thisImg.removeChild(thisImg.firstChild); 14732 } 14733 14734 var lastMove = 0; 14735 14736 //throttle performance old browsers 14737 var eventThrottle = 80; 14738 if ( navigator.userAgent.indexOf("Chrome") > -1 && navigator.userAgent.indexOf("Edge/") < 1 ) { 14739 eventThrottle = 1; 14740 $('html').addClass('cssreflections'); 14741 } else { 14742 $body.addClass('cssreflections'); 14743 } 14744 14745 var containerHTML = d.createElement('div'), 14746 shineHTML = d.createElement('div'), 14747 shadowHTML = d.createElement('div'), 14748 layersHTML = d.createElement('div'), 14749 layers = []; 14750 14751 thisImg.id = 'parallaxImg__' + l; 14752 containerHTML.className = 'parallaxImg-container'; 14753 shadowHTML.className = 'parallaxImg-shadow'; 14754 layersHTML.className = 'parallaxImg-layers'; 14755 14756 for (var i = 0; i < totalLayerElems; i++) { 14757 14758 var layer = d.createElement('div'), 14759 layerInner = d.createElement('div'), 14760 imgSrc = layerElems[i].getAttribute('data-img'); 14761 14762 $(layer).html($(layerElems[i]).html()); 14763 layer.className = 'parallaxImg-rendered-layer'; 14764 layer.setAttribute('data-layer', i); 14765 14766 if (i == 0 && $(thisImg).parents('.wpb_gallery').length == 0) { 14767 layerInner.className = 'bg-img'; 14768 layerInner.style.backgroundImage = 'url(' + imgSrc + ')'; 14769 layer.appendChild(layerInner); 14770 } 14771 layersHTML.appendChild(layer); 14772 14773 layers.push(layer); 14774 } 14775 14776 containerHTML.appendChild(layersHTML); 14777 thisImg.appendChild(containerHTML); 14778 $(thisImg).wrap('<div class="parallaxImg-wrap" />'); 14779 if (!(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1)) { 14780 $(thisImg).parent().append(shadowHTML); 14781 } 14782 14783 if (supportsTouch && $('body.using-mobile-browser').length > 0) { 14784 // Stop processing. 14785 } else { 14786 (function (_thisImg, _layers, _totalLayers, _shine) { 14787 $(thisImg).parents('.style-5').on('mousemove', function (e) { 14788 14789 var parentEl = $(this); 14790 var parallaxContainer = parentEl.find('.parallaxImg-container'); 14791 var parallaxShad = parentEl.find('.parallaxImg-shadow'); 14792 14793 var now = Date.now(); 14794 14795 var usingGallery = ($(_thisImg).parents('.wpb_gallery').length > 0) ? true : false; 14796 14797 if (now > lastMove + eventThrottle) { 14798 lastMove = now; 14799 window.requestAnimationFrame(function () { 14800 processMovement(e, false, _thisImg, _layers, _totalLayers, _shine, parentEl, parallaxContainer, parallaxShad, usingGallery); 14801 }); 14802 } 14803 14804 14805 });
14806 $(thisImg).parents('.style-5').on('mouseenter', function (e) { 14807 processEnter(e, _thisImg, _layers, _totalLayers, _shine); 14808 }); 14809 $(thisImg).parents('.style-5').on('mouseleave', function (e) { 14810 processExit(e, _thisImg, _layers, _totalLayers, _shine); 14811 }); 14812 })(thisImg, layers, totalLayerElems, shineHTML); 14813 } 14814 14815 // Set the depths 14816 (function (_thisImg, _layers, _totalLayers, _shine) { 14817 depths(false, _thisImg, _layers, _totalLayers, _shine); 14818 window.addEventListener('resize', function () { 14819 depths(false, _thisImg, _layers, _totalLayers, _shine); 14820 }); 14821 })(thisImg, layers, totalLayerElems, shineHTML); 14822 } 14823 14824 function processMovement(e, touchEnabled, elem, layers, totalLayers, shine, parentEl, parallaxContainer, parallaxShad, usingGal) { 14825 14826 // Stop raf if exit already called 14827 if (!$(elem.firstChild).hasClass('over')) { 14828 processExit(e, elem, layers, totalLayers, shine); 14829 return false 14830 } 14831 14832 // Set up multipliers 14833 var yMult = 0.03; 14834 var xMult = 0.063; 14835 14836 var scaleAmount = '1.03'; 14837 var offsetAmount = '-10'; 14838 var usingMasonrySize = false; 14839 14840 if ($(elem).parents('.col.wide').length > 0) { 14841 yMult = 0.03; 14842 xMult = 0.063; 14843 usingMasonrySize = true; 14844 } else if ($(elem).parents('.col.regular').length > 0 || $(elem).parents('.wpb_gallery').length > 0) { 14845 yMult = 0.045; 14846 xMult = 0.045; 14847 } else if ($(elem).parents('.col.tall').length > 0) { 14848 yMult = 0.05; 14849 xMult = 0.015; 14850 usingMasonrySize = true; 14851 } else if ($(elem).parents('.col.wide_tall').length > 0) { 14852 yMult = 0.04; 14853 xMult = 0.04; 14854 usingMasonrySize = true; 14855 } else if (parentEl.hasClass('nectar-fancy-box')) { 14856 yMult = 0.045; 14857 xMult = 0.022; 14858 scaleAmount = '1.06'; 14859 offsetAmount = '-2'; 14860 } else { 14861 yMult = 0.045; 14862 xMult = 0.075; 14863 } 14864 14865 var bdst = nectarDOMInfo.scrollTop, 14866 bdsl = 0, 14867 pageX = (touchEnabled) ? e.touches[0].pageX : e.pageX, 14868 pageY = (touchEnabled) ? e.touches[0].pageY : e.pageY, 14869 offsets = elem.getBoundingClientRect(), 14870 w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth, 14871 h = elem.clientHeight || elem.offsetHeight || elem.scrollHeight, 14872 wMultiple = 320 / w, 14873 offsetX = 0.52 - (pageX - offsets.left - bdsl) / w, 14874 offsetY = 0.52 - (pageY - offsets.top - bdst) / h, 14875 dy = (pageY - offsets.top - bdst) - h / 2, 14876 dx = (pageX - offsets.left - bdsl) - w / 2, 14877 yRotate = (offsetX - dx) * (yMult * wMultiple), 14878 xRotate = (dy - offsetY) * (xMult * wMultiple); 14879 14880 var imgCSS; 14881 14882 if (usingGal == true) { 14883 imgCSS = ' perspective(' + w * 3 + 'px) rotateX(' + -xRotate * 1.9 + 'deg) rotateY(' + -yRotate * 1.3 + 'deg)'; 14884 } else { 14885 14886 if (usingMasonrySize == false) { 14887 imgCSS = ' perspective(' + w * 3 + 'px) rotateX(' + xRotate + 'deg) rotateY(' + yRotate + 'deg) translateY(' + offsetY * offsetAmount + 'px) translateX(' + offsetX * offsetAmount + 'px) scale(' + scaleAmount + ')'; 14888 } else { 14889 imgCSS = ' perspective(' + w * 3 + 'px) rotateX(' + xRotate + 'deg) rotateY(' + yRotate + 'deg) translateY(' + offsetY * -10 + 'px) translateX(' + offsetX * -10 + 'px) scale(1.013)'; 14890 } 14891 14892 } 14893 14894 14895 // Container transform 14896 parallaxContainer.css('transform', imgCSS); 14897 14898 if (!(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1)) { 14899 parallaxShad.css('transform', imgCSS); 14900 } 14901 14902 14903 } 14904 14905 14906 function processEnter(e, elem) { 14907 14908 elem.firstChild.className += ' over'; 14909 elem.className += ' over'; 14910 14911 $(elem).addClass('transition'); 14912 14913 if ($(elem).parents('.wpb_gallery').length > 0) { 14914 setTimeout(function () { 14915 $(elem).removeClass('transition'); 14916 }, 450); 14917 } else { 14918 setTimeout(function () { 14919 $(elem).removeClass('transition'); 14920 }, 200); 14921 } 14922 14923 } 14924 14925 14926 function processExit(e, elem) { 14927 14928 var w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth; 14929 var container = elem.firstChild; 14930 14931 container.className = container.className.replace(' over', ''); 14932 elem.className = elem.className.replace(' over', ''); 14933 $(container).css('transform', 'perspective(' + w * 3 + 'px) rotateX(0deg) rotateY(0deg) translateZ(0)'); 14934 $(elem).parents('.parallaxImg-wrap').find('.parallaxImg-shadow').css('transform', 'perspective(' + w * 3 + 'px) rotateX(0deg) rotateY(0deg) translateZ(0)'); 14935 14936 $(elem).addClass('transition'); 14937 setTimeout(function () { 14938 $(elem).removeClass('transition'); 14939 }, 200); 14940 14941 } 14942 14943 14944 function depths(touchEnabled, elem, layers, totalLayers) { 14945 14946 var w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth; 14947 var container = elem.firstChild; 14948 14949 // Set z 14950 for (var ly = 0; ly < totalLayers; ly++) { 14951 if (ly == 0) { 14952 $(layers[ly]).css('transform', 'translateZ(0px)'); 14953 } 14954 else { 14955 $(layers[ly]).css('transform', 'translateZ(' + (w * 3) / 27 * (ly * 1.1) + 'px) '); 14956 } 14957 14958 } 14959 14960 totalLayers = totalLayers + 3; 14961 14962 // Set perspective from beginning 14963 $(container).css('transform', 'perspective(' + w * 3 + 'px)'); 14964 14965 } 14966 14967 } 14968 14969 14970 /** 14971 * Fancy Box 14972 * 14973 * @since 11.0 14974 */ 14975 function nectarFancyBoxHover() { 14976 14977 if( $('.nectar-fancy-box[data-style="hover_desc"]').length == 0 ) { 14978 return false; 14979 } 14980 14981 var $hoverContentHeight = 0; 14982 14983 $('body').on('mouseenter touchstart','.nectar-fancy-box[data-style="hover_desc"]', function() { 14984 $hoverContentHeight = parseInt($(this).find('.hover-content').outerHeight(true)); 14985 $(this).addClass('hovered'); 14986 $(this).find('.heading-wrap').css('transform','translateY(-'+ $hoverContentHeight +'px)'); 14987 });
14988 14989 $('body').on('mouseleave touchend','.nectar-fancy-box[data-style="hover_desc"]', function() { 14990 $(this).removeClass('hovered'); 14991 $(this).find('.heading-wrap').css('transform','translateY(0)'); 14992 }); 14993 14994 } 14995 14996 14997 14998 /** 14999 * Mouse Follow Icon 15000 * 15001 * @since 11.0 15002 */ 15003 function NectarMouseFollowIcon(el,iconSelector) { 15004 15005 this.$el = el; 15006 this.$iconEl = this.$el.find(iconSelector); 15007 15008 this.elX = 0; 15009 this.elY = 0; 15010 15011 this.initialX = this.$el.width() / 2; 15012 this.initialY = this.$el.height() / 2; 15013 15014 this.elX = 0; 15015 this.elY = 0; 15016 15017 this.lastScroll = 0; 15018 this.scrollAdjust = 0; 15019 15020 this.lastX = this.initialX; 15021 this.lastY = this.initialY; 15022 this.activeFollow = false; 15023 15024 this.percentage = 0.13; 15025 this.percentageTimeout; 15026 15027 $window.on('resize', this.resizeEvent.bind(this)); 15028 this.mouseEvents(); 15029 this.rafLoop(); 15030 15031 } 15032 15033 NectarMouseFollowIcon.prototype.resizeEvent = function() { 15034 this.initialX = this.$el.width() / 2; 15035 this.initialY = this.$el.height() / 2; 15036 }; 15037 15038 NectarMouseFollowIcon.prototype.mouseEvents = function() { 15039 15040 var that = this; 15041 15042 that.$el.on('mouseenter', function(e) { 15043 15044 that.activeFollow = true; 15045 15046 that.elX = e.offsetX; 15047 that.elY = e.offsetY; 15048 15049 that.lastScroll = 0; 15050 15051 clearTimeout(that.percentageTimeout); 15052 that.percentageTimeout = setTimeout(function(){ 15053 that.percentage = 0.2; 15054 },700); 15055 }); 15056 15057 that.$el.on('mouseleave', function() { 15058 15059 that.activeFollow = false; 15060 that.lastScroll = 0; 15061 15062 clearTimeout(that.percentageTimeout); 15063 that.percentage = 0.13; 15064 }); 15065 15066 that.$el.on('mousemove', function(e){ 15067 that.elX = e.offsetX; 15068 that.elY = e.offsetY; 15069 that.lastScroll = 0; 15070 }); 15071 15072 $(window).on('scroll',function() { 15073 if( that.activeFollow == true && that.lastScroll == 0) { 15074 that.lastScroll = nectarDOMInfo.scrollTop; 15075 } 15076 }); 15077 15078 }; 15079 15080 15081 NectarMouseFollowIcon.prototype.rafLoop = function() { 15082 15083 if( this.activeFollow == true ) { 15084 15085 this.scrollAdjust = ( this.lastScroll > 0 ) ? nectarDOMInfo.scrollTop - this.lastScroll : 0; 15086 15087 this.lastY = linearInterpolate(this.lastY, this.elY + this.scrollAdjust, this.percentage); 15088 this.lastX = linearInterpolate(this.lastX, this.elX, this.percentage); 15089 } else { 15090 this.lastY = linearInterpolate(this.lastY, this.initialY, 0.13); 15091 this.lastX = linearInterpolate(this.lastX, this.initialX, 0.13); 15092 } 15093 15094 this.$iconEl.css({ 15095 'transform': 'translateX(' + this.lastX + 'px) translateY(' + this.lastY + 'px)' 15096 }); 15097 15098 requestAnimationFrame(this.rafLoop.bind(this)); 15099 15100 }; 15101 15102 15103 15104 15105 /** 15106 * Video Lightbox 15107 * 15108 * @since 11.0 15109 */ 15110 function nectarVideoLightbox() { 15111 15112 iconMouseFollowArr = []; 15113 15114 // Parent hover relationship. 15115 $body.on('mouseenter','.nectar_video_lightbox[data-parent-hover="1"]', function() { 15116 var $parentRow = $(this).parents('.wpb_row'); 15117 $parentRow.find('> .row-bg-wrap .row-bg, > .nectar-video-wrap .nectar-video-inner').addClass('transition'); 15118 $parentRow.find('> .row-bg-wrap .row-bg, > .nectar-video-wrap .nectar-video-inner').css({ 15119 'transform' : 'scale(1.08)' 15120 }); 15121 }); 15122 15123 $body.on('mouseleave','.nectar_video_lightbox[data-parent-hover="1"]', function() { 15124 var $parentRow = $(this).parents('.wpb_row'); 15125 $parentRow.find('> .row-bg-wrap .row-bg, > .nectar-video-wrap .nectar-video-inner').css({ 15126 'transform' : 'scale(1)' 15127 }); 15128 }); 15129 15130 // Mouse Indicator. 15131 $('.nectar-video-box').each(function(i){ 15132 15133 if( $(this).find('.play_button_mouse_follow') ) { 15134 15135 var $that = $(this); 15136 15137 $(this).imagesLoaded(function () { 15138 15139 // Follow mouse. 15140 if( !nectarDOMInfo.usingMobileBrowser ) { 15141 iconMouseFollowArr[i] = new NectarMouseFollowIcon($that, '.play_button_mouse_follow'); 15142 } 15143 15144 // Initial setup. 15145 var $playColor = ( $that.is('[data-mouse-icon-color]') && $that.attr('data-mouse-icon-color').length > 0 ) ? $that.attr('data-mouse-icon-color') : '#000'; 15146 15147 if( $that.is('[data-mouse-style="solid_color"]') ) { 15148 15149 $that.find('.play_button_mouse_follow').css({ 15150 'background-color': $playColor 15151 });
15152 } 15153 15154 $that.find('.play_button_mouse_follow').addClass('visible'); 15155 15156 }); 15157 15158 } 15159 15160 }); 15161 15162 } 15163 15164 15165 15166 /** 15167 * Salient slider rotation 15168 * 15169 * @since 10.5 15170 */ 15171 function nectarCustomSliderRotate(slider) { 15172 15173 if ($('body.vc_editor').length > 0) { 15174 return; 15175 } 15176 15177 var $controlSelector = (slider.find('.project-slides').length > 0) ? '.dot-nav > span' : '.controls > li', 15178 $controlSelectorInd = (slider.find('.project-slides').length > 0) ? 'span' : ' li', 15179 $slideLength = slider.find($controlSelector).length, 15180 $currentSlide = slider.find($controlSelector + '.active').index(); 15181 15182 if ($currentSlide + 1 == $slideLength) { 15183 slider.find($controlSelector + ':first-child').trigger('click'); 15184 } else { 15185 slider.find($controlSelector + '.active').next($controlSelectorInd).trigger('click'); 15186 } 15187 } 15188 15189 15190 /** 15191 * Salient slider rotation reset 15192 * 15193 * @since 10.5 15194 */ 15195 function nectarCustomSliderResetRotate(slider, index) { 15196 clearInterval($nectarCustomSliderRotate[index].autorotate); 15197 15198 // Reinit autorotate 15199 if (slider.attr('data-autorotate').length > 0) { 15200 var slide_interval = (parseInt(slider.attr('data-autorotate')) < 100) ? 4000 : parseInt(slider.attr('data-autorotate')); 15201 $nectarCustomSliderRotate[index].autorotate = setInterval(function () { 15202 nectarCustomSliderRotate(slider) 15203 }, slide_interval); 15204 } 15205 } 15206 15207 15208 15209 /** 15210 * Fullscreen recent project slider 15211 * 15212 * @since 10.5 15213 */ 15214 function fsProjectSliderInit() { 15215 15216 $fsProjectSliderArr = []; 15217 15218 if (typeof SalientRecentProjectsFullScreen === 'undefined') { 15219 return; 15220 } 15221 15222 $('.nectar_fullscreen_zoom_recent_projects').each(function (i) { 15223 $fsProjectSliderArr[i] = new SalientRecentProjectsFullScreen($(this)); 15224 }); 15225 15226 } 15227 15228 15229 15230 15231 15232 /** 15233 * Portfolio single template sticky sidebar 15234 * 15235 * @since 6.0 15236 */ 15237 function portfolioSidebarFollow() { 15238 15239 var sidebarFollow = $('.single-portfolio #sidebar').attr('data-follow-on-scroll'); 15240 15241 if ($('body.single-portfolio').length == 0 || $('#sidebar[data-follow-on-scroll]').length == 0) { 15242 return; 15243 } 15244 15245 sidebarFollow = $('.single-portfolio #sidebar').attr('data-follow-on-scroll'); 15246 15247 if (sidebarFollow == 1 && 15248 !$body.hasClass('mobile') && 15249 parseInt($('#sidebar').height()) + 50 <= parseInt($('.post-area').height())) { 15250 15251 //padding from top of screen 15252 var $ssExtraTopSpace = 50; 15253 15254 if ($('#header-outer[data-remove-fixed="0"]').length > 0 && 15255 $('body[data-hhun="1"]').length == 0) { 15256 15257 $ssExtraTopSpace += $headerOuterEl.outerHeight(); 15258 15259 // Resize effect 15260 if ($('#header-outer[data-shrink-num][data-header-resize="1"]').length > 0) { 15261 var headerPadding2 = parseInt($headerOuterEl.attr('data-padding')) - parseInt($headerOuterEl.attr('data-padding')) / 1.8; 15262 $ssExtraTopSpace -= logoShrinkNum; 15263 $ssExtraTopSpace -= headerPadding2; 15264 } 15265 15266 // Condense 15267 if ($('body.mobile').length == 0 && $('#header-outer[data-condense="true"]').length > 0) { 15268 15269 var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'); 15270 15271 $ssExtraTopSpace = 50; 15272 $ssExtraTopSpace += $headerOuterEl.height() - (parseInt($headerSpan9.position().top) - parseInt($('#header-outer #logo').css('margin-top'))) - parseInt(nectarDOMInfo.secondaryHeaderHeight); 15273 } 15274 15275 } 15276 15277 if ($wpAdminBar.length > 0) { 15278 $ssExtraTopSpace += $wpAdminBar.outerHeight(); 15279 } 15280 15281 15282 $('.single-portfolio #sidebar').theiaStickySidebar({ 15283 additionalMarginTop: $ssExtraTopSpace, 15284 updateSidebarHeight: false 15285 }); 15286 15287 15288 } 15289 15290 } 15291 15292 15293 15294 15295 15296 /** 15297 * Infinite scroll pagination 15298 * 15299 * @since 6.0 15300 */ 15301 function infiniteScrollInit() { 15302 15303 if ($('.infinite_scroll').length > 0) { 15304 15305 // Portfolio 15306 $('.portfolio-items.infinite_scroll').infinitescroll({ 15307 navSelector: "div#pagination", 15308 nextSelector: "div#pagination a:first", 15309 itemSelector: ".portfolio-items.infinite_scroll .element", 15310 finishedMsg: "<em>Congratulations, you've reached the end of the internet.</em>", 15311 msgText: " ", 15312 }, function (newElements) { 15313 15314 15315 var $container = $('.portfolio-items.infinite_scroll:not(.carousel)'), 15316 $newElems = $(newElements).css('opacity', 0); 15317 15318 // Ensure that images load before adding to masonry layout 15319 $newElems.imagesLoaded(function () { 15320 15321 $(newElements).css('opacity', 1); 15322 15323 $container.isotope('appended', $(newElements)); 15324 15325 $(newElements).find('.work-item').addClass('ajax-loaded'); 15326 $(newElements).addClass('ajax-loaded'); 15327
15328 // Show elems now they're ready 15329 $(newElements).find('.work-meta, .nectar-love-wrap').css({ 15330 'opacity': 1 15331 }); 15332 15333 // Keep current filtering 15334 if ($('.portfolio-filters-inline').length > 0 || $('.portfolio-filters').length > 0) { 15335 15336 var selector; 15337 15338 if ($('.portfolio-filters-inline').length > 0) { 15339 selector = $('.portfolio-filters-inline a.active').attr('data-filter'); 15340 } else { 15341 selector = $('.portfolio-filters a.active').attr('data-filter'); 15342 } 15343 15344 $('.portfolio-filters-inline a.active').attr('data-filter'); 15345 $container.isotope({ 15346 filter: selector 15347 }); 15348 } 15349 15350 // Set width 15351 for (var i = 0; i < $portfolio_containers.length; i++) { 15352 $portfolio_containers[i].reLayout(); 15353 } 15354 15355 if ($(newElements).find('.work-item.style-5').length > 0) { 15356 parallaxItemHoverEffect(); 15357 } 15358 15359 if ($(newElements).find('.inner-wrap').attr('data-animation') == 'none') { 15360 $('.portfolio-items .col .inner-wrap').removeClass('animated'); 15361 } else { 15362 15363 for (var i = 0; i < $portfolio_containers.length; i++) { 15364 $portfolio_containers[i].masonryZindex(); 15365 $portfolio_containers[i].portfolioAccentColor(); 15366 } 15367 15368 $(newElements).each(function () { 15369 15370 var $portfolioOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '90%'; 15371 15372 // Not already visible 15373 var $that = $(this); 15374 var waypoint = new Waypoint({ 15375 element: $that, 15376 handler: function () { 15377 15378 var $portfolioAnimationDelay = ($that.is('[data-masonry-type="photography"].masonry-items')) ? 85 : 115; 15379 15380 setTimeout(function () { 15381 $that.addClass("animated-in"); 15382 }, $portfolioAnimationDelay * $that.attr('data-delay-amount')); 15383 15384 15385 waypoint.destroy(); 15386 }, 15387 offset: $portfolioOffsetPos 15388 15389 }); 15390 15391 15392 }); 15393 } 15394 15395 15396 // Lightbox reinit. 15397 $('.portfolio-items').each(function () { 15398 var $unique_id = uniqueIdGenerate(); 15399 $(this).find('a[rel^="prettyPhoto"], a.pretty_photo').attr('rel', 'prettyPhoto[' + $unique_id + '_gal]').removeClass('pretty_photo'); 15400 });
15401 15402 15403 $('.portfolio-items').each(function () { 15404 var $unique_id = uniqueIdGenerate(); 15405 $(this).find('a[data-fancybox^="group_"]').attr('data-fancybox', 'group_' + $unique_id); 15406 }); 15407 15408 lightBoxInit(); 15409 15410 setTimeout(function () { 15411 15412 for (var i = 0; i < $portfolio_containers.length; i++) { 15413 $portfolio_containers[i].masonryZindex(); 15414 $portfolio_containers[i].reLayout(); 15415 $portfolio_containers[i].isotopeCatSelection(); 15416 } 15417 $(newElements).removeClass('ajax-loaded'); 15418 }, 700); 15419 15420 parallaxRowsBGCals(); 15421 15422 }); 15423 15424 15425 }); 15426 15427 // Blog 15428 $('.post-area.infinite_scroll .posts-container').infinitescroll({ 15429 navSelector: "div#pagination", 15430 nextSelector: "div#pagination a:first", 15431 itemSelector: ".post-area.infinite_scroll .posts-container .post", 15432 finishedMsg: "<em>Congratulations, you've reached the end of the internet.</em>", 15433 msgText: " " 15434 }, function (newElements) { 15435 15436 if($(newElements).find('[data-nectar-img-src]').length > 0) { 15437 nectarLazyImageLoading(); 15438 } 15439 15440 // Only trigger recalc of waypoints and elements if needed 15441 if ($('.masonry.classic').length > 0 || $('.post-area:not(.masonry):not(.featured_img_left)').length > 0 || $('.post-area.standard-minimal').length > 0) { 15442 15443 // Gallery 15444 flexsliderInit(); 15445 15446 15447 // Media players 15448 if ($().mediaelementplayer) { 15449 $(newElements).find('.wp-audio-shortcode, .wp-video-shortcode').mediaelementplayer(); 15450 } 15451 15452 15453 // Lightbox 15454 lightBoxInit(); 15455 15456 // Carousels 15457 if ($('.carousel').length > 0) { 15458 standardCarouselInit(); 15459 clientsCarouselInit(); 15460 } 15461 15462 // Waypoints 15463 waypoints(); 15464 15465 // Testimonial slider 15466 $('.testimonial_slider').animate({ 15467 'opacity': '1' 15468 }, 800); 15469 nectarTestimonialSliders(); 15470 nectarTestimonialSlidersEvents(); 15471 15472 setTimeout(function () { 15473 responsiveVideoIframesInit(); 15474 responsiveVideoIframes(); 15475 $window.trigger('resize'); 15476 }, 500); 15477 15478 15479 parallaxRowsBGCals(); 15480 15481 $window.trigger('resize'); 15482 15483 } // Non meta overlaid style 15484 else { 15485 parallaxRowsBGCals(); 15486 15487 $window.trigger('resize'); 15488 } 15489 15490 // Trigger Masonry as a callback 15491 var $container = $('.infinite_scroll .posts-container'); 15492 if ($container.parent().hasClass('masonry')) { 15493 15494 $(newElements).addClass('masonry-blog-item'); 15495 15496 15497 } //if masonry 15498 15499 15500 // Loading effect 15501 15502 //// hide new items while they are loading 15503 var $newElems = $(newElements); 15504 //// ensure that images load before adding to masonry layout 15505 15506 if ($newElems.find('img').length == 0) { 15507 $newElems = $('body'); 15508 } 15509 15510 $newElems.imagesLoaded(function () { 15511 15512 if ($container.parent().hasClass('masonry') && 15513 !$container.parent().hasClass('auto_meta_overlaid_spaced')) { 15514 $container.isotope('appended', $(newElements)); 15515 } 15516 15517 for (var i = 0; i < $nectarMasonryBlogs.length; i++) { 15518 $nectarMasonryBlogs[i].flickityBlogInit(); 15519 } 15520 15521 $(newElements).addClass('ajax-loaded');
15522 // Show elems now they're ready 15523 15524 15525 // Classic enhanced specific 15526 if ($container.parent().hasClass('classic_enhanced')) { 15527 $container.find('.large_featured.has-post-thumbnail.ajax-loaded .post-featured-img, .wide_tall.has-post-thumbnail.ajax-loaded .post-featured-img').each(function () { 15528 var $src = $(this).find('img').attr('src'); 15529 $(this).css('background-image', 'url(' + $src + ')'); 15530 }); 15531 15532 $container.find('.large_featured.ajax-loaded .nectar-flickity, .wide_tall.ajax-loaded .nectar-flickity').each(function () { 15533 15534 $(this).find('.cell').each(function () { 15535 var $src = $(this).find('img').attr('src'); 15536 $(this).css('background-image', 'url(' + $src + ')'); 15537 }); 15538 15539 }); 15540 } 15541 15542 15543 if ($(newElements).parents('.posts-container').attr('data-animation') == 'none') { 15544 $(newElements).find('.inner-wrap').removeClass('animated'); 15545 } else { 15546 15547 for (var i = 0; i < $nectarMasonryBlogs.length; i++) { 15548 $nectarMasonryBlogs[i].blogMasonryZindex(); 15549 } 15550 15551 $(newElements).each(function () { 15552 15553 var $that = $(this); 15554 var waypoint = new Waypoint({ 15555 15556 element: $that, 15557 handler: function () { 15558 15559 setTimeout(function () { 15560 $that.addClass("animated-in"); 15561 }, 80 * $that.attr('data-delay-amount')); 15562 15563 waypoint.destroy(); 15564 }, 15565 offset: '90%' 15566 15567 }); 15568 15569 15570 }); 15571 } 15572 15573 setTimeout(function () { 15574 $(newElements).removeClass('ajax-loaded'); 15575 }, 700); 15576 15577 15578 }); 15579 15580 15581 }); 15582 15583 } 15584 15585 } 15586 15587 15588 15589 15590 15591 15592 /** 15593 * Scroll to top scroll bind. 15594 * 15595 * @since 2.0 15596 */ 15597 function toTopBind() { 15598 15599 if ($('#to-top').length > 0 && $window.width() > 1020 || 15600 $('#to-top').length > 0 && $('#to-top.mobile-enabled').length > 0) { 15601 15602 if (nectarDOMInfo.scrollTop > 350) { 15603 $window.on('scroll', hideToTop); 15604 } else { 15605 $window.on('scroll', showToTop); 15606 } 15607 } 15608 15609 } 15610 15611 /** 15612 * Scroll to top show. 15613 * 15614 * @since 2.0 15615 */ 15616 function showToTop() { 15617 15618 if (nectarDOMInfo.scrollTop > 350 && !$offCanvasEl.is('.fullscreen.open') ) { 15619 15620 $('#to-top').stop().transition({ 15621 'bottom': '17px' 15622 }, 350, 'easeInOutCubic'); 15623 15624 $window.off('scroll', showToTop); 15625 $window.on('scroll', hideToTop); 15626 } 15627 15628 } 15629 15630 15631 /** 15632 * Scroll to top hide. 15633 * 15634 * @since 2.0 15635 */ 15636 function hideToTop() { 15637 15638 if (nectarDOMInfo.scrollTop < 350 || $offCanvasEl.is('.fullscreen.open') ) { 15639 15640 var $animationTiming = ($('#slide-out-widget-area.fullscreen.open').length > 0) ? 1150 : 350; 15641 15642 $('#to-top').stop().transition({ 15643 'bottom': '-30px' 15644 }, $animationTiming, 'easeInOutQuint'); 15645 15646 $window.off('scroll', hideToTop); 15647 $window.on('scroll', showToTop); 15648 15649 } 15650 } 15651 15652 15653 /** 15654 * Scroll to top initialization. 15655 * 15656 * @since 10.5 15657 */ 15658 function scrollToTopInit() { 15659 15660 // Show/hide based on scroll pos 15661 if ($('.nectar-social.fixed').length == 0) { 15662 toTopBind(); 15663 } 15664 15665 15666 // Rounded style 15667 if ($('body[data-button-style*="rounded"]').length > 0) { 15668 var $clone = $('#to-top .fa-angle-up').clone(); 15669 $clone.addClass('top-icon'); 15670 $('#to-top').prepend($clone); 15671 } 15672 15673 // Scroll up click event 15674 $body.on('click', '#to-top, a[href="#top"]', function () { 15675 $('body,html').stop().animate({ 15676 scrollTop: 0 15677 }, 800, 'easeOutQuad', function () { 15678 if ($('.nectar-box-roll').length > 0) { 15679 $body.trigger('mousewheel', [1, 0, 0]); 15680 } 15681 });
15682 return false; 15683 }); 15684 15685 } 15686 15687 15688 15689 15690 15691 15692 15693 15694 15695 /** 15696 * Scrollspy plugin initialization. 15697 * 15698 * @since 5.0 15699 */ 15700 function scrollSpyInit() { 15701 15702 var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $window.width() > 1000) ? 0 : $headerOuterEl.outerHeight(); 15703 15704 if ($('.page-template-template-no-header-footer').length > 0 || $('.page-template-template-no-header').length > 0) { 15705 $headerNavSpace = 0; 15706 } 15707 15708 //prevent jump to rop on empty items 15709 $('header#top .sf-menu li a[href="#"]').on('click', function (e) { 15710 e.preventDefault(); 15711 }); 15712 15713 if ($('#nectar_fullscreen_rows').length == 0 || $nectarFullPage.$usingFullScreenRows == false) { 15714 15715 $('a.nectar-next-section').each(function () { 15716 15717 if ($(this).parents('.wpb_row:not(.inner_row)').length > 0) { 15718 15719 var $parentRow = $(this).parents('.wpb_row:not(.inner_row)'), 15720 $parentRowIndex = $(this).parents('.wpb_row:not(.inner_row)').index(); 15721 15722 if ($parentRow.parent().find('> .wpb_row[id]:eq(' + ($parentRowIndex + 1) + ')').length > 0) { 15723 var $nextRowID = $parentRow.parent().find('> .wpb_row:eq(' + ($parentRowIndex + 1) + ')').attr('id'); 15724 $(this).attr('href', '#' + $nextRowID); 15725 } 15726 15727 } 15728 15729 }); 15730 } 15731 15732 else if ($().fullpage) { 15733 $('a.nectar-next-section').on('click', function () { 15734 $.fn.fullpage.moveSectionDown(); 15735 return false; 15736 }); 15737 } 15738 15739 15740 // Links in off canvas menu. 15741 if ($('#slide-out-widget-area .off-canvas-menu-container').length > 0) { 15742 $('#slide-out-widget-area .off-canvas-menu-container').find("a[href*='" + location.pathname + "']").each(function () { 15743 15744 var $href = $(this).attr('href'); 15745 15746 // Regular animated anchors. 15747 if ($href != '#' && 15748 $href.indexOf("#") != -1 && 15749 $href.substr($href.indexOf("#")) !== '#' && 15750 $('div' + $href.substr($href.indexOf("#"))).length > 0) { 15751 15752 $(this).attr('href', $href.substr($href.indexOf("#"))); 15753 15754 $(this).parent() 15755 .removeClass('current_page_item') 15756 .removeClass('current-menu-item'); 15757 } 15758 15759 // Fullpage is a little different. 15760 if ($('div[data-fullscreen-anchor-id="' + $href.substr($href.indexOf("#") + 1) + '"]').length > 0) { 15761 15762 $(this).parent() 15763 .removeClass('current_page_item') 15764 .removeClass('current-menu-item'); 15765 } 15766 15767 }); 15768 } 15769 15770 // Links in header navigation. 15771 $("#header-outer").find("a[href*='" + location.pathname + "']").each(function () { 15772 15773 var $href = $(this).attr('href'); 15774 15775 // Regular animated anchors 15776 if ($href.indexOf("#") != -1 && 15777 $href.substr($href.indexOf("#")) !== '#' && 15778 $('div' + $href.substr($href.indexOf("#"))).length > 0) { 15779 15780 $(this).attr('href', $href.substr($href.indexOf("#"))); 15781 $(this).parent() 15782 .removeClass('current_page_item') 15783 .removeClass('current-menu-item'); 15784 } 15785 15786 // Fullpage is a little different 15787 if ($('div[data-fullscreen-anchor-id="' + $href.substr($href.indexOf("#") + 1) + '"]').length > 0) { 15788 15789 $(this).parent() 15790 .removeClass('current_page_item') 15791 .removeClass('current-menu-item'); 15792 } 15793 15794 }); 15795 15796 // Start scrollspy. 15797 var $target = ($('.page-submenu[data-sticky="true"]').length == 0) ? '#header-outer nav' : '.page-submenu'; 15798 $body.scrollspy({ 15799 target: $target, 15800 offset: $headerNavSpace + nectarDOMInfo.adminBarHeight + 40 15801 }); 15802 15803 } 15804 15805 15806 15807 15808 /** 15809 * Called to scroll to hash link on page load 15810 * 15811 * @since 5.0 15812 */ 15813 function pageLoadHash() { 15814 15815 var $hash = window.location.hash; 15816 15817 if( $hash && $hash.length > 0 ) { 15818 $hash = $hash.replace(/<|>/g,''); 15819 } 15820 15821 var $hashSubstrng = ($hash && $hash.length > 0) ? $hash.substring(1, $hash.length) : 0, 15822 headerPadding2 = parseInt($headerOuterEl.attr('data-padding')) * 2, 15823 $hasSlashLength = 0; 15824 15825 // If the hash has slashes 15826 if ($hashSubstrng) { 15827 $hasSlashLength = $hashSubstrng.split("/"); 15828 $hasSlashLength = $hasSlashLength.length; 15829 } 15830 15831 if ($hashSubstrng && $hasSlashLength > 1) { 15832 $hashSubstrng = $hashSubstrng.replace(/\//g, ""); 15833 $hash = $hash.replace(/\//g, ""); 15834 } 15835 15836 if ($hash && $('.main-content').find($hash).length > 0 || 15837 $hash && $('.main-content').find('[data-fullscreen-anchor-id="' + $hashSubstrng + '"]').length > 0) { 15838 15839 var $hashObj = ($('.main-content').find($hash).length > 0) ? $('.main-content').find($hash) : $('.main-content').find('[data-fullscreen-anchor-id="' + $hashSubstrng + '"]'), 15840 $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $window.width() > 1000) ? 0 : $('#header-space').outerHeight(); 15841 15842 if ($('.page-template-template-no-header-footer').length > 0 || $('.page-template-template-no-header').length > 0) { 15843 $headerNavSpace = 0; 15844 } 15845 15846 var $timeoutVar = 0; 15847 15848 if ($('.nectar-box-roll').length > 0 && $('.container-wrap.bottomBoxOut').length > 0) { 15849 nectarBoxRoll.boxRoll(null, -1); 15850 $timeoutVar = 2050; 15851 } 15852 15853 setTimeout(function () { 15854 15855 var $scrollTopDistance; 15856 15857 if ($('body[data-permanent-transparent="1"]').length == 0) { 15858 15859 if (!$body.hasClass('mobile')) { 15860 var $resize = ($('#header-outer[data-header-resize="0"]').length > 0) ? 0 : parseInt(logoShrinkNum) + headerPadding2 * 2; 15861 if ($('#header-outer[data-remove-fixed="1"]').length > 0) { 15862 $headerNavSpace = 0; 15863 } 15864 $scrollTopDistance = $hashObj.offset().top - parseInt($headerNavSpace) + $resize + 3 - nectarDOMInfo.adminBarHeight; 15865 15866 15867 // Condense 15868 if ($('body.mobile').length == 0 && $('#header-outer[data-condense="true"]').length > 0) { 15869 15870 var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'), 15871 $headerHeightStored = $headerOuterEl.height(),
15872 $headerHeightCondensed = $headerHeightStored - (parseInt($headerSpan9.height()) + parseInt($('#header-outer #logo').css('margin-top'))); 15873 15874 $scrollTopDistance = $hashObj.offset().top - parseInt($headerNavSpace) + $headerHeightCondensed - nectarDOMInfo.adminBarHeight; 15875 } 15876 15877 } else { 15878 $scrollTopDistance = ($('#header-outer[data-mobile-fixed="1"]').length > 0) ? $hashObj.offset().top + 2 - $headerNavSpace + nectarDOMInfo.adminBarHeight : $hashObj.offset().top - nectarDOMInfo.adminBarHeight + 1; 15879 } 15880 15881 } else { 15882 $scrollTopDistance = $hashObj.offset().top - nectarDOMInfo.adminBarHeight + 1; 15883 } 15884 15885 if ($('body[data-hhun="1"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length == 0) { 15886 15887 // Alter offset 15888 if ($('#header-outer.detached').length == 0) { 15889 $scrollTopDistance = $scrollTopDistance + $headerNavSpace; 15890 } 15891 } 15892 15893 var $pageSubMenu = ($('.page-submenu[data-sticky="true"]').length > 0) ? $('.page-submenu').height() : 0; 15894 var $headerSecondary; 15895 15896 if ($('body.material').length > 0 && 15897 $headerSecondaryEl.length > 0 && 15898 $('body[data-hhun="1"]').length == 0 && 15899 $('#header-outer[data-remove-fixed="1"]').length == 0 && 15900 !$body.hasClass('mobile')) { 15901 15902 $headerSecondary = $headerSecondaryEl.height(); 15903 15904 } else { 15905 $headerSecondary = 0; 15906 } 15907 15908 nectar_scrollToY($scrollTopDistance - $pageSubMenu + $headerSecondary, 700, 'easeInOutQuint'); 15909 15910 }, $timeoutVar); 15911 } 15912 } 15913 15914 15915 /** 15916 * Initialize page load hash functionality 15917 * 15918 * @since 10.5 15919 */ 15920 function pageLoadHashInit() { 15921 15922 if ($('body[data-animated-anchors="true"]').length > 0) { 15923 if ($('.nectar-box-roll').length == 0 && $('#nectar_fullscreen_rows').length == 0) { 15924 15925 // Inside tabs 15926 if (typeof nectarGetQueryParam['tab'] != 'undefined') { 15927 setTimeout(function () { 15928 pageLoadHash(); 15929 }, 800); 15930 } 15931 // Regular 15932 else { 15933 pageLoadHash(); 15934 } 15935 15936 } 15937 15938 if ($('#nectar_fullscreen_rows[data-mobile-disable="on"]').length > 0 && $('.nectar-box-roll').length == 0 && 15939 nectarDOMInfo.usingMobileBrowser) { 15940 pageLoadHash(); 15941 } 15942 15943 } 15944 15945 } 15946 15947 15948 /** 15949 * Animated anchor link theme option. 15950 * 15951 * @since 10.5 15952 */ 15953 function animatedAnchorLinks() { 15954 15955 if ($('body[data-animated-anchors="true"]').length > 0 || 15956 $('.single-product [data-gallery-style="left_thumb_sticky"]').length > 0) { 15957 15958 var headerPadding2 = headerPadding - headerPadding / 1.8; 15959 15960 setTimeout(scrollSpyInit, 200); 15961 15962 var $animatedScrollingTimeout; 15963 15964 $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) { 15965 15966 var $hash = $(this).prop("hash"); 15967 15968 if( !$(this).hasClass('nectar-next-section') && headerHideUntilNeeded == '1' ) { 15969 $body.addClass('animated-scrolling'); 15970 } 15971 15972 clearTimeout($animatedScrollingTimeout); 15973 15974 $animatedScrollingTimeout = setTimeout(function () { 15975 $body.removeClass('animated-scrolling'); 15976 }, 850); 15977 15978 var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $window.width() > 1000) ? 0 : $('#header-space').outerHeight(); 15979 15980 if ($('.page-template-template-no-header-footer').length > 0 || $('.page-template-template-no-header').length > 0) { 15981 $headerNavSpace = 0; 15982 } 15983 15984 if ($hash && $body.find($hash).length > 0 && $hash != '#top' && $hash != '' && $(this).attr('href').indexOf(window.location.href.split("#")[0]) !== -1 || 15985 $(this).is('[href^="#"]') && $hash != '' && $body.find($hash).length > 0 && $hash != '#top') { 15986 15987 //update hash 15988 if (!$(this).hasClass('skip-hash')) { 15989 if (history.pushState) { 15990 history.pushState(null, null, $hash); 15991 } else { 15992 location.hash = $hash; 15993 } 15994 } 15995 15996 if ($(this).parents('ul').length > 0) { 15997 15998 $(this) 15999 .parents('ul') 16000 .find('li') 16001 .removeClass('current-menu-item'); 16002 } 16003 16004 // Side widget area click 16005 if ($(this).parents('#slide-out-widget-area').length > 0) { 16006
16007 if ($('body.material[data-slide-out-widget-area-style="slide-out-from-right"].material-ocm-open').length > 0) { 16008 16009 $('body > .slide_out_area_close') 16010 .addClass('non-human-allowed') 16011 .trigger('click'); 16012 16013 // Sroll 16014 var $clickedLinkStore = $(this); 16015 16016 setTimeout(function () { 16017 $clickedLinkStore.trigger('click'); 16018 }, 1000); 16019 16020 } else { 16021 $('#slide-out-widget-area .slide_out_area_close') 16022 .addClass('non-human-allowed') 16023 .trigger('click'); 16024 } 16025 16026 setTimeout(function () { 16027 if ($('body.material[data-slide-out-widget-area-style="slide-out-from-right"]').length > 0) { 16028 $('body > .slide_out_area_close').removeClass('non-human-allowed'); 16029 16030 } else { 16031 $('#slide-out-widget-area .slide_out_area_close').removeClass('non-human-allowed'); 16032 } 16033 }, 100); 16034 } 16035 16036 // Mobile menu click 16037 if ( $(this).parents('#mobile-menu').length > 0 ) { 16038 $('.slide-out-widget-area-toggle.mobile-icon a') 16039 .addClass('non-human-allowed') 16040 .trigger('click'); 16041 16042 setTimeout(function () { 16043 $('.slide-out-widget-area-toggle.mobile-icon a').removeClass('non-human-allowed'); 16044 }, 100); 16045 } 16046 16047 var $mobileMenuHeight = ($(this).parents('#mobile-menu').length > 0) ? $(this).parents('#mobile-menu').height() : null; 16048 var $timeoutVar = 1; 16049 var $that = $(this); 16050 16051 if ($('.nectar-box-roll').length > 0 && $('.container-wrap.bottomBoxOut').length > 0) { 16052 nectarBoxRoll.boxRoll(null, -1); 16053 $timeoutVar = 2050; 16054 } 16055 16056 16057 setTimeout(function () { 16058 16059 var $scrollTopDistance; 16060 16061 // Scrolling 16062 if ($('body[data-permanent-transparent="1"]').length == 0) { 16063 16064 if (!$body.hasClass('mobile')) { 16065 var $resize = ($('#header-outer[data-header-resize="0"]').length > 0) ? 0 : parseInt(logoShrinkNum) + headerPadding2 * 2; 16066 if ($('#header-outer[data-remove-fixed="1"]').length > 0) { 16067 $headerNavSpace = 0; 16068 } 16069 16070 $scrollTopDistance = $($hash).offset().top - $mobileMenuHeight - parseInt($headerNavSpace) + $resize + 3 - nectarDOMInfo.adminBarHeight; 16071 16072 // Condense 16073 if ($('body.mobile').length == 0 && $('#header-outer[data-condense="true"]').length > 0) { 16074 16075 var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'), 16076 $headerHeightStored = $headerOuterEl.height(),
16077 $headerHeightCondensed = $headerHeightStored - (parseInt($headerSpan9.height()) + parseInt($('#header-outer #logo').css('margin-top'))); 16078 $scrollTopDistance = $($hash).offset().top - parseInt($headerNavSpace) + $headerHeightCondensed - nectarDOMInfo.adminBarHeight; 16079 16080 } 16081 16082 16083 } else { 16084 $scrollTopDistance = ($('#header-outer[data-mobile-fixed="1"]').length > 0) ? $($hash).offset().top + 2 - $headerNavSpace + nectarDOMInfo.adminBarHeight : $($hash).offset().top - $mobileMenuHeight - nectarDOMInfo.adminBarHeight + 1; 16085 } 16086 16087 } else { 16088 $scrollTopDistance = $($hash).offset().top - nectarDOMInfo.adminBarHeight + 1; 16089 } 16090 16091 if ($('body[data-hhun="1"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length == 0) { 16092 16093 // Alter offset 16094 if ($('#header-outer.detached').length == 0 || $that.parents('.page-submenu[data-sticky="true"]').length > 0) { 16095 $scrollTopDistance = $scrollTopDistance + $headerNavSpace; 16096 } 16097 16098 // Hide top header 16099 if ($that.parents('.page-submenu[data-sticky="true"]').length > 0) { 16100 16101 $('#header-outer.detached').addClass('invisible'); 16102 $('.page-submenu') 16103 .addClass('header-not-visible') 16104 .css('transform', 'translateY(0px)'); 16105 16106 } 16107 } 16108 16109 var $pageSubMenu = ($that.parents('.page-submenu[data-sticky="true"]').length > 0) ? $that.parents('.page-submenu').height() : 0; 16110 var $headerSecondary; 16111 16112 if ($('body.material').length > 0 && 16113 $headerSecondaryEl.length > 0 && 16114 $('body[data-hhun="1"]').length == 0 && 16115 $('#header-outer[data-remove-fixed="1"]').length == 0 && 16116 !$body.hasClass('mobile')) { 16117 16118 $headerSecondary = $headerSecondaryEl.height(); 16119 16120 } else { 16121 16122 if($('body[data-hhun="1"]').length > 0 && 16123 $headerSecondaryEl.length > 0 && 16124 !$body.hasClass('mobile') && 16125 $('#header-outer[data-remove-fixed="1"]').length == 0) { 16126 $headerSecondary = $headerSecondaryEl.height(); 16127 } else { 16128 $headerSecondary = 0; 16129 } 16130 16131 } 16132 16133 16134 nectar_scrollToY($scrollTopDistance - $pageSubMenu + $headerSecondary, 700, 'easeInOutQuint'); 16135 16136 }, $timeoutVar); 16137 16138 e.preventDefault(); 16139 16140 } 16141 16142 if ($hash == '#top') { 16143 // Side widget area click 16144 if ($(this).parents('#slide-out-widget-area').length > 0) { 16145 $('#slide-out-widget-area .slide_out_area_close').trigger('click'); 16146 } 16147 } 16148 16149 }); 16150 16151 16152 } 16153 16154 } 16155 16156 16157 16158 16159 16160 16161 /** 16162 * Search results masonry layout. 16163 * 16164 * @since 10.0 16165 */ 16166 function searchResultMasonry() { 16167 16168 var $searchContainer = $('#search-results'), 16169 $dividerNum = ($searchContainer.is('[data-layout="masonry-no-sidebar"]')) ? 4 : 3; 16170 16171 $searchContainer.imagesLoaded(function () { 16172 16173 $searchContainer.isotope({ 16174 itemSelector: '.result', 16175 layoutMode: 'packery', 16176 packery: { 16177 columnWidth: $('#search-results').width() / $dividerNum 16178 } 16179 }); 16180 16181 $searchContainer 16182 .find('article') 16183 .css('opacity', '1'); 16184 16185 }); 16186 16187 $window.on('resize', function () { 16188 $searchContainer.isotope({ 16189 layoutMode: 'packery', 16190 packery: { 16191 columnWidth: $('#search-results').width() / $dividerNum 16192 } 16193 }); 16194 }); 16195 16196 } 16197 16198 16199 /** 16200 * Search results masonry layout initialization. 16201 * 16202 * @since 10.5 16203 */ 16204 function searchResultMasonryInit() { 16205 if ($('body.search-results').length > 0 && 16206 $('#search-results article').length > 0 && 16207 $('#search-results[data-layout="list-no-sidebar"]').length == 0) { 16208 searchResultMasonry(); 16209 } 16210 } 16211 16212 16213 16214 16215 /** 16216 * Custom colors for portfolio grid elements. 16217 * 16218 * @since 10.5 16219 */ 16220 function portfolioCustomColoring() { 16221 16222 //portfolio colors 16223 if ($('.portfolio-items .col .style-3-alt').length > 0 || 16224 $('.portfolio-items .col .style-3').length > 0 || 16225 $('.portfolio-items .col .style-2').length > 0 || 16226 $('.portfolio-items .col .style-5').length > 0) { 16227 16228 var portfolioColorCss = ''; 16229 16230 $('.portfolio-items .col').each(function () { 16231 16232 var $titleColor = $(this).attr('data-title-color'), 16233 $subTitleColor = $(this).attr('data-subtitle-color'); 16234 16235 if ($titleColor.length > 0) { 16236 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; } '; 16237 portfolioColorCss += ' .portfolio-items[data-ps="8"] .col[data-title-color="' + $titleColor + '"] .line { background-color: ' + $titleColor + '; }'; 16238 portfolioColorCss += '.portfolio-items[data-ps="8"] .col[data-title-color="' + $titleColor + '"] .next-arrow line { stroke: ' + $titleColor + '; } '; 16239 } 16240 if ($subTitleColor.length > 0) { 16241 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; } '; 16242 } 16243 16244 });
16245 16246 //style 16247 nectarCreateStyle(portfolioColorCss, 'nectar-portfolio-colors'); 16248 16249 } 16250 16251 } 16252 16253 16254 16255 16256 /** 16257 * Single post pagination/recent post mouse events 16258 * 16259 * @since 10.5 16260 */ 16261 function postMouseEvents() { 16262 16263 16264 $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 () { 16265 $(this).parents('.grav-wrap') 16266 .find('img') 16267 .addClass('hovered'); 16268 }); 16269 16270 $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 () { 16271 $(this).parents('.grav-wrap') 16272 .find('img') 16273 .removeClass('hovered'); 16274 }); 16275 16276 $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 () { 16277 $(this).addClass('mouse-leaving'); 16278 }); 16279 16280 } 16281 16282 16283 16284 16285 /** 16286 * Masonry portfolio initialization. 16287 * 16288 * @since 10.5 16289 */ 16290 function masonryPortfolioInit() { 16291 16292 $portfolio_containers = []; 16293 16294 $('.portfolio-items:not(.carousel)').each(function (i) { 16295 16296 $(this).attr('instance', i); 16297 $(this).parent().parent().find('div[class^=portfolio-filters]').attr('instance', i); 16298 16299 if (typeof SalientPortfolio !== 'undefined') { 16300 $portfolio_containers[i] = new SalientPortfolio($(this), fullWidthContentColumns); 16301 } 16302 16303 }); 16304 16305 } 16306 16307 16308 16309 16310 /** 16311 * Perspective load in styling. 16312 * 16313 * @since 8.0 16314 */ 16315 function updatePerspectiveOrigin() { 16316 16317 if( nectarDOMInfo.winW > 690 ) { 16318 $('.posts-container[data-load-animation="perspective"]').css('perspective-origin', '50% ' + (nectarDOMInfo.scrollTop + nectarDOMInfo.winH) + 'px'); 16319 } 16320 requestAnimationFrame(updatePerspectiveOrigin); 16321 16322 } 16323 16324 16325 /** 16326 * Perspective load in styling. 16327 * 16328 * @since 8.0 16329 */ 16330 function updatePerspectiveOriginInit() { 16331 16332 if ($('.posts-container[data-load-animation="perspective"]').length > 0) { 16333 requestAnimationFrame(updatePerspectiveOrigin); 16334 } 16335 16336 } 16337 16338 16339 16340 /** 16341 * Blog load in animation. 16342 * 16343 * @since 3.0 16344 */ 16345 function blogLoadIn(post_container) { 16346 16347 if (post_container.attr('data-load-animation') == 'none') { 16348 16349 post_container 16350 .find('.inner-wrap') 16351 .removeClass('animated'); 16352 16353 } else { 16354 16355 post_container.find('article').each(function (i) { 16356 16357 // Loaded visible 16358 if ($(this).visible(true)) { 16359 16360 $(this).delay(110 * i).queue(function (next) { 16361 $(this).addClass("animated-in"); 16362 next(); 16363 });
16364 16365 16366 } else { 16367 16368 // Not already visible 16369 var $that = $(this); 16370 var waypoint = new Waypoint({ 16371 16372 element: $that, 16373 handler: function () { 16374 16375 setTimeout(function () { 16376 $that.addClass("animated-in"); 16377 }, 80 * $that.attr('data-delay-amount')); 16378 16379 waypoint.destroy(); 16380 }, 16381 offset: '90%' 16382 16383 }); 16384 } 16385 16386 }); 16387 16388 } 16389 16390 } 16391 16392 16393 /** 16394 * Masonry blog initialization. 16395 * 16396 * @since 10.5 16397 */ 16398 function masonryBlogInit() { 16399 16400 $nectarMasonryBlogs = []; 16401 16402 $('.posts-container').each(function (i) { 16403 16404 if ($(this).parent().hasClass('masonry') && !$(this).parent().hasClass('auto_meta_overlaid_spaced')) { 16405 16406 if (typeof NectarMasonryBlog == 'undefined') { 16407 return; 16408 } 16409 16410 $nectarMasonryBlogs[i] = new NectarMasonryBlog($(this), fullWidthSections, blogLoadIn); 16411 16412 } else { 16413 16414 blogLoadIn($(this)); 16415 16416 } 16417 16418 }); 16419 } 16420 16421 16422 16423 /** 16424 * Sticky Sidebar initialization. 16425 * 16426 * @since 10.5 16427 */ 16428 function stickySidebarInit() { 16429 16430 if (!$().theiaStickySidebar || nectarDOMInfo.usingMobileBrowser && nectarDOMInfo.winW < 1000 ) { 16431 return; 16432 } 16433 16434 $('#sidebar[data-nectar-ss="true"], #sidebar[data-nectar-ss="1"], .nectar-scrolling-tabs .scrolling-tab-nav').each(function () { 16435 16436 // Padding from top of screen 16437 var $ssExtraTopSpace = 50; 16438 16439 if ($('#header-outer[data-remove-fixed="0"]').length > 0 && 16440 $('body[data-hhun="1"]').length == 0 && 16441 $('#header-outer[data-format="left-header"]').length == 0) { 16442 16443 $ssExtraTopSpace += $headerOuterEl.outerHeight(); 16444 16445 // Resize effect 16446 if ($('#header-outer[data-shrink-num][data-header-resize="1"]').length > 0) { 16447 var headerPadding2 = parseInt($headerOuterEl.attr('data-padding')) - parseInt($headerOuterEl.attr('data-padding')) / 1.8; 16448 $ssExtraTopSpace -= logoShrinkNum; 16449 $ssExtraTopSpace -= headerPadding2; 16450 } 16451 16452 // Condense 16453 if ($('body.mobile').length == 0 && $('#header-outer[data-condense="true"]').length > 0) { 16454 16455 var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'); 16456 $ssExtraTopSpace = 50; 16457 $ssExtraTopSpace += $headerOuterEl.height() - (parseInt($headerSpan9.position().top) - parseInt($('#header-outer #logo').css('margin-top'))) - parseInt(nectarDOMInfo.secondaryHeaderHeight); 16458 } 16459 16460 } 16461 16462 if ($wpAdminBar.length > 0) { 16463 $ssExtraTopSpace += $wpAdminBar.outerHeight(); 16464 } 16465 16466 16467 if ($(this).parents('.wpb_widgetised_column').length > 0) { 16468 16469 if ($('body.vc_editor').length > 0) { 16470 // Skip processing. 16471 } else { 16472 $(this).parents('.wpb_column').theiaStickySidebar({ 16473 additionalMarginTop: $ssExtraTopSpace, 16474 updateSidebarHeight: false 16475 });
16476 } 16477 16478 } else { 16479 $(this).theiaStickySidebar({ 16480 additionalMarginTop: $ssExtraTopSpace, 16481 updateSidebarHeight: false 16482 }); 16483 } 16484 16485 }); 16486 } 16487 16488 16489 16490 16491 16492 /** 16493 * Section down arrow animated link 16494 * 16495 * @since 10.5 16496 */ 16497 function sectionDownArrowEvent() { 16498 16499 var headerPadding2 = headerPadding - headerPadding / 1.8; 16500 16501 $body.on('click', '.section-down-arrow, .scroll-down-wrap > .minimal-arrow', function () { 16502 16503 if ($(this).parents('.nectar-box-roll').length > 0) { 16504 return false; 16505 } 16506 16507 var $currentSection = $(this).parents('#page-header-bg'), 16508 $topDistance = $currentSection.height(), 16509 $offset = ($currentSection.parents('.first-section').length == 0 || $('body[data-transparent-header="false"]').length > 0) ? $currentSection.offset().top : 0, 16510 $bodyBorderSize = ($bodyBorderTop.length > 0 && $window.width() > 1000) ? $bodyBorderTop.height() : 0, 16511 $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0) ? 0 : $('#header-space').height(), 16512 $materialSecondary = 0; 16513 16514 if ($('body.material').length > 0 && $headerSecondaryEl.length > 0) { 16515 $materialSecondary = $headerSecondaryEl.height(); 16516 } 16517 16518 if ($('body[data-permanent-transparent="1"]').length == 0) { 16519 16520 // Regular 16521 if (!$body.hasClass('mobile')) { 16522 16523 if ($('body[data-hhun="1"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length == 0) { 16524 $('body,html').stop().animate({ 16525 scrollTop: parseInt($topDistance) + $offset + 2 - $bodyBorderSize * 2 16526 }, 1000, 'easeInOutCubic'); 16527 } else { 16528 16529 var $resize = ($('#header-outer[data-header-resize="0"]').length > 0) ? 0 : parseInt(logoShrinkNum) + headerPadding2 * 2; 16530 if ($('#header-outer[data-remove-fixed="1"]').length > 0) { 16531 $headerNavSpace = 0; 16532 $offset = 0; 16533 } 16534 16535 // Condense 16536 if ($('body.mobile').length == 0 && $('#header-outer[data-condense="true"]').length > 0) { 16537 var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9'); 16538 $headerNavSpace = $headerOuterEl.height() - (parseInt($headerSpan9.position().top) - parseInt($('#header-outer #logo').css('margin-top'))) - parseInt(nectarDOMInfo.secondaryHeaderHeight); 16539 } 16540 16541 $('body,html').stop().animate({ 16542 scrollTop: parseInt($topDistance - $headerNavSpace) + $resize + 3 + $offset + $materialSecondary 16543 }, 1000, 'easeInOutCubic'); 16544 16545 } 16546 16547 } else { 16548 16549 var $scrollPos; 16550 16551 if($('#header-outer[data-mobile-fixed="1"]').length > 0) { 16552 $scrollPos = parseInt($topDistance) - $headerNavSpace + parseInt($currentSection.offset().top) + 2; 16553 } else { 16554 $scrollPos = parseInt($topDistance) + parseInt($currentSection.offset().top) + 2; 16555 } 16556 16557 $('body,html').stop().animate({ 16558 scrollTop: $scrollPos - $bodyBorderSize * 2 16559 }, 1000, 'easeInOutCubic'); 16560 } 16561 16562 } else { 16563 // Permanent transparent 16564 $('body,html').stop().animate({ 16565 scrollTop: parseInt($topDistance) + parseInt($currentSection.offset().top) + 2 - $bodyBorderSize * 2 16566 }, 1000, 'easeInOutCubic'); 16567 } 16568 return false; 16569 }); 16570 16571 } 16572 16573 16574 16575 16576 16577 /** 16578 * Displace filter column/row BG effect - fullpage 16579 * 16580 * @since 10.5 16581 */ 16582 function nectarLiquidBGFP() { 16583 16584 $('.nectar-liquid-bg').removeClass('animated-in'); 16585 16586 for (var k = 0; k < $liquidBG_EL.length; k++) { 16587 16588 if ($liquidBG_EL[k].animationType == 'displace-filter-fade' && $($liquidBG_EL[k].canvasContainer).parents('.fp-section.active').length > 0) { 16589 16590 //add bg to container 16591 if ($($liquidBG_EL[k].canvasContainer).find('.image-added-to-stage').length == 0) { 16592 $liquidBG_EL[k].imgContainer.addChild($liquidBG_EL[k].bg); 16593 } 16594 16595 $($liquidBG_EL[k].canvasContainer) 16596 .find('.nectar-liquid-bg') 16597 .addClass('image-added-to-stage'); 16598 16599 $liquidBG_EL[k].animateProps($liquidBG_EL[k]); 16600 16601 } 16602 } 16603 } 16604 16605 16606 /** 16607 * Page Full Screen Rows 16608 * 16609 * @since 10.5 16610 */ 16611 function nectarFullPageInit() { 16612 16613 if ($('#nectar_fullscreen_rows').length > 0 && $().fullpage) { 16614 16615 $fullscreenSelector = (window.vc_iframe) ? '.vc_element.vc_vc_row.active ' : '.wpb_row.active '; 16616 16617 var $disableFPonMobile = ($('#nectar_fullscreen_rows[data-mobile-disable]').length > 0) ? $('#nectar_fullscreen_rows').attr('data-mobile-disable') : 'off'; 16618 if( !nectarDOMInfo.usingMobileBrowser ) { 16619 $disableFPonMobile = 'off'; 16620 }
16621 // Support for mobile animation theme option. 16622 if( $disableFPonMobile != 'on' ) { 16623 $fullscreenMarkupBool = true; 16624 } else { 16625 $fullscreenSelector = ''; 16626 } 16627 16628 $nectarFullPage = new NectarFullScreenRows(waypoints, $mouseParallaxScenes, nectarLiquidBGFP, nectarDOMInfo, responsiveTooltips, $standAnimatedColTimeout, $svgIcons); 16629 16630 } 16631 16632 } 16633 16634 16635 16636 16637 /** 16638 * Cross browser adjustments. 16639 * 16640 * @since 1.0 16641 */ 16642 function crossBrowserAdjust() { 16643 16644 // Add specific class if on device for better tablet tracking. 16645 if (nectarDOMInfo.usingMobileBrowser) { 16646 $body.addClass('using-mobile-browser'); 16647 } 16648 16649 // Add class for old IE. 16650 var ua = window.navigator.userAgent; 16651 var msie = ua.indexOf("Edge/"); 16652 if (msie > 0) { 16653 $body.addClass('msie'); 16654 } 16655 16656 // For users updating to 8 with a custom, old header template file 16657 if ($('html.js').length == 0) { 16658 $('html').removeClass('no-js').addClass('js'); 16659 } 16660 16661 //remove br's from code tag 16662 $('code').find('br').remove(); 16663 16664 // Contact form 7. 16665 $('.wpcf7-form p:has(input[type=submit])').css('padding-bottom', '0px'); 16666 16667 $('.full-width-content .wpcf7-submit').on('click', function () { 16668 setTimeout(function () { 16669 fullWidthContentColumns(); 16670 }, 1000); 16671 setTimeout(function () { 16672 fullWidthContentColumns(); 16673 }, 2000); 16674 }); 16675 16676 // Gravity form inside fw content row 16677 $('.gform_body').on('click', function () { 16678 setTimeout(function () { 16679 fullWidthContentColumns(); 16680 }, 200); 16681 }); 16682 16683 // Popup Maker. 16684 $('.pum.pum-theme-salient-page-builder-optimized button.pum-close').wrapInner('<span />'); 16685 16686 // pum inside fspr 16687 if ($('#nectar_fullscreen_rows').length > 0 && 16688 $('.pum-container .pum-content > .wpb_row .full-page-inner > .container > .span_12').length > 0) { 16689 $('.pum-container .pum-content > .wpb_row .full-page-inner > .container > .span_12').unwrap(); 16690 } 16691 16692 // Blog bottom padding 16693 if ($('.single .blog_next_prev_buttons').length > 0) { 16694 $('.container-wrap').css('padding-bottom', 0); 16695 } 16696 16697 // Remove margin on last cols inside of full width sections 16698 $('.full-width-section').each(function () { 16699 $(this).find('> .span_12 > div.col_last').last().css('margin-bottom', '0'); 16700 }); 16701 16702 // Remove boxed style from full width content 16703 $('.full-width-content .col.boxed').removeClass('boxed'); 16704 16705 // Neg marg z-index adjust 16706 $('.wpb_column.neg-marg').parents('.wpb_row').css('z-index', '110'); 16707 16708 16709 } 16710 16711 16712 16713 16714 //vc col mobile fixes 16715 function vcMobileColumns() { 16716 16717 $('.wpb_row').each(function () { 16718 if (typeof $(this).find('.span_12').offset() != 'undefined') { 16719 16720 $(this).find('[class*="vc_col-"]').each(function () { 16721 16722 var $firstChildOffset = $(this).parents('.span_12').offset().left; 16723 16724 $(this).removeClass('no-left-margin'); 16725 16726 if ($(this).offset().left < $firstChildOffset + 27) { 16727 $(this).addClass('no-left-margin'); 16728 } else { 16729 $(this).removeClass('no-left-margin'); 16730 } 16731 });
16732 } 16733 }); 16734 } 16735 16736 function vcMobileColumnsInit() { 16737 16738 var $winDOMWidth = nectarDOMInfo.winW, 16739 $winDOMHeight = nectarDOMInfo.winH, 16740 $orientChangeTrack = 0; 16741 16742 // Only needed in legacy column setups. 16743 if( $body.is('[data-flex-cols="true"]') ) { 16744 return; 16745 } 16746 16747 if ($('[class*="vc_col-xs-"], [class*="vc_col-md-"], [class*="vc_col-lg-"]').length > 0) { 16748 16749 // Trigger immediately. 16750 vcMobileColumns(); 16751 16752 // Resize. 16753 if( !nectarDOMInfo.usingMobileBrowser ) { 16754 // Bind normally for desktop. 16755 $window.on('resize',vcMobileColumns); 16756 } 16757 else { 16758 16759 // For mobile make sure the orientation has changed. 16760 window.addEventListener("orientationchange", function () { 16761 $orientChangeTrack = 1; 16762 }); 16763 16764 $window.on('resize', function () { 16765 16766 if (($window.width() != $winDOMWidth && $window.height != $winDOMHeight) || $orientChangeTrack === 1) { 16767 16768 vcMobileColumns(); 16769 16770 // Store the current window dimensions. 16771 $winDOMWidth = nectarDOMInfo.winW; 16772 $winDOMHeight = nectarDOMInfo.winH; 16773 16774 // Reset orientation change tracker. 16775 $orientChangeTrack = 0; 16776 } 16777 16778 }); 16779 16780 16781 } // end mobile only. 16782 16783 } // endif vc offset cols found. 16784 16785 16786 } 16787 16788 16789 16790 16791 /** 16792 * Select2 plugin initialization. 16793 * 16794 * @since 5.0 16795 */ 16796 function select2Init() { 16797 16798 $('select:not(.state_select):not(.country_select):not(.comment-form-rating #rating):not(#tribe-bar-form select):not(.woocommerce-currency-switcher)').each(function () { 16799 16800 // Prevent search from triggering on small devices. 16801 var $minimumToSearch = ( nectarDOMInfo.winW > 690 ) ? 7 : 200; 16802 16803 if ($(this).parents('#buddypress').length == 0) { 16804 16805 if ($(this).parents('.woocommerce-ordering').length == 0) { 16806 $(this).select2({ 16807 minimumResultsForSearch: $minimumToSearch, 16808 width: '100%' 16809 });
16810 } else { 16811 $(this).select2({ 16812 minimumResultsForSearch: $minimumToSearch, 16813 dropdownAutoWidth: true 16814 }); 16815 } 16816 } 16817 16818 }); 16819 } 16820 16821 16822 /** 16823 * Fancy select styling theme option. 16824 * 16825 * @since 10.5 16826 */ 16827 function fancySelectStyling() { 16828 16829 if ( $('body[data-fancy-form-rcs="1"]').length > 0 ) { 16830 16831 $('select:not(.comment-form-rating #rating)').each(function () { 16832 16833 var $selector; 16834 16835 //cf7 16836 if ($(this).parents('.wpcf7-form-control-wrap').length > 0) { 16837 16838 //select 2 already initialized 16839 if ($(this).parents('.wpcf7-form-control-wrap').find('.select2-container').length > 0) { 16840 $selector = $($(this).prev('.select2-container')); 16841 } else { 16842 $selector = $(this); 16843 } 16844 16845 //if label is found 16846 if ($selector.parents('.wpcf7-form-control-wrap').parent().find('label').length == 1) { 16847 $selector.parents('.wpcf7-form-control-wrap').parent().wrapInner('<div class="fancy-select-wrap" />'); 16848 } else { 16849 //default wrap 16850 $selector.wrap('<div class="fancy-select-wrap" />'); 16851 } 16852 } 16853 //default 16854 else { 16855 16856 //select 2 already initialized 16857 if ($(this).prev('.select2-container').length > 0) { 16858 $selector = $(this).prev('.select2-container'); 16859 } else { 16860 $selector = $(this); 16861 } 16862 16863 if ($(this).parents('#buddypress').length == 0 && $(this).parents('.widget_categories').length == 0) { 16864 //if label is found 16865 if ($selector.prev('label').length == 1) { 16866 $selector.prev('label').andSelf().wrapAll('<div class="fancy-select-wrap" />'); 16867 } else if ($selector.next('label').length == 1) { 16868 $selector.next('label').andSelf().wrapAll('<div class="fancy-select-wrap" />'); 16869 } else { 16870 //default wrap 16871 $selector.wrap('<div class="fancy-select-wrap" />'); 16872 } 16873 } 16874 16875 } 16876 }); 16877 16878 select2Init(); 16879 16880 } 16881 16882 } 16883 16884 16885 16886 16887 16888 /** 16889 * Back/Forward Safari cache assist. 16890 * 16891 * @since 10.5 16892 */ 16893 function bfCacheAssist() { 16894 16895 //Back/forward cache OCM close 16896 if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1 || 16897 navigator.userAgent.match(/(iPod|iPhone|iPad)/)) { 16898 16899 window.onpageshow = function (event) { 16900 16901 if (event.persisted) { 16902 16903 // Play video BGs 16904 $('.nectar-video-wrap, .nectar-slider-wrap .swiper-slide .video-wrap').each(function () { 16905 16906 if ($(this).find('video').length > 0) { 16907 $(this).find('video')[0].play(); 16908 } 16909 16910 });
16911 16912 16913 // Close mobile nav 16914 16915 //// Material Skin. 16916 if ($('body.material-ocm-open').length > 0) { 16917 $('body > .slide_out_area_close').addClass('non-human-allowed').trigger('click'); 16918 16919 setTimeout(function () { 16920 $('body > .slide_out_area_close').removeClass('non-human-allowed'); 16921 }, 100); 16922 16923 } else if ($('#slide-out-widget-area.slide-out-from-right-hover.open').length > 0 && navigator.userAgent.match(/(iPod|iPhone|iPad)/)) { 16924 OCM_mobileSlideOutRightHoverCloseCheck(); 16925 } 16926 // Others 16927 else if ($('#slide-out-widget-area.fullscreen.open').length > 0 || 16928 $('#slide-out-widget-area.fullscreen-alt.open').length > 0 || 16929 $('#slide-out-widget-area.slide-out-from-right.open').length > 0) { 16930 16931 $('#slide-out-widget-area .slide_out_area_close').addClass('non-human-allowed'); 16932 $('.slide-out-widget-area-toggle:not(.std-menu) a.open') 16933 .addClass('non-human-allowed') 16934 .trigger('click'); 16935 16936 setTimeout(function () { 16937 $('#slide-out-widget-area .slide_out_area_close').removeClass('non-human-allowed'); 16938 }, 100); 16939 16940 } 16941 16942 } // Loaded from bf cache 16943 16944 }; // onpage show 16945 16946 } 16947 16948 } 16949 16950 16951 16952 16953 16954 16955 /*-------------------------------------------------------------------------*/ 16956 /* WPBakery Frontend Editor 16957 /*-------------------------------------------------------------------------*/ 16958 16959 /** 16960 * Control adjustments 16961 * 16962 * @since 10.0 16963 */ 16964 function addRowCtrls() { 16965 16966 //remove padding for rows with only fullwidth ns 16967 $('.wpb_row').removeClass('only-ns'); 16968 16969 $('.nectar-slider-wrap[data-full-width="true"], .page-submenu, .portfolio-items[data-col-num="elastic"]:not(.fullwidth-constrained), .blog-fullwidth-wrap') 16970 .parents('.wpb_row') 16971 .addClass('only-ns'); 16972 16973 //padding when column contains item that could get lost under column controls 16974 $('body.vc_editor.compose-mode .wpb_row .vc_vc_column > .wpb_column > .vc_column-inner').each(function() { 16975 16976 if ($(this).find('> .vc_element-container > div').length > 0) { 16977 16978 if ($(this).find('> .vc_element-container > div:first-child').is('.vc_vc_row_inner')) { 16979 $(this).find('> .vc_element-container > div:first-child').addClass('first-inner-row-el'); 16980 } else { 16981 $(this).find('> .vc_element-container > div:first-child').removeClass('first-inner-row-el'); 16982 } 16983 16984 } 16985 16986 }); 16987 16988 } //addRowCtrl end 16989 16990 16991 /** 16992 * Convert front end padding 16993 * 16994 * Needed when the flexbox grid is not active due to 16995 * different markup in front end page builder view. 16996 * 16997 * @since 10.0 16998 */ 16999 function convertFrontEndPadding() { 17000 17001 $('.vc_element > .wpb_column[class*="padding-"][class*="-percent"]').each(function() { 17002 17003 var $elPaddingPercent = 4; 17004 17005 var elclassName = this.className.match(/padding-\d+/); 17006 if (elclassName) { 17007 $elPaddingPercent = elclassName[0].match(/\d+/); 17008 if ($elPaddingPercent) { 17009 $elPaddingPercent = $elPaddingPercent[0] / 100; 17010 } else { 17011 $elPaddingPercent = 0; 17012 } 17013 } 17014 17015 if ($elPaddingPercent) { 17016 var $parentRowWidth = $(this).parents('.span_12').width(); 17017 17018 if ($(this).is('[data-padding-pos="all"]')) { 17019 $(this).css('padding', $parentRowWidth * $elPaddingPercent); 17020 } else if ($(this).is('[data-padding-pos="top"]')) { 17021 $(this).css('padding-top', $parentRowWidth * $elPaddingPercent); 17022 } else if ($(this).is('[data-padding-pos="bottom"]')) { 17023 $(this).css('padding-bottom', $parentRowWidth * $elPaddingPercent); 17024 } else if ($(this).is('[data-padding-pos="left"]')) { 17025 $(this).css('padding-left', $parentRowWidth * $elPaddingPercent); 17026 } else if ($(this).is('[data-padding-pos="right"]')) { 17027 $(this).css('padding-right', $parentRowWidth * $elPaddingPercent); 17028 } else if ($(this).is('[data-padding-pos="top-bottom"]')) { 17029 $(this).css({ 17030 'padding-top': $parentRowWidth * $elPaddingPercent, 17031 'padding-bottom': $parentRowWidth * $elPaddingPercent, 17032 });
17033 } else if ($(this).is('[data-padding-pos="top-right"]')) { 17034 $(this).css({ 17035 'padding-top': $parentRowWidth * $elPaddingPercent, 17036 'padding-right': $parentRowWidth * $elPaddingPercent, 17037 }); 17038 } else if ($(this).is('[data-padding-pos="bottom-right"]')) { 17039 $(this).css({ 17040 'padding-right': $parentRowWidth * $elPaddingPercent, 17041 'padding-bottom': $parentRowWidth * $elPaddingPercent, 17042 }); 17043 } else if ($(this).is('[data-padding-pos="bottom-left"]')) { 17044 $(this).css({ 17045 'padding-left': $parentRowWidth * $elPaddingPercent, 17046 'padding-bottom': $parentRowWidth * $elPaddingPercent, 17047 }); 17048 } else if ($(this).is('[data-padding-pos="left-right"]')) { 17049 $(this).css({ 17050 'padding-left': $parentRowWidth * $elPaddingPercent, 17051 'padding-right': $parentRowWidth * $elPaddingPercent, 17052 }); 17053 } 17054 } 17055 17056 }); 17057 17058 $('.wpb_row[class*="vc_custom_"]').each(function() { 17059 17060 $(this).parent().addClass('no-bottom-margin'); 17061 17062 }); 17063 17064 } 17065 17066 17067 /** 17068 * WPBakery Front end editor integration 17069 * 17070 * @since 10.0 17071 */ 17072 function wpBakeryFrontendInit() { 17073 17074 // Set up controls/column padding. 17075 setTimeout(function() { 17076 17077 if ($('body.compose-mode').length > 0) { 17078 $('.container-wrap').addClass('visible-editor-controls'); 17079 } 17080 17081 if (nectarDOMInfo.usingFrontEndEditor) { 17082 addRowCtrls(); 17083 17084 if( !$body.is('[data-flex-cols="true"]') ) { 17085 convertFrontEndPadding(); 17086 $window.smartresize(convertFrontEndPadding); 17087 } 17088 17089 } 17090 17091 }, 200); 17092 17093 // Bind reload event 17094 $window.on('vc_reload', function() { 17095 17096 addRowCtrls(); 17097 columnBGColors(); 17098 coloredButtons(); 17099 twentytwentyInit(); 17100 parallaxRowsBGCals(); 17101 flexsliderInit(); 17102 accordionInit(); 17103 ulCheckmarks(); 17104 nectarFancyUlIcons(); 17105 nectarFancyBoxHover(); 17106 oneFourthClasses(); 17107 carouselfGrabbingClass(); 17108 nectarPostGridInit(); 17109 splitLineHeadingInit(); 17110 nectarVideoLightbox(); 17111 nectarKeyframeAssist(); 17112 nectarLazyImageLoading(); 17113 17114 if ($('.carousel').length > 0) { 17115 standardCarouselInit(); 17116 clientsCarouselInit(); 17117 carouselHeightCalcs(); 17118 } 17119 17120 if ($('.owl-carousel').length > 0) { 17121 $('.owl-carousel').each(function() { 17122 $(this).trigger('destroy.owl.carousel').removeClass('owl-loaded'); 17123 $(this).find('.owl-stage-outer .owl-stage > *').unwrap(); 17124 $(this).find('.owl-stage-outer > *').unwrap(); 17125 $(this).find('.owl-item > *').unwrap(); 17126 $(this).find('.owl-dots').remove(); 17127 $(this).find('.owl-nav').remove(); 17128 }); 17129 owlCarouselInit(); 17130 } 17131 17132 if ($('.nectar_cascading_images').length > 0) { 17133 imagesLoaded($('.nectar_cascading_images'), function() { 17134 cascadingImageBGSizing(); 17135 }); 17136 } 17137 17138 fullWidthSections(); 17139 fwsClasses(); 17140 recentPostsInit(); 17141 fullWidthRowPaddingAdjust(); 17142 17143 /*flickity carousels*/ 17144 if ($flickitySliders.length > 0) { 17145 for (var i = 0; i < $flickitySliders.length; i++) { 17146 17147 $flickitySliders[i].reloadCells(); 17148 $flickitySliders[i].off('scroll.flickity'); 17149 $flickitySliders[i].off('dragStart.flickity'); 17150 $flickitySliders[i].off('dragEnd.flickity'); 17151 17152 } 17153 } 17154 17155 flickityLazyInit(); 17156 17157 setTimeout(function() { 17158 17159 flickityInit(); 17160 if ($flickitySliders.length > 0) { 17161 for (var i = 0; i < $flickitySliders.length; i++) { 17162 $flickitySliders[i].reloadCells(); 17163 $flickitySliders[i].resize(); 17164 } 17165 } 17166 17167 }, 100); 17168 17169 /*flickity product carousels*/ 17170 if ($wooFlickityCarousels.length > 0) { 17171 for (var i = 0; i < $wooFlickityCarousels.length; i++) { 17172 17173 $wooFlickityCarousels[i].flickity('reloadCells'); 17174 $wooFlickityCarousels[i].off('scroll.flickity'); 17175 $wooFlickityCarousels[i].off('dragStart.flickity'); 17176 $wooFlickityCarousels[i].off('dragEnd.flickity'); 17177 17178 } 17179 } 17180 17181 setTimeout(function() { 17182 17183 if ($('.nectar-woo-flickity').length > 0) { 17184 productCarouselInit(); 17185 } 17186 if ($wooFlickityCarousels.length > 0) { 17187 for (var i = 0; i < $wooFlickityCarousels.length; i++) { 17188 $wooFlickityCarousels[i].flickity('reloadCells'); 17189 $wooFlickityCarousels[i].flickity('resize'); 17190 } 17191 } 17192 17193 }, 100); 17194 17195 nectarTestimonialSliders(); 17196 17197 for (var i = 0; i < $testimonialSliders.length; i++) { 17198 17199 if ($testimonialSliders[i].type == 'multiple_visible' || 17200 $testimonialSliders[i].type == 'multiple_visible_minimal') { 17201 17202 $testimonialSliders[i].flickityEl.flickity('reloadCells'); 17203 $testimonialSliders[i].flickityEl.off('select.flickity'); 17204 nectarTestimonialSliders(); 17205 $testimonialSliders[i].flickityEl.resize(); 17206 } 17207 17208 $testimonialSliders[i].testimonialSliderHeight(); 17209 } 17210 nectarTestimonialSlidersEvents(); 17211 17212 pricingTableHeight(); 17213 nectarIconMatchColoring(); 17214 lightBoxInit(); 17215 imageWithHotspotEvents(); 17216 largeIconHover(); 17217 nectarBoxRollInit(); 17218 midnightInit(); 17219 responsiveVideoIframesInit(); 17220 responsiveVideoIframes(); 17221 fullWidthContentColumns(); 17222 setTimeout(fullWidthContentColumns, 1000); 17223 videoBGInit(); 17224 vcFullHeightRowInit(); 17225 $window.off('scroll.parallaxSections').off('resize.parallaxSections'); 17226 parallaxScrollInit(); 17227 masonryBlogInit(); 17228 masonryPortfolioInit(); 17229 17230 if ($portfolio_containers.length > 0) { 17231 for (var i = 0; i < $portfolio_containers.length; i++) { 17232 $portfolio_containers[i].portfolioAccentColor(); 17233 } 17234 } 17235 17236 parallaxItemHoverEffect(); 17237 fsProjectSliderInit(); 17238 17239 setTimeout(function() { 17240 if ($('.nectar_fullscreen_zoom_recent_projects').length > 0) { 17241 17242 if ($fsProjectSliderArr.length > 0) { 17243 for (var i = 0; i < $fsProjectSliderArr.length; i++) { 17244 $fsProjectSliderArr[i].sliderCalcs(); 17245 } 17246 } 17247 17248 } 17249 }, 300); 17250 17251 $window.unbind('.infscr'); 17252 infiniteScrollInit();
17253 mouseParallaxInit(); 17254 17255 //play video BGs 17256 $('.nectar-video-wrap').each(function() { 17257 if ($(this).find('video').length > 0) { 17258 $(this).find('video').css('visibility', 'visible'); 17259 } 17260 }); 17261 17262 //tablet inherits small desktop 17263 $('.wpb_column[data-t-w-inherits]').each(function() { 17264 if ($(this).is('[data-t-w-inherits="small_desktop"]')) { 17265 $(this).parent().addClass('inherits-s-desktop-col'); 17266 } else { 17267 $(this).parent().removeClass('inherits-s-desktop-col'); 17268 } 17269 }); 17270 17271 //full screen page rows 17272 if ($('#nectar_fullscreen_rows').length > 0) { 17273 17274 if ($('#nectar_fullscreen_rows > .vc_element').length == 0) { 17275 $('#nectar_fullscreen_rows').prepend('<div class="vc_element empty_placeholder" />'); 17276 } 17277 17278 17279 if ($('#nectar_fullscreen_rows > .vc_element:not(.empty_placeholder)').length > 0) { 17280 $('#nectar_fullscreen_rows >.vc_element.empty_placeholder').remove(); 17281 } 17282 17283 17284 $.fn.fullpage.destroy('all'); 17285 nectarFullPageInit(); 17286 17287 //keep tooltip active status 17288 var nectarFPOffsets = [{ 17289 el: '', 17290 offset: 0 17291 }]; 17292 17293 ////create list of offsets 17294 $('#nectar_fullscreen_rows > div.vc_element').each(function(i) { 17295 nectarFPOffsets[i] = { 17296 el: $(this), 17297 offset: $(this).offset().top 17298 }; 17299 }); 17300 17301 17302 ////start active on that index 17303 17304 //move back to first section when all have been deleted but one 17305 if ($('#nectar_fullscreen_rows > div.vc_element').length === 1) { 17306 $('#nectar_fullscreen_rows').css({ 17307 'transform': 'translate3d(0,0,0)' 17308 });
17309 } 17310 17311 $body.scrollTo(0, 0); 17312 17313 17314 } else { 17315 17316 //remove container wrap padding/margin when needded 17317 if ($('body .main-content > .row > .vc_element:first > .wpb_row[class*="full-width-"]').length > 0 || 17318 $('body .main-content > .row > .vc_element:first .nectar-slider-wrap[data-full-width="true"]').length > 0) { 17319 $('.container-wrap').css({ 17320 'padding-top': '0', 17321 'margin-top': '0' 17322 }); 17323 } else { 17324 $('.container-wrap').css({ 17325 'padding-top': '40px' 17326 }); 17327 } 17328 17329 } 17330 17331 //reset svg icon arr 17332 $svgIcons = []; 17333 $('.svg-icon-holder') 17334 .removeClass('animated-in') 17335 .removeClass('bound'); 17336 17337 17338 //gmap 17339 if ($('.vc_nectar_gmap').length > 0) { 17340 17341 setTimeout(function() { 17342 17343 if (typeof google === 'object' && typeof google.maps === 'object') { 17344 window.mapAPI_Loaded(); 17345 } else { 17346 17347 if (window.nectarLove.mapApiKey.length > 0) { 17348 $.getScript('https://maps.google.com/maps/api/js?sensor=false&key=' + window.nectarLove.mapApiKey + '&callback=mapAPI_Loaded'); 17349 } 17350 } 17351 17352 }, 100); 17353 } 17354 17355 17356 stickySidebarInit(); 17357 17358 17359 if (typeof window.Waypoint != 'undefined') { 17360 Waypoint.destroyAll(); 17361 waypoints(); 17362 } 17363 17364 }); 17365 17366 } 17367 17368 17369 17370 17371 17372 17373 17374 17375 /** 17376 * Page transitions and waypoint triggering 17377 * 17378 * @since 10.5 17379 */ 17380 function pageTransitionInit() { 17381 17382 var mobileDisabledCondition = false; 17383 17384 if( $('body[data-ajax-transitions="true"]').length > 0 && 17385 $('#ajax-loading-screen[data-disable-mobile="1"]').length > 0 && 17386 nectarDOMInfo.winW < 1000 ) { 17387 17388 mobileDisabledCondition = true; 17389 17390 } 17391 17392 if ($('body[data-ajax-transitions="true"]').length > 0 && $('#ajax-loading-screen[data-method="standard"]').length > 0 && mobileDisabledCondition == false) { 17393 17394 $('html').addClass('page-trans-loaded'); 17395 17396 // Fade loading animation 17397 if ($('#ajax-loading-screen[data-effect="standard"]').length > 0) { 17398 17399 if ($('.nectar-particles').length == 0) { 17400 17401 $loadingScreenEl.transition({ 17402 'opacity': 0 17403 }, 500, function () { 17404 $(this).css({ 17405 'display': 'none' 17406 }); 17407 });
17408 $('#ajax-loading-screen .loading-icon').transition({ 17409 'opacity': 0 17410 }, 500); 17411 17412 } 17413 17414 // Bind waypoints after loading screen has left 17415 if ($('.nectar-box-roll').length == 0) { 17416 setTimeout(function () { 17417 waypoints(); 17418 }, 550); 17419 } 17420 17421 } 17422 17423 // Swipe loading animation 17424 else { 17425 17426 if ($('#ajax-loading-screen[data-effect*="horizontal_swipe"]').length > 0) { 17427 setTimeout(function () { 17428 $loadingScreenEl.addClass('loaded'); 17429 }, 60); 17430 } 17431 17432 if ($('#page-header-wrap #page-header-bg[data-animate-in-effect="zoom-out"] .nectar-video-wrap').length == 0) { 17433 setTimeout(function () { 17434 $('#ajax-loading-screen:not(.loaded)').addClass('loaded'); 17435 setTimeout(function () { 17436 $loadingScreenEl.addClass('hidden'); 17437 }, 1000); 17438 }, 150); 17439 } 17440 17441 17442 // Bind waypoints after loading screen has left 17443 if ($('.nectar-box-roll').length == 0 && $('#ajax-loading-screen[data-effect*="horizontal_swipe"]').length > 0) { 17444 setTimeout(function () { 17445 waypoints(); 17446 }, 750); 17447 } else if ($('.nectar-box-roll').length == 0) setTimeout(function () { 17448 waypoints(); 17449 }, 350); 17450 17451 } 17452 17453 17454 // Safari back/prev fix 17455 if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1 || 17456 navigator.userAgent.match(/(iPod|iPhone|iPad)/)) { 17457 17458 window.onunload = function () { 17459 $loadingScreenEl.stop().transition({ 17460 'opacity': 0 17461 }, 800, function () { 17462 $(this).css({ 17463 'display': 'none' 17464 }); 17465 });
17466 $('#ajax-loading-screen .loading-icon').transition({ 17467 'opacity': 0 17468 }, 600); 17469 }; 17470 window.onpageshow = function (event) { 17471 17472 if (event.persisted) { 17473 17474 $loadingScreenEl.stop().transition({ 17475 'opacity': 0 17476 }, 800, function () { 17477 $(this).css({ 17478 'display': 'none' 17479 }); 17480 }); 17481 $('#ajax-loading-screen .loading-icon').transition({ 17482 'opacity': 0 17483 }, 600); 17484 17485 } 17486 17487 }; 17488 17489 } 17490 17491 else if (navigator.userAgent.indexOf('Firefox') != -1) { 17492 window.onunload = function () {}; 17493 } 17494 17495 17496 // Remove excess loading images if using page transitions. 17497 $('.portfolio-loading, .nectar-slider-loading .loading-icon').remove(); 17498 17499 17500 if ($('#ajax-loading-screen[data-disable-fade-on-click="1"]').length == 0) { 17501 17502 if ($('body.using-mobile-browser #ajax-loading-screen[data-method="standard"][data-disable-mobile="1"]').length == 0) { 17503 17504 var ignore_onbeforeunload = false; 17505 $('a[href^="mailto"], a[href^="tel"], .woocommerce-order-downloads a[class*="downloads-file"]').on('click', function () { 17506 ignore_onbeforeunload = true; 17507 });
17508 window.addEventListener('beforeunload', function () { 17509 17510 if (!ignore_onbeforeunload) { 17511 $loadingScreenEl.addClass('set-to-fade'); 17512 transitionPage(); 17513 } 17514 ignore_onbeforeunload = false; 17515 }); 17516 } 17517 17518 } 17519 17520 } 17521 17522 // No page transitions 17523 else { 17524 17525 // Mobile disabled. 17526 if( mobileDisabledCondition == true ) { 17527 $loadingScreenEl.css({ 17528 'opacity': '0', 17529 'display': 'none' 17530 }).addClass('loaded').addClass('hidden'); 17531 } 17532 17533 if ($('.nectar-box-roll').length == 0 && !nectarDOMInfo.usingFrontEndEditor) { 17534 17535 // Waypoints. 17536 setTimeout(function () { 17537 waypoints(); 17538 }, 80); 17539 17540 } 17541 17542 } 17543 17544 17545 function transitionPage() { 17546 17547 if ($('#ajax-loading-screen[data-effect*="horizontal_swipe"]').length > 0) { 17548 $loadingScreenEl.removeClass('loaded'); 17549 $loadingScreenEl.addClass('in-from-right'); 17550 17551 setTimeout(function () { 17552 $loadingScreenEl.addClass('loaded'); 17553 }, 30); 17554 17555 } 17556 else { 17557 if ($('#ajax-loading-screen[data-effect="center_mask_reveal"]').length > 0) { 17558 $loadingScreenEl.css('opacity', '0').css('display', 'block').transition({ 17559 'opacity': '1' 17560 }, 450); 17561 } else { 17562 $loadingScreenEl.show().transition({ 17563 'opacity': '1' 17564 }, 450); 17565 } 17566 } 17567 17568 } 17569 17570 } 17571 17572 17573 17574 // Document ready event - starting everything up. 17575 jQuery(document).ready(function ($) { 17576 17577 // Initialize Nectar DOM helper. 17578 nectarDOMInfo.init(); 17579 17580 // Priority calls 17581 nectarBoxRollInit(); 17582 nectarFullPageInit(); 17583 nectarLazyImageLoading(); 17584 17585 // Header navigation. 17586 initSF(); 17587 navigationSearchInit(); 17588 centeredNavBottomBarInit(); 17589 centeredLogoHeaderInit(); 17590 headerNavPreInit(); 17591 headerNavScrollInit(); 17592 headerNavOffsetInit(); 17593 17594 // Page builder elements. 17595 salientPageBuilderElInit(); 17596 17597 // Column related. 17598 columnBGColors(); 17599 vcMobileColumnsInit(); 17600 17601 // Row related. 17602 fullWidthSections(); 17603 fwsClasses(); 17604 fwCarouselLinkFix(); 17605 fullWidthSectionsPreInit(); 17606 firstFWSection(); 17607 parallaxScrollInit(); 17608 parallaxRowsBGCals(); 17609 fullWidthRowPaddingAdjust(); 17610 fullWidthContentColumns(); 17611 oneFourthClasses(); 17612 fixIeFlexbox(); 17613 vcFullHeightRowInit(); 17614 17615 // Media. 17616 lightBoxInit(); 17617 audioVideoVis(); 17618 responsiveVideoIframesInit(); 17619 responsiveVideoIframes(); 17620 videoBGInit(); 17621 blogSingle(); 17622 17623 // Off canvas navigation. 17624 mobileNavMegamenuCorrect(); 17625 materialSkinOCM_Init(); 17626 OCM_dropdownMarkup(); 17627 OCM_dropdownIconPos(); 17628 clickToggleSubmenus(); 17629 OCM_init(); 17630 17631 // Page header 17632 pageHeaderInit(); 17633 17634 // Footer. 17635 footerRevealInit(); 17636 17637 // Third party. 17638 wooCommerceEvents(); 17639 fancySelectStyling(); 17640 17641 // Scrolling 17642 infiniteScrollInit(); 17643 scrollToTopInit(); 17644 animatedAnchorLinks(); 17645 updatePerspectiveOriginInit(); 17646 sectionDownArrowEvent(); 17647 17648 // Cross browser assist. 17649 crossBrowserAdjust(); 17650 bfCacheAssist(); 17651 17652 // Front end editing. 17653 wpBakeryFrontendInit(); 17654 17655 // Page transitions and waypoint activation. 17656 pageTransitionInit(); 17657 17658 17659 17660 // Main Debounced Resize Event. 17661 $window.off('smartresize.srInit'); 17662 $window.on('smartresize.srInit', smartResizeInit); 17663 17664 // Main Resize Event. 17665 $window.off('resize.srInit'); 17666 $window.on('resize.srInit', resizeInit); 17667 17668 // Window Load Event. 17669 $window.on('load', function () { 17670 17671 // Set header space. 17672 if ( $(window).scrollTop() == 0 ) { 17673 headerSpace(); 17674 } 17675 17676 $('video').css('visibility', 'visible'); 17677 17678 // Scroll to anchor 17679 pageLoadHashInit(); 17680 17681 // Row/Column related. 17682 fullWidthContentColumns();
17683 parallaxRowsBGCals(); 17684 17685 // Video BG 17686 resizeVideoToCover(); 17687 17688 }); 17689 17690 17691 }); 17692 17693 17694 17695}(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.