javascript - Delegate drag event to other element jQuery -
i have following html on page:
<div class="group-one" > <p><span id="handle" draggable="true">::</span> click me</p> </div> <div class="group-two" draggable="true"> <p>i should dragged</p> </div>
now want when #handle
dragged, drag event should delegated div.group-two
, element under move cursor should div.group-two
either. have tried:
$('#handle').mousedown(function(e){ $('.group-two').trigger(e); }); $('#handle').on('dragstart', function(e){ $('.group-two').trigger(e); }); $('.group-two').on('dragstart', function(e){ console.log('dragestart triggered on group-two'); }); $('.group-two').mousedown(function(e){ console.log("mousedown triggered on group-two"); });
here jsfiddle.
the problem here although event delegated div.group-two
element being dragged under move cursor still span#handle
.
now question that, possible delegate drag in manner? if is, hint how achieve it.
note using plain jquery not jquery ui.
Comments
Post a Comment