I know this is a mess! How can I write this code better?
function anim() {
$( "#p1-animation-1" ).fadeIn( 1200, function() {
$( "#p1-animation-1" ).fadeOut( 1200 );
$( "#p1-animation-2" ).fadeIn( 1200, function() {
$( "#p1-animation-2" ).fadeOut( 1200 );
$( "#p1-animation-3" ).fadeIn( 1200, function() {
$( "#p1-animation-3" ).fadeOut( 1200 );
$( "#p1-animation-4" ).fadeIn( 1200, function() {
$( "#p1-animation-4" ).fadeOut( 1200 );
$( "#p1-animation-5" ).fadeIn( 1200, function() {
$( "#p1-animation-5" ).fadeOut( 1200 );
$( "#p1-animation-6" ).fadeIn( 1200, function() {
$( "#p1-animation-6" ).fadeOut( 1200 );
anim();
});
});
});
});
});
});
}
anim();