K2xL K2xL - 1 year ago 103
Android Question

Translating touch events from Javascript to jQuery

I am using

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


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?

Answer Source

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).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download