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

前端 未结 2 451
没有蜡笔的小新
没有蜡笔的小新 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;
    }
    

提交回复
热议问题