シンプルな HTML ページで使用する場合は正常に動作する longpress イベントを処理するために Javascript を使用していますが、Phonegap/Android でこのコードを使用している場合は動作しません。コードは以下のとおりです。
$(document).ready(function() {
debugger;
var mousedowntime;
$('#Button1').mousedown(function() {
var d = new Date();
mousedowntime = d.getTime();
//alert('Handler for .mousedown() called.');
//start a timer
});
$('#Button1').mouseup(function() {
// debugger;
//alert('Handler for .mouseup() called.');
//stop the timer and decide on long click
var d = new Date();
//alert("mousedowntime=" + mousedowntime);
presstime = d.getTime() - mousedowntime;
//alert("presstime=" + presstime);
if (presstime > 999/*You can decide the time*/) {
//Do_Action_Long_Press_Event();
alert("Long pressed.");
} else {
//Do_Action_Click_Event();
alert("Click.");
}
});
});