开发者

Controlling collapsed state in Jquery Mobile

开发者 https://www.devze.com 2023-02-01 17:57 出处:网络
Is there any way to control state of a collapsible portion of the page from javascript as per the example below?开发者_StackOverflow

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消