Explaining the accordion methods
The accordion includes a selection of methods that allow you to control and manipulate the behavior of the widget programmatically. Some of the methods are common to each component of the library, such as the destroy
method that is used by every widget. The following table lists the sole method for the accordion widget:
Method |
Use |
---|---|
|
Recalculates the height of the accordion panels; the outcome is dependent on the content and the |
Header activation
The option
method can be used to programmatically show or hide different drawers. We can easily test this method using a textbox and a new button. In accordion12.html
, add the following new markup directly after the accordion:
<label for="activateChoice">Enter a header index to activate </label> <input id="activateChoice"> <button type="button" id="activate">Activate</button>
Now change the <script>
element so that it appears as follows:
<script...