JQuery change hue, saturation, gamma of ?

前端 未结 6 1325
日久生厌
日久生厌 2021-02-04 14:58

I want to make an image darker if you hover your mouse over it. Is it possible to change the hue, saturation or gamma of an img with JQuery (or Javascript)?

6条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-04 15:39

    You can do this in CSS

    IMG:hover
    {
        -ilter: brightness(0.7);
        -webkit-filter: brightness(0.7);
        -moz-filter: brightness(0.7);
        -o-filter: brightness(0.7);
        -ms-filter: brightness(0.7);
    }
    

    There's a bunch of other filters like blur, saturate, contrast, ...

    You can easely use JQuery to change the css if you want.

提交回复
热议问题