The files are built dynamically, so number of titles and text-class divs can vary.
What I am trying to achieve is to insert a elements in order to be able to jump from one title to the next, so I'm sort of after a prev() or next() but without the elements having to be siblings.

if I understand correctly, you want to add a tags at or near your h1 tags, but there could be any number of div elements between? You can get all your h1 elements with $('#text-container h1') then .each over them
–
MrOBrianJul 16 '12 at 22:00

@MrOBrian - yes, well buttons actually, to move up and down the article from title to title, but basically that was the idea. The solution from Roko is using each to achieve this, I implemented this and the result's great. Just what I was after.
–
ArgoronJul 16 '12 at 22:28

Very cool stuff, again thanks very much. I'll try to get my head around it :) There's just one tiny question I have left: I implemented and tested it locally here and it does just the job, except on one title, where it hardly scrolls so that the title remains stuck at the bottom of the page. Any idea why that might be ? I cannot see anything from the structure that would trigger a slightly different behavior. It's one of 10 titles somewhere in the middle of the file.
–
ArgoronJul 16 '12 at 22:42