Search code examples
jquerycssanimationtransitionfading

Trying to get a fallback for CSS3 transitions using jQuery


Possible Duplicate:
Special color transition effect with pure jQuery animation // no ui or other libary

I think this code should be it, but it's not working. I can tell it's changing the colors, but it's not fading (like CSS3 transitions). Please help. My code:

$(document).ready(function(){
    $("#nav-wrap ul li a").mouseover(function(){
        $(this).css("color","#444");
    });

    $("#nav-wrap ul li a").mouseout(function(){
        $(this).css("color","#999");
    });
});

Solution

  • $(document).ready(function(){
        $("#nav-wrap ul li a").hover(function(){
                $(this).stop().animate({color:'#444'}, 300);
            }, function () {
                $(this).stop().animate({color:'#999'}, 100);
            }
        )}
    });
    

    This code require jQuery UI.