Sunday, 8 September 2013

Accordeon change class in clicked element, easy how to do it?

Accordeon change class in clicked element, easy how to do it?

That is HTML Section:
<div class="accordion">
<div class="accord-header">
<a class="fleft">1 Title</a>
<a class="fright exp"></a>
</div>
<div class="accord-content">
ble ble ble
</div>
<div class="accord-header">
<a class="fleft">2 Title</a>
<a class="fright exp"></a>
</div>
<div class="accord-content">
bla bla bla
</div>
</div>
That is Jquery section:
$(document).ready(function() {
$(".accordion .accord-header").click(function() {
if($(this).next("div").is(":visible")){
$(this).next("div").slideUp("slow");
} else {
$(".accordion .accord-content").slideUp("slow");
$(this).next("div").slideToggle("slow");
}
});
});
Basicly what it does it is accordeon for my articles list. Now I need to
change class of element "fright exp" to "fright imp" wheen 1 tab is
clicked, same thing for next tabs. "fright exp" is symbol + and "fright
imp" is -, is there a easy way ?

No comments:

Post a Comment