can you pass a function to animate()?

can you pass a function to animate()?

hi,

can you pass a function to animate()?

can you animate this?

  1. $('a#test').addClass('selected');

or can you only animate CSS settings (I can't imagine animate() to be so limited...;-)

this doesn't work....

  1. $('a#nav').click( function(e) {
  2.     e.preventDefault();
  3.     $('#test').animate(function() {
  4.         $('#test').addClass('selected'); }, 600);
  5. });  
           
neither does this....


  1. $('a#nav').click( function(e) {
  2.     e.preventDefault();
  3.     $('#test').animate(function() {
  4.         $(this).addClass('selected'); }, 600);
  5. //      ^^^^^^
  6. });   
           
thank you.....