jQuery和touchstart,touchmove,touchend [英] JQuery and touchstart, touchmove, touchend

查看:254
本文介绍了jQuery和touchstart,touchmove,touchend的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用

window.addEventListener("touchstart", function(ev){
console.log(ev.touches); // good
    });

我怎样才能把此JQuery的? 我试过

How can I translate this to JQuery? I've tried

$(window).bind("touchstart",function(ev){
console.log(ev.touches); // says ev.touches is undefined
}

任何想法?谢谢

Any ideas? Thanks

推荐答案

jQuery的修正了事件,占浏览器差异。当这样的时候,你可以随时与 event.originalEvent 进入本地事件(见的这个页面)。

jQuery 'fixes up' events to account for browser differences. When it does so, you can always access the 'native' event with event.originalEvent (see the Special Properties subheading on this page).

这篇关于jQuery和touchstart,touchmove,touchend的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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