我正在尝试对 jquery mobile 可折叠集的折叠/展开执行操作。我正在运行 jquery.mobile-1.4.4 和 jquery-1.11.0。
我已经在小提琴上发布了代码来测试它是否有效,但它不起作用。此功能适用于旧版本的 jquery mobile 和 jquery。
http://jsfiddle.net/6txWy/
HTLM:
<div id="football" data-role="collapsible-set">
<div data-role="collapsible" data-collapsed="false">
<h3>Section 1</h3>
<p>I'm the collapsible set content for section 1.</p>
</div>
<div data-role="collapsible">
<h3>Section 2</h3>
<p>I'm the collapsible set content for section 2.</p>
</div>
JS:
$('#football').bind('expand', function () {
alert('Expanded');
}).bind('collapse', function () {
alert('Collapsed');
});
有谁知道有什么方法可以实现我想要做的事情吗?
提前致谢!
从 jQuery Mobile 1.4 开始,expand
and collapse
事件已被弃用并替换为collapsibleexpand
and collapsiblecollapse
.
$(document).on("pagecreate", "#pageID", function () {
$(".selector").on("collapsibleexpand collapsiblecollapse", function () {
/* code */
});
});
Demo
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)