Fade font color jquery

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
cohq82
Forum Commoner
Posts: 43
Joined: Mon Apr 21, 2008 8:38 pm

Fade font color jquery

Post 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>
Last edited by Benjamin on Fri May 08, 2009 9:49 am, edited 1 time in total.
Reason: Changed code type from text to html.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: Fade font color jquery

Post by pickle »

How doesn't it work? What does happen? Have you tried animating other properties?
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
kaszu
Forum Regular
Posts: 749
Joined: Wed Jul 19, 2006 7:29 am

Re: Fade font color jquery

Post by kaszu »

jQuery doesn't support color animation. For that you need color plugin.
cohq82
Forum Commoner
Posts: 43
Joined: Mon Apr 21, 2008 8:38 pm

Re: Fade font color jquery

Post by cohq82 »

cool. will try. Thanks
Post Reply