Jquery mobile 防止在点击保持后选中复选框
我已经试了好几天了,但没用。我有一个包含一些复选框的控制组,这些复选框与knockout.js绑定:Jquery mobile 防止在点击保持后选中复选框,jquery-mobile,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: {
<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>
弹出窗口正常打开,但最大的问题是复选框也被选中。该复选框只应在“点击”或“vclick”时选中,这是默认行为,似乎工作正常。问题是,当我按住(长触摸)时,弹出窗口打开,当我从屏幕上松开手指时,会生成vclick并选中复选框
我尝试了几种方法(在文档的正确位置):
在vclick eventhandler(和taphold eventhandler)中,但在我将手指从屏幕上松开(taphold)后,似乎没有办法取消vclick。有人有什么建议吗?谢谢大家!
PS,问题出在Android设备上…一个简单的解决方案是在弹出之前或之后使用jquery取消选中复选框。为输入类型复选框指定一个ID,例如--ID=“checkbox”--并将以下内容添加到taphold事件--$(“#checkbox”).prop('checked',false);谢谢,但这不是我喜欢的解决方案,因为我在“checked change”事件中做了几件事。我只是无法阻止它在Android上被检查。。。
$(document).on('taphold', '.ui-checkbox', function (event) {
$('#listitem-page #add-listitem-popup').popup('open', { transition: 'pop' });
});
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);
}