views:

31

answers:

0

I have this piece of code which, when you hover over a Class it finds the related ID and fades it in. Then when you click it it stays highlighted. The problem is, when you click and highlight it, then hover over another item it stays highlight also. Here is the code I am using.

$('.link1,.link2,.link3').hover(function(){
        linkClass = $(this).attr('className');  
        linkId='#'+linkClass;
        $(linkId).stop(true, true).fadeIn();
    },function(){
    //Test if element has been clicked
    var clicked = $(this).data('clicked');
    if(!clicked){
        $(linkId).stop(true, true).fadeOut();
        }
    }).click(function(){
        $(this).data('clicked', true);
        $(linkId).css('display','block');
        $(linkId).siblings().stop(true, true).fadeOut();
    });

It does work if I take the fades out, but I need those in. Many thanks, C