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 $( '.elementor-element-' + id + ' div.hfe-has-submenu-container' ).on( 'keyup', function(e){ 194 195 var $this = $( this ); 196 197 if( $this.parent().hasClass( 'menu-active' ) ) { 198 199 $this.parent().removeClass( 'menu-active' ); 200 201 $this.parent().next().find('ul').css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } ); 202 $this.parent().prev().find('ul').css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } ); 203 204 $this.parent().next().find( 'div.hfe-has-submenu-container' ).removeClass( 'sub-menu
204-active' ); 205 $this.parent().prev().find( 'div.hfe-has-submenu-container' ).removeClass( 'sub-menu-active' ); 206 }else { 207 208 $this.parent().next().find('ul').css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } ); 209 $this.parent().prev().find('ul').css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } ); 210 211 $this.parent().next().find( 'div.hfe-has-submenu-container' ).removeClass( 'sub-menu-active' ); 212 $this.parent().prev().find( 'div.hfe-has-submenu-container' ).removeClass( 'sub-menu-active' ); 213 214 $this.parent().siblings().find( '.hfe-has-submenu-container a' ).attr( 'aria-expanded', 'false' ); 215 216 $this.parent().next().removeClass( 'menu-active' ); 217 $this.parent().prev().removeClass( 'menu-active' ); 218 219 event.preventDefault(); 220 221 $this.parent().addClass( 'menu-active' ); 222 223 if( 'horizontal' !== layout ){ 224 $this.addClass( 'sub-menu-active' ); 225 } 226 227 $this.find( 'a' ).attr( 'aria-expanded', 'true' ); 228 229 $this.next().css( { 'visibility': 'visible', 'opacity': '1', 'height': 'auto' } ); 230 231 if ( 'horizontal' !== layout ) { 232 233 $this.next().css( 'position', 'relative'); 234 } 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'))) { 235 236 $this.next().css( 'position', 'relative'); 237 } else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 1024px )" ).matches ) { 238 239 if ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') ) { 240 241 $this.next().css( 'position', 'relative'); 242 } else if ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-none') ) { 243 244 $this.next().css( 'position', 'absolute'); 245 } 246 } 247 } 248 }); 249 250 $( '.elementor-element-' + id + ' li.menu-item' ).on( 'keyup', function(e){ 251 var $this = $( this ); 252 253 $this.next().find( 'a' ).attr( 'aria-expanded', 'false' ); 254 $this.prev().find( 'a' ).attr( 'aria-expanded', 'false' ); 255 256 $this.next().find('ul').css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } ); 257 $this.prev().find('ul').css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } ); 258 259 $this.siblings().removeClass( 'menu-active' ); 260 $this.next().find( 'div.hfe-has-submenu-container' ).removeClass( 'sub-menu-active' ); 261 $this.prev().find( 'div.hfe-has-submenu-container' ).removeClass( 'sub-menu-active' ); 262 263 }); 264 }; 265 266 function _handle_current_menu_item_class( layout_links ) { 267 layout_links.each( 268 function () { 269 var $this = $( this ); 270 if ($this.is( '[href*="#"]' )) { 271 var menu_item_parent = $this.parent(); 272 menu_item_parent.removeClass( 'current-menu-item current-menu-ancestor' ); 273 $this.click( 274 function () { 275 var current_index = menu_item_parent.index(), 276 parent_element = $this.closest( 'ul' ); 277 parent_element.find( 'li' ).not( ':eq(' + current_index + ')' ).removeClass( 'current-menu-item current-menu-ancestor' ); 278 menu_item_parent.addClass( 'current-menu-item current-menu-ancestor' ); 279 } 280 ) 281 } 282 } 283 ); 284 } 285 286 function _openMenu( id ) { 287 288 var flyout_content = $( '#hfe-flyout-content-id-' + id ); 289 var layout = $( '#hfe-flyout-content-id-' + id ).data( 'layout' ); 290 var layout_type = $( '#hfe-flyout-content-id-' + id ).data( 'flyout-type' ); 291 var wrap_width = flyout_content.width() + 'px'; 292 var container = $( '.elementor-element-' + id + ' .hfe-flyout-container .hfe-side.hfe-flyout-' + layout ); 293 294 $( '.elementor-element-' + id + ' .hfe-flyout-overlay' ).fadeIn( 100 ); 295 296 if( 'left' == layout ) { 297 298 $( 'body' ).css( 'margin-left' , '0' ); 299 container.css( 'left', '0' ); 300 301 if( 'push' == layout_type ) { 302 303 $( 'body' ).addClass( 'hfe-flyout-animating' ).css({ 304 position: 'absolute', 305 width: '100%', 306 'margin-left' : wrap_width, 307 'margin-right' : 'auto' 308 }); 309 } 310 311 container.addClass( 'hfe-flyout-show' ); 312 } else { 313 314 $( 'body' ).css( 'margin-right', '0' ); 315 container.css( 'right', '0' ); 316 317 if( 'push' == layout_type ) { 318 319 $( 'body' ).addClass( 'hfe-flyout-animating' ).css({ 320 position: 'absolute', 321 width: '100%', 322 'margin-left' : '-' + wrap_width, 323 'margin-right' : 'auto', 324 }); 325 } 326 327 container.addClass( 'hfe-flyout-show' ); 328 } 329 } 330 331 function _closeMenu( id ) { 332 333 var flyout_content = $( '#hfe-flyout-content-id-' + id ); 334 var layout = $( '#hfe-flyout-content-id-' + id ).data( 'layout' ); 335 var wrap_width = flyout_content.width() + 'px'; 336 var layout_type = $( '#hfe-flyout-content-id-' + id ).data( 'flyout-type' ); 337 var container = $( '.elementor-element-' + id + ' .hfe-flyout-container .hfe-side.hfe-flyout-' + layout ); 338 339 $( '.elementor-element-' + id + ' .hfe-flyout-overlay' ).fadeOut( 100 ); 340 341 if( 'left' == layout ) { 342 343 container.css( 'left', '-' + wrap_width ); 344 345 if( 'push' == layout_type ) { 346 347 $( 'body' ).css({ 348 position: '', 349 'margin-left' : '', 350 'margin-right' : '', 351 }); 352 353 setTimeout( function() { 354 $( 'body' ).removeClass( 'hfe-flyout-animating' ).css({ 355 width: '', 356 }); 357 }); 358 } 359 360 container.removeClass( 'hfe-flyout-show' ); 361 } else {
362 container.css( 'right', '-' + wrap_width ); 363 364 if( 'push' == layout_type ) { 365 366 $( 'body' ).css({ 367 position: '', 368 'margin-right' : '', 369 'margin-left' : '', 370 }); 371 372 setTimeout( function() { 373 $( 'body' ).removeClass( 'hfe-flyout-animating' ).css({ 374 width: '', 375 }); 376 }); 377 } 378 container.removeClass( 'hfe-flyout-show' ); 379 } 380 } 381 382 function _eventClick( id ){ 383 384 var layout = $( '.elementor-element-' + id + ' .hfe-nav-menu' ).data( 'layout' ); 385 386 $( '.elementor-element-' + id + ' div.hfe-has-submenu-container' ).off( 'click' ).on( 'click', function( event ) { 387 388 var $this = $( this ); 389 390 if( $( '.elementor-element-' + id ).hasClass( 'hfe-link-redirect-child' ) ) { 391 392 if( $this.hasClass( 'sub-menu-active' ) ) { 393 394 if( ! $this.next().hasClass( 'sub-menu-open' ) ) { 395 396 $this.find( 'a' ).attr( 'aria-expanded', 'false' ); 397 398 if( 'horizontal' !== layout ){ 399 400 event.preventDefault(); 401 402 $this.next().css( 'position', 'relative' ); 403 } 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'))) { 404 405 event.preventDefault(); 406 407 $this.next().css( 'position', 'relative' ); 408 } 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'))) { 409 410 event.preventDefault(); 411 412 $this.next().css( 'position', 'relative' ); 413 } 414 415 $this.removeClass( 'sub-menu-active' ); 416 $this.nextAll('.sub-menu').removeClass( 'sub-menu-open' ); 417 $this.nextAll('.sub-menu').css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } ); 418 $this.nextAll('.sub-menu').css( { 'transition': 'none'} ); 419 } else{ 420 421 $this.find( 'a' ).attr( 'aria-expanded', 'false' ); 422 423 $this.removeClass( 'sub-menu-active' ); 424 $this.nextAll('.sub-menu').removeClass( 'sub-menu-open' ); 425 $this.nextAll('.sub-menu').css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } ); 426 $this.nextAll('.sub-menu').css( { 'transition': 'none'} ); 427 428 if ( 'horizontal' !== layout ){ 429 430 $this.next().css( 'position', 'relative' ); 431 } 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'))) { 432 433 $this.next().css( 'position', 'relative' ); 434 435 } 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'))) { 436 437 $this.next().css( 'position', 'absolute' ); 438 } 439 } 440 } else { 441 442 $this.find( 'a' ).attr( 'aria-expanded', 'true' ); 443 if ( 'horizontal' !== layout ) { 444 445 event.preventDefault(); 446 $this.next().css( 'position', 'relative'); 447 } 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'))) { 448 449 event.preventDefault(); 450 $this.next().css( 'position', 'relative'); 451 } else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 1024px )" ).matches ) { 452 event.preventDefault(); 453 454 if ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') ) { 455 456 $this.next().css( 'position', 'relative'); 457 } else if ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-none') ) { 458 459 $this.next().css( 'position', 'absolute'); 460 } 461 } 462
463 $this.addClass( 'sub-menu-active' ); 464 $this.nextAll('.sub-menu').addClass( 'sub-menu-open' ); 465 $this.nextAll('.sub-menu').css( { 'visibility': 'visible', 'opacity': '1', 'height': 'auto' } ); 466 $this.nextAll('.sub-menu').css( { 'transition': '0.3s ease'} ); 467 } 468 } 469 }); 470 471 $( '.elementor-element-' + id + ' .hfe-menu-toggle' ).off( 'click keyup' ).on( 'click keyup',function( event ) { 472 473 var $this = $( this ); 474 475 if( $this.parent().parent().hasClass( 'menu-active' ) ) { 476 477 event.preventDefault(); 478 479 $this.parent().parent().removeClass( 'menu-active' ); 480 $this.parent().parent().next().css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } ); 481 482 if ( 'horizontal' !== layout ) { 483 484 $this.parent().parent().next().css( 'position', 'relative'); 485 } 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'))) { 486 487 $this.parent().parent().next().css( 'position', 'relative'); 488 } else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 1024px )" ).matches ) { 489 490 if ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') ) { 491 492 $this.parent().parent().next().css( 'position', 'relative'); 493 } else if ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-none') ) { 494 495 $this.parent().parent().next().css( 'position', 'absolute'); 496 } 497 } 498 }else { 499 500 event.preventDefault(); 501 502 $this.parent().parent().addClass( 'menu-active' ); 503 504 $this.parent().parent().next().css( { 'visibility': 'visible', 'opacity': '1', 'height': 'auto' } ); 505 506 if ( 'horizontal' !== layout ) { 507 508 $this.parent().parent().next().css( 'position', 'relative'); 509 } 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'))) { 510 511 $this.parent().parent().next().css( 'position', 'relative'); 512 } else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 1024px )" ).matches ) { 513 514 if ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') ) { 515 516 $this.parent().parent().next().css( 'position', 'relative'); 517 } else if ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-none') ) { 518 519 $this.parent().parent().next().css( 'position', 'absolute'); 520 } 521 } 522 } 523 }); 524 } 525 526 function _borderClass( id ){ 527 528 var last_item = $( '.elementor-element-' + id + ' .hfe-nav-menu' ).data( 'last-item' ); 529 var last_item_flyout = $( '.elementor-element-' + id + ' .hfe-flyout-wrapper' ).data( 'last-item' ); 530 var layout = $( '.elementor-element-' + id + ' .hfe-nav-menu' ).data( 'layout' ); 531 532 $( '.elementor-element-' + id + ' nav').removeClass('hfe-dropdown'); 533 534 if ( window.matchMedia( "( max-width: 767px )" ).matches ) { 535 536 if( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet')){ 537 538 $( '.elementor-element-' + id + ' nav').addClass('hfe-dropdown'); 539 if( ( 'cta' == last_item || 'cta' == last_item_flyout ) && 'expandible' != layout ){ 540 $( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).parent().removeClass( 'hfe-button-wrapper elementor-widget-button' ); 541 $( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).removeClass( 'elementor-button' ); 542 } 543 }else{ 544 545 $( '.elementor-element-' + id + ' nav').removeClass('hfe-dropdown'); 546 if( ( 'cta' == last_item || 'cta' == last_item_flyout ) && 'expandible' != layout ){ 547 $( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).parent().addClass( 'hfe-button-wrapper elementor-widget-button' ); 548 $( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).addClass( 'elementor-button' ); 549 } 550 } 551 }else if ( window.matchMedia( "( max-width: 1024px )" ).matches ) { 552 553 if( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') ) { 554 555 $( '.elementor-element-' + id + ' nav').addClass('hfe-dropdown'); 556 if( ( 'cta' == last_item || 'cta' == last_item_flyout ) && 'expandible' != layout ){ 557 $( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).parent().removeClass( 'hfe-button-wrapper elementor-widget-button' ); 558 $( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).removeClass( 'elementor-button' ); 559 } 560 }else{ 561 562 $( '.elementor-element-' + id + ' nav').removeClass('hfe-dropdown'); 563 if( ( 'cta' == last_item || 'cta' == last_item_flyout ) && 'expandible' != layout ){ 564 $( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).parent().addClass( 'hfe-button-wrapper elementor-widget-button' ); 565 $( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).addClass( 'elementor-button' ); 566 } 567 } 568 }else { 569 var $parent_element = $( '.elementor-element-' + id ); 570 $parent_element.find( 'nav').removeClass( 'hfe-dropdown' ); 571 if( ( 'cta' == last_item || 'cta' == last_item_flyout ) && 'expandible' != layout ){ 572 $parent_element.find( 'li.menu-item:last-child a.hfe-menu-item' ).parent().addClass( 'hfe-button-wrapper elementor-widget-button' ); 573 $parent_element.find( 'li.menu-item:last-child a.hfe-menu-item' ).addClass( 'elementor-button' ); 574 } 575 } 576 577 var layout = $( '.elementor-element-' + id + ' .hfe-nav-menu' ).data( 'layout' ); 578 if( 'expandible' == layout ){ 579 if( ( 'cta' == last_item || 'cta' == last_item_flyout ) && 'expandible' != layout ){ 580 $( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).parent().removeClass( 'hfe-button-wrapper elementor-widget-button' ); 581 $( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).removeClass( 'elementor-button' ); 582 } 583 } 584 } 585 586 function _toggleClick( id ){ 587 588 if ( $( '.elementor-element-' + id + ' .hfe-nav-menu__toggle' ).hasClass( 'hfe-active-menu-full-width' ) ){ 589 590 var $toggle = $( '.elementor-element-' + id + ' .hfe-nav-menu__toggle' ); 591 var $nextElement= $toggle.next(); 592 593 if( $nextElement.length ){ 594 $nextElement.css( 'left', '0' ); 595 596 var $section = $( '.elementor-element-' + id ).closest('.elementor-section, .e-con-boxed.e-parent, .e-con-full.e-parent'); 597 if ( $section.length ) { 598 var width = $section.outerWidth(); 599 var sec_pos = $section.offset().left - $toggle.next().offset().left; 600 $nextElement.css( 'width', width + 'px' ); 601 $nextElement.css( 'left', sec_pos + 'px' ); 602 } 603 } 604 } 605 606 $( '.elementor-element-' + id + ' .hfe-nav-menu__toggle' ).off( 'click keyup' ).on( 'click keyup', function( event ) { 607 608 var $this = $( this ); 609 var $selector = $this.next(); 610 611 if ( $this.hasClass( 'hfe-active-menu' ) ) { 612 613 var layout = $( '.elementor-element-' + id + ' .hfe-nav-menu' ).data( 'layout' ); 614 var full_width = $selector.data( 'full-width' ); 615 var toggle_icon = $( '.elementor-element-' + id + ' nav' ).data( 'toggle-icon' ); 616 617 $( '.elementor-element-' + id).find( '.hfe-nav-menu-icon' ).html( toggle_icon ); 618 619 $this.removeClass( 'hfe-active-menu' ); 620 $this.attr( 'aria-expanded', 'false' ); 621 622 if ( 'yes' == full_width ){ 623 624 $this.removeClass( 'hfe-active-menu-full-width' ); 625 626 $selector.css( 'width', 'auto' ); 627 $selector.css( 'left', '0' ); 628 $selector.css( 'z-index', '0' ); 629 } 630 } else { 631 632 var layout = $( '.elementor-element-' + id + ' .hfe-nav-menu' ).data( 'layout' ); 633 var full_width = $selector.data( 'full-width' ); 634 var close_icon = $( '.elementor-element-' + id + ' nav' ).data( 'close-icon' ); 635 636 $( '.elementor-element-' + id).find( '.hfe-nav-menu-icon' ).html( close_icon ); 637 638 $this.addClass( 'hfe-active-menu' ); 639 $this.attr( 'aria-expanded', 'true' ); 640 641 if ( 'yes' == full_width ){ 642 643 $this.addClass( 'hfe-active-menu-full-width' ); 644 645 var closestElement = $( '.elementor-element-' + id ).closest('.elementor-section, .e-con-boxed.e-parent, .e-con-full.e-parent'); 646 var width = closestElement.outerWidth(); 647 var sec_pos = closestElement.offset().left - $selector.offset().left; 648 649 $selector.css( 'width', width + 'px' ); 650 $selector.css( 'left', sec_pos + 'px' ); 651 $selector.css( 'z-index', '9999' ); 652 } 653 } 654 655 if( $( '.elementor-element-' + id + ' nav' ).hasClass( 'menu-is-active' ) ) { 656 657 $( '.elementor-element-' + id + ' nav' ).removeClass( 'menu-is-active' ); 658 }else { 659 660 $( '.elementor-element-' + id + ' nav' ).addClass( 'menu-is-active' ); 661 } 662 } ); 663 } 664 665 function _handleSinglePageMenu( id, layout ) { 666 $( '.elementor-element-' + id + ' ul.hfe-nav-menu li a' ).on( 667 'click', 668 function ( event ) { 669 var $this = $( this ); 670 var link = $this.attr( 'href' ); 671 var linkValue = ''; 672 673 // Optimized code to redirect to submenu-ids on traverse. 674 if ( link.includes( '#' ) && link.charAt(0) === '#' ) { // Check if the link is an anchor link. 675 event.preventDefault(); 676 var index = link.indexOf( '#' ); 677 linkValue = link.slice( index + 1 ); 678 } 679 if ( linkValue.length > 0 ) { 680 var targetSection = $( '#' + linkValue ); 681 682 if ( targetSection.length ) { // Check if the target section exists. 683 $('html, body').animate({ 684 scrollTop: targetSection.offset().top 685 }, 800); 686 } 687 688 if ( 'expandible' == layout ) { 689 $( '.elementor-element-' + id + ' .hfe-nav-menu__toggle' ).trigger( "click" ); 690 if ($this.hasClass( 'hfe-sub-menu-item' )) { 691 $( '.elementor-element-' + id + ' .hfe-menu-toggle' ).trigger( "click" ); 692 } 693 } else { 694 if ( window.matchMedia( '(max-width: 1024px)' ).matches && ( 'horizontal' == layout || 'vertical' == layout ) ) { 695 $( '.elementor-element-' + id + ' .hfe-nav-menu__toggle' ).trigger( "click" ); 696 if ($this.hasClass( 'hfe-sub-menu-item' )) { 697 $( '.elementor-element-' + id + ' .hfe-menu-toggle' ).trigger( "click" ); 698 } 699 } else { 700 if ($this.hasClass( 'hfe-sub-menu-item' )) { 701 _closeMenu( id ); 702 $( '.elementor-element-' + id + ' .hfe-menu-toggle' ).trigger( "click" ); 703 } 704 _closeMenu( id ); 705 } 706 } 707 } 708 } 709 ); 710 } 711 712 /** 713 * This function handles polylang plugin's lang switcher if present in the menu. 714 * 715 * @param {Object}
715 $scope The current element(hfe nav menu) wrapped with jQuery. 716 */ 717 function _handlePolylangSwitcher( $scope ) { 718 var polylangSwitcher = $scope.find( '.hfe-nav-menu nav .pll-parent-menu-item a.hfe-menu-item' ); 719 var hrefProperty = polylangSwitcher.prop( 'href' ); 720 if ( undefined !== hrefProperty && hrefProperty.includes( '#' ) ) { 721 var index = hrefProperty.indexOf( '#' ); 722 var value = hrefProperty.slice( index ); 723 if ( value === '#pll_switcher' ) { 724 polylangSwitcher.prop( 'href', '#' ); 725 } 726 } 727 } 728 729 $( window ).on( 'elementor/frontend/init', function () { 730 731 elementorFrontend.hooks.addAction( 'frontend/element_ready/navigation-menu.default', WidgethfeNavMenuHandler ); 732 elementorFrontend.hooks.addAction( 'frontend/element_ready/hfe-search-button.default', WidgethfeSearchButton ); 733 }); 734} )( 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.