Wijmo User Guide > Widgets > Accordion > Accordion How To > Expand All Panes |
Building on the Quick Start example, you can create a function to expand all closed panes in the accordion.
Note: In addition to creating our function, we also need to change the requireOpenedPane option, which is set to true by default, because it prevents all of the panes from collapsing. If you do not want to change this option to false, the script in the following section must be adjusted. |
Expand Script |
Copy Code
|
---|---|
<script type="text/javascript"> $(document).ready(function () { $("#accordion").wijaccordion({ header: "h2", expandDirection: "right", requireOpenedPane: false }); $("#expandAll").click(function(){expandAll();}); }); function expandAll(){ var accordion = $("#accordion"); accordion.wijaccordion("activate", accordion.find(".wijmo-wijaccordion-header.ui-state-default")); } </script> |
Button Markup |
Copy Code
|
---|---|
<button id="expandAll">Expand All</button> |