jQuery css() function changing 'a' property not 'a:hover' property

前端 未结 5 819
小蘑菇
小蘑菇 2021-01-05 05:49

I\'m having a bit of trouble with the jQuery css() function at the moment. It is changing the css value of the anchor element\'s border-top-color i

5条回答
  •  隐瞒了意图╮
    2021-01-05 06:17

    This code is broken since 1.9

    if($('...').is(':hover')){
      $(this).css('set','your styles here')
    }
    

    use this instead

    var class = '...';
    if($(class+':hover').length>0){
      $(class).css('set','your styles here');
    }
    

提交回复
热议问题