View Full Version : Tab content help, feature request

02-28-2008, 03:02 PM
1) Script Title:

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

3) Describe problem:
First of all this script is great, flexible and I have been able to use it in many different ways. Now I have been asked to do a couple of things with the script that I can't seem to figure out how to do.

First, I am trying to trigger the expandit() function with a mouseover of a tab. The name of my div is "newTabs", the name of my tabs are "new1", "new2", etc. I am trying to use onmouseover="newTabs.expandit('new1');", I have also tried "expandit('new1');" without any luck. Is there a way to do this similar to how any link on the page can be set to select a tab?

Feature request: Any chance there can be a setting added to allow random load of a tab rather than one that is selected by default?

02-29-2008, 01:58 AM
I figured out the mouseover problem.

Any chance of getting the random tab selection feature added on init()?


02-29-2008, 07:15 AM
Sure, try the below modified tabcontent.js file. It adds a new public method randomselect(). Here's a sample usage:

<script type="text/javascript">

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


When called with a value of true, it randomizes the selected tab when the page loads. Note that persistence if enabled supersedes this setting.

02-29-2008, 03:07 PM
Thank you so much for adding this for me.

I have added the code as demonstrated, but am not getting any randomized loading of the tabs.

Here's what I've got for code on the tabs and init code block. Anything jump out as incorrect?

Thanks again!

<ul id="productTabs" class="modernbricksmenu2">
<li><a href="#" rel="product1">1</a></li>
<li><a href="#" rel="product2">2</a></li>
<li><a href="#" rel="product3">3</a></li>
<li><a href="#" rel="product4">4</a></li>
<li><a href="#" rel="product5">5</a></li>
<li><a href="#" rel="product6">6</a></li>
<li><a href="/featured-products/">All</a>

<script type="text/javascript">
var products=new ddtabcontent("productTabs")

02-29-2008, 04:33 PM
Never mind, I'm an idiot. I removed class="selected" from the first tab thinking that would trigger that tab being selected by default. Added it back in and it's working.

Thanks again!