Controlling collapsed state in Jquery Mobile
Is there any way to control state of a collapsible portion of the page from javascript as per the example below?开发者_StackOverflow
<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="....">
I've found:
$('myCollapsible').trigger('collapse').trigger('updatelayout');
or
$('myCollapsible').trigger('expand').trigger('updatelayout');
to be the best way for controlling the collapsible elements
outdated
ui-collapsible-content
inside your collapsible has an aria-hidden
attribute - use this to check the state.
$('yourthing a:first').click()
toggles the state.
This is not very nice, but I haven't seen a nice implementation yet.
精彩评论