Mackit上的Webkit手势的Javascript事件? [英] Javascript events for gestures in Webkit on Mac?

查看:46
本文介绍了Mackit上的Webkit手势的Javascript事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能在Javascript的Mac桌面上的Webkit上获取手势事件,例如3指滑动?我做了一些谷歌搜索,找不到任何东西。否则,我想我可以将它们从Cocoa传递给WebView。我对3指滑动特别感兴趣。

Is it possible to get gesture events, such as a 3 finger swipe back, on Webkit on the Mac desktop in Javascript? I did a few Google searches and couldn't find anything. Otherwise, I guess I could pass them from Cocoa to a WebView. I am particularly interested in the 3 finger swipe back.

编辑

即使在Sencha Touch中也是如此厨房水槽应用程序关于我的Macbook Pro上的最新Webkit夜晚,刷卡事件未检测到。但是,对于我来说,使用Backbone.js历史插件进行部分Ajax样式页面更新(呃,不能相信我没想到)时,只需使用浏览器历史记录状态就可以更方便了,这样用户就可以去了返回使用浏览器后退按钮,或3手指轻扫。

It appears that even in the Sencha Touch Kitchen Sink app on the latest Webkit night nighlies on my Macbook Pro, swipe events aren't detected. However there is an easier solution for me to simply use the browser history state when doing partial Ajax style page updates (duh, can't believe I didn't think of that) with the Backbone.js history plugin so that the user can go back using the browser back button, or 3 finger swipe.

推荐答案

Webkit目前与触控API不兼容。

Webkit is not compatible with the touch API for the moment.

如果您想知道是否支持触摸事件api,您可以使用modernizr并根据结果修改您的UI ...

If you want to know if the touch events api is supported, you can use modernizr and modify your UI depending to the results ...

在此处下载:< a href =http://www.modernizr.com/ =nofollow> http://www.modernizr.com/ 然后写下这样的东西:

Download it here : http://www.modernizr.com/ Then write something like this :

if (Modernizr.touch){
  // bind to touchstart, touchmove, etc and watch `event.streamId`
} else {
  // bind to normal click, mousemove, etc
}        

Modernizr也定制你的body元素的类,所以你可以用CSS访问它

Modernizr customize also your body element's class, so you can access to it with CSS

你可以用yepnope js完成它: http://yepnopejs.com/

You can complete it with yepnope js : http://yepnopejs.com/

yepnope({
  test: Modernizr.touch,
  yep: 'touch-ui.js',
  nope: 'standard-ui.js'
});

当支持事件时,你可以使用jQuery mobile。

And when the events are supported, you can use jQuery mobile.

这篇关于Mackit上的Webkit手势的Javascript事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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