1jQuery(window).ready(function(){ 2 /* 3 * Adjust the <html> margin based on the height of the menu bar 4 */ 5 function toastMMsetHeights(){ 6 if(jQuery('.toast-mm-banner').css('display') == 'block'){ 7 var mm_bar_height = jQuery('.toast-mm-banner').outerHeight(); 8 jQuery('body, .toast-mm-menu').css({'padding-top': mm_bar_height}); 9 jQuery('.toast-mm-overflow').css({'max-height': 'calc(100vh - 50px - '+mm_bar_height+'px)'}); 10 }else{ 11 jQuery('body, .toast-mm-menu').css({'padding-top': 0}); 12 } 13 } 14 15 jQuery(window).resize(function(){ 16 toastMMsetHeights(); 17 }) 18 toastMMsetHeights(); 19 20 /* 21 * Open and close the navigation 22 */ 23 jQuery('.toast-mm-banner__hamburger').on('click', function(){ 24 if(jQuery('.toast-mm').hasClass('active')){ 25 jQuery('.toast-mm').removeClass('active'); 26 }else{ 27 jQuery('.toast-mm').addClass('active'); 28 } 29 }) 30 31 /* 32 * Append arrow icons to links with submenus 33 */ 34 jQuery('.toast-mm .menu-item-has-children > a').append('<div class="toast-mm-open-submenu"><div class="toast-mm-chevron"></div></div>'); 35 36 /* 37 * Open and close sub-navigation 38 */ 39 function open_sub_menu(sub_menu, sub_menu_trigger){ 40 if(jQuery(sub_menu_trigger).hasClass('active')){ 41 jQuery(sub_menu_trigger).removeClass('active'); 42 var sub_menu_height = jQuery(sub_menu).css({'height': 'auto'}).height(); 43 jQuery(sub_menu).height(sub_menu_height); 44 jQuery(sub_menu).height(0); 45 46 //close child submenus 47 jQuery(sub_menu).find('.sub-menu').height(0); 48 jQuery(sub_menu_trigger).find('li').removeClass('active'); 49 50 }else{ 51 jQuery(sub_menu_trigger).addClass('active'); 52 var sub_menu_height = jQuery(sub_menu).css({'height': 'auto'}).height(); 53 jQuery(sub_menu).height(0); 54 jQuery(sub_menu).height(sub_menu_height); 55 56 //amend parent submenus 57 jQuery(sub_menu_trigger).parents('.sub-menu').css({'height': 'auto'}); 58 } 59 } 60 61 62 63 jQuery('body').on('click','.toast-mm-open-submenu', function(e){ 64 e.preventDefault(); 65 e.stopPropagation(); 66 var sub_menu = jQuery(this).parent('a').parent('.menu-item-has-children').find('.sub-menu')[0]; 67 var sub_menu_trigger = jQuery(this).parent('a').parent('.menu-item-has-children'); 68 69 open_sub_menu(sub_menu, sub_menu_trigger); 70 }) 71 72 /* If parent links to itself open sub menu**/ 73 jQuery('body').on('click','.toast-mm-menu li a', function(e){ 74 if(jQuery(this).attr('href') == '#'){ 75 e.preventDefault(); 76 e.stopPropagation(); 77 var sub_menu = jQuery(this).parent('.menu-item-has-children').find('.sub-menu')[0]; 78 var sub_menu_trigger = jQuery(this).parent('.menu-item-has-children'); 79 80 open_sub_menu(sub_menu, sub_menu_trigger); 81 } 82 }) 83 84 85})
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.