1$.sidebarMenu = function(menu) { 2 var animationSpeed = 300; 3 4 var li_a=$('li a',menu); 5 //$(menu).on('click', 'li a', function(e) { 6 $(li_a).click(function(e) { 7 var $this = $(this); 8 var checkElement = $this.next(); 9 10 if (checkElement.is('.treeview-menu') && checkElement.is(':visible')) { 11 checkElement.slideUp(animationSpeed, function() { 12 checkElement.removeClass('menu-open'); 13 }); 14 checkElement.parent("li").removeClass("active"); 15 } 16 17 //If the menu is not visible 18 else if ((checkElement.is('.treeview-menu')) && (!checkElement.is(':visible'))) { 19 //Get the parent menu 20 var parent = $this.parents('ul').first(); 21 //Close all open menus within the parent 22 var ul = parent.find('ul:visible').slideUp(animationSpeed); 23 //Remove the menu-open class from the parent 24 ul.removeClass('menu-open'); 25 //Get the parent li 26 var parent_li = $this.parent("li"); 27 28 //Open the target menu and add the menu-open class 29 checkElement.slideDown(animationSpeed, function() { 30 //Add the class active to the parent li 31 checkElement.addClass('menu-open'); 32 parent.find('li.active').removeClass('active'); 33 parent_li.addClass('active'); 34 }); 35 } 36 //if this isn't a link, prevent the page from being redirected 37 if (checkElement.is('.treeview-menu')) { 38 e.preventDefault(); 39 } 40 }); 41}
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.