我已将 jQuery 实时点击事件替换为 jQuery 移动点击事件以提高响应能力。
出于兼容性原因,我感觉这是一个坏主意。
是否有必要同时拥有这两个事件,有没有办法为同一个函数编写这两个事件?
如('点击','点击')
比利的答案非常完整,而且在我使用它的几次后实际上效果很好。此外,您可能还想查看 vmouse 插件jQuery 移动版 http://en.wikipedia.org/wiki/JQuery_Mobile,这是抽象鼠标事件的尝试:
// 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 https://github.com/jquery/jquery-mobile/blob/master/js/vmouse.js
我一直在我正在做的一个项目中使用它,这些天它看起来反应非常灵敏。使用时,类似于:
$('selector').bind('vclick', function () { ...
or
$('selector').bind('vmousedown', function () { ...
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)