瀏覽代碼

Clone when dragging from the palette

master
Chris Smith 12 年之前
父節點
當前提交
035aefc120
共有 1 個檔案被更改,包括 11 行新增1 行删除
  1. 11
    1
      index.html

+ 11
- 1
index.html 查看文件

@@ -15,7 +15,17 @@
15 15
        .appendTo($('#palette'));
16 16
     });
17 17
 
18
-    $('.tower,.core').draggable();
18
+    $('.tower,.core').draggable({
19
+     helper: 'clone',
20
+     containment: 'window',
21
+     stop: function(evt, ui) {
22
+      $(this).clone()
23
+        .draggable()
24
+        .css('position', 'absolute')
25
+        .offset(ui.helper.offset())
26
+        .appendTo(document.body);
27
+     }
28
+    });
19 29
    });
20 30
   </script>
21 31
   <style type="text/css">

Loading…
取消
儲存