Open softelos opened 8 years ago
I use this in my code for mine side menu I have and thought I would share this.
html -
jquery - $(document).ready(function() { $(".custom-search-form input[type=text]").keyup(function(e) { var valThis = $(this).val(); $("#side-menu a").each(function() { if($(this).html().search(new RegExp(valThis, 'ig')) < 0 && valThis.length > 0) { if($(this).parent('li').length > 0) { $(this).hide(); } else { $(this).hide(); } } else if(valThis.length > 0) { $(this).show().addClass('active').parent().parent().addClass('in').parent().children('a.active').show(); } else { $(this).show().removeClass('active').parent().parent().removeClass('in').parent(); } }); }); });
maybe will fix this
I'm trying to add a button that expands or collapses all the first level
<li>
tags in the menu (I'm giving them classfirst
to easily locate them). I can get the menu expanding and collapsing, however with the following issues:Can you please check if I'm doing it properly? here is my code, where
dashboard-sidebar-expand
is the ID of the button that is pressed,dashboard-sidebar-menu
is the menu ID, and the glyphicon thing is just to control the picture shown on the button:Thanks.