How to keep a link active (as a normal link) inside an accordion
Hi
I'm new to jQuery and have a problem with links inside an accordion.
The simplified code looks like this:
- <div class="active-item">
<div class="available-items">
<h5>Headline</h5>
</div>
<div class="table-accordion">
<table>
<tr>
<td><a href="#link">Row 1 --- Content</a></td>
<td><a href="#link">Row 2 --- Content</a></td>
<td><a href="#link">Row 3 --- Content</a></td>
</tr>
</table>
</div>
</div>
The jQuery is adapted from a tutorial i found in the net and looks like that:
- $('.table-accordion').hide();
$('.active-item').click( function() {
var trig = $(this);
if ( trig.hasClass('active-item_active') ) {
trig.children('.table-accordion').slideToggle('fast');
trig.removeClass('active-item_active');
} else {
$('.active-item_active').children('.table-accordion').slideToggle('fast');
$('.active-item_active').removeClass('active-item_active');
trig.children('.table-accordion').slideToggle('fast');
trig.addClass('active-item_active');
};
return false;
});
The problem is, that the links inside the table are not active. If i click them, the accordion is closing. What do i have to do, to keep the links inside the open accordion as normal links, without closing the accordion?
I hope my question is clear... my english definetly isn't. Sorry ;-)