隐藏父母,如果父母缺少特定班级,则显示孩子

问题描述

在我的网站上,我有一个带有导航栏的全屏标题。两者都包含文本,图标等的组合,并显示在“主要内容”部分上方。我可以将类.p-X添加到#splash#nav(X =页码,例如页面1(URL .p-1)的INDEX/page/1和{{1 }}(第2页(URL .p-2),以便在第1页上同时显示INDEX/page/2#splash,但隐藏#nav并在第1页上仍显示#splash 2+页。最有效的方法是什么? CSS和jQuery解决方案还可以。我已经尝试了可见性答案here和JJJ的选择器here(不过可能误用了后者)。谢谢!

编辑:当前接受的答案不允许我保留#nav上的弯曲边缘(#nav的图像和#splash的顶部边缘之间有空白)。我可以删除它,但是我想知道是否有一种方法可以保存它。

#nav
#splash {
    width: 100%;
    height: 100vh;
    background:#e00;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.icon {
    width: 128px;
    height: 128px;
    background: #ddd;
    margin: auto 0 0.5rem 0;
}

#splash .info {
    max-width: 700px;
    margin: 0 auto auto auto;
    background: #ddd;
}

#nav {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    justify-content: space-evenly;
    width: 100%;
    height: 40px;
    background: #000;
    color: #fff;
    z-index: 5;
    border-radius: 30% 30% 0% 0%; /* curved top if #splash is shown; curved bottom if not */
}

#content {
    height: 100vh;
    overflow-x: hidden:
    overflow-y: auto;
    background: #ccc;
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)