I think your problem has to do with scope int hat curwidth and
curheight can only be seen inside the first function
if you pass them in to the second function some how or set them as
global values then you'll be ok

Mean Mike

On Jul 17, 5:59 am, runrunforest <craigco...@gmail.com> wrote:
> Hi,
>
> I want to animate the width and height of image when hovering it, and
> when i stop the image's state back to normal.
>
> My problem is, the image's state not back to normal when mouseout.
>
> here is my code
>
> $(function(){
>         $('img').hover(function(){
>                 var curwidth = $(this).width(), curheight = $(this).height();
>                 var aimwidth = curwidth +20, aimheight = curheight +20;
>                 $(this).stop().animate({width:aimwidth, 
> height:aimheight},400);
>
>         }, function(){
>                 $(this).stop().animate({width:curwidth, 
> height:curheight},400);
>         });
>
> });
>
> And HTML
>
> <img src="img/1oaxwk.jpg" width="40" height="40" />

Reply via email to