ipalaus
ipalaus

Reputation: 2273

jQuery hover overwrite the CSS a:hover color

I have a <div /> that contains a image and a anchor. The anchor has an a CSS attribute for a:hover that changes the color. It works! The problem is that I've added a jquery.hover() on the image that changes the color too for the anchor. When I try to hover the text directly, and not the <div /> containing the image, it doesn't works.

Code and example: http://jsfiddle.net/FGVSK/

Thank you in advance!

Upvotes: 1

Views: 1578

Answers (2)

WaiLam
WaiLam

Reputation: 1007

The jquery will override the css poperty. You need to reset color by.

function() { $(this).next('a').css('color', ''); }

Upvotes: 0

Yi Jiang
Yi Jiang

Reputation: 50115

For the second function you're passing to the hover function, instead of setting the color property to the original hex value, you should simply reset it to nothing:

$(this).next('a').css('color', '');

Here's a demo of this: http://jsfiddle.net/yijiang/FGVSK/1/

Upvotes: 3

Related Questions