Joomla javascript(JQuery) accordion menu always expand all nodes when click on last child element
<p>I'm new to joomla and Jquery. Please take this in mind.</p>

<p>I've a javascript accordion menu that is not working well: when I click on the last child element, then all nodes appears expanded. Not only the node(father) of the children clicked.</p>

<p>I've the index.php of the template that shows:</p>

<pre><code>function initMenu() {
        $('.menu ul').hide();
        $('.menu li.active.parent ul').show();
        $('.menu li a').click(
        function() {
        $(this).next().slideToggle('normal');
        }
        );
        }
    $(document).ready(function() {initMenu();});
</code></pre>

<p>[I can't post the images that I edited to show the behaviour(because I don't have reputation), so I'll explain the situation with a concept menu]</p>

<p><strong>Behaviour shown:</strong></p>

<p>Node1<br>
|||||Node1.1<br>
|||||Node1.2<br>
||||||||||||Node1.2.1<br>
<strong>|||||||||||||||||||||Node 1.2.1.1</strong>&lt;----- Clicking here all nodes below are expanded!<br>
|||||Node1.3<br>
Node2<br>
|||||Node2.1<br>
||||||||||||Node2.1.1<br>
||||||||||||Node2.1.2<br>
||||||||||||Node2.1.3<br>
|||||||||||||||||||||Node2.1.3.1<br>
|||||||||||||||||||||Node2.1.3.2<br>
|||||||||||||||||||||Node2.1.3.3<br>
Node3<br></p>

<p><strong>Correct Behaviour:</strong></p>

<p>Node1<br>
|||||Node1.1<br>
|||||Node1.2<br>
||||||||||||Node1.2.1<br>
<strong>|||||||||||||||||||||Node 1.2.1.1</strong> &lt;----- Clicking here don't show any more childs<br>
|||||Node1.3<br>
Node2<br>
Node3<br></p>

<p>Any help on this will be apreciated.
Regards. </p>
