The forum of the forums

Would you like to react to this message? Create an account in a few clicks or log in to continue.
The forum of the forums
4 posters

    Expand/Collapse (Toggle) Widgets

    Van-Helsing
    Van-Helsing
    Hyperactive


    Male Posts : 2431
    Reputation : 116
    Language : English, Greek

    Solved Expand/Collapse (Toggle) Widgets

    Post by Van-Helsing Fri 15 Nov - 3:03

    Good morning dear all,
    How can I add the toggle button in my forum widgets I have add it to forum categories and I want to place it in my forum widgets. My Forum Version is phpbb2

    Picture example of button:

    Expand/Collapse (Toggle) Widgets Po08

    Best Regards,
    Dark-Avenger


    Last edited by Dark-Avenger on Wed 4 Dec - 2:54; edited 1 time in total
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51498
    Reputation : 3523
    Language : English
    Location : United States

    Solved Re: Expand/Collapse (Toggle) Widgets

    Post by SLGray Fri 15 Nov - 6:02




    Expand/Collapse (Toggle) Widgets Slgray10

    When your topic has been solved, ensure you mark the topic solved.
    Never post your email in public.
    Van-Helsing
    Van-Helsing
    Hyperactive


    Male Posts : 2431
    Reputation : 116
    Language : English, Greek

    Solved Re: Expand/Collapse (Toggle) Widgets

    Post by Van-Helsing Sat 16 Nov - 19:43

    Hi all,
    SLGray I need this button of the picture for per widget, the example which you posted hides/shows all of the Widget Bar. Can we make the code like the categories toggler?

    Best Regards,
    Dark-Avenger
    Van-Helsing
    Van-Helsing
    Hyperactive


    Male Posts : 2431
    Reputation : 116
    Language : English, Greek

    Solved Re: Expand/Collapse (Toggle) Widgets

    Post by Van-Helsing Mon 18 Nov - 12:20

    bump
    avatar
    romanzo
    Forumember


    Posts : 75
    Reputation : 3
    Language : English

    Solved Re: Expand/Collapse (Toggle) Widgets

    Post by romanzo Mon 18 Nov - 12:58

    Hi, I believe avacweb have a code for that.
    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13207
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

    Solved Re: Expand/Collapse (Toggle) Widgets

    Post by Ange Tuteur Mon 18 Nov - 18:09

    romanzo wrote:Hi, I believe avacweb have a code for that.
    romanzo,

    Please refrain from posting if you're not going to provide the user with information that is helpful.

    Dark-Avenger,

    May I see the script you're using? I may be able to rework it for your widgets.
    Van-Helsing
    Van-Helsing
    Hyperactive


    Male Posts : 2431
    Reputation : 116
    Language : English, Greek

    Solved Re: Expand/Collapse (Toggle) Widgets

    Post by Van-Helsing Wed 4 Dec - 2:07

    SethC1995 wrote:
    romanzo wrote:Hi, I believe avacweb have a code for that.
    romanzo,

    Please refrain from posting if you're not going to provide the user with information that is helpful.

    Dark-Avenger,

    May I see the script you're using? I may be able to rework it for your widgets.
    Good Morning SethC1995
    I am using this javascript:
    Code:

    $(function(){
            $('#content-container .secondarytitle').parent().append('<span class="toggles"><img src="http://i57.servimg.com/u/f57/18/10/12/74/cat_mi10.png"/></span>');
            var heads = $('#content-container .secondarytitle').parent();
            for(var i=0;i<heads.length;i++){
            $(heads[i]).attr({
            id:'cat'+i,
            class: 'parent'
            });
            }
            var cookie = ReadCookie('catTog').split(',');
            for(var j=0;j<cookie.length;j++){
            $(cookie[j]).nextAll('tr').css('display','none');
            $(cookie[j]).find('.toggles').children('img').attr('src','http://i57.servimg.com/u/f57/18/10/12/74/cat_ma10.png');
            }
            $('.toggles').on('click',function() {
            var g = $(this).closest('.parent').nextAll('tr').css('display');
            cookieList = ReadCookie('catTog');
            if(g == "table-row") {
            var cid= $(this).closest('.parent').attr('id');
            $(this).closest('.parent').nextAll('tr').hide();
            SetCookie("catTog",cookieList+",#"+cid,1000);
            $(this).children('img').attr('src','http://i57.servimg.com/u/f57/18/10/12/74/cat_ma10.png');
            } else {
            KillCookie("catTog");
            var newCookie=[],
            a= $('.parent').nextAll('tr').filter(":hidden"),
            c = $.map(a,function(n,i){
            return "#"+$(a).closest('.parent').attr('id');
            });
            newCookie= c.join(',');
                SetCookie('catTog',newCookie, 100);
            $(this).children('img').attr('src','http://i57.servimg.com/u/f57/18/10/12/74/cat_mi10.png').parent().parent().parent().children('tr').not(":eq(0)").show();
            }
            });
            });
            function SetCookie(cookieName,cookieValue,nDays) {
            var today = new Date();
            var expire = new Date();
            if (nDays===null || nDays===0) nDays=1;
            expire.setTime(today.getTime() + 3600000*24*nDays);
            document.cookie = cookieName+"="+escape(cookieValue)+ ";expires="+expire.toGMTString();
            }
            function ReadCookie(cookieName) {
            var theCookie=""+document.cookie;
            var ind=theCookie.indexOf(cookieName+"=");
            if (ind===-1 || cookieName==="") return "";
            var ind1=theCookie.indexOf(";",ind);
            if (ind1==-1) ind1=theCookie.length;
            return unescape(theCookie.substring(ind+cookieName.length+1,ind1));
            }
            function KillCookie(cookieName){SetCookie(cookieName,"",-1);}
    and the necessary CSS Code.

    Best Regards,
    Dark-Avenger
    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13207
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

    Solved Re: Expand/Collapse (Toggle) Widgets

    Post by Ange Tuteur Wed 4 Dec - 2:27

    Done Wink

    It is for right column forum widgets.

    Script for modules:
    Code:
       $(function(){
                $('#content-container #right td.catLeft').parent().append('<span class="modtoggles"><img src="http://i57.servimg.com/u/f57/18/10/12/74/cat_mi10.png"/></span>');
                var heads = $('#content-container #right td.catLeft').parent();
                for(var i=0;i<heads.length;i++){
                $(heads[i]).attr({
                id:'cat'+i,
                class: 'parent'
                });
                }
                var cookie = ReadCookie('catTog').split(',');
                for(var j=0;j<cookie.length;j++){
                $(cookie[j]).nextAll('tr').css('display','none');
                $(cookie[j]).find('.modtoggles').children('img').attr('src','http://i57.servimg.com/u/f57/18/10/12/74/cat_ma10.png');
                }
                $('.modtoggles').on('click',function() {
                var g = $(this).closest('.parent').nextAll('tr').css('display');
                cookieList = ReadCookie('catTog');
                if(g == "table-row") {
                var cid= $(this).closest('.parent').attr('id');
                $(this).closest('.parent').nextAll('tr').hide();
                SetCookie("catTog",cookieList+",#"+cid,1000);
                $(this).children('img').attr('src','http://i57.servimg.com/u/f57/18/10/12/74/cat_ma10.png');
                } else {
                KillCookie("catTog");
                var newCookie=[],
                a= $('.parent').nextAll('tr').filter(":hidden"),
                c = $.map(a,function(n,i){
                return "#"+$(a).closest('.parent').attr('id');
                });
                newCookie= c.join(',');
                    SetCookie('catTog',newCookie, 100);
                $(this).children('img').attr('src','http://i57.servimg.com/u/f57/18/10/12/74/cat_mi10.png').parent().parent().parent().children('tr').not(":eq(0)").show();
                }
                });
                });
                function SetCookie(cookieName,cookieValue,nDays) {
                var today = new Date();
                var expire = new Date();
                if (nDays===null || nDays===0) nDays=1;
                expire.setTime(today.getTime() + 3600000*24*nDays);
                document.cookie = cookieName+"="+escape(cookieValue)+ ";expires="+expire.toGMTString();
                }
                function ReadCookie(cookieName) {
                var theCookie=""+document.cookie;
                var ind=theCookie.indexOf(cookieName+"=");
                if (ind===-1 || cookieName==="") return "";
                var ind1=theCookie.indexOf(";",ind);
                if (ind1==-1) ind1=theCookie.length;
                return unescape(theCookie.substring(ind+cookieName.length+1,ind1));
                }
                function KillCookie(cookieName){SetCookie(cookieName,"",-1);}
    CSS for modules:
    Code:
    .modtoggles {
        position: absolute;
        right: 15px;
        top: 9px;
    }
    Van-Helsing
    Van-Helsing
    Hyperactive


    Male Posts : 2431
    Reputation : 116
    Language : English, Greek

    Solved Re: Expand/Collapse (Toggle) Widgets

    Post by Van-Helsing Wed 4 Dec - 2:53

    Thank you very much SethC1995 its works perfect :wouhou:

    Solved! Smile 

    Best Regards,
    Dark-Avenger
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51498
    Reputation : 3523
    Language : English
    Location : United States

    Solved Re: Expand/Collapse (Toggle) Widgets

    Post by SLGray Wed 4 Dec - 3:00

    Topic Solved & Locked



    Expand/Collapse (Toggle) Widgets Slgray10

    When your topic has been solved, ensure you mark the topic solved.
    Never post your email in public.

      Current date/time is Sun 22 Sep - 18:35