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 _handleSinglePageMenu( id, layout ); 85 86 if( 'horizontal' !== layout ){ 87 88 _eventClick( id ); 89 }else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 767px )" ).matches ) { 90 91 _eventClick( id ); 92 }else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 1024px )" ).matches ) { 93 94 _eventClick( id ); 95 } 96 97 $( '.elementor-element-' + id + ' .hfe-flyout-trigger .hfe-nav-menu-icon' ).off( 'click keyup' ).on( 'click keyup', function() { 98 99 _openMenu( id ); 100 } ); 101 102 $( '.elementor-element-' + id + ' .hfe-flyout-close' ).off( 'click keyup' ).on( 'click keyup', function() { 103 104 _closeMenu( id ); 105 } ); 106 107 $( '.elementor-element-' + id + ' .hfe-flyout-overlay' ).off( 'click' ).on( 'click', function() { 108 109 _closeMenu( id ); 110 } ); 111 112 113 $scope.find( '.sub-menu' ).each( function() { 114 115 var parent = $( this ).closest( '.menu-item' ); 116 117 $scope.find( parent ).addClass( 'parent-has-child' ); 118 $scope.find( parent ).removeClass( 'parent-has-no-child' ); 119 }); 120 121 if( ( 'cta' == last_item || 'cta' == last_item_flyout ) && 'expandible' != layout ){ 122 $( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).parent().addClass( 'elementor-button-wrapper' ); 123 $( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).addClass( 'elementor-button' ); 124 } 125 126 _borderClass( id ); 127 128 $( window ).on( 'resize', function(){ 129 130 if( 'horizontal' !== layout ) { 131 132 _eventClick( id ); 133 }else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 767px )" ).matches ) { 134 135 _eventClick( id ); 136 }else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 1024px )" ).matches ) { 137 138 _eventClick( id ); 139 } 140 141 if( 'horizontal' == layout && window.matchMedia( "( min-width: 977px )" ).matches){ 142 143 $( '.elementor-element-' + id + ' div.hfe-has-submenu-container' ).next().css( 'position', 'absolute'); 144 } 145 146 if( 'expandible' == layout || 'flyout' == layout ){ 147 148 _toggleClick( id ); 149 }else if ( 'vertical' == layout || 'horizontal' == layout ) { 150 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'))){ 151 152 _toggleClick( id ); 153 }else if ( window.matchMedia( "( max-width: 1024px )" ).matches && $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') ) { 154 155 _toggleClick( id ); 156 } 157 } 158 159 _borderClass( id ); 160 161 }); 162 163 // Acessibility functions 164 165 $scope.find( '.parent-has-child .hfe-has-submenu-container a').attr( 'aria-haspopup', 'true' ); 166 $scope.find( '.parent-has-child .hfe-has-submenu-container a').attr( 'aria-expanded', 'false' ); 167 168 $scope.find( '.hfe-nav-menu__toggle').attr( 'aria-haspopup', 'true' ); 169 $scope.find( '.hfe-nav-menu__toggle').attr( 'aria-expanded', 'false' ); 170 171 // End of accessibility functions 172 173 $( document ).trigger( 'hfe_nav_menu_init', id ); 174 175 $( '.elementor-element-' + id + ' div.hfe-has-submenu-container' ).on( 'keyup', function(e){ 176 177 var $this = $( this ); 178 179 if( $this.parent().hasClass( 'menu-active' ) ) { 180 181 $this.parent().removeClass( 'menu-active' ); 182 183 $this.parent().next().find('ul').css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } ); 184 $this.parent().prev().find('ul').css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } ); 185 186 $this.parent().next().find( 'div.hfe-has-submenu-container' ).removeClass( 'sub-menu
186-active' ); 187 $this.parent().prev().find( 'div.hfe-has-submenu-container' ).removeClass( 'sub-menu-active' ); 188 }else { 189 190 $this.parent().next().find('ul').css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } ); 191 $this.parent().prev().find('ul').css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } ); 192 193 $this.parent().next().find( 'div.hfe-has-submenu-container' ).removeClass( 'sub-menu-active' ); 194 $this.parent().prev().find( 'div.hfe-has-submenu-container' ).removeClass( 'sub-menu-active' ); 195 196 $this.parent().siblings().find( '.hfe-has-submenu-container a' ).attr( 'aria-expanded', 'false' ); 197 198 $this.parent().next().removeClass( 'menu-active' ); 199 $this.parent().prev().removeClass( 'menu-active' ); 200 201 event.preventDefault(); 202 203 $this.parent().addClass( 'menu-active' ); 204 205 if( 'horizontal' !== layout ){ 206 $this.addClass( 'sub-menu-active' ); 207 } 208 209 $this.find( 'a' ).attr( 'aria-expanded', 'true' ); 210 211 $this.next().css( { 'visibility': 'visible', 'opacity': '1', 'height': 'auto' } ); 212 213 if ( 'horizontal' !== layout ) { 214 215 $this.next().css( 'position', 'relative'); 216 } 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'))) { 217 218 $this.next().css( 'position', 'relative'); 219 } else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 1024px )" ).matches ) { 220 221 if ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') ) { 222 223 $this.next().css( 'position', 'relative'); 224 } else if ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-none') ) { 225 226 $this.next().css( 'position', 'absolute'); 227 } 228 } 229 } 230 }); 231 232 $( '.elementor-element-' + id + ' li.menu-item' ).on( 'keyup', function(e){ 233 var $this = $( this ); 234 235 $this.next().find( 'a' ).attr( 'aria-expanded', 'false' ); 236 $this.prev().find( 'a' ).attr( 'aria-expanded', 'false' ); 237 238 $this.next().find('ul').css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } ); 239 $this.prev().find('ul').css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } ); 240 241 $this.siblings().removeClass( 'menu-active' ); 242 $this.next().find( 'div.hfe-has-submenu-container' ).removeClass( 'sub-menu-active' ); 243 $this.prev().find( 'div.hfe-has-submenu-container' ).removeClass( 'sub-menu-active' ); 244 245 }); 246 }; 247 248 function _handle_current_menu_item_class( layout_links ) { 249 layout_links.each( 250 function () { 251 var $this = $( this ); 252 if ($this.is( '[href*="#"]' )) { 253 var menu_item_parent = $this.parent(); 254 menu_item_parent.removeClass( 'current-menu-item current-menu-ancestor' ); 255 $this.click( 256 function () { 257 var current_index = menu_item_parent.index(), 258 parent_element = $this.closest( 'ul' ); 259 parent_element.find( 'li' ).not( ':eq(' + current_index + ')' ).removeClass( 'current-menu-item current-menu-ancestor' ); 260 menu_item_parent.addClass( 'current-menu-item current-menu-ancestor' ); 261 } 262 ) 263 } 264 } 265 ); 266 } 267 268 function _openMenu( id ) { 269 270 var flyout_content = $( '#hfe-flyout-content-id-' + id ); 271 var layout = $( '#hfe-flyout-content-id-' + id ).data( 'layout' ); 272 var layout_type = $( '#hfe-flyout-content-id-' + id ).data( 'flyout-type' ); 273 var wrap_width = flyout_content.width() + 'px'; 274 var container = $( '.elementor-element-' + id + ' .hfe-flyout-container .hfe-side.hfe-flyout-' + layout ); 275 276 $( '.elementor-element-' + id + ' .hfe-flyout-overlay' ).fadeIn( 100 ); 277 278 if( 'left' == layout ) { 279 280 $( 'body' ).css( 'margin-left' , '0' ); 281 container.css( 'left', '0' ); 282 283 if( 'push' == layout_type ) { 284 285 $( 'body' ).addClass( 'hfe-flyout-animating' ).css({ 286 position: 'absolute', 287 width: '100%', 288 'margin-left' : wrap_width, 289 'margin-right' : 'auto' 290 }); 291 } 292 293 container.addClass( 'hfe-flyout-show' ); 294 } else { 295 296 $( 'body' ).css( 'margin-right', '0' ); 297 container.css( 'right', '0' ); 298 299 if( 'push' == layout_type ) { 300 301 $( 'body' ).addClass( 'hfe-flyout-animating' ).css({ 302 position: 'absolute', 303 width: '100%', 304 'margin-left' : '-' + wrap_width, 305 'margin-right' : 'auto', 306 }); 307 } 308 309 container.addClass( 'hfe-flyout-show' ); 310 } 311 } 312 313 function _closeMenu( id ) { 314 315 var flyout_content = $( '#hfe-flyout-content-id-' + id ); 316 var layout = $( '#hfe-flyout-content-id-' + id ).data( 'layout' ); 317 var wrap_width = flyout_content.width() + 'px'; 318 var layout_type = $( '#hfe-flyout-content-id-' + id ).data( 'flyout-type' ); 319 var container = $( '.elementor-element-' + id + ' .hfe-flyout-container .hfe-side.hfe-flyout-' + layout ); 320 321 $( '.elementor-element-' + id + ' .hfe-flyout-overlay' ).fadeOut( 100 ); 322 323 if( 'left' == layout ) { 324 325 container.css( 'left', '-' + wrap_width ); 326 327 if( 'push' == layout_type ) { 328 329 $( 'body' ).css({ 330 position: '', 331 'margin-left' : '', 332 'margin-right' : '', 333 }); 334 335 setTimeout( function() { 336 $( 'body' ).removeClass( 'hfe-flyout-animating' ).css({ 337 width: '', 338 }); 339 }); 340 } 341 342 container.removeClass( 'hfe-flyout-show' ); 343 } else {
344 container.css( 'right', '-' + wrap_width ); 345 346 if( 'push' == layout_type ) { 347 348 $( 'body' ).css({ 349 position: '', 350 'margin-right' : '', 351 'margin-left' : '', 352 }); 353 354 setTimeout( function() { 355 $( 'body' ).removeClass( 'hfe-flyout-animating' ).css({ 356 width: '', 357 }); 358 }); 359 } 360 container.removeClass( 'hfe-flyout-show' ); 361 } 362 } 363 364 function _eventClick( id ){ 365 366 var layout = $( '.elementor-element-' + id + ' .hfe-nav-menu' ).data( 'layout' ); 367 368 $( '.elementor-element-' + id + ' div.hfe-has-submenu-container' ).off( 'click' ).on( 'click', function( event ) { 369 370 var $this = $( this ); 371 372 if( $( '.elementor-element-' + id ).hasClass( 'hfe-link-redirect-child' ) ) { 373 374 if( $this.hasClass( 'sub-menu-active' ) ) { 375 376 if( ! $this.next().hasClass( 'sub-menu-open' ) ) { 377 378 $this.find( 'a' ).attr( 'aria-expanded', 'false' ); 379 380 if( 'horizontal' !== layout ){ 381 382 event.preventDefault(); 383 384 $this.next().css( 'position', 'relative' ); 385 } 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'))) { 386 387 event.preventDefault(); 388 389 $this.next().css( 'position', 'relative' ); 390 } 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'))) { 391 392 event.preventDefault(); 393 394 $this.next().css( 'position', 'relative' ); 395 } 396 397 $this.removeClass( 'sub-menu-active' ); 398 $this.nextAll('.sub-menu').removeClass( 'sub-menu-open' ); 399 $this.nextAll('.sub-menu').css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } ); 400 $this.nextAll('.sub-menu').css( { 'transition': 'none'} ); 401 } else{ 402 403 $this.find( 'a' ).attr( 'aria-expanded', 'false' ); 404 405 $this.removeClass( 'sub-menu-active' ); 406 $this.nextAll('.sub-menu').removeClass( 'sub-menu-open' ); 407 $this.nextAll('.sub-menu').css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } ); 408 $this.nextAll('.sub-menu').css( { 'transition': 'none'} ); 409 410 if ( 'horizontal' !== layout ){ 411 412 $this.next().css( 'position', 'relative' ); 413 } 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'))) { 414 415 $this.next().css( 'position', 'relative' ); 416 417 } 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'))) { 418 419 $this.next().css( 'position', 'absolute' ); 420 } 421 } 422 } else { 423 424 $this.find( 'a' ).attr( 'aria-expanded', 'true' ); 425 if ( 'horizontal' !== layout ) { 426 427 event.preventDefault(); 428 $this.next().css( 'position', 'relative'); 429 } 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'))) { 430 431 event.preventDefault(); 432 $this.next().css( 'position', 'relative'); 433 } else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 1024px )" ).matches ) { 434 event.preventDefault(); 435 436 if ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') ) { 437 438 $this.next().css( 'position', 'relative'); 439 } else if ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-none') ) { 440 441 $this.next().css( 'position', 'absolute'); 442 } 443 } 444
445 $this.addClass( 'sub-menu-active' ); 446 $this.nextAll('.sub-menu').addClass( 'sub-menu-open' ); 447 $this.nextAll('.sub-menu').css( { 'visibility': 'visible', 'opacity': '1', 'height': 'auto' } ); 448 $this.nextAll('.sub-menu').css( { 'transition': '0.3s ease'} ); 449 } 450 } 451 }); 452 453 $( '.elementor-element-' + id + ' .hfe-menu-toggle' ).off( 'click keyup' ).on( 'click keyup',function( event ) { 454 455 var $this = $( this ); 456 457 if( $this.parent().parent().hasClass( 'menu-active' ) ) { 458 459 event.preventDefault(); 460 461 $this.parent().parent().removeClass( 'menu-active' ); 462 $this.parent().parent().next().css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } ); 463 464 if ( 'horizontal' !== layout ) { 465 466 $this.parent().parent().next().css( 'position', 'relative'); 467 } 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'))) { 468 469 $this.parent().parent().next().css( 'position', 'relative'); 470 } else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 1024px )" ).matches ) { 471 472 if ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') ) { 473 474 $this.parent().parent().next().css( 'position', 'relative'); 475 } else if ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-none') ) { 476 477 $this.parent().parent().next().css( 'position', 'absolute'); 478 } 479 } 480 }else { 481 482 event.preventDefault(); 483 484 $this.parent().parent().addClass( 'menu-active' ); 485 486 $this.parent().parent().next().css( { 'visibility': 'visible', 'opacity': '1', 'height': 'auto' } ); 487 488 if ( 'horizontal' !== layout ) { 489 490 $this.parent().parent().next().css( 'position', 'relative'); 491 } 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'))) { 492 493 $this.parent().parent().next().css( 'position', 'relative'); 494 } else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 1024px )" ).matches ) { 495 496 if ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') ) { 497 498 $this.parent().parent().next().css( 'position', 'relative'); 499 } else if ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-none') ) { 500 501 $this.parent().parent().next().css( 'position', 'absolute'); 502 } 503 } 504 } 505 }); 506 } 507 508 function _borderClass( id ){ 509 510 var last_item = $( '.elementor-element-' + id + ' .hfe-nav-menu' ).data( 'last-item' ); 511 var last_item_flyout = $( '.elementor-element-' + id + ' .hfe-flyout-wrapper' ).data( 'last-item' ); 512 var layout = $( '.elementor-element-' + id + ' .hfe-nav-menu' ).data( 'layout' ); 513 514 $( '.elementor-element-' + id + ' nav').removeClass('hfe-dropdown'); 515 516 if ( window.matchMedia( "( max-width: 767px )" ).matches ) { 517 518 if( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet')){ 519 520 $( '.elementor-element-' + id + ' nav').addClass('hfe-dropdown'); 521 if( ( 'cta' == last_item || 'cta' == last_item_flyout ) && 'expandible' != layout ){ 522 $( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).parent().removeClass( 'elementor-button-wrapper' ); 523 $( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).removeClass( 'elementor-button' ); 524 } 525 }else{ 526 527 $( '.elementor-element-' + id + ' nav').removeClass('hfe-dropdown'); 528 if( ( 'cta' == last_item || 'cta' == last_item_flyout ) && 'expandible' != layout ){ 529 $( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).parent().addClass( 'elementor-button-wrapper' ); 530 $( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).addClass( 'elementor-button' ); 531 } 532 } 533 }else if ( window.matchMedia( "( max-width: 1024px )" ).matches ) { 534 535 if( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') ) { 536 537 $( '.elementor-element-' + id + ' nav').addClass('hfe-dropdown'); 538 if( ( 'cta' == last_item || 'cta' == last_item_flyout ) && 'expandible' != layout ){ 539 $( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).parent().removeClass( 'elementor-button-wrapper' ); 540 $( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).removeClass( 'elementor-button' ); 541 } 542 }else{ 543 544 $( '.elementor-element-' + id + ' nav').removeClass('hfe-dropdown'); 545 if( ( 'cta' == last_item || 'cta' == last_item_flyout ) && 'expandible' != layout ){ 546 $( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).parent().addClass( 'elementor-button-wrapper' ); 547 $( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).addClass( 'elementor-button' ); 548 } 549 } 550 }else { 551 var $parent_element = $( '.elementor-element-' + id ); 552 $parent_element.find( 'nav').removeClass( 'hfe-dropdown' ); 553 if( ( 'cta' == last_item || 'cta' == last_item_flyout ) && 'expandible' != layout ){ 554 $parent_element.find( 'li.menu-item:last-child a.hfe-menu-item' ).parent().addClass( 'elementor-button-wrapper' ); 555 $parent_element.find( 'li.menu-item:last-child a.hfe-menu-item' ).addClass( 'elementor-button' ); 556 } 557 } 558 559 var layout = $( '.elementor-element-' + id + ' .hfe-nav-menu' ).data( 'layout' ); 560 if( 'expandible' == layout ){ 561 if( ( 'cta' == last_item || 'cta' == last_item_flyout ) && 'expandible' != layout ){ 562 $( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).parent().removeClass( 'elementor-button-wrapper' ); 563 $( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).removeClass( 'elementor-button' ); 564 } 565 } 566 } 567 568 function _toggleClick( id ){ 569 570 if ( $( '.elementor-element-' + id + ' .hfe-nav-menu__toggle' ).hasClass( 'hfe-active-menu-full-width' ) ){ 571 572 $( '.elementor-element-' + id + ' .hfe-nav-menu__toggle' ).next().css( 'left', '0' ); 573 574 var width = $( '.elementor-element-' + id ).closest('.elementor-section').outerWidth(); 575 var sec_pos = $( '.elementor-element-' + id ).closest('.elementor-section').offset().left - $( '.elementor-element-' + id + ' .hfe-nav-menu__toggle' ).next().offset().left; 576 $( '.elementor-element-' + id + ' .hfe-nav-menu__toggle' ).next().css( 'width', width + 'px' ); 577 $( '.elementor-element-' + id + ' .hfe-nav-menu__toggle' ).next().css( 'left', sec_pos + 'px' ); 578 } 579 580 $( '.elementor-element-' + id + ' .hfe-nav-menu__toggle' ).off( 'click keyup' ).on( 'click keyup', function( event ) { 581 582 var $this = $( this ); 583 var $selector = $this.next(); 584 585 if ( $this.hasClass( 'hfe-active-menu' ) ) { 586 587 var layout = $( '.elementor-element-' + id + ' .hfe-nav-menu' ).data( 'layout' ); 588 var full_width = $selector.data( 'full-width' ); 589 var toggle_icon = $( '.elementor-element-' + id + ' nav' ).data( 'toggle-icon' ); 590 591 $( '.elementor-element-' + id).find( '.hfe-nav-menu-icon' ).html( toggle_icon ); 592 593 $this.removeClass( 'hfe-active-menu' ); 594 $this.attr( 'aria-expanded', 'false' ); 595 596 if ( 'yes' == full_width ){ 597 598 $this.removeClass( 'hfe-active-menu-full-width' ); 599 600 $selector.css( 'width', 'auto' ); 601 $selector.css( 'left', '0' ); 602 $selector.css( 'z-index', '0' ); 603 } 604 } else { 605 606 var layout = $( '.elementor-element-' + id + ' .hfe-nav-menu' ).data( 'layout' ); 607 var full_width = $selector.data( 'full-width' ); 608 var close_icon = $( '.elementor-element-' + id + ' nav' ).data( 'close-icon' ); 609 610 $( '.elementor-element-' + id).find( '.hfe-nav-menu-icon' ).html( close_icon ); 611 612 $this.addClass( 'hfe-active-menu' ); 613 $this.attr( 'aria-expanded', 'true' ); 614 615 if ( 'yes' == full_width ){ 616 617 $this.addClass( 'hfe-active-menu-full-width' ); 618 619 var width = $( '.elementor-element-' + id ).closest('.elementor-section').outerWidth(); 620 var sec_pos = $( '.elementor-element-' + id ).closest('.elementor-section').offset().left - $selector.offset().left; 621 622 $selector.css( 'width', width + 'px' ); 623 $selector.css( 'left', sec_pos + 'px' ); 624 $selector.css( 'z-index', '9999' ); 625 } 626 } 627 628 if( $( '.elementor-element-' + id + ' nav' ).hasClass( 'menu-is-active' ) ) { 629 630 $( '.elementor-element-' + id + ' nav' ).removeClass( 'menu-is-active' ); 631 }else { 632 633 $( '.elementor-element-' + id + ' nav' ).addClass( 'menu-is-active' ); 634 } 635 } ); 636 } 637 638 function _handleSinglePageMenu( id, layout ) { 639 $( '.elementor-element-' + id + ' ul.hfe-nav-menu li a' ).on( 640 'click', 641 function () { 642 var $this = $( this ); 643 var link = $this.attr( 'href' ); 644 var linkValue = ''; 645 if ( link.includes( '#' ) ) { 646 var index = link.indexOf( '#' ); 647 linkValue = link.slice( index + 1 ); 648 } 649 if ( linkValue.length > 0 ) { 650 if ( 'expandible' == layout ) { 651 $( '.elementor-element-' + id + ' .hfe-nav-menu__toggle' ).trigger( "click" ); 652 if ($this.hasClass( 'hfe-sub-menu-item' )) { 653 $( '.elementor-element-' + id + ' .hfe-menu-toggle' ).trigger( "click" ); 654 } 655 } else { 656 if ( window.matchMedia( '(max-width: 1024px)' ).matches && ( 'horizontal' == layout || 'vertical' == layout ) ) { 657 $( '.elementor-element-' + id + ' .hfe-nav-menu__toggle' ).trigger( "click" ); 658 if ($this.hasClass( 'hfe-sub-menu-item' )) { 659 $( '.elementor-element-' + id + ' .hfe-menu-toggle' ).trigger( "click" ); 660 } 661 } else { 662 if ($this.hasClass( 'hfe-sub-menu-item' )) { 663 _closeMenu( id ); 664 $( '.elementor-element-' + id + ' .hfe-menu-toggle' ).trigger( "click" ); 665 } 666 _closeMenu( id ); 667 } 668 } 669 } 670 } 671 ); 672 } 673 674 $( window ).on( 'elementor/frontend/init', function () { 675 676 elementorFrontend.hooks.addAction( 'frontend/element_ready/navigation-menu.default', WidgethfeNavMenuHandler ); 677 elementorFrontend.hooks.addAction( 'frontend/element_ready/hfe-search-button.default', WidgethfeSearchButton ); 678 }); 679} )( 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.