a11675585abeb4b896934edf4b48528c7044bdd6
[myslice.git] / third-party / jquery-ui-1.10.2 / demos / droppable / propagation.html
1 <!doctype html>
2 <html lang="en">
3 <head>
4         <meta charset="utf-8">
5         <title>jQuery UI Droppable - Prevent propagation</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         <script src="../../ui/jquery.ui.droppable.js"></script>
13         <link rel="stylesheet" href="../demos.css">
14         <style>
15         #draggable { width: 100px; height: 40px; padding: 0.5em; float: left; margin: 10px 10px 10px 0; }
16         #droppable, #droppable2 { width: 230px; height: 120px; padding: 0.5em; float: left; margin: 10px; }
17         #droppable-inner, #droppable2-inner { width: 170px; height: 60px; padding: 0.5em; float: left; margin: 10px; }
18         </style>
19         <script>
20         $(function() {
21                 $( "#draggable" ).draggable();
22
23                 $( "#droppable, #droppable-inner" ).droppable({
24                         activeClass: "ui-state-hover",
25                         hoverClass: "ui-state-active",
26                         drop: function( event, ui ) {
27                                 $( this )
28                                         .addClass( "ui-state-highlight" )
29                                         .find( "> p" )
30                                                 .html( "Dropped!" );
31                                 return false;
32                         }
33                 });
34
35                 $( "#droppable2, #droppable2-inner" ).droppable({
36                         greedy: true,
37                         activeClass: "ui-state-hover",
38                         hoverClass: "ui-state-active",
39                         drop: function( event, ui ) {
40                                 $( this )
41                                         .addClass( "ui-state-highlight" )
42                                         .find( "> p" )
43                                                 .html( "Dropped!" );
44                         }
45                 });
46         });
47         </script>
48 </head>
49 <body>
50
51 <div id="draggable" class="ui-widget-content">
52         <p>Drag me to my target</p>
53 </div>
54
55 <div id="droppable" class="ui-widget-header">
56         <p>Outer droppable</p>
57         <div id="droppable-inner" class="ui-widget-header">
58                 <p>Inner droppable (not greedy)</p>
59         </div>
60 </div>
61
62 <div id="droppable2" class="ui-widget-header">
63         <p>Outer droppable</p>
64         <div id="droppable2-inner" class="ui-widget-header">
65                 <p>Inner droppable (greedy)</p>
66         </div>
67 </div>
68
69 <div class="demo-description">
70 <p>When working with nested droppables &#8212; for example, you may have an editable directory structure displayed as a tree, with folder and document nodes &#8212; the <code>greedy</code> option set to true prevents event propagation when a draggable is dropped on a child node (droppable).</p>
71 </div>
72 </body>
73 </html>