回答編集履歴
2
saichousei
test
CHANGED
@@ -117,3 +117,107 @@
|
|
117
117
|
}
|
118
118
|
|
119
119
|
```
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
# 再調整
|
124
|
+
|
125
|
+
解決済み?
|
126
|
+
|
127
|
+
```javascript
|
128
|
+
|
129
|
+
<script>
|
130
|
+
|
131
|
+
$(function(){
|
132
|
+
|
133
|
+
$('button').click(function(){
|
134
|
+
|
135
|
+
var innerType=$(this).data('innertype');
|
136
|
+
|
137
|
+
var target=$('.inner').filter(function(){return $(this).data('innertype')==innerType;});
|
138
|
+
|
139
|
+
$.when($('.outer,.inner').fadeOut().queue(function(){
|
140
|
+
|
141
|
+
if($(this).filter(target).length>0){
|
142
|
+
|
143
|
+
cat(target);
|
144
|
+
|
145
|
+
dog(target);
|
146
|
+
|
147
|
+
}
|
148
|
+
|
149
|
+
$(this).dequeue();
|
150
|
+
|
151
|
+
})).done(function(){
|
152
|
+
|
153
|
+
$('.outer').has(target).fadeIn();
|
154
|
+
|
155
|
+
target.fadeIn().queue(function(){
|
156
|
+
|
157
|
+
ape(target);
|
158
|
+
|
159
|
+
$(this).dequeue();
|
160
|
+
|
161
|
+
});
|
162
|
+
|
163
|
+
});
|
164
|
+
|
165
|
+
});
|
166
|
+
|
167
|
+
});
|
168
|
+
|
169
|
+
function cat(target){
|
170
|
+
|
171
|
+
target.append('<p>cat</p>');
|
172
|
+
|
173
|
+
}
|
174
|
+
|
175
|
+
function dog(target){
|
176
|
+
|
177
|
+
target.append('<p>dog</p>');
|
178
|
+
|
179
|
+
}
|
180
|
+
|
181
|
+
function ape(target){
|
182
|
+
|
183
|
+
target.append('<p>ape</p>');
|
184
|
+
|
185
|
+
}
|
186
|
+
|
187
|
+
</script>
|
188
|
+
|
189
|
+
<div class="wrapeer">
|
190
|
+
|
191
|
+
dummy1
|
192
|
+
|
193
|
+
<div class="outer" data-outerType="1">
|
194
|
+
|
195
|
+
dummy2
|
196
|
+
|
197
|
+
<div class="inner" data-innerType="A">innerA</div>
|
198
|
+
|
199
|
+
<div class="inner" data-innerType="B">innerB</div>
|
200
|
+
|
201
|
+
</div>
|
202
|
+
|
203
|
+
<div class="outer" data-outerType="2">
|
204
|
+
|
205
|
+
dummy3
|
206
|
+
|
207
|
+
<div class="inner" data-innerType="C">innerC</div>
|
208
|
+
|
209
|
+
<div class="inner" data-innerType="D">innerD</div>
|
210
|
+
|
211
|
+
</div>
|
212
|
+
|
213
|
+
<button type="button" data-innerType="A" data-outerType="1">A</button>
|
214
|
+
|
215
|
+
<button type="button" data-innerType="B" data-outerType="1">B</button>
|
216
|
+
|
217
|
+
<button type="button" data-innerType="C" data-outerType="2">C</button>
|
218
|
+
|
219
|
+
<button type="button" data-innerType="D" data-outerType="2">D</button>
|
220
|
+
|
221
|
+
</div>
|
222
|
+
|
223
|
+
```
|
1
chousei
test
CHANGED
@@ -57,3 +57,63 @@
|
|
57
57
|
}
|
58
58
|
|
59
59
|
```
|
60
|
+
|
61
|
+
# 調整
|
62
|
+
|
63
|
+
````javascript
|
64
|
+
|
65
|
+
$(function(){
|
66
|
+
|
67
|
+
$('button').click(function(){
|
68
|
+
|
69
|
+
var innerType=$(this).data('innertype');
|
70
|
+
|
71
|
+
var target=$('.inner').filter(function(){return $(this).data('innertype')==innerType;});
|
72
|
+
|
73
|
+
$.when($('.inner').fadeOut().queue(function(){
|
74
|
+
|
75
|
+
if($(this).filter(target).length>0){
|
76
|
+
|
77
|
+
cat(target);
|
78
|
+
|
79
|
+
dog(target);
|
80
|
+
|
81
|
+
}
|
82
|
+
|
83
|
+
$(this).dequeue();
|
84
|
+
|
85
|
+
})).done(function(){
|
86
|
+
|
87
|
+
$('.inner').filter(target).fadeIn().queue(function(){
|
88
|
+
|
89
|
+
ape(target);
|
90
|
+
|
91
|
+
$(this).dequeue();
|
92
|
+
|
93
|
+
});
|
94
|
+
|
95
|
+
});
|
96
|
+
|
97
|
+
});
|
98
|
+
|
99
|
+
});
|
100
|
+
|
101
|
+
function cat(target){
|
102
|
+
|
103
|
+
target.append('<p>cat</p>');
|
104
|
+
|
105
|
+
}
|
106
|
+
|
107
|
+
function dog(target){
|
108
|
+
|
109
|
+
target.append('<p>dog</p>');
|
110
|
+
|
111
|
+
}
|
112
|
+
|
113
|
+
function ape(target){
|
114
|
+
|
115
|
+
target.append('<p>ape</p>');
|
116
|
+
|
117
|
+
}
|
118
|
+
|
119
|
+
```
|