color change of navigation buttons when scrolling up and when scrolling down

前端 未结 2 450
没有蜡笔的小新
没有蜡笔的小新 2021-01-28 15:37

I am using headroom.js to hide my header when scrolling down and make my header section visible again when scrolling up. The header section contains my logo and navigation butto

相关标签:
2条回答
  • 2021-01-28 16:27

    I found a solution for this "issue" using CSS! headroom.js uses two classes to detect when the header is at top the page and when it's scrolling (not a the top), so I provided the following CSS.

    header.headroom--not-top ul li a{
        color: red;
    }
    
    header.headroom--top ul li a{
        color: white;
    }
    
    0 讨论(0)
  • 2021-01-28 16:28

    In my case (using nav class from bootstrap):

    nav.headroom--not-top  { color: red; background-color: lightgrey; opacity: .8 }
    nav.headroom--top  { color: white }
    

    It work, but the ideal situation would be that the color was a complementary color from the background color when the nabber descend.. Isn't?. Maybe in jQuery...

    0 讨论(0)
提交回复
热议问题