5 <title>jQuery UI Draggable - Handles</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">
14 #draggable, #draggable2 { width: 100px; height: 100px; padding: 0.5em; float: left; margin: 0 10px 10px 0; }
15 #draggable p { cursor: move; }
19 $( "#draggable" ).draggable({ handle: "p" });
20 $( "#draggable2" ).draggable({ cancel: "p.ui-widget-header" });
21 $( "div, p" ).disableSelection();
27 <div id="draggable" class="ui-widget-content">
28 <p class="ui-widget-header">I can be dragged only by this handle</p>
31 <div id="draggable2" class="ui-widget-content">
32 <p>You can drag me around…</p>
33 <p class="ui-widget-header">…but you can't drag me by this handle.</p>
36 <div class="demo-description">
37 <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>
38 <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>