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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Language" content="en" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Draggable Demo</title>
<link rel="stylesheet" href="../themes/flora/flora.all.css" type="text/css" media="screen" title="Flora (Default)" />
<link rel="stylesheet" href="css/style.css" type="text/css" />
<script src="../jquery-1.2.3.min.js" type="text/javascript"></script>
<script type="text/javascript" src="../jquery.dimensions.js"></script>
<script type="text/javascript" src="../ui.mouse.js"></script>
<script type="text/javascript" src="../ui.draggable.js"></script>
<script type="text/javascript" src="../ui.draggable.ext.js"></script>
<style type="text/css">
.example { height: 50px; width: 100px; }
</style>
</head>
<body class="flora">
<h2>1. Default, no options</h2>
<div class="playground" style='height: 400px;'>
<div id='example1' class="ui-wrapper example" style='background: #E6F7D4; width: 500px; height: 300px;'>
<div style='position: absolute; top: 20px; left: 20px; bottom: 20px; right: 20px;'>Drag me</div>
</div><br />
<button onclick="$('#example1').draggable('enable')">Enable</button>
<button onclick="$('#example1').draggable('disable')">Disable</button>
</div>
<h2>2. Clone as helper</h2>
<div class="playground">
<div id='example2' class="ui-wrapper example" style='background: #E6F7D4;'>
<div style='position: absolute; top: 20px; left: 20px; bottom: 20px; right: 20px;'>Drag me</div>
</div>
</div>
<h2>3. Custom helper, cursor at -5,-5</h2>
<div class="playground">
<div id='example3' class="ui-wrapper example" style='background: #E6F7D4;'>
<div style='position: absolute; top: 20px; left: 20px; bottom: 20px; right: 20px;'>Drag me</div>
</div>
</div>
<h2>4. Reverting</h2>
<div class="playground">
<div id='example4' class="ui-wrapper example" style='background: #E6F7D4;'>
<div style='position: absolute; top: 20px; left: 20px; bottom: 20px; right: 20px;'>Drag me</div>
</div>
</div>
<h2>5. A certain axis only</h2>
<div class="playground">
<div id='example5' class="ui-wrapper example" style='background: #E6F7D4;'>
<div style='position: absolute; top: 20px; left: 20px; bottom: 20px; right: 20px;'>Drag me</div>
</div>
</div>
<h2>6. Contain to parent</h2>
<div class="playground">
<div id='example6' class="ui-wrapper example" style='background: #E6F7D4;'>
<div style='position: absolute; top: 20px; left: 20px; bottom: 20px; right: 20px;'>Drag me</div>
</div>
</div>
<h2>7. Grid</h2>
<div class="playground">
<div id='example7' class="ui-wrapper example" style='background: #E6F7D4;'>
<div style='position: absolute; top: 20px; left: 20px; bottom: 20px; right: 20px;'>Drag me</div>
</div>
</div>
<script type="text/javascript">
if(!window.console) {
window.console = {
log: function() {
alert(arguments[0]);
}
}
}
$(window).bind("load",function(){
$('#example1').draggable();
$('#example2').draggable({ helper: 'clone', snap: true, snapMode: 'both', zIndex: 1000 });
$('#example3').draggable({ cursorAt: {top: -5, left: -5 }, helper: function() { return $(document.createElement('div')).css({'background': '#fff', 'border': '1px solid black', 'padding': '5px'}).text("I'm a draggable!").appendTo("body")[0]; } });
$('#example4').draggable({ helper: 'clone', revert: true });
$('#example5').draggable({ helper: 'clone', axis: 'x' });
$('#example6').draggable({ helper: 'clone', containment: 'parent' });
$('#example7').draggable({ helper: 'clone', grid: [50,50] });
});
</script>
</body>
</html>
|