Override a:hover with jQuery?

后端 未结 4 722
庸人自扰
庸人自扰 2021-01-02 04:21
4条回答
  •  生来不讨喜
    2021-01-02 04:37

    Here is a solution without hack classes:

    CSS:

    a {color: blue;}
    a:hover {color: red;}
    

    jQuery (uses jQueryUI to animate color):

    $('a').hover( 
      function() {
        $(this)
          .css('color','blue')
          .animate({'color': 'red'}, 400);
      },
      function() {
        $(this)
          .animate({'color': 'blue'}, 400);
      }
    );
    

    demo

提交回复
热议问题