Results 1 to 2 of 2

Thread: ajaxtabs "selected" on tabs other the the first

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

    Default ajaxtabs "selected" on tabs other the the first

    1) Script Title: Ajax Tabs Content Script (v 2.0)

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...axtabscontent/

    3) Describe problem: I am not able to get the "selected" option to work when something other then the first tab has the selected class. It always goes to the first tab. It almost looks like it loads the 2nd tab, then the first. Am I doing some thing wrong? I know I had this working with the previous version of the script (which is completely different code). When we updated to the new version this went unnoticed for a while. I went to the demo.htm code and tried to get it working with "selected" on something other then the first tab, but it eghibits the same behavior...

    Here is the code I'm trying.

    Code:
    <ul id="countrytabs" class="shadetabs">
    <li><a href="external1.htm" rel="countrycontainer">Tab 1</a></li>
    <li><a href="external2.htm" rel="countrycontainer" class="selected">Tab 2</a></li>
    <li><a href="external3.htm" rel="countrycontainer">Tab 3</a></li>
    <li><a href="external4.htm" rel="#iframe">Tab 4</a></li>
    </ul>
    
    <div id="countrycontainer" style="border:1px solid gray; width:450px; margin-bottom: 1em; padding: 10px">
    <p>This is some default tab content, embedded directly inside this space and not via Ajax.
    It can be shown when no tabs are automatically selected, or associated with a certain tab,
    in this case, the first tab.</p>
    </div>
    
    <script type="text/javascript">
    
    var countries=new ddajaxtabs("countrytabs", "countrycontainer")
    countries.setpersist(true)
    countries.setselectedClassTarget("link") //"link" or "linkparent"
    countries.init(3)
    
    </script>

  2. #2
    Join Date
    Jan 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi,

    I foud the problem. There seems to be a bug in the ajaxtabs.js script. In the init function, there is a persisterror flag. This is triggering line 188 to execute, which sets the persisted tab to the first tab. It should only default to the first tab if no tab is marked as "selected". I fixed it by just commenting out this line. It would be nice if the logic that set the flag loaded the selected tab instead.

    Thanks,
    Mark

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
  •