0

I am trying to implement double tap on a card.The card is displayed alright but no action takes place on double click.I tried to use 'dblclick' but its not working,maybe because it is not allowed in framework7 .Kindly suggest the proper way to do so.

$$('.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)];
                }
            },
            ]
        })
    });
<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>

1 Answer 1

0

Here is an example i am using to quit the app: Add event listener at first, count taps and quit on double tap.

// 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;
};

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.