imported the whole jquery-ui package, refreshed with 1.10.2
[myslice.git] / third-party / jquery-ui-1.10.2 / demos / draggable / snap-to.html
1 <!doctype html>
2 <html lang="en">
3 <head>
4         <meta charset="utf-8">
5         <title>jQuery UI Draggable - Snap to element or grid</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         <link rel="stylesheet" href="../demos.css">
13         <style>
14         .draggable { width: 90px; height: 80px; padding: 5px; float: left; margin: 0 10px 10px 0; font-size: .9em; }
15         .ui-widget-header p, .ui-widget-content p { margin: 0; }
16         #snaptarget { height: 140px; }
17         </style>
18         <script>
19         $(function() {
20                 $( "#draggable" ).draggable({ snap: true });
21                 $( "#draggable2" ).draggable({ snap: ".ui-widget-header" });
22                 $( "#draggable3" ).draggable({ snap: ".ui-widget-header", snapMode: "outer" });
23                 $( "#draggable4" ).draggable({ grid: [ 20,20 ] });
24                 $( "#draggable5" ).draggable({ grid: [ 80, 80 ] });
25         });
26         </script>
27 </head>
28 <body>
29
30 <div id="snaptarget" class="ui-widget-header">
31         <p>I'm a snap target</p>
32 </div>
33
34 <br style="clear:both" />
35
36 <div id="draggable" class="draggable ui-widget-content">
37         <p>Default (snap: true), snaps to all other draggable elements</p>
38 </div>
39
40 <div id="draggable2" class="draggable ui-widget-content">
41         <p>I only snap to the big box</p>
42 </div>
43
44 <div id="draggable3" class="draggable ui-widget-content">
45         <p>I only snap to the outer edges of the big box</p>
46 </div>
47
48 <div id="draggable4" class="draggable ui-widget-content">
49         <p>I snap to a 20 x 20 grid</p>
50 </div>
51
52 <div id="draggable5" class="draggable ui-widget-content">
53         <p>I snap to a 80 x 80 grid</p>
54 </div>
55
56 <div class="demo-description">
57 <p>Snap the draggable to the inner or outer boundaries of a DOM element.  Use the <code>snap</code>, <code>snapMode</code> (inner, outer, both), and <code>snapTolerance</code> (distance in pixels the draggable must be from the element when snapping is invoked) options. </p>
58 <p>Or snap the draggable to a grid.  Set the dimensions of grid cells (height and width in pixels) with the <code>grid</code> option.</p>
59 </div>
60 </body>
61 </html>