ここにFiddleと別のアプローチがあります。
HTML
<img id="1" src="/" draggable="true" ondragstart="drag(event)" alt="Image 1"/>
<img id="2" src="/" draggable="true" ondragstart="drag(event)" alt="Image 2"/>
<img id="3" src="/" draggable="true" ondragstart="drag(event)" alt="Image 3"/>
<img id="4" src="/" draggable="true" ondragstart="drag(event)" alt="Image 4"/>
<img id="5" src="/" draggable="true" ondragstart="drag(event)" alt="Image 5"/>
<div id="playlist" ondrop="drop(event)" ondragover="allowDrop(event)">
</div>
CSS
#playlist {
position: absolute;
top: 150px;
left: 0;
width: 960px;
min-height:160px;
background-color:#e5e5e5;
}
#playlist img {
margin: 5px;
}
img {
width: 150px;
height: 90px;
margin: 5px;
}
JS
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).cloneNode(true));
}