完整错误:
Ignored attempt to cancel a touchmove event with cancelable=false, for example because scrolling is in progress and cannot be interrupted.
preventDefault @ jquery-2.2.4.min.js:3
f @ jquery.ui.touch-punch.min.js:14
b._touchMove @ jquery.ui.touch-punch.min.js:26
f @ jquery-2.2.4.min.js:2
dispatch @ jquery-2.2.4.min.js:3
r.handle @ jquery-2.2.4.min.js:3
我正在使用touchpunch,这可能会使问题复杂化?正如大多数针对此错误的解决方案所建议的那样,我已尝试添加cancel: false
到可拖动选项。它没有帮助。
这被不断地拖着,30-80次。
这是所有与拖动相关的代码:
var t;
$(document).on('touchstart','.menu-item', function (event) {
selectItem(this);
var self = this;
if ($(self).hasClass('draggable')) return;
t = setTimeout(function () {
$(self).draggable({
revert: 'invalid',
helper: 'clone',
opacity: .75,
cancel: false,
appendTo: 'body',
cursorAt: {
left: 100,
top: 100
},
start: function(e, ui)
{
$(ui.helper).addClass("ui-draggable-helper");
$('.menu-container').addClass('stop-scrolling');
},
stop: function(e, ui) {
$('.menu-container').removeClass('stop-scrolling');
}
}).draggable('enable').addClass('draggable');
$(self).trigger(event)
}, 800);
});
$(document).on("touchend", function () {
clearTimeout(t);
$('.draggable:not(.ui-draggable-helper)').draggable( 'disable' ).removeClass('draggable');
});