1(function ($) { 2 $(function () { 3 4 var $doc = $(document); 5 var $bdy = $('body'); 6 7 (function(nav) { 8 var $nav = $(nav); 9 var toggle; 10 11 if ($nav.length) { 12 toggle = function($li, action) { 13 var intent = $li.data('intent'); 14 if (intent) { 15 clearTimeout(intent); 16 } 17 if (action) { 18 intent = setTimeout(function() { 19 if (action === 'open') { 20 $li.addClass('hover'); 21 $li.find('> .sub-menu').stop(true, true).slideDown(200); 22 } else { 23 $li.removeClass('hover'); 24 $li.find('> .sub-menu').stop(true, true).slideUp(200); 25 } 26 }, 100); 27 } 28 $li.data('intent', intent); 29 }; 30 $nav.on('mouseenter mouseleave', '.menu-item-has-children', function(e) { 31 if ($('.nav-toggle').css('display') == 'none') { 32 toggle($(this), (e.type === 'mouseenter' ? 'open' : 'close')); 33 } 34 }).on('mouseenter', '.sub-menu', function(e) { 35 if ($('.nav-toggle').css('display') == 'none') { 36 toggle($(this).closest('li')); 37 } 38 }); 39 } 40 })('.nav-primary > ul'); 41 42 /* main nav submenu, mobile only */ 43 $('.nav-primary > ul > li.menu-item-has-children > a').on('click', function (e) { 44 if ($('.nav-toggle').css('display') != 'none') { 45 var $li = $(this).parent(); 46 if ($li.hasClass('ddactive')) { 47 $li.children('.sub-menu').slideUp(300, function () { 48 $li.removeClass('ddactive'); 49 $(this).removeClass('ddopen'); 50 }); 51 } else { 52 $li.addClass('ddactive').children('.sub-menu').slideDown(300, function () { 53 $(this).addClass('ddopen').css('display', ''); 54 }); 55 } 56 e.preventDefault(); 57 } 58 }); 59 60 /* toggle */ 61 $doc.on('click', '.toggle', function(e) { 62 /* toggle content with ID of elements data-target */ 63 var target = $(this).attr('data-target'); 64 if (target) { 65 if ($(this).hasClass('nav-toggle')) { 66 /* insert/remove menu overlay */ 67 if ($('.menu-overlay').length) { 68 $('.menu-overlay').remove(); 69 } else { 70 $bdy.append('<div class="menu-overlay"></div>'); 71 } 72 } 73 $(target).slideToggle(); 74 $(this).toggleClass('toggle-closed'); 75 e.preventDefault(); 76 } 77 }); 78 79 $doc.on('click', '.menu-overlay', function(e) { 80 $('.nav-toggle').trigger('click'); 81 }); 82 83 }); 84})(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.