1( function () { 2 'use strict'; 3 4 var LAYOUT_CLASSES = [ 5 'elementor-nav-menu--layout-horizontal', 6 'elementor-nav-menu--layout-vertical', 7 'elementor-nav-menu--layout-dropdown', 8 ]; 9 10 function getBreakpoints() { 11 var cfg = window.elementorFrontendConfig; 12 var bp = cfg && cfg.responsive && cfg.responsive.breakpoints || {}; 13 return { 14 mobile : ( bp.mobile && bp.mobile.value ) || 767, 15 tablet : ( bp.tablet && bp.tablet.value ) || 1024, 16 }; 17 } 18 19 function getActiveLayout( el, bp ) { 20 var w = window.innerWidth; 21 22 // Native Elementor Breakpoint: dropdown-mobile / dropdown-tablet class 23 // takes priority over ECS responsive layout variables. 24 if ( w <= bp.mobile && el.classList.contains( 'elementor-nav-menu--dropdown-mobile' ) ) { 25 return 'dropdown'; 26 } 27 if ( w <= bp.tablet && el.classList.contains( 'elementor-nav-menu--dropdown-tablet' ) ) { 28 return 'dropdown'; 29 } 30 31 // ECS responsive layout â read the CSS custom property that our responsive 32 // selectors set at the correct @media breakpoint. 33 var style = window.getComputedStyle( el ); 34 var mainDisplay = style.getPropertyValue( '--ecs-nav-main-display' ).trim(); 35 var mainDir = style.getPropertyValue( '--ecs-nav-main-dir' ).trim(); 36 37 if ( mainDisplay === 'none' ) { return 'dropdown'; } 38 if ( mainDir === 'column' ) { return 'vertical'; } 39 return 'horizontal'; 40 } 41 42 function syncAll() { 43 var bp = getBreakpoints(); 44 var els = document.querySelectorAll( 45 '.ecs-nav-layout-horizontal,.ecs-nav-layout-vertical,.ecs-nav-layout-dropdown' 46 );
47 els.forEach( function ( el ) { 48 var layout = getActiveLayout( el, bp ); 49 LAYOUT_CLASSES.forEach( function ( c ) { el.classList.remove( c ); } ); 50 el.classList.add( 'elementor-nav-menu--layout-' + layout ); 51 } ); 52 } 53 54 // Register before Elementor Pro scripts (which load in the footer). 55 // This script is enqueued in the <head> so our DOMContentLoaded listener 56 // fires before theirs, ensuring the correct layout class is set when 57 // SmartMenus and the nav-menu widget initialise. 58 document.addEventListener( 'DOMContentLoaded', syncAll ); 59 window.addEventListener( 'resize', syncAll ); 60} )();
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.