检测用户的手势,如刷卡 [英] Detect user's gesture such as swipe

查看:109
本文介绍了检测用户的手势,如刷卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的PhoneGap为构建Android应用程序。

I am using phonegap for build android apps.

我想检测用户的手势,如用户的刷卡。有一个事件,我可以从JavaScript调用?

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

谢谢!

推荐答案

我用被称为JavaScript框架 XUI 首页),有一个类似的API来jQuery的。

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

您可以使用这个框架加上的刷卡插件,以获得进入易手势事件。见在该库为code和例子(特别是下的index.html)的刷卡/目录。一个简单的例子:

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

这篇关于检测用户的手势,如刷卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆