Carol
Carol

Reputation: 329

why fade in/out only working once?

I know it is a very idiot problem but i'm trying to make a div show and hide on mouseover but when mouse hover the div it only works one time, then the div fadeout and dont fade in again. Am I missing something?

Thanks in advance

here it is in action: http://jsfiddle.net/rB9fk/3/

Upvotes: 2

Views: 1210

Answers (2)

henryaaron
henryaaron

Reputation: 6192

Here's probably a better solution:

Uses CSS3 transitions, no jQuery necessary.

http://jsfiddle.net/rB9fk/7/

Upvotes: 0

millimoose
millimoose

Reputation: 39960

Fading out doesn't just make an element invisible, it makes it not display at all. After $(this).fadeOut('fast') executes, there is no div.backgroundHover to hover over in the view.

You should only fade out the same element you're fading in:

$(this).find(".botoesHover").fadeOut('fast');

Updated jsFiddle: http://jsfiddle.net/rB9fk/5/

Upvotes: 1

Related Questions