在taphold之后防止复选框被检查

时间:2014-05-26 20:38:35

标签: jquery-mobile

我现在已经尝试了几天,但它不会工作。我有一个包含一些复选框的控制组,这些复选框与knockout.js绑定:

<div data-role="content">
    <div data-role="fieldcontain" data-bind="with:selectedList, jqmRefreshList:selectedList">
        <fieldset data-role="controlgroup" data-bind="foreach: { data: items }" data-inset="true" data-filter="true" data-mini="true">
            <input type="checkbox" data-bind="attr: {id:guid}, checked:isChecked" />
            <label data-bind="text:value, attr: {for:guid}"></label>
        </fieldset>
    </div>
</div>

我正在使用&#34; taphold&#34;事件,我想打开一个弹出窗口:

$(document).on('taphold', '.ui-checkbox', function (event) {
    $('#listitem-page #add-listitem-popup').popup('open', { transition: 'pop' });
});

弹出窗口正常打开,但最大的问题是正在检查复选框。只应在&#34;点击&#34;上检查该复选框。或&#34; vclick&#34;,这是默认行为,似乎工作正常。问题是当我敲击(长按)时,弹出窗口打开,当我从屏幕上松开手指时,会生成vclick并检查复选框。

我尝试了几件事(在文档中的正确位置):

event.preventDefault();
event.stopPropagation();
event.stopImmediatePropagation();
$.event.special.tap.emitTapOnTaphold = false;



.ui-checkbox {
        -webkit-touch-callout: none !important;
    }

.ui-mobile {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: rgba(0,0,0,0);
}
在vclick事件处理程序(以及taphold事件处理程序)中的

,但是在我从屏幕上释放手指后,似乎没有办法取消vclick发生(taphold)。有没有人有建议?谢谢!

PS,问题出在Android设备上......

0 个答案:

没有答案