将selectmenu添加到可折叠

时间:2015-05-04 23:58:13

标签: jquery jquery-mobile

运行JQM 1.4.5

不确定这是否可行。尝试将selectmenu添加到可折叠标头。我已经尝试了各种各样的东西,但这已经接近我了:

HTML:

<div data-role="collapsible" data-content-theme="a" data-collapsed="true" id="my_id">
<h4>Butterflies
  <span class="select" style="float: right;" onclick="run(this);"><select name="select_name" id="select_id" data-native-menu="false"><option value="1">The 1st Option</option><option value="2">The 2nd Option</option></select></div>
  </span>
</h4>
<p>Read about Butterflies</p>
</div>

脚本:

$.widget('mobile.collapsible', $.mobile.collapsible, {
     _handleExpandCollapse: function (isCollapse) {
        if (this._trigger('before' + (isCollapse ? 'collapse' : 'expand'))) {
            this._superApply(arguments);
        }
    }
});

function run(object) {
    $('.ui-collapsible').on('collapsiblebeforeexpand', function (event, ui) {
        (this).child().selectmenu("open");
    });
}

因此,此代码在Google Chrome中的行为如下:

1)单击可折叠标题栏,它会按预期打开和关闭 2)点击选择菜单,按预期打开,我可以选择一个选项

BUT

单击可折叠标题栏不再有效。我再也无法打开任何可折叠的标题了。单击时标题变为蓝色但没有任何反应。

0 个答案:

没有答案
相关问题