1
|
1 |
<!DOCTYPE html> |
|
2 |
<html lang="en"> |
|
3 |
<head> |
|
4 |
<meta charset="UTF-8" /> |
|
5 |
<title>jQuery UI Draggable - Revert position</title> |
|
6 |
<link type="text/css" href="../../themes/base/jquery.ui.all.css" rel="stylesheet" /> |
|
7 |
<script type="text/javascript" src="../../jquery-1.4.2.js"></script> |
|
8 |
<script type="text/javascript" src="../../ui/jquery.ui.core.js"></script> |
|
9 |
<script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script> |
|
10 |
<script type="text/javascript" src="../../ui/jquery.ui.mouse.js"></script> |
|
11 |
<script type="text/javascript" src="../../ui/jquery.ui.draggable.js"></script> |
|
12 |
<link type="text/css" href="../demos.css" rel="stylesheet" /> |
|
13 |
<style type="text/css"> |
|
14 |
#draggable, #draggable2 { width: 100px; height: 100px; padding: 0.5em; float: left; margin: 0 10px 10px 0; } |
|
15 |
</style> |
|
16 |
<script type="text/javascript"> |
|
17 |
$(function() { |
|
18 |
$("#draggable").draggable({ revert: true }); |
|
19 |
$("#draggable2").draggable({ revert: true, helper: 'clone' }); |
|
20 |
}); |
|
21 |
</script> |
|
22 |
</head> |
|
23 |
<body> |
|
24 |
<div class="demo"> |
|
25 |
|
|
26 |
<div id="draggable" class="ui-widget-content"> |
|
27 |
<p>Revert the original</p> |
|
28 |
</div> |
|
29 |
|
|
30 |
<div id="draggable2" class="ui-widget-content"> |
|
31 |
<p>Revert the helper</p> |
|
32 |
</div> |
|
33 |
|
|
34 |
</div><!-- End demo --> |
|
35 |
|
|
36 |
<div class="demo-description"> |
|
37 |
|
|
38 |
<p> |
|
39 |
Return the draggable (or it's helper) to its original location when dragging stops with the boolean <code>revert</code> option. |
|
40 |
</p> |
|
41 |
|
|
42 |
</div><!-- End demo-description --> |
|
43 |
</body> |
|
44 |
</html> |