It doesn't matter where they are. You can have several trigger divisions and several detail divisions. Unless you are using AJAX to add and/or remove any of them, or are using another script to physically move them around in the DOM, the correspondence will hold. It doesn't matter if they can be seen or not.
Like you can have as many of these as you want, say this is the first:
Code:
<div class="triggers">
<div>
Default
</div>
<div>
1st Trigger
</div>
<div>
2nd Trigger
</div>
<div>
3rd Trigger
</div>
</div>
This could be located elsewhere and be the second:
Code:
<div class="triggers">
<div>
4rth Trigger
</div>
<div>
5th Trigger
</div>
<div>
6th Trigger
</div>
<div>
7th Trigger
</div>
</div>
Then you could have, in yet another place:
Code:
<div class="details">
<div id="default">
This is what people will see at page load.
</div>
<div id="first">
It's SEO freindly, try it without javascript enabled, all the contents of the details divisions are seen.
</div>
<div id="second">
The order in which the triggers appear determines which details division they activate.
</div>
<div id="third">
The id's of the details division are only for styling. They're not required for the script.
</div>
</div>
And in the same place or yet somewhere else:
Code:
<div class="details">
<div id="fourth">
That amused submarine affably pauses over that ravishing turtle.
</div>
<div id="fifth">
The open boundaries belligerently wobble over their puzzled swine.
</div>
<div id="sixth">
Those moaning students abhorrently surround that admonishing animal.
</div>
<div id="seventh">
Our bittersweet testosterone inconveniently watches our placating turtledoves.
</div>
</div>
If all of the details will be revealed in the same spot on the page, those may be combined:
Code:
<div class="details">
<div id="default">
This is what people will see at page load.
</div>
<div id="first">
It's SEO freindly, try it without javascript enabled, all the contents of the details divisions are seen.
</div>
<div id="second">
The order in which the triggers appear determines which details division they activate.
</div>
<div id="third">
The id's of the details division are only for styling. They're not required for the script.
</div>
<div id="fourth">
That amused submarine affably pauses over that ravishing turtle.
</div>
<div id="fifth">
The open boundaries belligerently wobble over their puzzled swine.
</div>
<div id="sixth">
Those moaning students abhorrently surround that admonishing animal.
</div>
<div id="seventh">
Our bittersweet testosterone inconveniently watches our placating turtledoves.
</div>
</div>
Again, it doesn't matter where on the page these are, only their order in the source code of the page. the first trigger will always trigger the first detail while hiding all the others, and so on.
So I guess it boils down to - what do you mean by 'swap'? As long as the order of elements in the DOM of the page hasn't changed, there should be no problem.
The script in this thread doesn't change the DOM when it swaps things, does some other script you're using do so?
Bookmarks