Change navigation font color based on background

后端 未结 5 1684
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-22 19:12

My problem is this. I have a fixed left navigation bar and I have to change the list font color based on the background of the section under it. The code is like this fiddle. So

5条回答
  •  旧时难觅i
    2021-01-22 19:36

    Can't you just give it a neutral colour to the fixed div and make it wrap around its content rather than have to resort to client scripts to dynamically change the colour? I have sanitized a bit the fixed element to make it look a bit more appealing...padding, margins, etc.

    #left_side
    {
        position:fixed;
        left: 20px;
        top:10px;
        z-index:999;
        background-color:#eee;
        padding:10px;
    }
    

    JS Fiddler Example

提交回复
热议问题