如何在滚动菜单中更改菜单和徽标颜色? [英] How to make menu and logo color change in scrolling menu?

查看:58
本文介绍了如何在滚动菜单中更改菜单和徽标颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有固定的菜单,当向下滚动时,标题菜单会改变白色。我插入了这个JQ:

I have fixed menu, and when scroll down, header menu change color in white. I have inserted this JQ:

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

进入我的网站,我正在努力。但是白色会覆盖所有文本,并且在接近它时仅显示文本。那么如何在反转颜色中制作徽标,在白色背景中将文字设为黑色?我找到了这个CSS:

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? I have found this CSS:

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

但不知道如何包含在JQ中。

But dont know how to include in JQ.

推荐答案

您必须更改#navigation元素的文本颜色。你可以这样做:

You have to change the text color of your #navigation element. You could do this like this:

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

编辑:


从我在你网站上看到的内容我想出了这个:


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"});
  }
});

这篇关于如何在滚动菜单中更改菜单和徽标颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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