I'm trying to use the suggestion by @gonzalo_medina in this thread about hyperlinks and the suggestion by @diabonas in this thread about overlay numbers to automate the process of passing an overlay number to \hypertarget
The method I'm using is very clumsy, and I'm sure there's a better way using beamer's internal functionality. But this is what I've tried, borrowing very liberally from @gonzalo_median's code
\documentclass{beamer}
\usepackage{ifthen}
\makeatletter
\newcommand*{\overlaynumber}{\number\beamer@slideinframe}
\makeatother
\begin{document}
\begin{frame}
\hyperlink{label4}{\beamerbutton{I jump to fourth slide of next frame}}
\hyperlink{label6}{\beamerbutton{I jump to sixth slide of next frame}}
\end{frame}
\begin{frame}
\begin{itemize}[<+->]
\item First.
\pause
\item Second.
\pause
\item Third;
\pause
\item
\ifthenelse{\isundefined{\firstValue}}{\def\firstValue{\overlaynumber}}{}
Fourth; I'm now at overlay
\#\firstValue. \hypertarget<\firstValue>{label4}{\beamerbutton{I'm on the fourth slide}}
\pause
\item Fifth
\pause
\item
\ifthenelse{\isundefined{\secondValue}}{\def\secondValue{\overlaynumber}}{}
Sixth I'm now on overlay \#\secondValue \hypertarget<\secondValue>{label6}{\beamerbutton{I'm on the sixth slide}}
\end{itemize}
\end{frame}
\end{document}
The problem I've identified with the code (there maybe others) is that even though I've specified that \firstValue and \secondValue should be defined only if they haven't already been defined, the ifthen conditional isn't working and the values keep getting incremented along with \overlaynumber. The problem should be evident immediately from running the code
If somebody could get this running properly, or suggest a better approach, I'd be most grateful.