Results 1 to 7 of 7

Thread: Select tab and load other ajax content

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

    Question Select tab and load other ajax content

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

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

    3) Describe problem:
    Is there an easy way to select a specific tab and load a different content than originally specified? I want to load external content from a link (not one of the tabs) but I always want a specific tab to be selected when showing that external content. Say, as an example (using your own examples) you ALWAYS want the Google homepage loaded on the fourth tab.

    I realize this can be done with expandit() and then loadajaxpage() but the screen flickers with the original content and it is just a workaround...

    Any ideas?
    /Mats

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

    Default

    Well, expandit() then loadajaxpage() would be the correct process. Most likely the reason it "flickers" while doing it is because when you call expandit(), it attempts to load the default content associated with that tab, only to be quickly interrupted by loadajaxpage() to load a different content instead. Is specifying a "blank" page to be associated with that tab by default an option for you? For example:

    Code:
    <ul id="countrytabs" class="shadetabs">
    <li><a href="external1.htm" rel="countrycontainer" class="selected">Tab 1</a></li>
    <li><a href="blank.htm" rel="countrycontainer">Tab 2</a></li>
    <li><a href="external3.htm" rel="countrycontainer">Tab 3</a></li>
    <li><a href="external4.htm" rel="countrycontainer">Tab 4</a></li>
    </ul>
    Blank.htm would be an actual external page, but with no real content, to minimize any flickering when switching from it to the actual page you want to load.

  3. #3
    Join Date
    Feb 2008
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default ...or de-select all

    Yes, using a blank page could be the solution but then again not really as I then would have to code for that tab every time with loadajaxcontent.
    Is there a way to de-select all tabs? Giving the user a visible indication that no tab is actually associated with the current content.
    Thanks for everything

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

    Default

    Sure, deselecting all tabs is possible, by padding in -1 in expandit():

    Code:
    instance.expandit(-1)
    However, this by default will trigger an alert message, which you need to disable inside the .js file:

    Code:
    catch(err){alert("Invalid Tab ID or position entered!")}
    Remove the part in gray.

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

    Default


    instance.expandit(-1) does not do anything for my script...
    Nothing happens.

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

    Default

    My bad, I was basing the above instructions on an older version of the script. Use the attached modified ajaxtabs.js file instead. Its only difference is the ability to dynamically deselect all tabs, by calling tabcontentinstance.expandit(-1), identical in that respect to the instruction above.

  7. #7
    Join Date
    Feb 2008
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Talking gr8

    That did it.
    THANK YOU for the support and for a great tool!

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
  •