JQuery-Mobile可折叠的展开/折叠事件

问题描述:

除了标头的onclick事件之外,还有谁知道其他方法来捕获标有data-role="collapsible"的组件的展开或折叠事件吗?

Does anyone know any other way to capture the event of expanding or collapsing a component marked with data-role="collapsible" apart from the onclick event of its header?

我想要某种类型的事件,该事件还将提供有关组件的展开/折叠状态的信息.

I would like some kind of event that will also provide information about the expanded/collapsed state of the component.

collapsible块具有自定义事件.您可以绑定到expandcollapse事件:

There are custom events for the collapsible blocks. You can bind to the expand and collapse events:

$('#my-collapsible').bind('expand', function () {
    alert('Expanded');
}).bind('collapse', function () {
    alert('Collapsed');
});

这是一个jsfiddle: http://jsfiddle.net/6txWy/

Here is a jsfiddle: http://jsfiddle.net/6txWy/