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