Given this html...
<div class="item">
<span class="handle">(handle)</span>
<span> Drag using the "(handle)"</span>
</div><br/>
<div class="handle2">(handle2)</div>
...and this jQuery...
$('.item').draggable({helper:'clone', handle:'.handle'});
$('.handle2').mousedown(function(e){
$('.handle').trigger(e);
});
...Why is it that the drag event does not fire when dragging using (handle2)? ((handle) works as expected)
I can make it work when I remove the "handle" option in the draggable method...
$('.item').draggable({helper:'clone'});
$('.handle2').mousedown(function(e){
$('.handle').trigger(e);
});
http://jsfiddle.net/2wLsvsw5/1/
What I am trying to do is trigger the drag event of the handle.
I was trying to do similar thing and i found this workaround
$('.item').draggable({
helper: 'clone'
});
$('.handle2').mousedown(function (event) {
handle = $(".item").children(".handle");
handle.trigger(event);
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.