Results 1 to 5 of 5

Thread: Tab Content Script -- remove bottom border on active tab

  1. #1
    Join Date
    Jun 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Tab Content Script -- remove bottom border on active tab

    =====
    Script: Tab Content
    http://www.dynamicdrive.com/dynamici...tabcontent.htm
    =====

    My question is how to remove the bottom border on an active tab to make it look connected to the body section AND put the bottom border back on an inactive tab. I've tried various things with z-index and border-bottom but I've been having issues -- e.g. I can get the bottom border to go away but it also goes away on inactive tabs. Anyone have a solution? It'd be greatly appreciated.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Using the demo 'right out of the box' with the optional persistence feature, add to the '#tablist li' style declaration so it looks like this:
    Code:
    #tablist li{
    list-style: none;
    display: inline;
    margin: 0;
    position:relative;
    }
    Then in the script where it says:
    Code:
    tabobjlinks[i].style.backgroundColor=initTabcolor
    add these two lines beneath that line:
    Code:
    for (i=0; i<tabobjlis.length; i++)
    tabobjlis[i].style.top=0
    then below this line:
    Code:
    aobject.style.backgroundColor=document.getElementById("tabcontentcontainer").style.backgroundColor=themecolor
    add this one:
    Code:
    aobject.parentNode.style.top='1px'
    Finally, below this line:
    Code:
    tabobjlinks=tabobj.getElementsByTagName("A")
    add this one:
    Code:
    tabobjlis=tabobj.getElementsByTagName("li")
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Jun 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up

    thank you jscheuer1!!!

    is it possible to make the active tab the same height as before (i.e. is there a way to increase the height on the bottom rather than shifting the position 1px down?)
    Last edited by keleh; 06-29-2005 at 04:24 AM.

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I thought about that and realized that with normal tabbed file folders in a file cabinet, the 'active' tab usually is lower than those behind it. Anyway, the effect you describe can be achieved by basically starting over with our modifications, except we still need that position:relative; that we added to:
    Code:
    #tablist li{
    list-style: none;
    display: inline;
    margin: 0;
    position:relative;
    }
    Now, working from an otherwise fresh copy of the script and only within the function called 'highlighttab', add to this line a curly bracket changing it from:
    Code:
    for (i=0; i<tabobjlinks.length; i++)
    to:
    Code:
    for (i=0; i<tabobjlinks.length; i++){
    after this line:
    Code:
    tabobjlinks[i].style.backgroundColor=initTabcolor
    add these two lines:
    Code:
    tabobjlinks[i].style.borderBottom='none'
    }
    Finally, after this line:
    Code:
    aobject.style.backgroundColor=document.getElementById("tabcontentcontainer").style.backgroundColor=themecolor
    add this one:
    Code:
    aobject.style.borderBottom='1px solid '+themecolor
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Jun 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you jscheuer1, you're incredible

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
  •