I'm having difficulty implementing an accordion effect on three different tables using jQuery and I could use some assistance. Right now it works o.k. When I click on the header rows the subsequent rows show, but I'd like some type of animation. I'd also like to have the first table show completely, but I'm a newbie and this is above my head.
Here is my HTML.
<table class="research">
<tbody>
<tr class="accordion">
<td colspan="3">This is the header</td>
</tr>
<tr>
<td>Research</td>
<td>Description</td>
<td>Partner</td>
</tr>
<tr>
<td>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</td>
<td>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</td>
<td>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</td>
</tr>
</tbody>
</table>
<table class="research">
<tbody>
<tr class="accordion">
<td colspan="3">This is the header</td>
</tr>
<tr>
<td>Research</td>
<td>Description</td>
<td>Partner</td>
</tr>
<tr>
<td>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</td>
<td>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</td>
<td>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</td>
</tr>
</tbody>
</table>
<table class="research">
<tbody>
<tr class="accordion">
<td colspan="3">This is the header</td>
</tr>
<tr>
<td>Research</td>
<td>Description</td>
<td>Partner</td>
</tr>
<tr>
<td>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</td>
<td>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</td>
<td>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</td>
</tr>
</tbody>
</table>
And here is my jQuery:
$(function() {
$(".research tr:not(.accordion)").hide();
$(".research tr:first-child").show();
$(".research tr.accordion").click(function(){
$(this).nextAll("tr").toggle();
});
});