phonegap を使用してモバイル アプリを開発しているときに、小さな問題に直面しています。タッチがボタンのいずれかを押すと、タッチ中に背景を交換して、ユーザーに何が起こっているかを視覚的にフィードバックできるようにします。
しかし、onmousedown イベントは、onclick と onmouseup を除いて、Android やその他のイベントで発生することはありませんか? どうすればそれを達成できますか?
機能する背景を交換するJavaScriptメソッドがあります。
function touched(isTouched){
console.log(isTouched);
if (isTouched) {
$('.blue_cell.firstCell').css("background-image", "url(images/cells/list-cell.png)");
} else {
$('.blue_cell.firstCell').css("background-image", "url(images/cells/blue-cell.png)");
}
}
そして、使用してみたイベントを含むテストボタンがあります:
<div class='blue_cell firstCell' onmouseup="touched(false)" onmousedown="touched(true)"
onmouseover="touched(true)" onfocusin="touched(true)">
<div class='cellMainText'>openPopOver()</div>
<div class='cellIconText'>POP</div></div>
ありがとう