| 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 Droppable - Visual feedback</title> |
| 7 | <link rel="stylesheet" href="../../themes/base/all.css"> |
| 8 | <link rel="stylesheet" href="../demos.css"> |
| 9 | <style> |
| 10 | #draggable, #draggable2 { width: 90px; height: 90px; padding: 0.5em; float: left; margin: 10px 10px 10px 0; } |
| 11 | #droppable, #droppable2 { width: 120px; height: 120px; padding: 0.5em; float: left; margin: 10px; } |
| 12 | h3 { clear: left; } |
| 13 | </style> |
| 14 | <script src="../../external/requirejs/require.js"></script> |
| 15 | <script src="../bootstrap.js"> |
| 16 | $( "#draggable" ).draggable(); |
| 17 | $( "#droppable" ).droppable({ |
| 18 | classes: { |
| 19 | "ui-droppable-hover": "ui-state-hover" |
| 20 | }, |
| 21 | drop: function( event, ui ) { |
| 22 | $( this ) |
| 23 | .addClass( "ui-state-highlight" ) |
| 24 | .find( "p" ) |
| 25 | .html( "Dropped!" ); |
| 26 | } |
| 27 | }); |
| 28 | |
| 29 | $( "#draggable2" ).draggable(); |
| 30 | $( "#droppable2" ).droppable({ |
| 31 | accept: "#draggable2", |
| 32 | classes: { |
| 33 | "ui-droppable-active": "ui-state-default" |
| 34 | }, |
| 35 | drop: function( event, ui ) { |
| 36 | $( this ) |
| 37 | .addClass( "ui-state-highlight" ) |
| 38 | .find( "p" ) |
| 39 | .html( "Dropped!" ); |
| 40 | } |
| 41 | }); |
| 42 | </script> |
| 43 | </head> |
| 44 | <body> |
| 45 | |
| 46 | <h3>Feedback on hover:</h3> |
| 47 | |
| 48 | <div id="draggable" class="ui-widget-content"> |
| 49 | <p>Drag me to my target</p> |
| 50 | </div> |
| 51 | |
| 52 | <div id="droppable" class="ui-widget-header"> |
| 53 | <p>Drop here</p> |
| 54 | </div> |
| 55 | |
| 56 | <h3>Feedback on activating draggable:</h3> |
| 57 | |
| 58 | <div id="draggable2" class="ui-widget-content"> |
| 59 | <p>Drag me to my target</p> |
| 60 | </div> |
| 61 | |
| 62 | <div id="droppable2" class="ui-widget-header"> |
| 63 | <p>Drop here</p> |
| 64 | </div> |
| 65 | |
| 66 | <div class="demo-description"> |
| 67 | <p>Change the droppable's appearance on hover, or when the droppable is active (an acceptable draggable is dropped on it). Set the values of the <code>ui-droppable-hover</code> or <code>ui-droppable-active</code> properties on the <code>classes</code> option to specify the respective classes.</p> |
| 68 | </div> |
| 69 | </body> |
| 70 | </html> |