]> source.dussan.org Git - jquery-ui.git/commitdiff
Added droppable visual test
authorRichard Worth <rdworth@gmail.com>
Mon, 9 Jun 2008 08:06:54 +0000 (08:06 +0000)
committerRichard Worth <rdworth@gmail.com>
Mon, 9 Jun 2008 08:06:54 +0000 (08:06 +0000)
tests/visual/all.css
tests/visual/all.html
tests/visual/droppable.html [new file with mode: 0644]

index 17fc5985bafc1c8ebd0dbae72756aca47cb64af7..4fb7bf5c449d9e113d553a86a9029017d798a4e3 100644 (file)
@@ -5,7 +5,7 @@ ul.plugins li { margin: 0 12px 12px 0;
        list-style-type: none; width: 210px; height: 220px; float: left;\r
        color: white; border: 1px solid gray; text-align: center; font-weight: bold; }\r
 \r
-#accordion, #draggable, #droppable,\r
+#accordion, #draggable,\r
 #resizable, #selectable, #sortable, #tabs {\r
        margin: 10px;\r
        width: 190px; height: 180px;\r
@@ -30,6 +30,10 @@ ul.plugins li { margin: 0 12px 12px 0;
        background: black;\r
 }\r
 \r
+.draggable { margin: 10px; width: 32px; height: 30px; float: left; background: #FF9C08; }\r
+#droppable { margin: 10px; width: 190px; height: 130px; float: left; border: 1px solid #FF9C08; overflow: hidden; }\r
+#droppable .draggable { margin: 7px; }\r
+\r
 .ui-dialog { background-color: #FF9C08; }\r
 .ui-dialog .ui-dialog-titlebar { background: black; padding: 0px; height: 28px;        _height: 29px; }\r
 .ui-dialog.ui-draggable .ui-dialog-titlebar { cursor: move; }\r
index 2340b1a01aa861919365b35c77e8a2d808f96740..e0b2fbafdeaa41404f924bbf2d423eecc3ad1e29 100644 (file)
                $("#datepicker").datepicker();\r
                $("#dialog").click(function() { $("<div/>").dialog(); });\r
                $("#draggable").draggable();\r
+               $(".draggable").draggable();\r
+               $("#droppable").droppable({\r
+                       accept: '.draggable',\r
+                       drop: function(ev, ui) {\r
+                               ui.draggable.css({ position: 'relative', top: 0, left: 0 }).clone().appendTo(this);\r
+                       }\r
+               });\r
                $("#resizable").resizable();\r
                $("#selectable").selectable();\r
                $("#slider").slider();\r
        Draggable\r
        <div id="draggable"></div>\r
 </li>\r
+<li>\r
+       Droppable\r
+       <div class="draggable">D</div>\r
+       <div class="draggable">R</div>\r
+       <div class="draggable">A</div>\r
+       <div class="draggable">G</div>\r
+       <div id="droppable">\r
+               DROP\r
+               <hr>\r
+       </div>\r
+</li>\r
 <li>\r
        Resizable\r
        <div id="resizable"></div>\r
diff --git a/tests/visual/droppable.html b/tests/visual/droppable.html
new file mode 100644 (file)
index 0000000..4bc5164
--- /dev/null
@@ -0,0 +1,39 @@
+<!DOCTYPE html>\r
+<html lang="en">\r
+<head>\r
+       <title>Simple Droppable</title>\r
+       <link rel="stylesheet" href="all.css" type="text/css" media="screen">\r
+       <script type="text/javascript" src="../../jquery-1.2.6.js"></script>\r
+       <script type="text/javascript" src="../../ui/ui.core.js"></script>\r
+       <script type="text/javascript" src="../../ui/ui.draggable.js"></script>\r
+       <script type="text/javascript" src="../../ui/ui.droppable.js"></script>\r
+       <script type="text/javascript">\r
+       $(function() {\r
+               $(".draggable").draggable();\r
+               $("#droppable").droppable({\r
+                       accept: '.draggable',\r
+                       drop: function(ev, ui) {\r
+                               ui.draggable.css({ position: 'relative', top: 0, left: 0 }).clone().appendTo(this);\r
+                       }\r
+               });\r
+       });\r
+       </script>\r
+</head>\r
+<body>\r
+\r
+<ul class="plugins">\r
+<li>\r
+       Droppable\r
+       <div class="draggable">D</div>\r
+       <div class="draggable">R</div>\r
+       <div class="draggable">A</div>\r
+       <div class="draggable">G</div>\r
+       <div id="droppable">\r
+               DROP\r
+               <hr>\r
+       </div>\r
+</li>\r
+</ul>\r
+\r
+</body>\r
+</html>\r