回答編集履歴
1
ちょうせい
test
CHANGED
@@ -31,3 +31,75 @@
|
|
31
31
|
});
|
32
32
|
|
33
33
|
```
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
# 調整版
|
38
|
+
|
39
|
+
任意に選ぶ処理
|
40
|
+
|
41
|
+
```javascript
|
42
|
+
|
43
|
+
<script>
|
44
|
+
|
45
|
+
$(function(){
|
46
|
+
|
47
|
+
$('#upper').droppable();
|
48
|
+
|
49
|
+
$('.select').on('change',function(){
|
50
|
+
|
51
|
+
var target=$('td:has(.select:checked) ~ .name');
|
52
|
+
|
53
|
+
$(this).closest('td').find('~ .name').draggable().draggable($(this).is(':checked')?'enable':'disable');
|
54
|
+
|
55
|
+
target.draggable({
|
56
|
+
|
57
|
+
drag: function(e,ui){
|
58
|
+
|
59
|
+
target.each(function(){
|
60
|
+
|
61
|
+
$(this).css({
|
62
|
+
|
63
|
+
top: ui.position.top,
|
64
|
+
|
65
|
+
left: ui.position.left
|
66
|
+
|
67
|
+
});
|
68
|
+
|
69
|
+
}).draggable('enable');
|
70
|
+
|
71
|
+
},
|
72
|
+
|
73
|
+
});
|
74
|
+
|
75
|
+
}).trigger('change');
|
76
|
+
|
77
|
+
});
|
78
|
+
|
79
|
+
</script>
|
80
|
+
|
81
|
+
<div id="upper" style="width:300px;height:300px;"></div>
|
82
|
+
|
83
|
+
<div id="lower">
|
84
|
+
|
85
|
+
<table>
|
86
|
+
|
87
|
+
<thead><tr><td>name</td><td>memo</td></tr></thead>
|
88
|
+
|
89
|
+
<tbody>
|
90
|
+
|
91
|
+
<tr><td><input type="checkbox" class="select"></td><td class="name">AAA</td><td>あああ</td></tr>
|
92
|
+
|
93
|
+
<tr><td><input type="checkbox" class="select"></td><td class="name">BBB</td><td>いいい</td></tr>
|
94
|
+
|
95
|
+
<tr><td><input type="checkbox" class="select"></td><td class="name">CCC</td><td>ううう</td></tr>
|
96
|
+
|
97
|
+
<tr><td><input type="checkbox" class="select"></td><td class="name">DDD</td><td>えええ</td></tr>
|
98
|
+
|
99
|
+
</tbody>
|
100
|
+
|
101
|
+
</table>
|
102
|
+
|
103
|
+
</div>
|
104
|
+
|
105
|
+
```
|