From 72b2c800e4ce42556cc38ee7af5c257328b245be Mon Sep 17 00:00:00 2001 From: drishu Date: Wed, 29 Jan 2020 15:10:26 +0200 Subject: [PATCH 1/2] NEPT-2781: Fix Main Menu Navigation collapse issue. --- templates/menu_tree/menu_tree.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/templates/menu_tree/menu_tree.js b/templates/menu_tree/menu_tree.js index cb101ef8..3734a23f 100644 --- a/templates/menu_tree/menu_tree.js +++ b/templates/menu_tree/menu_tree.js @@ -9,6 +9,11 @@ $('.ecl-navigation-menu__root').once('ecEuropaMenuTree', function() { ECL.megamenu('.ecl-navigation-menu__root'); }); + if ($('.ecl-navigation-menu__group').length) { + $('.ecl-navigation-menu__group').once('ecEuropaSubmenuTree', function() { + ECL.megamenu('.ecl-navigation-menu__group'); + }); + } } }; Drupal.behaviors.megaMenu = { From e49b2b8ee1bc649a3cfed52234d80a96b85567a7 Mon Sep 17 00:00:00 2001 From: drishu Date: Wed, 29 Jan 2020 21:33:11 +0200 Subject: [PATCH 2/2] NEPT-2781: Make burger menu work with megamenu. --- templates/menu_tree/menu_tree.js | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/templates/menu_tree/menu_tree.js b/templates/menu_tree/menu_tree.js index 3734a23f..c477537d 100644 --- a/templates/menu_tree/menu_tree.js +++ b/templates/menu_tree/menu_tree.js @@ -4,21 +4,20 @@ */ (function ($) { - Drupal.behaviors.ecEuropaMenuTree = { - attach: function (context) { - $('.ecl-navigation-menu__root').once('ecEuropaMenuTree', function() { - ECL.megamenu('.ecl-navigation-menu__root'); - }); - if ($('.ecl-navigation-menu__group').length) { - $('.ecl-navigation-menu__group').once('ecEuropaSubmenuTree', function() { - ECL.megamenu('.ecl-navigation-menu__group'); - }); - } - } - }; Drupal.behaviors.megaMenu = { attach: function (context, settings) { ECL.megamenu(); + + // Fix burger menu. + $('.ecl-navigation-menu__hamburger').click(function() { + var button = $(this); + + if (button.attr('aria-expanded') == 'true') { + button.attr('aria-expanded', 'false'); + } else { + button.attr('aria-expanded', 'true'); + } + }); } }; })(jQuery);