Collapsible Navigation
Collapsible Navigation
I have this HTML
- <li class="parent"><a href="#"><i class="fa fa-cog"></i> <span>Message Streams</span></a>
- <ul class="children">
-
-
- <li class="parent1"><a href="#"><i class="fa fa-cog"></i> <span>sean k</span></a>
- <ul class="children1">
- <li class="parent2"><a href="#"><i class="fa fa-cog"></i> <span>TEST 2 TEST 3</span></a>
- <ul>
-
- <li class="children2"><a href='https://pencopyediting.com/admin/message_streams/3'><i class="fa fa-cog"></i> Message Stream - TEST after IPN</a></li>
-
- </ul>
- </li>
-
- <li class="parent2"><a href="#"><i class="fa fa-cog"></i> <span>sk k</span></a>
- <ul>
-
- <li class="children2"><a href='https://pencopyediting.com/admin/message_streams/1'><i class="fa fa-cog"></i> Message Stream - TEST after IPN</a></li>
-
- <li class="children2"><a href='https://pencopyediting.com/admin/message_streams/2'><i class="fa fa-cog"></i> Message Stream - TEST after IPN</a></li>
-
- <li class="children2"><a href='https://pencopyediting.com/admin/message_streams/5'><i class="fa fa-cog"></i> Message Stream - TEST WITH MONEY</a></li>
-
- <li class="children2"><a href='https://pencopyediting.com/admin/message_streams/9'><i class="fa fa-cog"></i> Message Stream - EXAMPLE3</a></li>
-
- <li class="children2"><a href='https://pencopyediting.com/admin/message_streams/10'><i class="fa fa-cog"></i> Message Stream - EXAMPLE 6</a></li>
-
- </ul>
- </li>
-
-
- </ul>.
- </li>
- </ul>
- </li>
This is the jquery for showing and collapsing but when you click on parent1 nothing happens.I put in an alert to see but it isn't being called and I can't see why
- jQuery('.leftpanel .nav .parent .parent1 > a').click(function() {
- var coll = jQuery(this).parents('.collapsed').length;
- if (!coll) {
- jQuery('.leftpanel .nav .parent-focus').each(function() {
- jQuery(this).find('.children').slideUp('fast');
- jQuery(this).removeClass('parent-focus');
- });
- var child = jQuery(this).parent().find('.children');
- if(!child.is(':visible')) {
- child.slideDown('fast');
- if(!child.parent().hasClass('active'))
- child.parent().addClass('parent-focus');
- } else {
- child.slideUp('fast');
- child.parent().removeClass('parent-focus');
- }
- }
- return false;
- });
Similar code works for parent
Thanks