html5支持手机触摸吗?

发布于 2024-11-08 20:13:02 字数 176 浏览 1 评论 0原文

我想知道 html5 是否支持移动设备本机上的触摸功能?因此,我们不必为 iOS/Android/WP7 制作原生应用程序,而是可以制作在移动浏览器中加载的 html5 页面。

编辑

我的意思是浏览器中对原生触摸的JavaScript支持,这样你就可以用html5中的触摸来做你自己的事情。

I was wondering if html5 is supporting touch functionality on a mobile device native? So we don't have to make an native app for iOS/Android/WP7 but can make an html5 page which loads in the mobile browser.

EDIT

I mean the JavaScript support for touch native in the browser so you can do you own thing with the touch in html5.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

雨的味道风的声音 2024-11-15 20:13:02

取决于触摸事件的类型。对于标准浏览器单击/鼠标事件,浏览器会模拟这些事件。正如 Halst 所提到的,只需让可点击元素足够大,以便在移动环境中工作即可。

如果你想使用多点触控/手势,它会变得更有趣。

Webkit提供了touchstart、touchmove、touchend、touchcancel。对于单点触摸事件的支持在 IOS Safari 和 Android Webkit 中应该是相同的。您可以自己开发或使用 jqTouch 等库。

您可以详细了解 IOS Safari 如何处理触摸事件 。 Android 的事件似乎没有详细记录,但您可以在 quirksmode 触摸支持 上了解更多信息。

Depends on the type of touch event. For your standard browser click/mouse events these are emulated by the browser. As mentioned by Halst, just make your clickable elements big enough to work in a mobile environment.

If you want to use multitouch/gestures, it gets a little more interesting.

Webkit provides touchstart, touchmove, touchend, touchcancel. For single touch events support should be the same in both IOS Safari and Android Webkit. You could roll your own or use a library like jqTouch.

You can read more on how IOS Safari handles touch events. Events for Android don't seem to be as well documented, but you can read more on quirksmode touch support.

自由如风 2024-11-15 20:13:02

只要让点赞和按钮足够大就可以了。

Just make liks and buttons big enough, and that's it.

谈场末日恋爱 2024-11-15 20:13:02

有些。

可以编写一个看起来几乎像 iPad 原生应用程序(包括多点触控)的网页,但我不得不放弃使用“高级”事件,而必须显式处理 touches 数组获得合理的缩放/平移。 IMO 的结果非常好(我向人们展示矢量图形编辑器玩具认为它是一个本机应用程序)。

然而对于 Android 来说,事情有点棘手,因为在我的 Nexus 上,显然没有办法让任何东西接近全屏(对于一部手机来说,失去地址栏空间意味着失去大量空间),而且多点触控在默认浏览器:-(

然而,这两个问题(全屏和多点触控)都在 Opera 中得到了解决,在我看来,这是令人悲伤的,因为(可能)这意味着他们不希望在手机上拥有良好的网络应用程序......

所以从技术上讲,这是可以写一个html5/js 程序可以在桌面和手机上运行,​​但这当然并不意味着桌面应用程序的最佳 UI 也是手机的最佳 UI。

Somewhat.

It's possible to write a webpage that looks almost as a native app for iPad (including multi-touch) but I had to give up with using "high level" events and had to handle instead the touches array explicitly to get a reasonable zoom/pan. The results are IMO quite good (people I've shown that vector graphics editor toy thought it was a native app).

For Android however things are a little trickier because on my Nexus one apparently there is no way to get anything close to full-screen (and for a phone losing the address bar space means losing a LOT of space) and also multitouch is disabled in the default browser :-(

Both problems (fullscreen and multitouch) are however solved for example in Opera and this is in my opinion sad because (may be) this means they don't WANT good web apps on the phone...

So technically it's possible to write a single html5/js program that runs in both desktop and phone, but this doesn't of course mean that the best UI for a desktop app is also the best for a phone.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文