Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/86.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery UI可拖放';在移动设备中不开火时悬停类_Jquery_Jquery Ui_Jquery Ui Draggable_Jquery Ui Droppable - Fatal编程技术网

Jquery UI可拖放';在移动设备中不开火时悬停类

Jquery UI可拖放';在移动设备中不开火时悬停类,jquery,jquery-ui,jquery-ui-draggable,jquery-ui-droppable,Jquery,Jquery Ui,Jquery Ui Draggable,Jquery Ui Droppable,我使用jQueryUIDragable和Dropable来实现类似的输出。是我页面的链接。在桌面范围内,所有功能都能正常工作,但在移动仿真/设备中无法正常工作 在我的第三步中,当图像从侧边栏拖到移动封面时,droppable的hoverclass被触发。但是这个hoverclass不会在移动仿真/设备中被解雇。当鼠标指向可拖放区域的右下角时,它会被触发。下面是可拖放元素的代码 $('#image-pool-list img.dddraggable').draggable({ revert:

我使用jQueryUIDragable和Dropable来实现类似的输出。是我页面的链接。在桌面范围内,所有功能都能正常工作,但在移动仿真/设备中无法正常工作

在我的第三步中,当图像从侧边栏拖到移动封面时,droppable的hoverclass被触发。但是这个hoverclass不会在移动仿真/设备中被解雇。当鼠标指向可拖放区域的右下角时,它会被触发。下面是可拖放元素的代码

$('#image-pool-list img.dddraggable').draggable({
  revert: "invalid",
  helper: "clone",
  //appendTo: "body",
  //zIndex: 100,
  live: true,
  refreshPositions: true,
  drag: function(event, ui) {
    $(ui.helper).css('opacity', '0.5');
    $('div.design-template').css('opacity', '1');
    ui.helper.css({
      'width': '90px',
      'height': '90px'
    });
    //console.log(ui.helper);
  },
  stop: function(event, ui) {
    //$('div.design-template').css('opacity','0.2');
  }
});

$("div#template div.design-template div.placeholder").droppable({
  hoverClass: "drop-hover",
  tolerance: 'fit',
});

因此,请有人告诉我,即使鼠标指针处于中心位置,如何在移动仿真/设备中触发hoverClass。

假设您的问题不是hoverClass,但实际问题是scalefactor

$('#image-pool-list img.dddraggable').droppable({
        revert: "invalid",
        helper: "clone",
        live: true,
        refreshPositions: true,
        start: function( event, ui ) {
               scaleFactor = 0.6;
               click.x = event.clientX;
               click.y = event.clientY;
        },
        drag: function( event, ui ) {
              $(ui.helper).css('opacity','0.5');
              $('div.design-template').css('opacity','1');
              var zoom = 0.6;
              var original = ui.originalPosition; 
              ui.position = {
                     left: (event.clientX - click.x + original.left) / zoom,
                     top:  (event.clientY - click.y + original.top ) / zoom
              };
        },
        stop: function( event, ui ) {
               $('div.design-template').css('opacity','0.2');
               click.x = 0;
               click.y = 0;
        }
});

代码片段用于提供可运行的演示,您还没有提供支持JS的HTML/CSS,所以我将代码片段转换为代码块。如果您可以提供一个可运行的演示,用最少的代码演示问题,那么您可以随意创建一个代码段……什么是
liveDraggable()
。。?什么是
scaleFactor
。。?我看不到它在代码中的任何地方被使用。。。