【问题标题】:jquery mobile collapsible-set perform jquery function on collapsejquery mobile collapsible-set 在折叠时执行 jquery 功能
【发布时间】:2014-09-26 08:26:04
【问题描述】:

我正在尝试对 jquery mobile collapsible-set 的折叠/展开执行操作。我正在运行 jquery.mobile-1.4.4 和 jquery-1.11.0。

我已经在 fiddle 上发布了代码来测试它是否有效,但它没有。此功能适用于旧版本的 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 html jquery-mobile


    【解决方案1】:

    从 jQuery Mobile 1.4 开始,expandcollapse 事件已被弃用并替换为 collapsibleexpandcollapsiblecollapse

    $(document).on("pagecreate", "#pageID", function () {
       $(".selector").on("collapsibleexpand collapsiblecollapse", function () {
          /* code */
       });
    });
    

    Demo

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-04-26
      • 1970-01-01
      • 1970-01-01
      • 2012-08-31
      • 2018-03-05
      • 2012-01-14
      • 1970-01-01
      相关资源
      最近更新 更多