Board Logo

 Username:    Password:    Stay logged in: Welcome Guest. Please Login or Register.  Sep 24th, 2017, 05:28am

Coding Forum
Important News
Remember to add where the code goes in the headers/footers.

Also, please check the list of codes on the Hacks board, especially if you have an error. The code may already have been corrected.
Thanks.
Welcome to the Conforums Hacks Board!

Please follow these simple rules.

1. No spamming.
2. Do not advertise your board in here!
3. Keep on topic, or the thread will be locked.
4. No flame wars.
5. No bringing up old topics.

Please note: For codes other than those submitted in the Hacks Forum, please ask for permission to use from the creator. Be aware that coding queries in the Coding Forum become public domain. If you still seek coding help but find it inconvenient to display it publicly then please PM one of the moderators. We encourage all queries to be submitted here in hopes to help other members who might have the same question. Thank you.

Helpful sites
Google
Dynamic Drive

The Staff
Roger
Dave
Gizzy



« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Tabbed Catagories?  (Read 1053 times)
Mai
Member


member is offline

Avatar




PM


Posts: 2
xx Tabbed Catagories?
« Thread started on: Nov 4th, 2013, 5:52pm »

I would like to have a code that files all the Categories of my board in a tab bar at the top of my forum. The default page would be the general information page, but it would only show that one category.

What I am getting at is I need a tabbed category bar so that we can have multiple categories and boards without having it clutter the page by filing one after another on the main page, thus making it very long so you have to scroll all the way down.

Clicking a category title on the bar would bring you to that category's page and it's boards, but you would see no other category.


Do you get what I'm saying? I wish I had a board example to show you, but I have forgotten them.
User IP Logged

Dalton
Ex-Shiny Gold Star Club Member
Conforums Administrator


member is offline

Avatar



AIM
Homepage PM

Gender: Male
Posts: 1764
xx Re: Tabbed Catagories?
« Reply #1 on: Nov 5th, 2013, 03:35am »

While note exactly what youre looking for I am at the airport about to go on vacation, this allows your users to collapse categories and expand them by clicking the cell itself.

Main footers.
Code:
<script>
// Hide/Show Categories with Remembering v2 by CD
// Do not redistribute without permission of the creator

var hidden = "http://www.conforums.com/boardimages/menu/home.gif"; // Shown when hidden
var shown = "http://www.conforums.com/boardimages/menu/search.gif"; // Shown when visible


// Do not edit below here
// Vars
var aTD = document.getElementsByTagName("TD");

// Preload
document.write("<img src='"+hidden+"' border='0' style='display: none;' /><img src='"+shown+"' border='0' style='display: none;' />");

// Cookie stuff
function getCookieVal(offset) {
    var endstr = document.cookie.indexOf(";",offset);
    endstr = (endstr==-1?document.cookie.length:endstr);
    return document.cookie.substring(offset,endstr);
}
function GetCookie(name) {
    var arg = name+"=";
    var alen = arg.length;
    var clen = document.cookie.length;
    var i = 0;
    var data_2 = "";
    while(i < clen) {
        var j = i + alen;
        if(document.cookie.substring(i,j) == arg)
            data_2 += getCookieVal (j);
        i = document.cookie.indexOf(" ",i) + 1;
        if(i==0)
            break;
    }
    return data_2;
}
function SetCookie(name,value){
    expires = new Date();
    document.cookie = name+"="+value+"; expires="+expires.toGMTString().replace(/\d{4}/i,"2050");
}

// Code
if((GetCookie("hideShow")) && (location.href.match(/action=home$/i) || !location.href.match(/action=|board=/i))){
    var cook = GetCookie("hideShow");
    for(a=4;a<aTD.length;a++){
        if(aTD[a].className == "catbg" && aTD[a].getElementsByTagName("A")[0] && aTD[a].getElementsByTagName("A")[0].name){
            var image = new Image();
            image.style.display = "none";

            if(cook.match(new RegExp("\\s"+aTD[a].getElementsByTagName("A")[0].name,"i"))){
                image.src = hidden;
                for(b=a+1;b<aTD.length;b++){
                    if(aTD[b].width == "66%")
                        aTD[b].parentNode.style.display = "none";
                    else if(!aTD[b].className.match(/windowbg/i)){
                        extol = true;
                        break;
                    }
                }
            } else {
                image.src = shown;
                extol = false;
            }
            image.onclick = function(){ hideShow(this); };
            aTD[a].onclick = function(){ hideShow(this.firstChild); };
            aTD[a].insertBefore(image,aTD[a].firstChild);
            a = (extol?b-2:a);
        }
    }
} else if(!(GetCookie("hideShow"))){
    SetCookie("hideShow","-");
}

function hideShow(ext){
    newStatus = (ext.src==hidden?"":"none");
    if(ext.src == hidden)
        SetCookie("hideShow",GetCookie("hideShow").replace(new RegExp("\\s"+ext.parentNode.getElementsByTagName("A")[0].name,"i")));
    else
        SetCookie("hideShow",GetCookie("hideShow")+" "+ext.parentNode.getElementsByTagName("A")[0].name+" ");

    for(a=0;a<aTD.length;a++){
        if(aTD[a].innerHTML == ext.parentNode.innerHTML){
            for(b=a+1;b<aTD.length;b++){
                if(aTD[b].width == "66%")
                    aTD[b].parentNode.style.display = newStatus;
                else if(!aTD[b].className.match(/windowbg/i))
                    break;
            }
            break;
        }
    }
    ext.src = (ext.src == hidden?shown:hidden);
}

</script> 



This will allow your users to collapse any categories they arent using and it creates a cookie to remember it.
« Last Edit: Nov 5th, 2013, 03:37am by Dalton » User IP Logged

User Image
Mai
Member


member is offline

Avatar




PM


Posts: 2
xx Re: Tabbed Catagories?
« Reply #2 on: Nov 5th, 2013, 5:45pm »

I think this might work! Thanks, I'm going to try it out now :>

-- If you ever do find that code I'm looking for though, please tell me. Much appreciated!
« Last Edit: Nov 5th, 2013, 5:50pm by Mai » User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

Back To Top
Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls