1 |
|
2 <ul class="UIAPIPlugin-toc"> |
|
3 <li><a href="#overview">Overview</a></li> |
|
4 <li><a href="#options">Options</a></li> |
|
5 <li><a href="#events">Events</a></li> |
|
6 <li><a href="#methods">Methods</a></li> |
|
7 <li><a href="#theming">Theming</a></li> |
|
8 </ul> |
|
9 <div class="UIAPIPlugin"> |
|
10 <h1>jQuery UI Draggable</h1> |
|
11 <div id="overview"> |
|
12 <h2 class="top-header">Overview</h2> |
|
13 <div id="overview-main"> |
|
14 <p>The jQuery UI Draggable plugin makes selected elements draggable by mouse.</p> |
|
15 <p>Draggable elements gets a class of <code>ui-draggable</code>. During drag the element also gets a class of <code>ui-draggable-dragging</code>. If you want not just drag, but drag-and-drop, see the jQuery UI Droppable plugin, which provides a drop target for draggables.</p> |
|
16 <p>All callbacks (start, stop, drag) receive two arguments: The original browser event and a prepared ui object, view below for a documentation of this object (if you name your second argument 'ui'):</p> |
|
17 <ul> |
|
18 <li><b>ui.helper</b> - the jQuery object representing the helper that's being dragged</li> |
|
19 <li><b>ui.position</b> - current position of the helper as { top, left } object, relative to the offset element</li> |
|
20 <li><b>ui.offset</b> - current absolute position of the helper as { top, left } object, relative to page</li> |
|
21 </ul> |
|
22 </div> |
|
23 <div id="overview-dependencies"> |
|
24 <h3>Dependencies</h3> |
|
25 <ul> |
|
26 <li>UI Core</li> |
|
27 </ul> |
|
28 </div> |
|
29 <div id="overview-example"> |
|
30 <h3>Example</h3> |
|
31 <div id="overview-example" class="example"> |
|
32 <ul><li><a href="#demo"><span>Demo</span></a></li><li><a href="#source"><span>View Source</span></a></li></ul> |
|
33 <p><div id="demo" class="tabs-container" rel="170"> |
|
34 Initialize a draggable with default options.<br /> |
|
35 </p> |
|
36 <pre>$("#draggable").draggable(); |
|
37 </pre> |
|
38 <p></div><div id="source" class="tabs-container"> |
|
39 </p> |
|
40 <pre><!DOCTYPE html> |
|
41 <html> |
|
42 <head> |
|
43 <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/> |
|
44 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script> |
|
45 <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script> |
|
46 <style type="text/css"> |
|
47 #draggable { width: 100px; height: 70px; background: silver; } |
|
48 </style> |
|
49 <script> |
|
50 $(document).ready(function() { |
|
51 $("#draggable").draggable(); |
|
52 }); |
|
53 </script> |
|
54 </head> |
|
55 <body style="font-size:62.5%;"> |
|
56 |
|
57 <div id="draggable">Drag me</div> |
|
58 |
|
59 </body> |
|
60 </html> |
|
61 </pre> |
|
62 <p></div> |
|
63 </p><p></div> |
|
64 </div> |
|
65 </div> |
|
66 <div id="options"> |
|
67 <h2 class="top-header">Options</h2> |
|
68 <ul class="options-list"> |
|
69 |
|
70 <li class="option" id="option-disabled"> |
|
71 <div class="option-header"> |
|
72 <h3 class="option-name"><a href="#option-disabled">disabled</a></h3> |
|
73 <dl> |
|
74 <dt class="option-type-label">Type:</dt> |
|
75 <dd class="option-type">Boolean</dd> |
|
76 |
|
77 <dt class="option-default-label">Default:</dt> |
|
78 <dd class="option-default">false</dd> |
|
79 |
|
80 </dl> |
|
81 </div> |
|
82 <div class="option-description"> |
|
83 <p>Disables (true) or enables (false) the draggable. Can be set when initialising (first creating) the draggable.</p> |
|
84 </div> |
|
85 <div class="option-examples"> |
|
86 <h4>Code examples</h4> |
|
87 <dl class="option-examples-list"> |
|
88 |
|
89 <dt> |
|
90 Initialize a draggable with the <code>disabled</code> option specified. |
|
91 </dt> |
|
92 <dd> |
|
93 <pre><code>$( ".selector" ).draggable({ disabled: true });</code></pre> |
|
94 </dd> |
|
95 |
|
96 |
|
97 <dt> |
|
98 Get or set the <code>disabled</code> option, after init. |
|
99 </dt> |
|
100 <dd> |
|
101 <pre><code>//getter |
|
102 var disabled = $( ".selector" ).draggable( "option", "disabled" ); |
|
103 //setter |
|
104 $( ".selector" ).draggable( "option", "disabled", true );</code></pre> |
|
105 </dd> |
|
106 |
|
107 </dl> |
|
108 </div> |
|
109 </li> |
|
110 |
|
111 |
|
112 <li class="option" id="option-addClasses"> |
|
113 <div class="option-header"> |
|
114 <h3 class="option-name"><a href="#option-addClasses">addClasses</a></h3> |
|
115 <dl> |
|
116 <dt class="option-type-label">Type:</dt> |
|
117 <dd class="option-type">Boolean</dd> |
|
118 |
|
119 <dt class="option-default-label">Default:</dt> |
|
120 <dd class="option-default">true</dd> |
|
121 |
|
122 </dl> |
|
123 </div> |
|
124 <div class="option-description"> |
|
125 <p>If set to false, will prevent the <code>ui-draggable</code> class from being added. This may be desired as a performance optimization when calling <code>.draggable()</code> init on many hundreds of elements.</p> |
|
126 </div> |
|
127 <div class="option-examples"> |
|
128 <h4>Code examples</h4> |
|
129 <dl class="option-examples-list"> |
|
130 |
|
131 <dt> |
|
132 Initialize a draggable with the <code>addClasses</code> option specified. |
|
133 </dt> |
|
134 <dd> |
|
135 <pre><code>$( ".selector" ).draggable({ addClasses: false });</code></pre> |
|
136 </dd> |
|
137 |
|
138 |
|
139 <dt> |
|
140 Get or set the <code>addClasses</code> option, after init. |
|
141 </dt> |
|
142 <dd> |
|
143 <pre><code>//getter |
|
144 var addClasses = $( ".selector" ).draggable( "option", "addClasses" ); |
|
145 //setter |
|
146 $( ".selector" ).draggable( "option", "addClasses", false );</code></pre> |
|
147 </dd> |
|
148 |
|
149 </dl> |
|
150 </div> |
|
151 </li> |
|
152 |
|
153 |
|
154 <li class="option" id="option-appendTo"> |
|
155 <div class="option-header"> |
|
156 <h3 class="option-name"><a href="#option-appendTo">appendTo</a></h3> |
|
157 <dl> |
|
158 <dt class="option-type-label">Type:</dt> |
|
159 <dd class="option-type">Element, Selector</dd> |
|
160 |
|
161 <dt class="option-default-label">Default:</dt> |
|
162 <dd class="option-default">'parent'</dd> |
|
163 |
|
164 </dl> |
|
165 </div> |
|
166 <div class="option-description"> |
|
167 <p>The element passed to or selected by the <code>appendTo</code> option will be used as the draggable helper's container during dragging. By default, the helper is appended to the same container as the draggable.</p> |
|
168 </div> |
|
169 <div class="option-examples"> |
|
170 <h4>Code examples</h4> |
|
171 <dl class="option-examples-list"> |
|
172 |
|
173 <dt> |
|
174 Initialize a draggable with the <code>appendTo</code> option specified. |
|
175 </dt> |
|
176 <dd> |
|
177 <pre><code>$( ".selector" ).draggable({ appendTo: 'body' });</code></pre> |
|
178 </dd> |
|
179 |
|
180 |
|
181 <dt> |
|
182 Get or set the <code>appendTo</code> option, after init. |
|
183 </dt> |
|
184 <dd> |
|
185 <pre><code>//getter |
|
186 var appendTo = $( ".selector" ).draggable( "option", "appendTo" ); |
|
187 //setter |
|
188 $( ".selector" ).draggable( "option", "appendTo", 'body' );</code></pre> |
|
189 </dd> |
|
190 |
|
191 </dl> |
|
192 </div> |
|
193 </li> |
|
194 |
|
195 |
|
196 <li class="option" id="option-axis"> |
|
197 <div class="option-header"> |
|
198 <h3 class="option-name"><a href="#option-axis">axis</a></h3> |
|
199 <dl> |
|
200 <dt class="option-type-label">Type:</dt> |
|
201 <dd class="option-type">String</dd> |
|
202 |
|
203 <dt class="option-default-label">Default:</dt> |
|
204 <dd class="option-default">false</dd> |
|
205 |
|
206 </dl> |
|
207 </div> |
|
208 <div class="option-description"> |
|
209 <p>Constrains dragging to either the horizontal (x) or vertical (y) axis. Possible values: 'x', 'y'.</p> |
|
210 </div> |
|
211 <div class="option-examples"> |
|
212 <h4>Code examples</h4> |
|
213 <dl class="option-examples-list"> |
|
214 |
|
215 <dt> |
|
216 Initialize a draggable with the <code>axis</code> option specified. |
|
217 </dt> |
|
218 <dd> |
|
219 <pre><code>$( ".selector" ).draggable({ axis: 'x' });</code></pre> |
|
220 </dd> |
|
221 |
|
222 |
|
223 <dt> |
|
224 Get or set the <code>axis</code> option, after init. |
|
225 </dt> |
|
226 <dd> |
|
227 <pre><code>//getter |
|
228 var axis = $( ".selector" ).draggable( "option", "axis" ); |
|
229 //setter |
|
230 $( ".selector" ).draggable( "option", "axis", 'x' );</code></pre> |
|
231 </dd> |
|
232 |
|
233 </dl> |
|
234 </div> |
|
235 </li> |
|
236 |
|
237 |
|
238 <li class="option" id="option-cancel"> |
|
239 <div class="option-header"> |
|
240 <h3 class="option-name"><a href="#option-cancel">cancel</a></h3> |
|
241 <dl> |
|
242 <dt class="option-type-label">Type:</dt> |
|
243 <dd class="option-type">Selector</dd> |
|
244 |
|
245 <dt class="option-default-label">Default:</dt> |
|
246 <dd class="option-default">':input,option'</dd> |
|
247 |
|
248 </dl> |
|
249 </div> |
|
250 <div class="option-description"> |
|
251 <p>Prevents dragging from starting on specified elements.</p> |
|
252 </div> |
|
253 <div class="option-examples"> |
|
254 <h4>Code examples</h4> |
|
255 <dl class="option-examples-list"> |
|
256 |
|
257 <dt> |
|
258 Initialize a draggable with the <code>cancel</code> option specified. |
|
259 </dt> |
|
260 <dd> |
|
261 <pre><code>$( ".selector" ).draggable({ cancel: 'button' });</code></pre> |
|
262 </dd> |
|
263 |
|
264 |
|
265 <dt> |
|
266 Get or set the <code>cancel</code> option, after init. |
|
267 </dt> |
|
268 <dd> |
|
269 <pre><code>//getter |
|
270 var cancel = $( ".selector" ).draggable( "option", "cancel" ); |
|
271 //setter |
|
272 $( ".selector" ).draggable( "option", "cancel", 'button' );</code></pre> |
|
273 </dd> |
|
274 |
|
275 </dl> |
|
276 </div> |
|
277 </li> |
|
278 |
|
279 |
|
280 <li class="option" id="option-connectToSortable"> |
|
281 <div class="option-header"> |
|
282 <h3 class="option-name"><a href="#option-connectToSortable">connectToSortable</a></h3> |
|
283 <dl> |
|
284 <dt class="option-type-label">Type:</dt> |
|
285 <dd class="option-type">Selector</dd> |
|
286 |
|
287 <dt class="option-default-label">Default:</dt> |
|
288 <dd class="option-default">false</dd> |
|
289 |
|
290 </dl> |
|
291 </div> |
|
292 <div class="option-description"> |
|
293 <p>Allows the draggable to be dropped onto the specified sortables. If this option is used (<code>helper</code> must be set to 'clone' in order to work flawlessly), a draggable can be dropped onto a sortable list and then becomes part of it. |
|
294 </p><p>Note: Specifying this option as an array of selectors has been removed.</p> |
|
295 </div> |
|
296 <div class="option-examples"> |
|
297 <h4>Code examples</h4> |
|
298 <dl class="option-examples-list"> |
|
299 |
|
300 <dt> |
|
301 Initialize a draggable with the <code>connectToSortable</code> option specified. |
|
302 </dt> |
|
303 <dd> |
|
304 <pre><code>$( ".selector" ).draggable({ connectToSortable: 'ul#myList' });</code></pre> |
|
305 </dd> |
|
306 |
|
307 |
|
308 <dt> |
|
309 Get or set the <code>connectToSortable</code> option, after init. |
|
310 </dt> |
|
311 <dd> |
|
312 <pre><code>//getter |
|
313 var connectToSortable = $( ".selector" ).draggable( "option", "connectToSortable" ); |
|
314 //setter |
|
315 $( ".selector" ).draggable( "option", "connectToSortable", 'ul#myList' );</code></pre> |
|
316 </dd> |
|
317 |
|
318 </dl> |
|
319 </div> |
|
320 </li> |
|
321 |
|
322 |
|
323 <li class="option" id="option-containment"> |
|
324 <div class="option-header"> |
|
325 <h3 class="option-name"><a href="#option-containment">containment</a></h3> |
|
326 <dl> |
|
327 <dt class="option-type-label">Type:</dt> |
|
328 <dd class="option-type">Selector, Element, String, Array</dd> |
|
329 |
|
330 <dt class="option-default-label">Default:</dt> |
|
331 <dd class="option-default">false</dd> |
|
332 |
|
333 </dl> |
|
334 </div> |
|
335 <div class="option-description"> |
|
336 <p>Constrains dragging to within the bounds of the specified element or region. Possible string values: 'parent', 'document', 'window', [x1, y1, x2, y2].</p> |
|
337 </div> |
|
338 <div class="option-examples"> |
|
339 <h4>Code examples</h4> |
|
340 <dl class="option-examples-list"> |
|
341 |
|
342 <dt> |
|
343 Initialize a draggable with the <code>containment</code> option specified. |
|
344 </dt> |
|
345 <dd> |
|
346 <pre><code>$( ".selector" ).draggable({ containment: 'parent' });</code></pre> |
|
347 </dd> |
|
348 |
|
349 |
|
350 <dt> |
|
351 Get or set the <code>containment</code> option, after init. |
|
352 </dt> |
|
353 <dd> |
|
354 <pre><code>//getter |
|
355 var containment = $( ".selector" ).draggable( "option", "containment" ); |
|
356 //setter |
|
357 $( ".selector" ).draggable( "option", "containment", 'parent' );</code></pre> |
|
358 </dd> |
|
359 |
|
360 </dl> |
|
361 </div> |
|
362 </li> |
|
363 |
|
364 |
|
365 <li class="option" id="option-cursor"> |
|
366 <div class="option-header"> |
|
367 <h3 class="option-name"><a href="#option-cursor">cursor</a></h3> |
|
368 <dl> |
|
369 <dt class="option-type-label">Type:</dt> |
|
370 <dd class="option-type">String</dd> |
|
371 |
|
372 <dt class="option-default-label">Default:</dt> |
|
373 <dd class="option-default">'auto'</dd> |
|
374 |
|
375 </dl> |
|
376 </div> |
|
377 <div class="option-description"> |
|
378 <p>The css cursor during the drag operation.</p> |
|
379 </div> |
|
380 <div class="option-examples"> |
|
381 <h4>Code examples</h4> |
|
382 <dl class="option-examples-list"> |
|
383 |
|
384 <dt> |
|
385 Initialize a draggable with the <code>cursor</code> option specified. |
|
386 </dt> |
|
387 <dd> |
|
388 <pre><code>$( ".selector" ).draggable({ cursor: 'crosshair' });</code></pre> |
|
389 </dd> |
|
390 |
|
391 |
|
392 <dt> |
|
393 Get or set the <code>cursor</code> option, after init. |
|
394 </dt> |
|
395 <dd> |
|
396 <pre><code>//getter |
|
397 var cursor = $( ".selector" ).draggable( "option", "cursor" ); |
|
398 //setter |
|
399 $( ".selector" ).draggable( "option", "cursor", 'crosshair' );</code></pre> |
|
400 </dd> |
|
401 |
|
402 </dl> |
|
403 </div> |
|
404 </li> |
|
405 |
|
406 |
|
407 <li class="option" id="option-cursorAt"> |
|
408 <div class="option-header"> |
|
409 <h3 class="option-name"><a href="#option-cursorAt">cursorAt</a></h3> |
|
410 <dl> |
|
411 <dt class="option-type-label">Type:</dt> |
|
412 <dd class="option-type">Object</dd> |
|
413 |
|
414 <dt class="option-default-label">Default:</dt> |
|
415 <dd class="option-default">false</dd> |
|
416 |
|
417 </dl> |
|
418 </div> |
|
419 <div class="option-description"> |
|
420 <p>Moves the dragging helper so the cursor always appears to drag from the same position. Coordinates can be given as a hash using a combination of one or two keys: <code>{ top, left, right, bottom }</code>.</p> |
|
421 </div> |
|
422 <div class="option-examples"> |
|
423 <h4>Code examples</h4> |
|
424 <dl class="option-examples-list"> |
|
425 |
|
426 <dt> |
|
427 Initialize a draggable with the <code>cursorAt</code> option specified. |
|
428 </dt> |
|
429 <dd> |
|
430 <pre><code>$( ".selector" ).draggable({ cursorAt: { left: 5 } });</code></pre> |
|
431 </dd> |
|
432 |
|
433 |
|
434 <dt> |
|
435 Get or set the <code>cursorAt</code> option, after init. |
|
436 </dt> |
|
437 <dd> |
|
438 <pre><code>//getter |
|
439 var cursorAt = $( ".selector" ).draggable( "option", "cursorAt" ); |
|
440 //setter |
|
441 $( ".selector" ).draggable( "option", "cursorAt", { left: 5 } );</code></pre> |
|
442 </dd> |
|
443 |
|
444 </dl> |
|
445 </div> |
|
446 </li> |
|
447 |
|
448 |
|
449 <li class="option" id="option-delay"> |
|
450 <div class="option-header"> |
|
451 <h3 class="option-name"><a href="#option-delay">delay</a></h3> |
|
452 <dl> |
|
453 <dt class="option-type-label">Type:</dt> |
|
454 <dd class="option-type">Integer</dd> |
|
455 |
|
456 <dt class="option-default-label">Default:</dt> |
|
457 <dd class="option-default">0</dd> |
|
458 |
|
459 </dl> |
|
460 </div> |
|
461 <div class="option-description"> |
|
462 <p>Time in milliseconds after mousedown until dragging should start. This option can be used to prevent unwanted drags when clicking on an element.</p> |
|
463 </div> |
|
464 <div class="option-examples"> |
|
465 <h4>Code examples</h4> |
|
466 <dl class="option-examples-list"> |
|
467 |
|
468 <dt> |
|
469 Initialize a draggable with the <code>delay</code> option specified. |
|
470 </dt> |
|
471 <dd> |
|
472 <pre><code>$( ".selector" ).draggable({ delay: 500 });</code></pre> |
|
473 </dd> |
|
474 |
|
475 |
|
476 <dt> |
|
477 Get or set the <code>delay</code> option, after init. |
|
478 </dt> |
|
479 <dd> |
|
480 <pre><code>//getter |
|
481 var delay = $( ".selector" ).draggable( "option", "delay" ); |
|
482 //setter |
|
483 $( ".selector" ).draggable( "option", "delay", 500 );</code></pre> |
|
484 </dd> |
|
485 |
|
486 </dl> |
|
487 </div> |
|
488 </li> |
|
489 |
|
490 |
|
491 <li class="option" id="option-distance"> |
|
492 <div class="option-header"> |
|
493 <h3 class="option-name"><a href="#option-distance">distance</a></h3> |
|
494 <dl> |
|
495 <dt class="option-type-label">Type:</dt> |
|
496 <dd class="option-type">Integer</dd> |
|
497 |
|
498 <dt class="option-default-label">Default:</dt> |
|
499 <dd class="option-default">1</dd> |
|
500 |
|
501 </dl> |
|
502 </div> |
|
503 <div class="option-description"> |
|
504 <p>Distance in pixels after mousedown the mouse must move before dragging should start. This option can be used to prevent unwanted drags when clicking on an element.</p> |
|
505 </div> |
|
506 <div class="option-examples"> |
|
507 <h4>Code examples</h4> |
|
508 <dl class="option-examples-list"> |
|
509 |
|
510 <dt> |
|
511 Initialize a draggable with the <code>distance</code> option specified. |
|
512 </dt> |
|
513 <dd> |
|
514 <pre><code>$( ".selector" ).draggable({ distance: 30 });</code></pre> |
|
515 </dd> |
|
516 |
|
517 |
|
518 <dt> |
|
519 Get or set the <code>distance</code> option, after init. |
|
520 </dt> |
|
521 <dd> |
|
522 <pre><code>//getter |
|
523 var distance = $( ".selector" ).draggable( "option", "distance" ); |
|
524 //setter |
|
525 $( ".selector" ).draggable( "option", "distance", 30 );</code></pre> |
|
526 </dd> |
|
527 |
|
528 </dl> |
|
529 </div> |
|
530 </li> |
|
531 |
|
532 |
|
533 <li class="option" id="option-grid"> |
|
534 <div class="option-header"> |
|
535 <h3 class="option-name"><a href="#option-grid">grid</a></h3> |
|
536 <dl> |
|
537 <dt class="option-type-label">Type:</dt> |
|
538 <dd class="option-type">Array</dd> |
|
539 |
|
540 <dt class="option-default-label">Default:</dt> |
|
541 <dd class="option-default">false</dd> |
|
542 |
|
543 </dl> |
|
544 </div> |
|
545 <div class="option-description"> |
|
546 <p>Snaps the dragging helper to a grid, every x and y pixels. Array values: [x, y]</p> |
|
547 </div> |
|
548 <div class="option-examples"> |
|
549 <h4>Code examples</h4> |
|
550 <dl class="option-examples-list"> |
|
551 |
|
552 <dt> |
|
553 Initialize a draggable with the <code>grid</code> option specified. |
|
554 </dt> |
|
555 <dd> |
|
556 <pre><code>$( ".selector" ).draggable({ grid: [50, 20] });</code></pre> |
|
557 </dd> |
|
558 |
|
559 |
|
560 <dt> |
|
561 Get or set the <code>grid</code> option, after init. |
|
562 </dt> |
|
563 <dd> |
|
564 <pre><code>//getter |
|
565 var grid = $( ".selector" ).draggable( "option", "grid" ); |
|
566 //setter |
|
567 $( ".selector" ).draggable( "option", "grid", [50, 20] );</code></pre> |
|
568 </dd> |
|
569 |
|
570 </dl> |
|
571 </div> |
|
572 </li> |
|
573 |
|
574 |
|
575 <li class="option" id="option-handle"> |
|
576 <div class="option-header"> |
|
577 <h3 class="option-name"><a href="#option-handle">handle</a></h3> |
|
578 <dl> |
|
579 <dt class="option-type-label">Type:</dt> |
|
580 <dd class="option-type">Element, Selector</dd> |
|
581 |
|
582 <dt class="option-default-label">Default:</dt> |
|
583 <dd class="option-default">false</dd> |
|
584 |
|
585 </dl> |
|
586 </div> |
|
587 <div class="option-description"> |
|
588 <p>If specified, restricts drag start click to the specified element(s).</p> |
|
589 </div> |
|
590 <div class="option-examples"> |
|
591 <h4>Code examples</h4> |
|
592 <dl class="option-examples-list"> |
|
593 |
|
594 <dt> |
|
595 Initialize a draggable with the <code>handle</code> option specified. |
|
596 </dt> |
|
597 <dd> |
|
598 <pre><code>$( ".selector" ).draggable({ handle: 'h2' });</code></pre> |
|
599 </dd> |
|
600 |
|
601 |
|
602 <dt> |
|
603 Get or set the <code>handle</code> option, after init. |
|
604 </dt> |
|
605 <dd> |
|
606 <pre><code>//getter |
|
607 var handle = $( ".selector" ).draggable( "option", "handle" ); |
|
608 //setter |
|
609 $( ".selector" ).draggable( "option", "handle", 'h2' );</code></pre> |
|
610 </dd> |
|
611 |
|
612 </dl> |
|
613 </div> |
|
614 </li> |
|
615 |
|
616 |
|
617 <li class="option" id="option-helper"> |
|
618 <div class="option-header"> |
|
619 <h3 class="option-name"><a href="#option-helper">helper</a></h3> |
|
620 <dl> |
|
621 <dt class="option-type-label">Type:</dt> |
|
622 <dd class="option-type">String, Function</dd> |
|
623 |
|
624 <dt class="option-default-label">Default:</dt> |
|
625 <dd class="option-default">'original'</dd> |
|
626 |
|
627 </dl> |
|
628 </div> |
|
629 <div class="option-description"> |
|
630 <p>Allows for a helper element to be used for dragging display. Possible values: 'original', 'clone', Function. If a function is specified, it must return a DOMElement.</p> |
|
631 </div> |
|
632 <div class="option-examples"> |
|
633 <h4>Code examples</h4> |
|
634 <dl class="option-examples-list"> |
|
635 |
|
636 <dt> |
|
637 Initialize a draggable with the <code>helper</code> option specified. |
|
638 </dt> |
|
639 <dd> |
|
640 <pre><code>$( ".selector" ).draggable({ helper: 'clone' });</code></pre> |
|
641 </dd> |
|
642 |
|
643 |
|
644 <dt> |
|
645 Get or set the <code>helper</code> option, after init. |
|
646 </dt> |
|
647 <dd> |
|
648 <pre><code>//getter |
|
649 var helper = $( ".selector" ).draggable( "option", "helper" ); |
|
650 //setter |
|
651 $( ".selector" ).draggable( "option", "helper", 'clone' );</code></pre> |
|
652 </dd> |
|
653 |
|
654 </dl> |
|
655 </div> |
|
656 </li> |
|
657 |
|
658 |
|
659 <li class="option" id="option-iframeFix"> |
|
660 <div class="option-header"> |
|
661 <h3 class="option-name"><a href="#option-iframeFix">iframeFix</a></h3> |
|
662 <dl> |
|
663 <dt class="option-type-label">Type:</dt> |
|
664 <dd class="option-type">Boolean, Selector</dd> |
|
665 |
|
666 <dt class="option-default-label">Default:</dt> |
|
667 <dd class="option-default">false</dd> |
|
668 |
|
669 </dl> |
|
670 </div> |
|
671 <div class="option-description"> |
|
672 <p>Prevent iframes from capturing the mousemove events during a drag. Useful in combination with cursorAt, or in any case, if the mouse cursor is not over the helper. If set to true, transparent overlays will be placed over all iframes on the page. If a selector is supplied, the matched iframes will have an overlay placed over them.</p> |
|
673 </div> |
|
674 <div class="option-examples"> |
|
675 <h4>Code examples</h4> |
|
676 <dl class="option-examples-list"> |
|
677 |
|
678 <dt> |
|
679 Initialize a draggable with the <code>iframeFix</code> option specified. |
|
680 </dt> |
|
681 <dd> |
|
682 <pre><code>$( ".selector" ).draggable({ iframeFix: true });</code></pre> |
|
683 </dd> |
|
684 |
|
685 |
|
686 <dt> |
|
687 Get or set the <code>iframeFix</code> option, after init. |
|
688 </dt> |
|
689 <dd> |
|
690 <pre><code>//getter |
|
691 var iframeFix = $( ".selector" ).draggable( "option", "iframeFix" ); |
|
692 //setter |
|
693 $( ".selector" ).draggable( "option", "iframeFix", true );</code></pre> |
|
694 </dd> |
|
695 |
|
696 </dl> |
|
697 </div> |
|
698 </li> |
|
699 |
|
700 |
|
701 <li class="option" id="option-opacity"> |
|
702 <div class="option-header"> |
|
703 <h3 class="option-name"><a href="#option-opacity">opacity</a></h3> |
|
704 <dl> |
|
705 <dt class="option-type-label">Type:</dt> |
|
706 <dd class="option-type">Float</dd> |
|
707 |
|
708 <dt class="option-default-label">Default:</dt> |
|
709 <dd class="option-default">false</dd> |
|
710 |
|
711 </dl> |
|
712 </div> |
|
713 <div class="option-description"> |
|
714 <p>Opacity for the helper while being dragged.</p> |
|
715 </div> |
|
716 <div class="option-examples"> |
|
717 <h4>Code examples</h4> |
|
718 <dl class="option-examples-list"> |
|
719 |
|
720 <dt> |
|
721 Initialize a draggable with the <code>opacity</code> option specified. |
|
722 </dt> |
|
723 <dd> |
|
724 <pre><code>$( ".selector" ).draggable({ opacity: 0.35 });</code></pre> |
|
725 </dd> |
|
726 |
|
727 |
|
728 <dt> |
|
729 Get or set the <code>opacity</code> option, after init. |
|
730 </dt> |
|
731 <dd> |
|
732 <pre><code>//getter |
|
733 var opacity = $( ".selector" ).draggable( "option", "opacity" ); |
|
734 //setter |
|
735 $( ".selector" ).draggable( "option", "opacity", 0.35 );</code></pre> |
|
736 </dd> |
|
737 |
|
738 </dl> |
|
739 </div> |
|
740 </li> |
|
741 |
|
742 |
|
743 <li class="option" id="option-refreshPositions"> |
|
744 <div class="option-header"> |
|
745 <h3 class="option-name"><a href="#option-refreshPositions">refreshPositions</a></h3> |
|
746 <dl> |
|
747 <dt class="option-type-label">Type:</dt> |
|
748 <dd class="option-type">Boolean</dd> |
|
749 |
|
750 <dt class="option-default-label">Default:</dt> |
|
751 <dd class="option-default">false</dd> |
|
752 |
|
753 </dl> |
|
754 </div> |
|
755 <div class="option-description"> |
|
756 <p>If set to true, all droppable positions are calculated on every mousemove. Caution: This solves issues on highly dynamic pages, but dramatically decreases performance.</p> |
|
757 </div> |
|
758 <div class="option-examples"> |
|
759 <h4>Code examples</h4> |
|
760 <dl class="option-examples-list"> |
|
761 |
|
762 <dt> |
|
763 Initialize a draggable with the <code>refreshPositions</code> option specified. |
|
764 </dt> |
|
765 <dd> |
|
766 <pre><code>$( ".selector" ).draggable({ refreshPositions: true });</code></pre> |
|
767 </dd> |
|
768 |
|
769 |
|
770 <dt> |
|
771 Get or set the <code>refreshPositions</code> option, after init. |
|
772 </dt> |
|
773 <dd> |
|
774 <pre><code>//getter |
|
775 var refreshPositions = $( ".selector" ).draggable( "option", "refreshPositions" ); |
|
776 //setter |
|
777 $( ".selector" ).draggable( "option", "refreshPositions", true );</code></pre> |
|
778 </dd> |
|
779 |
|
780 </dl> |
|
781 </div> |
|
782 </li> |
|
783 |
|
784 |
|
785 <li class="option" id="option-revert"> |
|
786 <div class="option-header"> |
|
787 <h3 class="option-name"><a href="#option-revert">revert</a></h3> |
|
788 <dl> |
|
789 <dt class="option-type-label">Type:</dt> |
|
790 <dd class="option-type">Boolean, String</dd> |
|
791 |
|
792 <dt class="option-default-label">Default:</dt> |
|
793 <dd class="option-default">false</dd> |
|
794 |
|
795 </dl> |
|
796 </div> |
|
797 <div class="option-description"> |
|
798 <p>If set to true, the element will return to its start position when dragging stops. Possible string values: 'valid', 'invalid'. If set to invalid, revert will only occur if the draggable has not been dropped on a droppable. For valid, it's the other way around.</p> |
|
799 </div> |
|
800 <div class="option-examples"> |
|
801 <h4>Code examples</h4> |
|
802 <dl class="option-examples-list"> |
|
803 |
|
804 <dt> |
|
805 Initialize a draggable with the <code>revert</code> option specified. |
|
806 </dt> |
|
807 <dd> |
|
808 <pre><code>$( ".selector" ).draggable({ revert: true });</code></pre> |
|
809 </dd> |
|
810 |
|
811 |
|
812 <dt> |
|
813 Get or set the <code>revert</code> option, after init. |
|
814 </dt> |
|
815 <dd> |
|
816 <pre><code>//getter |
|
817 var revert = $( ".selector" ).draggable( "option", "revert" ); |
|
818 //setter |
|
819 $( ".selector" ).draggable( "option", "revert", true );</code></pre> |
|
820 </dd> |
|
821 |
|
822 </dl> |
|
823 </div> |
|
824 </li> |
|
825 |
|
826 |
|
827 <li class="option" id="option-revertDuration"> |
|
828 <div class="option-header"> |
|
829 <h3 class="option-name"><a href="#option-revertDuration">revertDuration</a></h3> |
|
830 <dl> |
|
831 <dt class="option-type-label">Type:</dt> |
|
832 <dd class="option-type">Integer</dd> |
|
833 |
|
834 <dt class="option-default-label">Default:</dt> |
|
835 <dd class="option-default">500</dd> |
|
836 |
|
837 </dl> |
|
838 </div> |
|
839 <div class="option-description"> |
|
840 <p>The duration of the revert animation, in milliseconds. Ignored if revert is false.</p> |
|
841 </div> |
|
842 <div class="option-examples"> |
|
843 <h4>Code examples</h4> |
|
844 <dl class="option-examples-list"> |
|
845 |
|
846 <dt> |
|
847 Initialize a draggable with the <code>revertDuration</code> option specified. |
|
848 </dt> |
|
849 <dd> |
|
850 <pre><code>$( ".selector" ).draggable({ revertDuration: 1000 });</code></pre> |
|
851 </dd> |
|
852 |
|
853 |
|
854 <dt> |
|
855 Get or set the <code>revertDuration</code> option, after init. |
|
856 </dt> |
|
857 <dd> |
|
858 <pre><code>//getter |
|
859 var revertDuration = $( ".selector" ).draggable( "option", "revertDuration" ); |
|
860 //setter |
|
861 $( ".selector" ).draggable( "option", "revertDuration", 1000 );</code></pre> |
|
862 </dd> |
|
863 |
|
864 </dl> |
|
865 </div> |
|
866 </li> |
|
867 |
|
868 |
|
869 <li class="option" id="option-scope"> |
|
870 <div class="option-header"> |
|
871 <h3 class="option-name"><a href="#option-scope">scope</a></h3> |
|
872 <dl> |
|
873 <dt class="option-type-label">Type:</dt> |
|
874 <dd class="option-type">String</dd> |
|
875 |
|
876 <dt class="option-default-label">Default:</dt> |
|
877 <dd class="option-default">'default'</dd> |
|
878 |
|
879 </dl> |
|
880 </div> |
|
881 <div class="option-description"> |
|
882 <p>Used to group sets of draggable and droppable items, in addition to droppable's accept option. A draggable with the same scope value as a droppable will be accepted by the droppable.</p> |
|
883 </div> |
|
884 <div class="option-examples"> |
|
885 <h4>Code examples</h4> |
|
886 <dl class="option-examples-list"> |
|
887 |
|
888 <dt> |
|
889 Initialize a draggable with the <code>scope</code> option specified. |
|
890 </dt> |
|
891 <dd> |
|
892 <pre><code>$( ".selector" ).draggable({ scope: 'tasks' });</code></pre> |
|
893 </dd> |
|
894 |
|
895 |
|
896 <dt> |
|
897 Get or set the <code>scope</code> option, after init. |
|
898 </dt> |
|
899 <dd> |
|
900 <pre><code>//getter |
|
901 var scope = $( ".selector" ).draggable( "option", "scope" ); |
|
902 //setter |
|
903 $( ".selector" ).draggable( "option", "scope", 'tasks' );</code></pre> |
|
904 </dd> |
|
905 |
|
906 </dl> |
|
907 </div> |
|
908 </li> |
|
909 |
|
910 |
|
911 <li class="option" id="option-scroll"> |
|
912 <div class="option-header"> |
|
913 <h3 class="option-name"><a href="#option-scroll">scroll</a></h3> |
|
914 <dl> |
|
915 <dt class="option-type-label">Type:</dt> |
|
916 <dd class="option-type">Boolean</dd> |
|
917 |
|
918 <dt class="option-default-label">Default:</dt> |
|
919 <dd class="option-default">true</dd> |
|
920 |
|
921 </dl> |
|
922 </div> |
|
923 <div class="option-description"> |
|
924 <p>If set to true, container auto-scrolls while dragging.</p> |
|
925 </div> |
|
926 <div class="option-examples"> |
|
927 <h4>Code examples</h4> |
|
928 <dl class="option-examples-list"> |
|
929 |
|
930 <dt> |
|
931 Initialize a draggable with the <code>scroll</code> option specified. |
|
932 </dt> |
|
933 <dd> |
|
934 <pre><code>$( ".selector" ).draggable({ scroll: false });</code></pre> |
|
935 </dd> |
|
936 |
|
937 |
|
938 <dt> |
|
939 Get or set the <code>scroll</code> option, after init. |
|
940 </dt> |
|
941 <dd> |
|
942 <pre><code>//getter |
|
943 var scroll = $( ".selector" ).draggable( "option", "scroll" ); |
|
944 //setter |
|
945 $( ".selector" ).draggable( "option", "scroll", false );</code></pre> |
|
946 </dd> |
|
947 |
|
948 </dl> |
|
949 </div> |
|
950 </li> |
|
951 |
|
952 |
|
953 <li class="option" id="option-scrollSensitivity"> |
|
954 <div class="option-header"> |
|
955 <h3 class="option-name"><a href="#option-scrollSensitivity">scrollSensitivity</a></h3> |
|
956 <dl> |
|
957 <dt class="option-type-label">Type:</dt> |
|
958 <dd class="option-type">Integer</dd> |
|
959 |
|
960 <dt class="option-default-label">Default:</dt> |
|
961 <dd class="option-default">20</dd> |
|
962 |
|
963 </dl> |
|
964 </div> |
|
965 <div class="option-description"> |
|
966 <p>Distance in pixels from the edge of the viewport after which the viewport should scroll. Distance is relative to pointer, not the draggable.</p> |
|
967 </div> |
|
968 <div class="option-examples"> |
|
969 <h4>Code examples</h4> |
|
970 <dl class="option-examples-list"> |
|
971 |
|
972 <dt> |
|
973 Initialize a draggable with the <code>scrollSensitivity</code> option specified. |
|
974 </dt> |
|
975 <dd> |
|
976 <pre><code>$( ".selector" ).draggable({ scrollSensitivity: 40 });</code></pre> |
|
977 </dd> |
|
978 |
|
979 |
|
980 <dt> |
|
981 Get or set the <code>scrollSensitivity</code> option, after init. |
|
982 </dt> |
|
983 <dd> |
|
984 <pre><code>//getter |
|
985 var scrollSensitivity = $( ".selector" ).draggable( "option", "scrollSensitivity" ); |
|
986 //setter |
|
987 $( ".selector" ).draggable( "option", "scrollSensitivity", 40 );</code></pre> |
|
988 </dd> |
|
989 |
|
990 </dl> |
|
991 </div> |
|
992 </li> |
|
993 |
|
994 |
|
995 <li class="option" id="option-scrollSpeed"> |
|
996 <div class="option-header"> |
|
997 <h3 class="option-name"><a href="#option-scrollSpeed">scrollSpeed</a></h3> |
|
998 <dl> |
|
999 <dt class="option-type-label">Type:</dt> |
|
1000 <dd class="option-type">Integer</dd> |
|
1001 |
|
1002 <dt class="option-default-label">Default:</dt> |
|
1003 <dd class="option-default">20</dd> |
|
1004 |
|
1005 </dl> |
|
1006 </div> |
|
1007 <div class="option-description"> |
|
1008 <p>The speed at which the window should scroll once the mouse pointer gets within the <code>scrollSensitivity</code> distance.</p> |
|
1009 </div> |
|
1010 <div class="option-examples"> |
|
1011 <h4>Code examples</h4> |
|
1012 <dl class="option-examples-list"> |
|
1013 |
|
1014 <dt> |
|
1015 Initialize a draggable with the <code>scrollSpeed</code> option specified. |
|
1016 </dt> |
|
1017 <dd> |
|
1018 <pre><code>$( ".selector" ).draggable({ scrollSpeed: 40 });</code></pre> |
|
1019 </dd> |
|
1020 |
|
1021 |
|
1022 <dt> |
|
1023 Get or set the <code>scrollSpeed</code> option, after init. |
|
1024 </dt> |
|
1025 <dd> |
|
1026 <pre><code>//getter |
|
1027 var scrollSpeed = $( ".selector" ).draggable( "option", "scrollSpeed" ); |
|
1028 //setter |
|
1029 $( ".selector" ).draggable( "option", "scrollSpeed", 40 );</code></pre> |
|
1030 </dd> |
|
1031 |
|
1032 </dl> |
|
1033 </div> |
|
1034 </li> |
|
1035 |
|
1036 |
|
1037 <li class="option" id="option-snap"> |
|
1038 <div class="option-header"> |
|
1039 <h3 class="option-name"><a href="#option-snap">snap</a></h3> |
|
1040 <dl> |
|
1041 <dt class="option-type-label">Type:</dt> |
|
1042 <dd class="option-type">Boolean, Selector</dd> |
|
1043 |
|
1044 <dt class="option-default-label">Default:</dt> |
|
1045 <dd class="option-default">false</dd> |
|
1046 |
|
1047 </dl> |
|
1048 </div> |
|
1049 <div class="option-description"> |
|
1050 <p>If set to a selector or to true (equivalent to '.ui-draggable'), the draggable will snap to the edges of the selected elements when near an edge of the element.</p> |
|
1051 </div> |
|
1052 <div class="option-examples"> |
|
1053 <h4>Code examples</h4> |
|
1054 <dl class="option-examples-list"> |
|
1055 |
|
1056 <dt> |
|
1057 Initialize a draggable with the <code>snap</code> option specified. |
|
1058 </dt> |
|
1059 <dd> |
|
1060 <pre><code>$( ".selector" ).draggable({ snap: true });</code></pre> |
|
1061 </dd> |
|
1062 |
|
1063 |
|
1064 <dt> |
|
1065 Get or set the <code>snap</code> option, after init. |
|
1066 </dt> |
|
1067 <dd> |
|
1068 <pre><code>//getter |
|
1069 var snap = $( ".selector" ).draggable( "option", "snap" ); |
|
1070 //setter |
|
1071 $( ".selector" ).draggable( "option", "snap", true );</code></pre> |
|
1072 </dd> |
|
1073 |
|
1074 </dl> |
|
1075 </div> |
|
1076 </li> |
|
1077 |
|
1078 |
|
1079 <li class="option" id="option-snapMode"> |
|
1080 <div class="option-header"> |
|
1081 <h3 class="option-name"><a href="#option-snapMode">snapMode</a></h3> |
|
1082 <dl> |
|
1083 <dt class="option-type-label">Type:</dt> |
|
1084 <dd class="option-type">String</dd> |
|
1085 |
|
1086 <dt class="option-default-label">Default:</dt> |
|
1087 <dd class="option-default">'both'</dd> |
|
1088 |
|
1089 </dl> |
|
1090 </div> |
|
1091 <div class="option-description"> |
|
1092 <p>Determines which edges of snap elements the draggable will snap to. Ignored if snap is false. Possible values: 'inner', 'outer', 'both'</p> |
|
1093 </div> |
|
1094 <div class="option-examples"> |
|
1095 <h4>Code examples</h4> |
|
1096 <dl class="option-examples-list"> |
|
1097 |
|
1098 <dt> |
|
1099 Initialize a draggable with the <code>snapMode</code> option specified. |
|
1100 </dt> |
|
1101 <dd> |
|
1102 <pre><code>$( ".selector" ).draggable({ snapMode: 'outer' });</code></pre> |
|
1103 </dd> |
|
1104 |
|
1105 |
|
1106 <dt> |
|
1107 Get or set the <code>snapMode</code> option, after init. |
|
1108 </dt> |
|
1109 <dd> |
|
1110 <pre><code>//getter |
|
1111 var snapMode = $( ".selector" ).draggable( "option", "snapMode" ); |
|
1112 //setter |
|
1113 $( ".selector" ).draggable( "option", "snapMode", 'outer' );</code></pre> |
|
1114 </dd> |
|
1115 |
|
1116 </dl> |
|
1117 </div> |
|
1118 </li> |
|
1119 |
|
1120 |
|
1121 <li class="option" id="option-snapTolerance"> |
|
1122 <div class="option-header"> |
|
1123 <h3 class="option-name"><a href="#option-snapTolerance">snapTolerance</a></h3> |
|
1124 <dl> |
|
1125 <dt class="option-type-label">Type:</dt> |
|
1126 <dd class="option-type">Integer</dd> |
|
1127 |
|
1128 <dt class="option-default-label">Default:</dt> |
|
1129 <dd class="option-default">20</dd> |
|
1130 |
|
1131 </dl> |
|
1132 </div> |
|
1133 <div class="option-description"> |
|
1134 <p>The distance in pixels from the snap element edges at which snapping should occur. Ignored if snap is false.</p> |
|
1135 </div> |
|
1136 <div class="option-examples"> |
|
1137 <h4>Code examples</h4> |
|
1138 <dl class="option-examples-list"> |
|
1139 |
|
1140 <dt> |
|
1141 Initialize a draggable with the <code>snapTolerance</code> option specified. |
|
1142 </dt> |
|
1143 <dd> |
|
1144 <pre><code>$( ".selector" ).draggable({ snapTolerance: 40 });</code></pre> |
|
1145 </dd> |
|
1146 |
|
1147 |
|
1148 <dt> |
|
1149 Get or set the <code>snapTolerance</code> option, after init. |
|
1150 </dt> |
|
1151 <dd> |
|
1152 <pre><code>//getter |
|
1153 var snapTolerance = $( ".selector" ).draggable( "option", "snapTolerance" ); |
|
1154 //setter |
|
1155 $( ".selector" ).draggable( "option", "snapTolerance", 40 );</code></pre> |
|
1156 </dd> |
|
1157 |
|
1158 </dl> |
|
1159 </div> |
|
1160 </li> |
|
1161 |
|
1162 |
|
1163 <li class="option" id="option-stack"> |
|
1164 <div class="option-header"> |
|
1165 <h3 class="option-name"><a href="#option-stack">stack</a></h3> |
|
1166 <dl> |
|
1167 <dt class="option-type-label">Type:</dt> |
|
1168 <dd class="option-type">Selector</dd> |
|
1169 |
|
1170 <dt class="option-default-label">Default:</dt> |
|
1171 <dd class="option-default">false</dd> |
|
1172 |
|
1173 </dl> |
|
1174 </div> |
|
1175 <div class="option-description"> |
|
1176 <p>Controls the z-Index of the set of elements that match the selector, always brings to front the dragged item. Very useful in things like window managers.</p> |
|
1177 </div> |
|
1178 <div class="option-examples"> |
|
1179 <h4>Code examples</h4> |
|
1180 <dl class="option-examples-list"> |
|
1181 |
|
1182 <dt> |
|
1183 Initialize a draggable with the <code>stack</code> option specified. |
|
1184 </dt> |
|
1185 <dd> |
|
1186 <pre><code>$( ".selector" ).draggable({ stack: ".products" });</code></pre> |
|
1187 </dd> |
|
1188 |
|
1189 |
|
1190 <dt> |
|
1191 Get or set the <code>stack</code> option, after init. |
|
1192 </dt> |
|
1193 <dd> |
|
1194 <pre><code>//getter |
|
1195 var stack = $( ".selector" ).draggable( "option", "stack" ); |
|
1196 //setter |
|
1197 $( ".selector" ).draggable( "option", "stack", ".products" );</code></pre> |
|
1198 </dd> |
|
1199 |
|
1200 </dl> |
|
1201 </div> |
|
1202 </li> |
|
1203 |
|
1204 |
|
1205 <li class="option" id="option-zIndex"> |
|
1206 <div class="option-header"> |
|
1207 <h3 class="option-name"><a href="#option-zIndex">zIndex</a></h3> |
|
1208 <dl> |
|
1209 <dt class="option-type-label">Type:</dt> |
|
1210 <dd class="option-type">Integer</dd> |
|
1211 |
|
1212 <dt class="option-default-label">Default:</dt> |
|
1213 <dd class="option-default">false</dd> |
|
1214 |
|
1215 </dl> |
|
1216 </div> |
|
1217 <div class="option-description"> |
|
1218 <p>z-index for the helper while being dragged.</p> |
|
1219 </div> |
|
1220 <div class="option-examples"> |
|
1221 <h4>Code examples</h4> |
|
1222 <dl class="option-examples-list"> |
|
1223 |
|
1224 <dt> |
|
1225 Initialize a draggable with the <code>zIndex</code> option specified. |
|
1226 </dt> |
|
1227 <dd> |
|
1228 <pre><code>$( ".selector" ).draggable({ zIndex: 2700 });</code></pre> |
|
1229 </dd> |
|
1230 |
|
1231 |
|
1232 <dt> |
|
1233 Get or set the <code>zIndex</code> option, after init. |
|
1234 </dt> |
|
1235 <dd> |
|
1236 <pre><code>//getter |
|
1237 var zIndex = $( ".selector" ).draggable( "option", "zIndex" ); |
|
1238 //setter |
|
1239 $( ".selector" ).draggable( "option", "zIndex", 2700 );</code></pre> |
|
1240 </dd> |
|
1241 |
|
1242 </dl> |
|
1243 </div> |
|
1244 </li> |
|
1245 |
|
1246 </ul> |
|
1247 </div> |
|
1248 <div id="events"> |
|
1249 <h2 class="top-header">Events</h2> |
|
1250 <ul class="events-list"> |
|
1251 |
|
1252 <li class="event" id="event-start"> |
|
1253 <div class="event-header"> |
|
1254 <h3 class="event-name"><a href="#event-start">start</a></h3> |
|
1255 <dl> |
|
1256 <dt class="event-type-label">Type:</dt> |
|
1257 <dd class="event-type">dragstart</dd> |
|
1258 </dl> |
|
1259 </div> |
|
1260 <div class="event-description"> |
|
1261 <p>This event is triggered when dragging starts.</p> |
|
1262 </div> |
|
1263 <div class="event-examples"> |
|
1264 <h4>Code examples</h4> |
|
1265 <dl class="event-examples-list"> |
|
1266 |
|
1267 <dt> |
|
1268 Supply a callback function to handle the <code>start</code> event as an init option. |
|
1269 </dt> |
|
1270 <dd> |
|
1271 <pre><code>$( ".selector" ).draggable({ |
|
1272 start: function(event, ui) { ... } |
|
1273 });</code></pre> |
|
1274 </dd> |
|
1275 |
|
1276 |
|
1277 <dt> |
|
1278 Bind to the <code>start</code> event by type: <code>dragstart</code>. |
|
1279 </dt> |
|
1280 <dd> |
|
1281 <pre><code>$( ".selector" ).bind( "dragstart", function(event, ui) { |
|
1282 ... |
|
1283 });</code></pre> |
|
1284 </dd> |
|
1285 |
|
1286 </dl> |
|
1287 </div> |
|
1288 </li> |
|
1289 |
|
1290 |
|
1291 <li class="event" id="event-drag"> |
|
1292 <div class="event-header"> |
|
1293 <h3 class="event-name"><a href="#event-drag">drag</a></h3> |
|
1294 <dl> |
|
1295 <dt class="event-type-label">Type:</dt> |
|
1296 <dd class="event-type">drag</dd> |
|
1297 </dl> |
|
1298 </div> |
|
1299 <div class="event-description"> |
|
1300 <p>This event is triggered when the mouse is moved during the dragging.</p> |
|
1301 </div> |
|
1302 <div class="event-examples"> |
|
1303 <h4>Code examples</h4> |
|
1304 <dl class="event-examples-list"> |
|
1305 |
|
1306 <dt> |
|
1307 Supply a callback function to handle the <code>drag</code> event as an init option. |
|
1308 </dt> |
|
1309 <dd> |
|
1310 <pre><code>$( ".selector" ).draggable({ |
|
1311 drag: function(event, ui) { ... } |
|
1312 });</code></pre> |
|
1313 </dd> |
|
1314 |
|
1315 |
|
1316 <dt> |
|
1317 Bind to the <code>drag</code> event by type: <code>drag</code>. |
|
1318 </dt> |
|
1319 <dd> |
|
1320 <pre><code>$( ".selector" ).bind( "drag", function(event, ui) { |
|
1321 ... |
|
1322 });</code></pre> |
|
1323 </dd> |
|
1324 |
|
1325 </dl> |
|
1326 </div> |
|
1327 </li> |
|
1328 |
|
1329 |
|
1330 <li class="event" id="event-stop"> |
|
1331 <div class="event-header"> |
|
1332 <h3 class="event-name"><a href="#event-stop">stop</a></h3> |
|
1333 <dl> |
|
1334 <dt class="event-type-label">Type:</dt> |
|
1335 <dd class="event-type">dragstop</dd> |
|
1336 </dl> |
|
1337 </div> |
|
1338 <div class="event-description"> |
|
1339 <p>This event is triggered when dragging stops.</p> |
|
1340 </div> |
|
1341 <div class="event-examples"> |
|
1342 <h4>Code examples</h4> |
|
1343 <dl class="event-examples-list"> |
|
1344 |
|
1345 <dt> |
|
1346 Supply a callback function to handle the <code>stop</code> event as an init option. |
|
1347 </dt> |
|
1348 <dd> |
|
1349 <pre><code>$( ".selector" ).draggable({ |
|
1350 stop: function(event, ui) { ... } |
|
1351 });</code></pre> |
|
1352 </dd> |
|
1353 |
|
1354 |
|
1355 <dt> |
|
1356 Bind to the <code>stop</code> event by type: <code>dragstop</code>. |
|
1357 </dt> |
|
1358 <dd> |
|
1359 <pre><code>$( ".selector" ).bind( "dragstop", function(event, ui) { |
|
1360 ... |
|
1361 });</code></pre> |
|
1362 </dd> |
|
1363 |
|
1364 </dl> |
|
1365 </div> |
|
1366 </li> |
|
1367 |
|
1368 </ul> |
|
1369 </div> |
|
1370 <div id="methods"> |
|
1371 <h2 class="top-header">Methods</h2> |
|
1372 <ul class="methods-list"> |
|
1373 |
|
1374 <li class="method" id="method-destroy"> |
|
1375 <div class="method-header"> |
|
1376 <h3 class="method-name"><a href="#method-destroy">destroy</a></h3> |
|
1377 <dl> |
|
1378 <dt class="method-signature-label">Signature:</dt> |
|
1379 <dd class="method-signature">.draggable( "destroy" |
|
1380 |
|
1381 |
|
1382 |
|
1383 |
|
1384 |
|
1385 |
|
1386 |
|
1387 )</dd> |
|
1388 </dl> |
|
1389 </div> |
|
1390 <div class="method-description"> |
|
1391 <p>Remove the draggable functionality completely. This will return the element back to its pre-init state.</p> |
|
1392 </div> |
|
1393 </li> |
|
1394 |
|
1395 |
|
1396 <li class="method" id="method-disable"> |
|
1397 <div class="method-header"> |
|
1398 <h3 class="method-name"><a href="#method-disable">disable</a></h3> |
|
1399 <dl> |
|
1400 <dt class="method-signature-label">Signature:</dt> |
|
1401 <dd class="method-signature">.draggable( "disable" |
|
1402 |
|
1403 |
|
1404 |
|
1405 |
|
1406 |
|
1407 |
|
1408 |
|
1409 )</dd> |
|
1410 </dl> |
|
1411 </div> |
|
1412 <div class="method-description"> |
|
1413 <p>Disable the draggable.</p> |
|
1414 </div> |
|
1415 </li> |
|
1416 |
|
1417 |
|
1418 <li class="method" id="method-enable"> |
|
1419 <div class="method-header"> |
|
1420 <h3 class="method-name"><a href="#method-enable">enable</a></h3> |
|
1421 <dl> |
|
1422 <dt class="method-signature-label">Signature:</dt> |
|
1423 <dd class="method-signature">.draggable( "enable" |
|
1424 |
|
1425 |
|
1426 |
|
1427 |
|
1428 |
|
1429 |
|
1430 |
|
1431 )</dd> |
|
1432 </dl> |
|
1433 </div> |
|
1434 <div class="method-description"> |
|
1435 <p>Enable the draggable.</p> |
|
1436 </div> |
|
1437 </li> |
|
1438 |
|
1439 |
|
1440 <li class="method" id="method-option"> |
|
1441 <div class="method-header"> |
|
1442 <h3 class="method-name"><a href="#method-option">option</a></h3> |
|
1443 <dl> |
|
1444 <dt class="method-signature-label">Signature:</dt> |
|
1445 <dd class="method-signature">.draggable( "option" |
|
1446 |
|
1447 , optionName |
|
1448 |
|
1449 , <span class="optional">[</span>value<span class="optional">] </span> |
|
1450 |
|
1451 |
|
1452 |
|
1453 )</dd> |
|
1454 </dl> |
|
1455 </div> |
|
1456 <div class="method-description"> |
|
1457 <p>Get or set any draggable option. If no value is specified, will act as a getter.</p> |
|
1458 </div> |
|
1459 </li> |
|
1460 |
|
1461 |
|
1462 <li class="method" id="method-option"> |
|
1463 <div class="method-header"> |
|
1464 <h3 class="method-name"><a href="#method-option">option</a></h3> |
|
1465 <dl> |
|
1466 <dt class="method-signature-label">Signature:</dt> |
|
1467 <dd class="method-signature">.draggable( "option" |
|
1468 |
|
1469 , options |
|
1470 |
|
1471 |
|
1472 |
|
1473 |
|
1474 |
|
1475 )</dd> |
|
1476 </dl> |
|
1477 </div> |
|
1478 <div class="method-description"> |
|
1479 <p>Set multiple draggable options at once by providing an options object.</p> |
|
1480 </div> |
|
1481 </li> |
|
1482 |
|
1483 |
|
1484 <li class="method" id="method-widget"> |
|
1485 <div class="method-header"> |
|
1486 <h3 class="method-name"><a href="#method-widget">widget</a></h3> |
|
1487 <dl> |
|
1488 <dt class="method-signature-label">Signature:</dt> |
|
1489 <dd class="method-signature">.draggable( "widget" |
|
1490 |
|
1491 |
|
1492 |
|
1493 |
|
1494 |
|
1495 |
|
1496 |
|
1497 )</dd> |
|
1498 </dl> |
|
1499 </div> |
|
1500 <div class="method-description"> |
|
1501 <p>Returns the .ui-draggable element.</p> |
|
1502 </div> |
|
1503 </li> |
|
1504 |
|
1505 |
|
1506 </ul> |
|
1507 </div> |
|
1508 <div id="theming"> |
|
1509 <h2 class="top-header">Theming</h2> |
|
1510 <p>The jQuery UI Draggable plugin uses the jQuery UI CSS Framework to style its look and feel, including colors and background textures. We recommend using the ThemeRoller tool to create and download custom themes that are easy to build and maintain. |
|
1511 </p> |
|
1512 <p>If a deeper level of customization is needed, there are widget-specific classes referenced within the jquery.ui.draggable.css stylesheet that can be modified. These classes are highlighed in bold below. |
|
1513 </p> |
|
1514 |
|
1515 <h3>Sample markup with jQuery UI CSS Framework classes</h3> |
|
1516 <div class="<strong>ui-draggable</strong>"></div> |
|
1517 <p class="theme-note"> |
|
1518 <strong> |
|
1519 Note: This is a sample of markup generated by the draggable plugin, not markup you should use to create a draggable. The only markup needed for that is <div></div>. |
|
1520 </strong> |
|
1521 </p> |
|
1522 |
|
1523 </div> |
|
1524 </div> |
|
1525 |
|
1526 </p><!-- |
|
1527 Pre-expand include size: 59871 bytes |
|
1528 Post-expand include size: 104557 bytes |
|
1529 Template argument size: 57856 bytes |
|
1530 Maximum: 2097152 bytes |
|
1531 --> |
|
1532 |
|
1533 <!-- Saved in parser cache with key jqdocs_docs:pcache:idhash:3768-1!1!0!!en!2 and timestamp 20100421175825 --> |
|