我正在尝试在卡片上实现双击。卡片显示正常但双击时不会发生任何操作。我尝试使用' dblclick'但它不起作用,可能是因为它不允许在框架7中。坚持建议正确的方法。
$$('.ord').on('taphold', function() {
var identity=this.id.toString();
myApp.modal({
title:'Quantity',
text:'<p>'+$$("#menuItem"+this.id.toString()).text()+ '<span style="float:right">'+$$("#menuPrice"+this.id.toString()).text()+'</span></p>'+'<p id="qty">'+quantity[parseInt(identity)]+'</p><p class="buttons-row"><button class="button button-raised button-fill color-red" id="increase" onClick="addUp('+identity+')">inc</button> <button class="button button-raised button-fill color-red" id="decrease" onClick="sub('+identity+')">dec</button></p>',
buttons:[
{
text:'add',
onClick: function() {
if (quantity[parseInt(identity)]>0)
{
var obj={name:$$("#menuItem"+identity).text(),price:$$("#menuPrice"+identity).text(),Quantity:quantity[parseInt(identity)],Category:allCategory[parseInt(identity)]};
orderArray.push(obj);
}
}
},
{
text:'cancel',
onClick:function() {
quantity[parseInt(identity)]=0;
document.getElementById("qty").innerHTML=quantity[parseInt(identity)];
}
},
]
})
});
&#13;
<span class="ord" id='+i+'><div class="card" id="listId"><div class="card-content color-white" style="background-color:red;"><div class="card-content-inner"><p><b><span id="menuItem'+i+'">' + allItems[i] + '</span><span style="float:right" id="menuPrice'+i+'">' + allPrices[i] + '</span></b></p></div></div></div></span>
&#13;
答案 0 :(得分:0)
以下是我用来退出应用的示例: 首先添加事件监听器,计数点击并双击退出。
// activate back button
document.addEventListener('backbutton', onBackKeyDown, false);
// functions on back button
function onBackKeyDown() {
if ($$('.page-on-center').length === 0 || $$('.page-on-center').attr('data-page') === 'index-1') {
if (backi === 1) {
backi = 0;
navigator.app.exitApp();
}
else {
backi++;
myApp.addNotification({
message: 'Tap twice to leave App.',
button: {
text: 'No, thanks.'
}
}
});
}
// end else
}
//end else if
else {
$$('.back').click();
}
return backi;
};