HTML
<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>
jQuery
$(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");
}
});
});
基本上,它的作用是我的文章列表的手风琴。现在,当单击 1 个选项卡时,我需要将<a>
元素“fright exp”的类更改为“fright imp”,下一个选项卡也是如此。“fright exp”是符号+,“fright imp”是-,有简单的方法吗?