PDA

View Full Version : Tab Content Script V2.2 - About to pull my hair out!



brent_seraphim
09-17-2008, 08:06 PM
1) Script Title: Tab Content Script V2.2

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

3) Describe problem:

I seem to have a small problem in my code that I can not correct.
It has to be something small, and I probably going to feel like an idiot when it's pointed out.

Here is my version of the code. Stripped down to be small:
<ul id="countrytabs1" class="shadetabs">

<li><a href="#" rel="a1" class="selected">1</a></li>
<li><a href="#" rel="a2">2</a></li>

</ul>

<div style="border:1px solid gray; width:450px; margin-bottom: 1em; padding: 10px">

<div class="tabcontent" id="a1">1</div>
<div class="tabcontent" id="a2">2</div>

</div>

<script type="text/javascript">
var countries=new ddtabcontent("countrytabs1")
countries.setpersist(true)
countries.setselectedClassTarget("link")
</script>

Nothing displays inside of the Contained div. The tabs show up just fine though.

The example off the page:

<ul id="countrytabs" class="shadetabs">
<li><a href="#" rel="country1" class="selected">Tab 1</a></li>
<li><a href="#" rel="country2">Tab 2</a></li>
<li><a href="#" rel="country3">Tab 3</a></li>
<li><a href="#" rel="country4">Tab 4</a></li>
<li><a href="http://www.dynamicdrive.com">Dynamic Drive</a></li>
</ul>

<div style="border:1px solid gray; width:450px; margin-bottom: 1em; padding: 10px">

<div id="country1" class="tabcontent">
Tab content 1 here<br />Tab content 1 here<br />
</div>

<div id="country2" class="tabcontent">
Tab content 2 here<br />Tab content 2 here<br />
</div>

<div id="country3" class="tabcontent">
Tab content 3 here<br />Tab content 3 here<br />
</div>

<div id="country4" class="tabcontent">
Tab content 4 here<br />Tab content 4 here<br />
</div>

</div>

<script type="text/javascript">

var countries=new ddtabcontent("countrytabs")
countries.setpersist(true)
countries.setselectedClassTarget("link") //"link" or "linkparent"
countries.init()

</script>

Works just fine though. I've sucessfully used many scripts of dynamic drive, and I really want to add this scripts awesome functionality to my website.

Thanks to anyone who can offer any help!
-Brent Kuykendall

amyschiff
09-17-2008, 08:38 PM
it looks like you're missing the countries.init() following the countries.setselectedClassTarget("link")