我也可以通过单击其他元素来展开/折叠 JQuery ui Accordion 的内容吗? [英] Can I expand/collapse content of JQuery ui Accordion by click another elements too?
问题描述
默认情况下,有内容标题来控制展开/折叠.但在我的情况下,我也可以通过其他元素展开/折叠内容.例如:
jquery ui 代码基本结构:
<div class="demo"><div id="手风琴"><h3><a href="#">第 1 节</a></h3><div><p>Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam.整数ut neque.Vivamus nisi metus,molestie vel,gravida in,调味品坐阿梅特,农科.南尼布.Donec 怀疑 eros.南美.Proin viverra leo ut欧迪奥.Curabiturmalesuada.前庭是 velit eu ante scelerisque vulputate.</p>
......
现在.我有另一个元素,就像:
…………
非常感谢!!
您可以使用 .使用传入的 false 激活 以编程方式折叠所有元素.由于您一次只打开一个元素,因此这将折叠显示该链接的任何打开元素.这仅在您将 collapsible
设置为 true
时才有效.
您可以传入要展开的其他元素,以在单击时展开该元素.
By default, there are headers of contents to control expand/collapse.But in my situation,I could expand/collapse the contents by another elements ,too. For example:
the basic structure of jquery ui accodion code:
<script>
$(function() {
$( "#accordion" ).accordion();
});
</script>
<div class="demo">
<div id="accordion">
<h3><a href="#">Section 1</a></h3>
<div>
<p>
Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer
ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit
amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut
odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.
</p>
</div>
......
</div>
and now. I have another elements,just like :
<ul id="another elements can expand/collapse too">
<li><a href=""> expand/collapse contents of section1 of id=accordion too</a></li>
........
</ul>
thank you very much!!
You can use .activate with false passed in to collapse all elements programmatically. Since you only ever have one element open at a time, this will work to collapse whatever element is open showing that link. This will only work if you have collapsible
set to true
.
You can pass in what other element you want to expand to expand that element on click.
这篇关于我也可以通过单击其他元素来展开/折叠 JQuery ui Accordion 的内容吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!