Skip to content

Commit 4cddfa3

Browse files
committed
Update _taxonomy.html.erb
1 parent 08ee0ea commit 4cddfa3

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

app/views/names/_taxonomy.html.erb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,22 +166,26 @@
166166
`[data-type="name"][data-${feat}=0])`
167167
);
168168
if (btn.data("visible")) {
169+
children.each(function() { $(this).data("visible", false); };
169170
children.hide(400);
170-
children.data("visible", false);
171171
btn.data("visible", false);
172172
btn.find("span").html("Show");
173173
btn.find("i").removeClass("fa-eye-slash");
174174
btn.find("i").addClass("fa-eye");
175175
} else {
176+
children.each(function() { $(this).data("visible", true); };
176177
children.show(400);
177-
children.data("visible", true);
178178
btn.data("visible", true);
179179
btn.find("span").html("Hide");
180180
btn.find("i").removeClass("fa-eye");
181181
btn.find("i").addClass("fa-eye-slash");
182182
}
183183
var all = $(`ul#name-${name_id}-children li`).length;
184-
var visible = $(`ul#name-${name_id}-children li:visible`).length;
184+
var visible = $(
185+
// I cannot use the :visible selector because of the 400ms delay
186+
// in the animation
187+
`ul#name-${name_id}-children li[data-visible=true]`
188+
).length;
185189
var cnt = $(`#name-${name_id}-children-count`);
186190
cnt.html(all == visible ? `(${all})` : `(${visible}/${all})`);
187191
return false;

0 commit comments

Comments
 (0)