tags:

views:

384

answers:

4
+4  A: 

Try this:

$("p.follow").hover(function()
   {
      $(this).stop().fadeTo("slow", 1.00);
   },
   function()
   {
      $(this).stop().fadeTo("fast", 0.50);
   });

Two key differences: I use the jQuery hover event to associate mouseover and mouseout event handlers such that child elements won't result in confusing behavior, and i use the stop() function to prevent animations from overlapping and canceling each other out.

Shog9
A: 

A mouseover-event is fired every time your mouse moves over the element. Since effects are executed sequentially and a mouseover is fired pretty frequently, you get a lot of effects that have to be executed "slow".

What you probably want is the hover-event, which is only executed once for each entry.

Javache
A: 

Very interesting. I never knew that, I will keep this in mind for further uses! So the stop is the main important part? For it does not overlap?

Ryan

Coughlin
stop() is key, because otherwise you could have a fade-out animation running before the fade-in had completed, and they would just stomp on each other and never complete.
Shog9
+1  A: 

It may be worth looking at the hoverintent plugin, this basically uses a little setTimeout so that it wont activate if a user quickly moves the mouse across the element instead. Easy to code yourself but worth a look.

redsquare