Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery colorplugin stops CSS :hover working

I am using the jQUery color plugin. I have an li element that, when hovered over, changes it's background color. It does this by using the standard :hover CSS pseudo class in the CSS file. This works fine, until I use the color plugin on it - the :hover effect just stops working when I 'pulse' the element using this code:

$(".elements").first()
              .delay(400)
              .css({ backgroundColor: '#eeeeee' })
              .animate({ backgroundColor: '#888888' }, 2000);

Can anyone suggest a solution so that, when the 'pulse' is displayed, the original :hover behaviour continues to work?

like image 742
Bojangles Avatar asked Aug 13 '26 21:08

Bojangles


1 Answers

Define the rule for :hover with !important so when the JavaScript sets the inline style, it will override it.

like image 61
Quentin Avatar answered Aug 15 '26 12:08

Quentin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!