简体   繁体   English

如何在滚动菜单中更改菜单和徽标颜色?

[英]How to make menu and logo color change in scrolling menu?

I have fixed menu, and when scroll down, header menu change color in white.我有固定菜单,向下滚动时,标题菜单将颜色更改为白色。 I have inserted this JQ:我已经插入了这个 JQ:

jQuery(document).scroll(function(){
if(jQuery(this).scrollTop() > 300)
{   
   jQuery('#navigation').css({"background":"white"});
} else {
   jQuery('#navigation').css({"background":"transparent"});
}
});

into my site , that i work on it.进入我的网站,我正在处理它。 But white color override all text and show only text when is close to it.但是白色会覆盖所有文本,并且仅在接近文本时显示文本。 So how to make logo in invert color, and text to be black in white background?那么如何使logo为反色,文字为白色背景为黑色呢? I have found this CSS:我找到了这个CSS:

 -webkit-filter: invert(.8);
  filter: invert(.8);

But dont know how to include in JQ.但不知道如何包含在 JQ 中。

You have to change the text color of your #navigation element.您必须更改 #navigation 元素的文本颜色。 You could do this like this:你可以这样做:

jQuery('#navigation').css({"color":"black"});

EDIT:编辑:
From what i can see on your website, i came up with this:从我在你的网站上看到的,我想出了这个:

jQuery(document).scroll(function() {
  if (jQuery(this).scrollTop() > 300) {   
    jQuery('#navigation').css({"background":"white"});
    jQuery('.menu-item').css({"color":"black"});
  } else {
    jQuery('#navigation').css({"background":"transparent"});
    jQuery('.menu-item').css({"color":"white"});
  }
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM