Reputation: 3913
OnClick event of img:
$(obj).animate({"left": "-=40px"},"slow");
$(obj).animate({"height":"600px","width":"320px"},30);
I want to animate width and height of image. Also, I am moving my image left by -40px. Afterwards again on the click event I want to bring back image to original size and position. I have tried this, but animate left is taking image to very left not to original place.
$(obj).animate({"Right": "+=40px"},"slow");
$(obj).animate({"height":"449px","width":"249px","left":"-20px"},30);
Upvotes: 0
Views: 90
Reputation: 3913
Oops... I noticed that "left":"-20px"
was extra in
$(obj).animate({"height":"449px","width":"249px","left":"-20px"},30);
After removing it the problem was solved.
Upvotes: 1
Reputation: 1891
Change:
$(obj).animate({"height":"449px","width":"249px","left":"-20px"},30);
to
$(obj).animate({"height":"449px","width":"249px","left":"-=20px"},30);
Upvotes: 1
Reputation: 14827
Try to change:
$(obj).animate({"Right": "+=40px"},"slow");
to:
$(obj).animate({"left": "+=40px"},"slow");
since when you use "Right": "+=40px"
, again your obj
will move to the left 40px
Upvotes: 0