Sunday, January 24, 2010

[jQuery] Using variable in animate()'s properties

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


//it's hover event, and this is the mouseover
function () {
direction = $(this).find('img').attr('class'); //should be either
top, bottom, left or right
value = ((direction =='top' || direction=='bottom') ? $(this).find
('img').outerHeight() * -1 : $(this).find('img').outerWidth() * -1);

$(this).find('img').stop().animate({direction: value} ,{duration:
500, easing: 'easeOutBounce'});
}

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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate