简体   繁体   English

jQuery UI 手风琴(默认全部隐藏)

[英]jQuery UI Accordion (hiding all by default)

Hello I am using jQuery UI Accodions你好,我正在使用jQuery UI Accodions

By default, the first accordion is shown and other are hidden.默认情况下,显示第一个手风琴,隐藏其他手风琴。 I would like to hide all the accordions by default until the user clicks it.我想默认隐藏所有手风琴,直到用户单击它。

How do I do that ?我该怎么做?

Thank You谢谢你

This is the updated code to accomplish the appropriate.这是完成相应操作的更新代码。

$( ".selector" ).accordion({active: false , collapsible: true}); $( ".selector" ).accordion({active: false , collapsible: true});

这段代码应该完成这个

$( ".selector" ).accordion({ active: false });

"Setting active to false will collapse all panels. This requires the collapsible option to be true." “将 active 设置为 false 将折叠所有面板。这需要可折叠选项为真。” http://api.jqueryui.com/accordion/#option-active http://api.jqueryui.com/accordion/#option-active

To hide all the accordion's panel by default, you need to set the following 2 options:要默认隐藏所有手风琴面板,您需要设置以下 2 个选项:

  $("#accordion").accordion({
    active: false,
    collapsible: true
  });

The active option specifies which panel is currently open. active选项指定当前打开的面板。 By default its value is 0, ie the first panel.默认情况下它的值为 0,即第一个面板。

The collapsible option specifies whether all the sections can be closed at once. collapsible选项指定是否可以一次关闭所有部分。 Allows collapsing the active section.允许折叠活动部分。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM