How to build floating menu bar when scroll down

后端 未结 5 1270
感情败类
感情败类 2020-12-23 10:11

When I scrolled down site display black menu bar at the top look like float bar. but I think there\'s jquery involved with this. I have tried CSS but seems not working for m

5条回答
  •  Happy的楠姐
    2020-12-23 10:52

    In the URL that you provide, I see a menu bar fixed on the top of browser while you scroll down several lines of the page.

    So I separate your problem to 2 questions: First, how to make a fixed top menu which won't be disappear when scroll the page. Second, how to make a menu fixed on top after scrolling down few lines.

    For the first question, I change your css code.

    #menucontainer {
        float:top;
        position:fixed;
        top:0;
        height: 100px;
        width: 100%;
        background-color: eeee00; /* makes other content won't be seen when the page scrolling */
    }
    

    And I think the second question need to write js. Well I don't know yet.

提交回复
热议问题