如何执行此功能
如果我点击<a href="#">Collapse All</a>
而不是打开all Accordian
而再次点击这个Collapse all
我正在使用 uiJqueryAccordian
html代码
<h1>My Accordina</h1> <a href="#">Collapse All</a>
<div class="js_enrollment">
<h4>demo section one</h4>
<div class="">here some text here some text</div>
<h4>demo section one</h4>
<div class="">here some text here some text</div>
<h4>demo section one</h4>
<div class="">here some text here some text</div>
<h4>demo section one</h4>
<div class="">here some text here some text</div>
</div>
jquery代码
$( ".js_enrollment" ).accordion({
header: "h4",
icons: { "header": "icon-plus", "headerSelected": "icon-minus" },
autoHeight: false
});
我 finding this 但未解决我的问题
答案 0 :(得分:0)
您可以尝试这样
$('a').on('click', function () {
if ($('.ui-accordion-content').is(':visible') ){
$(this).text('Collapse ALl');
$('.ui-accordion-content').hide();
}
else {
$(this).text('Expand ALl');
$('.ui-accordion-content').show();
}
});