I have an html file which is structured pretty much this way:
<div id="text-container">
<h1>Title 1</h1>
<div class="text"></div>
<div class="text"></div>
<div class="text"></div>
<div class="text"></div>
<h1>Title 2</h1>
<div class="text"></div>
<div class="text"></div>
<div class="text"></div>
<h1>Title 3</h1>
...
</div>
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.
Can anyone please point me in the right direction ?
Thanks in advance for your help
Here it is: using some ternary operators: (just add a class
btnto your.prevand.nextbuttons)DEMO