views:

354

answers:

2

Hi everyone ,

I have created a simple JQuery script with hovering effect on some links. The script works fine as you can see here : Test Sample ... (Please test it on any browser other than IE)

But if i hover fast on the links, you will notice the image icons do not disappear as required. I have tried everything to fix this but i can't find a suitable solution.

The question now: How can i be sure the mouseOut hover effect is applied after the mouseOver hover effect is completely done ?

+2  A: 

Becuase your animation effect has a duration to completion, you need to handle cases where hover/unhover happen during the animation.

I use JQuery's stop function (http://docs.jquery.com/Effects/stop)

Eg.

$("selector").stop(true,true).youreffect(.....);

Give it a try.

o.k.w
Thanks for the help Eg.I did it as you mentioned, i wrote in the unhover event :$(this).stop(true, true);But nothing is changed ... You can check it in the sample online, i have updated it. But your idea is right ... The problem is because i unhover so fast before the duration of the hover effect completes.Any other suggestion ?
Brad
+1  A: 

You need to apply the stop() to the elements that have been animated. Try this:

function hide_frame() {
   var hoveredLang = $(this).parent();     
   hoveredLang
      .find('.language-name').stop(true, true)
      .find('.download-img').stop(true, true)
      .find('.info-img').stop(true, true);
   //eccetera...
Alex Bagnolini
Brad