You could use the callback function (http://docs.jquery.com/Effects/ animate#paramsdurationeasingcallback).
$("#right").click(function(){ $("#i1").animate({width: '98px', "left": "+=86px"}, 1500, function (){ var id = $(this).attr('id').split('i')[1]; id = id -1; $(this).attr('id',id) }); }) On 21 Feb., 15:15, "paul.mac" <paul.mcma...@uuconstruct.co.uk> wrote: > Hi, > > I have a group of animations, which once they are finished I would > like to change all the image ids and then the src attribute. My code > is as follows: > > $("#right").click(function(){ > $("#i0").fadeIn(1500); > $("#i1").animate({width: '98px', "left": "+=86px"}, 1500); > ... > $("#i6").animate({width: "75px", left: "+=110px"}, 1500); > $("#i7").fadeOut(1500); > }) > > I don't know how to string a function to this above one so that it > executes after all the animations have finished. Basically I want to > take the existing ids ( i1, i2 ... and change and change them to i0, > i1 etc. > > Thanks in advance > > paul