1jQuery(function($) { 2 3 $(function() { 4 $( '.fl-node-lurtx2whagp4 .fl-photo-img' ) 5 .on( 'mouseenter', function( e ) { 6 $( this ).data( 'title', $( this ).attr( 'title' ) ).removeAttr( 'title' ); 7 } ) 8 .on( 'mouseleave', function( e ){ 9 $( this ).attr( 'title', $( this ).data( 'title' ) ).data( 'title', null ); 10 } ); 11 }); 12 window._fl_string_to_slug_regex = 'a-zA-Z0-9'; 13}); 14 15;(function($) { 16 17 PPAdvancedMenu = function( settings ) { 18 19 // set params 20 this.settingsId = settings.id; 21 this.nodeClass = '.fl-node-' + settings.id; 22 this.wrapperClass = this.nodeClass + ' .pp-advanced-menu'; 23 this.type = settings.type; 24 this.mobileToggle = settings.mobile; 25 this.mobileBelowRow = 'below' === settings.menuPosition; 26 this.breakpoints = settings.breakpoints; 27 this.mobileBreakpoint = settings.mobileBreakpoint; 28 this.mediaBreakpoint = settings.mediaBreakpoint; 29 this.mobileMenuType = settings.mobileMenuType; 30 this.offCanvasDirection = settings.offCanvasDirection; 31 this.postId = bb_powerpack.post_id; 32 this.isBuilderActive = settings.isBuilderActive; 33 this.currentBrowserWidth = window.innerWidth; 34 this.fullScreenMenu = null; 35 this.offCanvasMenu = null; 36 this.$submenus = null; 37 38 // initialize the menu 39 $( this._initMenu.bind( this ) ); 40 41 // check if viewport is resizing 42 $( window ).on( 'resize', function( e ) { 43 44 var width = window.innerWidth; 45 46 // if screen width is resized, reload the menu 47 if( width != this.currentBrowserWidth ) { 48 49 this._initMenu(); 50 this._clickOrHover(); 51 this.currentBrowserWidth = width; 52 } 53 54 }.bind( this ) ); 55 56 $( 'body' ).on( 'click', function( e ) { 57 if ( 'undefined' !== typeof FLBuilderConfig ){ 58 return; 59 } 60 61 if ( $( this.wrapperClass ).find( '.pp-advanced-menu-mobile-toggle' ).hasClass( 'pp-active' ) && ( 'expanded' !== this.mobileToggle ) ) { 62 if ( $( e.target ).parents('.fl-module-pp-advanced-menu').length > 0 ) { 63 return; 64 } 65 if ( $( e.target ).is( 'input' ) && $( e.target ).parents('.pp-advanced-menu').length > 0 ) { 66 return; 67 } 68 if ( $( e.target ).hasClass( 'pp-menu-close-btn' ) ) { 69 return; 70 } 71 $( this.wrapperClass ).find( '.pp-advanced-menu-mobile-toggle' ).trigger( 'click' ); 72 } 73 74 $( this.wrapperClass ).find( '.pp-has-submenu' ).each( function() { 75 if ( ! $( this ).find( '> .sub-menu' ).is( ':visible' ) ) { 76 $( this ).removeClass( 'pp-active' ); 77 } 78 } ); 79 $( this.wrapperClass ).find( '.pp-has-submenu' ).removeClass( 'focus' ); 80 $( this.wrapperClass ).find( '.pp-has-submenu .sub-menu' ).removeClass( 'focus' ); 81 $( this.wrapperClass ).find( '.pp-has-submenu-container' ).removeClass( 'focus' ); 82 $( this.wrapperClass ).find( '.pp-menu-toggle' ).attr( 'aria-expanded', false ); 83 84 }.bind( this ) ); 85 86 // Esc key to close the submenu. 87 $( document ).on( 'keyup', function( e ) { 88 if ( 27 == e.which ) { 89 $( this.wrapperClass ).find( '.pp-has-submenu' ).each( function() { 90 if ( ! $( this ).find( '> .sub-menu' ).is( ':visible' ) ) { 91 $( this ).removeClass( 'pp-active' ); 92 } 93 } ); 94 $( this.wrapperClass ).find( '.pp-has-submenu' ).removeClass( 'focus' ); 95 $( this.wrapperClass ).find( '.pp-has-submenu .sub-menu' ).removeClass( 'focus' ); 96 $( this.wrapperClass ).find( '.pp-has-submenu-container' ).removeClass( 'focus' ); 97 $( this.wrapperClass ).find( '.pp-menu-toggle' ).attr( 'aria-expanded', false ); 98 if ( $( this.wrapperClass ).find( '.pp-menu-toggle.focus' ).is( ':visible' ) ) { 99 $( this.wrapperClass ).find( '.pp-menu-toggle.focus' ).delay(100).trigger( 'focus' ); 100 } 101 } 102 }.bind( this ) ); 103 104 }; 105 106 PPAdvancedMenu.prototype = { 107 nodeClass : '', 108 wrapperClass : '', 109 type : '', 110 breakpoints : {}, 111 $submenus : null, 112 fullScreenMenu : null, 113 offCanvasMenu : null, 114 115 /** 116 * Check if the screen size fits a mobile viewport. 117 * 118 * @since 1.6.1 119 * @return bool 120 */ 121 _isMobile: function() { 122 return window.innerWidth <= this.breakpoints.small ? true : false;
123 }, 124 125 /** 126 * Check if the screen size fits a medium viewport. 127 * 128 * @since 1.10.5 129 * @return bool 130 */ 131 _isMedium: function() { 132 return window.innerWidth <= this.breakpoints.medium ? true : false; 133 }, 134 135 /** 136 * Check if the screen size fits a large viewport. 137 * 138 * @since 1.10.5 139 * @return bool 140 */ 141 _isLarge: function() { 142 return window.innerWidth <= this.breakpoints.large ? true : false; 143 }, 144 145 /** 146 * Check if the screen size fits a custom viewport. 147 * 148 * @since 1.10.5 149 * @return bool 150 */ 151 _isCustom: function() { 152 return window.innerWidth <= this.breakpoints.custom ? true : false; 153 }, 154 155 _isTouch: function() { 156 var prefixes = ' -webkit- -moz- -o- -ms- '.split(' '); 157 var mq = function(query) { 158 return window.matchMedia(query).matches; 159 } 160 161 if (('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch) { 162 return true; 163 } 164 165 // include the 'heartz' as a way to have a non matching MQ to help terminate the join 166 // https://git.io/vznFH 167 var query = ['(', prefixes.join('touch-enabled),('), 'heartz', ')'].join(''); 168 return mq(query); 169 }, 170 171 _isIOS: function() { 172 return [ 173 'iPad Simulator', 174 'iPhone Simulator', 175 'iPod Simulator', 176 'iPad', 177 'iPhone', 178 'iPod' 179 ].includes(navigator.platform) 180 // This explicitly catches modern iPads mimicking desktop Macs: 181 || (navigator.userAgent.includes("Mac") && navigator.maxTouchPoints > 1); 182 }, 183 184 /** 185 * Check if the menu should toggle for the current viewport base on the selected breakpoint 186 * 187 * @see this._isMobile() 188 * @see this._isMedium() 189 * @since 1.10.5 190 * @return bool 191 */ 192 _isMenuToggle: function() { 193 if ( ( 'always' == this.mobileBreakpoint 194 || ( this._isMobile() && 'mobile' == this.mobileBreakpoint ) 195 || ( this._isMedium() && 'medium-mobile' == this.mobileBreakpoint ) 196 || ( this._isCustom() && 'custom' == this.mobileBreakpoint ) 197 ) && ( $( this.nodeClass ).find( '.pp-advanced-menu-mobile-toggle' ).is(':visible') || 'expanded' == this.mobileToggle ) ) { 198 return true; 199 } 200 201 return false; 202 }, 203 204 _bindSettingsFormEvents: function() 205 { 206 // $('body').on( 'change', '.fl-builder-settings select[name="offcanvas_direction"]', function() { 207 // $('html').removeClass('pp-off-canvas-menu-open'); 208 // } ); 209 }, 210 211 /** 212 * Initialize the toggle logic for the menu. 213 * 214 * @see this._isMobile() 215 * @see this._menuOnCLick() 216 * @see this._clickOrHover() 217 * @see this._submenuOnRight() 218 * @see this._submenuRowZindexFix() 219 * @see this._toggleForMobile() 220 * @since 1.6.1 221 * @return void 222 */ 223 _initMenu: function() { 224 if ( this.mobileToggle != 'expanded' ) { 225 this._initOffCanvas(); 226 this._initFullScreen(); 227 } 228 229 this._setupSubmenu(); 230 this._menuOnHover(); 231 this._menuOnFocus(); 232 this._submenuOnClick(); 233 234 if ( $( this.nodeClass ).length && this.type == 'horizontal' ) { 235 this._initMegaMenus(); 236 } 237 238 if ( this.type == 'horizontal' || this.type == 'vertical' ) { 239 var self = this; 240 $( this.wrapperClass ).find('.pp-has-submenu-container').on( 'click', function( e ) { 241 if ( self.mobileMenuType !== 'off-canvas' && self.mobileMenuType !== 'full-screen' ) { 242 if ( self._isTouch() ) { 243 if ( ! $(this).hasClass('first-click') ) { 244 e.preventDefault(); 245 $(this).addClass('first-click'); 246 } 247 } 248 } 249 } ); 250 251 // Keyboard nav support for submenu toggle. 252 $( this.wrapperClass ).on( 'keydown.pp-menu', 'a, .pp-has-submenu-container > .pp-menu-toggle', function(e) { 253 var $current = $(e.target); 254 255 var key = e.key || e.which; 256 257 // Normalize keys 258 var KEYS = { 259 LEFT: 'ArrowLeft', 260 RIGHT: 'ArrowRight', 261 UP: 'ArrowUp', 262 DOWN: 'ArrowDown', 263 ENTER: 'Enter', 264 SPACE: ' ', 265 }; 266 267 function isKey(match) { 268 return key === match || key === { 269 ArrowLeft: 37, 270 ArrowUp: 38, 271 ArrowRight: 39, 272 ArrowDown: 40, 273 Enter: 13, 274 ' ': 32 275 }[match]; 276 } 277 278 var $item = $current.closest('li'); 279 var $parentItem = $current.closest('li.pp-has-submenu'); 280 var $submenu = $current.closest('ul.sub-menu'); 281 var isTopLevel = $current.closest('.sub-menu').length === 0; 282 283 /* ========================= 284 TOGGLE HANDLING 285 ========================= */ 286 287 function toggleSubmenu($el) { 288 var $li = $el.closest('li.pp-has-submenu'); 289 var $btn = $li.find('> .pp-has-submenu-container > .pp-menu-toggle'); 290 291 $li.toggleClass('pp-active'); 292 293 var isOpen = $li.hasClass('pp-active'); 294 295 if ($btn.length) { 296 $btn.attr('aria-expanded', isOpen); 297 } 298 } 299 300 // Button toggle 301 if ($current.hasClass('pp-menu-toggle')) { 302 if (isKey(KEYS.ENTER) || isKey(KEYS.SPACE)) { 303 e.preventDefault(); 304 e.stopPropagation(); 305 toggleSubmenu($current); 306 return; 307 } 308 } 309 310 /* ========================= 311 TOP LEVEL NAV (â â) 312 ========================= */ 313 314 if (isTopLevel && (isKey(KEYS.LEFT) || isKey(KEYS.RIGHT))) { 315 e.preventDefault(); 316 e.stopPropagation(); 317 318 if (isKey(KEYS.LEFT)) { 319 if ( $current.is( '.pp-menu-toggle' ) ) { 320 $current.prev('a').focus(); 321 } else { 322 var $prev = $item.prev(); 323 if ($prev.length) { 324 var $target = $prev.find('> .pp-has-submenu-container > .pp-menu-toggle:visible'); 325 ($target.length ? $target : $prev.find('a')).first().focus(); 326 } 327 } 328 } 329 330 if (isKey(KEYS.RIGHT)) { 331 if ( $current.next().is( '.pp-menu-toggle:visible' ) ) { 332 $current.next().focus(); 333 } else { 334 var $next = $item.next(); 335 if ($next.length) { 336 $next.find('a').first().focus(); 337 } 338 } 339 } 340 341 return; 342 } 343 344 // NESTED submenu navigation (LEFT / RIGHT) 345 if (!isTopLevel && (isKey(KEYS.RIGHT) || isKey(KEYS.LEFT))) { 346 347 var $parentItem = $current.closest('li.pp-has-submenu'); 348 349 // RIGHT â go into child submenu 350 if (isKey(KEYS.RIGHT)) { 351 var $childSubmenu = $parentItem.children('.sub-menu'); 352 353 if ($childSubmenu.length) { 354 e.preventDefault(); 355 e.stopPropagation(); 356 357 // Ensure open state 358 $parentItem.addClass('pp-active'); 359 360 var $toggle = $parentItem.find('> .pp-has-submenu-container > .pp-menu-toggle:visible'); 361 if ($toggle.length) { 362 $toggle.attr('aria-expanded', true); 363 } else { 364 $parentItem.find('> .pp-has-submenu-container > a').attr('aria-expanded', true); 365 } 366 367 // Focus first item in child submenu 368 $childSubmenu.find('a, .pp-menu-toggle:visible').first().focus(); 369 } 370 return; 371 } 372 373 // LEFT â go back to parent menu item 374 if (isKey(KEYS.LEFT)) { 375 var $currentSubmenu = $current.closest('ul.sub-menu'); 376 var $parentItem = $currentSubmenu.parent('li'); 377 378 if ($parentItem.length) { 379 e.preventDefault(); 380 e.stopPropagation(); 381 382 // CLOSE submenu 383 $parentItem.removeClass('pp-active'); 384 385 var $toggle = $parentItem.find('> .pp-has-submenu-container > .pp-menu-toggle:visible'); 386 387 if ($toggle.length) { 388 $toggle.attr('aria-expanded', false); 389 $toggle.focus(); 390 } else { 391 $parentItem.find('> .pp-has-submenu-container > a').attr('aria-expanded', false).focus(); 392 } 393 } 394 return; 395 } 396 } 397 398 /* ========================= 399 SUBMENU NAV (â â) 400 ========================= */ 401 402 // DOWN from toggle â first submenu item 403 if (isKey(KEYS.DOWN) && isTopLevel && $parentItem.length) { 404 e.preventDefault(); 405 e.stopPropagation(); 406 407 var $submenu = $parentItem.children('.sub-menu'); 408 409 if ($submenu.length) { 410 // ensure open state 411 if (!$parentItem.hasClass('pp-active')) { 412 $parentItem.addClass('pp-active'); 413 414 var $toggle = $parentItem.find('> .pp-has-submenu-container > .pp-menu-toggle:visible'); 415 if ($toggle.length) { 416 $toggle.attr('aria-expanded', true); 417 } else { 418 $parentItem.find('> .pp-has-submenu-container > a').attr('aria-expanded', true); 419 } 420 } 421 422 // move focus into submenu 423 $submenu.find('a, .pp-menu-toggle:visible').first().focus(); 424 } 425 426 return; 427 } 428 429 if (!$submenu.length) { 430 return; 431 } 432 433 var $items = $submenu.find('a, .pp-menu-toggle').filter(':visible'); 434 var index = $items.index($current); 435 436 if (index === -1) return; 437 438 // DOWN â 439 if (isKey(KEYS.DOWN)) { 440 e.preventDefault(); 441 e.stopPropagation(); 442 443 var next = index + 1; 444 if (next < $items.length) { 445 $items.eq(next).focus(); 446 } 447 return; 448 } 449 450 // UP â 451 if (isKey(KEYS.UP)) { 452 e.preventDefault(); 453 e.stopPropagation(); 454 455 if (index === 0 && ! $current.closest('.sub-menu').parents('.sub-menu').length) { 456 var $currentSubmenu = $current.closest('ul.sub-menu'); 457 var $parentItem = $currentSubmenu.parent('li'); 458 var $toggle = $parentItem.find('> .pp-has-submenu-container > .pp-menu-toggle:visible'); 459 if ($toggle.length) { 460 $toggle.focus(); 461 } else { 462 $parentItem.find('> .pp-has-submenu-container > a').focus(); 463 } 464 return; 465 } 466 467 // Don't loop back to the last item if we're on the first item of a submenu 468 if ( index === 0 ) { 469 $items.eq(index).focus(); 470 return; 471 } 472 473 $items.eq(index - 1).focus(); 474 return; 475 } 476 477 }.bind( this ) ); 478 } 479 480 if ( this._isMenuToggle() || this.type == 'accordion' ) { 481 $( this.wrapperClass ).off( 'mouseenter mouseleave' ); 482 this._menuOnClick(); 483 this._clickOrHover(); 484 } else { 485 $( this.wrapperClass ).off( 'click' ); 486 this._submenuOnRight(); 487 this._submenuRowZindexFix(); 488 } 489 490 if ( this.mobileToggle != 'expanded' ) { 491 this._toggleForMobile(); 492 } 493 494 $(this.wrapperClass).find('li:not(.menu-item-has-children)').on('click', 'a', function (e) { 495 if ( $(e.target).closest( '.pp-menu-search-item' ).length > 0 ) { 496 return; 497 } 498 499 $(this.nodeClass).find('.pp-advanced-menu').removeClass('menu-open'); 500 $(this.nodeClass).find('.pp-advanced-menu').addClass('menu-close'); 501 $('html').removeClass('pp-off-canvas-menu-open'); 502 $('html').removeClass('pp-full-screen-menu-open'); 503 504 }.bind( this ) ); 505 506 if ( $( this.wrapperClass ).find( '.pp-menu-search-item' ).length ) { 507 this._toggleMenuSearch(); 508 } 509 510 if ( $( this.wrapperClass ).find( '.pp-menu-cart-item').length ) { 511 this._wooUpdateParams(); 512 } 513 }, 514 515 /** 516 * Initializes submenu dropdowns. 517 * 518 * @since 2.33.x 519 * @return void 520 */ 521 _setupSubmenu: function() { 522 // $( this.wrapperClass + ' ul.sub-menu' ).each( function(){ 523 // $( this ).closest( 'li' ).attr( 'aria-haspopup', 'true' ); 524 // }); 525 }, 526 527 _menuOnHover: function() { 528 $( this.wrapperClass ).on( 'mouseenter', 'li.menu-item', function() { 529 $(this).addClass( 'hover' ); 530 } ).on( 'mouseleave', 'li.menu-item', function() { 531 $(this).removeClass( 'hover' ); 532 } ); 533 }, 534 535 /** 536 * Adds a focus class to menu elements similar to be used similar to CSS :hover psuedo event 537 * 538 * @since 1.9.0 539 * @return void 540 */ 541 _menuOnFocus: function() { 542 $( this.nodeClass ).off('focus', 'a').on( 'focus', 'a', function( e ) { 543 var $menuItem = $( e.target ).parents( '.menu-item' ).first(), 544 $parents = $( e.target ).parentsUntil( this.wrapperClass ); 545 546 $('.pp-advanced-menu .focus:not(.pp-menu-toggle)').removeClass('focus'); 547 548 $menuItem.addClass('focus'); 549 $parents.addClass('focus'); 550 551 }.bind( this ) ).on( 'focusout', 'a', function( e ) { 552 if ( $('.pp-advanced-menu .focus').hasClass('pp-has-submenu') ) { 553 $( e.target ).parentsUntil( this.wrapperClass ).find('.pp-has-submenu-container').removeClass('first-click'); 554 } 555 }.bind( this ) ); 556 557 $( this.nodeClass ).off('focus', '.pp-menu-toggle').on( 'focus', '.pp-menu-toggle', function( e ) { 558 $(e.target).addClass( 'focus' ); 559 }.bind( this ) ).off('blur', '.pp-menu-toggle').on( 'blur', '.pp-menu-toggle', function( e ) { 560 if ( $(e.target).parents( 'li.pp-has-submenu.pp-active' ).length === 0 || $(e.target).parents( 'li.pp-has-submenu.pp-active' ).parent( 'ul.menu' ).length === 0 ) { 561 $(e.target).removeClass( 'focus' ); 562 } 563 }.bind( this ) ); 564 }, 565 566 /** 567 * Logic for submenu toggling on accordions or mobile menus (vertical, horizontal) 568 * 569 * @since 1.6.1 570 * @return void 571 */ 572 _menuOnClick: function() { 573 var self = this; 574 var $mainItem = ''; 575 576 $( this.wrapperClass ) 577 .off( 'click.pp-advanced-menu keyup', '.pp-has-submenu-container' ) 578 .on( 'click.pp-advanced-menu keyup', '.pp-has-submenu-container', function( e ) { 579 var isValidEvent = e.which == 1 || e.which == 13 || e.which == undefined; // click or enter key press. 580 if ( ! isValidEvent ) { 581 return; 582 } 583 if ( e.which == 13 && ! $(e.target).hasClass( 'pp-menu-toggle' ) ) { // prevent event bubbling. 584 return; 585 } 586 if ( self._isTouch() ) { 587 if ( ! $(this).hasClass('first-click') ) { 588 e.preventDefault(); 589 $(this).addClass('first-click'); 590 } 591 } 592 593 e.stopPropagation(); 594 595 var isMainEl = $(e.target).parents('.menu-item').parent().parent().hasClass('pp-advanced-menu'); 596 597 if (isMainEl && $mainItem === '') { 598 $mainItem = $(e.target).parents('.menu-item'); 599 } 600 601 var $link = $( e.target ).parents( '.pp-has-submenu' ).first(), 602 $subMenu = $link.children( '.sub-menu' ).first(), 603 $href = $link.children('.pp-has-submenu-container').first().find('> a').attr('href'), 604 $subMenuParents = $( e.target ).parents( '.sub-menu' ), 605 $activeParent = $( e.target ).closest( '.pp-has-submenu.pp-active' ); 606 607 if ( $activeParent.length > 0 ) { 608 $activeParent.find( '.pp-menu-toggle' ).first().attr('aria-expanded', true); 609 } else { 610 $activeParent.find( '.pp-menu-toggle' ).first().attr('aria-expanded', false); 611 } 612 613 if( !$subMenu.is(':visible') || $(e.target).hasClass('pp-menu-toggle') 614 || ($subMenu.is(':visible') && (typeof $href === 'undefined' || $href == '#')) ) { 615 if ( ! $(this.wrapperClass).hasClass('pp-advanced-menu-accordion-collapse') ) { 616 e.preventDefault(); 617 } 618 if ( $(e.target).hasClass('pp-menu-toggle') ) { 619 e.stopPropagation(); 620 e.preventDefault(); 621 } 622 } 623 else { 624 e.stopPropagation(); 625 window.location.href = $href; 626 return; 627 } 628 629 if ($(this.wrapperClass).hasClass('pp-advanced-menu-accordion-collapse')) { 630 631 if ( $link.parents('.menu-item').length && !$link.parents('.menu-item').hasClass('pp-active') ) { 632 $('.menu .pp-active', this.wrapperClass).not($link).removeClass('pp-active'); 633 } 634 else if ($link.parents('.menu-item').hasClass('pp-active') && $link.parent('.sub-menu').length) { 635 $('.menu .pp-active', this.wrapperClass).not($link).not($activeParent).removeClass('pp-active'); 636 } 637 638 $('.sub-menu', this.wrapperClass).not($subMenu).not($subMenuParents).slideUp('normal'); 639 } 640 641 // Parent menu toggle icon was being reversed on collapsing its submenu, 642 // so here is the workaround to fix this behavior. 643 if ($(self.wrapperClass).find('.sub-menu:visible').length > 0) { 644 $(self.wrapperClass).find('.sub-menu:visible').parent().addClass('pp-active'); 645 } 646 $subMenu.slideToggle(400, function() { 647 // Reset previously opened sub-menu toggle icon. 648 $(e.target).parents('.pp-has-submenu-container').parent().parent().find('> .menu-item.pp-active').removeClass('pp-active'); 649 650 if ($mainItem !== '') { 651 $mainItem.parent().find('.menu-item.pp-active').removeClass('pp-active'); 652 $(self.wrapperClass).find('.sub-menu').parent().removeClass('pp-active'); 653 654 if ($(self.wrapperClass).find('.sub-menu:visible').length > 0) { 655 $(self.wrapperClass).find('.sub-menu:visible').parent().addClass('pp-active'); 656 } else { 657 $link.toggleClass('pp-active'); 658 $mainItem.removeClass('pp-active'); 659 } 660 } else { 661 $link.toggleClass('pp-active'); 662 } 663 if (!$subMenu.is(':visible')) { 664 $subMenu.parent().removeClass('pp-active'); 665 $subMenu.parent().find('> .p
665p-has-submenu-container .pp-menu-toggle').attr('aria-expanded', false); 666 } else { 667 $subMenu.parent().find('> .pp-has-submenu-container .pp-menu-toggle').attr('aria-expanded', true); 668 } 669 }); 670 671 }.bind( this ) ); 672 673 }, 674 675 /** 676 * Logic for submenu items click event 677 * 678 * @since 1.3.1 679 * @return void 680 */ 681 _submenuOnClick: function(){ 682 $( 'body' ).off( 'click', this.wrapperClass + ' .sub-menu a' ).on( 'click', this.wrapperClass + ' .sub-menu a', function( e ){ 683 if ( $( e.target ).parent().hasClass('focus') ) { 684 $( e.target ).parentsUntil( this.wrapperClass ).removeClass( 'focus' ); 685 } 686 }.bind( this ) ); 687 }, 688 689 /** 690 * Changes general styling and behavior of menus based on mobile / desktop viewport. 691 * 692 * @see this._isMobile() 693 * @since 1.6.1 694 * @return void 695 */ 696 _clickOrHover: function() { 697 this.$submenus = this.$submenus || $( this.wrapperClass ).find( '.sub-menu' ); 698 var $wrapper = $( this.wrapperClass ), 699 $menu = $wrapper.find( '.menu' ); 700 $li = $wrapper.find( '.pp-has-submenu' ); 701 702 if( this._isMenuToggle() ) { 703 $li.each( function() { 704 if( !$(this).hasClass('pp-active') ) { 705 $(this).find( '.sub-menu' ).fadeOut(); 706 } 707 } ); 708 } else { 709 $li.each( function() { 710 if( !$(this).hasClass('pp-active') ) { 711 $(this).find( '.sub-menu' ).css( { 712 'display' : '', 713 'opacity' : '' 714 } ); 715 } 716 } ); 717 } 718 }, 719 720 /** 721 * Logic to prevent submenus to go outside viewport boundaries. 722 * 723 * @since 1.6.1 724 * @return void 725 */ 726 _submenuOnRight: function() { 727 728 $( this.wrapperClass ) 729 .on( 'mouseenter focus', '.pp-has-submenu', function( e ) { 730 731 if( $ ( e.currentTarget ).find('.sub-menu').length === 0 ) { 732 return; 733 } 734 735 var $link = $( e.currentTarget ), 736 $parent = $link.parent(), 737 $subMenu = $link.find( '.sub-menu' ), 738 subMenuWidth = $subMenu.width(), 739 subMenuPos = 0, 740 winWidth = window.innerWidth; 741 742 if( $link.closest( '.pp-menu-submenu-right' ).length !== 0) { 743 744 $link.addClass( 'pp-menu-submenu-right' ); 745 746 } else if( $( 'body' ).hasClass( 'rtl' ) ) { 747 748 subMenuPos = $parent.is( '.sub-menu' ) ? 749 $parent.offset().left - subMenuWidth: 750 $link.offset().left - subMenuWidth; 751 752 if( subMenuPos <= 0 ) { 753 $link.addClass( 'pp-menu-submenu-right' ); 754 } 755 756 } else { 757 758 subMenuPos = $parent.is( '.sub-menu' ) ? 759 $parent.offset().left + $parent.width() + subMenuWidth : 760 $link.offset().left + subMenuWidth; 761 762 if( subMenuPos > winWidth ) { 763 $link.addClass('pp-menu-submenu-right'); 764 } 765 } 766 }.bind( this ) ) 767 .on( 'mouseleave', '.pp-has-submenu', function( e ) { 768 $( e.currentTarget ).removeClass( 'pp-menu-submenu-right' ); 769 }.bind( this ) ); 770 771 }, 772 773 /** 774 * Logic to prevent submenus to go behind the next overlay row. 775 * 776 * @since 2.2 777 * @return void 778 */ 779 _submenuRowZindexFix: function (e) { 780 781 $(this.wrapperClass) 782 .on('mouseenter', 'ul.menu > .pp-has-submenu', function (e) { 783 784 if ($(e.currentTarget).find('.sub-menu').length === 0) { 785 return; 786 } 787 788 $(this.nodeClass) 789 .closest('.fl-row') 790 .find('.fl-row-content') 791 .css('z-index', '10'); 792 793 }.bind( this ) ) 794 .on('mouseleave', 'ul.menu > .pp-has-submenu', function (e) { 795 796 $(this.nodeClass) 797 .closest('.fl-row') 798 .find('.fl-row-content') 799 .css('z-index', ''); 800 801 }.bind( this ) ); 802 }, 803 804 /** 805 * Logic for the mobile menu button. 806 * 807 * @since 1.6.1 808 * @return void 809 */ 810 _toggleForMobile: function() { 811 812 var $wrapper = null, 813 $menu = null, 814 self = this; 815 816 if ( this._isMenuToggle() ) { 817 $wrapper = $(this.wrapperClass); 818 if ( this._isMobileBelowRowEnabled() ) { 819 this._placeMobileMenuBelowRow(); 820 $menu = $(this.nodeClass + '-clone'); 821 $menu.find('ul.menu').show(); 822 } else { 823 $menu = $wrapper.find('.menu'); 824 } 825 826 if( !$wrapper.find( '.pp-advanced-menu-mobile-toggle' ).hasClass( 'pp-active' ) && this.mobileMenuType === 'default' ) { 827 $menu.css({ display: 'none' }); 828 } 829 830 $wrapper 831 .off( 'click.pp-mobile-menu-toggle', '.pp-advanced-menu-mobile-toggle' ) 832 .on( 'click.pp-mobile-menu-toggle', '.pp-advanced-menu-mobile-toggle', function( e ) { 833 e.stopPropagation(); 834 $(this).toggleClass( 'pp-active' ); 835 if ( $(this).hasClass('pp-active') ) { 836 $(this).attr('aria-expanded', 'true'); 837 $menu.addClass( 'pp-menu-visible' ); 838 } else { 839 $(this).attr('aria-expanded', 'false'); 840 $menu.removeClass( 'pp-menu-visible' ); 841 } 842 $menu.slideToggle(); 843 } ); 844 845 $menu.on( 'click', '.menu-item > a[href*="#"]', function(e) { 846 var $href = $(this).attr('href'), 847 $targetID = ''; 848 849 if ( $href !== '#' ) { 850 $targetID = $href.split('#')[1]; 851 852 if ( $('body').find('#'+ $targetID).length > 0 ) { 853 e.preventDefault(); 854 $( this ).toggleClass( 'pp-active' ); 855 setTimeout(function() { 856 $('html, body').animate({ 857 scrollTop: $('#'+ $targetID).offset().top 858 }, 1000, function() { 859 window.location.hash = $targetID; 860 }); 861 }, 500); 862 863 if ( ! self._isMenuToggle() ) { 864 $menu.slideToggle(); 865 } 866 } 867 } 868 }); 869 } 870 else { 871 872 if ( this._isMobileBelowRowEnabled() ) { 873 this._removeMenuFromBelowRow(); 874 } 875 876 $wrapper = $( this.wrapperClass ), 877 $menu = $wrapper.children( '.menu' ); 878 $wrapper.find( '.pp-advanced-menu-mobile-toggle' ).removeClass( 'pp-active' ); 879 $menu.css({ display: '' }); 880 } 881 }, 882 883 /** 884 * Init any mega menus that exist. 885 * 886 * @see this._isMenuToggle() 887 * @since 1.10.4 888 * @return void 889 */ 890 _initMegaMenus: function() { 891 892 var module = $( this.nodeClass ), 893 rowContent = module.closest( '.fl-row-content' ), 894 rowWidth = rowContent.width(), 895 megas = module.find( '.mega-menu' ), 896 disabled = module.find( '.mega-menu-disabled' ), 897 isToggle = this._isMenuToggle(); 898 899 if ( isToggle ) { 900 megas.removeClass( 'mega-menu' ).addClass( 'mega-menu-disabled' ); 901 module.find( 'li.mega-menu-disabled > ul.sub-menu' ).css( 'width', '' ); 902 rowContent.css( 'position', '' ); 903 } else { 904 disabled.removeClass( 'mega-menu-disabled' ).addClass( 'mega-menu' ); 905 module.find( 'li.mega-menu > ul.sub-menu' ).css( 'width', rowWidth + 'px' ); 906 rowContent.css( 'position', 'relative' ); 907 } 908 }, 909 910 /** 911 * Init off-canvas menu. 912 * 913 * @since 1.2.8 914 * @return void 915 */ 916 _initOffCanvas: function() { 917 if ( this.mobileMenuType !== 'off-canvas' ) { 918 return; 919 } 920 $('html').addClass('pp-off-canvas-menu-module'); 921 $('html').addClass('pp-off-canvas-menu-' + this.offCanvasDirection); 922 923 if ( $(this.nodeClass).find( '#pp-menu-' + this.settingsId ).length === 0 ) { 924 return; 925 } 926 927 var menuHTML = $(this.nodeClass).find( '#pp-menu-' + this.settingsId ).html(); 928 929 if ( null === this.offCanvasMenu ) {
930 this.offCanvasMenu = $('<div id="pp-advanced-menu-off-canvas-'+this.settingsId+'" class="fl-node-'+this.settingsId+' pp-menu-off-canvas" />').html( menuHTML ); 931 } 932 if ( $('#pp-advanced-menu-off-canvas-'+this.settingsId).length === 0 && null !== this.offCanvasMenu && ! this.isBuilderActive ) { 933 this.offCanvasMenu.appendTo( 'body' ); 934 } 935 936 $(this.nodeClass).trigger('pp-advanced-menu-off-canvas-init', [this.offCanvasMenu]); 937 938 this._toggleMenu(); 939 }, 940 941 /** 942 * Init full-screen overlay menu. 943 * 944 * @since 1.2.8 945 * @return void 946 */ 947 _initFullScreen: function() { 948 if ( this.mobileMenuType !== 'full-screen' ) { 949 return; 950 } 951 952 $('html').addClass('pp-full-screen-menu-module'); 953 954 if ( $(this.nodeClass).find( '#pp-menu-' + this.settingsId ).length === 0 ) { 955 return; 956 } 957 958 var menuHTML = $(this.nodeClass).find( '#pp-menu-' + this.settingsId ).html(); 959 960 if ( null === this.fullScreenMenu ) { 961 this.fullScreenMenu = $('<div id="pp-advanced-menu-full-screen-'+this.settingsId+'" class="fl-node-'+this.settingsId+' pp-menu-full-screen" />').html( menuHTML ); 962 } 963 if ( $('#pp-advanced-menu-full-screen-'+this.settingsId).length === 0 && null !== this.fullScreenMenu && ! this.isBuilderActive ) { 964 this.fullScreenMenu.appendTo( 'body' ); 965 } 966 967 $(this.nodeClass).trigger('pp-advanced-menu-full-screen-init', [this.fullScreenMenu]); 968 969 this._toggleMenu(); 970 }, 971 972 /** 973 * Trigger the toggle event for off-canvas 974 * and full-screen overlay menus. 975 * 976 * @since 1.2.8 977 * @return void 978 */ 979 _toggleMenu: function() { 980 var self = this; 981 var singleInstance = true; 982 if( self.mobileMenuType === 'full-screen' ) { 983 var winHeight = window.innerHeight; 984 $(self.nodeClass).find('.pp-menu-overlay').css('height', winHeight + 'px'); 985 $(window).on('resize', function() { 986 winHeight = window.innerHeight; 987 $(self.nodeClass).find('.pp-menu-overlay').css('height', winHeight + 'px'); 988 }); 989 } 990 991 // Toggle Click 992 var toggleEvent = ('ontouchend' in window) && this._isIOS() ? 'touchend' : 'click'; 993 $(self.nodeClass).find('.pp-advanced-menu-mobile-toggle' ).off(toggleEvent).on( toggleEvent, function() { 994 if ( singleInstance ) { 995 if ( $('.pp-advanced-menu.menu-open').length > 0 ) { 996 $('.pp-advanced-menu').removeClass('menu-open'); 997 $('html').removeClass('pp-full-screen-menu-open'); 998 } 999 } 1000 if( $(self.nodeClass).find('.pp-advanced-menu').hasClass('menu-open') ) { 1001 $(self.nodeClass).find('.pp-advanced-menu').removeClass('menu-open'); 1002 $(self.nodeClass).find('.pp-advanced-menu').addClass('menu-close'); 1003 $('html').removeClass('pp-off-canvas-menu-open'); 1004 $('html').removeClass('pp-full-screen-menu-open'); 1005 } else { 1006 $(self.nodeClass).find('.pp-advanced-menu').addClass('menu-open'); 1007 if( self.mobileMenuType === 'off-canvas' ) { 1008 $('html').addClass('pp-off-canvas-menu-open'); 1009 self.offCanvasMenu.find('nav').attr('tabindex', '0').trigger( 'focus' ); 1010 $(this).attr( 'tabindex', '-1' ).trigger( 'blur' ); 1011 } 1012 if( self.mobileMenuType === 'full-screen' ) { 1013 $('html').addClass('pp-full-screen-menu-open'); 1014 self.fullScreenMenu.find('nav').attr('tabindex', '0').trigger( 'focus' ); 1015 $(this).attr( 'tabindex', '-1' ).trigger( 'blur' ); 1016 } 1017 } 1018 1019 if ( '0' == $(this).attr('tabindex') ) { 1020 $(this).attr('aria-expanded', 'false'); 1021 } else { 1022 $(this).attr('aria-expanded', 'true'); 1023 } 1024 } ); 1025 1026 // iOS Safari "hover" fix. 1027 // This is needed to ensure the click event works properly on iOS devices since they treat the first tap as a hover event, 1028 // which can interfere with the intended toggle behavior of the menu. 1029 // $(self.nodeClass).find('.pp-advanced-menu-mobile-toggle' ).on( 'touchstart', function(e) { 1030 // e.preventDefault(); 1031 // e.stopPropagation(); 1032 // $(this).trigger('click'); 1033 // } ); 1034 1035 // Keyboard navigation. 1036 $(self.nodeClass).find('.pp-advanced-menu-mobile-toggle').on('keyup', function(e) { 1037 if ( 13 === e.keyCode || 13 === e.which ) { 1038 $(this).trigger('click'); 1039 } 1040 }); 1041 1042 // Close button click 1043 $(self.nodeClass).find('.pp-advanced-menu .pp-menu-close-btn, .pp-clear').on( 'click', function() { 1044 $(self.nodeClass).find('.pp-advanced-menu').removeClass('menu-open'); 1045 $(self.nodeClass).find('.pp-advanced-menu').addClass('menu-close'); 1046 $('html').removeClass('pp-off-canvas-menu-open'); 1047 $('html').removeClass('pp-full-screen-menu-open'); 1048 1049 if ( $(self.nodeClass).find('.pp-advanced-menu-mobile-toggle' ).is( ':visible' ) ) { 1050 setTimeout(function() { 1051 $(self.nodeClass).find('.pp-advanced-menu-mobile-toggle' ) 1052 .attr( 'tabindex', 0 ) 1053 .attr( 'aria-expanded', 'false' ) 1054 .trigger( 'focus' ); 1055 }, 120); 1056 } 1057 1058 if ( self.offCanvasMenu && self.offCanvasMenu.length > 0 ) { 1059 self.offCanvasMenu.find('nav').attr('tabindex', '-1').trigger( 'blur' ); 1060 } 1061 if ( self.fullScreenMenu && self.fullScreenMenu.length > 0 ) { 1062 self.fullScreenMenu.find('nav').attr('tabindex', '-1').trigger( 'blur' ); 1063 } 1064 } ); 1065 1066 if ( this.isBuilderActive ) { 1067 setTimeout(function() {
1068 if ( $('.fl-builder-settings[data-node="'+self.settingsId+'"]').length > 0 ) { 1069 $('.pp-advanced-menu').removeClass('menu-open'); 1070 $(self.nodeClass).find('.pp-advanced-menu-mobile-toggle').trigger('click'); 1071 } 1072 }, 600); 1073 1074 FLBuilder.addHook('settings-form-init', function() { 1075 if ( ! $('.fl-builder-settings[data-node="'+self.settingsId+'"]').length > 0 ) { 1076 return; 1077 } 1078 if ( ! $(self.nodeClass).find('.pp-advanced-menu').hasClass('menu-open') ) { 1079 $('.pp-advanced-menu').removeClass('menu-open'); 1080 $(self.nodeClass).find('.pp-advanced-menu-mobile-toggle').trigger('click'); 1081 } 1082 }); 1083 1084 if ( $('html').hasClass('pp-full-screen-menu-open') && ! $(self.nodeClass).find('.pp-advanced-menu').hasClass('menu-open') ) { 1085 $('html').removeClass('pp-full-screen-menu-open'); 1086 } 1087 if ( $('html').hasClass('pp-off-canvas-menu-open') && ! $(self.nodeClass).find('.pp-advanced-menu').hasClass('menu-open') ) { 1088 $('html').removeClass('pp-off-canvas-menu-open'); 1089 } 1090 } 1091 }, 1092 1093 /** 1094 * Check to see if Below Row should be enabled. 1095 * 1096 * @since 2.8.0 1097 * @return boolean 1098 */ 1099 _isMobileBelowRowEnabled: function() { 1100 if (this.mobileMenuType === 'default') { 1101 return this.mobileBelowRow && $( this.nodeClass ).closest( '.fl-col' ).length; 1102 } 1103 return false; 1104 }, 1105 1106 /** 1107 * Logic for putting the mobile menu below the menu's 1108 * column so it spans the full width of the page. 1109 * 1110 * @since 2.2 1111 * @return void 1112 */ 1113 _placeMobileMenuBelowRow: function () { 1114 1115 if ($(this.nodeClass + '-clone').length) { 1116 return; 1117 } 1118 // if ( $('html').hasClass( 'fl-builder-edit' ) ) { 1119 // return; 1120 // } 1121 1122 var module = $(this.nodeClass), 1123 clone = null, 1124 row = module.closest('.fl-row-content'); 1125 1126 if ( module.length < 1 ) { 1127 return; 1128 } 1129 1130 clone = ( module.length > 1 ) ? $( module[0] ).clone() : module.clone(); 1131 module.find('.pp-menu-nav').remove(); 1132 clone.addClass((this.nodeClass + '-clone').replace('.', '')); 1133 clone.addClass('pp-menu-mobile-clone'); 1134 clone.find('.pp-advanced-menu-mobile').remove(); 1135 row.append(clone); 1136 1137 // Removes animation when enabled. 1138 if ( module.hasClass( 'fl-animation' ) ) { 1139 clone.removeClass( 'fl-animation' ); 1140 } 1141 1142 this._menuOnClick(); 1143 }, 1144 1145 /** 1146 * Logic for removing the mobile menu from below the menu's 1147 * column and putting it back in the main wrapper. 1148 * 1149 * @since 2.2 1150 * @return void 1151 */ 1152 _removeMenuFromBelowRow: function () { 1153 1154 if (!$(this.nodeClass + '-clone').length) { 1155 return; 1156 } 1157 1158 var module = $(this.nodeClass), 1159 clone = $(this.nodeClass + '-clone'), 1160 menu = clone.find('.pp-menu-nav'); 1161 1162 module.find('.pp-advanced-menu-mobile').after(menu); 1163 module.find('.pp-advanced-menu-mobile-toggle').attr( 'aria-expanded', false ); 1164 clone.remove(); 1165 }, 1166 1167 _toggleMenuSearch: function() { 1168 var items = $( this.wrapperClass ).find( '.pp-menu-search-item' ), 1169 self = this; 1170 1171 items.each( function() { 1172 var item = $(this); 1173 var button = item.find( '> a' ), 1174 form = item.find( '.pp-search-form' ), 1175 input = item.find('.pp-search-form__input'); 1176 1177 button.on( 'click', function(e) { 1178 e.preventDefault(); 1179 item.toggleClass( 'pp-search-active' ); 1180 if ( item.hasClass( 'pp-search-active' ) ) { 1181 setTimeout( function() { 1182 input.focus(); 1183 self._focusMenuSearch( input ); 1184 }, 100 ); 1185 } 1186 1187 $('body').on( 'click.pp-menu-search', self._hideMenuSearch.bind( self ) ); 1188 } ); 1189 1190 input.on( 'focus', function() { 1191 form.addClass( 'pp-search-form--focus' ); 1192 } ).on( 'blur', function() { 1193 form.removeClass( 'pp-search-form--focus' ); 1194 } ); 1195 1196 // Close search form on ESC key press. 1197 input.on( 'keyup', function(e) { 1198 if ( e.key === 'Escape' || e.keyCode === 27 ) { 1199 item.removeClass( 'pp-search-active' ); 1200 $('body').off('click.pp-menu-search'); 1201 button.delay(100).focus(); 1202 } 1203 } ); 1204 } ); 1205 }, 1206 1207 _hideMenuSearch: function(e) { 1208 if (e !== undefined) { 1209 if ($(e.target).closest('.pp-menu-search-item').length > 0) { 1210 return; 1211 } 1212 } 1213 1214 $( this.wrapperClass ).find( '.pp-menu-search-item' ).removeClass( 'pp-search-active' ); 1215 $('body').off('click.pp-menu-search'); 1216 }, 1217 1218 _focusMenuSearch: function( $el ) { 1219 // If this function exists... (IE 9+) 1220 if ( $el[0].setSelectionRange ) { 1221 // Double the length because Opera is inconsistent about whether a carriage return is one character or tw
1221o. 1222 var len = $el.val().length * 2; 1223 1224 // Timeout seems to be required for Blink 1225 setTimeout(function() { 1226 $el[0].setSelectionRange( len, len ); 1227 }, 1); 1228 } else { 1229 // As a fallback, replace the contents with itself 1230 // Doesn't work in Chrome, but Chrome supports setSelectionRange 1231 $el.val( $el.val() ); 1232 } 1233 }, 1234 1235 /** 1236 * Adds menu node and post ID to WooCommerce ajax URL requests. 1237 * 1238 * @since 2.20 1239 * @return void 1240 */ 1241 _wooUpdateParams: function() { 1242 if ( 'undefined' !== typeof wc_cart_fragments_params ) { 1243 wc_cart_fragments_params.wc_ajax_url += '&pp-advanced-menu-node='+ this.settingsId +'&post-id='+ this.postId; 1244 } 1245 if ( 'undefined' !== typeof wc_add_to_cart_params ) { 1246 wc_add_to_cart_params.wc_ajax_url += '&pp-advanced-menu-node='+ this.settingsId +'&post-id='+ this.postId; 1247 } 1248 }, 1249 1250 _validClick: function(e) { 1251 return (e.which == 1 || e.which == 13 || e.which == 32 || e.which == undefined) ? true : false; 1252 } 1253 1254 }; 1255 1256})(jQuery); 1257 1258var pp_menu_qsyk239wmvix; 1259(function($) { 1260 1261 pp_menu_qsyk239wmvix = new PPAdvancedMenu({ 1262 id: 'qsyk239wmvix', 1263 type: 'horizontal', 1264 mobile: 'hamburger', 1265 menuPosition: 'below', 1266 breakpoints: { 1267 large: 1200, 1268 medium: 992, 1269 small: 768, 1270 custom: 768 }, 1271 mobileBreakpoint: 'mobile', 1272 mediaBreakpoint: '768', 1273 mobileMenuType: 'full-screen', 1274 offCanvasDirection: 'left', 1275 fullScreenAnimation: '', 1276 isBuilderActive: false }); 1277 1278})(jQuery); 1279 1280/* Start Layout Custom JS */ 1281 1282/* End Layout Custom JS */ 1283 1284(function($){ 1285 1286 /** 1287 * Helper class for header layout logic. 1288 * 1289 * @since 1.0 1290 * @class FLThemeBuilderHeaderLayout 1291 */ 1292 FLThemeBuilderHeaderLayout = { 1293 1294 /** 1295 * A reference to the window object for this page. 1296 * 1297 * @since 1.0 1298 * @property {Object} win 1299 */ 1300 win : null, 1301 1302 /** 1303 * A reference to the body object for this page. 1304 * 1305 * @since 1.0 1306 * @property {Object} body 1307 */ 1308 body : null, 1309 1310 /** 1311 * A reference to the header object for this page. 1312 * 1313 * @since 1.0 1314 * @property {Object} header 1315 */ 1316 header : null, 1317 1318 /** 1319 * Whether this header overlays the content or not. 1320 * 1321 * @since 1.0 1322 * @property {Boolean} overlay 1323 */ 1324 overlay : false, 1325 1326 /** 1327 * Whether the page has the WP admin bar or not. 1328 * 1329 * @since 1.0 1330 * @property {Boolean} hasAdminBar 1331 */ 1332 hasAdminBar : false, 1333 1334 /** 1335 * Breakpoint for when the sticky header should apply. 1336 * 1337 * @since 1.4 1338 * @property {String} stickyOn 1339 */ 1340 stickyOn: '', 1341 1342 /** 1343 * A reference of the sticky and shrink header breakpoint. 1344 * 1345 * @since 1.2.5 1346 * @property {Number} breakpointWidth 1347 */ 1348 breakpointWidth: 0, 1349 1350 /** 1351 * Whether this header can be pinned from page load. 1352 * 1353 * @since 1.6.1 1354 * @property {Boolean} pinnable 1355 */ 1356 pinnable : false, 1357 1358 /** 1359 * Initializes header layout logic. 1360 * 1361 * @since 1.0 1362 * @method init 1363 */ 1364 init: function() 1365 { 1366 var editing = $( 'html.fl-builder-edit' ).length, 1367 header = $( '.fl-builder-content[data-type=header]' ), 1368 menuModule = header.find( '.fl-module-menu' ), 1369 breakpoint = null, 1370 adminBarHeight = 0; 1371 1372 if ( ! editing && header.length ) { 1373 1374 header.imagesLoaded( $.proxy( function() { 1375 1376 this.win = $( window ); 1377 this.body = $( 'body' ); 1378 this.header = header.eq( 0 ); 1379 this.overlay = !! Number( header.attr( 'data-overlay' ) ); 1380 this.hasAdminBar = !! $( 'body.admin-bar' ).length; 1381 this.stickyOn = this.header.data( 'sticky-on' ); 1382 breakpoint = this.header.data( 'sticky-breakpoint' ); 1383 1384 if ( '' == this.stickyOn ) { 1385 if ( typeof FLBuilderLayoutConfig.breakpoints[ breakpoint ] !== undefined ) { 1386 this.breakpointWidth = FLBuilderLayoutConfig.breakpoints[ breakpoint ]; 1387 } 1388 else { 1389 this.breakpointWidth = FLBuilderLayoutConfig.breakpoints.medium; 1390 } 1391 } 1392 1393 if ( Number( header.attr( 'data-sticky' ) ) ) { 1394 1395 this.header.data( 'original-top', this.header.offset().top ); 1396 1397 // The pin decision is made once here, while the header offset and the admin bar height are read from the same layout. 1398 adminBarHeight = $( '#wpadminbar' ).length ? $( '#wpadminbar' ).outerHeight() : 0; 1399 this.pinnable = this.overlay && this.header.data( 'original-top' ) <= adminBarHeight; 1400 1401 this.win.on( 'resize', $.throttle( 500, $.proxy( this._initSticky, this ) ) ); 1402 this._initSticky(); 1403 1404 } 1405 1406 }, this ) ); 1407 } 1408 }, 1409 1410 /** 1411 * Initializes sticky logic for a header. 1412 * 1413 * @since 1.0 1414 * @access private 1415 * @method _initSticky 1416 */ 1417 _initSticky: function( e ) 1418 {
1419 var header = $('.fl-builder-content[data-type=header]'), 1420 windowSize = this.win.width(), 1421 makeSticky = false; 1422 1423 makeSticky = this._makeWindowSticky( windowSize ); 1424 if ( makeSticky || ( this.breakpointWidth > 0 && windowSize >= this.breakpointWidth ) ) { 1425 this.win.on( 'scroll.fl-theme-builder-header-sticky', $.proxy( this._doSticky, this ) ); 1426 this._initPin(); 1427 1428 // Apply the sticky state on initial load when the page is 1429 // already scrolled past the header â e.g. when the browser 1430 // restores the scroll position on refresh. Overlay headers are 1431 // out of scope here; this mirrors the shrink-on-load behavior 1432 // in _initShrink(). 1433 if ( ! e && ! this.overlay && ! this.header.hasClass( 'fl-theme-builder-header-sticky' ) ) { 1434 var loadWinTop = this.win.scrollTop(), 1435 loadHeaderTop = Math.floor( this.header.data( 'original-top' ) ); 1436 1437 if ( this.hasAdminBar && windowSize > 600 ) { 1438 loadWinTop += Math.floor( $( '#wpadminbar' ).outerHeight() ); 1439 } 1440 1441 if ( loadWinTop > loadHeaderTop ) { 1442 this.header.addClass( 'fl-theme-builder-header-sticky' ); 1443 this.header.addClass( 'fl-theme-builder-header-scrolled' ); 1444 this._adjustHeaderHeight(); 1445 this._adjustStickyHeaderWidth(); 1446 } 1447 } 1448 1449 // 1450 // Check if Event Type is 'resize' then invoke this._doSticky() 1451 // only if the 'fl-theme-builder-header-sticky' class is already present. 1452 // 1453 if ( e && 'resize' === e.type ) { 1454 if ( this.header.hasClass( 'fl-theme-builder-header-sticky' ) ) { 1455 this._doSticky( e ); 1456 } 1457 this._adjustStickyHeaderWidth(); 1458 } 1459 1460 if ( Number( header.attr( 'data-shrink' ) ) ) { 1461 this.header.data( 'original-height', this.header.outerHeight() ); 1462 this.win.on( 'resize', $.throttle( 500, $.proxy( this._initShrink, this ) ) ); 1463 this._initShrink(); 1464 } 1465 1466 this._initFlyoutMenuFix( e ); 1467 } else { 1468 this.win.off( 'scroll.fl-theme-builder-header-sticky' ); 1469 this.win.off( 'resize.fl-theme-builder-header-sticky' ); 1470 1471 this.header.removeClass( 'fl-theme-builder-header-sticky' ); 1472 this.header.removeClass( 'fl-theme-builder-header-pinned' ); 1473 this.header.removeAttr( 'style' ); 1474 this.header.parent().css( 'padding-top', '0' ); 1475 } 1476 }, 1477 1478 /** 1479 * Pins an overlay header with fixed positioning from page load, avoiding a position change that a scroll handler cannot apply before the compositor paints. 1480 * 1481 * @since 1.6.1 1482 * @access private 1483 * @method _initPin 1484 */ 1485 _initPin: function() 1486 { 1487 this.header.toggleClass( 'fl-theme-builder-header-pinned', this.pinnable ); 1488 1489 if ( ! this.pinnable ) { 1490 return; 1491 } 1492 1493 // Fixed positioning resolves the width against the viewport, so boxed layouts require their maximum width immediately. 1494 this._adjustStickyHeaderWidth(); 1495 1496 // The header is visible from the first paint, so the scrolled state must reflect any restored scroll position. 1497 if ( this.win.scrollTop() > Math.floor( this.header.data( 'original-top' ) ) ) { 1498 this.header.addClass( 'fl-theme-builder-header-scrolled' ); 1499 } 1500 }, 1501 1502 /** 1503 * Check if Header should be sticky at a particular Window size. 1504 * 1505 * @since 1.4 1506 * @access private 1507 * @param widowSize 1508 * @method _makeWindowSticky 1509 */ 1510 _makeWindowSticky: function ( windowSize ) 1511 { 1512 var makeSticky = false; 1513 1514 switch (this.stickyOn) { 1515 case 'xl': 1516 makeSticky = windowSize > FLBuilderLayoutConfig.breakpoints['large']; 1517 break; 1518 case '': // Default 1519 case 'desktop': 1520 makeSticky = windowSize >= FLBuilderLayoutConfig.breakpoints['medium']; 1521 break; 1522 case 'desktop-medium': 1523 makeSticky = windowSize > FLBuilderLayoutConfig.breakpoints['small']; 1524 break; 1525 case 'large': 1526 makeSticky = windowSize > FLBuilderLayoutConfig.breakpoints['medium'] && windowSize <= FLBuilderLayoutConfig.breakpoints['large']; 1527 break; 1528 case 'large-medium': 1529 makeSticky = windowSize > FLBuilderLayoutConfig.breakpoints['small'] && windowSize <= FLBuilderLayoutConfig.breakpoints['large']; 1530 break; 1531 case 'medium': 1532 makeSticky = ( windowSize <= FLBuilderLayoutConfig.breakpoints['medium'] && windowSize > FLBuilderLayoutConfig.breakpoints['small'] ); 1533 break; 1534 case 'medium-mobile':
1535 makeSticky = (windowSize <= FLBuilderLayoutConfig.breakpoints['medium']); 1536 break; 1537 case 'mobile': 1538 makeSticky = (windowSize <= FLBuilderLayoutConfig.breakpoints['small']); 1539 break; 1540 case 'all': 1541 makeSticky = true; 1542 break; 1543 } 1544 1545 return makeSticky; 1546 }, 1547 1548 /** 1549 * Sticks the header when the page is scrolled. 1550 * 1551 * @since 1.0 1552 * @access private 1553 * @method _doSticky 1554 */ 1555 _doSticky: function( e ) 1556 { 1557 var winTop = Math.floor( this.win.scrollTop() ), 1558 headerTop = Math.floor( this.header.data( 'original-top' ) ), 1559 hasStickyClass = this.header.hasClass( 'fl-theme-builder-header-sticky' ), 1560 hasScrolledClass = this.header.hasClass( 'fl-theme-builder-header-scrolled' ), 1561 beforeHeader = this.header.prevAll( '.fl-builder-content' ), 1562 bodyTopPadding = parseInt( jQuery('body').css('padding-top') ), 1563 winBarHeight = $('#wpadminbar').length ? $('#wpadminbar').outerHeight() : 0, 1564 headerHeight = 0; 1565 1566 if ( isNaN( bodyTopPadding ) ) { 1567 bodyTopPadding = 0; 1568 } 1569 1570 if ( this.hasAdminBar && this.win.width() > 600 ) { 1571 winTop += Math.floor( winBarHeight ); 1572 } 1573 1574 if ( winTop > headerTop ) { 1575 if ( ! hasStickyClass ) { 1576 if ( e && ( 'scroll' === e.type || 'smartscroll' === e.type ) ) { 1577 this.header.addClass( 'fl-theme-builder-header-sticky' ); 1578 if ( this.overlay && beforeHeader.length ) { 1579 this.header.css( 'top', winBarHeight); 1580 } 1581 } 1582 1583 if ( ! this.overlay ) { 1584 this._adjustHeaderHeight(); 1585 } 1586 } 1587 } 1588 else if ( hasStickyClass ) { 1589 this.header.removeClass( 'fl-theme-builder-header-sticky' ); 1590 this.header.removeAttr( 'style' ); 1591 this.header.parent().css( 'padding-top', '0' ); 1592 } 1593 1594 this._adjustStickyHeaderWidth(); 1595 1596 if ( winTop > headerTop ) { 1597 if ( ! hasScrolledClass ) { 1598 this.header.addClass( 'fl-theme-builder-header-scrolled' ); 1599 } 1600 } else if ( hasScrolledClass ) { 1601 this.header.removeClass( 'fl-theme-builder-header-scrolled' ); 1602 } 1603 1604 this._flyoutMenuFix( e ); 1605 }, 1606 1607 /** 1608 * Initializes flyout menu fixes on sticky header. 1609 * 1610 * @since 1.4.1 1611 * @method _initFlyoutMenuFix 1612 */ 1613 _initFlyoutMenuFix: function( e ) { 1614 var header = this.header, 1615 menuModule = header.closest( '.fl-menu' ), 1616 flyoutMenu = menuModule.find( '.fl-menu-mobile-flyout' ), 1617 isPushMenu = menuModule.hasClass( 'fl-menu-responsive-flyout-push' ) || menuModule.hasClass( 'fl-menu-responsive-flyout-push-opacity' ), 1618 isOverlay = menuModule.hasClass( 'fl-menu-responsive-flyout-overlay' ), 1619 flyoutPos = menuModule.hasClass( 'fl-flyout-right' ) ? 'right' : 'left', 1620 flyoutParent = header.parent().is( 'header' ) ? header.parent().parent() : header.parent(); 1621 isFullWidth = this.win.width() === header.width(), 1622 flyoutLayout = '', 1623 activePos = 250, 1624 headerPos = 0; 1625 1626 if ( ! flyoutMenu.length ) { 1627 return; 1628 } 1629 1630 if ( this.win.width() > header.parent().width() ) { 1631 headerPos = ( this.win.width() - header.width() ) / 2; 1632 } 1633 1634 if ( isOverlay ) { 1635 activePos = headerPos; 1636 } 1637 else if ( isPushMenu ) { 1638 activePos = activePos + headerPos; 1639 } 1640 flyoutMenu.data( 'activePos', activePos ); 1641 1642 if ( isPushMenu ) { 1643 flyoutLayout = 'push-' + flyoutPos; 1644 } 1645 else if ( isOverlay ) { 1646 flyoutLayout = 'overlay-' + flyoutPos; 1647 } 1648 1649 if ( isPushMenu && ! $( 'html' ).hasClass( 'fl-theme-builder-has-flyout-menu' ) ) { 1650 $( 'html' ).addClass( 'fl-theme-builder-has-flyout-menu' ); 1651 } 1652 1653 if ( ! flyoutParent.hasClass( 'fl-theme-builder-flyout-menu-' + flyoutLayout ) ) { 1654 flyoutParent.addClass( 'fl-theme-builder-flyout-menu-' + flyoutLayout ); 1655 } 1656 1657 if ( ! header.hasClass( 'fl-theme-builder-flyout-menu-overlay' ) && isOverlay ) { 1658 header.addClass( 'fl-theme-builder-flyout-menu-overlay' ); 1659 } 1660 1661 if ( ! header.hasClass( 'fl-theme-builder-header-full-width' ) && isFullWidth ) { 1662 header.addClass( 'fl-theme-builder-header-full-width' ); 1663 } 1664 else if ( ! isFullWidth ) { 1665 header.removeClass( 'fl-theme-builder-header-full-width' ); 1666 } 1667 1668 menuModule.on( 'click', '.fl-menu-mobile-toggle', $.proxy( function( event ){ 1669 if ( menuModule.find( '.fl-menu-mobile-toggle.fl-active' ).length ) {
1670 $( 'html' ).addClass( 'fl-theme-builder-flyout-menu-active' ); 1671 event.stopImmediatePropagation(); 1672 } 1673 else { 1674 $( 'html' ).removeClass( 'fl-theme-builder-flyout-menu-active' ); 1675 } 1676 1677 this._flyoutMenuFix( event ); 1678 }, this ) ); 1679 }, 1680 1681 /** 1682 * Fix flyout menu inside the sticky header. 1683 * 1684 * @since 1.4.1 1685 * @method _flyoutMenuFix 1686 */ 1687 _flyoutMenuFix: function( e ){ 1688 var header = this.header, 1689 menuModule = $( e.target ).closest( '.fl-menu' ), 1690 flyoutMenu = menuModule.find( '.fl-menu-mobile-flyout' ), 1691 flyoutPos = menuModule.hasClass( 'fl-flyout-right' ) ? 'right' : 'left', 1692 menuOpacity = menuModule.find( '.fl-menu-mobile-opacity' ), 1693 isScroll = 'undefined' !== typeof e && 'scroll' === e.handleObj.type, 1694 activePos = 'undefined' !== typeof flyoutMenu.data( 'activePos' ) ? flyoutMenu.data( 'activePos' ) : 0, 1695 headerPos = ( this.win.width() - header.width() ) / 2, 1696 inactivePos = headerPos > 0 ? activePos + 4 : 254; 1697 1698 if ( ! flyoutMenu.length ) { 1699 return; 1700 } 1701 1702 if ( this.overlay ) { 1703 return; 1704 } 1705 1706 if( $( '.fl-theme-builder-flyout-menu-active' ).length ) { 1707 1708 if ( isScroll && ! flyoutMenu.hasClass( 'fl-menu-disable-transition' ) ) { 1709 flyoutMenu.addClass( 'fl-menu-disable-transition' ); 1710 } 1711 1712 if ( header.hasClass( 'fl-theme-builder-header-sticky' ) ) { 1713 if ( ! isScroll ) { 1714 setTimeout( $.proxy( function(){ 1715 flyoutMenu.css( flyoutPos, '-' + activePos + 'px' ); 1716 }, this ), 1 ); 1717 } 1718 else { 1719 flyoutMenu.css( flyoutPos, '-' + activePos + 'px' ); 1720 } 1721 } 1722 else { 1723 flyoutMenu.css( flyoutPos, '0px' ); 1724 } 1725 } 1726 else { 1727 if ( flyoutMenu.hasClass( 'fl-menu-disable-transition' ) ) { 1728 flyoutMenu.removeClass( 'fl-menu-disable-transition' ); 1729 } 1730 1731 if ( header.hasClass( 'fl-theme-builder-flyout-menu-overlay' ) && headerPos > 0 && headerPos < 250 ) { 1732 if ( header.hasClass( 'fl-theme-builder-header-sticky' ) ) { 1733 inactivePos = headerPos + 254; 1734 } 1735 else { 1736 inactivePos = 254; 1737 } 1738 } 1739 1740 if ( e && e.type === 'resize' ) { 1741 inactivePos = headerPos + 254; 1742 } 1743 1744 flyoutMenu.css( flyoutPos, '-' + inactivePos + 'px' ); 1745 } 1746 1747 if ( e && menuModule.is('.fl-menu-responsive-flyout-overlay') && $.infinitescroll ) { 1748 e.stopImmediatePropagation(); 1749 } 1750 1751 if( menuOpacity.length ) { 1752 if ( header.hasClass( 'fl-theme-builder-header-sticky' ) ) { 1753 if ( '0px' === menuOpacity.css( 'left' ) ) { 1754 menuOpacity.css( 'left', '-' + headerPos + 'px' ); 1755 } 1756 } 1757 else { 1758 menuOpacity.css( 'left', '' ); 1759 } 1760 } 1761 }, 1762 1763 /** 1764 * Adjust sticky header width if BB Theme Boxed Layout is used. 1765 * 1766 * @since 1.4 1767 * @access private 1768 * @method _adjustStickyHeaderWidth 1769 */ 1770 _adjustStickyHeaderWidth: function () { 1771 if ( $('body').hasClass( 'fl-fixed-width' ) ) { 1772 var parentWidth = this.header.parent().width(); 1773 1774 // Better if this is set in the stylesheet file. 1775 if ( this.win.width() >= 992 ) { 1776 this.header.css({ 1777 'margin': '0 auto', 1778 'max-width': parentWidth, 1779 }); 1780 } 1781 else { 1782 this.header.css({ 1783 'margin': '', 1784 'max-width': '', 1785 }); 1786 } 1787 } 1788 }, 1789 1790 /** 1791 * Adjust Sticky Header Height 1792 * 1793 * @since 1.4 1794 * @access private 1795 * @method _adjustHeaderHeight 1796 */ 1797 _adjustHeaderHeight: function () { 1798 var beforeHeader = this.header.prevAll('.fl-builder-content'), 1799 beforeHeaderHeight = 0, 1800 beforeHeaderFix = 0, 1801 headerHeight = Math.floor( this.header.outerHeight() ), 1802 bodyTopPadding = parseInt( $( 'body' ).css( 'padding-top' ) ), 1803 wpAdminBarHeight = 0, 1804 totalHeaderHeight = 0; 1805 1806 if ( isNaN( bodyTopPadding ) ) { 1807 bodyTopPadding = 0; 1808 } 1809 1810 if ( beforeHeader.length ) { 1811 $.each( beforeHeader, function() { 1812 beforeHeaderHeight += Math.floor( $(this).outerHeight() ); 1813 }); 1814 // Subtract this value from the header parent's top padding. 1815 beforeHeaderFix = 2; 1816 } 1817 1818 if ( this.hasAdminBar && this.win.width() <= 600 ) { 1819 wpAdminBarHeight = Math.floor( $('#wpadminbar').outerHeight() ); 1820 } 1821 1822 totalHeaderHeight = Math.floor( beforeHeaderHeight + headerHeight); 1823 1824 if ( headerHeight > 0 ) { 1825 var headerParent = this.header.parent(), 1826 headerParentTopPadding = 0; 1827 1828 // If the header's parent container is the BODY tag ignore its top padding. 1829 if ( $( headerParent ).is('body') ) { 1830 headerParentTopPadding = Math.floor( headerHeight - wpAdminBarHeight ); 1831 } else { 1832 headerParentTopPadding = Math.floor( headerHeight - bodyTopPadding - wpAdminBarHeight ); 1833 } 1834 1835 $( headerParent ).css( 'padding-top', ( headerParentTopPadding - beforeHeaderFix ) + 'px' ); 1836 1837 this.header.css({ 1838 '-webkit-transform': 'translate(0px, -' + totalHeaderHeight + 'px)', 1839 '-ms-transform': 'translate(0px, -' + totalHeaderHeight + 'px)', 1840 'transform': 'translate(0px, -' + totalHeaderHeight + 'px)' 1841 }); 1842 1843 } 1844 1845 }, 1846 1847 /** 1848 * Initializes shrink logic for a header. 1849 * 1850 * @since 1.0 1851 * @access private 1852 * @method _initShrink 1853 */ 1854 _initShrink: function( e ) 1855 { 1856 if ( this.win.width() >= this.breakpointWidth ) {
1857 this.win.on( 'scroll.fl-theme-builder-header-shrink', $.proxy( this._doShrink, this ) ); 1858 this._setImageMaxHeight(); 1859 1860 if ( this.win.scrollTop() > 0 ){ 1861 this._doShrink(); 1862 } 1863 1864 } else { 1865 this.header.parent().css( 'padding-top', '0' ); 1866 this.win.off( 'scroll.fl-theme-builder-header-shrink' ); 1867 this._removeShrink(); 1868 this._removeImageMaxHeight(); 1869 } 1870 }, 1871 1872 /** 1873 * Shrinks the header when the page is scrolled. 1874 * 1875 * @since 1.0 1876 * @access private 1877 * @method _doShrink 1878 */ 1879 _doShrink: function( e ) 1880 { 1881 var winTop = this.win.scrollTop(), 1882 headerTop = this.header.data('original-top'), 1883 headerHeight = this.header.data('original-height'), 1884 shrinkImageHeight = this.header.data('shrink-image-height'), 1885 windowSize = this.win.width(), 1886 makeSticky = this._makeWindowSticky( windowSize ), 1887 hasClass = this.header.hasClass( 'fl-theme-builder-header-shrink' ); 1888 1889 1890 if ( this.hasAdminBar ) { 1891 winTop += 32; 1892 } 1893 1894 if ( makeSticky && ( winTop > headerTop + headerHeight ) ) { 1895 if ( ! hasClass ) { 1896 1897 this.header.addClass( 'fl-theme-builder-header-shrink' ); 1898 1899 // Shrink images but don't include lightbox and menu images. 1900 this.header.find('img').each( function( i ) { 1901 var image = $( this ), 1902 maxMegaMenu = image.closest( '.max-mega-menu' ).length, 1903 imageInLightbox = image.closest( '.fl-button-lightbox-content' ).length, 1904 imageInNavMenu = image.closest( 'li.menu-item' ).length; 1905 1906 if ( ! ( imageInLightbox || imageInNavMenu || maxMegaMenu ) ) { 1907 image.css( 'max-height', shrinkImageHeight ); 1908 } 1909 1910 }); 1911 1912 this.header.find( '.fl-row-content-wrap' ).each( function() { 1913 1914 var row = $( this ); 1915 1916 if ( parseInt( row.css( 'padding-bottom' ) ) > 5 ) { 1917 row.addClass( 'fl-theme-builder-header-shrink-row-bottom' ); 1918 } 1919 1920 if ( parseInt( row.css( 'padding-top' ) ) > 5 ) { 1921 row.addClass( 'fl-theme-builder-header-shrink-row-top' ); 1922 } 1923 } ); 1924 1925 this.header.find( '.fl-module' ).each( function() { 1926 1927 var module = $( this ).find( '.fl-module-content' ).length ? $( this ).find( '.fl-module-content' ) : $( this ); 1928 1929 if ( parseInt( module.css( 'margin-bottom' ) ) > 5 ) { 1930 module.addClass( 'fl-theme-builder-header-shrink-module-bottom' ); 1931 } 1932 1933 if ( parseInt( module.css( 'margin-top' ) ) > 5 ) { 1934 module.addClass( 'fl-theme-builder-header-shrink-module-top' ); 1935 } 1936 } ); 1937 } 1938 } else if (hasClass) { 1939 this.header.find( 'img' ).css( 'max-height', '' ); 1940 this._removeShrink(); 1941 } 1942 1943 // Fixes Shrink header issue with BB Theme when window is scrolled then resized and back. 1944 if ( 'undefined' === typeof( e ) && $('body').hasClass( 'fl-fixed-width' ) ) { 1945 if ( ! this.overlay ) { 1946 this._adjustHeaderHeight(); 1947 } 1948 } 1949 1950 }, 1951 1952 /** 1953 * Removes the header shrink effect. 1954 * 1955 * @since 1.0 1956 * @access private 1957 * @method _removeShrink 1958 */ 1959 _removeShrink: function() 1960 { 1961 var rows = this.header.find( '.fl-row-content-wrap' ), 1962 modules = this.header.find('.fl-module, .fl-module-content'); 1963 1964 rows.removeClass( 'fl-theme-builder-header-shrink-row-bottom' ); 1965 rows.removeClass( 'fl-theme-builder-header-shrink-row-top' ); 1966 modules.removeClass( 'fl-theme-builder-header-shrink-module-bottom' ); 1967 modules.removeClass( 'fl-theme-builder-header-shrink-module-top' ); 1968 this.header.removeClass( 'fl-theme-builder-header-shrink' ); 1969 }, 1970 1971 /** 1972 * Adds max height to images in modules for smooth scrolling. 1973 * 1974 * @since 1.1.1 1975 * @access private 1976 * @method _setImageMaxHeight 1977 */ 1978 _setImageMaxHeight: function() 1979 { 1980 var head = $( 'head' ), 1981 stylesId = 'fl-header-styles-' + this.header.data( 'post-id' ), 1982 styles = '', 1983 images = this.header.find( '.fl-module img' ); 1984 1985 if ( $( '#' + stylesId ).length ) { 1986 return; 1987 } 1988 1989 images.each( function( i ) { 1990 var image = $( this ), 1991 height = image.height(), 1992 node = image.closest( '.fl-module' ).data( 'node' ), 1993 className = 'fl-node-' + node + '-img-' + i, 1994 maxMegaMenu = image.closest( '.max-mega-menu' ).length, 1995 imageInLightbox = image.closest( '.fl-button-lightbox-content' ).length, 1996 imageInNavMenu = image.closest( 'li.menu-item' ).length; 1997 1998 if ( ! ( imageInLightbox || imageInNavMenu || maxMegaMenu ) ) { 1999 image.addClass( className ); 2000 styles += '.' + className + ' { max-height: ' + ( height ? height : image[0].height ) + 'px }'; 2001 } 2002 2003 } ); 2004
2005 if ( '' !== styles ) { 2006 head.append( '<style id="' + stylesId + '">' + styles + '</style>' ); 2007 } 2008 }, 2009 2010 /** 2011 * Removes max height on images in modules for smooth scrolling. 2012 * 2013 * @since 1.1.1 2014 * @access private 2015 * @method _removeImageMaxHeight 2016 */ 2017 _removeImageMaxHeight: function() 2018 { 2019 $( '#fl-header-styles-' + this.header.data( 'post-id' ) ).remove(); 2020 }, 2021 }; 2022 2023 $( function() { FLThemeBuilderHeaderLayout.init(); } ); 2024 2025})(jQuery); 2026 2027jQuery(function($) { 2028 2029 $(function() { 2030 $( '.fl-node-3vbmxca1g7hy .fl-photo-img' ) 2031 .on( 'mouseenter', function( e ) { 2032 $( this ).data( 'title', $( this ).attr( 'title' ) ).removeAttr( 'title' ); 2033 } ) 2034 .on( 'mouseleave', function( e ){ 2035 $( this ).attr( 'title', $( this ).data( 'title' ) ).data( 'title', null ); 2036 } ); 2037 }); 2038 window._fl_string_to_slug_regex = 'a-zA-Z0-9'; 2039}); 2040 2041var pp_menu_uwhteiqlyc5s; 2042(function($) { 2043 2044 pp_menu_uwhteiqlyc5s = new PPAdvancedMenu({ 2045 id: 'uwhteiqlyc5s', 2046 type: 'vertical', 2047 mobile: 'expanded', 2048 menuPosition: 'below', 2049 breakpoints: { 2050 large: 1200, 2051 medium: 992, 2052 small: 768, 2053 custom: 768 }, 2054 mobileBreakpoint: 'mobile', 2055 mediaBreakpoint: '768', 2056 mobileMenuType: 'default', 2057 offCanvasDirection: 'left', 2058 fullScreenAnimation: '', 2059 isBuilderActive: false }); 2060 2061})(jQuery); 2062 2063/* Start Layout Custom JS */ 2064 2065/* End Layout Custom JS */ 2066 2067 2068 2069/* Start Layout Custom JS */ 2070 2071/* End Layout Custom JS */ 2072 2073
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.