jQueryUI - Accordion - 使用ID设置Active [英] jQueryUI - Accordion - Setting Active using ID
本文介绍了jQueryUI - Accordion - 使用ID设置Active的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经检查了许多试图解决这个问题的网站。但是,我没有运气,并认为我会继续在这里发帖。
I've checked a number of sites trying to figure this out. However, I have had no luck and figured I would go ahead and make a post on here.
我要做的是根据ID设置Active Accordion。下面是我正在使用的内容。
What I am trying to do is setting the Active Accordion depending on ID. Below, is what I am working with.
jQuery代码:
$(function () {
$("#accordion").accordion({
collapsible: true,
header: "h3",
active: 'h3.content3',
heightStyle: "content"
});
});
HTML:
<div id="accordion">
<h3 class="content1">Content Title</h3>
<div align="left">
<p>Content for 1 Goes Here</p>
</div>
<h3 class="content2">Content Title</h3>
<div align="left">
<p>Content for 2 Goes Here</p>
</div>
<h3 class="content3">Content Title</h3>
<div align="left">
<p>Content for 3 Goes Here</p>
</div>
</div>
我希望我解释得很好,如果没有,请告诉我。我会尽力帮助你。
I hope I explained it well enough, If not, Let me know. I'll try to help ya.
推荐答案
设置有效
基于 h3
索引:
active: $('#accordion h3').index($('.content3'))
这篇关于jQueryUI - Accordion - 使用ID设置Active的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文