Reputation: 2264
I'm trying to drag one img and so it fires ondragenter for IE and dragover event for standard browsers, on IE and FF after the user drags it could fire ondrop event however on Webkit based (chrome and safari), i need to cancel or preventDefault() on the dragover event, doing that so will disable the dragging. Any idea on solving this? Thanks
Update: Im referring to designMode='on'
Upvotes: 0
Views: 2216
Reputation: 16597
The HTML5 Spec's default behavior is to automatically cancel then drag action on dragOver/drageEnter unless you cancel (return false and e.preventDefault()) that event yourself. It shouldn't be canceling the drag action at all.
It seems a bit odd at first. But I use this code and it works.
aDivElement.ondrop = function(e) {
alert("yo");
};
aDivElement.ondragenter = function(e) {
e.dataTransfer.dropEffect = 'move'
e.preventDefault();
return false;
};
aDivElement.ondragover = function (e) {
e.dataTransfer.dropEffect = 'move';
e.preventDefault();
return false;
};
Upvotes: 1