How can I make an image move to the right, then flip, and then move to the left, using selectors and functions?
I have an image of a fish and I need to do an animation so the fish goes from one site to the other, but when it reaches the top of one side I want to flip the image so it doesn't look that it's swimming back. I've started doing this:
$(document).ready(function () {
$("#fish").animate({rigth: '200'}, 2000);
and for fliping the image this: transform:
.css({ 'scaleX(-1)' });
and I guess for turning back it's the same as the first one just changing directon left.
But I don't know how can they be executed one by one... I'm new at jquery so the code it's probably wrong.
Thank you.