JSFiddle - React, Tailwind, and code Playground
HTML
<div class="scroll">
<ul id="expander" class="reports_list">
<li class="closed">
<h4>Ethylene Asia Margin Report Weekly</h4>
<p>20th Oct 2010</p>
<ul class="pdf">
<li class="closed">22 October 2010
<ul class="pdf">
<li><a href="#" target="_blank">1asdf</a></li>
</ul>
</li>
<li><a href="#" target="_blank" title="PDF document: opens in a new window">15 October 2010</a></li>
<li><a href="#" target="_blank" title="PDF document: opens in a new window">08 October 2010</a></li>
<li><a href="#" target="_blank" title="PDF document: opens in a new window">01 October 2010</a></li>
</ul>
</li>
<li class="closed">
<h4>ABS Europe weekly</h4>
<p>19th Oct 2010</p>
<ul class="pdf">
<li><a href="#" target="_blank" title="PDF document: opens in a new window">12 October 2010</a></li>
<li><a href="#" target="_blank" title="PDF document: opens in a new window">04 October 2010</a></li>
<li><a href="#" target="_blank" title="PDF document: opens in a new window">01 October 2010</a></li>
<li><a href="#" target="_blank" title="PDF document: opens in a new window">01 October 2010</a></li>
</ul>
</li>
<li class="closed">
<h4>Ethylene Asia Margin Report Weekly</h4>
<p>20th Oct 2010</p>
<ul class="pdf">
<li><a href="#" target="_blank" title="PDF document: opens in a new window">22 October 2010</a></li>
<li><a href="#" target="_blank" title="PDF document: opens in a new window">15 October 2010</a></li>
<li><a href="#" target="_blank" title="PDF document: opens in a new window">08 October 2010</a></li>
<li><a href="#" target="_blank" title="PDF...
JavaScript
$("#expander ul").hide();
$("#expander h4").live("click", function(e) {
var $this = $(this);
var $nestList = $($this).parent().find("ul");
var $scrollPane = $(".scroll");
// hide visible nested lists
$("#expander ul:visible").hide("fast", function(){
$(this).closest("li").removeClass("open").addClass("closed");
});
// show this list
if( $nestList.is(':visible'))
{
$nestList.hide();
}
else
{
$nestList.show("fast", function() {
$(this).closest("li").removeClass("closed").addClass("open");
});
}
// resize scrollbars
$scrollPane.jScrollPane();
e.preventDefault();
});