I am creating an application where I am implementing the HTML5 drag and drop functionality and its work is fine. Now this is an application where the item can not be needed in that case, I want to drag the element again and leave it in the last position. I see an example here and HTML looks Thanks in advance :) Being able to By dragging some 'back', you need a place to pull things back, like: In addition, (which I tested in Chrome, Firefox and Opera). http://ashishware.com/MochikitDnD.shtml but it should use MochiKit.js for their sample and I do not want any external plug-in / JS Please give me a sample for this Or provide the code My drag and drop code looks like this:
function allowDrop (ev) {ev.preventDefault (); } Function drag (ev) {ev.dataTransfer.setData ("text", ev.target.id); } Function drop (ev) {ev.preventDefault (); Var data = ev.dataTransfer.getData ("text"); Ev.target.appendChild (document.getElementById); }
& lt; Div id = "div1" ondrop = "drop (event)" ondragover = "allowdrop (event)" & gt; & Lt; / Div & gt; & Lt; Div id = "drag1" draggable = "true" ondragstart = "drag (event)" ondragover = "allowdrop (event)" & gt; & Lt; / Div & gt;
& lt; Div id = "div1" ondrop = "drop (event)" ondragover = "allowdrop (event))" & gt; & Lt; / Div & gt; & Lt; Div id = "div2" ondrop = "drop (event)" ondragover = "allowdrop (event)" & gt; & Lt; Div id = "drag1" draggable = "true" ondragstart = "drag (event)" & gt; & Lt; / Div & gt; & Lt; / Div & gt;
Comments
Post a Comment