I need to place a div on top of the table so that it can be moved relative to the cells of this table.
Here is an example , tell me how to get a similar effect, about what (and where) to read?
I need to place a div on top of the table so that it can be moved relative to the cells of this table.
Here is an example , tell me how to get a similar effect, about what (and where) to read?
Read, for example, about HTML5 Drag and Drop ,
Here is a living example ...
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(data)); }; <style>#placeToDrag {width: 120px;height: 30px;padding: 10px;border: 1px solid #aaaaaa;}</style> <body> <div id="placeToDrag" ondrop="drop(event)" ondragover="allowDrop(event)"></div> <br> <div id="itemToDrag" draggable="true" ondragstart="drag(event)">Перетащи меня</div> </body> Source: https://ru.stackoverflow.com/questions/572914/
All Articles