Collapse state management in jQuery Mobile

Is there a way to control the state of the collapsible part of the page from javascript according to the example below?

<div data-role="collapsible" data-collapsed="true">
<h3>Title</h3>
I'm some hidden content
</div>

<input type="button" value="click me to open the above section" onclick="....">
+3
source share
2 answers

outdated


ui-collapsible-contentinside your collapsible attribute aria-hidden- use this to check the status.

$('yourthing a:first').click()

switches state.

This is not very nice, but I have not seen a good implementation.

0
source

I found:

$('myCollapsible').trigger('collapse').trigger('updatelayout');

or

$('myCollapsible').trigger('expand').trigger('updatelayout');

to best manage discharged items

+18
source

Source: https://habr.com/ru/post/1782905/


All Articles