Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/413.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/74.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
Javascript 触发可拖动句柄的拖动事件_Javascript_Jquery_Jquery Ui - Fatal编程技术网

Javascript 触发可拖动句柄的拖动事件

Javascript 触发可拖动句柄的拖动事件,javascript,jquery,jquery-ui,Javascript,Jquery,Jquery Ui,鉴于此html <div class="item"> <span class="handle">(handle)</span> <span> Drag using the "(handle)"</span> </div><br/> <div class="handle2">(handle2)</div> …为什么使用(handle2)拖动时不会触发拖动事件?((处理)按

鉴于此html

<div class="item">
    <span class="handle">(handle)</span>
    <span> Drag using the "(handle)"</span>
</div><br/>
<div class="handle2">(handle2)</div>

…为什么使用(handle2)拖动时不会触发拖动事件?((处理)按预期工作)

当我删除可拖动方法中的“handle”选项时,我可以让它工作

$('.item').draggable({helper:'clone'});

$('.handle2').mousedown(function(e){
    $('.handle').trigger(e);
});


我试图做的是触发句柄的拖动事件。

我试图做类似的事情,我找到了这个解决方法

$('.item').draggable({
    helper: 'clone'
});

$('.handle2').mousedown(function (event) {
    handle = $(".item").children(".handle");
    handle.trigger(event);
});

这不是我想要的。我正在寻找一种方法,使它与可拖动的“句柄”选项定义的工作。在您的答案中,您只有“helper”选项,这与我问题最后一部分的代码基本相同。
$('.item').draggable({
    helper: 'clone'
});

$('.handle2').mousedown(function (event) {
    handle = $(".item").children(".handle");
    handle.trigger(event);
});