1( function( $ ) { 2 3 /** 4 * Search widget JS 5 */ 6 7 var WidgethfeSearchButton = function( $scope, $ ){ 8 9 if ( 'undefined' == typeof $scope ) 10 return; 11 12 var $input = $scope.find( "input.hfe-search-form__input" ); 13 var $clear = $scope.find( "button#clear" ); 14 var $clear_with_button = $scope.find( "button#clear-with-button" ); 15 var $search_button = $scope.find( ".hfe-search-submit" ); 16 var $toggle_search = $scope.find( ".hfe-search-icon-toggle input" ); 17 18 $scope.find( '.hfe-search-icon-toggle' ).on( 'click', function( ){ 19 $scope.find( ".hfe-search-form__input" ).trigger( 'focus' ); 20 }); 21 22 $scope.find( ".hfe-search-form__input" ).on( 'focus', function(){ 23 $scope.find( ".hfe-search-button-wrapper" ).addClass( "hfe-input-focus" ); 24 }); 25 26 $scope.find( ".hfe-search-form__input" ).blur( function() { 27 $scope.find( ".hfe-search-button-wrapper" ).removeClass( "hfe-input-focus" ); 28 }); 29 30 31 $search_button.on( 'touchstart click', function(){ 32 $input.submit(); 33 }); 34 35 $toggle_search.css( 'padding-right', $toggle_search.next().outerWidth() + 'px' ); 36 37 38 $input.on( 'keyup', function(){ 39 $clear.style = (this.value.length) ? $clear.css('visibility','visible'): $clear.css('visibility','hidden'); 40 $clear_with_button.style = (this.value.length) ? $clear_with_button.css('visibility','visible'): $clear_with_button.css('visibility','hidden'); 41 $clear_with_button.css( 'right', $search_button.outerWidth() + 'px' ); 42 }); 43 44 $clear.on("click",function(){ 45 this.style = $clear.css('visibility','hidden'); 46 $input.value = ""; 47 }); 48 $clear_with_button.on("click",function(){ 49 this.style = $clear_with_button.css('visibility','hidden'); 50 $input.value = ""; 51 }); 52 53 }; 54 /** 55 * Nav Menu handler Function. 56 * 57 */ 58 var WidgethfeNavMenuHandler = function( $scope, $ ) { 59 60 if ( 'undefined' == typeof $scope ) 61 return; 62 63 var id = $scope.data( 'id' ); 64 var wrapper = $scope.find('.elementor-widget-hfe-nav-menu '); 65 var layout = $( '.elementor-element-' + id + ' .hfe-nav-menu' ).data( 'layout' ); 66 var flyout_data = $( '.elementor-element-' + id + ' .hfe-flyout-wrapper' ).data( 'flyout-class' ); 67 var last_item = $( '.elementor-element-' + id + ' .hfe-nav-menu' ).data( 'last-item' ); 68 var last_item_flyout = $( '.elementor-element-' + id + ' .hfe-flyout-wrapper' ).data( 'last-item' ); 69 70 var menu_items_links = $( '.elementor-element-' + id + ' .hfe-nav-menu nav li a' ); 71 var menu_items_links_flyout = $( '.elementor-element-' + id + ' .hfe-flyout-wrapper li a' ); 72 if (menu_items_links.length > 0) { 73 _handle_current_menu_item_class( menu_items_links ); 74 } 75 76 if (menu_items_links_flyout.length > 0) { 77 _handle_current_menu_item_class( menu_items_links_flyout ); 78 } 79 80 $( 'div.hfe-has-submenu-container' ).removeClass( 'sub-menu-active' ); 81 82 _toggleClick( id ); 83 84 _handlePolylangSwitcher( $scope ); 85 86 _handleSinglePageMenu( id, layout ); 87 88 if( 'horizontal' !== layout ){ 89 90 _eventClick( id ); 91 }else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 767px )" ).matches ) { 92 93 _eventClick( id ); 94 }else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 1024px )" ).matches ) { 95 96 _eventClick( id ); 97 } 98 99 $( '.elementor-element-' + id + ' .hfe-flyout-trigger .hfe-nav-menu-icon' ).off( 'click keyup' ).on( 'click keyup', function() { 100 101 _openMenu( id ); 102 } ); 103 104 $( '.elementor-element-' + id + ' .hfe-flyout-close' ).off( 'click keyup' ).on( 'click keyup', function() { 105 106 _closeMenu( id ); 107 } ); 108 109 $( '.elementor-element-' + id + ' .hfe-flyout-overlay' ).off( 'click' ).on( 'click', function() { 110 111 _closeMenu( id ); 112 } ); 113 114 115 $scope.find( '.sub-menu' ).each( function() { 116 117 var parent = $( this ).closest( '.menu-item' ); 118 119 $scope.find( parent ).addClass( 'parent-has-child' ); 120 $scope.find( parent ).removeClass( 'parent-has-no-child' ); 121 }); 122 123 if( ( 'cta' == last_item || 'cta' == last_item_flyout ) && 'expandible' != layout ){ 124 $( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).parent().addClass( 'hfe-button-wrapper elementor-widget-button' ); 125 $( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).addClass( 'elementor-button' ); 126 } 127 128 _borderClass( id ); 129 130 $( window ).on( 'resize', function(){ 131 132 if( 'horizontal' !== layout ) { 133 134 _eventClick( id ); 135 }else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 767px )" ).matches ) { 136 137 _eventClick( id ); 138 }else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 1024px )" ).matches ) { 139 140 _eventClick( id ); 141 } 142 143 if( 'horizontal' == layout && window.matchMedia( "( min-width: 977px )" ).matches){ 144 145 $( '.elementor-element-' + id + ' div.hfe-has-submenu-container' ).next().css( 'position', 'absolute'); 146 } 147 148 if( 'expandible' == layout || 'flyout' == layout ){ 149 150 _toggleClick( id ); 151 }else if ( 'vertical' == layout || 'horizontal' == layout ) { 152 if( window.matchMedia( "( max-width: 767px )" ).matches && ($( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile'))){ 153 154 _toggleClick( id ); 155 }else if ( window.matchMedia( "( max-width: 1024px )" ).matches && $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') ) { 156 157 _toggleClick( id ); 158 }else{ 159 var $toggle = $( '.elementor-element-' + id + ' .hfe-nav-menu__toggle' ); 160 var $nextElement= $toggle.next(); 161 var width = $nextElement.parent().width(); 162 if( $nextElement.length ){ 163 $nextElement.css( 'width', width + 'px' ); 164 $nextElement.css( 'left', '0' ); 165 } 166 } 167 } 168 169 _borderClass( id ); 170 171 }); 172 173 // Acessibility functions 174 175 $scope.find( '.parent-has-child .hfe-has-submenu-container a').attr( 'aria-haspopup', 'true' ); 176 $scope.find( '.parent-has-child .hfe-has-submenu-container a').attr( 'aria-expanded', 'false' ); 177 178 var hef_navmenu_toggle = $scope.find( '.hfe-nav-menu__toggle' ); 179 hef_navmenu_toggle.attr( 'aria-haspopup', 'true' ); 180 hef_navmenu_toggle.attr( 'aria-expanded', 'false' ); 181 182 if ( window.matchMedia( "( max-width: 1024px )" ).matches && $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') ) { 183 hef_navmenu_toggle.find('i').attr('aria-hidden', 'false'); 184 } 185 if ( window.matchMedia( "( max-width: 768px )" ).matches && $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile') ) { 186 hef_navmenu_toggle.find('i').attr('aria-hidden', 'false'); 187 } 188 189 // End of accessibility functions 190 191 $( document ).trigger( 'hfe_nav_menu_init', id ); 192 193 // Add keyboard navigation for expandable menu 194 if ( 'expandible' === layout ) { 195 $( '.elementor-element-' + id + ' nav' ).on( 'keydown', function(e) { 196 var $currentElement = $( document.activeElement ); 197 var $menuItems = $( this ).find( 'li > a:visible' ); 198 var currentIndex = $menuItems.index( $currentElement ); 199 200 switch( e.key ) { 201 case 'Escape': // Escape key - close menu 202 $( '.elementor-element-' + id + ' .hfe-nav-menu__toggle' ).trigger( 'click' ); 203 $( '.elementor-element-' + id + ' .hfe-nav-menu__toggle' ).focus(); 204 e.preventDefault(); 205 break; 206 case 'ArrowDown': // Down arrow 207 if ( currentIndex < $menuItems.length - 1 ) { 208 $menuItems.eq( currentIndex + 1 ).focus(); 209 } 210 e.preventDefault(); 211 break; 212 case 'ArrowUp': // Up arrow 213 if ( currentIndex > 0 ) { 214 $menuItems.eq( currentIndex - 1 ).focus(); 215 } 216 e.preventDefault(); 217 break; 218 case 'Tab': // Tab key 219 // Let default tab behavior work but close menu when tabbing out 220 if ( e.shiftKey && currentIndex === 0 ) { 221 // Shift+Tab on first item - close menu 222 setTimeout(function() { 223 if ( !$( '.elementor-element-' + id + ' nav' ).find( ':focus' ).length ) { 224 $( '.elementor-element-' + id + ' .hfe-nav-menu__toggle' ).trigger( 'click' ); 225 } 226 }, 10); 227 } else if ( !e.shiftKey && currentIndex === $menuItems.length - 1 ) { 228 // Tab on last item - close menu 229 setTimeout(function() { 230 if ( !$( '.elementor-element-' + id + ' nav' ).find( ':focus' ).length ) { 231 $( '.elementor-element-' + id + ' .hfe-nav-menu__toggle' ).trigger( 'click' ); 232 } 233 }, 10); 234 } 235 break; 236 } 237 }); 238 } 239 240 $( '.elementor-element-' + id + ' div.hfe-has-submenu-container' ).on( 'keyup', function(e){ 241 242 var $this = $( this ); 243 244 // Handle Enter and Space keys for submenu toggle 245 if ( e.key === 'Enter' || e.key === 'Space' ) { 246 e.preventDefault(); 247 e.stopPropagation(); 248 } else { 249 return; // Only handle Enter and Space keys 250 } 251 252 if( $this.parent().hasClass( 'menu-active' ) ) { 253 254 $this.parent().removeClass( 'menu-active' ); 255 $this.attr( 'aria-expanded', 'false' ); 256 257 $this.parent().next().find('ul').css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } ); 258 $this.parent().prev().find('ul').css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } ); 259 260 $this.parent().next().find( 'div.hfe-has-submenu-container' ).removeClass( 'sub-menu
260-active' ); 261 $this.parent().prev().find( 'div.hfe-has-submenu-container' ).removeClass( 'sub-menu-active' ); 262 }else { 263 264 $this.parent().next().find('ul').css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } ); 265 $this.parent().prev().find('ul').css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } ); 266 267 $this.parent().next().find( 'div.hfe-has-submenu-container' ).removeClass( 'sub-menu-active' ); 268 $this.parent().prev().find( 'div.hfe-has-submenu-container' ).removeClass( 'sub-menu-active' ); 269 270 $this.parent().siblings().find( '.hfe-has-submenu-container a' ).attr( 'aria-expanded', 'false' ); 271 272 $this.parent().next().removeClass( 'menu-active' ); 273 $this.parent().prev().removeClass( 'menu-active' ); 274 275 event.preventDefault(); 276 277 $this.parent().addClass( 'menu-active' ); 278 279 if( 'horizontal' !== layout ){ 280 $this.addClass( 'sub-menu-active' ); 281 } 282 283 $this.find( 'a' ).attr( 'aria-expanded', 'true' ); 284 $this.attr( 'aria-expanded', 'true' ); 285 286 $this.next().css( { 'visibility': 'visible', 'opacity': '1', 'height': 'auto' } ); 287 288 if ( 'horizontal' !== layout ) { 289 290 $this.next().css( 'position', 'relative'); 291 } else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 767px )" ).matches && ($( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile'))) { 292 293 $this.next().css( 'position', 'relative'); 294 } else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 1024px )" ).matches ) { 295 296 if ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') ) { 297 298 $this.next().css( 'position', 'relative'); 299 } else if ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-none') ) { 300 301 $this.next().css( 'position', 'absolute'); 302 } 303 } 304 } 305 }); 306 307 $( '.elementor-element-' + id + ' li.menu-item' ).on( 'keyup', function(e){ 308 var $this = $( this ); 309 310 $this.next().find( 'a' ).attr( 'aria-expanded', 'false' ); 311 $this.prev().find( 'a' ).attr( 'aria-expanded', 'false' ); 312 313 $this.next().find('ul').css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } ); 314 $this.prev().find('ul').css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } ); 315 316 $this.siblings().removeClass( 'menu-active' ); 317 $this.next().find( 'div.hfe-has-submenu-container' ).removeClass( 'sub-menu-active' ); 318 $this.prev().find( 'div.hfe-has-submenu-container' ).removeClass( 'sub-menu-active' ); 319 320 }); 321 }; 322 323 function _handle_current_menu_item_class( layout_links ) { 324 layout_links.each( 325 function () { 326 var $this = $( this ); 327 if ($this.is( '[href*="#"]' )) { 328 var menu_item_parent = $this.parent(); 329 menu_item_parent.removeClass( 'current-menu-item current-menu-ancestor' ); 330 $this.click( 331 function () { 332 var current_index = menu_item_parent.index(), 333 parent_element = $this.closest( 'ul' ); 334 parent_element.find( 'li' ).not( ':eq(' + current_index + ')' ).removeClass( 'current-menu-item current-menu-ancestor' ); 335 menu_item_parent.addClass( 'current-menu-item current-menu-ancestor' ); 336 } 337 ) 338 } 339 } 340 ); 341 } 342 343 function _openMenu( id ) { 344 345 var flyout_content = $( '#hfe-flyout-content-id-' + id ); 346 var layout = $( '#hfe-flyout-content-id-' + id ).data( 'layout' ); 347 var layout_type = $( '#hfe-flyout-content-id-' + id ).data( 'flyout-type' ); 348 var wrap_width = flyout_content.width() + 'px'; 349 var container = $( '.elementor-element-' + id + ' .hfe-flyout-container .hfe-side.hfe-flyout-' + layout ); 350 351 $( '.elementor-element-' + id + ' .hfe-flyout-overlay' ).fadeIn( 100 ); 352 353 if( 'left' == layout ) { 354 355 $( 'body' ).css( 'margin-left' , '0' ); 356 container.css( 'left', '0' ); 357 358 if( 'push' == layout_type ) { 359 360 $( 'body' ).addClass( 'hfe-flyout-animating' ).css({ 361 position: 'absolute', 362 width: '100%', 363 'margin-left' : wrap_width, 364 'margin-right' : 'auto' 365 }); 366 } 367 368 container.addClass( 'hfe-flyout-show' ); 369 } else { 370 371 $( 'body' ).css( 'margin-right', '0' ); 372 container.css( 'right', '0' ); 373 374 if( 'push' == layout_type ) { 375 376 $( 'body' ).addClass( 'hfe-flyout-animating' ).css({ 377 position: 'absolute', 378 width: '100%', 379 'margin-left' : '-' + wrap_width, 380 'margin-right' : 'auto', 381 }); 382 } 383 384 container.addClass( 'hfe-flyout-show' ); 385 } 386 } 387 388 function _closeMenu( id ) { 389 390 var flyout_content = $( '#hfe-flyout-content-id-' + id ); 391 var layout = $( '#hfe-flyout-content-id-' + id ).data( 'layout' ); 392 var wrap_width = flyout_content.width() + 'px'; 393 var layout_type = $( '#hfe-flyout-content-id-' + id ).data( 'flyout-type' ); 394 var container = $( '.elementor-element-' + id + ' .hfe-flyout-container .hfe-side.hfe-flyout-' + layout ); 395 396 $( '.elementor-element-' + id + ' .hfe-flyout-overlay' ).fadeOut( 100 ); 397 398 if( 'left' == layout ) { 399 400 container.css( 'left', '-' + wrap_width ); 401 402 if( 'push' == layout_type ) { 403 404 $( 'body' ).css({ 405 position: '', 406 'margin-left' : '', 407 'margin-right' : '', 408 }); 409 410 setTimeout( function() { 411 $( 'body' ).removeClass( 'hfe-flyout-animating' ).css({ 412 width: '', 413 }); 414 }); 415 } 416 417 container.removeClass( 'hfe-flyout-show' ); 418 } else {
419 container.css( 'right', '-' + wrap_width ); 420 421 if( 'push' == layout_type ) { 422 423 $( 'body' ).css({ 424 position: '', 425 'margin-right' : '', 426 'margin-left' : '', 427 }); 428 429 setTimeout( function() { 430 $( 'body' ).removeClass( 'hfe-flyout-animating' ).css({ 431 width: '', 432 }); 433 }); 434 } 435 container.removeClass( 'hfe-flyout-show' ); 436 } 437 } 438 439 function _eventClick( id ){ 440 441 var layout = $( '.elementor-element-' + id + ' .hfe-nav-menu' ).data( 'layout' ); 442 443 $( '.elementor-element-' + id + ' div.hfe-has-submenu-container' ).off( 'click' ).on( 'click', function( event ) { 444 445 var $this = $( this ); 446 447 if( $( '.elementor-element-' + id ).hasClass( 'hfe-link-redirect-child' ) ) { 448 449 if( $this.hasClass( 'sub-menu-active' ) ) { 450 451 if( ! $this.next().hasClass( 'sub-menu-open' ) ) { 452 453 $this.find( 'a' ).attr( 'aria-expanded', 'false' ); 454 455 if( 'horizontal' !== layout ){ 456 457 event.preventDefault(); 458 459 $this.next().css( 'position', 'relative' ); 460 } else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 767px )" ).matches && ($( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile'))) { 461 462 event.preventDefault(); 463 464 $this.next().css( 'position', 'relative' ); 465 } else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 1024px )" ).matches && ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile'))) { 466 467 event.preventDefault(); 468 469 $this.next().css( 'position', 'relative' ); 470 } 471 472 $this.removeClass( 'sub-menu-active' ); 473 $this.nextAll('.sub-menu').removeClass( 'sub-menu-open' ); 474 $this.nextAll('.sub-menu').css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } ); 475 $this.nextAll('.sub-menu').css( { 'transition': 'none'} ); 476 } else{ 477 478 $this.find( 'a' ).attr( 'aria-expanded', 'false' ); 479 480 $this.removeClass( 'sub-menu-active' ); 481 $this.nextAll('.sub-menu').removeClass( 'sub-menu-open' ); 482 $this.nextAll('.sub-menu').css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } ); 483 $this.nextAll('.sub-menu').css( { 'transition': 'none'} ); 484 485 if ( 'horizontal' !== layout ){ 486 487 $this.next().css( 'position', 'relative' ); 488 } else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 767px )" ).matches && ($( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile'))) { 489 490 $this.next().css( 'position', 'relative' ); 491 492 } else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 1024px )" ).matches && ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile'))) { 493 494 $this.next().css( 'position', 'absolute' ); 495 } 496 } 497 } else { 498 499 $this.find( 'a' ).attr( 'aria-expanded', 'true' ); 500 if ( 'horizontal' !== layout ) { 501 502 event.preventDefault(); 503 $this.next().css( 'position', 'relative'); 504 } else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 767px )" ).matches && ($( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile'))) { 505 506 event.preventDefault(); 507 $this.next().css( 'position', 'relative'); 508 } else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 1024px )" ).matches ) { 509 event.preventDefault(); 510 511 if ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') ) { 512 513 $this.next().css( 'position', 'relative'); 514 } else if ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-none') ) { 515 516 $this.next().css( 'position', 'absolute'); 517 } 518 } 519
520 $this.addClass( 'sub-menu-active' ); 521 $this.nextAll('.sub-menu').addClass( 'sub-menu-open' ); 522 $this.nextAll('.sub-menu').css( { 'visibility': 'visible', 'opacity': '1', 'height': 'auto' } ); 523 $this.nextAll('.sub-menu').css( { 'transition': '0.3s ease'} ); 524 } 525 } 526 }); 527 528 $( '.elementor-element-' + id + ' .hfe-menu-toggle' ).off( 'click keyup' ).on( 'click keyup',function( event ) { 529 530 var $this = $( this ); 531 532 if( $this.parent().parent().hasClass( 'menu-active' ) ) { 533 534 event.preventDefault(); 535 536 $this.parent().parent().removeClass( 'menu-active' ); 537 $this.parent().parent().next().css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } ); 538 539 if ( 'horizontal' !== layout ) { 540 541 $this.parent().parent().next().css( 'position', 'relative'); 542 } else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 767px )" ).matches && ($( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile'))) { 543 544 $this.parent().parent().next().css( 'position', 'relative'); 545 } else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 1024px )" ).matches ) { 546 547 if ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') ) { 548 549 $this.parent().parent().next().css( 'position', 'relative'); 550 } else if ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-none') ) { 551 552 $this.parent().parent().next().css( 'position', 'absolute'); 553 } 554 } 555 }else { 556 557 event.preventDefault(); 558 559 $this.parent().parent().addClass( 'menu-active' ); 560 561 $this.parent().parent().next().css( { 'visibility': 'visible', 'opacity': '1', 'height': 'auto' } ); 562 563 if ( 'horizontal' !== layout ) { 564 565 $this.parent().parent().next().css( 'position', 'relative'); 566 } else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 767px )" ).matches && ($( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile'))) { 567 568 $this.parent().parent().next().css( 'position', 'relative'); 569 } else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 1024px )" ).matches ) { 570 571 if ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') ) { 572 573 $this.parent().parent().next().css( 'position', 'relative'); 574 } else if ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-none') ) { 575 576 $this.parent().parent().next().css( 'position', 'absolute'); 577 } 578 } 579 } 580 }); 581 } 582 583 function _borderClass( id ){ 584 585 var last_item = $( '.elementor-element-' + id + ' .hfe-nav-menu' ).data( 'last-item' ); 586 var last_item_flyout = $( '.elementor-element-' + id + ' .hfe-flyout-wrapper' ).data( 'last-item' ); 587 var layout = $( '.elementor-element-' + id + ' .hfe-nav-menu' ).data( 'layout' ); 588 589 $( '.elementor-element-' + id + ' nav').removeClass('hfe-dropdown'); 590 591 if ( window.matchMedia( "( max-width: 767px )" ).matches ) { 592 593 if( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet')){ 594 595 $( '.elementor-element-' + id + ' nav').addClass('hfe-dropdown'); 596 if( ( 'cta' == last_item || 'cta' == last_item_flyout ) && 'expandible' != layout ){ 597 $( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).parent().removeClass( 'hfe-button-wrapper elementor-widget-button' ); 598 $( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).removeClass( 'elementor-button' ); 599 } 600 }else{ 601 602 $( '.elementor-element-' + id + ' nav').removeClass('hfe-dropdown'); 603 if( ( 'cta' == last_item || 'cta' == last_item_flyout ) && 'expandible' != layout ){ 604 $( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).parent().addClass( 'hfe-button-wrapper elementor-widget-button' ); 605 $( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).addClass( 'elementor-button' ); 606 } 607 } 608 }else if ( window.matchMedia( "( max-width: 1024px )" ).matches ) { 609 610 if( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') ) { 611 612 $( '.elementor-element-' + id + ' nav').addClass('hfe-dropdown'); 613 if( ( 'cta' == last_item || 'cta' == last_item_flyout ) && 'expandible' != layout ){ 614 $( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).parent().removeClass( 'hfe-button-wrapper elementor-widget-button' ); 615 $( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).removeClass( 'elementor-button' ); 616 } 617 }else{ 618 619 $( '.elementor-element-' + id + ' nav').removeClass('hfe-dropdown'); 620 if( ( 'cta' == last_item || 'cta' == last_item_flyout ) && 'expandible' != layout ){ 621 $( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).parent().addClass( 'hfe-button-wrapper elementor-widget-button' ); 622 $( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).addClass( 'elementor-button' ); 623 } 624 } 625 }else { 626 var $parent_element = $( '.elementor-element-' + id ); 627 $parent_element.find( 'nav').removeClass( 'hfe-dropdown' ); 628 if( ( 'cta' == last_item || 'cta' == last_item_flyout ) && 'expandible' != layout ){ 629 $parent_element.find( 'li.menu-item:last-child a.hfe-menu-item' ).parent().addClass( 'hfe-button-wrapper elementor-widget-button' ); 630 $parent_element.find( 'li.menu-item:last-child a.hfe-menu-item' ).addClass( 'elementor-button' ); 631 } 632 } 633 634 var layout = $( '.elementor-element-' + id + ' .hfe-nav-menu' ).data( 'layout' ); 635 if( 'expandible' == layout ){ 636 if( ( 'cta' == last_item || 'cta' == last_item_flyout ) && 'expandible' != layout ){ 637 $( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).parent().removeClass( 'hfe-button-wrapper elementor-widget-button' ); 638 $( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).removeClass( 'elementor-button' ); 639 } 640 } 641 } 642 643 function _toggleClick( id ){ 644 645 if ( $( '.elementor-element-' + id + ' .hfe-nav-menu__toggle' ).hasClass( 'hfe-active-menu-full-width' ) ){ 646 647 var $toggle = $( '.elementor-element-' + id + ' .hfe-nav-menu__toggle' ); 648 var $nextElement= $toggle.next(); 649 650 if( $nextElement.length ){ 651 $nextElement.css( 'left', '0' ); 652 653 var $section = $( '.elementor-element-' + id ).closest('.elementor-section, .e-con-boxed.e-parent, .e-con-full.e-parent'); 654 if ( $section.length ) { 655 var width = $section.outerWidth(); 656 var sec_pos = $section.offset().left - $toggle.next().offset().left; 657 $nextElement.css( 'width', width + 'px' ); 658 $nextElement.css( 'left', sec_pos + 'px' ); 659 } 660 } 661 } 662 663 $( '.elementor-element-' + id + ' .hfe-nav-menu__toggle' ).off( 'click keyup' ).on( 'click keyup', function( event ) { 664 665 // Handle keyboard events properly 666 if ( event.type === 'keyup' && event.key !== 'Enter' && event.key !== 'Space' ) { 667 return; // Only handle Enter and Space keys 668 } 669 670 // Prevent default for keyboard events to avoid scrolling 671 if ( event.type === 'keyup' ) { 672 event.preventDefault(); 673 } 674 675 var $this = $( this ); 676 var $selector = $this.next(); 677 678 if ( $this.hasClass( 'hfe-active-menu' ) ) { 679 680 var layout = $( '.elementor-element-' + id + ' .hfe-nav-menu' ).data( 'layout' ); 681 var full_width = $selector.data( 'full-width' ); 682 var toggle_icon = $( '.elementor-element-' + id + ' nav' ).data( 'toggle-icon' ); 683 684 $( '.elementor-element-' + id).find( '.hfe-nav-menu-icon' ).html( toggle_icon ); 685 686 $this.removeClass( 'hfe-active-menu' ); 687 $this.attr( 'aria-expanded', 'false' ); 688 689 if ( 'yes' == full_width ){ 690 691 $this.removeClass( 'hfe-active-menu-full-width' ); 692 693 $selector.css( 'width', 'auto' ); 694 $selector.css( 'left', '0' ); 695 $selector.css( 'z-index', '0' ); 696 } 697 } else { 698 699 var layout = $( '.elementor-element-' + id + ' .hfe-nav-menu' ).data( 'layout' ); 700 var full_width = $selector.data( 'full-width' ); 701 var close_icon = $( '.elementor-element-' + id + ' nav' ).data( 'close-icon' ); 702 703 $( '.elementor-element-' + id).find( '.hfe-nav-menu-icon' ).html( close_icon ); 704 705 $this.addClass( 'hfe-active-menu' ); 706 $this.attr( 'aria-expanded', 'true' ); 707 708 if ( 'yes' == full_width ){ 709 710 $this.addClass( 'hfe-active-menu-full-width' ); 711 712 var closestElement = $( '.elementor-element-' + id ).closest('.elementor-section, .e-con-boxed.e-parent, .e-con-full.e-parent'); 713 var width = closestElement.outerWidth(); 714 var sec_pos = closestElement.offset().left - $selector.offset().left; 715 716 $selector.css( 'width', width + 'px' ); 717 $selector.css( 'left', sec_pos + 'px' ); 718 $selector.css( 'z-index', '9999' ); 719 } 720 } 721 722 if( $( '.elementor-element-' + id + ' nav' ).hasClass( 'menu-is-active' ) ) { 723 724 $( '.elementor-element-' + id + ' nav' ).removeClass( 'menu-is-active' ); 725 }else { 726 727 $( '.elementor-element-' + id + ' nav' ).addClass( 'menu-is-active' ); 728 729 // Focus on first menu item when menu opens 730 if ( event.type === 'keyup' ) { 731 setTimeout(function() { 732 $selector.find('li:first-child > a').focus(); 733 }, 100); 734 } 735 } 736 } ); 737 } 738 739 function _handleSinglePageMenu( id, layout ) { 740 $( '.elementor-element-' + id + ' ul.hfe-nav-menu li a' ).on( 741 'click', 742 function ( event ) { 743 var $this = $( this ); 744 var link = $this.attr( 'href' ); 745 var linkValue = ''; 746 747 // Check if this is an anchor link 748 if ( link && link.includes( '#' ) ) { 749 // Get the hash value 750 if ( link.charAt(0) === '#' ) { 751 event.preventDefault(); 752 linkValue = link.slice( 1 ); 753 } else { 754 var index = link.indexOf( '#' ); 755 if ( index !== -1 ) { 756 linkValue = link.slice( index + 1 ); 757 } 758 } 759 } 760 761 if ( linkValue.length > 0 ) { 762 var targetSection = $( '#' + linkValue ); 763 764 if ( targetSection.length ) { // Check if the target section exists. 765 $('html, body').animate({ 766 scrollTop: targetSection.offset().top 767 }, 800); 768 } 769 770 // Close the menu after clicking anchor link 771 setTimeout(function() { 772 if ( 'expandible' == layout ) { 773 // For expandible layout, trigger click on toggle if menu is open 774 var $toggle = $( '.elementor-element-' + id + ' .hfe-nav-menu__toggle' ); 775 if ( $toggle.hasClass( 'hfe-active-menu' ) ) { 776 $toggle.trigger( 'click' ); 777 } 778 } else if ( 'flyout' == layout ) { 779 // For flyout layout, use the close menu function 780 _closeMenu( id ); 781 } else { 782 // For horizontal and vertical layouts on mobile/tablet 783 if ( window.matchMedia( '(max-width: 1024px)' ).matches ) { 784 if ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') || 785 $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile') ) { 786 var $toggle = $( '.elementor-element-' + id + ' .hfe-nav-menu__toggle' ); 787 if ( $toggle.hasClass( 'hfe-active-menu' ) ) { 788 $toggle.trigger( 'click' ); 789 } 790 } 791 } 792 } 793 }, 100); // Small delay to ensure smooth scrolling starts first 794 } 795 } 796 ); 797 } 798 799 /** 800 * This function handles polylang plugin's lang switcher if present in the menu. 801 * 802 * @param {Object}
802 $scope The current element(hfe nav menu) wrapped with jQuery. 803 */ 804 function _handlePolylangSwitcher( $scope ) { 805 var polylangSwitcher = $scope.find( '.hfe-nav-menu nav .pll-parent-menu-item a.hfe-menu-item' ); 806 var hrefProperty = polylangSwitcher.prop( 'href' ); 807 if ( undefined !== hrefProperty && hrefProperty.includes( '#' ) ) { 808 var index = hrefProperty.indexOf( '#' ); 809 var value = hrefProperty.slice( index ); 810 if ( value === '#pll_switcher' ) { 811 polylangSwitcher.prop( 'href', '#' ); 812 } 813 } 814 } 815 816 $( window ).on( 'elementor/frontend/init', function () { 817 818 elementorFrontend.hooks.addAction( 'frontend/element_ready/navigation-menu.default', WidgethfeNavMenuHandler ); 819 elementorFrontend.hooks.addAction( 'frontend/element_ready/hfe-search-button.default', WidgethfeSearchButton ); 820 }); 821} )( jQuery );
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.