How get the :hover css style of an anchor with jQuery?

后端 未结 4 1188
挽巷
挽巷 2020-12-19 13:00

How can i get the :hover in css stylesheet on the fly with jquery?

stupid example:

a.foo {
    color: red;
    font-size: 11px;
}

a.foo:hover {
            


        
4条回答
  •  囚心锁ツ
    2020-12-19 13:33

    You can use .hover() function instead. http://api.jquery.com/hover/

    $( "a.foo" ).hover(
      function() {
        $( this ).css( 'color','red' );
      }, function() {
        $( this ).css( 'color','blue');
      }
    );
    

提交回复
热议问题