javascript - How can i get the drop point indormation? [drag and drop] -
now im trying implement drag , drop on html5. i'd know how can grab info drop content. example...
<div id="droppoint"></div><ul> <li draggable="true">1</li> <li draggable="true">2</li> <li draggable="true">3</li> <li draggable="true">4</li> <li draggable="true">5</li> </ul>
when drag li element droppoint , drop this, want grab id attribute(droppoint).
erea.addeventlistener("drop", function(evt) { var droptext = evt.datatransfer.getdata("text"); console.log('============================'); console.log(droptext); console.log('============================'); evt.preventdefault(); }, false);
function drag_over(event) { console.log(event.clientx); console.log(event.clienty); event.preventdefault(); homecoming false; } function drop(event) { console.log(event.clientx); console.log(event.clienty); event.preventdefault(); homecoming false; }
http://jsfiddle.net/robertc/kkuqh/30/
clientx , clienty current client's coordinates (his pointer), if client's coordinates while drops, know dropped item.
found here: html5: dragover(), drop(): how current x,y coordinates?
have day =)
javascript html html5 drag-and-drop draggable
No comments:
Post a Comment