1 |
<!doctype html> |
2 |
<html lang="en"> |
3 |
<head> |
4 |
<meta charset="utf-8"> |
5 |
<title>jQuery UI Droppable - Default functionality</title> |
6 |
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css"> |
7 |
<script src="../../jquery-1.9.1.js"></script> |
8 |
<script src="../../ui/jquery.ui.core.js"></script> |
9 |
<script src="../../ui/jquery.ui.widget.js"></script> |
10 |
<script src="../../ui/jquery.ui.mouse.js"></script> |
11 |
<script src="../../ui/jquery.ui.draggable.js"></script> |
12 |
<script src="../../ui/jquery.ui.droppable.js"></script> |
13 |
<link rel="stylesheet" href="../demos.css"> |
14 |
<style> |
15 |
#draggable { width: 100px; height: 100px; padding: 0.5em; float: left; margin: 10px 10px 10px 0; } |
16 |
#droppable { width: 150px; height: 150px; padding: 0.5em; float: left; margin: 10px; } |
17 |
</style> |
18 |
<script> |
19 |
$(function() { |
20 |
$( "#draggable" ).draggable(); |
21 |
$( "#droppable" ).droppable({ |
22 |
drop: function( event, ui ) { |
23 |
$( this ) |
24 |
.addClass( "ui-state-highlight" ) |
25 |
.find( "p" ) |
26 |
.html( "Dropped!" ); |
27 |
} |
28 |
}); |
29 |
}); |
30 |
</script> |
31 |
</head> |
32 |
<body> |
33 |
|
34 |
<div id="draggable" class="ui-widget-content"> |
35 |
<p>Drag me to my target</p> |
36 |
</div> |
37 |
|
38 |
<div id="droppable" class="ui-widget-header"> |
39 |
<p>Drop here</p> |
40 |
</div> |
41 |
|
42 |
<div class="demo-description"> |
43 |
<p>Enable any DOM element to be droppable, a target for draggable elements.</p> |
44 |
</div> |
45 |
</body> |
46 |
</html> |