什么是用于触摸手势的好的 JavaScript 库或 jQuery 插件?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8801058/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-24 07:33:19  来源:igfitidea点击:

What is a good JavaScript library or jQuery plugin for touch gestures?

javascriptjquerytouchgestures

提问by agente_secreto

I don′t need a full fledged framework like Sencha or jQuery mobile, just the ability to detect gestures such as swype or pinch to optimize some parts of my site for touch devices.

我不需要像 Sencha 或 jQuery mobile 这样的成熟的框架,只需要能够检测手势(如 swype 或 pinch)来优化我网站的某些部分以用于触摸设备。

I have never worked with touch events so I dont really know where to start. Is there a light framework or jQuery plugin for this?

我从来没有接触过触摸事件,所以我真的不知道从哪里开始。是否有一个轻量级框架或 jQuery 插件?

回答by user980085

You can check those out: Hammer.js, which you can run standalone or as a jQuery plugin, QuoJS, which is a microlibrary it should work fine alongside jQuery. If you are planning to use jQuery UI then touchpunchshould do the job!

你可以看看这些:Hammer.js,你可以独立运行,也可以作为 jQuery 插件运行, QuoJS是一个微型库,它应该可以与 jQuery 一起正常工作。如果您打算使用 jQuery UI,那么touchpunch应该可以完成这项工作!

回答by jobwat

TouchSwipeshould meet your needs :)

TouchSwipe应该可以满足您的需求 :)

回答by Daniel Glyde

I've written a jQuery Plugin: TouchItit converts touch events to mouse events. The blog post includes a link to GitHub.

我写了一个 jQuery 插件:TouchIt它将触摸事件转换为鼠标事件。博客文章包含指向 GitHub 的链接。

回答by dxh

Since you've tagged it jquery, I'll recommend jQTouch.

由于您已将其标记为 jquery,因此我会推荐jQTouch