如何在出现固定导航时隐藏图像

时间:2022-07-10 02:49:21

I am working on a site here: http://americanbitcoinacademy.com/

我在这里的网站上工作:http://americanbitcoinacademy.com/

When you scroll a bit on the site a fixed nav will appear but on this fixed navigation I want to hide the logo nav BUT I still want it to appear on the regular nav bar on the top.

当你在网站上滚动一点时,会出现一个固定的导航,但是在这个固定的导航上我想要隐藏徽标导航但我还是希望它出现在顶部的常规导航栏上。

如何在出现固定导航时隐藏图像

Here's the CSS I am using:

这是我使用的CSS:

.nav>li>a>img {
    max-width: none;
}
.menu-item a img {
    border: none;
    box-shadow: none;
    vertical-align: middle;
    width: auto;
    display: inline;
}

I want it to hide on a black fixed nav but I still want it to appear on the regular nav. ANy idea how to do so?

我希望它隐藏在黑色固定导航上,但我仍然希望它出现在常规导航上。不知道怎么做?

You can use the inspector of Chrome to check this out.

您可以使用Chrome的检查器进行检查。

2 个解决方案

#1


2  

The nav menu has class .affix when it is fixed/black, so using that as the parent selector to hide the image should hide it in the fixed state without affecting the menu's default state.

导航菜单在固定/黑色时具有类.affix,因此使用它作为隐藏图像的父选择器应该将其隐藏在固定状态而不影响菜单的默认状态。

.main-menu.affix .menu-image {
  display: none;
}

#2


0  

Can't use chrome as I am on iPad, as the navy bar looks different at the top and when it's further down the page, I'm guessing that at some point you apply a different class to the nav div?

不能像我在iPad上那样使用chrome,因为海军栏在顶部看起来不同,当它在页面的下方时,我猜想在某些时候你会在导航div中使用不同的类?

You can target the img within that class with the style display: none;

您可以使用样式display:none;来定位该类中的img。

Hope this helps, if not I'm sure some one on a computer can give more of an example

希望这有帮助,如果不是我肯定计算机上的某个人可以提供更多的例子

#1


2  

The nav menu has class .affix when it is fixed/black, so using that as the parent selector to hide the image should hide it in the fixed state without affecting the menu's default state.

导航菜单在固定/黑色时具有类.affix,因此使用它作为隐藏图像的父选择器应该将其隐藏在固定状态而不影响菜单的默认状态。

.main-menu.affix .menu-image {
  display: none;
}

#2


0  

Can't use chrome as I am on iPad, as the navy bar looks different at the top and when it's further down the page, I'm guessing that at some point you apply a different class to the nav div?

不能像我在iPad上那样使用chrome,因为海军栏在顶部看起来不同,当它在页面的下方时,我猜想在某些时候你会在导航div中使用不同的类?

You can target the img within that class with the style display: none;

您可以使用样式display:none;来定位该类中的img。

Hope this helps, if not I'm sure some one on a computer can give more of an example

希望这有帮助,如果不是我肯定计算机上的某个人可以提供更多的例子