1(function($){ 2 "use strict"; 3 var $window = $(window); 4 var startMegaMenu = function() { 5 $(".fl-mega-menu").accessibleMegaMenu({ 6 /* prefix for generated unique id attributes, which are required 7 to indicate aria-owns, aria-controls and aria-labelledby */ 8 uuidPrefix: "accessible-megamenu", 9 /* css class used to define the megamenu styling */ 10 menuClass: "nav-menu", 11 /* css class for a top-level navigation item in the megamenu */ 12 topNavItemClass: "nav-item", 13 /* css class for a megamenu panel */ 14 panelClass: "sub-nav", 15 /* css class for a group of items within a megamenu panel */ 16 panelGroupClass: "sub-nav-group", 17 /* css class for the hover state */ 18 hoverClass: "hover", 19 /* css class for the focus state */ 20 focusClass: "focus", 21 /* css class for the open state */ 22 openClass: "open" 23 }); 24 25 26 var $sub_nav_mega_menu_item = $(".fl--header .mega-menu-item"); 27 if ($sub_nav_mega_menu_item.length !== 0) { 28 $sub_nav_mega_menu_item.each( function() { 29 var $self = $(this); 30 if($self.hasClass('has-submenu') && !$self.hasClass("sub-menu-full-width")){ 31 // ADD Mega menu ul width 32 $self.find('ul.sub-menu-wide').each(function(){ 33 var $ul = $(this), 34 total_width = 1, 35 limit = $ul.data('max-columns'), 36 i = 0; 37 if(typeof $ul.data('max-columns') !== 'undefined'){ 38 $ul.children().each(function(){ 39 if(!limit || limit > i) { 40 total_width += Math.ceil($(this).outerWidth()); 41 } 42 i++; 43 }); 44 $ul.innerWidth(total_width); 45 if( total_width > w_width){ 46 $ul.css({'max-width': w_width}); 47 } 48 } 49 }); 50 51 var $sub_nav_child = $self.find('.sub-nav .sub-menu'), 52 w_width = $window.width(), 53 offset = $sub_nav_child.offset(), 54 offset_right = (offset.left + $sub_nav_child.outerWidth()) - $(window).width(); 55 if(offset_right >= 0){ 56 $(this).find('.sub-nav').css( 57 { 58 'max-width': w_width, 59 'margin-left': -offset_right-20 60 } 61 ); 62 } 63 } 64 65 66 }); 67 } 68 69 }; 70 // Start 71 $('document').ready(function() { 72 startMegaMenu(); 73 }); 74})(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.