Friday, May 10, 2024
 Popular · Latest · Hot · Upcoming
100
rated 0 times [  106] [ 6]  / answers: 1 / hits: 21042  / 14 Years ago, mon, february 7, 2011, 12:00:00

I am using phonegap for build android apps.



I would like to detect user's gesture such as a user's swipe. Is there an event i can call from javascript?



Thanks!


More From » android

 Answers
174

I use a JavaScript framework called xui (homepage) that has a similar API to jQuery.



You can use this framework coupled with the swipe plugin to get access to easy gesture events. See the swipe/ directory under that repository for the code and example (specifically under index.html). A brief example:



x$('body').swipe(function(e, data) {
console.log('type:' + data.type + ' deltaX:' + data.deltaX + ' deltaY:' + data.deltaY + ' distance:' + data.distance + ' delay:' + data.delay+' direction:' + data.direction );
});

[#93866] Friday, February 4, 2011, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ibrahimr

Total Points: 468
Total Questions: 99
Total Answers: 93

Location: Serbia
Member since Sun, Jul 11, 2021
3 Years ago
ibrahimr questions
Tue, Jun 22, 21, 00:00, 3 Years ago
Tue, May 26, 20, 00:00, 4 Years ago
Fri, Jan 3, 20, 00:00, 4 Years ago
;