CSS - Change text color depending on background

前端 未结 2 1608
忘掉有多难
忘掉有多难 2020-12-07 04:31

I have a simple layout consisting of three full height divs and a fixed header bar.

2条回答
  •  孤街浪徒
    2020-12-07 05:09

    You can do it with jquery, when something happens, do:

    $('yourdiv1').css({"color": "black"})
    $('yourdiv2').css({"background-color": "white"})
    

    To set it to default just:

    $('yourdiv1').css({"color": ""})
    $('yourdiv2').css({"background-color": ""})
    

    Also add transitions to make it look really nice.

提交回复
热议问题