I was looking for a script creating collapsible / expandable divs that always remain inside the (visible part of the) browser's viewport, whatever the position of the links (for the divs) on the page. I didn't find one, so I created it myself. Demo and instructions here.