7

i wanna dynamically change the link color within a hover event. I got the following code so far but it doesn´t work. Any suggestions why? In my oppinion it seems to be right...

    $('.fadelink').hover(function(){            
        $(this).animate({
            color: '#333'
        }, 600);            
    },
    function(){
        $(this).animate({
            color: '#999'
        }, 600);          
    });
Mikaelik
  • 355
  • 3
  • 4
  • 12

4 Answers4

9

You have to add colors plugin to make it work. That is stripped from core.

Dennis
  • 32,200
  • 11
  • 64
  • 79
Arda
  • 6,756
  • 3
  • 47
  • 67
4

jQuery doesn't support animation of colors, but it can with the color plugin: http://plugins.jquery.com/project/color

However, there's another route you could take, with CSS3, if you don't mind it not working in some older browsers:

.baseClass {
    color:#999; 

    -webkit-transition-property:color; 
    -webkit-transition-duration: 1s, 1s; 
    -webkit-transition-timing-function: linear, ease-in;
}

.baseClass:hover {
    color: #333;
}
Joakim Johansson
  • 3,196
  • 1
  • 27
  • 43
0

See the answer to this question: jQuery: animate text color for input field?

You cannot animate css text color with jQuery.

Community
  • 1
  • 1
Naftali
  • 144,921
  • 39
  • 244
  • 303
0

You have to use jQuery color plugin to make color animation work.

Muhammad Usman
  • 12,439
  • 6
  • 36
  • 59