blob: 0f8c3dc5665a287569d4c3b7c08ab178360f69ab (
plain)
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
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>jQuery UI Droppable - Default Demo</title>
<link type="text/css" href="css/ui-lightness/jquery-ui-1.8.1.custom.css" rel="stylesheet" />
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.1.custom.min.js"></script>
<style type="text/css">
#draggable { width: 100px; height: 100px; padding: 0.5em; float: left; margin: 10px 10px 10px 0; }
#droppable { width: 150px; height: 150px; padding: 0.5em; float: left; margin: 10px; }
</style>
<script type="text/javascript">
$(function() {
$("#draggable").draggable();
$("#droppable").droppable({
drop: function(event, ui) {
$(this).addClass('ui-state-highlight').find('p').html('Dropped!');
}
});
var report_event = function(report_text) {
var reportElement = $("#drop_reports");
var origText = reportElement.text();
reportElement.text(origText + " " + report_text);
}
$('body').mousedown(function() {
report_event('down');
});
$('body').mousemove(function() {
report_event('move');
});
$('body').mouseup(function() {
report_event('up');
});
});
</script>
</head>
<body>
<div class="demo">
<div id="draggable" class="ui-widget-content">
<p>Drag me to my target</p>
</div>
<div id="droppable" class="ui-widget-header">
<p>Drop here</p>
</div>
<div class="test-data">
<p id="drop_reports">start</p>
</div>
</div><!-- End demo -->
<div class="demo-description">
<p>Taken from the JQuery demo.</p>
</div><!-- End demo-description -->
</body>
</html>
|