Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Tab Content Problem

  1. #1
    Join Date
    May 2005
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Tab Content Problem

    1) Script Title:
    Tab Content Script

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

    3) Describe problem:
    I've installed the script and it works fine bar every now and then when you go on to the page and all the content is in one long list rather than hidden behind the tabs. This disappears if you refresh the page, and if you return to the page later it will probably be ok...

    Any ideas why this may be happening?
    Thanks!
    Matt

  2. #2
    Join Date
    May 2005
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi everyone,

    It's been nearly a week since I posted this problem, and I've still got it!

    Can anyone help me please?

    Many thanks,
    Matt

  3. #3
    Join Date
    May 2007
    Location
    England, UK
    Posts
    235
    Thanks
    3
    Thanked 6 Times in 6 Posts

    Default

    Try this version instead, i'm using it with no problems!
    it uses ajax, so calls the content from an external page.

    http://www.dynamicdrive.com/dynamici...tent/index.htm

    Also if you've got dynamic content you can use each of the tabs to send a query so you should only need one external page.

  4. #4
    Join Date
    May 2005
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    That's a good idea, however I have 20 pages that use tabs, with three tabs on each page. To use the AJAX version would mean creating a lot of unnecessary pages to create the content, instead of just 20 pages.

    Therefore I would really like to just fix the tab content script if possible.

    Thanks though!
    Matt

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

    Default

    I've installed the script and it works fine bar every now and then when you go on to the page and all the content is in one long list rather than hidden behind the tabs. This disappears if you refresh the page, and if you return to the page later it will probably be ok...
    There's no bug in the script itself that can cause this sort of instability- either it always works, or it doesn't. The two possible culprits are:

    1) The CSS associated with this script (tabcontent.css) isn't always loaded properly when the page first loads for some reason. It is this CSS file that hides the tabs contents initially.

    2) The call to initalize the script (initializetabcontent) isn't always called when the page first loads. The only reason this might happen is if you have some other JavaScript on the page that's throwing errors every once in a while. When it does, the browser halts all other JavaScripts from being called, indirectly affecting this script as well.

    If you're still having problems, a link to the problem page might be helpful.

  6. #6
    Join Date
    May 2007
    Location
    England, UK
    Posts
    235
    Thanks
    3
    Thanked 6 Times in 6 Posts

    Default

    If you use php you could create just one external page for every single tab on your website!
    I do the same.
    For the tab link you would have something like
    HTML Code:
    <a href="externalpage.php?content=whatever&id=1">TAB 1</a>
    Then on the external page you would use the query (content=whatever and id=1) to call the content from a database (e.g. MySQL).

  7. #7
    Join Date
    May 2005
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks guys,

    DD Admin, I've PM'd you with a link to the website, as I can't make it public just yet.

    I've put all the CSS associated with the tabs into my main CSS, rather than as a separate file.

    Your help would be appreciated!

    Many thanks,
    Matt

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

    Default

    l've checked your page. The css for ".tabcontent" needs the following in red:



    Code:
    .tabcontent{margin-top: 35px; display:none}

  9. #9
    Join Date
    May 2005
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Excellent!! Thank you so much.

    One last thing. Say I'm on my second tab and then I go to another page which also has the tabs on, ableit different content, how comes it starts on the second tab, rather than going back to the first one like it should?

    Thanks!
    Matt

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

    Default

    If you have persistence turned on (it's on by default inside the .js file), plus the two Tab Content scripts on the two pages both use the same ID for the UL element of the Tabs, then the script thinks the two are the same, with one Tab's persisted state transferring over to the other.

    If you don't wish this to happen, give the Tab Content script on the other page a different ID.

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
  •