% From http://tex.stackexchange.com/questions/119988

\documentclass[a6paper,12pt]{scrbook}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% usage: \tooltip[<link colour>]{<link text>}[<tip box colour>]{<tip text>}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{media9}[2013/07/19]
\usepackage{xcolor}
\usepackage{calc}
\pagestyle{empty}
\usepackage[landscape,margin=12pt]{geometry}

% define functions which ensure thet the tooltip fits in the page
% bounds when invoked for the first time.
\usepackage[pdftex]{eforms}
\usepackage{insdljs,amsmath}

\begin{insDLJS}[tooltips]{Tooltipsdljs}{DLJS for Tooltips}
app.focusRect = false;

dimensions=this.getPageBox();
var RightBound=dimensions[2]-dimensions[0];
var TopBound=dimensions[1]-dimensions[3];


function tobounds(field)
{
  var f2=field;
  if ( f2[0]<0   ) { f2[2]=f2[2]-f2[0]; f2[0]=0; }
  if ( f2[2]>RightBound ) { f2[0]=f2[0]-f2[2]+RightBound; f2[2]=RightBound; }
  if ( f2[3]<0   ) { f2[1]=f2[1]-f2[3]; f2[3]=0; }
  if ( f2[1]>TopBound   ) { f2[3]=f2[3]-f2[1]+TopBound; f2[1]=TopBound; }
  return(f2);
}

\end{insDLJS}

\ExplSyntaxOn
\let\tpPdfLink\mix_pdflink:nn\let\tpPdfAnnot\mix_pdfannot:nnnn
\let\tpPdfXform\mix_pdfxform:n\def\tpPdfLastXform{\g_mix_pdflastxform_tl}
\ExplSyntaxOff

\NewDocumentCommand{\tooltip}{O{blue}mO{yellow!20}m}{{%
  \leavevmode%
  \tpPdfLink{%
    /Subtype/Screen%
    /AA<<%
      /E<</S/JavaScript/JS(%
        var fd=this.getField('tip.\thetcnt');%
        if(typeof(fdor\thetcnt)=='undefined'){%
          fd.rect=tobounds(fd.rect);
          var fdor\thetcnt=fd.rect;%
          var click\thetcnt=false;%
          var dragging\thetcnt=false;%
        }%
        if(fd.display==display.hidden){%
          fd.delay=true; fd.display=display.visible;fd.delay=false;%          
        }%
        this.dirty=false;%
      )>>%
      /X<</S/JavaScript/JS(%
        if(!click\thetcnt&&!dragging\thetcnt){fd.display=display.hidden;}%
        if(!dragging\thetcnt){click\thetcnt=false;}this.dirty=false;%
      )>>%
      /U<</S/JavaScript/JS(click\thetcnt=true;this.dirty=false;)>>%
      /PC<</S/JavaScript/JS (%
        var fd=this.getField('tip.\thetcnt');%
        try{fd.rect=fdor\thetcnt;}catch(e){}%
        fd.display=display.hidden;this.dirty=false;%
      )>>%
    >>%
  }{{\color{#1}#2}}%
  \sbox\tiptext{\fcolorbox{black}{#3}{#4}}%
  \edef\twd{\the\wd\tiptext}%
  \edef\tht{\the\ht\tiptext}%
  \edef\tdp{\the\dp\tiptext}%
  \tpPdfXform{\tiptext}%
  \raisebox{\heightof{#2}}[0pt][0pt]{\makebox[0pt][l]{%
    \tpPdfAnnot{\twd}{\tht}{\tdp}{%
      /Subtype/Widget/FT/Btn/Ff 65536/T (tip.\thetcnt)/F 3%
      /MK<</TP 1/I \tpPdfLastXform/IF<</S/A/FB true/A [0.0 0.0]>>>>%
      /AA <<%
        /U <<%
          /S/JavaScript/JS(%
            var fd=event.target;%
            var mX=this.mouseX;var mY=this.mouseY;%
            var drag=function(){%
              var nX=this.mouseX;var nY=this.mouseY;%
              var dX=nX-mX;var dY=nY-mY;%
              var fdr=fd.rect;%
              fdr[0]+=dX;fdr[1]+=dY;fdr[2]+=dX;fdr[3]+=dY;%
              fd.rect=fdr;
              mX=nX;mY=nY;%
            };%
            if(!dragging\thetcnt){%
              dragging\thetcnt=true;Int=app.setInterval("drag()",1);%
            }%
            else{app.clearInterval(Int);dragging\thetcnt=false;}%
            this.dirty=false;%
          )%
        >>%
      >>%
    }%
  }}%   
  \stepcounter{tcnt}%
}}  
\newsavebox\tiptext\newcounter{tcnt}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}
\Large 
\tooltip[black]{foo}[blue!50]{Hint: What is the definition of foo?}


Einstein's \tooltip{formula}{$E=m c^2$} is well known.
  Another famous  formula is due \hfill to~\tooltip{Pythagoras}{
\begin{minipage}{4cm}
dsfdsf
dsafadsf
dsaf
fdsa
fsad
\begin{equation*}
a^2+b^2=c^2
\end{equation*}
\end{minipage}
}.


\end{document}