检查是否所有子元素都被隐藏 [英] Check if all children elements are hidden

查看:116
本文介绍了检查是否所有子元素都被隐藏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的脚本有点卡在这里:

I'm a bit stuck here with my script:

它是一个复选框,可过滤所有.notme图像并隐藏其列表项. 现在的问题是,我无法获得fadeToggle的有效回调函数. 它应该像这样:

Its a checkbox filtering all .notme images and hiding it's list items. The problem is now I cant get a working callback function for the fadeToggle. It should behave like this :

如果#list-team-single-container的所有子级都不显示",请执行某些操作.

If all children of #list-team-single-container are "displayed none" - do something.

$('#show-only-my-teams').change(function(){
    $('.notme').each(function(){
        $(this).parent().parent().fadeToggle('fast', function(){
        });
    });
}); 

推荐答案

if($('#list-team-single-container').children(':visible').length == 0) {
   // action when all are hidden
}

这篇关于检查是否所有子元素都被隐藏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆