Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Technique for detecting multiple taps

ANSWERED

What's the best way to detect multiple taps?

Author | ch, passion for improvement.

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

@francogrex - here is a sample tap detection

tapR.onclick = function() {
baseCount++;
// after 400 ms see how many taps have occurred and react accordingly

setTimeout(function(){

if ( baseCount == 1) { // scroll up
consolelog("scrollup tap click");
}

if ( baseCount == 2) { //scroll down
consolelog("scrolldown tap click");
}

console.log("tap reset click count");
baseCount = 0;
}, 400);
}    

Author | ch, passion for improvement.

View best answer in original post

Best Answer
0 Votes
1 REPLY 1

@francogrex - here is a sample tap detection

tapR.onclick = function() {
baseCount++;
// after 400 ms see how many taps have occurred and react accordingly

setTimeout(function(){

if ( baseCount == 1) { // scroll up
consolelog("scrollup tap click");
}

if ( baseCount == 2) { //scroll down
consolelog("scrolldown tap click");
}

console.log("tap reset click count");
baseCount = 0;
}, 400);
}    

Author | ch, passion for improvement.

Best Answer
0 Votes