1// Following functions are related to the sidebar nav 2// Show and hide the sidebar 3$(".sidebar-toggle").click(function(e) { 4 e.preventDefault(); 5 $("#wrapper").toggleClass("toggled"); 6}); 7 8/** 9 * This function generates the âunrollingâ of the secction by adding 10 * some classes to the element and applying a jQuery slide action 11 * 12 * @param el The DOM element on which to perform the action 13 * @param speed The desired speed to slide up/down the section 14 */ 15function activate (el, speed) { 16 if (!el.parent().hasClass('active')) { 17 $('.sidebar-nav li ul').slideUp(speed); 18 el.next().slideToggle(speed); 19 $('.sidebar-nav li').removeClass('active'); 20 el.parent().addClass('active'); 21 } 22 else { 23 el.next().slideToggle(speed); 24 $('.sidebar-nav li').removeClass('active'); 25 } 26} 27 28// On click slide down or up the links section 29$('.sidebar-nav > li > a').click(function(e) { 30 e.preventDefault(); 31 activate($(this), 300); 32}); 33 34// This detects the path to activate the current link accordingly 35var current = location.pathname; 36$('.sidebar-nav > li > ul a').each(function() { 37 var $this = $(this); 38 // If the current path is like this link, make it active 39 if ($this.attr('href') === current){ 40 $this.addClass('active'); 41 activate($this.closest('.sidebar-nav > li').children('a'), 0); 42 } 43})
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.