您好我正试图在另一个div中拖动一些按钮/图像,但我会不断收到警告。
Ignored attempt to cancel a touchstart event with cancelable=false, for example because scrolling is in progress and cannot be interrupted.
这是我的代码。
<link rel="stylesheet" href="bootstrap-3.3.6-dist/css/bootstrap.min.css">
<!-- Optional theme -->
<link rel="stylesheet" href="bootstrap-3.3.6-dist/css/bootstrap-theme.min.css">
<script src="bootstrap-3.3.6-dist/js/bootstrap.min.js"></script>
<script src="js/jquery-2.1.4.min.js"></script>
<link href="css/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script src="js/jquery-ui.min.js"></script>
<script src="js/jquery.ui.touch-punch.min.js"></script>
<script>
$(function () {
$(".btn-popup-sources img").draggable({
cancel :false,
revert: "invalid",
refreshPositions: true,
drag: function (event, ui) {
ui.helper.addClass("draggable");
},
stop: function (event, ui) {
ui.helper.removeClass("draggable");
var image = this.src.split("/")[this.src.split("/").length - 1];
if ($.ui.ddmanager.drop(ui.helper.data("ui-draggable"), event)) {
alert(image + " dropped.");
}
else {
alert(image + " not dropped.");
}
}
});
$("#droppedHere").droppable({
drop: function (event, ui) {
if ($("#droppedHere img").length == 0) {
$("#droppedHere").html("");
}
ui.draggable.addClass("dropped");
$("#droppedHere").append(ui.draggable);
}
});
});
</script>
我试图检查但没有在网上找到合适的解决方案。