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 58 59 60 61 62 63 64 65 66 67 68 69
| <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<script type="text/javascript" src="lib/prototype.js"></script>
<script type="text/javascript" src="src/scriptaculous.js?load=effects,dragdrop"></script>
<style type="text/css">
div#source {
width: 100px;
height: 100px;
cursor: move;
background: #9fcfba;
}
</style>
</head>
<body>
<div id="source" >
Draggable
</div>
<div id="source2" style="height: 100px; width: 100px; background-color: gray;">
Draggable2
</div>
<script type="text/javascript">
new Draggable("source", {
revert:"failure"
});
new Draggable("source2", {
revert:"true"
});
</script>
<br/>
<div id="target" style="height: 100px; width: 100px; background-color: green;">
Good Target 1
</div>
<div id="target2" style="height: 100px; width: 100px; background-color: green;">
Good Target 2
</div>
<script type="text/javascript">
Droppables.add('target', {
accept: 'source',
// containment:'source',
onDrop:function(element){ Test() }
});
Droppables.add('target2', {
containment: 'source2',
onDrop:function(element){ Test() }
});
function Test(){
alert('OK');
}
</script>
<br/>
</body>
</html> |
Partager