-2

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");
    });
});
Community
  • 1
  • 1
ModernDesigner
  • 7,539
  • 10
  • 34
  • 41

2 Answers2

2
$(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.

  • 2
    You know, animating colors do not work without the UI/UI.color module. You could at least add a note about it before people start complaining and downvoting. `=]` – Fabrício Matté Oct 14 '12 at 01:46
1

What you need is to animate() the element, not simply to change the color value in css. Here is a reference on how to do it.

Konstantin Dinev
  • 34,219
  • 14
  • 75
  • 100