Problem with using variable as animate()'s properties

Problem with using variable as animate()'s properties

Hi, I'm writing this script and apparently the animate method wouldnt interpret the variable I passed in the properties section:


  1. //it's hover event, and this is the mouseover

  2. function () {
  3.         direction = $(this).find('img').attr('class');  //should be either top, bottom, left or right
  4.         value = ((direction =='top' || direction=='bottom') ? $(this).find('img').outerHeight() * -1 : $(this).find('img').outerWidth() * -1);
  5.         $(this).find('img').stop().animate({direction: value} ,{duration:500, easing: 'easeOutBounce'});

  6. }


I have tested the content of variable, and there are 100% working, my final verdict is, the animate method doesn't read the variable "direction" properly. Anyone has any ideas to get around with this problem? 




Thanks!