Hello, I was wondering how to make 
http://www.learningjquery.com/2007/03/accordion-madness
by Karl, work with an unordered lis instead of divs. I tried the below
but did not work. I think what I have done here ('.links:visible');
looks plain wrong (I can't put a class or an Id in there right??)

$(document).ready(function() {

 $('.links').hide();

$('.category').click(function() {

var $nexto = $(this).next();

var $visibleSiblings = $nexto.siblings('.links:visible');

if ($visibleSiblings.length ) { $visibleSiblings.slideUp('fast',
function() {$nexto.slideToggle('fast'); });
} else {
$nexto.slideToggle('fast');
 }
 });
 });

The HTML:

<ul>
<li class="category">Web Packages and Services
<ul class="links">
<li><a href="somewhere.html">How do you do</a></li>
<li><a href="somewhere.html">How are you going</a></li>
<li><a href="somewhere.html">Have a good day</a></li>
<li><a href="somewhere.html">Testing testing</a></li>
<li><a href="somewhere.html">Good day to you</a></li>
</ul>
</li>
<li class="category">Web Packages and Services
<ul class="links">
<li><a href="somewhere.html">How do you do</a></li>
<li><a href="somewhere.html">How are you going</a></li>
<li><a href="somewhere.html">Have a good day</a></li>
<li><a href="somewhere.html">Testing testing</a></li>
<li><a href="somewhere.html">Good day to you</a></li>
</ul>
</li>
</ul>

Reply via email to