i am using following code for animation using jquery. when i click on a list element, the corresponding div slides down and opacity goes to ‘1’. When i click other list element, the previos one goes up and fades, and the next one come down.
var id_prev;
var id_new;
$("#tag ul li ").click(function(event){
var i = $(this).index()+1;
var id_new="#person"+i;
if(id_new != id_prev){
$(id_prev).animate({top:'300px',opacity:'0'},500);
$(id_prev).delay(200).css({'z-index':'0'});
$(id_new).delay(200).css({'z-index':'300'});
$(id_new).delay(200).animate({top:'300px',opacity:'0'},500);
$(id_new).delay(200).animate({top:'330px',opacity:'1'},500);
id_prev = id_new;
}
});