| 1 | <!doctype html> |
| 2 | <html lang="en"> |
| 3 | <head> |
| 4 | <meta charset="utf-8"> |
| 5 | <meta name="viewport" content="width=device-width, initial-scale=1"> |
| 6 | <title>jQuery UI Draggable - Handles</title> |
| 7 | <link rel="stylesheet" href="../../themes/base/all.css"> |
| 8 | <link rel="stylesheet" href="../demos.css"> |
| 9 | <style> |
| 10 | #draggable, #draggable2 { width: 100px; height: 100px; padding: 0.5em; float: left; margin: 0 10px 10px 0; } |
| 11 | #draggable p { cursor: move; } |
| 12 | </style> |
| 13 | <script src="../../external/requirejs/require.js"></script> |
| 14 | <script src="../bootstrap.js" data-modules="disable-selection"> |
| 15 | $( "#draggable" ).draggable({ handle: "p" }); |
| 16 | $( "#draggable2" ).draggable({ cancel: "p.ui-widget-header" }); |
| 17 | $( "div, p" ).disableSelection(); |
| 18 | </script> |
| 19 | </head> |
| 20 | <body> |
| 21 | |
| 22 | <div id="draggable" class="ui-widget-content"> |
| 23 | <p class="ui-widget-header">I can be dragged only by this handle</p> |
| 24 | </div> |
| 25 | |
| 26 | <div id="draggable2" class="ui-widget-content"> |
| 27 | <p>You can drag me around…</p> |
| 28 | <p class="ui-widget-header">…but you can't drag me by this handle.</p> |
| 29 | </div> |
| 30 | |
| 31 | <div class="demo-description"> |
| 32 | <p>Allow dragging only when the cursor is over a specific part of the draggable. Use the <code>handle</code> option to specify the jQuery selector of an element (or group of elements) used to drag the object.</p> |
| 33 | <p>Or prevent dragging when the cursor is over a specific element (or group of elements) within the draggable. Use the <code>cancel</code> option to specify a jQuery selector over which to "cancel" draggable functionality.</p> |
| 34 | </div> |
| 35 | </body> |
| 36 | </html> |