views:

202

answers:

2

I am using this code to hide and show a div based on which thumbnail you rollover;

    $(document).ready(function(){
    $('div.infodiv').hide();
    $(".website_thumbs a").hover(
    function(){
       var name = $(this).attr("name");
       $(".infodiv").stop();
        $("."+name).fadeIn();
    },
    function(){
       var name = $(this).attr("name");
        $("."+name).fadeTo(7000,1).fadeOut();
    });
});

The script gets the name attribute from the thumbnail and displays the div with the corresponding class. Each div shares the .infodiv class but also has a class unique to each thumbnail.

The functionality is basically where I want it but when you scroll over the thumbnails fast some of the divs get stuck in a kind of half faded-in state and stop working unless i roll over them once - then they slow fade in and they are usable again.

I am a bit new to jQuery and would appreciate any help.

A: 

Try removing the $(".infodiv").stop(); line--that stops all the infodivs from animating.

honeybuzzer
I added that because without it it would not display a previous div once I rolled over the next until the animation was finished playing.
Omikron
A: 

The solution ended up being the hoverIntent plugin.

Omikron