Results 1 to 7 of 7

Thread: NEXT/PREV with Nested Tabs

  1. #1
    Join Date
    Jul 2008
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default NEXT/PREV with Nested Tabs

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

    2) Script URL (on DD): Ajax Tabs Content: http://www.dynamicdrive.com/dynamici...tent/index.htm
    3) Describe problem:
    Does anyone have a way to make NEXT/PREV (cycleit) work in a nested tab set? Thanks.

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

    Default

    A cycling link will still work when put inside a nested tab content. That is, if that content is the 2nd tab, clicking on the "next" link will cause the 3rd tab to be selected:

    Code:
    <p><a href="javascript:countries.cycleit('prev')" style="margin-right: 280px;"><img src="roundleft.gif" border="0" /> Back</a>
    <a href="javascript:countries.cycleit('next')"><img src="roundright.gif" border="0" /> Forward</a></p>
    Or are you asking about going to a different tab than sequentially?

  3. #3
    Join Date
    Jul 2008
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by ddadmin View Post
    A cycling link will still work when put inside a nested tab content. That is, if that content is the 2nd tab, clicking on the "next" link will cause the 3rd tab to be selected:

    Code:
    <p><a href="javascript:countries.cycleit('prev')" style="margin-right: 280px;"><img src="roundleft.gif" border="0" /> Back</a>
    <a href="javascript:countries.cycleit('next')"><img src="roundright.gif" border="0" /> Forward</a></p>
    Or are you asking about going to a different tab than sequentially?
    Thanks for the reply.
    If I use the code you posted the links take me out of the nested page and to the next main tab; instead of the next page in the nest.
    I am asking about going to the next tab inside the nested page, sequentially. I thought it should work like this: but it does not.


    Code:
    <p><a href="javascript:provinces.cycleit('prev')" style="margin-right: 280px;"><img src="roundleft.gif" border="0" /> Back</a>
    <a href="javascript:provinces.cycleit('next')"><img src="roundright.gif" border="0" /> Forward</a></p>

    I get an error: 'provinces' is undefined. Thanks for the help.

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

    Default

    Ah yes, you need to make sure "provinces" is declared as a global variable when you initialize it. In other words, you'd remove the part in red here:

    Code:
    countries.onajaxpageload=function(pageurl){
    if (pageurl.indexOf("externalnested.htm")!=-1){
    var provinces=new ddajaxtabs("provincetabs", "provincedivcontainer")
    provinces.setpersist(true)
    provinces.setselectedClassTarget("link") //"link" or "linkparent"
    provinces.init()
    }
    That will do it.

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

    Default

    You got it, works as I expected now.
    Thanks again for the help.

  6. #6
    Join Date
    Jul 2008
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    admin- I have another tweak I was wondering if someone had already done for an external link into the tabbed content using ID's instead of index #'s?
    Using the standard code as below, I would like to link into the tabbed content with the following (or somthing similar?);
    <a href="target.htm?flowertabs=myfavorite">Target Page</a>
    which would lead me to target.htm with external2.htm tab selected.

    Code:
    <ul id="countrytabs" class="shadetabs">
    <li><a href="external1.htm" rel="countrycontainer" class="selected" id="thebestest">Tab 1</a></li>
    <li><a href="external2.htm" rel="countrycontainer" id="myfavorite">Tab 2</a></li>
    <li><a href="external3.htm" rel="countrycontainer" id="justok">Tab 3</a></li>
    <li><a href="external4.htm" rel="countrycontainer" id="notsogood">Tab 4</a></li>
    </ul>
    
    <div id="countrydivcontainer" style="border:1px solid gray; width:450px; margin-bottom: 1em; padding: 10px">
    </div>
    
    <script type="text/javascript">
    
    var countries=new ddajaxtabs("countrytabs", "countrydivcontainer")
    countries.setpersist(true)
    countries.setselectedClassTarget("link") //"link" or "linkparent"
    countries.init()
    
    </script>
    As I would like to use them, the number of tabs are dynamic based on the content available. While I know I always want to link to "myfavorite" from pages outside the tabbed area, I will never know ahead of time what postion it is in. Does that explain it? Thanks again.

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

    Default

    marcdet, please start a new thread when asking a new question on a script.

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
  •