Reputation:
I have some simple code that is controlling a slider control on an iPad. I'm running into an issue where the control is jumping around wildly and I traced it down to the fact that ev.originalEvent.touches
is sometimes undefined
...
Wondering if anyone has any idea what might be going on here. jQuery 1.7.2, iOS5.1, iPad 3 if it matters
$( document.body )
.on( 'mousemove touchmove', function( ev ){
// logs undefined about 10% of the time???
console.log( ev.originalEvent.touches );
} );
And of course I can't re-produce this in a simple stripped-down case, though this is the exact code that's running: http://jsfiddle.net/vYKhh/4/
Upvotes: 1
Views: 1334
Reputation: 26
It seems that when you are using the 'touchmove' or 'mousemove' event the touches array is 'ev.touches' so try this:
$( document.body )
.on( 'mousemove touchmove', function( ev ){
// logs undefined about 10% of the time???
console.log( ev.touches );
} );
But for 'mousedown' and 'touchstart' it's still ev.originalEvent.touches.
Upvotes: 1