jQuery mobile-对于每个实时点击事件是否应该有一个等效的点击事件? [英] jQuery mobile- For every live tap event should there be an equivalent click event?

查看:17
本文介绍了jQuery mobile-对于每个实时点击事件是否应该有一个等效的点击事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将 jQuery 实时点击事件替换为 jQuery 移动点击事件以提高响应速度.

I have replaced the jQuery live click events to jQuery mobile tap events to increase responsiveness.

出于兼容性原因,我觉得这是个坏主意.

I have a feeling this was a bad idea for compatibility reasons.

有必要同时拥有这两个事件吗,有什么办法可以把它们写成同一个函数?

Is it necessary to have both events, and is there any way to write them both for the same function?

比如('click','tap')

Such as ('click','tap')

推荐答案

Billy 的回答非常完整,在我使用它的几次之后实际上效果很好.此外,您可能还想查看 JQuery Mobile 中的 vmouse 插件,这是一种尝试抽象鼠标事件:

Billy's answer is incredibly complete and actually worked quite well the few times I used it. Additionally however, you may want to look at the vmouse plugin in JQuery Mobile, it is an attempt to abstract mouse events:

 // This plugin is an experiment for abstracting away the touch and mouse
 // events so that developers don't have to worry about which method of input
 // the device their document is loaded on supports.

-- https://github.com/jquery/jquery-mobile/blob/master/js/vmouse.js

我一直在我正在进行的一个项目中使用它,这几天它似乎反应灵敏.要使用,例如:

I've been playing with it on a project I'm working on, it seems pretty responsive these days. To use, something like:

$('selector').bind('vclick', function () { ...

$('selector').bind('vmousedown', function () { ...

这篇关于jQuery mobile-对于每个实时点击事件是否应该有一个等效的点击事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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