remove an id after an animation in jquery

remove an id after an animation in jquery

I'd like to remove an id from an image after its animation is completed. I have this in my code:

if(index == 1 && direction =='down'){ $('#slidetext1 #rock').animate({right:"0"}); $('#slidetext1 #deer').animate({left: "0"}).addClass('open').removeAttr('id'); }

It's not working because it removes the id before even starting the animation, but what I want to do is to remove the id #deer from the image and add ('open') after the .animate() has been executed.

so here i made a jsfiddle: http://jsfiddle.net/67oe1jvn/45/ . pay attection to the left image as you scroll down under the HELLO h1. the thing i want to achive is: when i get to the second section, i'd like to see both of the images slide in the view with the directive "transition:all 1.2s ease-out;" AND whenever the section gets changed make them slide out of the view with a faster transiction, so it won't been noticed that much.