Reputation: 83
Full Error:
[Intervention] Ignored attempt to cancel a touchend event with cancelable=false, for example because scrolling is in progress and cannot be interrupted.
preventDefault @ jquery.min.js:2
(anonymous) @ number_grid_game.php:239
each @ jquery.min.js:2
(anonymous) @ number_grid_game.php:234
dispatch @ jquery.min.js:2
y.handle @ jquery.min.js:2
I have a code where touch events are used. When I start dragging, at first 10-30 steps it's normal but after 30-35 steps it's drag become slow & struggle to drag. I'm not sure what is causing this problem, I am new to working with touch events and can't seem to fix this problem. Here is the code handling the touch event:
$(window)
.on('touchstart', function(event) {
var missingNumbers, $target = $(event.target);
if(!$target.hasClass('missing-number'))
return;
missingNumbers = MissingNumbers.ByElement($target);
//185
$.each(event.originalEvent.changedTouches, function(index, touch) {
event.preventDefault();
event.stopPropagation();
missingNumbers.startDrag($target, touch.identifier, touch.pageX, touch.pageY);
});
})
.on('touchmove', function(event) {
$.each(event.originalEvent.changedTouches, function(index, touch) {
var touchId = touch.identifier;
if((touchId in MissingNumbers.DraggedElements)) {
event.preventDefault();
event.stopPropagation();
MissingNumbers.DoCellDrag(touchId, touch.pageX, touch.pageY);
}
});
})
.on('touchend', function(event) {
$.each(event.originalEvent.changedTouches, function(index, touch) {
var touchId = touch.identifier;
if((touchId in MissingNumbers.DraggedElements)) {
event.preventDefault();
event.stopPropagation();
MissingNumbers.EndCellDrag(touchId);
}
});
});
any solution will be appreciated
Upvotes: 0
Views: 1125
Reputation: 83
I Got the solution.. put css = 'touch-action:none' to the div area & everything will work fine.
Upvotes: 1