[Tex/LaTex] How to alternate graphics in LaTeX beamer

beameroverlays

I'm trying to alternate graphics on a slide:

\frame{
\frametitle{Verkette Liste Beispiel} 
\begin{figure}
    \includegraphics<1>[scale=0.7]{pics/List-0.pdf}
    \includegraphics<2>[scale=0.7]{pics/List-1.pdf}
    \caption<1>{Hallo}
    \caption<2>{Welt}
\end{figure}
}

My problem is I don't get alternating captions. I get something like this: http://public.kungi.org/main-faulty.pdf

I tried the solution from this question: https://stackoverflow.com/questions/1088761/how-to-change-an-image-on-a-slide-in-latex but it did not work for me.

What am I doing wrong?

Best Answer

The \caption command is not "overlay specification aware". Instead of

\caption<1>{Hallo}
\caption<2>{Welt}

do

\caption{\only<1>{Hallo}\only<2>{Welt}}