Page 1 of 1

Fade font color jquery

Posted: Fri May 08, 2009 2:42 am
by cohq82
I am trying to make font color fading from one color to another. The code below doesnt work from red to black. Can someone help to fix that? Thanks

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js" type="text/javascript"></script>
<script type="text/javascript" src="js/ui.core.js"></script>
<script type="text/javascript">
  $(document).ready(function() {
    $('#test').click(function() {
      $('#test').text("test 2");
      $('#test').animate({
        color:"black" 
      }, 500);
    });
});
</script>
 
</head>
 
<body>
<label id="test" style="color:red;">abcd</label>
</body>
</html>

Re: Fade font color jquery

Posted: Fri May 08, 2009 9:55 am
by pickle
How doesn't it work? What does happen? Have you tried animating other properties?

Re: Fade font color jquery

Posted: Fri May 08, 2009 12:08 pm
by kaszu
jQuery doesn't support color animation. For that you need color plugin.

Re: Fade font color jquery

Posted: Fri May 08, 2009 12:19 pm
by cohq82
cool. will try. Thanks