简体   繁体   English

任何人都可以建议一个地方开始javascript触摸事件的网络?

[英]Can anyone suggest a place to start with javascript touch events for the web?

I would like to learn how to make image galleries and content sliders that can support both touch and mouse events. 我想学习如何制作可以支持触摸和鼠标事件的图像库和内容滑块。 What's a good place to start learning about touch events? 什么是开始学习触摸事件的好地方?

I can't seem to find any official documentation. 我似乎无法找到任何官方文件。

Are there helpful touch libraries supported through jQuery that normalize the api? 是否通过jQuery支持有用的触摸库来规范化api?

I've noticed that you don't want to use a mobile framework for some reason. 我注意到你出于某种原因不想使用移动框架。

If you don't want to use a mobile framework, which is highly recommended, you can go straight to the native API, of course. 如果您不想使用强烈推荐的移动框架,您当然可以直接使用本机API。 But be aware that you might find vendor specific differences that are already handled by the mobile frameworks and might be hard to deal with. 但请注意,您可能会发现已由移动框架处理的供应商特定差异,并且可能难以处理。

Here's a fairly good tutorial on how to do touch and mobile optimizations based solely on native APIs: 这是一个关于如何仅基于本机API进行触摸和移动优化的相当好的教程:

http://www.html5rocks.com/en/mobile/touch.html http://www.html5rocks.com/en/mobile/touch.html

There is a good Apple documentation on touch events (but not only): 关于触摸事件有一个很好的Apple文档 (但不仅仅是):

list of supported events on Safari Web Content Guide: Handling Events Safari Web内容指南:处理事件中支持的事件列表

You can also visit this page (JS script created by me) on your touch-enabled device and see what events are being triggered: 您还可以在启用触摸的设备上访问此页面 (由我创建的JS脚本),并查看正在触发的事件:

http://jsfiddle.net/wzD8A/embedded/result/ http://jsfiddle.net/wzD8A/embedded/result/

I believe different devices may fire different events . 我相信不同的设备可能引发不同的事件 For example my own tablet-convertible PC does not fire touch events, when I click the screen, and Android may behave differently than eg. 例如,当我点击屏幕时,我自己的平板电脑可转换PC不会触发触摸事件,Android的行为可能与例如不同。 iPhone. 苹果手机。 I do not know any source of comprehensive information about the differences in this matter. 我不知道有关这个问题的差异的任何综合信息来源。

There are some JavaScript Touch Libraries such the following: 有一些JavaScript Touch Libraries如下:

You'll need to get familiar with jquery mobile touch events, I am sure there is lots of resources on it but here is one that I found useful 你需要熟悉jquery移动触摸事件,我相信它上面有很多资源,但这里有一个我发现有用的资源

http://jquerymobile.com/test/docs/api/events.html http://jquerymobile.com/test/docs/api/events.html

If you're simply interested in learning about touch events, iTunes has the Apple Developer Conference Videos from the 2010 and 2011 conferences available for free. 如果您只是对了解触摸事件感兴趣,iTunes会免费提供2010年2011年会议的Apple开发者大会视频。 It requires registration, but again the registration is free. 它需要注册,但注册是免费的。

I used the information here to create a mobile-friendly version of an application and it worked fine on iOS and Android. 我使用这里的信息来创建一个适合移动设备的应用程序版本,它在iOS和Android上运行良好。 (Blackberry didn't have a browser that supported touch events at that time.) (Blackberry当时没有支持触摸事件的浏览器。)

This will give you an overview of how to use touch events and gestures in your web apps. 这将概述如何在Web应用程序中使用触摸事件和手势。 Watch the "Adding Touch and Gesture Detection to Web Pages on iPhone OS" from the 2010 conference as well as the "Hidden Gems for Web Apps" and "Understanding Layout and Gestures in Safari on iOS and Lion" presentations from the 2011 conference. 观看2010年大会上的“在iPhone OS上为网页添加触摸和手势检测”以及2011年大会上的“隐藏的Web应用程序宝石”和“了解iOS和狮子会的Safari中的布局和手势”演示。

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM