PDA

View Full Version : Tab Content Script (v 2.2) selected tabs not working?



bonesbrigade
09-05-2008, 04:06 AM
1) Script Title:
Tab Content Script (v 2.2)

2) Script URL (on DD):
http://www.dynamicdrive.com/dynamicindex17/tabcontent.htm

3) Describe problem:
I have the code that I produced with the basic example and use of some of the other tips on the script page as well as the documentation page, but I can't seem to get the 'selected option' to work.

I have tried placing the class="selected" portion of code into the link/"a href", the list/"LI", as well as using divs. For some reason, upon page load the first tab (skate in my code) is always selected, and then upon refresh, the last focused tab is the one that is selected.

Any idea what's wrong? Thanks.


...
<h3>Online Dealers</h3>
<ul id="bannertabs" class="shadetabs">
<li><a href="#" rel="skate">Skate</a></li>
<li><a href="#" rel="snow" class="selected">Snow</a></li>
<li><a href="#" rel="apparel" >Apparel</a></li>
</ul>

<div style="border:1px solid gray; width:400px; margin-bottom: 1em; padding: 10px">
<div id="skate" class="tabcontent">
<? echo $skMessage; ?>
</div>

<div id="snow" class="tabcontent">
<? echo $snMessage; ?>
</div>

<div id="apparel" class="tabcontent">
<? echo $apMessage; ?>
</div>
</div>

<script type="text/javascript">
var banners=new ddtabcontent("bannertabs")
banners.setpersist(true)
banners.setselectedClassTarget("link") //"link" or "linkparent"
banners.init()
</script>
...

bonesbrigade
09-05-2008, 04:10 AM
Oh, this was my first post, and I just noticed that there is a "script help" section. Can a moderator/admin move this to the correct board?

*EDIT*:I found the cause of the problem- the banners.setpersist(true) needs to be made false.