我有、JqueryUI、和触摸屏,而在移动设备中,我得到了错误:undefined is not an object (evaluating '$.ui.mouse')。
我试图找出为什么会出现这个错误,并验证:
只有当我尝试在移动设备中使用触摸穿孔,而不是在笔记本电脑上时,才会发生这种情况。(在笔记本电脑中,触控打孔是识别和工作的。在移动领域,我认为这是公认的,但不起作用,应该如何做)。
这是我的剧本:
$('.touchtable').on('doubletap',function(e){
mover();
});
function mover(){
$("#tbodyproject").sortable({
items: "> tr",
appendTo: "parent",
helper: "clone",
placeholder: "placeholder-style",
containment: ".table",
start: function(event, ui) {
var cantidad_real = $('.table thead tr th:visible').length;
var cantidad_actual = $(this).find('.placeholder-style td').length;
if(cantidad_actual > cantidad_real){
var cantidad_a_ocultar = (cantidad_actual - cantidad_real);
for(var i = 0; i <= cantidad_a_ocultar; i++){
$(this).find('.placeholder-style td:nth-child('+ i +')').addClass('hidden-td');
}
}
ui.helper.css('display', 'table')
},
stop: function(event, ui) {
ui.item.css('display', '')
},
update: function( event, ui ) {
let newOrder = $(this).sortable('toArray');
$.ajax({
type: "POST",
url:'/admin/projects/updateOrder',
data: {ids: newOrder}
})
.done(function( msg ) {
location.reload();
});
}
}).disableSelection();
}脚本可以拖放行,也可以在没有拖动的情况下滚动。因此,当用户做双击,然后功能开始工作,并有可能使拖放。
在电脑里工作,在移动设备或ipad上不起作用。
如果在function mover()中,我在控制台中放置了一个console.log,我将查看日志,但拖放日志不起作用。
我应该如何修正未定义的错误?我认为如果我修复错误脚本将在移动设备上工作。
发布于 2017-11-27 11:32:06
我有一个require('jqueryui');文件,这个文件在 <script src="/cms/lib/jquerytouchpunch/jquery.ui.touch-punch.js"></script>之后加载了,我只是更改了顺序,在require('jqueryui');中如下所示
<script src="/assets/js/cms.js"></script>
<script src="/cms/lib/jquerytouchpunch/jquery.ui.touch-punch.js"></script>https://stackoverflow.com/questions/47508852
复制相似问题