1(function ($) { 2 3 $(document).ready(function () { 4 var $myDiv = $('#my-menu'); 5 if ($myDiv.length) { 6 mmenu = mmlight(document.querySelector("#my-menu")); 7 mmenu.create("(max-width: 767px)"); 8 mmenu.init("selected"); 9 $("#main-menu-panel").click(function (e) { 10 e.preventDefault(); 11 if ($("#my-menu").hasClass("mm--open")) { 12 mmenu.close(); 13 } else { 14 mmenu.open(); 15 $("#my-menu li:first").focus(); 16 $("a.dropdown-toggle").focusin( 17 function () { 18 $('.dropdown').addClass('open') 19 } 20 ); 21 $("#my-menu li:last").focusout( 22 function () { 23 mmenu.close(); 24 } 25 ); 26 $('#my-menu').on('focusout', function (e) { 27 setTimeout(function () { // needed because nothing has focus during 'focusout' 28 if ($(':focus').closest('#my-menu').length <= 0) { 29 mmenu.close(); 30 $("a#main-menu-panel").focus(); 31 } 32 }, 0); 33 }); 34 $("#main-menu-panel").focusin( 35 function () { 36 mmenu.close(); 37 } 38 ); 39 $("#main-menu-panel").on('keydown blur', function (e) { 40 if (e.shiftKey && e.keyCode === 9) { 41 mmenu.close(); 42 } 43 }); 44 } 45 e.stopPropagation(); 46 }); 47 } 48 49 // Menu 50 function onResizeMenuLayout() { 51 if ($(window).width() > 767) { 52 $(".dropdown").hover( 53 function () { 54 $(this).addClass('open') 55 }, 56 function () { 57 $(this).removeClass('open') 58 } 59 ); 60 $(".dropdown").focusin( 61 function () { 62 $(this).addClass('open') 63 } 64 ); 65 $(".dropdown").focusout( 66 function () { 67 $(this).removeClass('open') 68 } 69 ); 70 } else { 71 $(".dropdown").hover( 72 function () { 73 $(this).removeClass('open') 74 } 75 ); 76 } 77 } 78 ; 79 // initial state 80 onResizeMenuLayout(); 81 // on resize 82 $(window).on('resize', onResizeMenuLayout); 83 84 $('.navbar .dropdown-toggle').hover(function () { 85 $(this).addClass('disabled'); 86 }); 87 $('.navbar .dropdown-toggle').focus(function () { 88 $(this).addClass('disabled'); 89 }); 90 }); 91})(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.