使用jquery mobile中的点按替换所有点击事件以加快速度 [英] Replace all click events with tap in jquery mobile to speed up

查看:119
本文介绍了使用jquery mobile中的点按替换所有点击事件以加快速度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用phonegap和jquery mobile开发移动应用程序。我创建了数据角色布局等...在这个应用程序中,我有很多按钮,如下所示去到不同的页面。 (我没有特别地将点击事件绑定到这些按钮,他们只是使用href的神奇)。

 < a data-role =buttonhref =#page6> 
转到第6页
< / a>

这些按钮的问题是,他们是非常慢,400ms延迟every1正在谈论。 可以使用tap / vclick / touchstart (最佳做法)替换这些按钮上的所有事件,以便他们即时响应?



感谢

解决方案

我写了一个名为Lightning Touch 的JS实用程序,以摆脱这种延迟。 这里是我演示的(糟糕的)。



该库的基础是Google的fastButtons,它显然不再可用(或者,如果是,网址已更改),但以前可从code.google.com的知识共享许可下获得。



闪电触摸触摸touchend而不是touchstart,但我怀疑你可以修改它在touchstart上工作没有太多的努力,如果它不工作,因为是你。



在演示中, Brian Leroux 一个关于400ms-ish延迟问题的幻灯片,说PPL已经解决了这个问题。他链接到一些项目,你可以看看如果闪电触摸不适合你的情况。如果这些失败,您可以尝试查看他在同一个演示文稿中链接到的其他列表。 / p>

希望在那里有一个解决方案。 (如果闪电触摸不工作,我很想知道为什么,所以我可以改进它。)


Im developing a mobile application using phonegap and jquery mobile. I created the layout with data-roles etc... and in this application I have a lot of buttons like the following to go to different pages. (I don't specifically bind click events to these buttons, they just use the href for the magic).

<a data-role="button" href="#page6">
    go to page 6
</a>

The problem with these buttons is that they are incredibly slow, with the 400ms delay every1 is talking about. Is it possible to replace all events on these buttons with tap/vclick/touchstart (Whatever is best) so they respond instant? They will never have to deal with double taps or people dragreleasing...

Thanks

解决方案

I wrote a JS utility called Lightning Touch to get rid of exactly that delay. Here's me demonstrating it (badly).

The foundation of that library is Google's fastButtons, which apparently is no longer available (or if it is, the URL has changed) but used to be available under Creative Commons license from code.google.com.

Lightning Touch triggers on touchend rather than touchstart, but I suspect you can modify it to work on touchstart without too much effort, if it doesn't work as-is for you.

In a presentation, Brian Leroux had a slide about the 400ms-ish delay issue that said "PPL HAVE SOLVED THE SHIT OUT OF THIS." He linked to a few projects that you might look at if Lightning Touch doesn't work for your situation. And if those fail you, you can try looking through this other list that he linked to in the same presentation.

Hope there's a solution in there somewhere for you. (And if Lightning Touch doesn't work, I'd love to know exactly why so I can improve it.)

这篇关于使用jquery mobile中的点按替换所有点击事件以加快速度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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