CodeIgniter Forums
JS Function For Menu Codeigniter - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: JS Function For Menu Codeigniter (/showthread.php?tid=59615)



JS Function For Menu Codeigniter - El Forum - 10-27-2013

[eluser]razerone[/eluser]
Hi I am making menu for codeigniter.

Just about there just stuck on small issue.

I need to be able to make the parent category when click on it to show then if click on it again to hide.

At the moment I have only got it working for so parent cat opens when click. Just need to have second option so can click on parent again after it opens it click it will close

$('.nav-show').hide();

$("li:has(ul)").click(function(){

$("ul",this).slideDown();
});


<div class="container">
<div class="row">
<div class="col-lg-3 col-md-3 col-sm-12 col-xs-12">
<div class="sidebar">
<ul class="nav sidenav">
<li><a href="#">Home</a></li>
<li><a href="#">Download Software</a></li>
<li>
<a href="#">Features</a>
<ul class="nav nav-show">
<li><a href="#">Font Page Database</a></li>
<li><a href="#">TPL Links</a></li>
<li><a href="#">Custom Contact Page</a></li>
</ul>
</li>
<li><a href="#">Custom Modules</a></li>
<li><a href="#">CWS User Guide</a></li>
<li>
<a href="#">CWS HMVC Codeigniter</a>
<ul class="nav nav-show">
<li><a href="#">Modules</a></li>
<li><a href="#">TPL Links</a></li>
<li><a href="#">Custom Contact Page</a></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
</div>


JS Function For Menu Codeigniter - El Forum - 10-28-2013

[eluser]Tpojka[/eluser]
Check jquery site/forums, but you can also try with toggle() function.