如何将元素的dragstart事件分配(传输,...)到其他元素?
HTML:
<div draggable="true" ondragstart="drag(event)"> draggable </div>
<div ondrop="drop(event)" ondragover="dragover(event)"> droppable </div>
JS:
$(document).ready(function(){
$(document).mousemove(function(event) {
$('.drag-panel').css({"top":event.pageY-70+'px',"left":event.pageX-70+'px'});
Mouse.x = event.pageX;
Mouse.y = event.pageY;
});
});
function drag(event){
event.preventDefault();
var panel = $('.drag-panel')[0];
$(panel).css({"top":Mouse.y-70+'px',"left":Mouse.x-70+'px',"display":"block"});
//and continue dragging with $(panel) ??
}
function dragover(event){
alert('dragover');
}
有没有办法在调用drag()
时更改拖动元素?