Reputation: 211
i want in this when tab slide up remove class active and add active class in open tab
$(document).ready(function(){
$("#accordian li h3").click(function(){
//slide up all the link lists
$("#accordian ul .row").slideUp();
//slide down the link list below the h3 clicked - only if its closed
if(!$(this).next().is(":visible"))
{
$(this).next().slideDown();
}
})
})
Upvotes: 0
Views: 3797
Reputation: 74420
$(document).ready(function () {
$("#accordian li h3").click(function () {
var $parent = $(this).parent();
if ($parent.hasClass('active')) return;
//slide up all the link lists
$("#accordian ul .row").slideUp();
$(this).next().slideDown(function () {
$parent.addClass('active').siblings().removeClass('active');
});
})
})
Upvotes: 1
Reputation: 15861
first remove all active class. then add to the current clicked one's. Demo: Accordion
$('#accordian li').removeClass('active');
$(this).parent('li').addClass('active');
Upvotes: 1