Mercurial > hg > MPIWGThesaurus
comparison jquery-ui/development-bundle/demos/droppable/propagation.html @ 0:b2e4605f20b2
beta version
author | dwinter |
---|---|
date | Thu, 30 Jun 2011 09:07:49 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:b2e4605f20b2 |
---|---|
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.5.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 class="demo"> | |
52 | |
53 <div id="draggable" class="ui-widget-content"> | |
54 <p>Drag me to my target</p> | |
55 </div> | |
56 | |
57 <div id="droppable" class="ui-widget-header"> | |
58 <p>Outer droppable</p> | |
59 <div id="droppable-inner" class="ui-widget-header"> | |
60 <p>Inner droppable (not greedy)</p> | |
61 </div> | |
62 </div> | |
63 | |
64 <div id="droppable2" class="ui-widget-header"> | |
65 <p>Outer droppable</p> | |
66 <div id="droppable2-inner" class="ui-widget-header"> | |
67 <p>Inner droppable (greedy)</p> | |
68 </div> | |
69 </div> | |
70 | |
71 </div><!-- End demo --> | |
72 | |
73 | |
74 | |
75 <div class="demo-description"> | |
76 <p>When working with nested droppables — for example, you may have an editable directory structure displayed as a tree, with folder and document nodes — the <code>greedy</code> option set to true prevents event propagation when a draggable is dropped on a child node (droppable).</p> | |
77 </div><!-- End demo-description --> | |
78 | |
79 </body> | |
80 </html> |