1/** 2 * @file 3 * Contains simple_megamenu.js. 4 */ 5 6(function ($, Drupal) { 7 'use strict'; 8 9 Drupal.behaviors.simple_megamenu = { 10 attach: function(context, settings) { 11 12 // Basic a11y. 13 // Make the megamenu navigable with keyboard. 14 $('ul.menu--simple-mega-menu li.menu-item--expanded a').on('focusin', function(){ 15 $('li.menu-item--expanded').removeClass('focused'); 16 $(this).parents('li.menu-item--expanded').addClass('focused'); 17 }); 18 19 // Close menu on click anywhere. 20 $('body').on('click', function(){ 21 $('li.menu-item--expanded').removeClass('focused'); 22 }); 23 24 // Close menu on escape key press. 25 $(document).keyup(function(e) { 26 if (e.keyCode == 27) { 27 $('li.menu-item--expanded').removeClass('focused'); 28 } 29 }); 30 } 31 }; 32 33}(jQuery, Drupal));
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.