1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>test</title>
<script type="text/javascript" src="prototype.js"></script>
<script type="text/javascript" src="scriptaculous/scriptaculous.js"></script>
<style type="text/css">
#pool {
float:left;
width:200px;
height:500px;
background-color:green;
}
.drag {
float:left;
background-color:yellow;
}
#drop {
width:200px;
float:right;
height:500px;
background-color:blue;
}
</style>
</head>
<body>
<div id="pool">
<div class="drag" >
<h2>Un titre</h2>
<p>
un texte <a href="#jambon">un lien</a>
</p>
</div>
</div>
<div id="drop">
</div>
<script type="text/javascript">
function moveItem(drag, drop) {
var clone = drag.cloneNode(true);
// enlevons les styles
drop.insert(clone.writeAttribute("style", ""));
}
$$(".drag").each( function(draggableElement) {
new Draggable(draggableElement, {ghosting: true, revert: true});
});
Droppables.add("drop", { onDrop: moveItem });
</script>
</body>
</html> |