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.

Expand/Collapse (Toggle) Widgets

4 posters

Go down

Solved Expand/Collapse (Toggle) Widgets

Post by Van-Helsing November 15th 2013, 2:03 am

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 December 4th 2013, 1:54 am; edited 1 time in total
Van-Helsing
Van-Helsing
Hyperactive

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

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: Expand/Collapse (Toggle) Widgets

Post by SLGray November 15th 2013, 5:02 am



Expand/Collapse (Toggle) Widgets Slgray10

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

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

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

Solved Re: Expand/Collapse (Toggle) Widgets

Post by Van-Helsing November 16th 2013, 6:43 pm

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

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: Expand/Collapse (Toggle) Widgets

Post by Van-Helsing November 18th 2013, 11:20 am

bump
Van-Helsing
Van-Helsing
Hyperactive

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

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: Expand/Collapse (Toggle) Widgets

Post by romanzo November 18th 2013, 11:58 am

Hi, I believe avacweb have a code for that.
avatar
romanzo
Forumember

Posts : 75
Reputation : 3
Language : English

Back to top Go down

Solved Re: Expand/Collapse (Toggle) Widgets

Post by Ange Tuteur November 18th 2013, 5:09 pm

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.
Ange Tuteur
Ange Tuteur
Forumaster

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

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: Expand/Collapse (Toggle) Widgets

Post by Van-Helsing December 4th 2013, 1:07 am

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
Van-Helsing
Van-Helsing
Hyperactive

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

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: Expand/Collapse (Toggle) Widgets

Post by Ange Tuteur December 4th 2013, 1:27 am

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;
}
Ange Tuteur
Ange Tuteur
Forumaster

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

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: Expand/Collapse (Toggle) Widgets

Post by Van-Helsing December 4th 2013, 1:53 am

Thank you very much SethC1995 its works perfect :wouhou:

Solved! Smile 

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

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

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: Expand/Collapse (Toggle) Widgets

Post by SLGray December 4th 2013, 2:00 am

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.
SLGray
SLGray
Administrator
Administrator

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

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum