I have a pretty complex nested accordion tree navigation "working" @ http://www.medlargroup.com the test site for a client.
It appears to work correctly only it is not collapsed by default and so is incredibly long. I attempted to put the various divs and classes around it as bootstrap intended but I got a very complex mess and also inappropriate styling I would then have to over-write.
If anyone could advise me of a JavaScript solution to make the boxes auto-collapse when not part of the active tree it would be much appreciated.
The php generated nav is as follows:
N.B. the variable $id is set at 0 from outside and parsed in when the snippet is called. It is a recursive function so it makes the standard div wraps even more complicated and an alternative js solution more attractive.
<?php if(!isset($subpages)) $subpages = $site->pages() ?>
<?php $id+=1 ?>
<ul id="accordiongroup_<?php echo $id ?>" class"collapse in">
<?php
foreach($subpages->visible() AS $p): ?>
<li class="depth-<?php echo $p->depth() ?>">
<a href="#accordiongroup_<?php echo $id+1 ?>" data-toggle="collapse" data-parent="<?php echo $id ?>" >
<?php if($p->hasChildren())
{ echo $p->title() ?></a>
<?php snippet('accordionmenu', array('subpages' => $p->children(), 'id' => $id)) ?>
<?php $id+=1;}
else { ?>
<a class=" <?php echo ($p->isActive()) ? 'active' : '' ?>" href="<?php echo $p->url() ?>"><?php echo $p->title() ?></a>
<?php }
?>
</li>
<?php endforeach;?>
</ul>