1 line
761 B
JavaScript
1 line
761 B
JavaScript
|
$.fn.sidebar=function(){var e=this,s=e.children(".sidebar-tabs").first(),i=e.children(".sidebar-content").first();return e.find(".sidebar-tabs > li > a").on("click",function(){var s=$(this).closest("li");s.hasClass("active")?e.close():e.open(this.hash.slice(1),s)}),e.open=function(a,l){"undefined"==typeof l&&(l=s.find('li > a[href="#'+a+'"]').parent()),i.children(".sidebar-pane.active").removeClass("active"),i.children("#"+a).addClass("active"),s.children("li.active").removeClass("active"),l.addClass("active"),e.trigger("content",{id:a}),e.hasClass("collapsed")&&(e.trigger("opening"),e.removeClass("collapsed"))},e.close=function(){s.children("li.active").removeClass("active"),e.hasClass("collapsed")||(e.trigger("closing"),e.addClass("collapsed"))},e};
|