How do I drag and drop multiple images from one canvas to another? My manager has given me this task, it\'s been 3 days and I am not able to do this as I\'m new to HTML5. I\
Drag/Drop multiple items between 2 canvases
Here’s what the code does:
Some explanation about the code:
Here is code and a Fiddle: http://jsfiddle.net/m1erickson/3KqgX/
Click an item to toggle it's selection
Drag from top to bottom canvas to drop selected items
[Addition: Alternate code to sort bottom canvas by order dropped]
function handleDrop(e){
for(var i=items.length-1;i>=0;i--){
if(items[i].isSelected){
items[i].isDropped=true;
items[i].isSelected=false;
// sort the bottom canvas by order dropped
var move=items[i];
items.splice(i,1);
items.push(move);
}
}
draw();
}
[ Edited to present a solution in KineticJS ]
Here is code and a Fiddle: http://jsfiddle.net/m1erickson/bSpBF/
Click on image(s) to toggle selection
Then click in the other canvas to drop