[24421] | 1 | <!DOCTYPE html>
|
---|
| 2 | <html lang="en">
|
---|
| 3 | <head>
|
---|
| 4 | <meta charset="utf-8">
|
---|
| 5 | <title>jQuery UI Draggable - Handles</title>
|
---|
| 6 | <link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
|
---|
| 7 | <script src="../../jquery-1.6.2.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, #draggable2 { width: 100px; height: 100px; padding: 0.5em; float: left; margin: 0 10px 10px 0; }
|
---|
| 15 | #draggable p { cursor: move; }
|
---|
| 16 | </style>
|
---|
| 17 | <script>
|
---|
| 18 | $(function() {
|
---|
| 19 | $( "#draggable" ).draggable({ handle: "p" });
|
---|
| 20 | $( "#draggable2" ).draggable({ cancel: "p.ui-widget-header" });
|
---|
| 21 | $( "div, p" ).disableSelection();
|
---|
| 22 | });
|
---|
| 23 | </script>
|
---|
| 24 | </head>
|
---|
| 25 | <body>
|
---|
| 26 |
|
---|
| 27 | <div class="demo">
|
---|
| 28 |
|
---|
| 29 | <div id="draggable" class="ui-widget-content">
|
---|
| 30 | <p class="ui-widget-header">I can be dragged only by this handle</p>
|
---|
| 31 | </div>
|
---|
| 32 |
|
---|
| 33 | <div id="draggable2" class="ui-widget-content">
|
---|
| 34 | <p>You can drag me around…</p>
|
---|
| 35 | <p class="ui-widget-header">…but you can't drag me by this handle.</p>
|
---|
| 36 | </div>
|
---|
| 37 |
|
---|
| 38 | <!-- ADD CANCEL DEMO -->
|
---|
| 39 |
|
---|
| 40 | </div><!-- End demo -->
|
---|
| 41 |
|
---|
| 42 |
|
---|
| 43 |
|
---|
| 44 | <div class="demo-description">
|
---|
| 45 | <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>
|
---|
| 46 | <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>
|
---|
| 47 | </div><!-- End demo-description -->
|
---|
| 48 |
|
---|
| 49 | </body>
|
---|
| 50 | </html>
|
---|