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

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

问题描述

我已将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-对于每个实时点击事件,应该有一个等效的click事件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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