1var _____WB$wombat$assign$function_____=function(name){return (globalThis._wb_wombat && globalThis._wb_wombat.local_init && globalThis._wb_wombat.local_init(name))||globalThis[name];};if(!globalThis.__WB_pmw){globalThis.__WB_pmw=function(obj){this.__WB_source=obj;return this;}}{ 2let window = _____WB$wombat$assign$function_____("window"); 3let self = _____WB$wombat$assign$function_____("self"); 4let document = _____WB$wombat$assign$function_____("document"); 5let location = _____WB$wombat$assign$function_____("location"); 6let top = _____WB$wombat$assign$function_____("top"); 7let parent = _____WB$wombat$assign$function_____("parent"); 8let frames = _____WB$wombat$assign$function_____("frames"); 9let opener = _____WB$wombat$assign$function_____("opener"); 10/** 11 * File fronend-pro.js 12 * 13 * Handles toggling the navigation menu for Addon widget 14 * 15 * @package astra-addon 16 */ 17 18 astraToggleSetupPro = function( mobileHeaderType, body, menu_click_listeners ) { 19 20 var flag = false; 21 var menuToggleAllLength; 22 23 if ( 'off-canvas' === mobileHeaderType || 'full-width' === mobileHeaderType ) { 24 // comma separated selector added, if menu is outside of Off-Canvas then submenu is not clickable, it work only for Off-Canvas area with dropdown style. 25 var __main_header_all = document.querySelectorAll( '#ast-mobile-popup, #ast-mobile-header' ); 26 if ( body.classList.contains('ast-header-break-point') ) { 27 28 var menu_toggle_all = document.querySelectorAll( '#ast-mobile-header .main-header-menu-toggle' ); 29 } else { 30 menu_toggle_all = document.querySelectorAll( '#ast-desktop-header .main-header-menu-toggle' ); 31 } 32 menuToggleAllLength = menu_toggle_all.length; 33 } else { 34 35 if ( body.classList.contains('ast-header-break-point') ) { 36 37 var __main_header_all = document.querySelectorAll( '#ast-mobile-header' ), 38 menu_toggle_all = document.querySelectorAll( '#ast-mobile-header .main-header-menu-toggle' ); 39 menuToggleAllLength = menu_toggle_all.length; 40 flag = menuToggleAllLength > 0 ? false : true; 41 menuToggleAllLength = flag ? 1 : menuToggleAllLength; 42 } else { 43 44 var __main_header_all = document.querySelectorAll( '#ast-desktop-header' ), 45 menu_toggle_all = document.querySelectorAll('#ast-desktop-header .main-header-menu-toggle'); 46 menuToggleAllLength = menu_toggle_all.length; 47 } 48 } 49 50 if ( menuToggleAllLength > 0 || flag ) { 51 52 for (var i = 0; i < menuToggleAllLength; i++) { 53 54 if ( !flag ) { 55 menu_toggle_all[i].setAttribute('data-index', i); 56 57 if (!menu_click_listeners[i]) { 58 menu_click_listeners[i] = menu_toggle_all[i]; 59 menu_toggle_all[i].removeEventListener('click', astraNavMenuToggle); 60 menu_toggle_all[i].addEventListener('click', astraNavMenuToggle, false); 61 } 62 } 63 64 if ('undefined' !== typeof __main_header_all[i]) { 65 66 // To handle the comma seprated selector added above we need this loop. 67 for( var mainHeaderCount =0; mainHeaderCount < __main_header_all.length; mainHeaderCount++ ){ 68 69 if (document.querySelector('header.site-header').classList.contains('ast-builder-menu-toggle-link')) { 70 var astra_menu_toggle = __main_header_all[mainHeaderCount].querySelectorAll('ul.main-header-menu .menu-item-has-children > .menu-link, ul.main-header-menu .ast-menu-toggle'); 71 } else { 72 var astra_menu_toggle = __main_header_all[mainHeaderCount].querySelectorAll('ul.main-header-menu .ast-menu-toggle'); 73 } 74 // Add Eventlisteners for Submenu. 75 if (astra_menu_toggle.length > 0) { 76 77 for (var j = 0; j < astra_menu_toggle.length; j++) { 78 astra_menu_toggle[j].removeEventListener('click', AstraToggleSubMenu); 79 astra_menu_toggle[j].addEventListener('click', AstraToggleSubMenu, false); 80 } 81 } 82 } 83 } 84 } 85 } 86} 87 88astraNavMenuTogglePro = function ( event, body, mobileHeaderType, thisObj ) { 89 90 event.preventDefault(); 91 92 var desktop_header = event.target.closest('#ast-desktop-header'); 93 94 var desktop_header_content = document.querySelector('#masthead > #ast-desktop-header .ast-desktop-header-content'); 95 96 if ( null !== desktop_header && undefined !== desktop_header && '' !== desktop_header ) { 97 98 var desktop_toggle = desktop_header.querySelector( '.main-header-menu-toggle' ); 99 } else { 100 var desktop_toggle = document.querySelector('#masthead > #ast-desktop-header .main-header-menu-toggle'); 101 } 102 103 var desktop_menu = document.querySelector('#masthead > #ast-desktop-header .ast-desktop-header-content .main-header-bar-navigation'); 104 105 if ( 'desktop' === event.currentTarget.trigger_type ) { 106 107 if ( null !== desktop_menu && '' !== desktop_menu && undefined !== desktop_menu ) { 108 astraToggleClass(desktop_menu, 'toggle-on'); 109 if (desktop_menu.classList.contains('toggle-on')) { 110 desktop_menu.style.display = 'block'; 111 } else { 112 desktop_menu.style.display = ''; 113 } 114 } 115 astraToggleClass(desktop_toggle, 'toggled'); 116 if ( desktop_toggle.classList.contains( 'toggled' ) ) { 117 body.classList.add("ast-main-header-nav-open"); 118 if ( 'dropdown' === mobileHeaderType ) { 119 desktop_header_content.style.display = 'block'; 120 } 121 } else { 122 body.classList.remove("ast-main-header-nav-open"); 123 desktop_header_content.style.display = 'none'; 124 } 125 return; 126 } 127 128 var __main_header_all = document.querySelectorAll('#masthead > #ast-mobile-header .main-header-bar-navigation'); 129 menu_toggle_all = document.querySelectorAll( '#masthead > #ast-mobile-header .main-header-menu-toggle' ) 130 var event_index = '0'; 131 var sticky_header = false;
132 if ( null !== thisObj.closest( '#ast-fixed-header' ) ) { 133 134 __main_header_all = document.querySelectorAll('#ast-fixed-header > #ast-mobile-header .main-header-bar-navigation'); 135 menu_toggle_all = document.querySelectorAll( '#ast-fixed-header .main-header-menu-toggle' ) 136 137 event_index = '0'; 138 sticky_header = true; 139 140 } 141 142 if ('undefined' === typeof __main_header_all[event_index]) { 143 return false; 144 } 145 var menuHasChildren = __main_header_all[event_index].querySelectorAll('.menu-item-has-children'); 146 for (var i = 0; i < menuHasChildren.length; i++) { 147 menuHasChildren[i].classList.remove('ast-submenu-expanded'); 148 var menuHasChildrenSubMenu = menuHasChildren[i].querySelectorAll('.sub-menu'); 149 for (var j = 0; j < menuHasChildrenSubMenu.length; j++) { 150 menuHasChildrenSubMenu[j].style.display = 'none'; 151 } 152 } 153 154 var menu_class = thisObj.getAttribute('class') || ''; 155 156 if ( menu_class.indexOf('main-header-menu-toggle') !== -1 ) { 157 astraToggleClass(__main_header_all[event_index], 'toggle-on'); 158 astraToggleClass(menu_toggle_all[event_index], 'toggled'); 159 if ( sticky_header && 1 < menu_toggle_all.length ) { 160 astraToggleClass(menu_toggle_all['1'], 'toggled'); 161 } 162 if (__main_header_all[event_index].classList.contains('toggle-on')) { 163 __main_header_all[event_index].style.display = 'block'; 164 body.classList.add("ast-main-header-nav-open"); 165 } else { 166 __main_header_all[event_index].style.display = ''; 167 body.classList.remove("ast-main-header-nav-open"); 168 } 169 } 170} 171 172 173 174const accountMenuToggle = function () { 175 const checkAccountActionTypeCondition = astraAddon.hf_account_action_type && 'menu' === astraAddon.hf_account_action_type; 176 const accountMenuClickCondition = checkAccountActionTypeCondition && astraAddon.hf_account_show_menu_on && 'click' === astraAddon.hf_account_show_menu_on; 177 178 const headerAccountContainer = document.querySelectorAll('.ast-header-account-wrap'); 179 180 if( headerAccountContainer ) { 181 182 headerAccountContainer.forEach(element => { 183 184 const accountMenu = element.querySelector('.ast-account-nav-menu'); 185 186 document.addEventListener('pointerup', function(e) { 187 const condition = ( accountMenuClickCondition ) || ( checkAccountActionTypeCondition && document.querySelector('body').classList.contains('ast-header-break-point')); 188 if( condition ) { 189 // if the target of the click isn't the container nor a descendant of the container 190 if ( accountMenu && !element.contains( e.target ) ) { 191 accountMenu.style.right = ''; 192 accountMenu.style.left = ''; 193 } 194 } 195 }); 196 197 const headerAccountTrigger = element.querySelector( '.ast-header-account-link' ); 198 if( headerAccountTrigger ) { 199 headerAccountTrigger.addEventListener( 'click', function(e) { 200 const condition = ( accountMenuClickCondition ) || ( checkAccountActionTypeCondition && document.querySelector('body').classList.contains('ast-header-break-point')); 201 if( condition ) { 202 203 headerSelectionPosition = e.target.closest('.site-header-section'); 204 205 if( headerSelectionPosition ) { 206 if( headerSelectionPosition.classList.contains('site-header-section-left') ) { 207 accountMenu.style.left = accountMenu.style.left === '' ? '-100%' : ''; 208 accountMenu.style.right = accountMenu.style.right === '' ? 'auto' : ''; 209 } else { 210 accountMenu.style.right = accountMenu.style.right === '' ? '-100%' : ''; 211 accountMenu.style.left = accountMenu.style.left === '' ? 'auto' : ''; 212 } 213 } 214 } 215 }); 216 } 217 }); 218 } 219} 220 221document.addEventListener( 'astPartialContentRendered', function() { 222 accountMenuToggle(); 223}); 224 225window.addEventListener( 'load', function() { 226 accountMenuToggle(); 227} ); 228 229document.addEventListener( 'astLayoutWidthChanged', function() { 230 accountMenuToggle(); 231} ); 232/** 233 * Stick elements 234 * 235 * => How to use? 236 * 237 * jQuery( {SELECTOR} ).astHookExtSticky( { 238 * dependent: [{selectors}], // Not required. Default: []. Stick element dependent selectors. 239 * stick_upto_scroll: {value}, // Not required. Default: 0. Stick element after scroll upto the {value} in px. 240 * gutter: {value}, // Not required. Default: 0. Stick element from top of the window in px\. 241 * }); 242 * 243 * @package Astra Addon 244 * @since 1.0.0 245 */ 246 247;(function ( $, window, undefined ) { 248 249 var pluginName = 'astHookExtSticky', 250 document = window.document, 251 windowWidth = jQuery( window ).outerWidth(), 252 viewPortWidth = jQuery( window ).width(), 253 defaults = { 254 dependent : [], 255 max_width : '', 256 site_layout : '', 257 break_point : 920, 258 admin_bar_height_lg : 32, 259 admin_bar_height_sm : 46, 260 admin_bar_height_xs : 0, 261 stick_upto_scroll : 0, 262 gutter : 0, 263 wrap : '<div></div>', 264 265 // Padding support of <body> tag. 266 body_padding_support : true, 267 268 // Padding support of <html> tag. 269 html_padding_support : true, 270 271 active_shrink : false, 272 // Added shrink option. 273 shrink : { 274 padding_top : '', 275 padding_bottom : '', 276 }, 277 278 // Enable sticky on mobile 279 sticky_on_device : 'desktop', 280 281 header_style : 'none', 282 283 hide_on_scroll : 'no', 284 }, 285 /* Manage hide on scroll down */ 286 lastScrollTop = 0, 287 delta = 5, 288 navbarHeight = 0, 289 should_stick = true, 290 hideScrollInterval; 291 292 /** 293 * Init 294 * 295 * @since 1.0.0 296 */ 297 function astHookExtSticky( element, options ) { 298 this.element = element; 299 this.options = $.extend( {}, defaults, options ); 300 this._defaults = defaults; 301 this._name = pluginName; 302 303 /* Manage hide on scroll down */ 304 if ( '1' == this.options.hide_on_scroll ) { 305 this.navbarHeight = $(element).outerHeight(); 306 } 307 308 this.lastScrollTop = 0; 309 this.delta = 5; 310 this.should_stick = true; 311 this.hideScrollInterval = ''; 312 313 this.init(); 314 } 315 316 /** 317 * Stick element 318 * 319 * @since 1.0.0 320 */ 321 astHookExtSticky.prototype.stick_me = function( self, type ) { 322
323 var selector = jQuery( self.element ), 324 windowWidth = jQuery( window ).outerWidth(), 325 stick_upto_scroll = parseInt( self.options.stick_upto_scroll ), 326 max_width = parseInt( selector.parent().attr( 'data-stick-maxwidth' ) ), // parseInt( self.options.max_width ), 327 gutter = parseInt( selector.parent().attr( 'data-stick-gutter' ) ); // parseInt( self.options.gutter ). 328 /** 329 * Check window width 330 */ 331 var hook_sticky_header = astraAddon.hook_sticky_header || ''; 332 // Any stick header is enabled? 333 if ( 'enabled' == hook_sticky_header ) { 334 if ( ( 'desktop' == self.options.sticky_on_device && astraAddon.hook_custom_header_break_point > windowWidth ) || 335 ( 'mobile' == self.options.sticky_on_device && astraAddon.hook_custom_header_break_point <= windowWidth ) ) { 336 self.stickRelease( self ); 337 } else { 338 if ( jQuery( window ).scrollTop() > stick_upto_scroll ) { 339 340 if ( 'none' == self.options.header_style ) { 341 if ( 'enabled' == self.options.active_shrink ) { 342 self.hasShrink( self, 'stick' ); 343 var topValue = 'none'; // Default value for 'top' property 344 if ( !selector.hasClass( 'ast-custom-header' ) ) { 345 topValue = gutter; // If it's not the specified class, set 'top' to 'gutter' 346 } 347 selector.parent().css( 'min-height', selector.outerHeight() ); 348 selector.addClass( 'ast-header-sticky-active' ).stop().css( { 349 'max-width': max_width, 350 'top': topValue, // Setting 'top' property based on the condition 351 'padding-top': self.options.shrink.padding_top, 352 'padding-bottom': self.options.shrink.padding_bottom, 353 } ); 354 selector.addClass( 'ast-sticky-shrunk' ).stop(); 355 } else { 356 self.hasShrink( self, 'stick' ); 357 selector.parent().css( 'min-height', selector.outerHeight() ); 358 selector.addClass( 'ast-header-sticky-active' ).stop().css( { 359 'max-width': max_width, 360 'top': gutter, 361 'padding-top': self.options.shrink.padding_top, 362 'padding-bottom': self.options.shrink.padding_bottom, 363 } ); 364 selector.addClass( 'ast-sticky-shrunk' ).stop(); 365 } 366 } 367 368 } else { 369 self.stickRelease( self ); 370 } 371 } 372 } 373 374 var hook_sticky_footer = astraAddon.hook_sticky_footer || ''; 375 // Any stick header is enabled? 376 if ( 'enabled' == hook_sticky_footer ) { 377 378 if ( 379 ( 'desktop' == self.options.sticky_on_device && astraAddon.hook_custom_footer_break_point > windowWidth ) || 380 ( 'mobile' == self.options.sticky_on_device && astraAddon.hook_custom_footer_break_point <= windowWidth ) 381 ) { 382 self.stickRelease( self ); 383 } 384 else{ 385 jQuery( 'body' ).addClass( 'ast-footer-sticky-active' ); 386 selector.parent().css( 'min-height', selector.outerHeight() ); 387 selector.stop().css({ 388 'max-width' : max_width, 389 }); 390 } 391 } 392 } 393 394 astHookExtSticky.prototype.update_attrs = function () { 395 396 var self = this, 397 selector = jQuery( self.element ), 398 gutter = parseInt( self.options.gutter ), 399 max_width = self.options.max_width; 400 401 if ( 'none' == self.options.header_style ) { 402 var stick_upto_scroll = selector.offset().top || 0; 403 } 404 405 /** 406 * Update Max-Width 407 */ 408 if ( 'ast-box-layout' != self.options.site_layout ) { 409 max_width = jQuery( 'body' ).width(); 410 } 411 412 /** 413 * Check dependent element 414 * - Is exist? 415 * - Has attr 'data-stick-support' with status 'on' 416 */ 417 if ( self.options.dependent ) { 418 jQuery.each( self.options.dependent, function(index, val) { 419 if ( 420 ( jQuery( val ).length ) && 421 ( jQuery( val ).parent().attr( 'data-stick-support' ) == 'on' ) 422 ) { 423 dependent_height = jQuery( val ).outerHeight(); 424 gutter += parseInt( dependent_height ); 425 stick_upto_scroll -= parseInt( dependent_height ); 426 } 427 }); 428 } 429 430 /** 431 * Add support for Admin bar height 432 */ 433 if ( self.options.admin_bar_height_lg && jQuery( '#wpadminbar' ).length && viewPortWidth > 782 ) { 434 gutter += parseInt( self.options.admin_bar_height_lg ); 435 stick_upto_scroll -= parseInt( self.options.admin_bar_height_lg ); 436 } 437 438 if ( self.options.admin_bar_height_sm && jQuery( '#wpadminbar' ).length && ( viewPortWidth >= 600 && viewPortWidth <= 782 ) ) { 439 gutter += parseInt( self.options.admin_bar_height_sm ); 440 stick_upto_scroll -= parseInt( self.options.admin_bar_height_sm ); 441 } 442 443 if( self.options.admin_bar_height_xs && jQuery( '#wpadminbar' ).length ){ 444 gutter += parseInt( self.options.admin_bar_height_xs ); 445 stick_upto_scroll -= parseInt( self.options.admin_bar_height_xs ); 446 } 447 448 /** 449 * Add support for <body> tag 450 */ 451 if ( self.options.body_padding_support ) { 452 gutter += parseInt( jQuery( 'body' ).css( 'padding-top' ), 10 ); 453 stick_upto_scroll -= parseInt( jQuery( 'body' ).css( 'padding-top' ), 10 ); 454 } 455 456 /** 457 * Add support for <html> tag 458 */ 459 if ( self.options.html_padding_support ) { 460 gutter += parseInt( jQuery( 'html' ).css( 'padding-top' ), 10 ); 461 stick_upto_scroll -= parseInt( jQuery( 'html' ).css( 'padding-top' ), 10 ); 462 } 463 464 /** 465 * Updated vars 466 */ 467 self.options.stick_upto_scroll = stick_upto_scroll; 468 469 /** 470 * Update Attributes 471 */ 472 if ( 'none' == self.options.header_style ) { 473 selector.parent() 474 .css( 'min-height', selector.outerHeight() ) 475 .attr( 'data-stick-gutter', parseInt( gutter ) ) 476 .attr( 'data-stick-maxwidth', parseInt( max_width ) ); 477 } 478 } 479 480 astHookExtSticky.prototype.hasShrink = function( self, method ) { 481 482 var st = $( window ).scrollTop(); 483 484 // If they scrolled down and are past the navbar, add class .nav-up. 485 // This is necessary so you never see what is "behind" the navbar. 486 var fixed_header = jQuery(self.element); 487 if ( st > fixed_header.outerHeight() ){ 488 // Active Shrink 489 jQuery('body').addClass('ast-shrink-custom-header'); 490 } else { 491 // Remove Shrink effect 492 jQuery('body').removeClass('ast-shrink-custom-header'); 493 } 494 } 495 496 astHookExtSticky.prototype.stickRelease = function( self ) {
497 var selector = jQuery( self.element ); 498 499 var hook_sticky_header = astraAddon.hook_sticky_header || ''; 500 // Any stick header is enabled? 501 if ( 'enabled' == hook_sticky_header ) { 502 if ( 'none' == self.options.header_style ) { 503 selector.removeClass( 'ast-header-sticky-active' ).stop().css({ 504 'max-width' : '', 505 'top' : '', 506 'padding' : '', 507 }); 508 selector.parent().css( 'min-height', '' ); 509 selector.removeClass( 'ast-sticky-shrunk' ).stop(); 510 } 511 } 512 513 var hook_sticky_footer = astraAddon.hook_sticky_footer || ''; 514 // Any stick footer is enabled? 515 if ( 'enabled' == hook_sticky_footer ) { 516 jQuery( 'body' ).removeClass( 'ast-footer-sticky-active' ); 517 } 518 } 519 /** 520 * Init Prototype 521 * 522 * @since 1.0.0 523 */ 524 astHookExtSticky.prototype.init = function () { 525 526 /** 527 * If custom stick options are set 528 */ 529 if ( jQuery( this.element ) ) { 530 531 var self = this, 532 selector = jQuery( self.element ), 533 gutter = parseInt( self.options.gutter ), 534 stick_upto_scroll = selector.position().top || 0, 535 dependent_height = 0; 536 537 /** 538 * Add parent <div> wrapper with height element for smooth scroll 539 * 540 * Added 'data-stick-support' to all sticky elements 541 * To know the {dependent} element has support of 'stick' 542 */ 543 if ( 'none' == self.options.header_style ) { 544 selector.wrap( self.options.wrap ) 545 .parent().css( 'min-height', selector.outerHeight() ) 546 .attr( 'data-stick-support', 'on' ) 547 .attr( 'data-stick-maxwidth', parseInt( self.options.max_width ) ); 548 } 549 550 self.update_attrs(); 551 552 // Stick me!. 553 jQuery( window ).on('resize', function() { 554 555 self.stickRelease( self ); 556 self.update_attrs(); 557 self.stick_me( self ); 558 } ); 559 560 jQuery( window ).on('scroll', function() { 561 // update the stick_upto_scroll if normal main header navigation is opend. 562 self.stick_me( self, 'scroll' ); 563 } ); 564 565 jQuery( document ).ready(function($) { 566 self.stick_me( self ); 567 } ); 568 569 } 570 571 }; 572 573 $.fn[pluginName] = function ( options ) { 574 return this.each(function () { 575 if ( ! $.data( this, 'plugin_' + pluginName )) { 576 $.data( this, 'plugin_' + pluginName, new astHookExtSticky( this, options ) ); 577 } 578 }); 579 } 580 581 582 583 var $body = jQuery( 'body' ), 584 layout_width = $body.width(), 585 site_layout = astraAddon.site_layout || '', 586 hook_sticky_header = astraAddon.hook_sticky_header || '', 587 hook_shrink_header = astraAddon.hook_shrink_header || ''; 588 sticky_header_on_devices = astraAddon.hook_sticky_header_on_devices || 'desktop', 589 site_layout_box_width = astraAddon.site_layout_box_width || 1200, 590 hook_sticky_footer = astraAddon.hook_sticky_footer || '', 591 sticky_footer_on_devices = astraAddon.hook_sticky_footer_on_devices || 'desktop'; 592 593 594 595 switch ( site_layout ) { 596 case 'ast-box-layout': 597 layout_width = parseInt( site_layout_box_width ); 598 break; 599 } 600 601 jQuery( document ).ready(function($) { 602 // Any stick header is enabled? 603 if ( 'enabled' == hook_sticky_header ) { 604 605 jQuery( '.ast-custom-header' ).astHookExtSticky({ 606 sticky_on_device: sticky_header_on_devices, 607 header_style: 'none', 608 site_layout: site_layout, 609 max_width: layout_width, 610 active_shrink: hook_shrink_header, 611 }); 612 613 } 614 615 // Any stick footer is enabled? 616 if ( 'enabled' == hook_sticky_footer ) { 617 618 jQuery( '.ast-custom-footer' ).astHookExtSticky({ 619 sticky_on_device: sticky_footer_on_devices, 620 max_width: layout_width, 621 site_layout: site_layout, 622 header_style: 'none', 623 }); 624 625 } 626 }); 627 628}(jQuery, window)); 629/** 630 * Stick elements 631 * 632 * => How to use? 633 * 634 * jQuery( {SELECTOR} ).astExtSticky( { 635 * dependent: [{selectors}], // Not required. Default: []. Stick element dependent selectors. 636 * stick_upto_scroll: {value}, // Not required. Default: 0. Stick element after scroll upto the {value} in px. 637 * gutter: {value}, // Not required. Default: 0. Stick element from top of the window in px\. 638 * }); 639 * 640 * @package Astra Addon 641 * @since 1.0.0 642 */ 643 644 ;(function ( $, window, undefined ) { 645
646 var pluginName = 'astExtSticky', 647 document = window.document, 648 windowWidth = jQuery( window ).outerWidth(), 649 viewPortWidth = jQuery( window ).width(), 650 header_builder_active = astraAddon.header_builder_active, 651 defaults = { 652 dependent : [], 653 max_width : '', 654 site_layout : '', 655 break_point : 920, 656 admin_bar_height_lg : 32, 657 admin_bar_height_sm : 46, 658 admin_bar_height_xs : 0, 659 stick_upto_scroll : 0, 660 gutter : 0, 661 wrap : '<div></div>', 662 663 // Padding support of <body> tag. 664 body_padding_support : true, 665 666 // Padding support of <html> tag. 667 html_padding_support : true, 668 669 // Added shrink option. 670 shrink : { 671 padding_top : '', 672 padding_bottom : '', 673 }, 674 675 // Enable sticky on mobile 676 sticky_on_device : 'desktop', 677 678 header_style : 'none', 679 680 hide_on_scroll : 'no', 681 }, 682 /* Manage hide on scroll down */ 683 lastScrollTop = 0, 684 delta = 5, 685 navbarHeight = 0, 686 loginPopup = document.querySelector('#ast-hb-account-login-wrap') !== null, 687 should_stick = true, 688 hideScrollInterval; 689 690 /** 691 * Init 692 * 693 * @since 1.0.0 694 */ 695 function astExtSticky( element, options ) { 696 this.element = element; 697 this.options = $.extend( {}, defaults, options ); 698 this._defaults = defaults; 699 this._name = pluginName; 700 701 /* Manage hide on scroll down */ 702 if ( '1' == this.options.hide_on_scroll ) { 703 this.navbarHeight = $(element).outerHeight(); 704 } 705 706 this.lastScrollTop = 0; 707 this.delta = 5; 708 this.should_stick = true; 709 this.hideScrollInterval = ''; 710 711 this.init(); 712 } 713 714 /** 715 * Stick element 716 * 717 * @since 1.0.0 718 */ 719 astExtSticky.prototype.stick_me = function( self, type ) { 720 721 var selector = jQuery( self.element ), 722 windowWidth = jQuery( window ).outerWidth(); 723 stick_upto_scroll = parseInt( self.options.stick_upto_scroll ), 724 max_width = parseInt( selector.parent().attr( 'data-stick-maxwidth' ) ), // parseInt( self.options.max_width ), 725 gutter = parseInt( selector.parent().attr( 'data-stick-gutter' ) ), // parseInt( self.options.gutter ). 726 aboveHeaderSelectorValue = gutter; 727 728 if ( header_builder_active && astraAddon.header_main_shrink ) { 729 // Decrese the top of primary / below as we decrease the min-height of all sticked headers by 20. 730 if ( ( selector.hasClass( 'ast-stick-primary-below-wrapper' ) || ( selector.hasClass( 'ast-primary-header' ) ) ) && 1 == astraAddon.header_above_stick && gutter > 0 ) { 731 732 gutter = gutter - 10; 733 } 734 735 const aboveHeaderBar = document.querySelector( '.ast-above-header-bar' ); 736 if ( astraAddon.header_above_stick === '1' && aboveHeaderBar !== null ) { 737 const aboveHeaderBarHeight = aboveHeaderBar.getBoundingClientRect().height + parseInt( aboveHeaderBar.parentNode.getAttribute( 'data-stick-gutter' ) ); 738 if ( ( selector.hasClass( 'ast-stick-primary-below-wrapper' ) || ( selector.hasClass( 'ast-primary-header' ) ) ) && gutter > 0 ) { 739 gutter = aboveHeaderBarHeight; 740 } 741 } 742 } 743 744 /** 745 * Check window width 746 */ 747 if ( 748 (self.options.sticky_on_device === 'desktop' && jQuery('body').hasClass('ast-header-break-point')) || 749 (self.options.sticky_on_device === 'mobile' && !jQuery('body').hasClass('ast-header-break-point')) 750 ) { 751 self.stickRelease(self); 752 } 753 else { 754 755 // stick_upto_scroll with negative value enables a sticky by default so rounding up to zero. 756 if ( stick_upto_scroll < 0 ) { 757 stick_upto_scroll = 0; 758 } 759 760 // Check if the Elementor Motion Effect class present 761 var stcikyHeaderElementor = document.getElementsByClassName('elementor-motion-effects-parent'); 762 var stickyHeaderFlag = stcikyHeaderElementor.length > 0 ? true : false; 763 764 if ( jQuery( window ).scrollTop() > stick_upto_scroll ) { 765 766 var fixed_header = selector; 767 768 if ( header_builder_active ) { 769 770 var mobile_parent = selector.closest( '.ast-mobile-header-wrap' ); 771 var desktop_parent = selector.closest( '#ast-desktop-header' ); 772 773 mobile_parent = ( 0 === mobile_parent.length ) ? selector.find( '.ast-mobile-header-wrap' ) : mobile_parent; 774 775 desktop_parent = ( 0 === desktop_parent.length ) ? selector.find( '#ast-desktop-header' ) : desktop_parent; 776 777 mobile_parent.find( '.ast-mobile-header-content' ).css( 'to
777p', selector.outerHeight() + gutter ); 778 if ( 'ast-box-layout' == self.options.site_layout ) { 779 var max_width_mobile = jQuery( 'body' ).width(); 780 mobile_parent.find( '.ast-mobile-header-content' ).css( 'width', max_width_mobile ); 781 } else { 782 mobile_parent.find( '.ast-mobile-header-content' ).css( 'width', max_width ); 783 } 784 785 desktop_parent.find( '.ast-desktop-header-content' ).css( 'top', selector.outerHeight() + gutter ); 786 desktop_parent.find( '.ast-desktop-header-content' ).css( 'width', max_width ); 787 } 788 789 if ( '1' === self.options.hide_on_scroll ) { 790 791 self.hasScrolled( self, 'stick' ); 792 }else if ( 'none' == self.options.header_style ) { 793 794 if ( ! stickyHeaderFlag ) { 795 selector.parent().css( 'min-height', selector.outerHeight() ); 796 } 797 798 if ( ! document.querySelector('body').classList.contains( 'fl-builder-edit' ) ) { 799 selector.addClass('ast-sticky-active').stop().css({ 800 'top': gutter, 801 }); 802 } 803 selector.addClass( 'ast-sticky-active' ).stop().css({ 804 'max-width' : max_width, 805 'padding-top' : self.options.shrink.padding_top, 806 'padding-bottom' : self.options.shrink.padding_bottom, 807 }); 808 if ( ( selector.hasClass( 'ast-stick-primary-below-wrapper' ) || selector.hasClass( 'ast-primary-header' ) ) && 1 == astraAddon.header_above_stick && 70 > selector.closest('#ast-desktop-header').find('.ast-above-header-bar').outerHeight() ) { 809 selector.parent().css("min-height", selector.outerHeight()); 810 } 811 812 selector.addClass( 'ast-sticky-shrunk' ).stop(); 813 $( document ).trigger( "addStickyClass" ); 814 fixed_header.addClass('ast-header-sticked'); 815 816 }else if ( 'slide' == self.options.header_style ) { 817 fixed_header.css({ 818 'top' : gutter, 819 }); 820 fixed_header.addClass('ast-header-slide'); 821 fixed_header.css( 'visibility', 'visible' ); 822 fixed_header.addClass( 'ast-sticky-active' ).stop().css({ 823 'transform': loginPopup ? 'none' : 'translateY(0)', 824 }); 825 $('html').addClass('ast-header-stick-slide-active'); 826 $( document ).trigger( "addStickyClass" ); 827 fixed_header.addClass('ast-header-sticked'); 828 829 }else if( 'fade' == self.options.header_style ) { 830 fixed_header.css({ 831 'top' : gutter, 832 }); 833 fixed_header.addClass('ast-header-fade'); 834 fixed_header.css( 'visibility', 'visible' ); 835 fixed_header.addClass( 'ast-sticky-active' ).stop().css({ 836 'opacity' : '1', 837 }); 838 $('html').addClass('ast-header-stick-fade-active'); 839 $( document ).trigger( "addStickyClass" ); 840 fixed_header.addClass('ast-header-sticked'); 841 } 842 } else { 843 self.stickRelease( self ); 844 if ( header_builder_active ) { 845 var mobile_parent = selector.closest( '.ast-mobile-header-wrap' ); 846 mobile_parent = ( 0 === mobile_parent.length ) ? selector.find( '.ast-mobile-header-wrap' ) : mobile_parent; 847 if ( !jQuery( 'body' ).hasClass( 'ast-primary-sticky-header-active' ) || !jQuery( 'body' ).hasClass( 'ast-above-sticky-header-active' ) || !jQuery( 'body' ).hasClass( 'ast-below-sticky-header-active' ) ) { 848 mobile_parent.find( '.ast-mobile-header-content' ).removeAttr( 'style' ); 849 } 850 } 851 } 852 } 853 } 854 855 astExtSticky.prototype.update_attrs = function () { 856 857 var self = this, 858 selector = jQuery( self.element ), 859 gutter = parseInt( self.options.gutter ), 860 max_width = self.options.max_width; 861 862 if ( 'none' == self.options.header_style && ! jQuery( 'body' ).hasClass( 'ast-sticky-toggled-off' ) ) { 863 var stick_upto_scroll = selector.offset().top || 0; 864 }else{ 865 if ( $('#masthead').length ) { 866 var masthead = $('#masthead'); 867 var masthead_bottom = masthead.offset().top + masthead.outerHeight() + 100; 868 var stick_upto_scroll = masthead_bottom || 0; 869 } 870 } 871 872 /** 873 * Update Max-Width 874 */ 875 if ( 'ast-box-layout' != self.options.site_layout ) { 876 max_width = jQuery( 'body' ).width(); 877 } 878 879 /** 880 * Check dependent element 881 * - Is exist? 882 * - Has attr 'data-stick-support' with status 'on' 883 */ 884 if ( self.options.dependent ) { 885 jQuery.each( self.options.dependent, function(index, val) { 886 if ( 887 ( jQuery( val ).length ) && 888 ( jQuery( val ).parent().attr( 'data-stick-support' ) == 'on' ) 889 ) { 890 891 dependent_height = jQuery( val ).outerHeight();
892 gutter += parseInt( dependent_height ); 893 stick_upto_scroll -= parseInt( dependent_height ); 894 } 895 }); 896 } 897 898 /** 899 * Add support for Admin bar height 900 */ 901 if ( self.options.admin_bar_height_lg && jQuery( '#wpadminbar' ).length && viewPortWidth > 782 ) { 902 gutter += parseInt( self.options.admin_bar_height_lg ); 903 stick_upto_scroll -= parseInt( self.options.admin_bar_height_lg ); 904 } 905 906 if ( self.options.admin_bar_height_sm && jQuery( '#wpadminbar' ).length && ( viewPortWidth >= 600 && viewPortWidth <= 782 ) ) { 907 gutter += parseInt( self.options.admin_bar_height_sm ); 908 stick_upto_scroll -= parseInt( self.options.admin_bar_height_sm ); 909 } 910 911 if( self.options.admin_bar_height_xs && jQuery( '#wpadminbar' ).length ){ 912 gutter += parseInt( self.options.admin_bar_height_xs ); 913 stick_upto_scroll -= parseInt( self.options.admin_bar_height_xs ); 914 } 915 916 /** 917 * Add support for <body> tag 918 */ 919 if ( self.options.body_padding_support ) { 920 gutter += parseInt( jQuery( 'body' ).css( 'padding-top' ), 10 ); 921 stick_upto_scroll -= parseInt( jQuery( 'body' ).css( 'padding-top' ), 10 ); 922 } 923 924 /** 925 * Add support for <html> tag 926 */ 927 if ( self.options.html_padding_support ) { 928 gutter += parseInt( jQuery( 'html' ).css( 'padding-top' ), 10 ); 929 stick_upto_scroll -= parseInt( jQuery( 'html' ).css( 'padding-top' ), 10 ); 930 } 931 932 /** 933 * Reduce the stick_upto_scrll by one if filter `astra_addon_sticky_header_stick_origin_position` is set true. 934 * This will make the sticky header appear sticky on initial load. 935 */ 936 if ( stick_origin_position ) { 937 stick_upto_scroll--; 938 } 939 940 /** 941 * Updated vars 942 */ 943 self.options.stick_upto_scroll = stick_upto_scroll; 944 945 /** 946 * Update Attributes 947 */ 948 if ( 'none' == self.options.header_style ) { 949 selector.parent() 950 .css( 'min-height', selector.outerHeight() ) 951 .attr( 'data-stick-gutter', parseInt( gutter ) ) 952 .attr( 'data-stick-maxwidth', parseInt( max_width ) ); 953 }else{ 954 selector.parent() 955 .attr( 'data-stick-gutter', parseInt( gutter ) ) 956 .attr( 'data-stick-maxwidth', parseInt( max_width ) ); 957 958 if ( 'ast-padded-layout' === self.options.site_layout ) { 959 selector.css( 'max-width', parseInt( max_width ) ); 960 } 961 } 962 } 963 964 astExtSticky.prototype.hasScrolled = function( self, method ) { 965 966 var st = $( window ).scrollTop(); 967 968 // Make sure they scroll more than delta 969 if(Math.abs(lastScrollTop - st) <= delta) 970 return; 971 972 // If they scrolled down and are past the navbar, add class .nav-up. 973 // This is necessary so you never see what is "behind" the navbar. 974 var fixed_header = jQuery(self.element); 975 if (st > lastScrollTop && st > navbarHeight){ 976 977 // Scroll Down 978 jQuery(self.element).removeClass('ast-nav-down').addClass('ast-nav-up'); 979 } else { 980 // Scroll Up 981 if(st + $(window).height() < $(document).height()) { 982 jQuery(self.element).removeClass('ast-nav-up').addClass('ast-nav-down'); 983 } 984 } 985 986 lastScrollTop = st; 987 988 if ( !$(self.element).hasClass('ast-nav-up') && 'stick' == method ) { 989 fixed_header.css({ 990 'top' : gutter, 991 }); 992 fixed_header.addClass('ast-header-sticked'); 993 fixed_header.addClass('ast-header-slide'); 994 fixed_header.css( 'visibility', 'visible' ); 995 fixed_header.addClass( 'ast-sticky-active' ).stop().css({ 996 'transform':'translateY(0)', 997 }); 998 $( document ).trigger( "addStickyClass" ); 999 $('html').addClass('ast-header-stick-scroll-active'); 1000 }else{ 1001 fixed_header.css({ 1002 'transform':'translateY(-100%)', 1003 }).stop(); 1004 1005 setTimeout(function() { 1006 fixed_header.removeClass( 'ast-sticky-active' ); 1007 }, 300); 1008 fixed_header.css({ 1009 'visibility' : 'hidden', 1010 'top' : '', 1011 }); 1012 $( document ).trigger( "removeStickyClass" ); 1013 $('html').removeClass('ast-header-stick-scroll-active'); 1014 fixed_header.removeClass('ast-header-sticked'); 1015 } 1016 } 1017 1018 astExtSticky.prototype.stickRelease = function( self ) { 1019 var selector = jQuery( self.element ); 1020 var fixed_header = selector; 1021 if ( '1' === self.options.hide_on_scroll ) { 1022 self.hasScrolled( self, 'release' ); 1023 }else{ 1024 if ( 'none' == self.options.header_style ) { 1025 selector.removeClass( 'ast-sticky-active' ).stop().css({ 1026 'max-width' : '', 1027 'top' : '', 1028 'padding' : '', 1029 }); 1030 selector.parent().css( 'min-height', '' ); 1031 $( document ).trigger( "removeStickyClass" ); 1032 fixed_header.removeClass('ast-header-sticked'); 1033 selector.removeClass( 'ast-sticky-shrunk' ).stop(); 1034 1035 }else if ( 'slide' == self.options.header_style ) { 1036 fixed_header.removeClass( 'ast-sticky-active' ).stop().css({ 1037 'transform': loginPopup ? 'translateY(-100vh)' : 'translateY(-100%)', 1038 }); 1039 fixed_header.css({ 1040 'visibility' : 'hidden', 1041 'top' : '', 1042 }); 1043
1044 $('html').removeClass('ast-header-stick-slide-active'); 1045 $( document ).trigger( "removeStickyClass" ); 1046 fixed_header.removeClass('ast-header-sticked'); 1047 1048 }else if( 'fade' == self.options.header_style ) { 1049 fixed_header.removeClass( 'ast-sticky-active' ).stop().css({ 1050 'opacity' : '0', 1051 }); 1052 fixed_header.css({ 1053 'visibility' : 'hidden', 1054 }); 1055 fixed_header.removeClass('ast-header-sticked'); 1056 $( document ).trigger( "removeStickyClass" ); 1057 $('html').removeClass('ast-header-stick-fade-active'); 1058 } 1059 } 1060 } 1061 /** 1062 * Init Prototype 1063 * 1064 * @since 1.0.0 1065 */ 1066 astExtSticky.prototype.init = function () { 1067 1068 /** 1069 * If custom stick options are set 1070 */ 1071 if ( jQuery( this.element ) ) { 1072 1073 var self = this, 1074 selector = jQuery( self.element ); 1075 1076 /** 1077 * Add parent <div> wrapper with height element for smooth scroll 1078 * 1079 * Added 'data-stick-support' to all sticky elements 1080 * To know the {dependent} element has support of 'stick' 1081 */ 1082 if ( 'none' == self.options.header_style ) { 1083 selector.wrap( self.options.wrap ) 1084 .parent().css( 'min-height', selector.outerHeight() ) 1085 .attr( 'data-stick-support', 'on' ) 1086 .attr( 'data-stick-maxwidth', parseInt( self.options.max_width ) ); 1087 }else{ 1088 selector.wrap( self.options.wrap ) 1089 .attr( 'data-stick-support', 'on' ) 1090 .attr( 'data-stick-maxwidth', parseInt( self.options.max_width ) ); 1091 } 1092 1093 self.update_attrs(); 1094 1095 // Stick me!. 1096 jQuery( window ).on('resize', function() { 1097 1098 self.stickRelease( self ); 1099 self.update_attrs(); 1100 self.stick_me( self ); 1101 } ); 1102 1103 jQuery( window ).on('scroll', function() { 1104 // update the stick_upto_scroll if normal main header navigation is opend. 1105 self.stick_me( self, 'scroll' ); 1106 1107 if( jQuery( 'body' ).hasClass( 'ast-sticky-toggled-off' ) ){ 1108 self.update_attrs(); 1109 self.stick_me( self, 'scroll' ); 1110 } 1111 } ); 1112 1113 jQuery( document ).ready(function($) { 1114 self.stick_me( self ); 1115 setTimeout( () => self.stick_me( self ), 0 ); 1116 } ); 1117 } 1118 }; 1119 1120 $.fn[pluginName] = function ( options ) { 1121 return this.each(function () { 1122 if ( ! $.data( this, 'plugin_' + pluginName )) { 1123 $.data( this, 'plugin_' + pluginName, new astExtSticky( this, options ) ); 1124 } 1125 }); 1126 } 1127 1128 var $body = jQuery( 'body' ), 1129 layout_width = $body.width(), 1130 stick_header_meta = astraAddon.stick_header_meta || 'default', 1131 stick_main = astraAddon.header_main_stick || '', 1132 main_shrink = astraAddon.header_main_shrink || '', 1133 stick_above = astraAddon.header_above_stick || '', 1134 stick_below = astraAddon.header_below_stick || '', 1135 header_main_stick_meta = astraAddon.header_main_stick_meta || '', 1136 header_above_stick_meta = astraAddon.header_above_stick_meta || '', 1137 header_below_stick_meta = astraAddon.header_below_stick_meta || '', 1138 site_layout = astraAddon.site_layout || '', 1139 site_layout_box_width = astraAddon.site_layout_box_width || 1200, 1140 sticky_header_on_devices = astraAddon.sticky_header_on_devices || 'desktop', 1141 sticky_header_style = astraAddon.sticky_header_style || 'none', 1142 sticky_hide_on_scroll = astraAddon.sticky_hide_on_scroll || '', 1143 header_logo_width = astraAddon.header_logo_width || '', 1144 responsive_header_logo_width = astraAddon.responsive_header_logo_width || '', 1145 stick_origin_position = astraAddon.stick_origin_position || '', 1146 tablet_break_point = astraAddon.tablet_break_point || 768, 1147 mobile_break_point = astraAddon.mobile_break_point || 544; 1148 1149 /** 1150 * Check meta options 1151 */ 1152 if ( 'disabled' == stick_header_meta ) { 1153 return; 1154 } 1155 1156 if ( 'enabled' === stick_header_meta ) { 1157 stick_main = header_main_stick_meta; 1158 stick_above = header_above_stick_meta; 1159 stick_below = header_below_stick_meta; 1160 } 1161 1162 if ( $('header .site-logo-img img').length > 0 ) { 1163 var id_img = $('header .site-logo-img img'); 1164 var id_height = id_img.attr('height'); 1165 1166 if ( typeof id_height === 'undefined' ) { 1167 id_height = id_img.height(); 1168 } 1169 1170 if ( id_height == 0 ) { 1171 id_height = ''; 1172 } 1173 1174 if ( -1 === id_height.toString().indexOf('%') ) { 1175 id_height += 'px'; 1176 } 1177
1178 if ( '' != responsive_header_logo_width.desktop || '' != responsive_header_logo_width.tablet || '' != responsive_header_logo_width.mobile ) { 1179 var output = "<style type='text/css' id='ast-site-identity-img' class='ast-site-identity-img' > #masthead .ast-header-sticked .site-logo-img .astra-logo-svg { width: " + responsive_header_logo_width.desktop + "px; } @media (max-width: " + tablet_break_point + "px) { #masthead .ast-header-sticked .site-logo-img .astra-logo-svg { width: " + responsive_header_logo_width.tablet + "px; } } @media (max-width: " + mobile_break_point + "px) { #masthead .ast-header-sticked .site-logo-img .astra-logo-svg{ width: " + responsive_header_logo_width.mobile + "px; } } </style>"; 1180 }else if( '' != header_logo_width ){ 1181 var output = "<style type='text/css' id='ast-site-identity-img' class='ast-site-identity-img' > #masthead .ast-header-sticked .site-logo-img .astra-logo-svg { width: " + header_logo_width + "px; } #masthead .ast-header-sticked .site-logo-img img { max-height: " + id_height + "; width: auto; } </style>"; 1182 } 1183 1184 $("head").append( output ); 1185 } 1186 1187 // Any stick header is enabled? 1188 if ( stick_main || stick_above || stick_below ) { 1189 1190 // Add Respective class to the body dependent on which sticky header is activated. 1191 $( document ).on( "addStickyClass", function() { 1192 var bodyClass = ''; 1193 1194 if ( '1' == stick_main || 'on' == stick_main || 'disabled' == stick_main ) { 1195 bodyClass += " ast-primary-sticky-header-active"; 1196 } 1197 if ( '1' == stick_above || 'on' == stick_above || 'disabled' == stick_above ) { 1198 bodyClass += " ast-above-sticky-header-active"; 1199 } 1200 if ( '1' == stick_below || 'on' == stick_below || 'disabled' == stick_below ) { 1201 bodyClass += " ast-below-sticky-header-active"; 1202 } 1203 $('body').addClass(bodyClass); 1204 }); 1205 1206 // Remove Respective class from the body dependent on which sticky header is not activated. 1207 $( document ).on( "removeStickyClass", function() { 1208 var bodyClass = ''; 1209 1210 if ( '1' == stick_main || 'on' == stick_main || 'disabled' == stick_main ) { 1211 bodyClass += " ast-primary-sticky-header-active"; 1212 } 1213 if ( '1' == stick_above || 'on' == stick_above || 'disabled' == stick_above ) { 1214 bodyClass += " ast-above-sticky-header-active"; 1215 } 1216 if ( '1' == stick_below || 'on' == stick_below || 'disabled' == stick_below ) { 1217 bodyClass += " ast-below-sticky-header-active"; 1218 } 1219 $('body').removeClass(bodyClass); 1220 }); 1221 1222 switch ( site_layout ) { 1223 case 'ast-box-layout': 1224 layout_width = parseInt( site_layout_box_width ); 1225 break; 1226 } 1227 1228 jQuery( document ).on('ready astLayoutWidthChanged', function( e ) { 1229 1230 if( 'astLayoutWidthChanged' === e.type ) { 1231 1232 // return if sticky not enabled. 1233 if (!(parseInt( stick_main ) || parseInt( stick_below ) || parseInt( stick_above ))) { 1234 return; 1235 } 1236 1237 // Unwrapping sticky to reapply again. 1238 jQuery('div.ast-stick-primary-below-wrapper').children().unwrap(); 1239 jQuery('div[data-stick-support="on"]').children().unwrap(); 1240 1241 } 1242 1243 1244 1245 if ( '1' == sticky_hide_on_scroll ) { 1246 if ( '1' == main_shrink ) { 1247 jQuery( '#ast-fixed-header' ).addClass( 'ast-sticky-shrunk' ).stop(); 1248 } 1249 1250 if( !( '1' == stick_above || 'on' == stick_above || 'disabled' == stick_above ) ) { 1251 jQuery( '#ast-fixed-header .ast-above-header' ).hide(); 1252 } 1253 if( !( '1' == stick_main || 'on' == stick_main || 'disabled' == stick_main ) ) { 1254 jQuery( '#ast-fixed-header .main-header-bar' ).hide(); 1255 } 1256 if( !( '1' == stick_below || 'on' == stick_below || 'disabled' == stick_below ) ) { 1257 jQuery( '#ast-fixed-header .ast-below-header' ).hide(); 1258 } 1259 1260 jQuery( '#ast-fixed-header' ).astExtSticky({ 1261 //dependent: ['#masthead .ast-above-header'], 1262 max_width: layout_width, 1263 site_layout: site_layout, 1264 sticky_on_device: sticky_header_on_devices, 1265 header_style: 'slide', 1266 hide_on_scroll: sticky_hide_on_scroll, 1267 }); 1268 }else{ 1269 if ('none' == sticky_header_style) { 1270 1271 if (header_builder_active) { 1272 var headers = 'both' === sticky_header_on_devices ? ['desktop', 'mobile'] : [sticky_header_on_devices]; 1273
1274 headers.forEach(function (header) { 1275 1276 /** 1277 * Stick Above Header 1278 */ 1279 if ('1' == stick_above || 'on' == stick_above || 'disabled' == stick_above) { 1280 jQuery('#masthead #ast-' + header + '-header .ast-above-header').astExtSticky({ 1281 max_width: layout_width, 1282 site_layout: site_layout, 1283 sticky_on_device: sticky_header_on_devices, 1284 header_style: sticky_header_style, 1285 hide_on_scroll: sticky_hide_on_scroll, 1286 }); 1287 } 1288 // Add wrapper class to primary header & below header if stick primary header , stick below header and shrink primary header is enabled. 1289 // stick wrapper class of primary header and below header 1290 if (('1' == stick_main || 'on' == stick_main || 'disabled' == stick_main) && 1291 ('1' == stick_below || 'on' == stick_below || 'disabled' == stick_below) 1292 ) { 1293 1294 var selector = jQuery('#masthead #ast-' + header + '-header .main-header-bar-wrap').length ? 1295 jQuery('#masthead #ast-' + header + '-header .main-header-bar-wrap') : 1296 jQuery('#masthead #ast-' + header + '-header .ast-below-header-wrap'); 1297 1298 selector.wrap('<div class="ast-stick-primary-below-wrapper"></div>') 1299 jQuery('#masthead #ast-' + header + '-header .ast-below-header-wrap').prependTo('#masthead #ast-' + header + '-header .ast-stick-primary-below-wrapper'); 1300 jQuery('#masthead #ast-' + header + '-header .main-header-bar-wrap').prependTo('#masthead #ast-' + header + '-header .ast-stick-primary-below-wrapper'); 1301 1302 jQuery('#masthead #ast-' + header + '-header .ast-stick-primary-below-wrapper').astExtSticky({ 1303 dependent: ['#masthead #ast-' + header + '-header .ast-above-header'], 1304 max_width: layout_width, 1305 site_layout: site_layout, 1306 shrink: shrink_options, 1307 sticky_on_device: sticky_header_on_devices, 1308 header_style: sticky_header_style, 1309 hide_on_scroll: sticky_hide_on_scroll, 1310 }); 1311 1312 } else { 1313 1314 /** 1315 * Stick Main Header 1316 */ 1317 if ('1' == stick_main || 'on' == stick_main || 'disabled' == stick_main) { 1318 1319 // If shrink is enabled 1320 // then add shrink top and bottom paddings. 1321 var shrink_options = ''; 1322 if (main_shrink) { 1323 shrink_options = { 1324 padding_top: '', 1325 padding_bottom: '', 1326 } 1327 } 1328 1329 jQuery('#masthead #ast-' + header + '-header .main-header-bar').astExtSticky({ 1330 dependent: ['#masthead #ast-' + header + '-header .ast-above-header'], 1331 max_width: layout_width, 1332 site_layout: site_layout, 1333 shrink: shrink_options, 1334 sticky_on_device: sticky_header_on_devices, 1335 header_style: sticky_header_style, 1336 hide_on_scroll: sticky_hide_on_scroll, 1337 }); 1338 1339 jQuery('#masthead #ast-' + header + '-header .ast-custom-header').astExtSticky({ 1340 max_width: layout_width, 1341 site_layout: site_layout, 1342 shrink: shrink_options, 1343 sticky_on_device: sticky_header_on_devices, 1344 header_style: sticky_header_style, 1345 hide_on_scroll: sticky_hide_on_scroll, 1346 }); 1347 } 1348 1349 /** 1350 * Stick Below Header 1351 */ 1352 if (('1' == stick_below || 'on' == stick_below || 'disabled' == stick_below)) { 1353 jQuery('#masthead #ast-' + header + '-header .ast-below-header').astExtSticky({ 1354 dependent: ['#masthead #ast-' + header + '-header .main-header-bar', '#masthead #ast-' + header + '-header .ast-above-header'], 1355 max_width: layout_width, 1356 site_layout: site_layout, 1357 sticky_on_device: sticky_header_on_devices, 1358 header_style: sticky_header_style, 1359 hide_on_scroll: sticky_hide_on_scroll, 1360 }); 1361 1362 } 1363 } 1364 1365 }); 1366 1367 } else { 1368 1369 /** 1370 * Stick Above Header 1371 */ 1372 if ('1' == stick_above || 'on' == stick_above || 'disabled' == stick_above) { 1373 jQuery('#masthead .ast-above-header').astExtSticky({ 1374 max_width: layout_width, 1375 site_layout: site_layout, 1376 sticky_on_device: sticky_header_on_devices, 1377 header_style: sticky_header_style, 1378 hide_on_scroll: sticky_hide_on_scroll, 1379 }); 1380 } 1381 // Add wrapper class to primary header & below header if stick primary header , stick below header and shrink primary header is enabled. 1382 // stick wrapper class of primary header and below header 1383 if (('1' == stick_main || 'on' == stick_main || 'disabled' == stick_main) && 1384 ('1' == stick_below || 'on' == stick_below || 'disabled' == stick_below) 1385 ) { 1386 1387 jQuery('#masthead .main-header-bar-wrap').wrap('<div class="ast-stick-primary-below-wrapper"></div>') 1388 jQuery('#masthead .ast-below-header-wrap').prependTo('.ast-stick-primary-below-wrapper'); 1389 jQuery('#masthead .main-header-bar-wrap').prependTo('.ast-stick-primary-below-wrapper'); 1390 1391 jQuery('#masthead .ast-stick-primary-below-wrapper').astExtSticky({ 1392 dependent: ['#masthead .ast-above-header'], 1393 max_width: layout_width, 1394 site_layout: site_layout, 1395 shrink: shrink_options, 1396 sticky_on_device: sticky_header_on_devices, 1397 header_style: sticky_header_style, 1398 hide_on_scroll: sticky_hide_on_scroll, 1399 }); 1400 1401 } else { 1402 1403 /** 1404 * Stick Main Header 1405 */ 1406 if ('1' == stick_main || 'on' == stick_main || 'disabled' == stick_main) { 1407 1408 // If shrink is enabled 1409 // then add shrink top and bottom paddings. 1410 var shrink_options = ''; 1411 if (main_shrink) { 1412 shrink_options = { 1413 padding_top: '', 1414 padding_bottom: '', 1415 } 1416 } 1417 1418 jQuery('#masthead .main-header-bar').astExtSticky({ 1419 dependent: ['#masthead .ast-above-header'], 1420 max_width: layout_width, 1421 site_layout: site_layout, 1422 shrink: shrink_options, 1423 sticky_on_device: sticky_header_on_devices, 1424 header_style: sticky_header_style, 1425 hide_on_scroll: sticky_hide_on_scroll, 1426 }); 1427 1428 jQuery('#masthead .ast-custom-header').astExtSticky({ 1429 max_width: layout_width, 1430 site_layout: site_layout, 1431 shrink: shrink_options, 1432 sticky_on_device: sticky_header_on_devices, 1433 header_style: sticky_header_style, 1434 hide_on_scroll: sticky_hide_on_scroll, 1435 }); 1436 } 1437 1438 /** 1439 * Stick Below Header 1440 */ 1441 if (('1' == stick_below || 'on' == stick_below || 'disabled' == stick_below)) { 1442 jQuery('#masthead .ast-below-header').astExtSticky({ 1443 dependent: ['#masthead .main-header-bar', '#masthead .ast-above-header'], 1444 max_width: layout_width, 1445 site_layout: site_layout, 1446 sticky_on_device: sticky_header_on_devices, 1447 header_style: sticky_header_style, 1448 hide_on_scroll: sticky_hide_on_scroll, 1449 }); 1450 1451 } 1452 } 1453 1454 } 1455 1456 } 1457 else{ 1458 1459 jQuery( '#ast-fixed-header' ).addClass( 'ast-sticky-shrunk' ).stop(); 1460 1461 if( !( '1' == stick_above || 'on' == stick_above || 'disabled' == stick_above ) ) { 1462 jQuery( '#ast-fixed-header .ast-above-header' ).hide(); 1463 } 1464 if( !( '1' == stick_main || 'on' == stick_main || 'disabled' == stick_main ) ) { 1465 jQuery( '#ast-fixed-header .main-header-bar' ).hide(); 1466 } 1467 if( !( '1' == stick_below || 'on' == stick_below || 'disabled' == stick_below) ) { 1468 jQuery( '#ast-fixed-header .ast-below-header' ).hide(); 1469 } 1470 /** 1471 * Stick Main Header 1472 */ 1473 if ( '1' == stick_above || 'on' == stick_above || 'disabled' == stick_above 1474 || '1' == stick_main || 'on' == stick_main || 'disabled' == stick_main 1475 || '1' == stick_below || 'on' == stick_below || 'disabled' == stick_below 1476 ) { 1477 1478 // If shrink is enabled 1479 // then add shrink top and bottom paddings. 1480 var shrink_options = ''; 1481 if( main_shrink ) { 1482 shrink_options = { 1483 padding_top: '', 1484 padding_bottom: '', 1485 } 1486 } 1487 1488 jQuery( '#ast-fixed-header' ).astExtSticky({ 1489 //dependent: ['#masthead .ast-above-header'], 1490 max_width: layout_width, 1491 site_layout: site_layout, 1492 shrink: shrink_options, 1493 sticky_on_device: sticky_header_on_devices, 1494 header_style: sticky_header_style, 1495 hide_on_scroll: sticky_hide_on_scroll, 1496 }); 1497 } 1498 } 1499 } 1500 1501 // If Sticky Header for both mobile , desktops. 1502 if ( 'mobile' == sticky_header_on_devices || 'both' == sticky_header_on_devices ) { 1503 // Normal Header Mobile Menu Toggled 1504 jQuery( '#masthead .main-header-menu-toggle' ).click(function(event) { 1505 1506 /* If menu navigation is opened and has sticky active */ 1507 if( jQuery( '#masthead .main-header-menu-toggle' ).hasClass( 'toggled' ) ){ 1508 // Add body class to update the stick_upto_scroll. 1509 $body.addClass('ast-sticky-toggled-off'); 1510 1511 if ( 1512 'none' == defaults['header_style'] && 1513 ( jQuery( '#masthead .main-header-bar' ).hasClass('ast-sticky-active') || 1514 jQuery( '#masthead .ast-stick-primary-below-wrapper' ).hasClass('ast-sticky-active') ) 1515 ){ 1516 1517 // Only If none style is selected 1518 var windowHeight = jQuery( window ).height(), 1519 headerSectionHeight = 0; 1520 1521 if ( jQuery( '#masthead .ast-above-header' ) && jQuery( '#masthead .ast-above-header' ).length ) { 1522 headerSectionHeight = jQuery( '#masthead .ast-above-header' ).height(); 1523 } 1524 1525 // overflow hide for html. 1526 if ( '1' == sticky_hide_on_scroll ) { 1527 jQuery( 'html' ).css({ 1528 'overflow' : 'hidden', 1529 }); 1530 } 1531 // add min height to wrapper class of primary header and below header 1532 if ( '1' == main_shrink && 1533 ( '1' == stick_main || 'on' == stick_main || 'disabled' == stick_main ) && 1534 ( '1' == stick_below || 'on' == stick_below || 'disabled' == stick_below ) 1535 ) { 1536 jQuery( '#masthead .ast-stick-primary-below-wrapper' ).css({ 1537 'max-height' : ( windowHeight - headerSectionHeight ) +'px', 1538 'overflow-y' : 'auto', 1539 }); 1540 } else { 1541 // ass max height to sticky header. 1542 jQuery( '#masthead .main-header-bar.ast-sticky-active' ).css({ 1543 'max-height' : ( windowHeight - headerSectionHeight ) +'px', 1544 'overflow-y' : 'auto', 1545 }); 1546 } 1547 } 1548 } 1549 else{ 1550 $body.addClass('ast-sticky-toggled-off'); 1551 jQuery( 'html' ).css({ 1552 'overflow' : '', 1553 }); 1554 if ( '1' == main_shrink && 1555 ( '1' == stick_main || 'on' == stick_main || 'disabled' == stick_main ) && 1556 ( '1' == stick_below || 'on' == stick_below || 'disabled' == stick_below ) 1557 ) { 1558 jQuery( '#masthead .ast-stick-primary-below-wrapper' ).css({ 1559 'max-height' : '', 1560 'overflow-y' : '', 1561 }); 1562 } else { 1563 // ass max height to sticky header. 1564 jQuery( '#masthead .main-header-bar.ast-sticky-active' ).css({ 1565 'max-height' : '', 1566 'overflow-y' : '', 1567 }); 1568 } 1569 } 1570 }); 1571 // Fixed Header Mobile Menu Toggled 1572 jQuery( '#ast-fixed-header .main-header-menu-toggle' ).click(function(event) { 1573 /* If menu navigation is opened and has sticky active */ 1574 1575 if( jQuery( '#ast-fixed-header .main-header-menu-toggle' ).hasClass( 'toggled' ) ){ 1576 1577 var windowHeight = jQuery( window ).height(); 1578 1579 // overflow hide for html. 1580 if ( '1' == sticky_hide_on_scroll ) { 1581 jQuery( 'html' ).css({ 1582 'overflow' : 'auto', 1583 }); 1584 } 1585 // ass max height to sticky header. 1586 jQuery( '#ast-fixed-header' ).css({ 1587 'max-height' : ( windowHeight ) +'px', 1588 'overflow-y' : 'auto', 1589 }); 1590 } 1591 // remove css if menu toggle is closed. 1592 else{ 1593 jQuery( 'html' ).css({ 1594 'overflow' : '', 1595 }); 1596 jQuery( '#ast-fixed-header' ).css({ 1597 'max-height' : '', 1598 'overflow-y' : '', 1599 }); 1600 } 1601 }); 1602 } 1603 1604 }); 1605 } 1606 1607 1608}(jQuery, window)); 1609document.addEventListener("DOMContentLoaded", display_mega_menu_on_load); 1610document.addEventListener( 1611 "astPartialContentRendered", 1612 display_mega_menu_on_load 1613); 1614 1615/** 1616 * Remove "hidden" class after the page is fully loaded to fix the visibility issue of MegaMenu width. 1617 */ 1618function display_mega_menu_on_load() { 1619 // For Content width. 1620 var menu_content = document.querySelectorAll(".content-width-mega"); 1621 if (menu_content.length > 0) { 1622 for (var i = 0; i < menu_content.length; i++) { 1623 menu_content[i].addEventListener("mouseenter", function (event) { 1624 var mega_menu_container = event.target.querySelector( 1625 ".astra-mega-menu-width-content" 1626 ); 1627 if (null !== mega_menu_container) { 1628 mega_menu_container.classList.remove("ast-hidden"); 1629 } 1630 }); 1631 } 1632 } 1633 1634 // For Menu Container width. 1635 var menu_container = document.querySelectorAll(".menu-container-width-mega"); 1636 if (menu_container.length > 0) { 1637 for (var i = 0; i < menu_container.length; i++) { 1638 menu_container[i].addEventListener("mouseenter", function (event) { 1639 var mega_menu_container = event.target.querySelector( 1640 ".astra-mega-menu-width-menu-container" 1641 ); 1642 if (null !== mega_menu_container) { 1643 mega_menu_container.classList.remove("ast-hidden"); 1644 } 1645 }); 1646 } 1647 } 1648 1649 // For Full width. 1650 var menu_full_width = document.querySelectorAll(".full-width-mega"); 1651 if (menu_full_width.length > 0) { 1652 for (var i = 0; i < menu_full_width.length; i++) { 1653 menu_full_width[i].addEventListener("mouseenter", function (event) { 1654 var mega_menu_container = event.target.querySelector( 1655 ".astra-full-megamenu-wrapper" 1656 ); 1657 var mega_menu_submenu = event.target.querySelector( 1658 ".astra-mega-menu-width-full" 1659 ); 1660 if (null !== mega_menu_container) { 1661 mega_menu_container.classList.remove("ast-hidden"); 1662 } 1663 if (null !== mega_menu_submenu) { 1664 mega_menu_submenu.classList.remove("ast-hidden"); 1665 } 1666 }); 1667 } 1668 } 1669 1670 // For Full width Stretched. 1671 var menu_full_width_stretched = document.querySelectorAll( 1672 ".full-stretched-width-mega" 1673 ); 1674 if (menu_full_width_stretched.length > 0) { 1675 for (var i = 0; i < menu_full_width_stretched.length; i++) { 1676 menu_full_width_stretched[i].addEventListener( 1677 "mouseenter", 1678 function (event) { 1679 var mega_menu_container = event.target.querySelector( 1680 ".astra-full-megamenu-wrapper" 1681 ); 1682 var mega_menu_submenu = event.target.querySelector( 1683 ".astra-mega-menu-width-full-stretched" 1684 ); 1685 if (null !== mega_menu_container) { 1686 mega_menu_container.classList.remove("ast-hidden"); 1687 } 1688 if (null !== mega_menu_submenu) { 1689 mega_menu_submenu.classList.remove("ast-hidden"); 1690 } 1691 } 1692 ); 1693 } 1694 } 1695 1696 // For Custom Width MegaMenu. 1697 var customWidthStretched = document.querySelectorAll(".custom-width-mega"); 1698 if (customWidthStretched.length > 0) { 1699 for (var i = 0; i < customWidthStretched.length; i++) { 1700 customWidthStretched[i].addEventListener("mouseenter", function (event) { 1701 var megaMenuSubmenu = event.target.querySelector( 1702 ".astra-mega-menu-width-custom" 1703 ); 1704 if (null !== megaMenuSubmenu) { 1705 megaMenuSubmenu.classList.remove("ast-hidden"); 1706 } 1707 }); 1708 } 1709 } 1710} 1711 1712var items = document.getElementsByClassName("astra-megamenu-li"); 1713 1714function apply_megamenu_width_styles() {
1715 [].slice.call(items).forEach(container => { 1716 jQuery(container).hover(function () { 1717 var ast_container = jQuery(container).parents(".ast-container"), 1718 $main_container = ast_container.children(), 1719 $full_width_main_container = ast_container.parent(), 1720 $this = jQuery(this); 1721 1722 // Full width mega menu 1723 if ( 1724 $this.hasClass("full-width-mega") || 1725 $this.hasClass("full-stretched-width-mega") 1726 ) { 1727 $main_container = jQuery($main_container).closest(".ast-container"); 1728 } 1729 1730 if ( 1731 parseInt(window.innerWidth) > parseInt(astra.break_point) && 1732 "ast-hf-mobile-menu" !== $this.parent().attr("id") && 1733 "ast-desktop-toggle-menu" !== $this.parent().attr("id") 1734 ) { 1735 var $menuWidth = $main_container.width(), 1736 $menuPosition = $main_container.offset(), 1737 $menuItemPosition = $this.offset(), 1738 positionLeft = 1739 $menuItemPosition.left - 1740 ($menuPosition.left + 1741 parseFloat($main_container.css("paddingLeft"))), 1742 positionRight = $menuWidth - ($menuItemPosition.left + $menuPosition.left) + 130; 1743 1744 var $fullMenuWidth = $full_width_main_container.width(), 1745 $fullMenuPosition = $full_width_main_container.offset(), 1746 fullPositionLeft = 1747 $menuItemPosition.left - 1748 ($fullMenuPosition.left + 1749 parseFloat($full_width_main_container.css("paddingLeft"))); 1750 1751 if ($this.hasClass("custom-width-mega")) { 1752 var customMegaMenuWidth = 1753 window 1754 .getComputedStyle( 1755 $this.find(".astra-mega-menu-width-custom")[0], 1756 "::before" 1757 ) 1758 .getPropertyValue("content") || 1200; 1759 1760 customMegaMenuWidth = customMegaMenuWidth.replace(/[^0-9]/g, ""); 1761 customMegaMenuWidth = parseInt(customMegaMenuWidth); 1762 1763 if (customMegaMenuWidth <= $menuWidth) { 1764 var extra_width = parseInt($menuWidth - customMegaMenuWidth), 1765 customWithPositionLeft = parseInt(positionLeft - extra_width), 1766 customWithPositionRight = 1767 $menuPosition.left - customWithPositionLeft; 1768 } else { 1769 var extra_width = parseInt(customMegaMenuWidth - $menuWidth), 1770 customWithPositionLeft = parseInt(positionLeft + extra_width), 1771 customWithPositionRight = 1772 $menuPosition.left + customWithPositionLeft; 1773 } 1774 } 1775 1776 if ($this.hasClass("menu-container-width-mega")) { 1777 var menu_width_container = 1778 jQuery(container).parents(".main-navigation"); 1779 1780 if ($full_width_main_container.hasClass("ast-above-header")) { 1781 menu_width_container = jQuery(".ast-above-header-navigation"); 1782 } else if ($full_width_main_container.hasClass("ast-below-header")) { 1783 menu_width_container = jQuery(".ast-below-header-actual-nav"); 1784 } 1785 1786 if (menu_width_container.length) { 1787 $target_container = menu_width_container; 1788 } else { 1789 $target_container = $this.parent("ul"); 1790 } 1791 1792 $menuWidth = $target_container.width() + "px"; 1793 var $offset_right = 1794 jQuery(window).width() - 1795 ($target_container.offset().left + $target_container.outerWidth()); 1796 var $current_offset = $this.offset(); 1797 var $width = 1798 jQuery(window).width() - $offset_right - $current_offset.left, 1799 positionLeft = parseInt($target_container.width() - $width), 1800 positionRight = 1801 parseInt($menuWidth) - 1802 $this.outerWidth() - 1803 parseInt($target_container.width() - $width); 1804 } 1805 if ($this.hasClass("full-width-mega")) { 1806 $this 1807 .find(".astra-full-megamenu-wrapper") 1808 .css({ 1809 left: "-" + fullPositionLeft + "px", 1810 width: $fullMenuWidth, 1811 }); 1812 $this.find(".astra-megamenu").css({ width: $menuWidth }); 1813 } else if ($this.hasClass("full-stretched-width-mega")) { 1814 $this 1815 .find(".astra-full-megamenu-wrapper") 1816 .css({ 1817 left: "-" + fullPositionLeft + "px", 1818 width: $fullMenuWidth, 1819 }); 1820 } else if ($this.hasClass("custom-width-mega")) { 1821 if (astra.isRtl) { 1822 $this 1823 .find(".astra-mega-menu-width-custom") 1824 .css({ 1825 // right: "-" + customWithPositionRight + "px", 1826 width: customMegaMenuWidth + "px", 1827 }); 1828 } else { 1829 $this 1830 .find(".astra-mega-menu-width-custom") 1831 .css({ 1832 left: "-" + customWithPositionLeft + "px", 1833 width: customMegaMenuWidth + "px", 1834 }); 1835 } 1836 } 1837 else { 1838 if (astra.isRtl) { 1839 $this 1840 .find(".astra-megamenu") 1841 .css({ right: "-" + positionRight + "px", width: $menuWidth }); 1842 } else { 1843 $this 1844 .find(".astra-megamenu") 1845 .css({ left: "-" + positionLeft + "px", width: $menuWidth }); 1846 } 1847 } 1848 } else { 1849 if (astra.isRtl) { 1850 $this 1851 .find(".astra-megamenu") 1852 .css({ right: "", width: "", "background-image": "" }); 1853 $this 1854 .find(".astra-full-megamenu-wrapper") 1855 .css({ right: "", width: "", "background-image": "" }); 1856 } else { 1857 $this 1858 .find(".astra-megamenu") 1859 .css({ left: "", width: "", "background-image": "" }); 1860 $this 1861 .find(".astra-full-megamenu-wrapper") 1862 .css({ left: "", width: "", "background-image": "" }); 1863 } 1864 } 1865 }); 1866
1867 jQuery(container).mouseenter(function () { 1868 document.dispatchEvent( 1869 new CustomEvent("astra_mega_menu_on_hover", { detail: {} }) 1870 ); 1871 }); 1872 }); 1873} 1874 1875apply_megamenu_width_styles(); 1876 1877document.addEventListener("astMenuHoverStyleChanged", function () { 1878 apply_megamenu_width_styles(); 1879}); 1880 1881// Achieve accessibility for megamenus using focusin on <a>. 1882[].slice.call(items).forEach(function (container) { 1883 var ast_container = jQuery(container).parents(".ast-container"), 1884 $main_container = ast_container.children(), 1885 $full_width_main_container = ast_container.parent(), 1886 $this = jQuery(container); 1887 1888 // Full width mega menu 1889 if ( 1890 $this.hasClass("full-width-mega") || 1891 $this.hasClass("full-stretched-width-mega") 1892 ) { 1893 $main_container = jQuery($main_container).closest(".ast-container"); 1894 $this.find(".astra-full-megamenu-wrapper").removeClass("ast-hidden"); 1895 } 1896 1897 $this.find(".menu-link").focusin(function (e) { 1898 if (!astra.is_header_footer_builder_active) { 1899 $this.find(".sub-menu").addClass("astra-megamenu-focus"); 1900 $this 1901 .find(".astra-full-megamenu-wrapper") 1902 .addClass("astra-megamenu-wrapper-focus"); 1903 } 1904 1905 $this.find(".sub-menu").removeClass("ast-hidden"); 1906 if (
1907 parseInt(jQuery(window).width()) > parseInt(astra.break_point) && 1908 "ast-hf-mobile-menu" !== $this.parent().attr("id") && 1909 "ast-desktop-toggle-menu" !== $this.parent().attr("id") 1910 ) { 1911 var $menuWidth = $main_container.width(), 1912 $menuPosition = $main_container.offset(), 1913 $menuItemPosition = $this.offset(), 1914 positionLeft = 1915 $menuItemPosition.left - 1916 ($menuPosition.left + parseFloat($main_container.css("paddingLeft"))), 1917 positionRight = $menuItemPosition.left + $menuPosition.left; 1918 1919 var $fullMenuWidth = $full_width_main_container.width(), 1920 $fullMenuPosition = $full_width_main_container.offset(), 1921 fullPositionLeft = 1922 $menuItemPosition.left - 1923 ($fullMenuPosition.left + 1924 parseFloat($full_width_main_container.css("paddingLeft"))); 1925 1926 if ($this.hasClass("custom-width-mega")) { 1927 var customMegaMenuWidth = 1928 window 1929 .getComputedStyle( 1930 $this.find(".astra-mega-menu-width-custom")[0], 1931 "::before" 1932 ) 1933 .getPropertyValue("content") || 1200; 1934 1935 customMegaMenuWidth = customMegaMenuWidth.replace(/[^0-9]/g, ""); 1936 customMegaMenuWidth = parseInt(customMegaMenuWidth); 1937 1938 if (customMegaMenuWidth <= $menuWidth) { 1939 var extra_width = parseInt($menuWidth - customMegaMenuWidth), 1940 customWithPositionLeft = parseInt(positionLeft - extra_width), 1941 customWithPositionRight = 1942 $menuPosition.left - customWithPositionLeft; 1943 } else { 1944 var extra_width = parseInt(customMegaMenuWidth - $menuWidth), 1945 customWithPositionLeft = parseInt(positionLeft + extra_width), 1946 customWithPositionRight = 1947 $menuPosition.left + customWithPositionLeft; 1948 } 1949 } 1950 1951 if ($this.hasClass("menu-container-width-mega")) { 1952 var menu_width_container = 1953 jQuery(container).parents(".main-navigation"); 1954 1955 if ($full_width_main_container.hasClass("ast-above-header")) { 1956 menu_width_container = jQuery(".ast-above-header-navigation"); 1957 } else if ($full_width_main_container.hasClass("ast-below-header")) { 1958 menu_width_container = jQuery(".ast-below-header-actual-nav"); 1959 } 1960 1961 if (menu_width_container.length) { 1962 $target_container = menu_width_container; 1963 } else { 1964 $target_container = $this.parent("ul"); 1965 } 1966 1967 $menuWidth = $target_container.width() + "px"; 1968 var $offset_right = 1969 jQuery(window).width() - 1970 ($target_container.offset().left + $target_container.outerWidth()); 1971 var $current_offset = $this.offset(); 1972 var $width = 1973 jQuery(window).width() - $offset_right - $current_offset.left, 1974 positionLeft = parseInt($target_container.width() - $width), 1975 positionRight = 1976 parseInt($menuWidth) - 1977 $this.outerWidth() - 1978 parseInt($target_container.width() - $width); 1979 } 1980 if ($this.hasClass("full-width-mega")) { 1981 $this 1982 .find(".astra-full-megamenu-wrapper") 1983 .css({ left: "-" + fullPositionLeft + "px", width: $fullMenuWidth }); 1984 $this.find(".astra-megamenu").css({ width: $menuWidth }); 1985 } else if ($this.hasClass("full-stretched-width-mega")) { 1986 $this 1987 .find(".astra-full-megamenu-wrapper") 1988 .css({ left: "-" + fullPositionLeft + "px", width: $fullMenuWidth }); 1989 } else if ($this.hasClass("custom-width-mega")) { 1990 if (astra.isRtl) { 1991 $this 1992 .find(".astra-mega-menu-width-custom") 1993 .css({ 1994 right: "-" + customWithPositionRight + "px", 1995 width: customMegaMenuWidth + "px", 1996 }); 1997 } else { 1998 $this 1999 .find(".astra-mega-menu-width-custom") 2000 .css({ 2001 left: "-" + customWithPositionLeft + "px", 2002 width: customMegaMenuWidth + "px", 2003 }); 2004 } 2005 } else { 2006 if (astra.isRtl) { 2007 $this 2008 .find(".astra-megamenu") 2009 .css({ right: "-" + positionRight + "px", width: $menuWidth }); 2010 } else { 2011 $this 2012 .find(".astra-megamenu") 2013 .css({ left: "-" + positionLeft + "px", width: $menuWidth }); 2014 } 2015 } 2016 } else { 2017 if (astra.isRtl) { 2018 $this 2019 .find(".astra-megamenu") 2020 .css({ right: "", width: "", "background-image": "" }); 2021 $this 2022 .find(".astra-full-megamenu-wrapper") 2023 .css({ right: "", width: "", "background-image": "" }); 2024 } else { 2025 $this 2026 .find(".astra-megamenu") 2027 .css({ left: "", width: "", "background-image": "" }); 2028 $this 2029 .find(".astra-full-megamenu-wrapper") 2030 .css({ left: "", width: "", "background-image": "" }); 2031 } 2032 } 2033 }); 2034 2035 if (!astra.is_header_footer_builder_active) { 2036 $this.find(".menu-link").keydown(function (e) { 2037 if (e.which == 9 && e.shiftKey) { 2038 $this.find(".sub-menu").removeClass("astra-megamenu-focus"); 2039 $this 2040 .find(".astra-full-megamenu-wrapper") 2041 .removeClass("astra-megamenu-wrapper-focus"); 2042 } 2043 }); 2044 2045 jQuery(container) 2046 .find(".sub-menu .menu-item") 2047 .last() 2048 .focusout(function () { 2049 $this.find(".sub-menu").removeClass("astra-megamenu-focus"); 2050 $this 2051 .find(".astra-full-megamenu-wrapper") 2052 .removeClass("astra-megamenu-wrapper-focus"); 2053 }); 2054 2055 jQuery(window).click(function () { 2056 $this.find(".sub-menu").removeClass("astra-megamenu-focus"); 2057 $this 2058 .find(".astra-full-megamenu-wrapper") 2059 .removeClass("astra-megamenu-wrapper-focus"); 2060 }); 2061 } 2062 2063 $this.click(function (event) { 2064 if (!jQuery(event.target).hasClass("menu-item")) { 2065 return; 2066 } 2067 // event.stopPropagation(); 2068 event.stopImmediatePropagation(); 2069 }); 2070}); 2071/** 2072 * Advanced Search Styling 2073 * 2074 * @package Astra Addon 2075 * @since 1.4.8 2076 */ 2077 2078( function() { 2079 2080 function body_iphone_classes() { 2081 var iphone = ( navigator.userAgent.match(/iPhone/i) == 'iPhone' ) ? 'iphone' : ''; 2082 var ipod = ( navigator.userAgent.match(/iPod/i) == 'iPod' ) ? 'ipod' : ''; 2083 2084 document.body.className += ' ' + iphone; 2085 document.body.className += ' ' + ipod; 2086 } 2087 body_iphone_classes(); 2088 2089 function remove_style_class( style ) { 2090 var allClasses = document.body.className; 2091 allClasses = allClasses.replace( style, '' ); 2092 document.body.className = allClasses; 2093 } 2094 2095 function add_style_class( style ) { 2096 document.body.className += ' ' + style; 2097 } 2098 2099 // Helper Function. 2100 function fade_in( element ) { 2101 2102 element.style.display = 'block'; 2103 setTimeout(function() { 2104 element.style.opacity = 1; 2105 }, 1); 2106 } 2107 2108 function fade_out( element ) { 2109 2110 element.style.opacity = ''; 2111 setTimeout(function() { 2112 element.style.display = ''; 2113 }, 200); 2114 } 2115 2116 function header_cover_form_height( current_header_cover_form ) { 2117 2118 // Primary header cover search. 2119 if ( document.body.classList.contains('ast-header-break-point') ) { 2120 2121 var site_navigation = document.querySelector( '.main-navigation' ); 2122 var main_header_bar = document.querySelector( '.main-header-bar' ); 2123 2124 if( null !== main_header_bar && null !== site_navigation ) { 2125 2126 var site_navigation_outer_height = site_navigation.offsetHeight; 2127 var main_header_outer_height = main_header_bar.offsetHeight; 2128 2129 // Have a navigation outer height. 2130 // And primary header NOT have the `No Toggle` style. 2131 if( site_navigation_outer_height && ( ! document.body.classList.contains('ast-no-toggle-menu-enable') ) ) { 2132 var search_height = parseFloat(site_navigation_outer_height) - parseFloat(main_header_outer_height); 2133 } else { 2134 var search_height = parseFloat(main_header_outer_height); 2135 } 2136 current_header_cover_form.style.maxHeight = Math.abs( search_height ) + "px"; 2137 } 2138 } 2139 } 2140 2141 function header_builder_cover_form_height( current_header_cover_form ) { 2142 2143 // Primary header cover search. 2144 if ( document.body.classList.contains('ast-header-break-point') ) { 2145 2146 var site_navigation = document.querySelector( '.main-navigation' ); 2147 var main_header_bar = document.querySelector( '.main-header-bar' ); 2148 var mobile_header_bar = document.querySelector( '.ast-mobile-header-wrap' ); 2149 2150 if( null !== main_header_bar && null !== site_navigation ) { 2151 2152 var site_navigation_outer_height = site_navigation.offsetHeight; 2153 var main_header_outer_height = main_header_bar.offsetHeight; 2154 var mobile_header_outer_height = mobile_header_bar.offsetHeight; 2155 2156 // Have a navigation outer height. 2157 // And primary header NOT have the `No Toggle` style. 2158 if( site_navigation_outer_height && ( ! document.body.classList.contains('ast-no-toggle-menu-enable') ) ) { 2159 var search_height = parseFloat(site_navigation_outer_height) - parseFloat(main_header_outer_height); 2160 } else { 2161 var search_height = parseFloat(main_header_outer_height); 2162 } 2163 if ( current_header_cover_form.parentNode.classList.contains( 'ast-mobile-header-wrap' ) ) { 2164 var search_height = parseFloat(mobile_header_outer_height); 2165 } 2166 2167 current_header_cover_form.style.maxHeight = Math.abs( search_height ) + "px"; 2168 } 2169 } 2170 } 2171 2172 var searchIcons = document.querySelectorAll( 'a.astra-search-icon:not(.slide-search)' ); 2173 2174 for ( var i = 0; searchIcons.length > i; i++ ) { 2175 2176 searchIcons[i].onclick = function ( evt ) { 2177 2178 evt.preventDefault(); 2179 2180 if ( ! evt ) { 2181 evt = window.event; 2182 } 2183 2184 if ( this.classList.contains( 'header-cover' ) ) { 2185 var header_cover = document.querySelectorAll( '.ast-search-box.header-cover' ), 2186 header_builder_active = astraAddon.is_header_builder_active || false; 2187 2188 for (var j = 0; j < header_cover.length; j++) { 2189 2190 var header_cover_icon = header_cover[j].parentNode.querySelectorAll( 'a.astra-search-icon' ); 2191 2192 for (var k = 0; k < header_cover_icon.length; k++) { 2193 if ( header_cover_icon[k] == this ) { 2194 fade_in( header_cover[j] ); 2195 header_cover[j].querySelector( 'input.search-field' ).focus(); 2196 2197 // Set header cover form height. 2198 if ( header_builder_active ) { 2199 header_builder_cover_form_height( header_cover[j] ); 2200 } else { 2201 header_cover_form_height( header_cover[j] ); 2202 } 2203 } 2204 }; 2205 }; 2206 2207 } else if ( this.classList.contains( 'full-screen' ) ) { 2208 2209 var fullScreen = document.getElementById( 'ast-seach-full-screen-form' ); 2210 if ( fullScreen.classList.contains( 'full-screen' ) ) { 2211 fade_in( fullScreen ); 2212 add_style_class( 'full-screen' ); 2213 fullScreen.querySelector( 'input.search-field' ).focus(); 2214 } 2215 } 2216 }; 2217 }; 2218 2219 /* Search Header Cover & Full Screen Close */ 2220 var closes = document.querySelectorAll( '.ast-search-box .close' ); 2221 for (var i = 0, len = closes.length; i < len; ++i) { 2222 closes[i].onclick = function(evt){ 2223 2224 if ( ! evt) { evt = window.event; 2225 } 2226 var self = this; 2227 while ( 1 ) { 2228 if ( self.parentNode.classList.contains( 'ast-search-box' ) ) { 2229 fade_out( self.parentNode ); 2230 remove_style_class( 'full-screen' ); 2231 break; 2232 } else if ( self.parentNode.classList.contains( 'site-header' ) ) { 2233 break; 2234 } 2235 self = self.parentNode; 2236 } 2237 }; 2238 } 2239 2240 document.onkeydown = function ( evt ) { 2241 if ( evt.keyCode == 27 ) { 2242 var fullScreenForm = document.getElementById( 'ast-seach-full-screen-form' ); 2243 2244 if ( null != fullScreenForm ) { 2245 fade_out( fullScreenForm ); 2246 remove_style_class( 'full-screen' ); 2247 } 2248 2249 var header_cover = document.querySelectorAll( '.ast-search-box.header-cover' ); 2250 for (var j = 0; j < header_cover.length; j++) { 2251 fade_out( header_cover[j] ); 2252 } 2253 } 2254 } 2255 2256 window.addEventListener("resize", function() { 2257 2258 if( 'BODY' !== document.activeElement.tagName ) { 2259 return; 2260 } 2261 2262 // Skip resize event when keyboard display event triggers on devices. 2263 if( 'INPUT' != document.activeElement.tagName ) { 2264 var header_cover = document.querySelectorAll( '.ast-search-box.header-cover' ); 2265 if ( ! document.body.classList.contains( 'ast-header-break-point' ) ) { 2266 for (var j = 0; j < header_cover.length; j++) { 2267 header_cover[j].style.maxHeight = ''; 2268 header_cover[j].style.opacity = ''; 2269 header_cover[j].style.display = ''; 2270 } 2271 } 2272 } 2273 }); 2274 2275 let closeIcon = document.getElementById("close"); 2276 if ( closeIcon ) { 2277 closeIcon.addEventListener("keydown", function (event) { 2278 if (event.key === "Enter") { 2279 event.preventDefault(); 2280 this.click(); 2281 } else if (event.key === "Tab") { 2282 event.preventDefault(); 2283 } 2284 }); 2285 } 2286 2287} )(); 2288 2289} 2290 2291/* 2292 FILE ARCHIVED ON 06:05:08 Jul 11, 2025 AND RETRIEVED FROM THE 2293 INTERNET ARCHIVE ON 09:04:46 Aug 06, 2026. 2294 JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE. 2295
2296 ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C. 2297 SECTION 108(a)(3)). 2298*/ 2299/* 2300playback timings (ms): 2301 captures_list: 0.661 2302 exclusion.robots: 0.127 2303 exclusion.robots.policy: 0.115 2304 esindex: 0.01 2305 cdx.remote: 27.705 2306 LoadShardBlock: 378.344 (3) 2307 PetaboxLoader3.datanode: 201.771 (5) 2308 load_resource: 424.4 2309 PetaboxLoader3.resolve: 219.144 2310 loaddict: 172.855 2311*/
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.