Results 1 to 5 of 5

Thread: Tab content help, feature request

  1. #1
    Join Date
    Feb 2008
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Tab content help, feature request

    1) Script Title:

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...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?

  2. #2
    Join Date
    Feb 2008
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    I figured out the mouseover problem.

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

    TIA

  3. #3
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Sure, try the below modified tabcontent.js file. It adds a new public method randomselect(). Here's a sample usage:

    Code:
    <script type="text/javascript">
    
    var countries=new ddtabcontent("countrytabs")
    countries.setpersist(false)
    countries.randomselect(true)
    countries.setselectedClassTarget("link") //"link" or "linkparent"
    countries.init()
    
    </script>
    When called with a value of true, it randomizes the selected tab when the page loads. Note that persistence if enabled supersedes this setting.

  4. The Following User Says Thank You to ddadmin For This Useful Post:

    A2HD (02-29-2008)

  5. #4
    Join Date
    Feb 2008
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    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!

    Code:
    <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>
    </ul>
    
    <script type="text/javascript">
    var products=new ddtabcontent("productTabs")
    products.setpersist(false)
    products.randomselect(true)
    products.setselectedClassTarget("link")
    products.init()
    </script>

  6. #5
    Join Date
    Feb 2008
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    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!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •