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