Skip to content

Commit

Permalink
Merge pull request #200 from ec-europa/nept-2781
Browse files Browse the repository at this point in the history
NEPT-2781: Make burger menu work with megamenu.
  • Loading branch information
drishu authored Feb 7, 2020
2 parents e957bb4 + e49b2b8 commit 5fbdfb5
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions templates/menu_tree/menu_tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,20 @@
*/

(function ($) {
Drupal.behaviors.ecEuropaMenuTree = {
attach: function (context) {
$('.ecl-navigation-menu__root').once('ecEuropaMenuTree', function() {
ECL.megamenu('.ecl-navigation-menu__root');
});
}
};
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);

0 comments on commit 5fbdfb5

Please sign in to comment.