我也可以通过单击其他元素来扩展/折叠JQuery ui Accordion的内容吗? [英] Can I expand/collapse content of JQuery ui Accordion by click another elements too?

查看:71
本文介绍了我也可以通过单击其他元素来扩展/折叠JQuery ui Accordion的内容吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

默认情况下,有一些标头来控制扩展/折叠.但是在我的情况下,我也可以通过其他元素来扩展/折叠内容.例如:

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:

jquery ui accodion代码的基本结构:

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>

非常感谢您!

推荐答案

您可以使用.通过传入false激活,以编程方式折叠所有元素.由于您一次只能打开一个元素,因此可以折叠显示该链接的任何打开的元素.只有将collapsible设置为true时,此功能才起作用.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆