remove css :hover attribute with jquery

前端 未结 7 1028
遇见更好的自我
遇见更好的自我 2020-12-10 02:44

Lets say I have


7条回答
  •  Happy的楠姐
    2020-12-10 02:56

    You can't remove pseudo-class rules, but you can override them with event bindings:

    $("#container").on('mouseover', function () {
       $(this).css('background', 'blue');
    }).on('mouseout', function () {
       $(this).css('background', whateverItIsNormally);
    });
    

提交回复
热议问题