Quote:
Originally Posted by CHIPIT
Thanks! Great mod, installed and nominated.
One thing though...
For dynamically selecting a tab we're supposed to use
<a href="javascript:instance.expandit(1)">Select 2nd Tab</a>
What is exactly is the instance? How is it defined? and when you say tab# starting with 0, would the first one (0) be the one with the first tabbed link, the first one in the code itself, or tcontent1??
|
Thank you
To answer your first question, the instance is the var name in this chunk of script that you added in Step 16: (Bold Red)
Code:
<!-- Tabbed Forums switch tab script -->
<script type="text/javascript">
var myforumtabs=new ddtabcontent("forumtabs")
myforumtabs.setpersist(true)
myforumtabs.setselectedClassTarget("link")
myforumtabs.init()
</script>
<!-- /end Tabbed Forums switch tab script -->
So to further expand on this function: instance.expandit(tabid_or_position)
This method lets you dynamically select any tab based on
either its
ID attribute (you need to first assign one to that tab),
or position relative to its peer tab links. The method can be called anywhere on the page, such as inside a link on the page.
Parameter:
tabid or position: Either a string representing the tab link's ID, or an integer corresponding to that tab's position relative to its peers, to select. For the later, the counting starts at 0 (ie: 0=Tab 1, 1=Tab 2, 2=Tab 3 and so on).
So to answer your question, 0=the first tab. tcontent1=the content of the tab itself, not the ID of the tab.
Example:
Based on the following sample tabs layout, I added a tab ID to Tab 2. You don't need to do this as you can also just call the position as well.
Code:
<ul id="forumtabs" class="shadetabs">
<li><a href="#" rel="tcontent1" class="selected">Tab 1</a></li>
<li><a href="#" rel="tcontent2" id="roses">Tab 2</a></li>
<li><a href="#" rel="tcontent3">Tab 3</a></li>
<li><a href="#" rel="tcontent4">Tab 4</a></li>
</ul>
Here are some examples of how the links can be used:
This one uses the position parameter:
Code:
<!--Selects 4TH tab within instance "myforumtabs" -->
<a href="javascript:myforumtabs.expandit(3)">Tab 4</a>
this one uses the tabid parameter:
Code:
<!--Selects tab with ID="roses" within instance "myforumtabs" -->
<a href="javascript:myforumtabs.expandit('roses')">Select "Roses" tab</a>
Hope that helped out and answered your questions..
Bobster