Debian Codegraph @

demos/droppable/accepted-elements.html

raw
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 - Accept</title>
7 <link rel="stylesheet" href="../../themes/base/all.css">
8 <link rel="stylesheet" href="../demos.css">
9 <style>
10 #droppable { width: 150px; height: 150px; padding: 0.5em; float: left; margin: 10px; }
11 #draggable, #draggable-nonvalid { width: 100px; height: 100px; padding: 0.5em; float: left; margin: 10px 10px 10px 0; }
12 </style>
13 <script src="../../external/requirejs/require.js"></script>
14 <script src="../bootstrap.js">
15 $( "#draggable, #draggable-nonvalid" ).draggable();
16 $( "#droppable" ).droppable({
17 accept: "#draggable",
18 classes: {
19 "ui-droppable-active": "ui-state-active",
20 "ui-droppable-hover": "ui-state-hover"
21 },
22 drop: function( event, ui ) {
23 $( this )
24 .addClass( "ui-state-highlight" )
25 .find( "p" )
26 .html( "Dropped!" );
27 }
28 });
29 </script>
30 </head>
31 <body>
32
33 <div id="draggable-nonvalid" class="ui-widget-content">
34 <p>I'm draggable but can't be dropped</p>
35 </div>
36
37 <div id="draggable" class="ui-widget-content">
38 <p>Drag me to my target</p>
39 </div>
40
41 <div id="droppable" class="ui-widget-header">
42 <p>accept: '#draggable'</p>
43 </div>
44
45 <div class="demo-description">
46 <p>Specify using the <code>accept</code> option which element (or group of elements) is accepted by the target droppable.</p>
47 </div>
48 </body>
49 </html>